From 06197d74ee5e9d9d912fe44b2251a89785af889e Mon Sep 17 00:00:00 2001 From: Raghavendra Tirumalasetti <104980124+RaghavendraTirumalasetti@users.noreply.github.com> Date: Tue, 23 May 2023 19:34:36 +0530 Subject: [PATCH 1/7] PWA-3113:The button seems to not be working with the keyboard. (#4120) Co-authored-by: Aanchal Pawar <97873570+glo82145@users.noreply.github.com> --- .../CartPage/GiftCards/__tests__/useGiftCards.spec.js | 1 + .../lib/talons/CartPage/GiftCards/useGiftCards.js | 8 ++++++++ .../__tests__/__snapshots__/giftCards.spec.js.snap | 2 -- .../lib/components/CartPage/GiftCards/giftCards.js | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/peregrine/lib/talons/CartPage/GiftCards/__tests__/useGiftCards.spec.js b/packages/peregrine/lib/talons/CartPage/GiftCards/__tests__/useGiftCards.spec.js index 698b9dc66e..5698215842 100644 --- a/packages/peregrine/lib/talons/CartPage/GiftCards/__tests__/useGiftCards.spec.js +++ b/packages/peregrine/lib/talons/CartPage/GiftCards/__tests__/useGiftCards.spec.js @@ -121,6 +121,7 @@ test('it returns the proper shape', () => { errorLoadingGiftCards: expect.any(Boolean), errorRemovingCard: expect.any(Boolean), giftCardsData: expect.any(Array), + handleEnterKeyPress: expect.any(Function), isLoadingGiftCards: expect.any(Boolean), isApplyingCard: expect.any(Boolean), isCheckingBalance: expect.any(Boolean), diff --git a/packages/peregrine/lib/talons/CartPage/GiftCards/useGiftCards.js b/packages/peregrine/lib/talons/CartPage/GiftCards/useGiftCards.js index cca73a8da8..4c90000d7e 100644 --- a/packages/peregrine/lib/talons/CartPage/GiftCards/useGiftCards.js +++ b/packages/peregrine/lib/talons/CartPage/GiftCards/useGiftCards.js @@ -156,6 +156,13 @@ export const useGiftCards = props => { removeCardLoading, setIsCartUpdating ]); + const handleEnterKeyPress = useCallback(() => { + event => { + if (event.key === 'Enter') { + applyGiftCard(); + } + }; + }, [applyGiftCard]); const shouldDisplayCardBalance = mostRecentAction === actions.CHECK_BALANCE && @@ -178,6 +185,7 @@ export const useGiftCards = props => { (appliedCardsResult.data && appliedCardsResult.data.cart.applied_gift_cards) || [], + handleEnterKeyPress, isLoadingGiftCards: appliedCardsResult.loading, isApplyingCard: applyCardLoading, isCheckingBalance: balanceResult.loading, diff --git a/packages/venia-ui/lib/components/CartPage/GiftCards/__tests__/__snapshots__/giftCards.spec.js.snap b/packages/venia-ui/lib/components/CartPage/GiftCards/__tests__/__snapshots__/giftCards.spec.js.snap index 8a2fcd7129..902ef687df 100644 --- a/packages/venia-ui/lib/components/CartPage/GiftCards/__tests__/__snapshots__/giftCards.spec.js.snap +++ b/packages/venia-ui/lib/components/CartPage/GiftCards/__tests__/__snapshots__/giftCards.spec.js.snap @@ -85,7 +85,6 @@ exports[`it renders correctly when it has cards 1`] = ` disabled={false} onClick={[MockFunction]} onDragStart={[Function]} - onKeyDown={[Function]} onKeyUp={[Function]} onMouseDown={[Function]} onMouseEnter={[Function]} @@ -337,7 +336,6 @@ exports[`it renders correctly with no cards 1`] = ` disabled={false} onClick={[MockFunction]} onDragStart={[Function]} - onKeyDown={[Function]} onKeyUp={[Function]} onMouseDown={[Function]} onMouseEnter={[Function]} diff --git a/packages/venia-ui/lib/components/CartPage/GiftCards/giftCards.js b/packages/venia-ui/lib/components/CartPage/GiftCards/giftCards.js index 1af065994c..59734a86e5 100644 --- a/packages/venia-ui/lib/components/CartPage/GiftCards/giftCards.js +++ b/packages/venia-ui/lib/components/CartPage/GiftCards/giftCards.js @@ -54,6 +54,7 @@ const GiftCards = props => { errorLoadingGiftCards, errorRemovingCard, giftCardsData, + handleEnterKeyPress, isLoadingGiftCards, isApplyingCard, isCheckingBalance, @@ -198,6 +199,7 @@ const GiftCards = props => { data-cy="GiftCards-apply" disabled={isApplyingCard} onClick={applyGiftCard} + onKeyDown={handleEnterKeyPress} > Date: Wed, 24 May 2023 14:15:47 +0530 Subject: [PATCH 2/7] PWA#3093 Url Rewrite to external URL does not work on PWA (#4109) Co-authored-by: Aanchal Pawar <97873570+glo82145@users.noreply.github.com> --- .../lib/talons/MagentoRoute/useMagentoRoute.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/peregrine/lib/talons/MagentoRoute/useMagentoRoute.js b/packages/peregrine/lib/talons/MagentoRoute/useMagentoRoute.js index fa15f28fd0..bbdbab9563 100644 --- a/packages/peregrine/lib/talons/MagentoRoute/useMagentoRoute.js +++ b/packages/peregrine/lib/talons/MagentoRoute/useMagentoRoute.js @@ -48,6 +48,16 @@ export const useMagentoRoute = (props = {}) => { const { data, error, loading } = queryResult; const { route } = data || {}; + // redirect to external url + useEffect(() => { + if (route) { + const external_URL = route.relative_url; + if (external_URL && external_URL.startsWith('http')) { + window.location.replace(external_URL); + } + } + }, [route]); + useEffect(() => { if (initialized.current || !getInlinedPageData()) { runQuery({ From 6f4d1106451d2a4d5f25b65863df40a64dac1a06 Mon Sep 17 00:00:00 2001 From: Raghavendra Tirumalasetti <104980124+RaghavendraTirumalasetti@users.noreply.github.com> Date: Wed, 24 May 2023 14:54:32 +0530 Subject: [PATCH 3/7] PWA#3118 Update to latest @adobe/magento-storefront-events-sdk (#4103) * PWA#3118 Update to latest @adobe/magento-storefront-events-sdk * PWA#3118 Update to latest @adobe/magento-storefront-events-sdk * PWA#3118 Update to latest @adobe/magento-storefront-events-sdk * PWA-3118::resolve conflicts at packages/extensions/experience-platform-connector/package.json * PWA-3118::resolve conflicts at packages/extensions/experience-platform-connector/package.json --------- Co-authored-by: Aanchal Pawar <97873570+glo82145@users.noreply.github.com> Co-authored-by: glo82145 --- .../experience-platform-connector/package.json | 2 +- yarn.lock | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/extensions/experience-platform-connector/package.json b/packages/extensions/experience-platform-connector/package.json index 7aa87c3e7a..a4a3341645 100644 --- a/packages/extensions/experience-platform-connector/package.json +++ b/packages/extensions/experience-platform-connector/package.json @@ -13,7 +13,7 @@ "license": "(OSL-3.0 OR AFL-3.0)", "dependencies": { "@adobe/magento-storefront-event-collector": "~1.3.1", - "@adobe/magento-storefront-events-sdk": "~1.1.19" + "@adobe/magento-storefront-events-sdk": "~1.3.1" }, "devDependencies": {}, "peerDependencies": { diff --git a/yarn.lock b/yarn.lock index 74c48f2dee..31b3e5cff6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -40,13 +40,20 @@ "@snowplow/browser-plugin-performance-timing" "^3.0.1" "@snowplow/browser-tracker" "^3.0.1" -"@adobe/magento-storefront-events-sdk@*", "@adobe/magento-storefront-events-sdk@~1.1.19": +"@adobe/magento-storefront-events-sdk@*": version "1.1.19" resolved "https://registry.yarnpkg.com/@adobe/magento-storefront-events-sdk/-/magento-storefront-events-sdk-1.1.19.tgz#7632b873c4e913505d6176384618017315999a77" integrity sha512-N/FEN5kEUvLvrjVf+xjZkkOKIP+dD9D++CBwBVbpwpRwsMzVhDAJA0txfquesa/bVQIPf8MlJ43jdEoyH9/RJg== dependencies: "@adobe/adobe-client-data-layer" "^2.0.2" +"@adobe/magento-storefront-events-sdk@~1.3.1": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@adobe/magento-storefront-events-sdk/-/magento-storefront-events-sdk-1.3.1.tgz#efe9e5898462ef8d6b360af483919566dfadf69e" + integrity sha512-Ky8iovqTpaCnMPcm7ZMZAPlGsLhOnbUCNiWX13JeFKqo+T+kRoipHfDzlNiWaYmRdys1QOODn7xpoROynwUVRg== + dependencies: + "@adobe/adobe-client-data-layer" "^2.0.2" + "@adobe/reactor-cookie@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@adobe/reactor-cookie/-/reactor-cookie-1.1.0.tgz#9c13201fc4dd41b7600aa911e587539b7b9e4216" From d73a6e9dbad6fe2a8ffeb5a372253fc37dfdae2a Mon Sep 17 00:00:00 2001 From: Raghavendra Tirumalasetti <104980124+RaghavendraTirumalasetti@users.noreply.github.com> Date: Wed, 24 May 2023 15:54:31 +0530 Subject: [PATCH 4/7] Search auto populate results not accessible with tab or up/down keys. (#4060) Co-authored-by: sahil Co-authored-by: Sahil Kumar Sharma <86670457+Sahilsks@users.noreply.github.com> Co-authored-by: Devagouda <40405790+dpatil-magento@users.noreply.github.com> Co-authored-by: Aanchal Pawar <97873570+glo82145@users.noreply.github.com> Co-authored-by: arpit khare <84493875+glo42707@users.noreply.github.com> --- .../venia-ui/lib/components/SearchBar/searchBar.js | 14 +++++++------- .../lib/components/SearchBar/searchBar.module.css | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/venia-ui/lib/components/SearchBar/searchBar.js b/packages/venia-ui/lib/components/SearchBar/searchBar.js index 2174249637..3e1d677474 100644 --- a/packages/venia-ui/lib/components/SearchBar/searchBar.js +++ b/packages/venia-ui/lib/components/SearchBar/searchBar.js @@ -35,13 +35,6 @@ const SearchBar = React.forwardRef((props, ref) => { initialValues={initialValues} onSubmit={handleSubmit} > -
- -
{ onChange={handleChange} onFocus={handleFocus} /> +
+ +
diff --git a/packages/venia-ui/lib/components/SearchBar/searchBar.module.css b/packages/venia-ui/lib/components/SearchBar/searchBar.module.css index 7bddc04d7f..97da548373 100644 --- a/packages/venia-ui/lib/components/SearchBar/searchBar.module.css +++ b/packages/venia-ui/lib/components/SearchBar/searchBar.module.css @@ -46,6 +46,6 @@ .autocomplete { composes: grid from global; - composes: relative from global; + /* composes: relative from global; */ composes: z-menu from global; } From 13d295a2a879d07b80ee448c47003a988cffd02e Mon Sep 17 00:00:00 2001 From: Raghavendra Tirumalasetti <104980124+RaghavendraTirumalasetti@users.noreply.github.com> Date: Wed, 24 May 2023 16:49:06 +0530 Subject: [PATCH 5/7] Fixing issue with apollo error due to undefined query, changing test to non-deprecated flag (#4084) Co-authored-by: Justin Conabree Co-authored-by: Aanchal Pawar <97873570+glo82145@users.noreply.github.com> --- .../peregrine/lib/talons/Link/__tests__/useLink.spec.js | 6 +++--- packages/peregrine/lib/talons/Link/useLink.js | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/peregrine/lib/talons/Link/__tests__/useLink.spec.js b/packages/peregrine/lib/talons/Link/__tests__/useLink.spec.js index 3b3bd951d7..a9b0fb0f21 100644 --- a/packages/peregrine/lib/talons/Link/__tests__/useLink.spec.js +++ b/packages/peregrine/lib/talons/Link/__tests__/useLink.spec.js @@ -76,7 +76,7 @@ const givenEmptyProps = () => { const givenValidProps = () => { props = { - prefetchType: true, + shouldPrefetch: true, innerRef: { current: 'foo' }, to: '/bar.html' }; @@ -86,7 +86,7 @@ const givenFalsePrefetch = () => { givenValidProps(); props = { ...props, - prefetchType: false + shouldPrefetch: false }; }; @@ -175,7 +175,7 @@ describe('#useLink does not run query when', () => { expect(mockRunQuery).not.toHaveBeenCalled(); }); - test('should prefetch is false', async () => { + test('prefetch flag is false', async () => { givenFalsePrefetch(); await act(() => { diff --git a/packages/peregrine/lib/talons/Link/useLink.js b/packages/peregrine/lib/talons/Link/useLink.js index 3bccd64ac0..e08d2e4b50 100644 --- a/packages/peregrine/lib/talons/Link/useLink.js +++ b/packages/peregrine/lib/talons/Link/useLink.js @@ -8,9 +8,7 @@ import DEFAULT_OPERATIONS from '../MagentoRoute/magentoRoute.gql'; export const useLink = (props, passedOperations = {}) => { const { innerRef: originalRef, to } = props; const shouldPrefetch = props.prefetchType || props.shouldPrefetch; - const operations = shouldPrefetch - ? mergeOperations(DEFAULT_OPERATIONS, passedOperations) - : {}; + const operations = mergeOperations(DEFAULT_OPERATIONS, passedOperations); const intersectionObserver = useIntersectionObserver(); const { resolveUrlQuery } = operations; From 7157194a303f815ae8f98164997bb041e0980376 Mon Sep 17 00:00:00 2001 From: glo80771 <127736464+glo80771@users.noreply.github.com> Date: Wed, 24 May 2023 19:24:18 +0530 Subject: [PATCH 6/7] PWA-3134::The signout event is not captured (#4121) * PWA-3134::The signout event is not captured * PWA-3134::Resolved lint issues * PWA-3134::Formatted the code * PWA-3134::The signout event is not captured --------- Co-authored-by: arpit khare <84493875+glo42707@users.noreply.github.com> Co-authored-by: Aanchal Pawar <97873570+glo82145@users.noreply.github.com> Co-authored-by: glo82145 --- .../src/handlers/signOut.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 packages/extensions/experience-platform-connector/src/handlers/signOut.js diff --git a/packages/extensions/experience-platform-connector/src/handlers/signOut.js b/packages/extensions/experience-platform-connector/src/handlers/signOut.js new file mode 100644 index 0000000000..569ec03bca --- /dev/null +++ b/packages/extensions/experience-platform-connector/src/handlers/signOut.js @@ -0,0 +1,32 @@ +const canHandle = event => event.type === 'USER_SIGN_OUT'; + +const handle = sdk => { + sdk.context.setShopper({ + shopperId: 'guest' + }); + + const accountContext = { + firstName: '', + lastName: '', + emailAddress: '' + }; + + const cartContext = { + id, + prices: {}, + items: {}, + possibleOnepageCheckout: false, + giftMessageSelected: false, + giftWrappingSelected: false + }; + + sdk.context.setShoppingCart(cartContext); + sdk.context.setAccount(accountContext); + + sdk.publish.signOut(); +}; + +export default { + canHandle, + handle +}; From defc0c8348bae39003b7ee3252b1332d7030dcba Mon Sep 17 00:00:00 2001 From: Aanchal Pawar <97873570+glo82145@users.noreply.github.com> Date: Thu, 25 May 2023 12:09:36 +0530 Subject: [PATCH 7/7] PWA-2980::No results when filtering a category with a composite attribute from layered navigation (#4083) --- packages/peregrine/lib/talons/FilterModal/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/peregrine/lib/talons/FilterModal/helpers.js b/packages/peregrine/lib/talons/FilterModal/helpers.js index 23c0c343e0..5d3a7b163c 100644 --- a/packages/peregrine/lib/talons/FilterModal/helpers.js +++ b/packages/peregrine/lib/talons/FilterModal/helpers.js @@ -143,7 +143,7 @@ export const stripHtml = html => html.replace(/(<([^>]+)>)/gi, ''); /** GetFilterInput helpers below. */ const getValueFromFilterString = keyValueString => - keyValueString.split(DELIMITER)[1]; + keyValueString.split(DELIMITER).pop(); /** * Converts a set of values to a range filter