From 6d2f429ab3b75e7c5eb3ddf673928b8ec73f1639 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 15:37:27 -0700 Subject: [PATCH 01/49] Initial Commit --- packages/pwa-kit-create-app/assets/plugin-config.js | 3 +++ .../template-chakra-storefront/src/pages/account/index.jsx | 3 +++ .../src/pages/account/wishlist/index.test.js | 1 + packages/template-chakra-storefront/src/routes.tsx | 7 ++++--- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/pwa-kit-create-app/assets/plugin-config.js b/packages/pwa-kit-create-app/assets/plugin-config.js index f7d3c03089..5b6add7f2d 100644 --- a/packages/pwa-kit-create-app/assets/plugin-config.js +++ b/packages/pwa-kit-create-app/assets/plugin-config.js @@ -14,6 +14,9 @@ module.exports = { plugins: { + SFDC_EXT_WISHLIST: { + description: 'Wishlist Extension' + }, // SFDC_EXT_HELLO_WORLD_ENABLED: { // description: 'The Hello World Extension' // }, diff --git a/packages/template-chakra-storefront/src/pages/account/index.jsx b/packages/template-chakra-storefront/src/pages/account/index.jsx index 5abb596722..0025907a8c 100644 --- a/packages/template-chakra-storefront/src/pages/account/index.jsx +++ b/packages/template-chakra-storefront/src/pages/account/index.jsx @@ -29,6 +29,7 @@ import {ChevronDownIcon, SignoutIcon} from '../../components/icons' import AccountDetail from '../../pages/account/profile' import AccountAddresses from '../../pages/account/addresses' import AccountOrders from '../../pages/account/orders' +// @sfdc-extension-line SFDC_EXT_WISHLIST import AccountWishlist from '../../pages/account/wishlist/index' import {messages, navLinks} from './constant' @@ -217,9 +218,11 @@ const Account = () => { + {/* @sfdc-extension-block-start SFDC_EXT_WISHLIST */} + {/* @sfdc-extension-block-end SFDC_EXT_WISHLIST */} diff --git a/packages/template-chakra-storefront/src/pages/account/wishlist/index.test.js b/packages/template-chakra-storefront/src/pages/account/wishlist/index.test.js index b07c3f283a..dfb55a727b 100644 --- a/packages/template-chakra-storefront/src/pages/account/wishlist/index.test.js +++ b/packages/template-chakra-storefront/src/pages/account/wishlist/index.test.js @@ -5,6 +5,7 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ import React from 'react' +// @sfdc-extension-line SFDC_EXT_WISHLIST import AccountWishlist from '.' import {renderWithProviders} from '../../../utils/test-utils' import {screen, waitFor} from '@testing-library/react' diff --git a/packages/template-chakra-storefront/src/routes.tsx b/packages/template-chakra-storefront/src/routes.tsx index 2d91d5e54f..bcd2893e13 100644 --- a/packages/template-chakra-storefront/src/routes.tsx +++ b/packages/template-chakra-storefront/src/routes.tsx @@ -45,9 +45,8 @@ const ProductList = loadable(() => import('../src/pages/product-list'), { // const StoreLocator = loadable(() => import('../src/pages/store-locator'), { // fallback // }) -const Wishlist = loadable(() => import('../src/pages/account/wishlist'), { - fallback -}) +// @sfdc-extension-line SFDC_EXT_WISHLIST +const Wishlist = loadable(() => import('../src/pages/account/wishlist'), {fallback}) const PageNotFound = loadable(() => import('../src/pages/page-not-found')) export const routes = [ @@ -121,10 +120,12 @@ export const routes = [ path: '/category/:categoryId', component: ProductList }, + // @sfdc-extension-block-start SFDC_EXT_WISHLIST { path: '/account/wishlist', component: Wishlist }, + // @sfdc-extension-block-end SFDC_EXT_WISHLIST // { // path: '/store-locator', // component: StoreLocator From 11f36b0e377fba3a9a1c85b204bf3343ba5aea4e Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 15:50:33 -0700 Subject: [PATCH 02/49] Update presets --- packages/pwa-kit-create-app/CHANGELOG.md | 1 + .../assets/plugin-config.js | 2 +- .../scripts/create-mobify-app.js | 67 ++++++++++++------- 3 files changed, 44 insertions(+), 26 deletions(-) diff --git a/packages/pwa-kit-create-app/CHANGELOG.md b/packages/pwa-kit-create-app/CHANGELOG.md index 73d9456e65..ae70b675e3 100644 --- a/packages/pwa-kit-create-app/CHANGELOG.md +++ b/packages/pwa-kit-create-app/CHANGELOG.md @@ -3,6 +3,7 @@ - Deprecate V3 Extensibility and experimental V4 Extensibility (#2573) - Move extensibility logic to generator (#2573) - Apply prettier to trimmed files (#2688) +- Add Wishlist feature extension flag [#](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/) ## v3.10.0 (Feb 18, 2025) - Add Data Cloud API configuration to `default.js`. [#2318] (https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2229) diff --git a/packages/pwa-kit-create-app/assets/plugin-config.js b/packages/pwa-kit-create-app/assets/plugin-config.js index 5b6add7f2d..c333d6d7ec 100644 --- a/packages/pwa-kit-create-app/assets/plugin-config.js +++ b/packages/pwa-kit-create-app/assets/plugin-config.js @@ -16,7 +16,7 @@ module.exports = { plugins: { SFDC_EXT_WISHLIST: { description: 'Wishlist Extension' - }, + } // SFDC_EXT_HELLO_WORLD_ENABLED: { // description: 'The Hello World Extension' // }, diff --git a/packages/pwa-kit-create-app/scripts/create-mobify-app.js b/packages/pwa-kit-create-app/scripts/create-mobify-app.js index 350a1a0332..193b7cdf97 100755 --- a/packages/pwa-kit-create-app/scripts/create-mobify-app.js +++ b/packages/pwa-kit-create-app/scripts/create-mobify-app.js @@ -278,7 +278,8 @@ const PRESETS = [ 'project.einstein.siteId': 'aaij-MobileFirst', 'project.dataCloud.appSourceId': '7ae070a6-f4ec-4def-a383-d9cacc3f20a1', 'project.dataCloud.tenantId': 'g82wgnrvm-ywk9dggrrw8mtggy.pc-rnd', - 'project.demo.enableDemoSettings': false + 'project.demo.enableDemoSettings': false, + 'project.selectedPlugins.SFDC_EXT_WISHLIST': false }, assets: ['translations'], private: false @@ -313,7 +314,8 @@ const PRESETS = [ ['project.einstein.siteId']: 'aaij-MobileFirst', ['project.dataCloud.appSourceId']: 'fb81edab-24c6-4b40-8684-b67334dfdf32', ['project.dataCloud.tenantId']: 'mmyw8zrxhfsg09lfmzrd1zjqmg', - ['project.demo.enableDemoSettings']: true // True only for presets deployed to demo environments like pwa-kit.mobify-storefront.com + ['project.demo.enableDemoSettings']: true, // True only for presets deployed to demo environments like pwa-kit.mobify-storefront.com + ['project.selectedPlugins.SFDC_EXT_WISHLIST']: false }, assets: ['translations'], private: true @@ -339,7 +341,8 @@ const PRESETS = [ 'project.einstein.siteId': 'aaij-MobileFirst', 'project.dataCloud.appSourceId': 'fb81edab-24c6-4b40-8684-b67334dfdf32', 'project.dataCloud.tenantId': 'mmyw8zrxhfsg09lfmzrd1zjqmg', - 'project.demo.enableDemoSettings': false + 'project.demo.enableDemoSettings': false, + 'project.selectedPlugins.SFDC_EXT_WISHLIST': true }, assets: ['translations'], private: true @@ -365,7 +368,8 @@ const PRESETS = [ 'project.einstein.siteId': 'aaij-MobileFirst', 'project.dataCloud.appSourceId': 'fb81edab-24c6-4b40-8684-b67334dfdf32', 'project.dataCloud.tenantId': 'mmyw8zrxhfsg09lfmzrd1zjqmg', - 'project.demo.enableDemoSettings': false + 'project.demo.enableDemoSettings': false, + 'project.selectedPlugins.SFDC_EXT_WISHLIST': true }, assets: ['translations'], private: true @@ -391,7 +395,8 @@ const PRESETS = [ 'project.dataCloud.appSourceId': 'fb81edab-24c6-4b40-8684-b67334dfdf32', 'project.dataCloud.tenantId': 'mmyw8zrxhfsg09lfmzrd1zjqmg', 'project.commerce.isSlasPrivate': true, - 'project.demo.enableDemoSettings': false + 'project.demo.enableDemoSettings': false, + 'project.selectedPlugins.SFDC_EXT_WISHLIST': false }, assets: ['translations'], private: true @@ -417,7 +422,8 @@ const PRESETS = [ 'project.commerce.isSlasPrivate': true, 'project.dataCloud.appSourceId': 'fb81edab-24c6-4b40-8684-b67334dfdf32', 'project.dataCloud.tenantId': 'mmyw8zrxhfsg09lfmzrd1zjqmg', - 'project.demo.enableDemoSettings': false + 'project.demo.enableDemoSettings': false, + 'project.selectedPlugins.SFDC_EXT_WISHLIST': false }, assets: ['translations'], private: true @@ -443,7 +449,8 @@ const PRESETS = [ 'project.commerce.isSlasPrivate': false, 'project.dataCloud.appSourceId': 'fb81edab-24c6-4b40-8684-b67334dfdf32', 'project.dataCloud.tenantId': 'mmyw8zrxhfsg09lfmzrd1zjqmg', - 'project.demo.enableDemoSettings': false + 'project.demo.enableDemoSettings': false, + 'project.selectedPlugins.SFDC_EXT_WISHLIST': false }, assets: ['translations'], private: true @@ -893,26 +900,36 @@ const main = async (opts) => { }) } - // Prompt user for plugin selection - if (Object.keys(pluginConfig?.plugins || {}).length > 0) { - const pluginChoices = Object.entries(pluginConfig.plugins).map(([key, config]) => ({ - name: config.description, - value: key - })) - - const pluginAnswers = await inquirer.prompt([ - { - type: 'checkbox', - name: 'selectedPlugins', - message: 'Which extensions would you like to enable?', - choices: pluginChoices + // load answer from context in preset object if available + // otherwise, prompt users to select extensions + if (context.answers.project?.selectedPlugins) { + Object.entries(context.answers.project.selectedPlugins).forEach(([pluginKey, enabled]) => { + if (pluginConfig?.plugins?.[pluginKey]) { + selectedPlugins[pluginKey] = enabled } - ]) - - // Convert selected plugins array to object with true values - pluginAnswers.selectedPlugins.forEach((plugin) => { - selectedPlugins[plugin] = true }) + } else { + // Prompt user for plugin selection + if (Object.keys(pluginConfig?.plugins || {}).length > 0) { + const pluginChoices = Object.entries(pluginConfig.plugins).map(([key, config]) => ({ + name: config.description, + value: key + })) + + const pluginAnswers = await inquirer.prompt([ + { + type: 'checkbox', + name: 'selectedPlugins', + message: 'Which extensions would you like to enable?', + choices: pluginChoices + } + ]) + + // Convert selected plugins array to object with true values + pluginAnswers.selectedPlugins.forEach((plugin) => { + selectedPlugins[plugin] = true + }) + } } if (!OUTPUT_DIR_FLAG_ACTIVE) { From 2a668980e336b9e767c11a13d576993ad8826b23 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 15:52:09 -0700 Subject: [PATCH 03/49] Update CHANGELOG.md --- packages/template-chakra-storefront/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/template-chakra-storefront/CHANGELOG.md b/packages/template-chakra-storefront/CHANGELOG.md index 39ec83387a..673e3887fa 100644 --- a/packages/template-chakra-storefront/CHANGELOG.md +++ b/packages/template-chakra-storefront/CHANGELOG.md @@ -2,6 +2,7 @@ - Migrate directory structure from `app/*` to `src/*` [#2693](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2693) - Upgrade to Chakra UI v3 and Decomposition on Cart, PLP, PDP and Cart [2839](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2839), [#2872](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2872), [#2878](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2878), [#2924](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2924) - Create a safe version of `` that won't break the SSR rendering [#2785](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2785) +- Convert Wishlist feature into an extension [#](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/) ## 0.1.0-extensibility-preview.4 - Fix hreflang alternate links [#2269](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2269) From 038db2595aee5ea44f110baaa8faae666e2f794d Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 15:55:17 -0700 Subject: [PATCH 04/49] Pruning Batch 1 --- packages/template-chakra-storefront/config/constants.js | 2 ++ .../src/components/_app/hooks/use-app-navigation.js | 3 +++ 2 files changed, 5 insertions(+) diff --git a/packages/template-chakra-storefront/config/constants.js b/packages/template-chakra-storefront/config/constants.js index 8f68a6d64d..5d5bc682f3 100644 --- a/packages/template-chakra-storefront/config/constants.js +++ b/packages/template-chakra-storefront/config/constants.js @@ -58,10 +58,12 @@ export const urlPartPositions = { // definitions to a common location (here), so that each message is only defined // once. +//@sfdc-extension-block-start SFDC_EXT_WISHLIST export const TOAST_MESSAGE_ADDED_TO_WISHLIST = defineMessage({ id: 'global.info.added_to_wishlist', defaultMessage: '{quantity} {quantity, plural, one {item} other {items}} added to wishlist' }) +//@sfdc-extension-block-end SFDC_EXT_WISHLIST export const TOAST_MESSAGE_ALREADY_IN_WISHLIST = defineMessage({ id: 'global.info.already_in_wishlist', diff --git a/packages/template-chakra-storefront/src/components/_app/hooks/use-app-navigation.js b/packages/template-chakra-storefront/src/components/_app/hooks/use-app-navigation.js index adae4f8f29..29b0c1af10 100644 --- a/packages/template-chakra-storefront/src/components/_app/hooks/use-app-navigation.js +++ b/packages/template-chakra-storefront/src/components/_app/hooks/use-app-navigation.js @@ -37,16 +37,19 @@ export const useAppNavigation = () => { history?.push(path) }, [buildUrl, history]) + //@sfdc-extension-block-start SFDC_EXT_WISHLIST const onWishlistClick = useCallback(() => { // Link to wishlist page if registered; Header component will show auth modal for guest users const path = buildUrl('/account/wishlist') history?.push(path) }, [buildUrl, history]) + //@sfdc-extension-block-end SFDC_EXT_WISHLIST return { onLogoClick, onCartClick, onAccountClick, + //@sfdc-extension-line SFDC_EXT_WISHLIST onWishlistClick } } From f6ed2b86f6b34e9facaeaea044496aaf23d7c299 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:01:24 -0700 Subject: [PATCH 05/49] Pruning Batch 2 --- .../src/components/_app/hooks/use-app-navigation.test.js | 3 +++ .../src/components/_app/index.jsx | 9 ++++++++- .../src/components/_app/index.test.jsx | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/template-chakra-storefront/src/components/_app/hooks/use-app-navigation.test.js b/packages/template-chakra-storefront/src/components/_app/hooks/use-app-navigation.test.js index 2b10d3d8b9..382de1fde0 100644 --- a/packages/template-chakra-storefront/src/components/_app/hooks/use-app-navigation.test.js +++ b/packages/template-chakra-storefront/src/components/_app/hooks/use-app-navigation.test.js @@ -59,6 +59,7 @@ describe('useAppNavigation', () => { expect(result.current.onLogoClick).toEqual(expect.any(Function)) expect(result.current.onCartClick).toEqual(expect.any(Function)) expect(result.current.onAccountClick).toEqual(expect.any(Function)) + //@sfdc-extension-line SFDC_EXT_WISHLIST expect(result.current.onWishlistClick).toEqual(expect.any(Function)) }) @@ -89,6 +90,7 @@ describe('useAppNavigation', () => { expect(mockHistory.push).toHaveBeenCalledWith('/account') }) + //@sfdc-extension-block-start SFDC_EXT_WISHLIST test('handles wishlist click navigation', () => { const {result} = renderHook(() => useAppNavigation()) @@ -97,6 +99,7 @@ describe('useAppNavigation', () => { expect(mockLocalization.buildUrl).toHaveBeenCalledWith('/account/wishlist') expect(mockHistory.push).toHaveBeenCalledWith('/account/wishlist') }) + //@sfdc-extension-block-end SFDC_EXT_WISHLIST test('handles multiple navigation calls', () => { const {result} = renderHook(() => useAppNavigation()) diff --git a/packages/template-chakra-storefront/src/components/_app/index.jsx b/packages/template-chakra-storefront/src/components/_app/index.jsx index d98c1c143f..f1b6d94b1e 100644 --- a/packages/template-chakra-storefront/src/components/_app/index.jsx +++ b/packages/template-chakra-storefront/src/components/_app/index.jsx @@ -47,7 +47,13 @@ const App = (props) => { const {getTokenWhenReady, authModal} = useAppAuth() const {targetLocale, messages, site, locale, buildUrl, currency, appOrigin} = useAppLocalization() - const {onLogoClick, onCartClick, onAccountClick, onWishlistClick} = useAppNavigation() + const { + onLogoClick, + onCartClick, + onAccountClick, + //@sfdc-extension-line SFDC_EXT_WISHLIST + onWishlistClick + } = useAppNavigation() const { isDrawerMenuOpen, onDrawerMenuOpen, @@ -81,6 +87,7 @@ const App = (props) => { onLogoClick, onMyCartClick: onCartClick, onMyAccountClick: onAccountClick, + //@sfdc-extension-line SFDC_EXT_WISHLIST onWishlistClick, // TODO: Will be enabled when store locator feature is ready // onStoreLocatorClick: onOpenStoreLocator, diff --git a/packages/template-chakra-storefront/src/components/_app/index.test.jsx b/packages/template-chakra-storefront/src/components/_app/index.test.jsx index 960ef39ade..cedf2e758c 100644 --- a/packages/template-chakra-storefront/src/components/_app/index.test.jsx +++ b/packages/template-chakra-storefront/src/components/_app/index.test.jsx @@ -41,6 +41,7 @@ jest.mock('./hooks', () => ({ onLogoClick: jest.fn(), onCartClick: jest.fn(), onAccountClick: jest.fn(), + //@sfdc-extension-line SFDC_EXT_WISHLIST onWishlistClick: jest.fn() })), useAppModals: jest.fn(() => ({ From ab745aaf9de02ccc31bda3f78284a31b2e3340a0 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:15:22 -0700 Subject: [PATCH 06/49] Pruning Batch 3 --- .../src/components/_app/partials/app-header.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/template-chakra-storefront/src/components/_app/partials/app-header.jsx b/packages/template-chakra-storefront/src/components/_app/partials/app-header.jsx index 0a8241dc09..f83290d6f0 100644 --- a/packages/template-chakra-storefront/src/components/_app/partials/app-header.jsx +++ b/packages/template-chakra-storefront/src/components/_app/partials/app-header.jsx @@ -23,6 +23,7 @@ const AppHeader = ({ onLogoClick, onMyCartClick, onMyAccountClick, + //@sfdc-extension-line SFDC_EXT_WISHLIST onWishlistClick, onStoreLocatorClick, mobileNavigationProps @@ -36,6 +37,7 @@ const AppHeader = ({ onLogoClick={onLogoClick} onMyCartClick={onMyCartClick} onMyAccountClick={onMyAccountClick} + //@sfdc-extension-line SFDC_EXT_WISHLIST onWishlistClick={onWishlistClick} onStoreLocatorClick={onStoreLocatorClick} > @@ -56,6 +58,7 @@ AppHeader.propTypes = { onLogoClick: PropTypes.func.isRequired, onMyCartClick: PropTypes.func.isRequired, onMyAccountClick: PropTypes.func.isRequired, + //@sfdc-extension-line SFDC_EXT_WISHLIST onWishlistClick: PropTypes.func.isRequired, onStoreLocatorClick: PropTypes.func.isRequired, mobileNavigationProps: PropTypes.object.isRequired From 1820ee5b11e26fe7baf157f0458fa2768cff193c Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:16:56 -0700 Subject: [PATCH 07/49] Pruning Batch 4 --- .../src/components/_app/partials/app-header.test.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/template-chakra-storefront/src/components/_app/partials/app-header.test.jsx b/packages/template-chakra-storefront/src/components/_app/partials/app-header.test.jsx index e7ebc28113..b8f3d2cb4a 100644 --- a/packages/template-chakra-storefront/src/components/_app/partials/app-header.test.jsx +++ b/packages/template-chakra-storefront/src/components/_app/partials/app-header.test.jsx @@ -24,8 +24,10 @@ jest.mock('../../header', () => { typeof props.onMyCartClick === 'function' ? 'function' : props.onMyCartClick, onMyAccountClick: typeof props.onMyAccountClick === 'function' ? 'function' : props.onMyAccountClick, + //@sfdc-extension-block-start SFDC_EXT_WISHLIST onWishlistClick: typeof props.onWishlistClick === 'function' ? 'function' : props.onWishlistClick, + //@sfdc-extension-block-end SFDC_EXT_WISHLIST onStoreLocatorClick: typeof props.onStoreLocatorClick === 'function' ? 'function' @@ -90,6 +92,7 @@ describe('AppHeader', () => { onMenuClick: jest.fn(), onLogoClick: jest.fn(), onMyCartClick: jest.fn(), + //@sfdc-extension-line SFDC_EXT_WISHLIST onMyAccountClick: jest.fn(), onWishlistClick: jest.fn(), onStoreLocatorClick: jest.fn(), @@ -134,6 +137,7 @@ describe('AppHeader', () => { expect(headerProps.onLogoClick).toBe('function') expect(headerProps.onMyCartClick).toBe('function') expect(headerProps.onMyAccountClick).toBe('function') + //@sfdc-extension-line SFDC_EXT_WISHLIST expect(headerProps.onWishlistClick).toBe('function') }) From afe7bee10b1f155a0ee952e097cfe90bce2f4c89 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:23:56 -0700 Subject: [PATCH 08/49] Possible issue? --- .../src/components/header/index.jsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/template-chakra-storefront/src/components/header/index.jsx b/packages/template-chakra-storefront/src/components/header/index.jsx index 5563a37f5c..9cf3cbd1aa 100644 --- a/packages/template-chakra-storefront/src/components/header/index.jsx +++ b/packages/template-chakra-storefront/src/components/header/index.jsx @@ -109,6 +109,7 @@ const Header = ({ onMyAccountClick = noop, onLogoClick = noop, onMyCartClick = noop, + //@sfdc-extension-line SFDC_EXT_WISHLIST onWishlistClick = noop, onStoreLocatorClick = noop, ...props @@ -168,10 +169,12 @@ const Header = ({ defaultMessage: 'Log out', id: 'header.popover.action.log_out' }), + //@sfdc-extension-block-start SFDC_EXT_WISHLIST wishlist: formatMessage({ defaultMessage: 'Wishlist', id: 'header.button.assistive_msg.wishlist' }), + //@sfdc-extension-block-end SFDC_EXT_WISHLIST storeLocator: formatMessage({ defaultMessage: 'Store Locator', id: 'header.button.assistive_msg.store_locator' @@ -319,6 +322,7 @@ const Header = ({ )} + {/* @sfdc-extension-block-start SFDC_EXT_WISHLIST */} + {/* @sfdc-extension-block-end SFDC_EXT_WISHLIST */} {isStoreLocatorEnabled && ( Date: Fri, 8 Aug 2025 16:37:42 -0700 Subject: [PATCH 09/49] Update index.test.js --- .../src/components/header/index.test.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/template-chakra-storefront/src/components/header/index.test.js b/packages/template-chakra-storefront/src/components/header/index.test.js index 5b80a4d3c1..059f9d35f5 100644 --- a/packages/template-chakra-storefront/src/components/header/index.test.js +++ b/packages/template-chakra-storefront/src/components/header/index.test.js @@ -33,12 +33,18 @@ const MockedComponent = ({history}) => { const onAccountClick = () => { history.push(createPathWithDefaults('/account')) } + //@sfdc-extension-block-start SFDC_EXT_WISHLIST const onWishlistClick = () => { history.push(createPathWithDefaults('/account/wishlist')) } + //@sfdc-extension-block-end SFDC_EXT_WISHLIST return (
-
+
) } @@ -74,7 +80,7 @@ test('renders Header', async () => { expect(logo).toBeInTheDocument() expect(account).toBeInTheDocument() expect(cart).toBeInTheDocument() - // Note: Wishlist button is currently commented out in the header component + //@sfdc-extension-line SFDC_EXT_WISHLIST // expect(wishlist).toBeInTheDocument() expect(searchInput).toBeInTheDocument() }) From b5adbb037ba6f019ba9f1fc88a56d55f8e400c7f Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:38:42 -0700 Subject: [PATCH 10/49] Update data.mock.js --- .../src/components/item-variant/data.mock.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/template-chakra-storefront/src/components/item-variant/data.mock.js b/packages/template-chakra-storefront/src/components/item-variant/data.mock.js index 9c7a51c064..e16560670d 100644 --- a/packages/template-chakra-storefront/src/components/item-variant/data.mock.js +++ b/packages/template-chakra-storefront/src/components/item-variant/data.mock.js @@ -428,6 +428,7 @@ export const cartVariant = { isProductUnavailable: false } +//@sfdc-extension-block-start SFDC_EXT_WISHLIST export const wishlistVariant = { currency: 'GBP', id: '701643563814M', @@ -762,3 +763,4 @@ export const wishlistVariant = { c_width: 'Z', quantity: 5 } +//@sfdc-extension-block-end SFDC_EXT_WISHLIST \ No newline at end of file From 3936555cbd9348116fb0c58791d4dbcd0760a06e Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:39:24 -0700 Subject: [PATCH 11/49] Update index.test.js --- .../src/components/item-variant/index.test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/template-chakra-storefront/src/components/item-variant/index.test.js b/packages/template-chakra-storefront/src/components/item-variant/index.test.js index f1ea9d4012..dbd394378c 100644 --- a/packages/template-chakra-storefront/src/components/item-variant/index.test.js +++ b/packages/template-chakra-storefront/src/components/item-variant/index.test.js @@ -62,6 +62,7 @@ describe('ItemPrice', function () { expect(getByText(/^£0\.00$/i)).toBeInTheDocument() }) + //@sfdc-extension-block-start SFDC_EXT_WISHLIST test('should display product prices if variant is for wishlist page on desktop', () => { useMediaQuery.mockReturnValue([true]) const {getByText, container, getAllByText} = renderWithProviders( @@ -95,4 +96,5 @@ describe('ItemPrice', function () { const strikethroughPriceTag = container.querySelector('s') expect(within(strikethroughPriceTag).getByText(/£476\.80/i)).toBeInTheDocument() }) + //@sfdc-extension-block-end SFDC_EXT_WISHLIST }) From efc9e94eda6d9203488f8c5c9a2d14c9c07b4d27 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:39:57 -0700 Subject: [PATCH 12/49] Update index.jsx --- .../src/components/product-item/index.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/template-chakra-storefront/src/components/product-item/index.jsx b/packages/template-chakra-storefront/src/components/product-item/index.jsx index 176f9f5886..e88ecf9eb9 100644 --- a/packages/template-chakra-storefront/src/components/product-item/index.jsx +++ b/packages/template-chakra-storefront/src/components/product-item/index.jsx @@ -172,6 +172,7 @@ ProductItem.propTypes = { onItemQuantityChange: PropTypes.func, onAddItemToCart: PropTypes.func, showLoading: PropTypes.bool, + //@sfdc-extension-line SFDC_EXT_WISHLIST isWishlistItem: PropTypes.bool, primaryAction: PropTypes.node, secondaryActions: PropTypes.node From 802451c69f9f78b9974d234a868bc647d6d9f43a Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:41:39 -0700 Subject: [PATCH 13/49] Update index.jsx --- .../src/components/product-tile/index.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/template-chakra-storefront/src/components/product-tile/index.jsx b/packages/template-chakra-storefront/src/components/product-tile/index.jsx index 0790acc282..68725fdd98 100644 --- a/packages/template-chakra-storefront/src/components/product-tile/index.jsx +++ b/packages/template-chakra-storefront/src/components/product-tile/index.jsx @@ -164,6 +164,7 @@ const ProductTile = (props) => { return getPriceData(productWithFilteredVariants) }, [productWithFilteredVariants]) + //@sfdc-extension-block-start SFDC_EXT_WISHLIST // Message formatting const messages = useMemo( () => ({ @@ -184,6 +185,7 @@ const ProductTile = (props) => { }), [intl, localizedProductName] ) + //@sfdc-extension-block-end SFDC_EXT_WISHLIST // Retrieve product badges const filteredLabels = useMemo(() => { @@ -290,6 +292,7 @@ const ProductTile = (props) => { )} + {/* @sfdc-extension-block-start SFDC_EXT_WISHLIST */} {enableFavourite && ( { )} + {/* @sfdc-extension-block-end SFDC_EXT_WISHLIST */} {filteredLabels.size > 0 && ( {Array.from(filteredLabels.entries()).map(([label, colorScheme]) => ( From 0ca58e39bd46357e579c1fb183689b35af20473d Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:42:21 -0700 Subject: [PATCH 14/49] Update index.jsx --- .../src/components/product-view/index.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/template-chakra-storefront/src/components/product-view/index.jsx b/packages/template-chakra-storefront/src/components/product-view/index.jsx index 94080cf1c3..f970452995 100644 --- a/packages/template-chakra-storefront/src/components/product-view/index.jsx +++ b/packages/template-chakra-storefront/src/components/product-view/index.jsx @@ -55,6 +55,7 @@ const messages = defineMessages({ defaultMessage: 'Add Bundle to Cart', id: 'product_view.button.add_bundle_to_cart' }, + //@sfdc-extension-block-start SFDC_EXT_WISHLIST addToWishlist: { defaultMessage: 'Add to Wishlist', id: 'product_view.button.add_to_wishlist' @@ -67,6 +68,7 @@ const messages = defineMessages({ defaultMessage: 'Add Bundle to Wishlist', id: 'product_view.button.add_bundle_to_wishlist' }, + //@sfdc-extension-block-end SFDC_EXT_WISHLIST quantity: { defaultMessage: 'Quantity', id: 'product_view.label.quantity' From 14faf310fb0d211c29302aa89f93e9f733ee8887 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:43:17 -0700 Subject: [PATCH 15/49] Update constant.js --- .../template-chakra-storefront/src/pages/account/constant.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/template-chakra-storefront/src/pages/account/constant.js b/packages/template-chakra-storefront/src/pages/account/constant.js index 817e2dacad..73c9753371 100644 --- a/packages/template-chakra-storefront/src/pages/account/constant.js +++ b/packages/template-chakra-storefront/src/pages/account/constant.js @@ -21,11 +21,13 @@ export const navLinks = [ path: '', icon: AccountIcon }, + //@sfdc-extension-block-start SFDC_EXT_WISHLIST { name: 'wishlist', path: '/wishlist', icon: HeartIcon }, + //@sfdc-extension-block-end SFDC_EXT_WISHLIST { name: 'orders', path: '/orders', From 11010c066f3f3a1e5078f9c3f276175a53bdd04b Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:46:28 -0700 Subject: [PATCH 16/49] Update use-product-detail-data.js --- .../src/pages/product-detail/hooks/use-product-detail-data.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/template-chakra-storefront/src/pages/product-detail/hooks/use-product-detail-data.js b/packages/template-chakra-storefront/src/pages/product-detail/hooks/use-product-detail-data.js index bb23f36656..e209eda3d1 100644 --- a/packages/template-chakra-storefront/src/pages/product-detail/hooks/use-product-detail-data.js +++ b/packages/template-chakra-storefront/src/pages/product-detail/hooks/use-product-detail-data.js @@ -20,6 +20,7 @@ import {useHistory, useLocation, useParams} from 'react-router-dom' import {useCurrentBasket, useVariant} from '../../../hooks' import useEinstein from '../../../hooks/use-einstein' +//@sfdc-extension-line SFDC_EXT_WISHLIST import {useWishList} from '../../../hooks/use-wish-list' import {normalizeSetBundleProduct, getUpdateBundleChildArray} from '../../../utils/product-utils' @@ -32,6 +33,7 @@ export const useProductDetailData = () => { const location = useLocation() const einstein = useEinstein() const showError = useErrorHandler() + //@sfdc-extension-line SFDC_EXT_WISHLIST const {addToWishlist, isPending: isWishlistLoading} = useWishList() /****************************** Basket *********************************/ @@ -323,11 +325,13 @@ export const useProductDetailData = () => { selectedBundleQuantity, setSelectedBundleQuantity, handleAddToCart, + //@sfdc-extension-line SFDC_EXT_WISHLIST handleAddToWishlist: addToWishlist, handleProductSetAddToCart, handleProductBundleAddToCart, handleChildProductValidation, isBasketLoading, + //@sfdc-extension-line SFDC_EXT_WISHLIST isWishlistLoading } } From 61996b2028651ed37c98dc046d090b79f6c37819 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:47:17 -0700 Subject: [PATCH 17/49] Update product-details-composite.jsx --- .../product-detail/partials/product-details-composite.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details-composite.jsx b/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details-composite.jsx index cd7830d057..029c958bd2 100644 --- a/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details-composite.jsx +++ b/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details-composite.jsx @@ -110,6 +110,7 @@ const CompositeProductDetails = ({ }} isProductLoading={isProductLoading} isBasketLoading={isBasketLoading} + //@sfdc-extension-line SFDC_EXT_WISHLIST isWishlistLoading={isWishlistLoading} setChildProductOrderability={setChildProductOrderability} /> @@ -133,7 +134,9 @@ CompositeProductDetails.propTypes = { isProductABundle: PropTypes.bool, isProductLoading: PropTypes.bool, isBasketLoading: PropTypes.bool, + //@sfdc-extension-line SFDC_EXT_WISHLIST isWishlistLoading: PropTypes.bool, + //@sfdc-extension-line SFDC_EXT_WISHLIST handleAddToWishlist: PropTypes.func, handleAddToCart: PropTypes.func, handleProductSetAddToCart: PropTypes.func, From 5c8b0b9b6b67748dd096d371fe0a9bdd0adc92ae Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:49:10 -0700 Subject: [PATCH 18/49] Fixed --- .../product-detail/partials/product-details-composite.jsx | 1 + .../pages/product-detail/partials/product-details-simple.jsx | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details-composite.jsx b/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details-composite.jsx index 029c958bd2..ab77a17c1c 100644 --- a/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details-composite.jsx +++ b/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details-composite.jsx @@ -24,6 +24,7 @@ const CompositeProductDetails = ({ isProductABundle, isProductLoading, isBasketLoading, + //@sfdc-extension-line SFDC_EXT_WISHLIST isWishlistLoading, handleAddToWishlist, handleAddToCart, diff --git a/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details-simple.jsx b/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details-simple.jsx index 60c6bb7ab1..e1542f9577 100644 --- a/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details-simple.jsx +++ b/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details-simple.jsx @@ -14,6 +14,7 @@ const SimpleProductDetails = ({ primaryCategory, isProductLoading, isBasketLoading, + //@sfdc-extension-line SFDC_EXT_WISHLIST isWishlistLoading, handleAddToWishlist, handleAddToCart @@ -27,6 +28,7 @@ const SimpleProductDetails = ({ addToWishlist={handleAddToWishlist} isProductLoading={isProductLoading} isBasketLoading={isBasketLoading} + //@sfdc-extension-line SFDC_EXT_WISHLIST isWishlistLoading={isWishlistLoading} /> @@ -39,7 +41,9 @@ SimpleProductDetails.propTypes = { primaryCategory: PropTypes.object, isProductLoading: PropTypes.bool, isBasketLoading: PropTypes.bool, + //@sfdc-extension-line SFDC_EXT_WISHLIST isWishlistLoading: PropTypes.bool, + //@sfdc-extension-line SFDC_EXT_WISHLIST handleAddToWishlist: PropTypes.func, handleAddToCart: PropTypes.func } From 2f16dec39cc614ca8097ee2175fc006adc0a5cda Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:50:01 -0700 Subject: [PATCH 19/49] Update product-details-simple.jsx --- .../src/pages/product-detail/partials/product-details-simple.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details-simple.jsx b/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details-simple.jsx index e1542f9577..1b56cd60cd 100644 --- a/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details-simple.jsx +++ b/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details-simple.jsx @@ -25,6 +25,7 @@ const SimpleProductDetails = ({ product={product} category={primaryCategory?.parentCategoryTree || []} addToCart={(variant, quantity) => handleAddToCart([{product, variant, quantity}])} + //@sfdc-extension-line SFDC_EXT_WISHLIST addToWishlist={handleAddToWishlist} isProductLoading={isProductLoading} isBasketLoading={isBasketLoading} From 3a72825f56651395d58c6f92e4ef32901054aa5d Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:50:33 -0700 Subject: [PATCH 20/49] Update product-details.jsx --- .../src/pages/product-detail/partials/product-details.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details.jsx b/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details.jsx index e88a309a0b..7f2ea247bf 100644 --- a/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details.jsx +++ b/packages/template-chakra-storefront/src/pages/product-detail/partials/product-details.jsx @@ -26,7 +26,9 @@ ProductDetails.propTypes = { isProductABundle: PropTypes.bool, isProductLoading: PropTypes.bool, isBasketLoading: PropTypes.bool, + //@sfdc-extension-line SFDC_EXT_WISHLIST isWishlistLoading: PropTypes.bool, + //@sfdc-extension-line SFDC_EXT_WISHLIST handleAddToWishlist: PropTypes.func, handleAddToCart: PropTypes.func, handleProductSetAddToCart: PropTypes.func, From ced6c2e1c13b937c997861b396756fac0ada9d8e Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:51:35 -0700 Subject: [PATCH 21/49] Update index.jsx --- .../src/pages/product-list/index.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/template-chakra-storefront/src/pages/product-list/index.jsx b/packages/template-chakra-storefront/src/pages/product-list/index.jsx index 374761a8d9..0589dc9d04 100644 --- a/packages/template-chakra-storefront/src/pages/product-list/index.jsx +++ b/packages/template-chakra-storefront/src/pages/product-list/index.jsx @@ -22,6 +22,7 @@ import ProductListPagination from './partials/product-list-pagination' import PageAnalytics from './page-analytics' // Hooks +//@sfdc-extension-line SFDC_EXT_WISHLIST import {useWishList} from '../../hooks/use-wish-list' import {useProductListData} from './hooks/use-product-list-data' import {useProductListControls} from './hooks/use-product-list-controls' @@ -35,6 +36,7 @@ const ProductList = () => { const { pages: {productList: productListConfig} } = getConfig() + //@sfdc-extension-line SFDC_EXT_WISHLIST const {toggleWishlist, isItemInWishlist} = useWishList() const { @@ -120,8 +122,10 @@ const ProductList = () => { productSearchResult={productSearchResult} searchParams={searchParams} productListConfig={productListConfig} + //@sfdc-extension-line SFDC_EXT_WISHLIST isItemInWishlist={isItemInWishlist} onClickProduct={handleProductClick} + //@sfdc-extension-line SFDC_EXT_WISHLIST onFavouriteToggle={toggleWishlist} /> From 40c65975234e0e5fb89b54e42ea110ae4e78f39f Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:52:28 -0700 Subject: [PATCH 22/49] Update index.test.js --- .../src/pages/product-list/index.test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/template-chakra-storefront/src/pages/product-list/index.test.js b/packages/template-chakra-storefront/src/pages/product-list/index.test.js index faef0a9a99..933cc5d277 100644 --- a/packages/template-chakra-storefront/src/pages/product-list/index.test.js +++ b/packages/template-chakra-storefront/src/pages/product-list/index.test.js @@ -165,6 +165,7 @@ describe('Product List renders properly', () => { }) }) +//@sfdc-extension-block-start SFDC_EXT_WISHLIST test('show login modal when an unauthenticated user tries to add an item to wishlist', async () => { prependHandlersToServer([ { @@ -198,6 +199,7 @@ test('show login modal when an unauthenticated user tries to add an item to wish expect(screen.getByText(/^password$/i)).toBeInTheDocument() }) }) +//@sfdc-extension-block-end SFDC_EXT_WISHLIST test('clicking a filter will change url', async () => { window.history.pushState({}, 'ProductList', '/uk/en-GB/category/mens-clothing-jackets') From 2b6ed7d13019d5f5e4f82625af150301c2a9ddd3 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:53:49 -0700 Subject: [PATCH 23/49] Update product-list-grid.jsx --- .../src/pages/product-list/partials/product-list-grid.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/template-chakra-storefront/src/pages/product-list/partials/product-list-grid.jsx b/packages/template-chakra-storefront/src/pages/product-list/partials/product-list-grid.jsx index c78ed34feb..9458ace7a6 100644 --- a/packages/template-chakra-storefront/src/pages/product-list/partials/product-list-grid.jsx +++ b/packages/template-chakra-storefront/src/pages/product-list/partials/product-list-grid.jsx @@ -16,6 +16,7 @@ const ProductListGrid = ({ isFetched, searchParams, productListConfig, + //@sfdc-extension-line SFDC_EXT_WISHLIST isItemInWishlist, onFavouriteToggle, onClickProduct @@ -31,13 +32,16 @@ const ProductListGrid = ({ .fill(0) .map((_, index) => ) : productSearchResult?.hits?.map((product) => { + //@sfdc-extension-line SFDC_EXT_WISHLIST const isInWishlist = isItemInWishlist(product) return ( Date: Fri, 8 Aug 2025 16:54:27 -0700 Subject: [PATCH 24/49] Update product-list-grid.test.js --- .../src/pages/product-list/partials/product-list-grid.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/template-chakra-storefront/src/pages/product-list/partials/product-list-grid.test.js b/packages/template-chakra-storefront/src/pages/product-list/partials/product-list-grid.test.js index 3b6e02c7dd..b10f8d2eb8 100644 --- a/packages/template-chakra-storefront/src/pages/product-list/partials/product-list-grid.test.js +++ b/packages/template-chakra-storefront/src/pages/product-list/partials/product-list-grid.test.js @@ -63,6 +63,7 @@ const mockProps = { isFetched: true, searchParams: {limit: 2}, productListConfig: {}, + //@sfdc-extension-line SFDC_EXT_WISHLIST isItemInWishlist: jest.fn(), onFavouriteToggle: jest.fn(), onClickProduct: jest.fn() From c95adde72b81b2873ffba354ccdd13e90045ca77 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:55:28 -0700 Subject: [PATCH 25/49] Update use-wish-list.test.js --- .../template-chakra-storefront/src/hooks/use-wish-list.test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/template-chakra-storefront/src/hooks/use-wish-list.test.js b/packages/template-chakra-storefront/src/hooks/use-wish-list.test.js index 7b306d0503..79c8d74a33 100644 --- a/packages/template-chakra-storefront/src/hooks/use-wish-list.test.js +++ b/packages/template-chakra-storefront/src/hooks/use-wish-list.test.js @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ - +//@sfdc-extension-block-start SFDC_EXT_WISHLIST import {renderHook, act} from '@testing-library/react' import {useIntl} from 'react-intl' import { @@ -324,3 +324,4 @@ describe('useWishList', () => { ) }) }) +//@sfdc-extension-block-end SFDC_EXT_WISHLIST \ No newline at end of file From 5bf0f938f92e6f265a61c911b8ce517c2d5db58c Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Fri, 8 Aug 2025 16:56:47 -0700 Subject: [PATCH 26/49] Update use-wish-list.js --- packages/template-chakra-storefront/src/hooks/use-wish-list.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/template-chakra-storefront/src/hooks/use-wish-list.js b/packages/template-chakra-storefront/src/hooks/use-wish-list.js index 2788f7ca4e..8d7bbd60ae 100644 --- a/packages/template-chakra-storefront/src/hooks/use-wish-list.js +++ b/packages/template-chakra-storefront/src/hooks/use-wish-list.js @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ - +//@sfdc-extension-block-start SFDC_EXT_WISHLIST import React, {useEffect, useCallback} from 'react' import {useIntl} from 'react-intl' import {Button} from '@chakra-ui/react' @@ -198,3 +198,4 @@ export const useWishList = ({listId = ''} = {}) => { ...restOfQuery } } +//@sfdc-extension-block-end SFDC_EXT_WISHLIST From d2ea6714c30714c9e93c7e19bf104f208b06aabb Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Sat, 9 Aug 2025 14:26:18 -0700 Subject: [PATCH 27/49] Update index.jsx --- .../src/components/product-view/index.jsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/template-chakra-storefront/src/components/product-view/index.jsx b/packages/template-chakra-storefront/src/components/product-view/index.jsx index f970452995..577c7c92d2 100644 --- a/packages/template-chakra-storefront/src/components/product-view/index.jsx +++ b/packages/template-chakra-storefront/src/components/product-view/index.jsx @@ -151,10 +151,13 @@ const ProductView = forwardRef( category, showFullLink = false, imageSize = 'md', + //@sfdc-extension-line SFDC_EXT_WISHLIST isWishlistLoading = false, addToCart, updateCart, + //@sfdc-extension-line SFDC_EXT_WISHLIST addToWishlist, + //@sfdc-extension-line SFDC_EXT_WISHLIST updateWishlist, isProductLoading, isProductPartOfSet = false, @@ -200,6 +203,7 @@ const ProductView = forwardRef( const priceData = useMemo(() => { return getPriceData(product, {quantity}) }, [product, quantity]) + //@sfdc-extension-line SFDC_EXT_WISHLIST const canAddToWishlist = !isProductLoading const isProductASet = product?.type.set const isProductABundle = product?.type.bundle @@ -265,9 +269,12 @@ const ProductView = forwardRef( addToCart: formatMessage(messages.addToCart), addSetToCart: formatMessage(messages.addSetToCart), addBundleToCart: formatMessage(messages.addBundleToCart), + //@sfdc-extension-block-start SFDC_EXT_WISHLIST addToWishlist: formatMessage(messages.addToWishlist), addSetToWishlist: formatMessage(messages.addSetToWishlist), addBundleToWishlist: formatMessage(messages.addBundleToWishlist) + //@sfdc-extension-block-end SFDC_EXT_WISHLIST + } const handleCartItem = async () => { @@ -286,7 +293,6 @@ const ProductView = forwardRef( const itemsAdded = await addToCart(variant, quantity) // Open modal only when `addToCart` returns some data // It's possible that the item has been added to cart, but we don't want to open the modal. - // See wishlist_primary_action for example. if (itemsAdded) { onAddToCartModalOpen({ product, @@ -299,6 +305,7 @@ const ProductView = forwardRef( } } + //@sfdc-extension-block-start SFDC_EXT_WISHLIST const handleWishlistItem = async () => { if (!updateWishlist && !addToWishlist) return null if (updateWishlist) { @@ -331,6 +338,7 @@ const ProductView = forwardRef( ) } + //@sfdc-extension-block-start SFDC_EXT_WISHLIST // child product of bundles do not have add to wishlist button if ((addToWishlist || updateWishlist) && !isProductPartOfBundle) { buttons.push( @@ -353,7 +361,7 @@ const ProductView = forwardRef( ) } - + //@sfdc-extension-block-end SFDC_EXT_WISHLIST return buttons } @@ -679,10 +687,13 @@ ProductView.propTypes = { category: PropTypes.array, isProductLoading: PropTypes.bool, isBasketLoading: PropTypes.bool, + //@sfdc-extension-line SFDC_EXT_WISHLIST isWishlistLoading: PropTypes.bool, addToCart: PropTypes.func, + //@sfdc-extension-line SFDC_EXT_WISHLIST addToWishlist: PropTypes.func, updateCart: PropTypes.func, + //@sfdc-extension-line SFDC_EXT_WISHLIST updateWishlist: PropTypes.func, showFullLink: PropTypes.bool, imageSize: PropTypes.oneOf(['sm', 'md']), From e36be83ea55f5d35238d5a839227b8bd779dc2fe Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Sat, 9 Aug 2025 14:29:19 -0700 Subject: [PATCH 28/49] Fix missing closing annotation --- .../src/components/product-view/index.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/template-chakra-storefront/src/components/product-view/index.jsx b/packages/template-chakra-storefront/src/components/product-view/index.jsx index 577c7c92d2..60f7271bd8 100644 --- a/packages/template-chakra-storefront/src/components/product-view/index.jsx +++ b/packages/template-chakra-storefront/src/components/product-view/index.jsx @@ -314,6 +314,7 @@ const ProductView = forwardRef( } addToWishlist(product, variant, quantity) } + //@sfdc-extension-block-end SFDC_EXT_WISHLIST // child product of bundles do not have add to cart button if ((addToCart || updateCart) && !isProductPartOfBundle) { From 81845edeae0c6526b4440d8e64c44b59fdeef6cf Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Sat, 9 Aug 2025 14:30:36 -0700 Subject: [PATCH 29/49] Update constants annotations. --- packages/template-chakra-storefront/config/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/template-chakra-storefront/config/constants.js b/packages/template-chakra-storefront/config/constants.js index 5d5bc682f3..39ca8bd249 100644 --- a/packages/template-chakra-storefront/config/constants.js +++ b/packages/template-chakra-storefront/config/constants.js @@ -63,7 +63,6 @@ export const TOAST_MESSAGE_ADDED_TO_WISHLIST = defineMessage({ id: 'global.info.added_to_wishlist', defaultMessage: '{quantity} {quantity, plural, one {item} other {items}} added to wishlist' }) -//@sfdc-extension-block-end SFDC_EXT_WISHLIST export const TOAST_MESSAGE_ALREADY_IN_WISHLIST = defineMessage({ id: 'global.info.already_in_wishlist', @@ -84,6 +83,7 @@ export const TOAST_MESSAGE_REMOVED_FROM_WISHLIST = defineMessage({ id: 'global.info.removed_from_wishlist', defaultMessage: 'Item removed from wishlist' }) +//@sfdc-extension-block-end SFDC_EXT_WISHLIST // Einstein recommender constants used in export const EINSTEIN_RECOMMENDERS = { From c6c5f870702cc79c53a32f2d5d05defa23e1955e Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Sat, 9 Aug 2025 14:32:28 -0700 Subject: [PATCH 30/49] Update app-header.test.jsx --- .../src/components/_app/partials/app-header.test.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/template-chakra-storefront/src/components/_app/partials/app-header.test.jsx b/packages/template-chakra-storefront/src/components/_app/partials/app-header.test.jsx index b8f3d2cb4a..68db21da13 100644 --- a/packages/template-chakra-storefront/src/components/_app/partials/app-header.test.jsx +++ b/packages/template-chakra-storefront/src/components/_app/partials/app-header.test.jsx @@ -92,8 +92,8 @@ describe('AppHeader', () => { onMenuClick: jest.fn(), onLogoClick: jest.fn(), onMyCartClick: jest.fn(), - //@sfdc-extension-line SFDC_EXT_WISHLIST onMyAccountClick: jest.fn(), + //@sfdc-extension-line SFDC_EXT_WISHLIST onWishlistClick: jest.fn(), onStoreLocatorClick: jest.fn(), mobileNavigationProps: { From aa3932d826f9f1732c6f66ede449c659adc87766 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Sat, 9 Aug 2025 14:36:10 -0700 Subject: [PATCH 31/49] Update index.jsx --- .../template-chakra-storefront/src/components/header/index.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/template-chakra-storefront/src/components/header/index.jsx b/packages/template-chakra-storefront/src/components/header/index.jsx index 9cf3cbd1aa..a65b6fe184 100644 --- a/packages/template-chakra-storefront/src/components/header/index.jsx +++ b/packages/template-chakra-storefront/src/components/header/index.jsx @@ -98,6 +98,7 @@ const SearchBar = (props) => { * @param {object} props.searchInputRef reference of the search input * @param {func} props.onMyAccountClick click event handler for my account button * @param {func} props.onMyCartClick click event handler for my cart button + //@sfdc-extension-line SFDC_EXT_WISHLIST * @param {func} props.onWishlistClick click event handler for wish list button * @param {func} props.onStoreLocatorClick click event handler for store locator button * @param {React.ReactElement} props.children - React Node to be rendered inside Header From a9099e7dd6ee6e6353190e0dfe55ecc07902d288 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Sat, 9 Aug 2025 14:37:57 -0700 Subject: [PATCH 32/49] Update index.test.js --- .../src/components/header/index.test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/template-chakra-storefront/src/components/header/index.test.js b/packages/template-chakra-storefront/src/components/header/index.test.js index 059f9d35f5..8b9f34063a 100644 --- a/packages/template-chakra-storefront/src/components/header/index.test.js +++ b/packages/template-chakra-storefront/src/components/header/index.test.js @@ -190,6 +190,7 @@ test('route to account page when an authenticated users click on account icon', }) }) +//@sfdc-extension-block-start SFDC_EXT_WISHLIST test('route to wishlist page when an authenticated users click on wishlist icon', async () => { const history = createMemoryHistory() // mock push function @@ -210,3 +211,4 @@ test('route to wishlist page when an authenticated users click on wishlist icon' expect(history.push).toHaveBeenCalledWith(createPathWithDefaults('/account/wishlist')) }) }) +//@sfdc-extension-block-end SFDC_EXT_WISHLIST \ No newline at end of file From 174af6bf917e2fcd28372cde63213c899a2cf1a2 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Sat, 9 Aug 2025 14:39:17 -0700 Subject: [PATCH 33/49] Update index.test.js --- .../src/components/item-variant/index.test.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/template-chakra-storefront/src/components/item-variant/index.test.js b/packages/template-chakra-storefront/src/components/item-variant/index.test.js index dbd394378c..eb66840c93 100644 --- a/packages/template-chakra-storefront/src/components/item-variant/index.test.js +++ b/packages/template-chakra-storefront/src/components/item-variant/index.test.js @@ -10,7 +10,11 @@ import PropTypes from 'prop-types' import {renderWithProviders} from '../../utils/test-utils' import ItemVariantProvider from './index' import ItemPrice from './item-price' -import {cartVariant, wishlistVariant} from './data.mock' +import { + cartVariant, + //@sfdc-extension-line SFDC_EXT_WISHLIST + wishlistVariant +} from './data.mock' import {within} from '@testing-library/react' import {useMediaQuery} from '@chakra-ui/react' From 2e783c0546077baf58e22fe34025089ac978db08 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Sat, 9 Aug 2025 14:41:13 -0700 Subject: [PATCH 34/49] Update index.test.js --- .../src/components/product-tile/index.test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/template-chakra-storefront/src/components/product-tile/index.test.js b/packages/template-chakra-storefront/src/components/product-tile/index.test.js index 0f0ebec2e8..b46a783404 100644 --- a/packages/template-chakra-storefront/src/components/product-tile/index.test.js +++ b/packages/template-chakra-storefront/src/components/product-tile/index.test.js @@ -54,6 +54,7 @@ test('Renders PricingAndPromotionsSkeleton when isRefetching is true', async () expect(queryByTestId('sf-product-tile-skeleton')).not.toBeInTheDocument() }) +//@sfdc-extension-block-start SFDC_EXT_WISHLIST test('Remove from wishlist cannot be muti-clicked', async () => { const onClick = jest.fn() @@ -72,6 +73,7 @@ test('Remove from wishlist cannot be muti-clicked', async () => { }) expect(onClick).toHaveBeenCalledTimes(1) }) +//@sfdc-extension-block-end SFDC_EXT_WISHLIST test('Renders variant details based on the selected swatch', async () => { useBreakpointValue.mockReturnValue(true) From 2d0c65343766dcb0188d5d50ed65a73cdc09c1c2 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Sat, 9 Aug 2025 14:44:15 -0700 Subject: [PATCH 35/49] Update index.test.js --- .../src/components/product-view/index.test.js | 39 +++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/packages/template-chakra-storefront/src/components/product-view/index.test.js b/packages/template-chakra-storefront/src/components/product-view/index.test.js index 773cba5bd1..9fa199483b 100644 --- a/packages/template-chakra-storefront/src/components/product-view/index.test.js +++ b/packages/template-chakra-storefront/src/components/product-view/index.test.js @@ -29,7 +29,9 @@ const MockComponent = (props) => { MockComponent.propTypes = { product: PropTypes.object, addToCart: PropTypes.func, + //@sfdc-extension-line SFDC_EXT_WISHLIST addToWishlist: PropTypes.func, + //@sfdc-extension-line SFDC_EXT_WISHLIST updateWishlist: PropTypes.func, isBasketLoading: PropTypes.bool } @@ -69,6 +71,7 @@ test('ProductView Component renders with addToCart event handler', async () => { }) }) +//@sfdc-extension-block-start SFDC_EXT_WISHLIST test('ProductView Component renders with addToWishList event handler', async () => { const addToWishlist = jest.fn() @@ -87,7 +90,9 @@ test('ProductView Component renders with addToWishList event handler', async () }) expect(addToWishlist).toHaveBeenCalledTimes(1) }) +//@sfdc-extension-block-end SFDC_EXT_WISHLIST +//@sfdc-extension-block-start SFDC_EXT_WISHLIST test('ProductView Component renders with updateWishlist event handler', async () => { const updateWishlist = jest.fn() @@ -105,6 +110,7 @@ test('ProductView Component renders with updateWishlist event handler', async () }) expect(updateWishlist).toHaveBeenCalledTimes(1) }) +//@sfdc-extension-block-end SFDC_EXT_WISHLIST test('Product View can update quantity', async () => { const user = userEvent.setup() @@ -132,7 +138,12 @@ test('Product View can update quantity', async () => { test('renders a product set properly - parent item', () => { const parent = mockProductSet renderWithProviders( - {}} addToWishlist={() => {}} /> + {}} + //@sfdc-extension-line SFDC_EXT_WISHLIST + addToWishlist={() => {}} + /> ) // NOTE: there can be duplicates of the same element, due to mobile and desktop views @@ -140,6 +151,7 @@ test('renders a product set properly - parent item', () => { const fromAtLabel = screen.getAllByText(/from/i)[0] const addSetToCartButton = screen.getAllByRole('button', {name: /add set to cart/i})[0] + //@sfdc-extension-line SFDC_EXT_WISHLIST const addSetToWishlistButton = screen.getAllByRole('button', {name: /add set to wishlist/i})[0] const variationAttributes = screen.queryAllByRole('radiogroup') // e.g. sizes, colors const quantityPicker = screen.queryByRole('spinbutton', {name: /quantity/i}) @@ -147,6 +159,7 @@ test('renders a product set properly - parent item', () => { // What should exist: expect(fromAtLabel).toBeInTheDocument() expect(addSetToCartButton).toBeInTheDocument() + //@sfdc-extension-line SFDC_EXT_WISHLIST expect(addSetToWishlistButton).toBeInTheDocument() // What should _not_ exist: @@ -157,13 +170,19 @@ test('renders a product set properly - parent item', () => { test('renders a product set properly - child item', () => { const child = mockProductSet.setProducts[0] renderWithProviders( - {}} addToWishlist={() => {}} /> + {}} + //@sfdc-extension-line SFDC_EXT_WISHLIST + addToWishlist={() => {}} + /> ) // NOTE: there can be duplicates of the same element, due to mobile and desktop views // (they're hidden with display:none style) const addToCartButton = screen.getAllByRole('button', {name: /add to cart/i})[0] + //@sfdc-extension-line SFDC_EXT_WISHLIST const addToWishlistButton = screen.getAllByRole('button', {name: /add to wishlist/i})[0] const variationAttributes = screen.getAllByRole('radiogroup') // e.g. sizes, colors const quantityPicker = screen.getByRole('spinbutton', {name: /quantity/i}) @@ -171,6 +190,7 @@ test('renders a product set properly - child item', () => { // What should exist: expect(addToCartButton).toBeInTheDocument() + //@sfdc-extension-line SFDC_EXT_WISHLIST expect(addToWishlistButton).toBeInTheDocument() expect(variationAttributes).toHaveLength(2) expect(quantityPicker).toBeInTheDocument() @@ -191,6 +211,7 @@ test('validateOrderability callback is called when adding a set to cart', async product={parent} validateOrderability={validateOrderability} addToCart={() => {}} + //@sfdc-extension-line SFDC_EXT_WISHLIST addToWishlist={() => {}} /> ) @@ -215,6 +236,7 @@ test('onVariantSelected callback is called after successfully selected a variant product={child} onVariantSelected={onVariantSelected} addToCart={() => {}} + //@sfdc-extension-line SFDC_EXT_WISHLIST addToWishlist={() => {}} /> ) @@ -258,20 +280,28 @@ describe('add to cart button loading tests', () => { test('renders a product bundle properly - parent item', () => { const parent = mockProductBundle renderWithProviders( - {}} addToWishlist={() => {}} /> + {}} + //@sfdc-extension-line SFDC_EXT_WISHLIST + addToWishlist={() => {}} + /> ) // NOTE: there can be duplicates of the same element, due to mobile and desktop views // (they're hidden with display:none style) const addBundleToCartButton = screen.getAllByRole('button', {name: /add bundle to cart/i})[0] + //@sfdc-extension-block-start SFDC_EXT_WISHLIST const addBundleToWishlistButton = screen.getAllByRole('button', { name: /add bundle to wishlist/i })[0] + //@sfdc-extension-block-end SFDC_EXT_WISHLIST const quantityPicker = screen.getByRole('spinbutton', {name: /quantity/i}) const variationAttributes = screen.queryAllByRole('radiogroup') // e.g. sizes, colors // What should exist: expect(addBundleToCartButton).toBeInTheDocument() + //@sfdc-extension-line SFDC_EXT_WISHLIST expect(addBundleToWishlistButton).toBeInTheDocument() expect(quantityPicker).toBeInTheDocument() @@ -285,6 +315,7 @@ test('renders a product bundle properly - child item', () => { {}} + //@sfdc-extension-line SFDC_EXT_WISHLIST addToWishlist={() => {}} isProductPartOfBundle={true} setChildProductOrderability={() => {}} @@ -292,6 +323,7 @@ test('renders a product bundle properly - child item', () => { ) const addToCartButton = screen.queryByRole('button', {name: /add to cart/i}) + //@sfdc-extension-line SFDC_EXT_WISHLIST const addToWishlistButton = screen.queryByRole('button', {name: /add to wishlist/i}) const variationAttributes = screen.getAllByRole('radiogroup') // e.g. sizes, colors const quantityPicker = screen.queryByRole('spinbutton', {name: /quantity:/i}) @@ -301,6 +333,7 @@ test('renders a product bundle properly - child item', () => { // What should _not_ exist: expect(addToCartButton).toBeNull() + //@sfdc-extension-line SFDC_EXT_WISHLIST expect(addToWishlistButton).toBeNull() expect(quantityPicker).toBeNull() }) From 8b8153cc71f24a895f5a9ef375df739aa0d05d37 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Sat, 9 Aug 2025 14:48:03 -0700 Subject: [PATCH 36/49] Update index.jsx --- .../src/components/recommended-products/index.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/template-chakra-storefront/src/components/recommended-products/index.jsx b/packages/template-chakra-storefront/src/components/recommended-products/index.jsx index 4cdf799bd0..6c40ae5478 100644 --- a/packages/template-chakra-storefront/src/components/recommended-products/index.jsx +++ b/packages/template-chakra-storefront/src/components/recommended-products/index.jsx @@ -14,14 +14,18 @@ import useEinstein from '../../hooks/use-einstein' import useDataCloud from '../../hooks/use-datacloud' import {useCurrentCustomer} from '../../hooks/use-current-customer' import useIntersectionObserver from '../../hooks/use-intersection-observer' +//@sfdc-extension-line SFDC_EXT_WISHLIST import {useWishList} from '../../hooks/use-wish-list' import useToast from '../../hooks/use-toast' import useNavigation from '../../hooks/use-navigation' import { API_ERROR_MESSAGE, + //@sfdc-extension-line SFDC_EXT_WISHLIST TOAST_ACTION_VIEW_WISHLIST, + //@sfdc-extension-line SFDC_EXT_WISHLIST TOAST_MESSAGE_ADDED_TO_WISHLIST, + //@sfdc-extension-line SFDC_EXT_WISHLIST TOAST_MESSAGE_REMOVED_FROM_WISHLIST } from '../../../config/constants' import {useShopperCustomersMutation} from '@salesforce/commerce-sdk-react' @@ -41,6 +45,7 @@ const RecommendedProducts = ({zone, recommender, products, title, shouldFetch, . } = useEinstein() const {data: customer} = useCurrentCustomer() const {customerId} = customer + //@sfdc-extension-line SFDC_EXT_WISHLIST const {data: wishlist} = useWishList() const dataCloud = useDataCloud() @@ -57,10 +62,12 @@ const RecommendedProducts = ({zone, recommender, products, title, shouldFetch, . const messages = useMemo( () => ({ + //@sfdc-extension-block-start SFDC_EXT_WISHLIST toastAddedToWishlist: (quantity) => formatMessage(TOAST_MESSAGE_ADDED_TO_WISHLIST, {quantity}), toastViewWishlist: formatMessage(TOAST_ACTION_VIEW_WISHLIST), toastRemovedFromWishlist: formatMessage(TOAST_MESSAGE_REMOVED_FROM_WISHLIST), + //@sfdc-extension-block-end SFDC_EXT_WISHLIST apiError: formatMessage(API_ERROR_MESSAGE) }), [intl] @@ -128,6 +135,7 @@ const RecommendedProducts = ({zone, recommender, products, title, shouldFetch, . return null } + //@sfdc-extension-block-start SFDC_EXT_WISHLIST // TODO: DRY this handler when intl provider is available globally const addItemToWishlist = async (product) => { try { @@ -209,6 +217,7 @@ const RecommendedProducts = ({zone, recommender, products, title, shouldFetch, . ) }, enableFavourite: true, + //@sfdc-extension-block-start SFDC_EXT_WISHLIST isFavourite: wishlist?.customerProductListItems?.some( (item) => item.productId === product?.productId ), @@ -216,6 +225,7 @@ const RecommendedProducts = ({zone, recommender, products, title, shouldFetch, . const action = toBeFavourite ? addItemToWishlist : removeItemFromWishlist return action(product) } + //@sfdc-extension-block-end SFDC_EXT_WISHLIST })} {...props} /> From d422c5cbb4ca4f7e1b6899a25032b42778a2fbc8 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Sat, 9 Aug 2025 14:49:00 -0700 Subject: [PATCH 37/49] Update index.jsx --- .../src/components/recommended-products/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/template-chakra-storefront/src/components/recommended-products/index.jsx b/packages/template-chakra-storefront/src/components/recommended-products/index.jsx index 6c40ae5478..4733ce5dd5 100644 --- a/packages/template-chakra-storefront/src/components/recommended-products/index.jsx +++ b/packages/template-chakra-storefront/src/components/recommended-products/index.jsx @@ -199,7 +199,7 @@ const RecommendedProducts = ({zone, recommender, products, title, shouldFetch, . }) } } - + //@sfdc-extension-block-end SFDC_EXT_WISHLIST return ( Date: Sat, 9 Aug 2025 15:11:39 -0700 Subject: [PATCH 38/49] Update constants.js --- .../src/config/constants.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/template-chakra-storefront/src/config/constants.js b/packages/template-chakra-storefront/src/config/constants.js index 124a7cc1a9..08808e5720 100644 --- a/packages/template-chakra-storefront/src/config/constants.js +++ b/packages/template-chakra-storefront/src/config/constants.js @@ -58,6 +58,7 @@ export const urlPartPositions = { // definitions to a common location (here), so that each message is only defined // once. +//@sfdc-extension-block-start SFDC_EXT_WISHLIST export const TOAST_MESSAGE_ADDED_TO_WISHLIST = defineMessage({ id: 'global.info.added_to_wishlist', defaultMessage: '{quantity} {quantity, plural, one {item} other {items}} added to wishlist' @@ -68,11 +69,6 @@ export const TOAST_MESSAGE_ALREADY_IN_WISHLIST = defineMessage({ defaultMessage: 'Item is already in wishlist' }) -export const TOAST_MESSAGE_REMOVED_ITEM_FROM_CART = defineMessage({ - defaultMessage: 'Item removed from cart', - id: 'cart.info.removed_from_cart' -}) - export const TOAST_ACTION_VIEW_WISHLIST = defineMessage({ defaultMessage: 'View', id: 'global.link.added_to_wishlist.view_wishlist' @@ -82,6 +78,11 @@ export const TOAST_MESSAGE_REMOVED_FROM_WISHLIST = defineMessage({ id: 'global.info.removed_from_wishlist', defaultMessage: 'Item removed from wishlist' }) +//@sfdc-extension-block-end SFDC_EXT_WISHLIST +export const TOAST_MESSAGE_REMOVED_ITEM_FROM_CART = defineMessage({ + defaultMessage: 'Item removed from cart', + id: 'cart.info.removed_from_cart' +}) // Einstein recommender constants used in export const EINSTEIN_RECOMMENDERS = { From 5067615cc9d21bf14d8e1e9077dae2ef0cd45011 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Sat, 9 Aug 2025 15:13:38 -0700 Subject: [PATCH 39/49] Update use-add-to-cart-modal.test.js --- .../src/hooks/use-add-to-cart-modal.test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/template-chakra-storefront/src/hooks/use-add-to-cart-modal.test.js b/packages/template-chakra-storefront/src/hooks/use-add-to-cart-modal.test.js index 105da546c7..b00fd5f09e 100644 --- a/packages/template-chakra-storefront/src/hooks/use-add-to-cart-modal.test.js +++ b/packages/template-chakra-storefront/src/hooks/use-add-to-cart-modal.test.js @@ -13,9 +13,11 @@ import {getDisplayVariationValues} from '../utils/product-utils' // Mock the hooks jest.mock('./use-current-basket') +//@sfdc-extension-line SFDC_EXT_WISHLIST jest.mock('./use-wish-list') import {useCurrentBasket} from './use-current-basket' +//@sfdc-extension-line SFDC_EXT_WISHLIST import {useWishList} from './use-wish-list' const MOCK_PRODUCT = { @@ -585,10 +587,12 @@ beforeEach(() => { isPending: false }) + //@sfdc-extension-block-start SFDC_EXT_WISHLIST useWishList.mockReturnValue({ data: null, isLoading: false }) + //@sfdc-extension-block-end SFDC_EXT_WISHLIST }) test('Renders AddToCartModal with multiple products', () => { From 02494288a578b55e8d1b07cfabb4f4f37397e016 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Sat, 9 Aug 2025 15:14:37 -0700 Subject: [PATCH 40/49] Update constant.js --- .../template-chakra-storefront/src/pages/account/constant.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/template-chakra-storefront/src/pages/account/constant.js b/packages/template-chakra-storefront/src/pages/account/constant.js index 73c9753371..e52925ce8e 100644 --- a/packages/template-chakra-storefront/src/pages/account/constant.js +++ b/packages/template-chakra-storefront/src/pages/account/constant.js @@ -12,6 +12,7 @@ export const messages = defineMessages({ profile: {defaultMessage: 'Account Details', id: 'global.account.link.account_details'}, addresses: {defaultMessage: 'Addresses', id: 'global.account.link.addresses'}, orders: {defaultMessage: 'Order History', id: 'global.account.link.order_history'}, + //@sfdc-extension-line SFDC_EXT_WISHLIST wishlist: {defaultMessage: 'Wishlist', id: 'global.account.link.wishlist'} }) From 4a62844a917c12447fdf063a23e18febe03c7959 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Mon, 11 Aug 2025 08:29:34 -0700 Subject: [PATCH 41/49] More constant out of optional block Why are there 2 constants files? --- packages/template-chakra-storefront/config/constants.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/template-chakra-storefront/config/constants.js b/packages/template-chakra-storefront/config/constants.js index 39ca8bd249..7bbe4fcd77 100644 --- a/packages/template-chakra-storefront/config/constants.js +++ b/packages/template-chakra-storefront/config/constants.js @@ -69,11 +69,6 @@ export const TOAST_MESSAGE_ALREADY_IN_WISHLIST = defineMessage({ defaultMessage: 'Item is already in wishlist' }) -export const TOAST_MESSAGE_REMOVED_ITEM_FROM_CART = defineMessage({ - defaultMessage: 'Item removed from cart', - id: 'cart.info.removed_from_cart' -}) - export const TOAST_ACTION_VIEW_WISHLIST = defineMessage({ defaultMessage: 'View', id: 'global.link.added_to_wishlist.view_wishlist' @@ -84,6 +79,10 @@ export const TOAST_MESSAGE_REMOVED_FROM_WISHLIST = defineMessage({ defaultMessage: 'Item removed from wishlist' }) //@sfdc-extension-block-end SFDC_EXT_WISHLIST +export const TOAST_MESSAGE_REMOVED_ITEM_FROM_CART = defineMessage({ + defaultMessage: 'Item removed from cart', + id: 'cart.info.removed_from_cart' +}) // Einstein recommender constants used in export const EINSTEIN_RECOMMENDERS = { From cd93a04299a2fc69267863d749ea61e73979260e Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Mon, 11 Aug 2025 08:34:47 -0700 Subject: [PATCH 42/49] Don't use wishlist on cart if not enabled --- packages/template-chakra-storefront/src/pages/cart/index.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/template-chakra-storefront/src/pages/cart/index.jsx b/packages/template-chakra-storefront/src/pages/cart/index.jsx index 97a8f4e3ce..d9e807aae4 100644 --- a/packages/template-chakra-storefront/src/pages/cart/index.jsx +++ b/packages/template-chakra-storefront/src/pages/cart/index.jsx @@ -11,6 +11,7 @@ import {useCurrentBasket, useCurrentCustomer} from '../../hooks/' // Custom Cart Hooks import {useCartProducts} from './hooks/use-cart-products' import {useCartOperations} from './hooks/use-cart-operations' +//@sfdc-extension-line SFDC_EXT_WISHLIST import {useWishList} from '../../hooks/use-wish-list' import {useCartGiftItems} from './hooks/use-cart-gift-items' import {useCartDefaultShipping} from './hooks/use-cart-default-shipping' @@ -53,9 +54,11 @@ const Cart = () => { handleRemoveItem } = useCartOperations(basket, productsByItemId, showError) + //@sfdc-extension-block-start SFDC_EXT_WISHLIST // Wishlist operations const {addToWishlist} = useWishList() const handleAddToWishlist = (product) => addToWishlist(product) + //@sfdc-extension-block-end SFDC_EXT_WISHLIST // Gift items const {localIsGiftItems, handleIsAGiftChange} = useCartGiftItems( @@ -116,6 +119,7 @@ const Cart = () => { selectedItem={selectedItem} handleChangeItemQuantity={handleChangeItemQuantity} handleIsAGiftChange={handleIsAGiftChange} + //@sfdc-extension-line SFDC_EXT_WISHLIST handleAddToWishlist={handleAddToWishlist} handleEditClick={handleEditClick} handleRemoveItem={handleRemoveItem} From 0f6a7249b6fc9179263680a37ff5eccb71c43621 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Mon, 11 Aug 2025 08:43:24 -0700 Subject: [PATCH 43/49] Fixing lint errors --- .../src/components/header/index.test.js | 8 +++---- .../src/components/item-variant/data.mock.js | 2 +- .../src/components/item-variant/index.test.js | 2 +- .../src/components/product-view/index.jsx | 1 - .../src/components/product-view/index.test.js | 24 +++++++++---------- .../src/hooks/use-wish-list.test.js | 2 +- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/packages/template-chakra-storefront/src/components/header/index.test.js b/packages/template-chakra-storefront/src/components/header/index.test.js index 8b9f34063a..2751d9de73 100644 --- a/packages/template-chakra-storefront/src/components/header/index.test.js +++ b/packages/template-chakra-storefront/src/components/header/index.test.js @@ -40,10 +40,10 @@ const MockedComponent = ({history}) => { //@sfdc-extension-block-end SFDC_EXT_WISHLIST return (
-
) @@ -211,4 +211,4 @@ test('route to wishlist page when an authenticated users click on wishlist icon' expect(history.push).toHaveBeenCalledWith(createPathWithDefaults('/account/wishlist')) }) }) -//@sfdc-extension-block-end SFDC_EXT_WISHLIST \ No newline at end of file +//@sfdc-extension-block-end SFDC_EXT_WISHLIST diff --git a/packages/template-chakra-storefront/src/components/item-variant/data.mock.js b/packages/template-chakra-storefront/src/components/item-variant/data.mock.js index e16560670d..7ea9dca6e7 100644 --- a/packages/template-chakra-storefront/src/components/item-variant/data.mock.js +++ b/packages/template-chakra-storefront/src/components/item-variant/data.mock.js @@ -763,4 +763,4 @@ export const wishlistVariant = { c_width: 'Z', quantity: 5 } -//@sfdc-extension-block-end SFDC_EXT_WISHLIST \ No newline at end of file +//@sfdc-extension-block-end SFDC_EXT_WISHLIST diff --git a/packages/template-chakra-storefront/src/components/item-variant/index.test.js b/packages/template-chakra-storefront/src/components/item-variant/index.test.js index eb66840c93..d1e15babd7 100644 --- a/packages/template-chakra-storefront/src/components/item-variant/index.test.js +++ b/packages/template-chakra-storefront/src/components/item-variant/index.test.js @@ -11,7 +11,7 @@ import {renderWithProviders} from '../../utils/test-utils' import ItemVariantProvider from './index' import ItemPrice from './item-price' import { - cartVariant, + cartVariant, //@sfdc-extension-line SFDC_EXT_WISHLIST wishlistVariant } from './data.mock' diff --git a/packages/template-chakra-storefront/src/components/product-view/index.jsx b/packages/template-chakra-storefront/src/components/product-view/index.jsx index 60f7271bd8..5cbb8b1de8 100644 --- a/packages/template-chakra-storefront/src/components/product-view/index.jsx +++ b/packages/template-chakra-storefront/src/components/product-view/index.jsx @@ -274,7 +274,6 @@ const ProductView = forwardRef( addSetToWishlist: formatMessage(messages.addSetToWishlist), addBundleToWishlist: formatMessage(messages.addBundleToWishlist) //@sfdc-extension-block-end SFDC_EXT_WISHLIST - } const handleCartItem = async () => { diff --git a/packages/template-chakra-storefront/src/components/product-view/index.test.js b/packages/template-chakra-storefront/src/components/product-view/index.test.js index 9fa199483b..621a48a04a 100644 --- a/packages/template-chakra-storefront/src/components/product-view/index.test.js +++ b/packages/template-chakra-storefront/src/components/product-view/index.test.js @@ -138,11 +138,11 @@ test('Product View can update quantity', async () => { test('renders a product set properly - parent item', () => { const parent = mockProductSet renderWithProviders( - {}} + {}} //@sfdc-extension-line SFDC_EXT_WISHLIST - addToWishlist={() => {}} + addToWishlist={() => {}} /> ) @@ -170,11 +170,11 @@ test('renders a product set properly - parent item', () => { test('renders a product set properly - child item', () => { const child = mockProductSet.setProducts[0] renderWithProviders( - {}} + {}} //@sfdc-extension-line SFDC_EXT_WISHLIST - addToWishlist={() => {}} + addToWishlist={() => {}} /> ) @@ -280,11 +280,11 @@ describe('add to cart button loading tests', () => { test('renders a product bundle properly - parent item', () => { const parent = mockProductBundle renderWithProviders( - {}} + {}} //@sfdc-extension-line SFDC_EXT_WISHLIST - addToWishlist={() => {}} + addToWishlist={() => {}} /> ) diff --git a/packages/template-chakra-storefront/src/hooks/use-wish-list.test.js b/packages/template-chakra-storefront/src/hooks/use-wish-list.test.js index 79c8d74a33..b467cd46bc 100644 --- a/packages/template-chakra-storefront/src/hooks/use-wish-list.test.js +++ b/packages/template-chakra-storefront/src/hooks/use-wish-list.test.js @@ -324,4 +324,4 @@ describe('useWishList', () => { ) }) }) -//@sfdc-extension-block-end SFDC_EXT_WISHLIST \ No newline at end of file +//@sfdc-extension-block-end SFDC_EXT_WISHLIST From b05bd112af0ea08389e6078f9e9c27cf85fa5a10 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Mon, 11 Aug 2025 13:42:46 -0700 Subject: [PATCH 44/49] Fix after bad merge --- packages/pwa-kit-create-app/assets/plugin-config.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/pwa-kit-create-app/assets/plugin-config.js b/packages/pwa-kit-create-app/assets/plugin-config.js index fa8c274662..d97ba97a30 100644 --- a/packages/pwa-kit-create-app/assets/plugin-config.js +++ b/packages/pwa-kit-create-app/assets/plugin-config.js @@ -14,14 +14,14 @@ module.exports = { plugins: { - SFDC_EXT_WISHLIST: { - description: 'Wishlist Extension' - } // SFDC_EXT_HELLO_WORLD_ENABLED: { // description: 'The Hello World Extension' // }, SFDC_EXT_SOCIAL_LOGIN: { description: 'Social login Extension' + }, + SFDC_EXT_WISHLIST: { + description: 'Wishlist Extension' } } } From 4683222cbb64ee579945780ebb91083542182b0b Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Mon, 11 Aug 2025 13:58:52 -0700 Subject: [PATCH 45/49] Update cart-secondary-button-group.jsx --- .../src/pages/cart/partials/cart-secondary-button-group.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/template-chakra-storefront/src/pages/cart/partials/cart-secondary-button-group.jsx b/packages/template-chakra-storefront/src/pages/cart/partials/cart-secondary-button-group.jsx index 038f794600..f98edc07ad 100644 --- a/packages/template-chakra-storefront/src/pages/cart/partials/cart-secondary-button-group.jsx +++ b/packages/template-chakra-storefront/src/pages/cart/partials/cart-secondary-button-group.jsx @@ -74,10 +74,12 @@ const CartSecondaryButtonGroup = ({ id: 'cart_secondary_button_group.action.remove', defaultMessage: 'Remove' }), + //@sfdc-extension-block-start SFDC_EXT_WISHLIST addToWishlist: formatMessage({ id: 'cart_secondary_button_group.action.added_to_wishlist', defaultMessage: 'Add to Wishlist' }), + //@sfdc-extension-block-end SFDC_EXT_WISHLIST edit: formatMessage({ id: 'cart_secondary_button_group.action.edit', defaultMessage: 'Edit' @@ -110,6 +112,7 @@ const CartSecondaryButtonGroup = ({ + {/*@sfdc-extension-block-start SFDC_EXT_WISHLIST*/} {customer.isRegistered && ( @@ -160,6 +164,7 @@ const CartSecondaryButtonGroup = ({ CartSecondaryButtonGroup.propTypes = { onClick: PropTypes.func, onEditClick: PropTypes.func, + //@sfdc-extension-line SFDC_EXT_WISHLIST onAddToWishlistClick: PropTypes.func, onRemoveItemClick: PropTypes.func, onIsAGiftChange: PropTypes.func, From e51dd5031224d6b4495121b1ed0e50342e92ddc8 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Mon, 11 Aug 2025 14:01:21 -0700 Subject: [PATCH 46/49] Update index.test.js --- .../src/pages/product-detail/index.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/template-chakra-storefront/src/pages/product-detail/index.test.js b/packages/template-chakra-storefront/src/pages/product-detail/index.test.js index 8751ccb425..65b90d969b 100644 --- a/packages/template-chakra-storefront/src/pages/product-detail/index.test.js +++ b/packages/template-chakra-storefront/src/pages/product-detail/index.test.js @@ -14,6 +14,7 @@ import {renderWithProviders} from '../../utils/test-utils' import {prependHandlersToServer} from '../../../jest-setup' import { basketWithProductSet, + //@sfdc-extension-line SFDC_EXT_WISHLIST mockWishlistWithItem, einsteinRecommendation, masterProduct, @@ -114,12 +115,14 @@ describe('product detail', () => { expect(screen.getAllByText(/from £9\.59/i)).toHaveLength(2) expect(screen.getAllByText(/£15\.36/i)).toHaveLength(4) expect(screen.getAllByText(/Add to Cart/)).toHaveLength(2) + //@sfdc-extension-line SFDC_EXT_WISHLIST expect(screen.getAllByText(/Add to Wishlist/)).toHaveLength(2) expect(screen.getAllByTestId('product-view')).toHaveLength(1) expect(screen.getByText(/You might also like/i)).toBeInTheDocument() }) }) + //@sfdc-extension-block-start SFDC_EXT_WISHLIST test('should add to wishlist', async () => { prependHandlersToServer([ { @@ -165,7 +168,9 @@ describe('product detail', () => { expect(screen.getByText(/item added to wishlist/i)).toBeInTheDocument() }) }) + //@sfdc-extension-block-end SFDC_EXT_WISHLIST + //@sfdc-extension-block-start SFDC_EXT_WISHLIST test('should not add to wishlist if item is already in wishlist', async () => { prependHandlersToServer([ { @@ -198,6 +203,7 @@ describe('product detail', () => { expect(screen.getByText(/item is already in wishlist/i)).toBeInTheDocument() }) }) + //@sfdc-extension-block-end SFDC_EXT_WISHLIST }) describe('product set', () => { From 14f058772b329dd3d32782d771a9595bb60ea6fb Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Mon, 11 Aug 2025 14:02:16 -0700 Subject: [PATCH 47/49] Update cart-secondary-button-group.test.js --- .../cart/partials/cart-secondary-button-group.test.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/template-chakra-storefront/src/pages/cart/partials/cart-secondary-button-group.test.js b/packages/template-chakra-storefront/src/pages/cart/partials/cart-secondary-button-group.test.js index 70f56354b2..4583b371d3 100644 --- a/packages/template-chakra-storefront/src/pages/cart/partials/cart-secondary-button-group.test.js +++ b/packages/template-chakra-storefront/src/pages/cart/partials/cart-secondary-button-group.test.js @@ -25,6 +25,7 @@ jest.mock('../../../hooks/use-current-customer', () => ({ })) const MockedComponent = ({ + //@sfdc-extension-line SFDC_EXT_WISHLIST onAddToWishlistClick = noop, onEditClick = noop, onRemoveItemClick = noop, @@ -35,6 +36,7 @@ const MockedComponent = ({ return ( { test('renders secondary with event handlers', async () => { const onRemoveItemClick = jest.fn() const onEditClick = jest.fn() + //@sfdc-extension-line SFDC_EXT_WISHLIST const onAddToWishlistClick = jest.fn() const onIsAGiftChange = jest.fn() const {user} = renderWithProviders( { }) expect(onEditClick).toHaveBeenCalledTimes(1) + //@sfdc-extension-block-start SFDC_EXT_WISHLIST const addToWishlistButton = screen.getByRole('button', { name: /Add to wishlist/i }) await user.click(addToWishlistButton) expect(onAddToWishlistClick).toHaveBeenCalledTimes(1) - + //@sfdc-extension-block-end SFDC_EXT_WISHLIST const removeButton = screen.getByRole('button', { name: /remove/i }) From 3b3111670107b653e2d1464ac95edf274c5a93ff Mon Sep 17 00:00:00 2001 From: Kevin He Date: Wed, 13 Aug 2025 12:52:47 -0700 Subject: [PATCH 48/49] bundle size increase by 1kb --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f67d92adb6..c328dc4020 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -393,4 +393,4 @@ jobs: uses: "./.github/actions/bundle_size_test" with: cwd: ${{ env.PROJECT_DIR }} - config: '{"build/main.js": "59kB", "build/vendor.js": "390kB"}' + config: '{"build/main.js": "60kB", "build/vendor.js": "390kB"}' From ef6effe21b79d30c45497c8ae9f2f60433a4b638 Mon Sep 17 00:00:00 2001 From: Kevin He Date: Wed, 13 Aug 2025 12:54:36 -0700 Subject: [PATCH 49/49] Revert "bundle size increase by 1kb" This reverts commit 3b3111670107b653e2d1464ac95edf274c5a93ff. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c328dc4020..f67d92adb6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -393,4 +393,4 @@ jobs: uses: "./.github/actions/bundle_size_test" with: cwd: ${{ env.PROJECT_DIR }} - config: '{"build/main.js": "60kB", "build/vendor.js": "390kB"}' + config: '{"build/main.js": "59kB", "build/vendor.js": "390kB"}'