From 1d443ccd8505687fa3f0f76949a7154a8a5a9f6d Mon Sep 17 00:00:00 2001 From: Matteo Alessani Date: Tue, 29 Jul 2025 11:23:09 +0200 Subject: [PATCH] feat: add option to hide item codes and returns on MFEs --- .../src/getMfeConfig.test.ts | 62 +++++++++++++++++++ .../organization-config/src/schema/types.ts | 20 ++++++ 2 files changed, 82 insertions(+) diff --git a/packages/organization-config/src/getMfeConfig.test.ts b/packages/organization-config/src/getMfeConfig.test.ts index c239ba4..e188bea 100644 --- a/packages/organization-config/src/getMfeConfig.test.ts +++ b/packages/organization-config/src/getMfeConfig.test.ts @@ -216,6 +216,68 @@ describe("getMfeConfig function", () => { expect(config?.language).toBe("en-US") }) + it("should handle hide item code on checkout", () => { + const config = getMfeConfig({ + jsonConfig: { + mfe: { + default: { + checkout: { + hide_item_codes: true, + }, + }, + }, + }, + }) + expect(config?.checkout?.hide_item_codes).toBe(true) + }) + + it("should handle hide item code on cart", () => { + const config = getMfeConfig({ + jsonConfig: { + mfe: { + default: { + cart: { + hide_item_codes: true, + }, + }, + }, + }, + }) + expect(config?.cart?.hide_item_codes).toBe(true) + }) + + it("should handle hide item code on microstore", () => { + const config = getMfeConfig({ + jsonConfig: { + mfe: { + default: { + microstore: { + hide_item_codes: true, + }, + }, + }, + }, + }) + expect(config?.microstore?.hide_item_codes).toBe(true) + }) + + it("should handle hide item code on my-account and hide returns", () => { + const config = getMfeConfig({ + jsonConfig: { + mfe: { + default: { + my_account: { + hide_item_codes: true, + hide_returns: true, + }, + }, + }, + }, + }) + expect(config?.my_account?.hide_item_codes).toBe(true) + expect(config?.my_account?.hide_returns).toBe(true) + }) + it("should handle language as market override", () => { const config = getMfeConfig({ jsonConfig: { diff --git a/packages/organization-config/src/schema/types.ts b/packages/organization-config/src/schema/types.ts index 139363f..fcb974e 100644 --- a/packages/organization-config/src/schema/types.ts +++ b/packages/organization-config/src/schema/types.ts @@ -88,6 +88,7 @@ export interface MfeConfig { * Settings for the Checkout micro front end. */ checkout?: { + hide_item_codes?: boolean thankyou_page?: Url optional_billing_info?: boolean billing_countries?: StateCountry @@ -106,6 +107,25 @@ export interface MfeConfig { [k: string]: StateCountry3 } } + /** + * Settings for the Cart micro front end. + */ + cart?: { + hide_item_codes?: boolean + } + /** + * Settings for the microstore micro front end. + */ + microstore?: { + hide_item_codes?: boolean + } + /** + * Settings for the my-account micro front end. + */ + my_account?: { + hide_item_codes?: boolean + hide_returns?: boolean + } /** * Checkout internal links settings. */