@faststore/core 4.9.2 → 4.9.3-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-generate.log +3 -3
- package/.turbo/turbo-test.log +150 -139
- package/CHANGELOG.md +10 -0
- package/package.json +6 -6
- package/src/components/region/RegionModal/useRegion.ts +2 -0
- package/src/sdk/cart/index.ts +11 -9
- package/src/sdk/localization/useLocalizationConfig.tsx +4 -0
- package/src/sdk/session/initialSession.ts +8 -0
- package/src/sdk/session/syncSalesChannelFromOrderForm.ts +55 -2
- package/src/utils/utilities.ts +9 -5
- package/test/components/region/useRegion.browser.test.ts +1 -1
- package/test/components/region/useRegion.test.ts +67 -0
- package/test/sdk/session/getInitialSession.browser.test.ts +8 -0
- package/test/sdk/session/reconcileSessionLocale.browser.test.ts +16 -0
- package/test/sdk/session/syncSalesChannelFromOrderForm.test.ts +158 -1
- package/test/utils/filterChannel.test.ts +25 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @faststore/core@4.9.
|
|
2
|
+
> @faststore/core@4.9.3-dev.0 generate /home/runner/work/faststore/faststore/packages/core
|
|
3
3
|
> pnpm run gen-types && pnpm run cache-graphql
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @faststore/core@4.9.
|
|
6
|
+
> @faststore/core@4.9.3-dev.0 gen-types /home/runner/work/faststore/faststore/packages/core
|
|
7
7
|
> node ../cli/bin/run generate-types .
|
|
8
8
|
|
|
9
9
|
[33m[STARTED][39m Parse Configuration
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
[32m[COMPLETED][39m Generate to @generated/
|
|
20
20
|
[32m[COMPLETED][39m Generate outputs
|
|
21
21
|
|
|
22
|
-
> @faststore/core@4.9.
|
|
22
|
+
> @faststore/core@4.9.3-dev.0 cache-graphql /home/runner/work/faststore/faststore/packages/core
|
|
23
23
|
> node ../cli/bin/run cache-graphql --config=./discovery.config.default.js --queries=./@generated/persisted-documents.json
|
|
24
24
|
|
|
25
25
|
[Info] - Config file location: /home/runner/work/faststore/faststore/packages/core/discovery.config.default.js
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @faststore/core@4.9.
|
|
2
|
+
> @faststore/core@4.9.3-dev.0 test /home/runner/work/faststore/faststore/packages/core
|
|
3
3
|
> vitest run
|
|
4
4
|
|
|
5
5
|
|
|
@@ -7,26 +7,33 @@
|
|
|
7
7
|
|
|
8
8
|
Not implemented: navigation to another Document
|
|
9
9
|
Not implemented: navigation to another Document
|
|
10
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/ui/useScrollRestoration.browser.test.ts [2m([22m[2m43 tests[22m[2m)[22m[33m
|
|
10
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/ui/useScrollRestoration.browser.test.ts [2m([22m[2m43 tests[22m[2m)[22m[33m 1198[2mms[22m[39m
|
|
11
11
|
Browserslist: browsers data (caniuse-lite) is 8 months old. Please run:
|
|
12
12
|
npx update-browserslist-db@latest
|
|
13
13
|
Why you should do it regularly: https://github.com/browserslist/update-db#readme
|
|
14
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/ContractSwitcher.browser.test.tsx [2m([22m[2m22 tests[22m[2m)[22m[33m
|
|
15
|
-
[33m[2m✓[22m[39m shows an error state when the list fails to load [33m
|
|
16
|
-
[33m[2m✓[22m[39m requires selecting a contract before Confirm is enabled, then switches (REQ-03) [33m
|
|
17
|
-
[33m[2m✓[22m[39m keeps Confirm disabled until a different contract is selected [33m
|
|
18
|
-
[33m[2m✓[22m[39m keeps Confirm disabled when
|
|
19
|
-
|
|
20
|
-
[33m[2m✓[22m[39m
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
[33m[2m✓[22m[39m
|
|
24
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/
|
|
25
|
-
|
|
26
|
-
[33m[2m✓[22m[39m
|
|
27
|
-
|
|
28
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/
|
|
29
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/
|
|
14
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/ContractSwitcher.browser.test.tsx [2m([22m[2m22 tests[22m[2m)[22m[33m 4246[2mms[22m[39m
|
|
15
|
+
[33m[2m✓[22m[39m shows an error state when the list fails to load [33m 715[2mms[22m[39m
|
|
16
|
+
[33m[2m✓[22m[39m requires selecting a contract before Confirm is enabled, then switches (REQ-03) [33m 424[2mms[22m[39m
|
|
17
|
+
[33m[2m✓[22m[39m keeps Confirm disabled until a different contract is selected [33m 371[2mms[22m[39m
|
|
18
|
+
[33m[2m✓[22m[39m keeps Confirm disabled when switching is unavailable [33m 368[2mms[22m[39m
|
|
19
|
+
[33m[2m✓[22m[39m keeps Confirm disabled when the selected contract is filtered out [33m 345[2mms[22m[39m
|
|
20
|
+
[33m[2m✓[22m[39m honors CMS-provided labels for the header, current session, search, footer, and available count [33m 363[2mms[22m[39m
|
|
21
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/cards/MyAccountListCards.browser.test.tsx [2m([22m[2m16 tests[22m[2m)[22m[33m 3043[2mms[22m[39m
|
|
22
|
+
[33m[2m✓[22m[39m shows the tab bar and renders Personal cards by default [33m 1270[2mms[22m[39m
|
|
23
|
+
[33m[2m✓[22m[39m paginates when there are more than 25 cards [33m 355[2mms[22m[39m
|
|
24
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/BuyingPolicyAlert.browser.test.tsx [2m([22m[2m13 tests[22m[2m)[22m[33m 3166[2mms[22m[39m
|
|
25
|
+
[33m[2m✓[22m[39m opens the reject confirmation modal with the default English copy [33m 1303[2mms[22m[39m
|
|
26
|
+
[33m[2m✓[22m[39m opens the reject confirmation modal with CMS-provided labels [33m 418[2mms[22m[39m
|
|
27
|
+
[33m[2m✓[22m[39m shows the default English toast when a policy is rejected [33m 314[2mms[22m[39m
|
|
28
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/CartRecommendationShelf/CartRecommendationShelf.browser.test.tsx [2m([22m[2m13 tests[22m[2m)[22m[33m 304[2mms[22m[39m
|
|
29
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/localization/useBindingSelector.browser.test.tsx [2m([22m[2m9 tests[22m[2m)[22m[32m 108[2mms[22m[39m
|
|
30
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationDrawer.browser.test.tsx [2m([22m[2m10 tests[22m[2m)[22m[33m 2015[2mms[22m[39m
|
|
31
|
+
[33m[2m✓[22m[39m renders the menu view with contract details and manage footer [33m 994[2mms[22m[39m
|
|
32
|
+
[33m[2m✓[22m[39m opens the contract switcher and returns to the menu on back [33m 367[2mms[22m[39m
|
|
33
|
+
[33m[2m✓[22m[39m resets to the menu when the drawer closes [33m 329[2mms[22m[39m
|
|
34
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/reconcileSessionLocale.browser.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 20[2mms[22m[39m
|
|
35
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/ui/ProductGallery/GalleryPageHeightLock.browser.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m 99[2mms[22m[39m
|
|
36
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/recommendations/useRecommendationShelf.browser.test.tsx [2m([22m[2m12 tests[22m[2m)[22m[32m 71[2mms[22m[39m
|
|
30
37
|
[90mstderr[2m | test/components/RecommendationShelf/RecommendationShelf.browser.test.tsx
|
|
31
38
|
[22m[39mError in optimistic validation: TypeError: Failed to parse URL from /api/graphql?operationName=ValidateCartMutation&operationHash=3c71b0d3fc2bade14df68abfa271858beb361b12
|
|
32
39
|
[90m at node:internal/deps/undici/undici:16416:13[39m
|
|
@@ -56,11 +63,11 @@ Browserslist: browsers data (caniuse-lite) is 8 months old. Please run:
|
|
|
56
63
|
[90mstderr[2m | test/components/RecommendationShelf/RecommendationShelf.browser.test.tsx[2m > [22m[2mRecommendationShelf[2m > [22m[2mrenders nothing when there is an error
|
|
57
64
|
[22m[39mError fetching recommendations [90mundefined[39m boom for campaign vrn:recommendations:acc:rec-top-items-v2:campaign-1
|
|
58
65
|
|
|
59
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/RecommendationShelf/RecommendationShelf.browser.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
60
|
-
[32m✓[39m [30m[46m browser [49m[39m test/
|
|
61
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/
|
|
62
|
-
[32m✓[39m [30m[46m browser [49m[39m test/
|
|
63
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/navigation/Navbar.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
66
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/RecommendationShelf/RecommendationShelf.browser.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m 165[2mms[22m[39m
|
|
67
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/CartSidebar/CartSidebar.browser.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[32m 75[2mms[22m[39m
|
|
68
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrderDetails.browser.test.tsx [2m([22m[2m4 tests[22m[2m)[22m[32m 93[2mms[22m[39m
|
|
69
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/getInitialSession.browser.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 11[2mms[22m[39m
|
|
70
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/navigation/Navbar.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 92[2mms[22m[39m
|
|
64
71
|
[90mstderr[2m | test/pages/password-protection.browser.test.tsx[2m > [22m[2mPasswordProtectionLogin[2m > [22m[2mposts the password and redirects to the requested return path
|
|
65
72
|
[22m[39mWarning: An update to PasswordProtectionLogin inside a test was not wrapped in act(...).
|
|
66
73
|
|
|
@@ -242,6 +249,7 @@ act(() => {
|
|
|
242
249
|
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act
|
|
243
250
|
at PasswordProtectionLogin (/home/runner/work/faststore/faststore/packages/core/src/pages/password-protection/index.tsx:19:69)
|
|
244
251
|
|
|
252
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationDrawerFooter.browser.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[33m 545[2mms[22m[39m
|
|
245
253
|
[90mstderr[2m | test/pages/password-protection.browser.test.tsx[2m > [22m[2mPasswordProtectionLogin[2m > [22m[2mshows service unavailable when the login request fails
|
|
246
254
|
[22m[39mWarning: An update to PasswordProtectionLogin inside a test was not wrapped in act(...).
|
|
247
255
|
|
|
@@ -290,10 +298,8 @@ act(() => {
|
|
|
290
298
|
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act
|
|
291
299
|
at PasswordProtectionLogin (/home/runner/work/faststore/faststore/packages/core/src/pages/password-protection/index.tsx:19:69)
|
|
292
300
|
|
|
293
|
-
[32m✓[39m [30m[46m browser [49m[39m test/pages/password-protection.browser.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[33m
|
|
294
|
-
|
|
295
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationDrawerFooter.browser.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m 281[2mms[22m[39m
|
|
296
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/useSwitchContract.browser.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 36[2mms[22m[39m
|
|
301
|
+
[32m✓[39m [30m[46m browser [49m[39m test/pages/password-protection.browser.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[33m 997[2mms[22m[39m
|
|
302
|
+
[33m[2m✓[22m[39m renders the password protection form [33m 459[2mms[22m[39m
|
|
297
303
|
[90mstderr[2m | test/components/cms/RenderSections.browser.test.tsx
|
|
298
304
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
299
305
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
@@ -302,9 +308,9 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
302
308
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
303
309
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
304
310
|
|
|
305
|
-
[32m✓[39m [30m[46m browser [49m[39m test/
|
|
306
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/navigation/NavbarSlider.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
307
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/
|
|
311
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/useSwitchContract.browser.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 54[2mms[22m[39m
|
|
312
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/navigation/NavbarSlider.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 45[2mms[22m[39m
|
|
313
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/cms/RenderSections.browser.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[32m 102[2mms[22m[39m
|
|
308
314
|
[90mstderr[2m | test/sdk/localization/store-url.browser.test.ts
|
|
309
315
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
310
316
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
@@ -313,14 +319,15 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
313
319
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
314
320
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
315
321
|
|
|
316
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/localization/store-url.browser.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
317
|
-
[32m✓[39m [30m[46m browser [49m[39m test/
|
|
318
|
-
[32m✓[39m [30m[46m browser [49m[39m test/
|
|
319
|
-
[32m✓[39m [30m[46m browser [49m[39m test/
|
|
322
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/localization/store-url.browser.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
323
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/Menu.browser.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[33m 403[2mms[22m[39m
|
|
324
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/useAvailableContracts.browser.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 28[2mms[22m[39m
|
|
325
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/templates/SearchPage/SearchWrapper.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 42[2mms[22m[39m
|
|
326
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/recommendations/useRecommendationShelf.sessionFallback.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 139[2mms[22m[39m
|
|
320
327
|
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountListQuotes.browser.test.tsx [2m([22m[2m4 tests[22m[2m)[22m[32m 104[2mms[22m[39m
|
|
321
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/navigation/NavbarAccountArea.browser.test.tsx [2m([22m[2m4 tests[22m[2m)[22m[32m
|
|
322
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/CartRecommendationShelf/CartRecommendationProductCard.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
323
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/changeContractToken.browser.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m
|
|
328
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/navigation/NavbarAccountArea.browser.test.tsx [2m([22m[2m4 tests[22m[2m)[22m[32m 72[2mms[22m[39m
|
|
329
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/CartRecommendationShelf/CartRecommendationProductCard.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 49[2mms[22m[39m
|
|
330
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/changeContractToken.browser.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m 20[2mms[22m[39m
|
|
324
331
|
[90mstderr[2m | test/components/account/doLogout.browser.test.ts
|
|
325
332
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
326
333
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
@@ -329,9 +336,9 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
329
336
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
330
337
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
331
338
|
|
|
332
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/doLogout.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
333
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/ui/LocalizationButton.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
334
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationDrawerHeader.browser.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[
|
|
339
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/doLogout.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 35[2mms[22m[39m
|
|
340
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/ui/LocalizationButton.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 36[2mms[22m[39m
|
|
341
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationDrawerHeader.browser.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[33m 383[2mms[22m[39m
|
|
335
342
|
[90mstderr[2m | test/sdk/account/clearPersistedSessionState.browser.test.ts
|
|
336
343
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
337
344
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
@@ -340,14 +347,14 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
340
347
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
341
348
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
342
349
|
|
|
343
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/clearPersistedSessionState.browser.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m
|
|
344
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrderDelivery.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
345
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryOptionAccordion.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
346
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrderStatus.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
347
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/region/useRegion.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
348
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountListCards.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
349
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrdersList.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
350
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/SummaryCard.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
350
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/clearPersistedSessionState.browser.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 14[2mms[22m[39m
|
|
351
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrderDelivery.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 103[2mms[22m[39m
|
|
352
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryOptionAccordion.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 106[2mms[22m[39m
|
|
353
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrderStatus.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 127[2mms[22m[39m
|
|
354
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/region/useRegion.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 18[2mms[22m[39m
|
|
355
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountListCards.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 94[2mms[22m[39m
|
|
356
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrdersList.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 31[2mms[22m[39m
|
|
357
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/SummaryCard.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 107[2mms[22m[39m
|
|
351
358
|
[90mstderr[2m | test/sdk/session/sessionStore.browser.test.ts
|
|
352
359
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
353
360
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
@@ -356,9 +363,9 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
356
363
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
357
364
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
358
365
|
|
|
359
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationSignInButton.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[
|
|
360
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/sessionStore.browser.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
361
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryOptionAccordionDeliveryInfo.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
366
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationSignInButton.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[33m 314[2mms[22m[39m
|
|
367
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/sessionStore.browser.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
368
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryOptionAccordionDeliveryInfo.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m 44[2mms[22m[39m
|
|
362
369
|
[90mstderr[2m | test/sdk/session/validateSession.browser.test.ts
|
|
363
370
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
364
371
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
@@ -367,14 +374,14 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
367
374
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
368
375
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
369
376
|
|
|
370
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/validateSession.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
371
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/StatusCard.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
372
|
-
[32m✓[39m [30m[46m browser [49m[39m test/utils/isLocalHost.browser.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
373
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/reconcileSessionLocale.disabled.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
374
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryCard.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
375
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryOptionAccordionProducts.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
376
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/skeletons/ProductGridSkeleton.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
377
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/bindingPaths.test.ts [2m([22m[2m71 tests[22m[2m)[22m[32m
|
|
377
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/validateSession.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
378
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/StatusCard.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 123[2mms[22m[39m
|
|
379
|
+
[32m✓[39m [30m[46m browser [49m[39m test/utils/isLocalHost.browser.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
380
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/reconcileSessionLocale.disabled.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
381
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryCard.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m 55[2mms[22m[39m
|
|
382
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryOptionAccordionProducts.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m 56[2mms[22m[39m
|
|
383
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/skeletons/ProductGridSkeleton.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 30[2mms[22m[39m
|
|
384
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/bindingPaths.test.ts [2m([22m[2m71 tests[22m[2m)[22m[32m 29[2mms[22m[39m
|
|
378
385
|
[90mstderr[2m | test/sdk/account/refreshToken.browser.test.ts
|
|
379
386
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
380
387
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
@@ -383,14 +390,13 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
383
390
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
384
391
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
385
392
|
|
|
386
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/refreshToken.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
387
|
-
[32m✓[39m [30m[43m node [49m[39m test/server/password-protection-service.test.ts [2m([22m[2m22 tests[22m[2m)[22m[32m
|
|
388
|
-
[32m✓[39m [30m[43m node [49m[39m test/pages/api/switch-contract.test.ts [2m([22m[2m25 tests[22m[2m)[22m[32m
|
|
389
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/FilterFacetPendingApproval.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
393
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/refreshToken.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
394
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/password-protection-service.test.ts [2m([22m[2m22 tests[22m[2m)[22m[32m 41[2mms[22m[39m
|
|
395
|
+
[32m✓[39m [30m[43m node [49m[39m test/pages/api/switch-contract.test.ts [2m([22m[2m25 tests[22m[2m)[22m[32m 89[2mms[22m[39m
|
|
396
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/FilterFacetPendingApproval.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m 223[2mms[22m[39m
|
|
390
397
|
[32m✓[39m [30m[43m node [49m[39m test/utils/match-url.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
391
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/useBindingSelector.test.tsx [2m([22m[2m22 tests[22m[2m)[22m[32m
|
|
392
|
-
[32m✓[39m [30m[43m node [49m[39m test/pages/api/unlock.test.ts [2m([22m[2m15 tests[22m[2m)[22m[32m
|
|
393
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/bindingSelector.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m 9[2mms[22m[39m
|
|
398
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/useBindingSelector.test.tsx [2m([22m[2m22 tests[22m[2m)[22m[32m 15[2mms[22m[39m
|
|
399
|
+
[32m✓[39m [30m[43m node [49m[39m test/pages/api/unlock.test.ts [2m([22m[2m15 tests[22m[2m)[22m[32m 209[2mms[22m[39m
|
|
394
400
|
[90mstderr[2m | test/components/search/SearchInputComponent.test.tsx
|
|
395
401
|
[22m[39mWarning: forwardRef render functions accept exactly two parameters: props and ref. Did you forget to use the ref parameter?
|
|
396
402
|
|
|
@@ -454,22 +460,25 @@ Warning: React does not recognize the `providerProps` prop on a DOM element. If
|
|
|
454
460
|
at Suspense
|
|
455
461
|
at Wrapper (/home/runner/work/faststore/faststore/packages/core/test/components/search/SearchInputComponent.test.tsx:106:20)
|
|
456
462
|
|
|
457
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
458
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/
|
|
459
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/
|
|
463
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/session/syncSalesChannelFromOrderForm.test.ts [2m([22m[2m14 tests[22m[2m)[22m[32m 15[2mms[22m[39m
|
|
464
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/search/SearchInputComponent.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[32m 72[2mms[22m[39m
|
|
465
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/bindingSelector.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m 9[2mms[22m[39m
|
|
466
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountListQuotesTable.test.tsx [2m([22m[2m15 tests[22m[2m)[22m[33m 500[2mms[22m[39m
|
|
467
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/search/useSearchHistory.test.ts [2m([22m[2m13 tests[22m[2m)[22m[32m 50[2mms[22m[39m
|
|
460
468
|
[90mstderr[2m | test/pages/pvt/account/cards/index.test.ts[2m > [22m[2mCards page getServerSideProps[2m > [22m[2mredirects to /pvt/account/403 when the query fails with 401/403
|
|
461
469
|
[22m[39m{ extensions: { status: [33m401[39m } }
|
|
462
470
|
|
|
463
471
|
[90mstderr[2m | test/pages/pvt/account/cards/index.test.ts[2m > [22m[2mCards page getServerSideProps[2m > [22m[2mrenders the error state (no redirect) when the query fails with a non-auth status
|
|
464
472
|
[22m[39m{ extensions: { status: [33m502[39m } }
|
|
465
473
|
|
|
466
|
-
[32m✓[39m [30m[43m node [49m[39m test/pages/pvt/account/cards/index.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
467
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountListQuotes.test.tsx [2m([22m[2m11 tests[22m[2m)[22m[33m
|
|
468
|
-
[33m[2m✓[22m[39m navigates with the search term on blur [33m
|
|
469
|
-
[33m[2m✓[22m[39m navigates without a label param when the search is cleared [33m
|
|
470
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/cookieCacheBusting.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m
|
|
471
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/quoteFilters.test.ts [2m([22m[2m26 tests[22m[2m)[22m[32m
|
|
472
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/productJsonLd.test.ts [2m([22m[2m36 tests[22m[2m)[22m[32m
|
|
474
|
+
[32m✓[39m [30m[43m node [49m[39m test/pages/pvt/account/cards/index.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
475
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountListQuotes.test.tsx [2m([22m[2m11 tests[22m[2m)[22m[33m 854[2mms[22m[39m
|
|
476
|
+
[33m[2m✓[22m[39m navigates with the search term on blur [33m 360[2mms[22m[39m
|
|
477
|
+
[33m[2m✓[22m[39m navigates without a label param when the search is cleared [33m 360[2mms[22m[39m
|
|
478
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/cookieCacheBusting.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m 15[2mms[22m[39m
|
|
479
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/quoteFilters.test.ts [2m([22m[2m26 tests[22m[2m)[22m[32m 34[2mms[22m[39m
|
|
480
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/productJsonLd.test.ts [2m([22m[2m36 tests[22m[2m)[22m[32m 16[2mms[22m[39m
|
|
481
|
+
[32m✓[39m [30m[43m node [49m[39m test/experimental/myAccountCmsServerSideProps.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 11[2mms[22m[39m
|
|
473
482
|
[90mstderr[2m | test/pages/api/graphql.test.ts[2m > [22m[2m/api/graphql error status propagation[2m > [22m[2mpropagates the upstream 400 from a wrapped BadRequestError instead of 500
|
|
474
483
|
[22m[39mGraphql execution returned with error: [
|
|
475
484
|
{
|
|
@@ -537,7 +546,7 @@ Warning: React does not recognize the `providerProps` prop on a DOM element. If
|
|
|
537
546
|
|
|
538
547
|
[90mstderr[2m | test/pages/api/graphql.test.ts[2m > [22m[2m/api/graphql request handling[2m > [22m[2mmaps UnauthorizedError thrown by execute to its status
|
|
539
548
|
[22m[39mSomething unexpected occurred querying Graphql endpoint:
|
|
540
|
-
|
|
549
|
+
ce [FastStoreError]: expired
|
|
541
550
|
at [90m/home/runner/work/faststore/faststore/packages/core/[39mtest/pages/api/graphql.test.ts:202:33
|
|
542
551
|
at [90m/home/runner/work/faststore/faststore/packages/core/[39mtest/pages/api/graphql.test.ts:207:39
|
|
543
552
|
at file:///home/runner/work/faststore/faststore/node_modules/[4m.pnpm[24m/@vitest+runner@4.0.18/node_modules/[4m@vitest/runner[24m/dist/index.js:1024:60
|
|
@@ -579,72 +588,74 @@ Warning: React does not recognize the `providerProps` prop on a DOM element. If
|
|
|
579
588
|
at trace (file:///home/runner/work/faststore/faststore/node_modules/[4m.pnpm[24m/vitest@4.0.18_@opentelemetry+api@1.9.0_@types+node@20.19.13_jiti@2.6.1_jsdom@27.4.0_sas_13be941c57d55f08f06eeaf1c180ddfe/node_modules/[4mvitest[24m/dist/chunks/test.B8ej_ZHS.js:239:21)
|
|
580
589
|
at runTest (file:///home/runner/work/faststore/faststore/node_modules/[4m.pnpm[24m/@vitest+runner@4.0.18/node_modules/[4m@vitest/runner[24m/dist/index.js:1653:12)
|
|
581
590
|
|
|
582
|
-
[32m✓[39m [30m[43m node [49m[39m test/pages/api/graphql.test.ts [2m([22m[2m19 tests[22m[2m)[22m[32m
|
|
583
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
584
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/
|
|
585
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/multipleTemplates.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
591
|
+
[32m✓[39m [30m[43m node [49m[39m test/pages/api/graphql.test.ts [2m([22m[2m19 tests[22m[2m)[22m[32m 35[2mms[22m[39m
|
|
592
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/clearCookies.test.ts [2m([22m[2m20 tests[22m[2m)[22m[32m 23[2mms[22m[39m
|
|
593
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/multipleTemplates.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
586
594
|
[90mstderr[2m | test/sdk/account/useSetPassword.test.ts[2m > [22m[2museSetPassword[2m > [22m[2mmaps wrongcredentials error responses to the existing message
|
|
587
595
|
[22m[39mSet password request failed: Bad Request
|
|
588
596
|
|
|
589
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/useSetPassword.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m
|
|
590
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderEntryOperation.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
591
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/localizeRedirectDestination.test.ts [2m([22m[2m11 tests[22m[2m)[22m[32m
|
|
592
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesFilterSlider.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
593
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesStatusSelector.test.tsx [2m([22m[2m14 tests[22m[2m)[22m[32m
|
|
594
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/hreflang.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
595
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/getMyAccountRoutes.test.ts [2m([22m[2m13 tests[22m[2m)[22m[32m
|
|
596
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesSelectedTags.test.tsx [2m([22m[2m10 tests[22m[2m)[22m[32m
|
|
597
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/redirects/index.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m
|
|
598
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderEntryUpload.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
599
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
600
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
601
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/getDeliveryOptionLabel.test.ts [2m([22m[2m21 tests[22m[2m)[22m[32m
|
|
602
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/graphql/retryPolicy.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m
|
|
603
|
-
[32m✓[39m [30m[43m node [49m[39m test/server/cms/myAccountDefaultSections.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m
|
|
604
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/productJsonLdRendering.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[32m
|
|
605
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/
|
|
606
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
607
|
-
[32m✓[39m [30m[43m node [49m[39m test/proxy.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m
|
|
608
|
-
[32m✓[39m [30m[43m node [49m[39m test/server/webops-api.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m
|
|
609
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
610
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/
|
|
611
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
612
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
613
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/
|
|
614
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/refreshToken.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
597
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/useSetPassword.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 47[2mms[22m[39m
|
|
598
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderEntryOperation.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 34[2mms[22m[39m
|
|
599
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/localizeRedirectDestination.test.ts [2m([22m[2m11 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
600
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesFilterSlider.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m 170[2mms[22m[39m
|
|
601
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesStatusSelector.test.tsx [2m([22m[2m14 tests[22m[2m)[22m[32m 197[2mms[22m[39m
|
|
602
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/hreflang.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
603
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/getMyAccountRoutes.test.ts [2m([22m[2m13 tests[22m[2m)[22m[32m 11[2mms[22m[39m
|
|
604
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesSelectedTags.test.tsx [2m([22m[2m10 tests[22m[2m)[22m[32m 155[2mms[22m[39m
|
|
605
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/redirects/index.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 45[2mms[22m[39m
|
|
606
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderEntryUpload.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 62[2mms[22m[39m
|
|
607
|
+
[32m✓[39m [30m[43m node [49m[39m test/proxy.localization.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 76[2mms[22m[39m
|
|
608
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderEntry.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 50[2mms[22m[39m
|
|
609
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/getDeliveryOptionLabel.test.ts [2m([22m[2m21 tests[22m[2m)[22m[32m 9[2mms[22m[39m
|
|
610
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/graphql/retryPolicy.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m 21[2mms[22m[39m
|
|
611
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/cms/myAccountDefaultSections.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
612
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/productJsonLdRendering.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[32m 15[2mms[22m[39m
|
|
613
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/analytics/useStartRecommendationSession.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 33[2mms[22m[39m
|
|
614
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderFormItems.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 26[2mms[22m[39m
|
|
615
|
+
[32m✓[39m [30m[43m node [49m[39m test/proxy.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 18[2mms[22m[39m
|
|
616
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/webops-api.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
617
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/StatusCard.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 19[2mms[22m[39m
|
|
618
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/store-url.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
619
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/cart/waitForSessionValidated.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
620
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/content/service.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
621
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/refreshToken.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
615
622
|
[32m✓[39m [30m[43m node [49m[39m test/server/cms/global.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
616
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
617
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
623
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/auth/useAuth.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 30[2mms[22m[39m
|
|
624
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/rootSpan.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 41[2mms[22m[39m
|
|
618
625
|
[32m✓[39m [30m[43m node [49m[39m test/utils/getRequestHostname.test.ts [2m([22m[2m12 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
619
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
620
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
621
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
622
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/validateSessionRefreshToken.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m
|
|
623
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
627
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
628
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/
|
|
629
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
630
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
631
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/
|
|
632
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/recommendations/
|
|
633
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/
|
|
634
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
635
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
636
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
626
|
+
[32m✓[39m [30m[43m node [49m[39m test/pages/api/preview.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
627
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/Layout.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[32m 49[2mms[22m[39m
|
|
628
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/search/SearchInput.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
629
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/validateSessionRefreshToken.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
630
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/index.test.ts [2m([22m[2m7 tests[22m[2m)[22m[33m 5149[2mms[22m[39m
|
|
631
|
+
[33m[2m✓[22m[39m should return a valid merged GraphQL schema [33m 302[2mms[22m[39m
|
|
632
|
+
[33m[2m✓[22m[39m should handle options and execute [33m 4558[2mms[22m[39m
|
|
633
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/recommendations/vrn.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
634
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/region/useRegion.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 29[2mms[22m[39m
|
|
635
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/retry.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 16[2mms[22m[39m
|
|
636
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/cms/index.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
637
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/getB2BSessionClaims.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
638
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/userOrderStatus.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
639
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/recommendations/useRecommendationUserId.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 187[2mms[22m[39m
|
|
640
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/unlockResponse.test.ts [2m([22m[2m11 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
641
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/recommendations/useRecommendations.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
642
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/OrganizationDrawerBody.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 49[2mms[22m[39m
|
|
643
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/isLocalHost.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
644
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/session/toSessionInput.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
645
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuoteStatusBadge.test.tsx [2m([22m[2m4 tests[22m[2m)[22m[32m 37[2mms[22m[39m
|
|
646
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/getOrderTotalLabel.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
637
647
|
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/listOrdersLabels.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
638
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/getCookie.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m
|
|
639
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/session/isSignInAreaResolved.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
640
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
641
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
642
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
643
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
644
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
[2m
|
|
648
|
-
[2m
|
|
649
|
-
[2m
|
|
648
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/getCookie.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
649
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/session/isSignInAreaResolved.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
650
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/auth/ProfileChallenge.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 34[2mms[22m[39m
|
|
651
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/filterChannel.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
652
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/analytics/utils.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
653
|
+
[32m✓[39m [30m[43m node [49m[39m test/instrumentation.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
654
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/orderDetailsLabels.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
655
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/clearPersistedSessionState.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 10[2mms[22m[39m
|
|
656
|
+
|
|
657
|
+
[2m Test Files [22m [1m[32m129 passed[39m[22m[90m (129)[39m
|
|
658
|
+
[2m Tests [22m [1m[32m1005 passed[39m[22m[90m (1005)[39m
|
|
659
|
+
[2m Start at [22m 19:28:12
|
|
660
|
+
[2m Duration [22m 64.24s[2m (transform 13.31s, setup 0ms, import 54.17s, tests 28.07s, environment 78.66s)[22m
|
|
650
661
|
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.9.3-dev.1](https://github.com/vtex/faststore/compare/v4.9.3-dev.0...v4.9.3-dev.1) (2026-10-06)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- keep empty carts from moving the session sales channel ([#3509](https://github.com/vtex/faststore/issues/3509)) ([600fb7d](https://github.com/vtex/faststore/commit/600fb7d9403553c12bd01d6b3955f18c48f91054)), closes [#3435](https://github.com/vtex/faststore/issues/3435) [#3435](https://github.com/vtex/faststore/issues/3435)
|
|
11
|
+
|
|
12
|
+
## [4.9.3-dev.0](https://github.com/vtex/faststore/compare/v4.9.1-dev.0...v4.9.3-dev.0) (2026-10-05)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @faststore/core
|
|
15
|
+
|
|
6
16
|
## [4.9.2](https://github.com/vtex/faststore/compare/v4.9.1...v4.9.2) (2026-10-02)
|
|
7
17
|
|
|
8
18
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.3-dev.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
"style-loader": "^3.3.1",
|
|
72
72
|
"swr": "^2.2.5",
|
|
73
73
|
"use-sync-external-store": "^1.6.0",
|
|
74
|
-
"@faststore/api": "4.9.
|
|
75
|
-
"@faststore/diagnostics": "4.9.
|
|
76
|
-
"@faststore/lighthouse": "4.9.
|
|
77
|
-
"@faststore/
|
|
78
|
-
"@faststore/
|
|
74
|
+
"@faststore/api": "4.9.3-dev.1",
|
|
75
|
+
"@faststore/diagnostics": "4.9.3-dev.1",
|
|
76
|
+
"@faststore/lighthouse": "4.9.3-dev.1",
|
|
77
|
+
"@faststore/sdk": "4.9.3-dev.1",
|
|
78
|
+
"@faststore/ui": "4.9.3-dev.1"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@cypress/code-coverage": "^3.12.1",
|
|
@@ -41,8 +41,10 @@ export default function useRegion(): UseRegionValues {
|
|
|
41
41
|
|
|
42
42
|
try {
|
|
43
43
|
// `session` usually comes from `useSession()`, which also carries UI state
|
|
44
|
+
// and filters session-only channel keys (sales channel markers).
|
|
44
45
|
const newSession = {
|
|
45
46
|
...toSessionInput(session),
|
|
47
|
+
channel: sessionStore.read()?.channel ?? session.channel,
|
|
46
48
|
postalCode,
|
|
47
49
|
geoCoordinates: null, // Revalidate geo coordinates in API when users set a new postal code
|
|
48
50
|
} as Session
|
package/src/sdk/cart/index.ts
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
sessionStore,
|
|
19
19
|
toSessionInput,
|
|
20
20
|
} from '../session'
|
|
21
|
-
import {
|
|
21
|
+
import { syncSessionWithValidatedCart } from '../session/syncSalesChannelFromOrderForm'
|
|
22
22
|
import { createValidationStore, useStore } from '../useStore'
|
|
23
23
|
import { waitForSessionValidated } from './waitForSessionValidated'
|
|
24
24
|
|
|
@@ -162,14 +162,16 @@ const validateCart = async (cart: Cart): Promise<Cart | null> => {
|
|
|
162
162
|
},
|
|
163
163
|
})
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
165
|
+
syncSessionWithValidatedCart(
|
|
166
|
+
{
|
|
167
|
+
adoptedSalesChannel: validated?.order?.salesChannel,
|
|
168
|
+
// `null` means the browser cart is already valid.
|
|
169
|
+
itemCount: (validated ? validated.order.acceptedOffer : cart.items)
|
|
170
|
+
.length,
|
|
171
|
+
},
|
|
172
|
+
() => sessionStore.read(),
|
|
173
|
+
(session) => sessionStore.setSilent(session)
|
|
174
|
+
)
|
|
173
175
|
|
|
174
176
|
return (
|
|
175
177
|
validated && {
|
|
@@ -47,6 +47,10 @@ export const useLocalizationConfig = (params?: { url?: string | URL }) => {
|
|
|
47
47
|
const session = sessionRef.current
|
|
48
48
|
const channel = JSON.parse(session.channel ?? '{}') ?? {}
|
|
49
49
|
channel.salesChannel = settings.salesChannel
|
|
50
|
+
// The URL is the SC intent: validateCart never adopts over it.
|
|
51
|
+
channel.salesChannelSource = 'url'
|
|
52
|
+
// Adoption never applies on the URL SC, so a recorded rejection is moot.
|
|
53
|
+
delete channel.rejectedSalesChannel
|
|
50
54
|
|
|
51
55
|
const newSession = {
|
|
52
56
|
...session,
|
|
@@ -46,6 +46,10 @@ export function getInitialSession(
|
|
|
46
46
|
const settings = getSettings()
|
|
47
47
|
const channel = JSON.parse(defaults.channel ?? '{}') ?? {}
|
|
48
48
|
channel.salesChannel = settings.salesChannel
|
|
49
|
+
// The URL is the SC intent: validateCart never adopts over it.
|
|
50
|
+
channel.salesChannelSource = 'url'
|
|
51
|
+
// Adoption never applies on the URL SC, so a recorded rejection is moot.
|
|
52
|
+
delete channel.rejectedSalesChannel
|
|
49
53
|
|
|
50
54
|
return {
|
|
51
55
|
...defaults,
|
|
@@ -81,6 +85,10 @@ export function reconcileSessionLocale(fromIDB: Session): Session {
|
|
|
81
85
|
const settings = getSettings()
|
|
82
86
|
const channel = safeParseChannel(fromIDB.channel)
|
|
83
87
|
channel.salesChannel = settings.salesChannel
|
|
88
|
+
// The URL is the SC intent: validateCart never adopts over it.
|
|
89
|
+
channel.salesChannelSource = 'url'
|
|
90
|
+
// Adoption never applies on the URL SC, so a recorded rejection is moot.
|
|
91
|
+
delete channel.rejectedSalesChannel
|
|
84
92
|
|
|
85
93
|
return {
|
|
86
94
|
...fromIDB,
|
|
@@ -35,8 +35,9 @@ function readSalesChannel(channel: Record<string, unknown>): string {
|
|
|
35
35
|
* (e.g. after Quick Order) without revalidating the cart.
|
|
36
36
|
*
|
|
37
37
|
* Uses `sessionStore.setSilent` so we do not trigger `cartStore.set` mid-flight
|
|
38
|
-
* (that race previously wiped SC-exclusive items). Marks the channel
|
|
39
|
-
*
|
|
38
|
+
* (that race previously wiped SC-exclusive items). Marks the channel with
|
|
39
|
+
* `salesChannelSource: 'orderForm'` so `validateSession` keeps it until the
|
|
40
|
+
* cart is empty (see `releaseAdoptedSalesChannel`).
|
|
40
41
|
*/
|
|
41
42
|
export function syncSalesChannelFromOrderForm(
|
|
42
43
|
salesChannel: string | null | undefined,
|
|
@@ -61,8 +62,60 @@ export function syncSalesChannelFromOrderForm(
|
|
|
61
62
|
...channel,
|
|
62
63
|
salesChannel: nextSalesChannel,
|
|
63
64
|
hasOnlyDefaultSalesChannel: false,
|
|
65
|
+
salesChannelSource: 'orderForm',
|
|
64
66
|
}),
|
|
65
67
|
})
|
|
66
68
|
|
|
67
69
|
return true
|
|
68
70
|
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Drops the orderForm adoption marker and any rejected SC once the cart has no
|
|
74
|
+
* items, so Session Manager can again reject or replace the sales channel on
|
|
75
|
+
* the next `validateSession`. The SC itself is kept: an empty `salesChannel`
|
|
76
|
+
* would reach Checkout and catalog queries.
|
|
77
|
+
*/
|
|
78
|
+
export function releaseAdoptedSalesChannel(
|
|
79
|
+
readSession: () => Session,
|
|
80
|
+
setSilent: (session: Session) => void
|
|
81
|
+
): boolean {
|
|
82
|
+
const session = readSession()
|
|
83
|
+
const { salesChannelSource, rejectedSalesChannel, ...channel } =
|
|
84
|
+
parseChannelRecord(session.channel)
|
|
85
|
+
const isAdopted = salesChannelSource === 'orderForm'
|
|
86
|
+
|
|
87
|
+
if (!isAdopted && rejectedSalesChannel === undefined) {
|
|
88
|
+
return false
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
setSilent({
|
|
92
|
+
...session,
|
|
93
|
+
channel: JSON.stringify(
|
|
94
|
+
isAdopted || salesChannelSource === undefined
|
|
95
|
+
? channel
|
|
96
|
+
: { ...channel, salesChannelSource }
|
|
97
|
+
),
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
return true
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Applies the sales channel outcome of a `validateCart` to the session: adopt
|
|
105
|
+
* the orderForm SC when the API returned one, release the adoption once the
|
|
106
|
+
* cart is empty.
|
|
107
|
+
*/
|
|
108
|
+
export function syncSessionWithValidatedCart(
|
|
109
|
+
{
|
|
110
|
+
adoptedSalesChannel,
|
|
111
|
+
itemCount,
|
|
112
|
+
}: { adoptedSalesChannel: string | null | undefined; itemCount: number },
|
|
113
|
+
readSession: () => Session,
|
|
114
|
+
setSilent: (session: Session) => void
|
|
115
|
+
) {
|
|
116
|
+
syncSalesChannelFromOrderForm(adoptedSalesChannel, readSession, setSilent)
|
|
117
|
+
|
|
118
|
+
if (itemCount === 0) {
|
|
119
|
+
releaseAdoptedSalesChannel(readSession, setSilent)
|
|
120
|
+
}
|
|
121
|
+
}
|
package/src/utils/utilities.ts
CHANGED
|
@@ -110,9 +110,9 @@ export const toArray = <T>(x: T[] | T | undefined) =>
|
|
|
110
110
|
Array.isArray(x) ? x : x ? [x] : []
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
* Filters the channel object by removing the hasOnlyDefaultSalesChannel
|
|
114
|
-
*
|
|
115
|
-
* so we remove
|
|
113
|
+
* Filters the channel object by removing the hasOnlyDefaultSalesChannel, salesChannelSource and rejectedSalesChannel keys.
|
|
114
|
+
* These keys are session-only (useAuth and the ValidateSession/ValidateCart mutations),
|
|
115
|
+
* so we remove them from the session's channel object to avoid unnecessary cache invalidations and query executions
|
|
116
116
|
*
|
|
117
117
|
* @param channel - The channel string to filter.
|
|
118
118
|
* @returns The filtered channel string.
|
|
@@ -122,8 +122,12 @@ export function filterChannel(channel: string): string {
|
|
|
122
122
|
return '{}'
|
|
123
123
|
}
|
|
124
124
|
try {
|
|
125
|
-
const {
|
|
126
|
-
|
|
125
|
+
const {
|
|
126
|
+
hasOnlyDefaultSalesChannel,
|
|
127
|
+
salesChannelSource,
|
|
128
|
+
rejectedSalesChannel,
|
|
129
|
+
...filteredChannel
|
|
130
|
+
} = JSON.parse(channel)
|
|
127
131
|
return JSON.stringify(filteredChannel)
|
|
128
132
|
} catch {
|
|
129
133
|
console.warn('[filterChannel] Invalid channel JSON:', channel)
|
|
@@ -7,7 +7,7 @@ const mockSessionSet = vi.hoisted(() => vi.fn())
|
|
|
7
7
|
|
|
8
8
|
vi.mock('src/sdk/session', async () => ({
|
|
9
9
|
validateSession: mockValidateSession,
|
|
10
|
-
sessionStore: { set: mockSessionSet },
|
|
10
|
+
sessionStore: { set: mockSessionSet, read: vi.fn() },
|
|
11
11
|
toSessionInput: (await import('src/sdk/session/toSessionInput'))
|
|
12
12
|
.toSessionInput,
|
|
13
13
|
}))
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vitest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { act, renderHook } from '@testing-library/react'
|
|
6
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
7
|
+
|
|
8
|
+
const { mockRead, mockSet, mockValidateSession } = vi.hoisted(() => ({
|
|
9
|
+
mockRead: vi.fn(),
|
|
10
|
+
mockSet: vi.fn(),
|
|
11
|
+
mockValidateSession: vi.fn(),
|
|
12
|
+
}))
|
|
13
|
+
|
|
14
|
+
vi.mock('src/sdk/session', async () => ({
|
|
15
|
+
sessionStore: { read: mockRead, set: mockSet },
|
|
16
|
+
validateSession: mockValidateSession,
|
|
17
|
+
toSessionInput: (await import('src/sdk/session/toSessionInput'))
|
|
18
|
+
.toSessionInput,
|
|
19
|
+
}))
|
|
20
|
+
vi.mock('discovery.config', () => ({ deliveryPromise: { enabled: false } }))
|
|
21
|
+
vi.mock('src/sdk/product', () => ({ getProductCount: vi.fn() }))
|
|
22
|
+
|
|
23
|
+
import useRegion from '../../../src/components/region/RegionModal/useRegion'
|
|
24
|
+
|
|
25
|
+
// What `useSession()` hands to region components: `filterChannel` already
|
|
26
|
+
// stripped the session-only keys.
|
|
27
|
+
const filteredSession = {
|
|
28
|
+
locale: 'en-US',
|
|
29
|
+
currency: { code: 'USD', symbol: '$' },
|
|
30
|
+
country: 'USA',
|
|
31
|
+
channel: JSON.stringify({ salesChannel: '4', regionId: '' }),
|
|
32
|
+
postalCode: null,
|
|
33
|
+
} as any
|
|
34
|
+
|
|
35
|
+
const storedChannel = JSON.stringify({
|
|
36
|
+
salesChannel: '4',
|
|
37
|
+
regionId: '',
|
|
38
|
+
hasOnlyDefaultSalesChannel: false,
|
|
39
|
+
rejectedSalesChannel: '6',
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
describe('useRegion', () => {
|
|
43
|
+
beforeEach(() => {
|
|
44
|
+
vi.clearAllMocks()
|
|
45
|
+
mockRead.mockReturnValue({ ...filteredSession, channel: storedChannel })
|
|
46
|
+
mockValidateSession.mockImplementation(async (session) => session)
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it('validates the new postal code with the stored channel, keeping session-only keys', async () => {
|
|
50
|
+
const { result } = renderHook(() => useRegion())
|
|
51
|
+
|
|
52
|
+
await act(() =>
|
|
53
|
+
result.current.setRegion({
|
|
54
|
+
session: filteredSession,
|
|
55
|
+
postalCode: '10001',
|
|
56
|
+
errorMessage: 'error',
|
|
57
|
+
})
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
expect(mockValidateSession).toHaveBeenCalledWith(
|
|
61
|
+
expect.objectContaining({ channel: storedChannel, postalCode: '10001' })
|
|
62
|
+
)
|
|
63
|
+
expect(mockSet).toHaveBeenCalledWith(
|
|
64
|
+
expect.objectContaining({ channel: storedChannel })
|
|
65
|
+
)
|
|
66
|
+
})
|
|
67
|
+
})
|
|
@@ -134,6 +134,14 @@ describe('getInitialSession (browser, localization enabled)', () => {
|
|
|
134
134
|
expect(channel.regionId).toBe('region-abc')
|
|
135
135
|
})
|
|
136
136
|
|
|
137
|
+
it('marks the URL-derived salesChannel as intentional', () => {
|
|
138
|
+
stubHref('https://store.example.com/en-US/some/path')
|
|
139
|
+
|
|
140
|
+
const result = getInitialSession(defaults)
|
|
141
|
+
|
|
142
|
+
expect(JSON.parse(result.channel ?? '{}').salesChannelSource).toBe('url')
|
|
143
|
+
})
|
|
144
|
+
|
|
137
145
|
it('preserves non-locale defaults (country, person, etc.)', () => {
|
|
138
146
|
stubHref('https://store.example.com/en-US/some/path')
|
|
139
147
|
|
|
@@ -165,6 +165,22 @@ describe('reconcileSessionLocale (browser, localization enabled)', () => {
|
|
|
165
165
|
expect(channel.customKey).toBe('keep-me')
|
|
166
166
|
})
|
|
167
167
|
|
|
168
|
+
it('marks the URL salesChannel as intentional, replacing an orderForm adoption', () => {
|
|
169
|
+
stubHref('https://store.example.com/pt-BR/some/path')
|
|
170
|
+
|
|
171
|
+
const payload: Session = {
|
|
172
|
+
...STALE,
|
|
173
|
+
channel:
|
|
174
|
+
'{"salesChannel":"4","salesChannelSource":"orderForm","rejectedSalesChannel":"6"}',
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const channel = JSON.parse(reconcileSessionLocale(payload).channel ?? '{}')
|
|
178
|
+
|
|
179
|
+
expect(channel.salesChannel).toBe('1')
|
|
180
|
+
expect(channel.salesChannelSource).toBe('url')
|
|
181
|
+
expect(channel).not.toHaveProperty('rejectedSalesChannel')
|
|
182
|
+
})
|
|
183
|
+
|
|
168
184
|
it('survives a malformed channel JSON in the payload (does not throw, still reconciles)', () => {
|
|
169
185
|
stubHref('https://store.example.com/pt-BR/some/path')
|
|
170
186
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { describe, expect, it, vi } from 'vitest'
|
|
2
2
|
import type { Session } from '@faststore/sdk'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
releaseAdoptedSalesChannel,
|
|
5
|
+
syncSalesChannelFromOrderForm,
|
|
6
|
+
syncSessionWithValidatedCart,
|
|
7
|
+
} from '../../../src/sdk/session/syncSalesChannelFromOrderForm'
|
|
4
8
|
|
|
5
9
|
const baseSession = (
|
|
6
10
|
salesChannel: string,
|
|
@@ -44,6 +48,7 @@ describe('syncSalesChannelFromOrderForm', () => {
|
|
|
44
48
|
expect(JSON.parse(next.channel ?? '{}')).toMatchObject({
|
|
45
49
|
salesChannel: '2',
|
|
46
50
|
hasOnlyDefaultSalesChannel: false,
|
|
51
|
+
salesChannelSource: 'orderForm',
|
|
47
52
|
})
|
|
48
53
|
})
|
|
49
54
|
|
|
@@ -123,3 +128,155 @@ describe('syncSalesChannelFromOrderForm', () => {
|
|
|
123
128
|
)
|
|
124
129
|
})
|
|
125
130
|
})
|
|
131
|
+
|
|
132
|
+
describe('releaseAdoptedSalesChannel', () => {
|
|
133
|
+
const withChannel = (channel: Record<string, unknown>) =>
|
|
134
|
+
baseSession('', true, JSON.stringify(channel))
|
|
135
|
+
|
|
136
|
+
it('drops the orderForm marker and keeps the rest of the channel', () => {
|
|
137
|
+
const setSilent = vi.fn()
|
|
138
|
+
const released = releaseAdoptedSalesChannel(
|
|
139
|
+
() =>
|
|
140
|
+
withChannel({
|
|
141
|
+
salesChannel: '4',
|
|
142
|
+
regionId: 'r1',
|
|
143
|
+
hasOnlyDefaultSalesChannel: false,
|
|
144
|
+
salesChannelSource: 'orderForm',
|
|
145
|
+
}),
|
|
146
|
+
setSilent
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
expect(released).toBe(true)
|
|
150
|
+
expect(JSON.parse(setSilent.mock.calls[0][0].channel)).toEqual({
|
|
151
|
+
salesChannel: '4',
|
|
152
|
+
regionId: 'r1',
|
|
153
|
+
hasOnlyDefaultSalesChannel: false,
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
it('drops a rejected SC together with the adoption marker', () => {
|
|
158
|
+
const setSilent = vi.fn()
|
|
159
|
+
|
|
160
|
+
releaseAdoptedSalesChannel(
|
|
161
|
+
() =>
|
|
162
|
+
withChannel({
|
|
163
|
+
salesChannel: '4',
|
|
164
|
+
salesChannelSource: 'orderForm',
|
|
165
|
+
rejectedSalesChannel: '6',
|
|
166
|
+
}),
|
|
167
|
+
setSilent
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
expect(JSON.parse(setSilent.mock.calls[0][0].channel)).toEqual({
|
|
171
|
+
salesChannel: '4',
|
|
172
|
+
})
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
it('drops a rejected SC left after the adoption was dropped', () => {
|
|
176
|
+
const setSilent = vi.fn()
|
|
177
|
+
|
|
178
|
+
expect(
|
|
179
|
+
releaseAdoptedSalesChannel(
|
|
180
|
+
() => withChannel({ salesChannel: '4', rejectedSalesChannel: '6' }),
|
|
181
|
+
setSilent
|
|
182
|
+
)
|
|
183
|
+
).toBe(true)
|
|
184
|
+
expect(JSON.parse(setSilent.mock.calls[0][0].channel)).toEqual({
|
|
185
|
+
salesChannel: '4',
|
|
186
|
+
})
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
it('keeps the URL marker when dropping a rejected SC', () => {
|
|
190
|
+
const setSilent = vi.fn()
|
|
191
|
+
|
|
192
|
+
releaseAdoptedSalesChannel(
|
|
193
|
+
() =>
|
|
194
|
+
withChannel({
|
|
195
|
+
salesChannel: '3',
|
|
196
|
+
salesChannelSource: 'url',
|
|
197
|
+
rejectedSalesChannel: '6',
|
|
198
|
+
}),
|
|
199
|
+
setSilent
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
expect(JSON.parse(setSilent.mock.calls[0][0].channel)).toEqual({
|
|
203
|
+
salesChannel: '3',
|
|
204
|
+
salesChannelSource: 'url',
|
|
205
|
+
})
|
|
206
|
+
})
|
|
207
|
+
|
|
208
|
+
it('is a no-op without the orderForm marker', () => {
|
|
209
|
+
const setSilent = vi.fn()
|
|
210
|
+
|
|
211
|
+
expect(
|
|
212
|
+
releaseAdoptedSalesChannel(
|
|
213
|
+
() => withChannel({ salesChannel: '4' }),
|
|
214
|
+
setSilent
|
|
215
|
+
)
|
|
216
|
+
).toBe(false)
|
|
217
|
+
expect(
|
|
218
|
+
releaseAdoptedSalesChannel(
|
|
219
|
+
() => withChannel({ salesChannel: '3', salesChannelSource: 'url' }),
|
|
220
|
+
setSilent
|
|
221
|
+
)
|
|
222
|
+
).toBe(false)
|
|
223
|
+
expect(
|
|
224
|
+
releaseAdoptedSalesChannel(() => baseSession('', true, '{'), setSilent)
|
|
225
|
+
).toBe(false)
|
|
226
|
+
expect(setSilent).not.toHaveBeenCalled()
|
|
227
|
+
})
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
describe('syncSessionWithValidatedCart', () => {
|
|
231
|
+
const store = (channel: Record<string, unknown>) => {
|
|
232
|
+
let session = baseSession('', true, JSON.stringify(channel))
|
|
233
|
+
const setSilent = vi.fn((next: Session) => {
|
|
234
|
+
session = next
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
return {
|
|
238
|
+
read: () => session,
|
|
239
|
+
setSilent,
|
|
240
|
+
channel: () => JSON.parse(session.channel ?? '{}'),
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
it('adopts the returned SC and keeps the marker while the cart has items', () => {
|
|
245
|
+
const s = store({ salesChannel: '2' })
|
|
246
|
+
|
|
247
|
+
syncSessionWithValidatedCart(
|
|
248
|
+
{ adoptedSalesChannel: '4', itemCount: 1 },
|
|
249
|
+
s.read,
|
|
250
|
+
s.setSilent
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
expect(s.channel()).toMatchObject({
|
|
254
|
+
salesChannel: '4',
|
|
255
|
+
salesChannelSource: 'orderForm',
|
|
256
|
+
})
|
|
257
|
+
})
|
|
258
|
+
|
|
259
|
+
it('releases the adoption once the validated cart is empty', () => {
|
|
260
|
+
const s = store({ salesChannel: '4', salesChannelSource: 'orderForm' })
|
|
261
|
+
|
|
262
|
+
syncSessionWithValidatedCart(
|
|
263
|
+
{ adoptedSalesChannel: null, itemCount: 0 },
|
|
264
|
+
s.read,
|
|
265
|
+
s.setSilent
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
expect(s.channel()).toEqual({ salesChannel: '4' })
|
|
269
|
+
})
|
|
270
|
+
|
|
271
|
+
it('leaves the session untouched when nothing was adopted and the cart has items', () => {
|
|
272
|
+
const s = store({ salesChannel: '4', salesChannelSource: 'orderForm' })
|
|
273
|
+
|
|
274
|
+
syncSessionWithValidatedCart(
|
|
275
|
+
{ adoptedSalesChannel: undefined, itemCount: 2 },
|
|
276
|
+
s.read,
|
|
277
|
+
s.setSilent
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
expect(s.setSilent).not.toHaveBeenCalled()
|
|
281
|
+
})
|
|
282
|
+
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import { filterChannel } from 'src/utils/utilities'
|
|
4
|
+
|
|
5
|
+
describe('filterChannel', () => {
|
|
6
|
+
it('strips session-only keys so they never reach queries or cache keys', () => {
|
|
7
|
+
expect(
|
|
8
|
+
JSON.parse(
|
|
9
|
+
filterChannel(
|
|
10
|
+
JSON.stringify({
|
|
11
|
+
salesChannel: '4',
|
|
12
|
+
regionId: 'r1',
|
|
13
|
+
hasOnlyDefaultSalesChannel: false,
|
|
14
|
+
salesChannelSource: 'orderForm',
|
|
15
|
+
rejectedSalesChannel: '6',
|
|
16
|
+
})
|
|
17
|
+
)
|
|
18
|
+
)
|
|
19
|
+
).toEqual({ salesChannel: '4', regionId: 'r1' })
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('returns an empty object for an empty channel', () => {
|
|
23
|
+
expect(filterChannel('')).toBe('{}')
|
|
24
|
+
})
|
|
25
|
+
})
|