@faststore/core 4.9.1 → 4.9.3-dev.0
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 +136 -120
- package/CHANGELOG.md +10 -0
- package/package.json +6 -6
- package/src/components/region/RegionModal/RegionModal.tsx +1 -1
- package/src/components/region/RegionModal/useRegion.ts +3 -2
- package/src/components/region/RegionPopover/RegionPopover.tsx +1 -1
- package/src/components/region/RegionSlider/RegionSlider.tsx +1 -1
- package/src/sdk/account/useReorder.ts +2 -2
- package/src/sdk/cart/index.ts +8 -2
- package/src/sdk/session/index.ts +19 -19
- package/src/sdk/session/toSessionInput.ts +27 -0
- package/test/components/region/useRegion.browser.test.ts +64 -0
- package/test/sdk/session/sessionStore.browser.test.ts +63 -0
- package/test/sdk/session/toSessionInput.test.ts +43 -0
- package/test/sdk/session/validateSession.browser.test.ts +47 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @faststore/core@4.9.
|
|
2
|
+
> @faststore/core@4.9.2 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.2 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.2 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.2 test /home/runner/work/faststore/faststore/packages/core
|
|
3
3
|
> vitest run
|
|
4
4
|
|
|
5
5
|
|
|
@@ -7,25 +7,23 @@
|
|
|
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 1025[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/
|
|
15
|
-
[33m[2m✓[22m[39m shows
|
|
16
|
-
[33m[2m✓[22m[39m
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
[33m[2m✓[22m[39m
|
|
23
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/CartRecommendationShelf/CartRecommendationShelf.browser.test.tsx [2m([22m[2m13 tests[22m[2m)[22m[32m
|
|
24
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/localization/useBindingSelector.browser.test.tsx [2m([22m[2m9 tests[22m[2m)[22m[32m
|
|
25
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/
|
|
26
|
-
|
|
27
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/ui/ProductGallery/GalleryPageHeightLock.browser.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m 90[2mms[22m[39m
|
|
28
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/reconcileSessionLocale.browser.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 13[2mms[22m[39m
|
|
14
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/cards/MyAccountListCards.browser.test.tsx [2m([22m[2m16 tests[22m[2m)[22m[33m 2299[2mms[22m[39m
|
|
15
|
+
[33m[2m✓[22m[39m shows the tab bar and renders Personal cards by default [33m 888[2mms[22m[39m
|
|
16
|
+
[33m[2m✓[22m[39m paginates when there are more than 25 cards [33m 355[2mms[22m[39m
|
|
17
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/ContractSwitcher.browser.test.tsx [2m([22m[2m22 tests[22m[2m)[22m[33m 2772[2mms[22m[39m
|
|
18
|
+
[33m[2m✓[22m[39m shows an error state when the list fails to load [33m 455[2mms[22m[39m
|
|
19
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/BuyingPolicyAlert.browser.test.tsx [2m([22m[2m13 tests[22m[2m)[22m[33m 2283[2mms[22m[39m
|
|
20
|
+
[33m[2m✓[22m[39m opens the reject confirmation modal with the default English copy [33m 1093[2mms[22m[39m
|
|
21
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationDrawer.browser.test.tsx [2m([22m[2m10 tests[22m[2m)[22m[33m 1261[2mms[22m[39m
|
|
22
|
+
[33m[2m✓[22m[39m renders the menu view with contract details and manage footer [33m 697[2mms[22m[39m
|
|
23
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/CartRecommendationShelf/CartRecommendationShelf.browser.test.tsx [2m([22m[2m13 tests[22m[2m)[22m[32m 286[2mms[22m[39m
|
|
24
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/localization/useBindingSelector.browser.test.tsx [2m([22m[2m9 tests[22m[2m)[22m[32m 126[2mms[22m[39m
|
|
25
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/ui/ProductGallery/GalleryPageHeightLock.browser.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m 107[2mms[22m[39m
|
|
26
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/reconcileSessionLocale.browser.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 17[2mms[22m[39m
|
|
29
27
|
[90mstderr[2m | test/components/RecommendationShelf/RecommendationShelf.browser.test.tsx
|
|
30
28
|
[22m[39mError in optimistic validation: TypeError: Failed to parse URL from /api/graphql?operationName=ValidateCartMutation&operationHash=3c71b0d3fc2bade14df68abfa271858beb361b12
|
|
31
29
|
[90m at node:internal/deps/undici/undici:16416:13[39m
|
|
@@ -33,7 +31,7 @@ Browserslist: browsers data (caniuse-lite) is 8 months old. Please run:
|
|
|
33
31
|
at baseRequest [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/graphql/request.ts:42:20[90m)[39m
|
|
34
32
|
at GraphqlRequest [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/graphql/request.ts:130:20[90m)[39m
|
|
35
33
|
at request [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/graphql/request.ts:154:5[90m)[39m
|
|
36
|
-
at validateCart [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/index.ts:
|
|
34
|
+
at validateCart [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/index.ts:126:46[90m)[39m
|
|
37
35
|
at onValidate [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/useStore.ts:18:14[90m)[39m
|
|
38
36
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:17) {
|
|
39
37
|
[cause]: TypeError: Invalid URL
|
|
@@ -52,13 +50,15 @@ Browserslist: browsers data (caniuse-lite) is 8 months old. Please run:
|
|
|
52
50
|
}
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/recommendations/useRecommendationShelf.browser.test.tsx [2m([22m[2m12 tests[22m[2m)[22m[32m 50[2mms[22m[39m
|
|
56
53
|
[90mstderr[2m | test/components/RecommendationShelf/RecommendationShelf.browser.test.tsx[2m > [22m[2mRecommendationShelf[2m > [22m[2mrenders nothing when there is an error
|
|
57
54
|
[22m[39mError fetching recommendations [90mundefined[39m boom for campaign vrn:recommendations:acc:rec-top-items-v2:campaign-1
|
|
58
55
|
|
|
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/
|
|
56
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/RecommendationShelf/RecommendationShelf.browser.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m 95[2mms[22m[39m
|
|
57
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/recommendations/useRecommendationShelf.browser.test.tsx [2m([22m[2m12 tests[22m[2m)[22m[32m 42[2mms[22m[39m
|
|
58
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/CartSidebar/CartSidebar.browser.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[32m 56[2mms[22m[39m
|
|
59
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrderDetails.browser.test.tsx [2m([22m[2m4 tests[22m[2m)[22m[32m 113[2mms[22m[39m
|
|
60
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/navigation/Navbar.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 51[2mms[22m[39m
|
|
61
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/getInitialSession.browser.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
62
62
|
[90mstderr[2m | test/pages/password-protection.browser.test.tsx[2m > [22m[2mPasswordProtectionLogin[2m > [22m[2mposts the password and redirects to the requested return path
|
|
63
63
|
[22m[39mWarning: An update to PasswordProtectionLogin inside a test was not wrapped in act(...).
|
|
64
64
|
|
|
@@ -96,7 +96,6 @@ act(() => {
|
|
|
96
96
|
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
|
|
97
97
|
at PasswordProtectionLogin (/home/runner/work/faststore/faststore/packages/core/src/pages/password-protection/index.tsx:19:69)
|
|
98
98
|
|
|
99
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/navigation/Navbar.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 44[2mms[22m[39m
|
|
100
99
|
[90mstderr[2m | test/pages/password-protection.browser.test.tsx[2m > [22m[2mPasswordProtectionLogin[2m > [22m[2mdefaults returnTo to root and shows API validation errors
|
|
101
100
|
[22m[39mWarning: An update to PasswordProtectionLogin inside a test was not wrapped in act(...).
|
|
102
101
|
|
|
@@ -289,92 +288,108 @@ act(() => {
|
|
|
289
288
|
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
|
|
290
289
|
at PasswordProtectionLogin (/home/runner/work/faststore/faststore/packages/core/src/pages/password-protection/index.tsx:19:69)
|
|
291
290
|
|
|
292
|
-
[32m✓[39m [30m[46m browser [49m[39m test/pages/password-protection.browser.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[33m
|
|
293
|
-
[33m[2m✓[22m[39m renders the password protection form [33m 431[2mms[22m[39m
|
|
294
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/getInitialSession.browser.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
295
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/useSwitchContract.browser.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 37[2mms[22m[39m
|
|
296
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationDrawerFooter.browser.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[33m 319[2mms[22m[39m
|
|
291
|
+
[32m✓[39m [30m[46m browser [49m[39m test/pages/password-protection.browser.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[33m 632[2mms[22m[39m
|
|
297
292
|
[90mstderr[2m | test/components/cms/RenderSections.browser.test.tsx
|
|
298
293
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
299
294
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
300
|
-
at validateCart [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/index.ts:
|
|
295
|
+
at validateCart [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/index.ts:124:9[90m)[39m
|
|
301
296
|
at onValidate [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/useStore.ts:18:20[90m)[39m
|
|
302
297
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
303
298
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
304
299
|
|
|
305
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/
|
|
306
|
-
[32m✓[39m [30m[46m browser [49m[39m test/
|
|
307
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/
|
|
300
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationDrawerFooter.browser.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m 298[2mms[22m[39m
|
|
301
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/useSwitchContract.browser.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 31[2mms[22m[39m
|
|
302
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/cms/RenderSections.browser.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[32m 62[2mms[22m[39m
|
|
303
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/navigation/NavbarSlider.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 37[2mms[22m[39m
|
|
308
304
|
[90mstderr[2m | test/sdk/localization/store-url.browser.test.ts
|
|
309
305
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
310
306
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
311
|
-
at validateCart [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/index.ts:
|
|
307
|
+
at validateCart [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/index.ts:124:9[90m)[39m
|
|
312
308
|
at onValidate [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/useStore.ts:18:20[90m)[39m
|
|
313
309
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
314
310
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
315
311
|
|
|
312
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/Menu.browser.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[32m 279[2mms[22m[39m
|
|
316
313
|
[32m✓[39m [30m[46m browser [49m[39m test/sdk/localization/store-url.browser.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
317
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/useAvailableContracts.browser.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m
|
|
318
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/templates/SearchPage/SearchWrapper.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
319
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/recommendations/useRecommendationShelf.sessionFallback.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
320
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountListQuotes.browser.test.tsx [2m([22m[2m4 tests[22m[2m)[22m[32m
|
|
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
|
|
314
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/useAvailableContracts.browser.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 27[2mms[22m[39m
|
|
315
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/templates/SearchPage/SearchWrapper.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 30[2mms[22m[39m
|
|
316
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/recommendations/useRecommendationShelf.sessionFallback.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 124[2mms[22m[39m
|
|
317
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountListQuotes.browser.test.tsx [2m([22m[2m4 tests[22m[2m)[22m[32m 95[2mms[22m[39m
|
|
318
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/navigation/NavbarAccountArea.browser.test.tsx [2m([22m[2m4 tests[22m[2m)[22m[32m 47[2mms[22m[39m
|
|
319
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/CartRecommendationShelf/CartRecommendationProductCard.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 47[2mms[22m[39m
|
|
320
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/changeContractToken.browser.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m 18[2mms[22m[39m
|
|
324
321
|
[90mstderr[2m | test/components/account/doLogout.browser.test.ts
|
|
325
322
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
326
323
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
327
|
-
at validateCart [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/index.ts:
|
|
324
|
+
at validateCart [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/index.ts:124:9[90m)[39m
|
|
328
325
|
at onValidate [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/useStore.ts:18:20[90m)[39m
|
|
329
326
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
330
327
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
331
328
|
|
|
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/account/OrganizationDrawerHeader.browser.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[32m
|
|
329
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/doLogout.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 25[2mms[22m[39m
|
|
330
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationDrawerHeader.browser.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[32m 265[2mms[22m[39m
|
|
334
331
|
[32m✓[39m [30m[46m browser [49m[39m test/components/ui/LocalizationButton.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 37[2mms[22m[39m
|
|
335
332
|
[90mstderr[2m | test/sdk/account/clearPersistedSessionState.browser.test.ts
|
|
336
333
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
337
334
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
338
|
-
at validateCart [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/index.ts:
|
|
335
|
+
at validateCart [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/index.ts:124:9[90m)[39m
|
|
339
336
|
at onValidate [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/useStore.ts:18:20[90m)[39m
|
|
340
337
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
341
338
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
342
339
|
|
|
343
340
|
[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
|
|
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/sections/Account/
|
|
348
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/
|
|
349
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/
|
|
341
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrderDelivery.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 71[2mms[22m[39m
|
|
342
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryOptionAccordion.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 80[2mms[22m[39m
|
|
343
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrderStatus.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 77[2mms[22m[39m
|
|
344
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountListCards.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 67[2mms[22m[39m
|
|
345
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/region/useRegion.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 20[2mms[22m[39m
|
|
346
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrdersList.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 22[2mms[22m[39m
|
|
347
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/SummaryCard.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 77[2mms[22m[39m
|
|
348
|
+
[90mstderr[2m | test/sdk/session/sessionStore.browser.test.ts
|
|
349
|
+
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
350
|
+
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
351
|
+
at validateCart [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/index.ts:124:9[90m)[39m
|
|
352
|
+
at onValidate [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/useStore.ts:18:20[90m)[39m
|
|
353
|
+
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
354
|
+
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
355
|
+
|
|
356
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/sessionStore.browser.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 9[2mms[22m[39m
|
|
357
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationSignInButton.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 186[2mms[22m[39m
|
|
350
358
|
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryOptionAccordionDeliveryInfo.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m 26[2mms[22m[39m
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
359
|
+
[90mstderr[2m | test/sdk/session/validateSession.browser.test.ts
|
|
360
|
+
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
361
|
+
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
362
|
+
at validateCart [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/index.ts:124:9[90m)[39m
|
|
363
|
+
at onValidate [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/useStore.ts:18:20[90m)[39m
|
|
364
|
+
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
365
|
+
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
366
|
+
|
|
367
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/validateSession.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
368
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/StatusCard.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 88[2mms[22m[39m
|
|
369
|
+
[32m✓[39m [30m[46m browser [49m[39m test/utils/isLocalHost.browser.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
354
370
|
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/reconcileSessionLocale.disabled.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
355
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryCard.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
371
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryCard.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m 36[2mms[22m[39m
|
|
356
372
|
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryOptionAccordionProducts.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m 37[2mms[22m[39m
|
|
357
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/skeletons/ProductGridSkeleton.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
373
|
+
[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
|
|
374
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/bindingPaths.test.ts [2m([22m[2m71 tests[22m[2m)[22m[32m 19[2mms[22m[39m
|
|
358
375
|
[90mstderr[2m | test/sdk/account/refreshToken.browser.test.ts
|
|
359
376
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
360
377
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
361
|
-
at validateCart [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/index.ts:
|
|
378
|
+
at validateCart [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/index.ts:124:9[90m)[39m
|
|
362
379
|
at onValidate [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/useStore.ts:18:20[90m)[39m
|
|
363
380
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
364
381
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
365
382
|
|
|
366
383
|
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/refreshToken.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
367
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
368
|
-
[32m✓[39m [30m[43m node [49m[39m test/pages/api/switch-contract.test.ts [2m([22m[2m25 tests[22m[2m)[22m[32m
|
|
369
|
-
[32m✓[39m [30m[
|
|
370
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/match-url.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m
|
|
371
|
-
[32m✓[39m [30m[
|
|
372
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
373
|
-
[32m✓[39m [30m[43m node [49m[39m test/pages/api/unlock.test.ts [2m([22m[2m15 tests[22m[2m)[22m[32m 136[2mms[22m[39m
|
|
384
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/password-protection-service.test.ts [2m([22m[2m22 tests[22m[2m)[22m[32m 27[2mms[22m[39m
|
|
385
|
+
[32m✓[39m [30m[43m node [49m[39m test/pages/api/switch-contract.test.ts [2m([22m[2m25 tests[22m[2m)[22m[32m 71[2mms[22m[39m
|
|
386
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/FilterFacetPendingApproval.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m 156[2mms[22m[39m
|
|
387
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/match-url.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
388
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/useBindingSelector.test.tsx [2m([22m[2m22 tests[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
389
|
+
[32m✓[39m [30m[43m node [49m[39m test/pages/api/unlock.test.ts [2m([22m[2m15 tests[22m[2m)[22m[32m 124[2mms[22m[39m
|
|
374
390
|
[90mstderr[2m | test/components/search/SearchInputComponent.test.tsx
|
|
375
391
|
[22m[39mWarning: forwardRef render functions accept exactly two parameters: props and ref. Did you forget to use the ref parameter?
|
|
376
392
|
|
|
377
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/bindingSelector.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
378
393
|
[90mstderr[2m | test/components/search/SearchInputComponent.test.tsx[2m > [22m[2mSearchInput (OES integration)[2m > [22m[2mrenders without crashing
|
|
379
394
|
[22m[39mWarning: React does not recognize the `visibleDropdown` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `visibledropdown` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
|
|
380
395
|
at div
|
|
@@ -435,22 +450,24 @@ Warning: React does not recognize the `providerProps` prop on a DOM element. If
|
|
|
435
450
|
at Suspense
|
|
436
451
|
at Wrapper (/home/runner/work/faststore/faststore/packages/core/test/components/search/SearchInputComponent.test.tsx:106:20)
|
|
437
452
|
|
|
453
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/bindingSelector.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
438
454
|
[32m✓[39m [30m[43m node [49m[39m test/components/search/SearchInputComponent.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[32m 63[2mms[22m[39m
|
|
439
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountListQuotesTable.test.tsx [2m([22m[2m15 tests[22m[2m)[22m[33m
|
|
455
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountListQuotesTable.test.tsx [2m([22m[2m15 tests[22m[2m)[22m[33m 319[2mms[22m[39m
|
|
456
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/search/useSearchHistory.test.ts [2m([22m[2m13 tests[22m[2m)[22m[32m 32[2mms[22m[39m
|
|
440
457
|
[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
|
|
441
458
|
[22m[39m{ extensions: { status: [33m401[39m } }
|
|
442
459
|
|
|
443
460
|
[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
|
|
444
461
|
[22m[39m{ extensions: { status: [33m502[39m } }
|
|
445
462
|
|
|
446
|
-
[32m✓[39m [30m[43m node [49m[39m test/pages/pvt/account/cards/index.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
447
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
448
|
-
|
|
449
|
-
[33m[2m✓[22m[39m navigates with the search term on blur [33m 360[2mms[22m[39m
|
|
463
|
+
[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
|
|
464
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountListQuotes.test.tsx [2m([22m[2m11 tests[22m[2m)[22m[33m 800[2mms[22m[39m
|
|
465
|
+
[33m[2m✓[22m[39m navigates with the search term on blur [33m 358[2mms[22m[39m
|
|
450
466
|
[33m[2m✓[22m[39m navigates without a label param when the search is cleared [33m 356[2mms[22m[39m
|
|
451
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/quoteFilters.test.ts [2m([22m[2m26 tests[22m[2m)[22m[32m
|
|
467
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/quoteFilters.test.ts [2m([22m[2m26 tests[22m[2m)[22m[32m 28[2mms[22m[39m
|
|
468
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/cookieCacheBusting.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m 11[2mms[22m[39m
|
|
452
469
|
[32m✓[39m [30m[43m node [49m[39m test/utils/productJsonLd.test.ts [2m([22m[2m36 tests[22m[2m)[22m[32m 11[2mms[22m[39m
|
|
453
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
470
|
+
[32m✓[39m [30m[43m node [49m[39m test/experimental/myAccountCmsServerSideProps.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
454
471
|
[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
|
|
455
472
|
[22m[39mGraphql execution returned with error: [
|
|
456
473
|
{
|
|
@@ -561,71 +578,70 @@ Warning: React does not recognize the `providerProps` prop on a DOM element. If
|
|
|
561
578
|
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)
|
|
562
579
|
|
|
563
580
|
[32m✓[39m [30m[43m node [49m[39m test/pages/api/graphql.test.ts [2m([22m[2m19 tests[22m[2m)[22m[32m 28[2mms[22m[39m
|
|
564
|
-
[32m✓[39m [30m[43m node [49m[39m test/experimental/myAccountCmsServerSideProps.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
565
581
|
[32m✓[39m [30m[43m node [49m[39m test/utils/clearCookies.test.ts [2m([22m[2m20 tests[22m[2m)[22m[32m 20[2mms[22m[39m
|
|
566
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/multipleTemplates.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
582
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/multipleTemplates.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
567
583
|
[90mstderr[2m | test/sdk/account/useSetPassword.test.ts[2m > [22m[2museSetPassword[2m > [22m[2mmaps wrongcredentials error responses to the existing message
|
|
568
584
|
[22m[39mSet password request failed: Bad Request
|
|
569
585
|
|
|
570
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/useSetPassword.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m
|
|
571
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderEntryOperation.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
586
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/useSetPassword.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 38[2mms[22m[39m
|
|
587
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderEntryOperation.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 30[2mms[22m[39m
|
|
572
588
|
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/localizeRedirectDestination.test.ts [2m([22m[2m11 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
573
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesFilterSlider.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
574
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesStatusSelector.test.tsx [2m([22m[2m14 tests[22m[2m)[22m[32m
|
|
575
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/hreflang.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
576
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/getMyAccountRoutes.test.ts [2m([22m[2m13 tests[22m[2m)[22m[32m
|
|
577
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesSelectedTags.test.tsx [2m([22m[2m10 tests[22m[2m)[22m[32m
|
|
578
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/redirects/index.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m
|
|
579
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderEntryUpload.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
580
|
-
[32m✓[39m [30m[43m node [49m[39m test/proxy.localization.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m
|
|
581
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
582
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
583
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/graphql/retryPolicy.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m
|
|
584
|
-
[32m✓[39m [30m[43m node [49m[39m test/server/cms/myAccountDefaultSections.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m
|
|
585
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/productJsonLdRendering.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[32m
|
|
586
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/session/syncSalesChannelFromOrderForm.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m
|
|
587
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
588
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
589
|
-
[33m[2m✓[22m[39m should handle options and execute [33m 591[2mms[22m[39m
|
|
590
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderFormItems.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 22[2mms[22m[39m
|
|
589
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesFilterSlider.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m 159[2mms[22m[39m
|
|
590
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesStatusSelector.test.tsx [2m([22m[2m14 tests[22m[2m)[22m[32m 163[2mms[22m[39m
|
|
591
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/hreflang.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
592
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/getMyAccountRoutes.test.ts [2m([22m[2m13 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
593
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesSelectedTags.test.tsx [2m([22m[2m10 tests[22m[2m)[22m[32m 85[2mms[22m[39m
|
|
594
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/redirects/index.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 37[2mms[22m[39m
|
|
595
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderEntryUpload.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 36[2mms[22m[39m
|
|
596
|
+
[32m✓[39m [30m[43m node [49m[39m test/proxy.localization.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 37[2mms[22m[39m
|
|
597
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/getDeliveryOptionLabel.test.ts [2m([22m[2m21 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
598
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderEntry.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 40[2mms[22m[39m
|
|
599
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/graphql/retryPolicy.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m 22[2mms[22m[39m
|
|
600
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/cms/myAccountDefaultSections.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
601
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/productJsonLdRendering.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[32m 13[2mms[22m[39m
|
|
602
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/session/syncSalesChannelFromOrderForm.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
603
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/index.test.ts [2m([22m[2m7 tests[22m[2m)[22m[33m 786[2mms[22m[39m
|
|
604
|
+
[32m✓[39m [30m[43m node [49m[39m test/proxy.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 13[2mms[22m[39m
|
|
591
605
|
[32m✓[39m [30m[43m node [49m[39m test/server/webops-api.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m 11[2mms[22m[39m
|
|
592
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
593
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/StatusCard.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
594
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/store-url.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m
|
|
606
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/analytics/useStartRecommendationSession.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 40[2mms[22m[39m
|
|
607
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/StatusCard.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 25[2mms[22m[39m
|
|
608
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/store-url.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
609
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderFormItems.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 27[2mms[22m[39m
|
|
595
610
|
[32m✓[39m [30m[43m node [49m[39m test/sdk/cart/waitForSessionValidated.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 9[2mms[22m[39m
|
|
596
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/refreshToken.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m
|
|
611
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/refreshToken.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 10[2mms[22m[39m
|
|
597
612
|
[32m✓[39m [30m[43m node [49m[39m test/server/content/service.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
598
|
-
[32m✓[39m [30m[43m node [49m[39m test/server/cms/global.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
599
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/auth/useAuth.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m
|
|
600
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
601
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
602
|
-
[32m✓[39m [30m[43m node [49m[39m test/server/rootSpan.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m
|
|
613
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/cms/global.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
614
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/auth/useAuth.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 33[2mms[22m[39m
|
|
615
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/getRequestHostname.test.ts [2m([22m[2m12 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
616
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/Layout.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[32m 46[2mms[22m[39m
|
|
617
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/rootSpan.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 39[2mms[22m[39m
|
|
618
|
+
[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
|
|
603
619
|
[32m✓[39m [30m[43m node [49m[39m test/utils/validateSessionRefreshToken.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
604
|
-
[32m✓[39m [30m[43m node [49m[39m test/pages/api/preview.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
605
620
|
[32m✓[39m [30m[43m node [49m[39m test/components/search/SearchInput.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
606
621
|
[32m✓[39m [30m[43m node [49m[39m test/sdk/recommendations/vrn.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
607
622
|
[32m✓[39m [30m[43m node [49m[39m test/server/cms/index.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
608
623
|
[32m✓[39m [30m[43m node [49m[39m test/utils/retry.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
609
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/getB2BSessionClaims.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m
|
|
624
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/getB2BSessionClaims.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
610
625
|
[32m✓[39m [30m[43m node [49m[39m test/utils/userOrderStatus.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
611
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/recommendations/useRecommendationUserId.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m
|
|
626
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/recommendations/useRecommendationUserId.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 190[2mms[22m[39m
|
|
627
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/OrganizationDrawerBody.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 33[2mms[22m[39m
|
|
612
628
|
[32m✓[39m [30m[43m node [49m[39m test/utils/unlockResponse.test.ts [2m([22m[2m11 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
613
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/account/OrganizationDrawerBody.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 29[2mms[22m[39m
|
|
614
629
|
[32m✓[39m [30m[43m node [49m[39m test/sdk/recommendations/useRecommendations.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
615
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
616
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
617
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
618
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/getOrderTotalLabel.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m
|
|
619
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
630
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/isLocalHost.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
631
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuoteStatusBadge.test.tsx [2m([22m[2m4 tests[22m[2m)[22m[32m 41[2mms[22m[39m
|
|
632
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/session/toSessionInput.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
633
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/getOrderTotalLabel.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
634
|
+
[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
|
|
635
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/getCookie.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
620
636
|
[32m✓[39m [30m[43m node [49m[39m test/sdk/session/isSignInAreaResolved.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
621
|
-
[32m✓[39m [30m[43m node [49m[39m test/instrumentation.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
622
637
|
[32m✓[39m [30m[43m node [49m[39m test/sdk/analytics/utils.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
623
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/auth/ProfileChallenge.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
624
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
625
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
[2m
|
|
629
|
-
[2m
|
|
630
|
-
[2m
|
|
638
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/auth/ProfileChallenge.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 25[2mms[22m[39m
|
|
639
|
+
[32m✓[39m [30m[43m node [49m[39m test/instrumentation.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
640
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/orderDetailsLabels.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
641
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/clearPersistedSessionState.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
642
|
+
|
|
643
|
+
[2m Test Files [22m [1m[32m127 passed[39m[22m[90m (127)[39m
|
|
644
|
+
[2m Tests [22m [1m[32m992 passed[39m[22m[90m (992)[39m
|
|
645
|
+
[2m Start at [22m 13:35:02
|
|
646
|
+
[2m Duration [22m 48.01s[2m (transform 11.84s, setup 0ms, import 44.44s, tests 17.34s, environment 57.43s)[22m
|
|
631
647
|
|
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.0](https://github.com/vtex/faststore/compare/v4.9.1-dev.0...v4.9.3-dev.0) (2026-10-05)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @faststore/core
|
|
9
|
+
|
|
10
|
+
## [4.9.2](https://github.com/vtex/faststore/compare/v4.9.1...v4.9.2) (2026-10-02)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **core:** keep UI session state out of session and cart mutations ([#3511](https://github.com/vtex/faststore/issues/3511)) ([3c58a21](https://github.com/vtex/faststore/commit/3c58a213d237f8d5f7919ab12f63015fbfe3ef73)), closes [#3479](https://github.com/vtex/faststore/issues/3479) [#3479](https://github.com/vtex/faststore/issues/3479) [#3509](https://github.com/vtex/faststore/issues/3509)
|
|
15
|
+
|
|
6
16
|
## [4.9.1](https://github.com/vtex/faststore/compare/v4.9.0...v4.9.1) (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.0",
|
|
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/
|
|
76
|
-
"@faststore/
|
|
77
|
-
"@faststore/
|
|
78
|
-
"@faststore/
|
|
74
|
+
"@faststore/api": "4.9.3-dev.0",
|
|
75
|
+
"@faststore/lighthouse": "4.9.3-dev.0",
|
|
76
|
+
"@faststore/diagnostics": "4.9.3-dev.0",
|
|
77
|
+
"@faststore/ui": "4.9.3-dev.0",
|
|
78
|
+
"@faststore/sdk": "4.9.3-dev.0"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@cypress/code-coverage": "^3.12.1",
|
|
@@ -65,7 +65,7 @@ function RegionModal(regionModalProps: RegionModalProps) {
|
|
|
65
65
|
} = cmsData?.regionalization ?? {}
|
|
66
66
|
|
|
67
67
|
const inputRef = useRef<HTMLInputElement>(null)
|
|
68
|
-
const { isValidating,
|
|
68
|
+
const { isValidating, ...session } = useSession()
|
|
69
69
|
const { modal: displayModal, closeModal } = useUI()
|
|
70
70
|
|
|
71
71
|
const [input, setInput] = useState<string>('')
|
|
@@ -3,7 +3,7 @@ import { useState } from 'react'
|
|
|
3
3
|
import type { Session } from '@faststore/sdk'
|
|
4
4
|
import { deliveryPromise } from 'discovery.config'
|
|
5
5
|
import { getProductCount } from 'src/sdk/product'
|
|
6
|
-
import { sessionStore, validateSession } from 'src/sdk/session'
|
|
6
|
+
import { sessionStore, toSessionInput, validateSession } from 'src/sdk/session'
|
|
7
7
|
|
|
8
8
|
type SetRegionProps = {
|
|
9
9
|
session: Session
|
|
@@ -40,8 +40,9 @@ export default function useRegion(): UseRegionValues {
|
|
|
40
40
|
setLoading(true)
|
|
41
41
|
|
|
42
42
|
try {
|
|
43
|
+
// `session` usually comes from `useSession()`, which also carries UI state
|
|
43
44
|
const newSession = {
|
|
44
|
-
...session,
|
|
45
|
+
...toSessionInput(session),
|
|
45
46
|
postalCode,
|
|
46
47
|
geoCoordinates: null, // Revalidate geo coordinates in API when users set a new postal code
|
|
47
48
|
} as Session
|
|
@@ -78,7 +78,7 @@ function RegionPopover(regionPopoverProps: RegionPopoverProps) {
|
|
|
78
78
|
} = cmsData?.regionalization ?? {}
|
|
79
79
|
|
|
80
80
|
const inputRef = useRef<HTMLInputElement>(null)
|
|
81
|
-
const { isValidating,
|
|
81
|
+
const { isValidating, ...session } = useSession()
|
|
82
82
|
const { popover: displayPopover, closePopover } = useUI()
|
|
83
83
|
const { onPostalCodeChange } = useDeliveryPromise()
|
|
84
84
|
const { city, postalCode } = sessionStore.read()
|
|
@@ -45,7 +45,7 @@ function RegionSlider() {
|
|
|
45
45
|
regionSlider: { type: regionSliderType, isOpen },
|
|
46
46
|
closeRegionSlider,
|
|
47
47
|
} = useUI()
|
|
48
|
-
const { isValidating,
|
|
48
|
+
const { isValidating, ...session } = useSession()
|
|
49
49
|
const { state: searchState, setState: setSearchState } = useSearch()
|
|
50
50
|
const {
|
|
51
51
|
loading: loadingRegion,
|
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
} from '@generated/graphql'
|
|
11
11
|
import ReorderError from '../error/ReorderError/ReorderError'
|
|
12
12
|
import { request } from '../graphql/request'
|
|
13
|
-
import { sessionStore } from '../session'
|
|
13
|
+
import { sessionStore, toSessionInput } from '../session'
|
|
14
14
|
import { useLink } from '../ui/useLink'
|
|
15
15
|
|
|
16
16
|
import storeConfig from '../../../discovery.config'
|
|
@@ -116,7 +116,7 @@ export const useReorder = () => {
|
|
|
116
116
|
ValidateCartMutationMutation,
|
|
117
117
|
ValidateCartMutationMutationVariables
|
|
118
118
|
>(ValidateCartMutation, {
|
|
119
|
-
session: sessionStore.read(),
|
|
119
|
+
session: toSessionInput(sessionStore.read()),
|
|
120
120
|
cart: {
|
|
121
121
|
order: orderPayload as IStoreCart['order'],
|
|
122
122
|
},
|
package/src/sdk/cart/index.ts
CHANGED
|
@@ -13,7 +13,11 @@ import type {
|
|
|
13
13
|
|
|
14
14
|
import storeConfig from '../../../discovery.config'
|
|
15
15
|
import { request } from '../graphql/request'
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
hasValidatedSessionStore,
|
|
18
|
+
sessionStore,
|
|
19
|
+
toSessionInput,
|
|
20
|
+
} from '../session'
|
|
17
21
|
import { syncSalesChannelFromOrderForm } from '../session/syncSalesChannelFromOrderForm'
|
|
18
22
|
import { createValidationStore, useStore } from '../useStore'
|
|
19
23
|
import { waitForSessionValidated } from './waitForSessionValidated'
|
|
@@ -123,7 +127,9 @@ const validateCart = async (cart: Cart): Promise<Cart | null> => {
|
|
|
123
127
|
ValidateCartMutationMutation,
|
|
124
128
|
ValidateCartMutationMutationVariables
|
|
125
129
|
>(ValidateCartMutation, {
|
|
126
|
-
session
|
|
130
|
+
// The session loaded from IndexedDB skips `sessionStore.set`, so it may
|
|
131
|
+
// still carry UI state persisted by an older version
|
|
132
|
+
session: toSessionInput(sessionStore.read()),
|
|
127
133
|
cart: {
|
|
128
134
|
order: {
|
|
129
135
|
orderNumber: cart.id,
|
package/src/sdk/session/index.ts
CHANGED
|
@@ -21,6 +21,9 @@ import { createValidationStore, useStore } from '../useStore'
|
|
|
21
21
|
import { getPostalCode } from '../userLocation/index'
|
|
22
22
|
import { getInitialSession, reconcileSessionLocale } from './initialSession'
|
|
23
23
|
import { RELOAD_AFTER_LOGOUT_KEY, SESSION_READY_KEY } from './storageKeys'
|
|
24
|
+
import { type SessionUIKey, toSessionInput } from './toSessionInput'
|
|
25
|
+
|
|
26
|
+
export { toSessionInput } from './toSessionInput'
|
|
24
27
|
|
|
25
28
|
const isReloadAfterLogoutPending = (): boolean => {
|
|
26
29
|
try {
|
|
@@ -160,18 +163,11 @@ export const validateSession = async (session: Session) => {
|
|
|
160
163
|
return null
|
|
161
164
|
}
|
|
162
165
|
|
|
163
|
-
// Remove fields that are not part of IStoreSession type
|
|
164
|
-
const { isSessionReady, isValidating, ...sessionWithoutExtras } =
|
|
165
|
-
session as Session & {
|
|
166
|
-
isSessionReady?: boolean
|
|
167
|
-
isValidating?: boolean
|
|
168
|
-
}
|
|
169
|
-
|
|
170
166
|
const data = await request<
|
|
171
167
|
ValidateSessionMutation,
|
|
172
168
|
ValidateSessionMutationVariables
|
|
173
169
|
>(mutation, {
|
|
174
|
-
session:
|
|
170
|
+
session: toSessionInput(session),
|
|
175
171
|
search: window.location.search,
|
|
176
172
|
})
|
|
177
173
|
|
|
@@ -210,9 +206,11 @@ const defaultStore = createSessionStore(
|
|
|
210
206
|
export const sessionStore = {
|
|
211
207
|
...defaultStore,
|
|
212
208
|
set: (val: Session) => {
|
|
213
|
-
|
|
209
|
+
// Also drops UI state already persisted, since `session` then differs
|
|
210
|
+
const session = toSessionInput(val)
|
|
211
|
+
if (deepEqual(session, defaultStore.read()) === true) return
|
|
214
212
|
|
|
215
|
-
defaultStore.set(
|
|
213
|
+
defaultStore.set(session)
|
|
216
214
|
|
|
217
215
|
// Trigger cart revalidation when session changes
|
|
218
216
|
cartStore.set(cartStore.read())
|
|
@@ -224,9 +222,10 @@ export const sessionStore = {
|
|
|
224
222
|
* path keeps an explicit (non-default) client SC.
|
|
225
223
|
*/
|
|
226
224
|
setSilent: (val: Session) => {
|
|
227
|
-
|
|
225
|
+
const session = toSessionInput(val)
|
|
226
|
+
if (deepEqual(session, defaultStore.read()) === true) return
|
|
228
227
|
|
|
229
|
-
defaultStore.set(
|
|
228
|
+
defaultStore.set(session)
|
|
230
229
|
},
|
|
231
230
|
}
|
|
232
231
|
|
|
@@ -276,16 +275,17 @@ export const useSession = ({ filter }: SessionOptions = { filter: true }) => {
|
|
|
276
275
|
channel = filterChannel(channel ?? '')
|
|
277
276
|
}
|
|
278
277
|
|
|
279
|
-
return useMemo(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
278
|
+
return useMemo(() => {
|
|
279
|
+
// Must match `SESSION_UI_KEYS`, which `toSessionInput` strips before the
|
|
280
|
+
// session is stored or sent to the API
|
|
281
|
+
const uiState = {
|
|
283
282
|
isValidating,
|
|
284
283
|
isSessionReady,
|
|
285
284
|
hasValidated,
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
|
|
285
|
+
} satisfies Record<SessionUIKey, boolean>
|
|
286
|
+
|
|
287
|
+
return { ...session, channel, ...uiState }
|
|
288
|
+
}, [isValidating, session, channel, isSessionReady, hasValidated])
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
/**
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Session } from '@faststore/sdk'
|
|
2
|
+
|
|
3
|
+
/** UI-only state that `useSession()` returns next to the session fields. */
|
|
4
|
+
export const SESSION_UI_KEYS = [
|
|
5
|
+
'isSessionReady',
|
|
6
|
+
'isValidating',
|
|
7
|
+
'hasValidated',
|
|
8
|
+
] as const
|
|
9
|
+
|
|
10
|
+
export type SessionUIKey = (typeof SESSION_UI_KEYS)[number]
|
|
11
|
+
|
|
12
|
+
type SessionUIState = Partial<Record<SessionUIKey, boolean>>
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Returns the session without the UI-only state, as `IStoreSession` expects.
|
|
16
|
+
* GraphQL rejects unknown input fields, so a session that carries them (e.g.
|
|
17
|
+
* built from `useSession()` or persisted that way) fails every validation.
|
|
18
|
+
*/
|
|
19
|
+
export function toSessionInput(session: Session & SessionUIState): Session {
|
|
20
|
+
const input = { ...session }
|
|
21
|
+
|
|
22
|
+
for (const key of SESSION_UI_KEYS) {
|
|
23
|
+
delete input[key]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return input
|
|
27
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Session } from '@faststore/sdk'
|
|
2
|
+
import { act, renderHook } from '@testing-library/react'
|
|
3
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
4
|
+
|
|
5
|
+
const mockValidateSession = vi.hoisted(() => vi.fn())
|
|
6
|
+
const mockSessionSet = vi.hoisted(() => vi.fn())
|
|
7
|
+
|
|
8
|
+
vi.mock('src/sdk/session', async () => ({
|
|
9
|
+
validateSession: mockValidateSession,
|
|
10
|
+
sessionStore: { set: mockSessionSet },
|
|
11
|
+
toSessionInput: (await import('src/sdk/session/toSessionInput'))
|
|
12
|
+
.toSessionInput,
|
|
13
|
+
}))
|
|
14
|
+
|
|
15
|
+
vi.mock('src/sdk/product', () => ({
|
|
16
|
+
getProductCount: vi.fn().mockResolvedValue(1),
|
|
17
|
+
}))
|
|
18
|
+
|
|
19
|
+
import useRegion from '../../../src/components/region/RegionModal/useRegion'
|
|
20
|
+
|
|
21
|
+
const session: Session = {
|
|
22
|
+
locale: 'en-US',
|
|
23
|
+
currency: { code: 'USD', symbol: '$' },
|
|
24
|
+
country: 'USA',
|
|
25
|
+
channel: '{"salesChannel":"1","regionId":""}',
|
|
26
|
+
deliveryMode: null,
|
|
27
|
+
addressType: null,
|
|
28
|
+
city: null,
|
|
29
|
+
postalCode: null,
|
|
30
|
+
geoCoordinates: null,
|
|
31
|
+
person: null,
|
|
32
|
+
b2b: null,
|
|
33
|
+
marketingData: null,
|
|
34
|
+
refreshAfter: null,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
describe('useRegion', () => {
|
|
38
|
+
afterEach(() => {
|
|
39
|
+
vi.clearAllMocks()
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it('keeps the UI state from useSession() out of the new session', async () => {
|
|
43
|
+
mockValidateSession.mockResolvedValue(null)
|
|
44
|
+
const { result } = renderHook(() => useRegion())
|
|
45
|
+
|
|
46
|
+
await act(() =>
|
|
47
|
+
result.current.setRegion({
|
|
48
|
+
session: {
|
|
49
|
+
...session,
|
|
50
|
+
isValidating: false,
|
|
51
|
+
isSessionReady: true,
|
|
52
|
+
hasValidated: true,
|
|
53
|
+
} as Session,
|
|
54
|
+
postalCode: '10001',
|
|
55
|
+
errorMessage: 'error',
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
const expected = { ...session, postalCode: '10001' }
|
|
60
|
+
|
|
61
|
+
expect(mockValidateSession).toHaveBeenCalledWith(expected)
|
|
62
|
+
expect(mockSessionSet).toHaveBeenCalledWith(expected)
|
|
63
|
+
})
|
|
64
|
+
})
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Session } from '@faststore/sdk'
|
|
2
|
+
import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
3
|
+
|
|
4
|
+
const mockRequest = vi.hoisted(() => vi.fn())
|
|
5
|
+
|
|
6
|
+
vi.mock('../../../src/sdk/graphql/request', () => ({
|
|
7
|
+
request: mockRequest,
|
|
8
|
+
}))
|
|
9
|
+
|
|
10
|
+
import { sessionStore } from '../../../src/sdk/session'
|
|
11
|
+
|
|
12
|
+
const session: Session = {
|
|
13
|
+
locale: 'en-US',
|
|
14
|
+
currency: { code: 'USD', symbol: '$' },
|
|
15
|
+
country: 'USA',
|
|
16
|
+
channel: '{"salesChannel":"1","regionId":""}',
|
|
17
|
+
deliveryMode: null,
|
|
18
|
+
addressType: null,
|
|
19
|
+
city: null,
|
|
20
|
+
postalCode: '10001',
|
|
21
|
+
geoCoordinates: null,
|
|
22
|
+
person: null,
|
|
23
|
+
b2b: null,
|
|
24
|
+
marketingData: null,
|
|
25
|
+
refreshAfter: null,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const withUIState = {
|
|
29
|
+
isValidating: false,
|
|
30
|
+
isSessionReady: true,
|
|
31
|
+
hasValidated: true,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
describe('sessionStore', () => {
|
|
35
|
+
beforeAll(async () => {
|
|
36
|
+
mockRequest.mockResolvedValue({ validateSession: null })
|
|
37
|
+
// The store validates its initial session on load; let it settle first
|
|
38
|
+
await vi.waitFor(() => expect(mockRequest).toHaveBeenCalled())
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
beforeEach(() => {
|
|
42
|
+
mockRequest.mockClear()
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it('does not store the UI state from useSession()', () => {
|
|
46
|
+
sessionStore.set({ ...session, ...withUIState } as Session)
|
|
47
|
+
|
|
48
|
+
expect(sessionStore.read()).toStrictEqual(session)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('does not store the UI state on a silent update', () => {
|
|
52
|
+
sessionStore.setSilent({
|
|
53
|
+
...session,
|
|
54
|
+
postalCode: '10002',
|
|
55
|
+
...withUIState,
|
|
56
|
+
} as Session)
|
|
57
|
+
|
|
58
|
+
expect(sessionStore.read()).toStrictEqual({
|
|
59
|
+
...session,
|
|
60
|
+
postalCode: '10002',
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
})
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Session } from '@faststore/sdk'
|
|
2
|
+
import { describe, expect, it } from 'vitest'
|
|
3
|
+
|
|
4
|
+
import { toSessionInput } from '../../../src/sdk/session/toSessionInput'
|
|
5
|
+
|
|
6
|
+
const session: Session = {
|
|
7
|
+
locale: 'en-US',
|
|
8
|
+
currency: { code: 'USD', symbol: '$' },
|
|
9
|
+
country: 'USA',
|
|
10
|
+
channel: '{"salesChannel":"1","regionId":""}',
|
|
11
|
+
deliveryMode: null,
|
|
12
|
+
addressType: null,
|
|
13
|
+
city: null,
|
|
14
|
+
postalCode: '10001',
|
|
15
|
+
geoCoordinates: null,
|
|
16
|
+
person: null,
|
|
17
|
+
b2b: null,
|
|
18
|
+
marketingData: null,
|
|
19
|
+
refreshAfter: null,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe('toSessionInput', () => {
|
|
23
|
+
it('drops the UI state useSession() adds, which IStoreSession rejects', () => {
|
|
24
|
+
expect(
|
|
25
|
+
toSessionInput({
|
|
26
|
+
...session,
|
|
27
|
+
isValidating: false,
|
|
28
|
+
isSessionReady: true,
|
|
29
|
+
hasValidated: true,
|
|
30
|
+
})
|
|
31
|
+
).toEqual(session)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('strips the UI state from a session persisted with it', () => {
|
|
35
|
+
const persisted = { ...session, hasValidated: true } as Session
|
|
36
|
+
|
|
37
|
+
expect(toSessionInput(persisted)).toEqual(session)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('keeps a clean session as is', () => {
|
|
41
|
+
expect(toSessionInput(session)).toEqual(session)
|
|
42
|
+
})
|
|
43
|
+
})
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Session } from '@faststore/sdk'
|
|
2
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
3
|
+
|
|
4
|
+
const mockRequest = vi.hoisted(() => vi.fn())
|
|
5
|
+
|
|
6
|
+
vi.mock('../../../src/sdk/graphql/request', () => ({
|
|
7
|
+
request: mockRequest,
|
|
8
|
+
}))
|
|
9
|
+
|
|
10
|
+
import { validateSession } from '../../../src/sdk/session'
|
|
11
|
+
|
|
12
|
+
const session: Session = {
|
|
13
|
+
locale: 'en-US',
|
|
14
|
+
currency: { code: 'USD', symbol: '$' },
|
|
15
|
+
country: 'USA',
|
|
16
|
+
channel: '{"salesChannel":"1","regionId":""}',
|
|
17
|
+
deliveryMode: null,
|
|
18
|
+
addressType: null,
|
|
19
|
+
city: null,
|
|
20
|
+
postalCode: '10001',
|
|
21
|
+
geoCoordinates: null,
|
|
22
|
+
person: null,
|
|
23
|
+
b2b: null,
|
|
24
|
+
marketingData: null,
|
|
25
|
+
refreshAfter: null,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
describe('validateSession', () => {
|
|
29
|
+
beforeEach(async () => {
|
|
30
|
+
mockRequest.mockResolvedValue({ validateSession: null })
|
|
31
|
+
// The store validates its initial session on load; let it settle first
|
|
32
|
+
await vi.waitFor(() => expect(mockRequest).toHaveBeenCalled())
|
|
33
|
+
mockRequest.mockClear()
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('does not send the UI state persisted with the session', async () => {
|
|
37
|
+
await validateSession({
|
|
38
|
+
...session,
|
|
39
|
+
isValidating: false,
|
|
40
|
+
isSessionReady: true,
|
|
41
|
+
hasValidated: true,
|
|
42
|
+
} as Session)
|
|
43
|
+
|
|
44
|
+
expect(mockRequest).toHaveBeenCalledTimes(1)
|
|
45
|
+
expect(mockRequest.mock.calls[0][1].session).toStrictEqual(session)
|
|
46
|
+
})
|
|
47
|
+
})
|