@faststore/core 3.81.0 → 3.82.2

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.
Files changed (114) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +43 -43
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/config.json +3 -3
  5. package/.next/cache/webpack/client-production/0.pack +0 -0
  6. package/.next/cache/webpack/client-production/index.pack +0 -0
  7. package/.next/cache/webpack/server-production/0.pack +0 -0
  8. package/.next/cache/webpack/server-production/index.pack +0 -0
  9. package/.next/prerender-manifest.js +1 -1
  10. package/.next/prerender-manifest.json +1 -1
  11. package/.next/react-loadable-manifest.json +24 -24
  12. package/.next/routes-manifest.json +1 -1
  13. package/.next/server/chunks/2430.js +1 -1
  14. package/.next/server/chunks/2570.js +1 -1
  15. package/.next/server/chunks/3945.js +1 -1
  16. package/.next/server/chunks/8071.js +1 -1
  17. package/.next/server/chunks/83.js +1 -1
  18. package/.next/server/chunks/8474.js +1 -1
  19. package/.next/server/chunks/8563.js +1 -1
  20. package/.next/server/chunks/8687.js +1 -1
  21. package/.next/server/chunks/9117.js +1 -1
  22. package/.next/server/chunks/948.js +2 -2
  23. package/.next/server/chunks/9563.js +2 -2
  24. package/.next/server/chunks/9630.js +3 -3
  25. package/.next/server/chunks/9853.js +1 -1
  26. package/.next/server/chunks/ButtonSignIn.js +1 -1
  27. package/.next/server/chunks/UISKUMatrixSidebar.js +1 -1
  28. package/.next/server/middleware-build-manifest.js +1 -1
  29. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  30. package/.next/server/pages/[...slug].js +1 -1
  31. package/.next/server/pages/[slug]/p.js +1 -1
  32. package/.next/server/pages/account/orders.js +1 -1
  33. package/.next/server/pages/api/graphql.js +2 -2
  34. package/.next/server/pages/en-US/404.html +1 -1
  35. package/.next/server/pages/en-US/500.html +1 -1
  36. package/.next/server/pages/en-US/checkout.html +1 -1
  37. package/.next/server/pages/en-US/login.html +1 -1
  38. package/.next/server/pages/en-US/s.html +1 -1
  39. package/.next/server/pages/en-US.html +1 -1
  40. package/.next/server/pages/s.js +1 -1
  41. package/.next/server/pages-manifest.json +1 -1
  42. package/.next/static/{v2vl5Y9dOFfl93DdQC3uY → Uvcxd2ViFEhaCaNA_H3ts}/_buildManifest.js +1 -1
  43. package/.next/static/chunks/2284.6e01b30c38bb74fd.js +1 -0
  44. package/.next/static/chunks/3155.8ff6efc44151971f.js +1 -0
  45. package/.next/static/chunks/{3166-a1d98d71987c90d6.js → 3166-785c61fd0e214905.js} +1 -1
  46. package/.next/static/chunks/3399.15d4dbadc57c3f42.js +1 -0
  47. package/.next/static/chunks/3836.63a23109a71dbbdb.js +1 -0
  48. package/.next/static/chunks/4803.74cf987971db6d93.js +1 -0
  49. package/.next/static/chunks/6700.ddae2aa02d2dd401.js +1 -0
  50. package/.next/static/chunks/{6789.634a5fcc1ed30b8d.js → 6789.38bef760c1190c23.js} +1 -1
  51. package/.next/static/chunks/7191-102277856f196551.js +1 -0
  52. package/.next/static/chunks/83.730576d7ded8dfe2.js +1 -0
  53. package/.next/static/chunks/8325.40b7331df742c2f5.js +1 -0
  54. package/.next/static/chunks/9173-912ae438e42cb222.js +1 -0
  55. package/.next/static/chunks/ButtonSignIn.e767fc25322cf230.js +1 -0
  56. package/.next/static/chunks/CartItem.d4c2664933f93606.js +1 -0
  57. package/.next/static/chunks/CartSidebar.e21ad4975e18e6db.js +1 -0
  58. package/.next/static/chunks/Gift.5891ca280b4f0164.js +1 -0
  59. package/.next/static/chunks/OrderSummary.35d859a1e467ad91.js +1 -0
  60. package/.next/static/chunks/ProductShelf.9f3194be577c7cce.js +1 -0
  61. package/.next/static/chunks/ProductTiles.e0528e72234381e6.js +1 -0
  62. package/.next/static/chunks/RegionModal.b5edb6ada60d37ec.js +1 -0
  63. package/.next/static/chunks/RegionSlider.3d9063b0cb6733d9.js +1 -0
  64. package/.next/static/chunks/UISKUMatrixSidebar.5793df7899038286.js +1 -0
  65. package/.next/static/chunks/pages/[slug]/p-0287b5a8ac0b92e5.js +1 -0
  66. package/.next/static/chunks/pages/_app-f8a8608651b3f06b.js +1 -0
  67. package/.next/static/chunks/pages/account/orders/[id]-c2d355a49d409bb0.js +1 -0
  68. package/.next/static/chunks/pages/account/orders-68bef823fcd81bf9.js +1 -0
  69. package/.next/static/chunks/{webpack-39f2e04144d694ad.js → webpack-3f872192534f3b6d.js} +1 -1
  70. package/.next/trace +136 -136
  71. package/.turbo/turbo-build.log +27 -27
  72. package/.turbo/turbo-test.log +5 -5
  73. package/CHANGELOG.md +10 -0
  74. package/cms/faststore/content-types.json +21 -0
  75. package/package.json +3 -3
  76. package/src/Layout.tsx +0 -2
  77. package/src/components/region/RegionBar/RegionBar.tsx +17 -23
  78. package/src/components/region/RegionButton/RegionButton.tsx +4 -35
  79. package/src/components/search/Filter/FilterDeliveryMethodFacet.tsx +2 -8
  80. package/src/components/search/Filter/FilterDesktop.tsx +19 -7
  81. package/src/components/search/Filter/FilterSlider.tsx +20 -9
  82. package/src/components/templates/ProductListingPage/ProductListing.tsx +1 -1
  83. package/src/components/ui/ProductGallery/ProductGallery.tsx +1 -1
  84. package/src/sdk/deliveryPromise/useDeliveryPromise.ts +127 -63
  85. package/src/sdk/geolocation/useGeolocation.ts +18 -28
  86. package/src/sdk/session/index.ts +11 -29
  87. package/src/sdk/userLocation/index.ts +142 -0
  88. package/src/utils/globalSettings.ts +5 -0
  89. package/.next/static/chunks/2284.6dd050e60172189a.js +0 -1
  90. package/.next/static/chunks/3155.c3fa96f983101956.js +0 -1
  91. package/.next/static/chunks/3399.60aae5ddb9123ef5.js +0 -1
  92. package/.next/static/chunks/3836.a2f49cd66f78bcb2.js +0 -1
  93. package/.next/static/chunks/4803.412bf2a7e15626a6.js +0 -1
  94. package/.next/static/chunks/6700.f046aa86e2c83b53.js +0 -1
  95. package/.next/static/chunks/7191-2b424236f6799274.js +0 -1
  96. package/.next/static/chunks/83.affac11ef34a0c11.js +0 -1
  97. package/.next/static/chunks/8325.b3ddbb43feda1a85.js +0 -1
  98. package/.next/static/chunks/9173-acced9d62b9088c8.js +0 -1
  99. package/.next/static/chunks/ButtonSignIn.111c95c4e7e2640f.js +0 -1
  100. package/.next/static/chunks/CartItem.e010557e686e1009.js +0 -1
  101. package/.next/static/chunks/CartSidebar.f2f885b6d9a227e2.js +0 -1
  102. package/.next/static/chunks/Gift.f93e4a95caf390e3.js +0 -1
  103. package/.next/static/chunks/OrderSummary.8092365254225970.js +0 -1
  104. package/.next/static/chunks/ProductShelf.dcdeffe85dca1ace.js +0 -1
  105. package/.next/static/chunks/ProductTiles.12e553830401871d.js +0 -1
  106. package/.next/static/chunks/RegionModal.0aff964cb36eb49a.js +0 -1
  107. package/.next/static/chunks/RegionSlider.cbf2ac28eeac8dbe.js +0 -1
  108. package/.next/static/chunks/UISKUMatrixSidebar.8b6fac58c48f999c.js +0 -1
  109. package/.next/static/chunks/pages/[slug]/p-2c73921b1ab00c27.js +0 -1
  110. package/.next/static/chunks/pages/_app-57478e0d1d2ddf62.js +0 -1
  111. package/.next/static/chunks/pages/account/orders/[id]-0a4ab1b9f4c54abb.js +0 -1
  112. package/.next/static/chunks/pages/account/orders-63e3a141c7bd9070.js +0 -1
  113. package/src/components/region/RegionModal/useRegionModal.ts +0 -44
  114. /package/.next/static/{v2vl5Y9dOFfl93DdQC3uY → Uvcxd2ViFEhaCaNA_H3ts}/_ssgManifest.js +0 -0
@@ -1,23 +1,23 @@
1
1
 
2
- > @faststore/core@3.80.0 prebuild /home/runner/work/faststore/faststore/packages/core
2
+ > @faststore/core@3.82.0 prebuild /home/runner/work/faststore/faststore/packages/core
3
3
  > na run partytown && na run generate
4
4
 
5
5
 
6
- > @faststore/core@3.80.0 partytown /home/runner/work/faststore/faststore/packages/core
6
+ > @faststore/core@3.82.0 partytown /home/runner/work/faststore/faststore/packages/core
7
7
  > partytown copylib ./public/~partytown
8
8
 
9
9
  Partytown lib copied to: /home/runner/work/faststore/faststore/packages/core/public/~partytown
10
10
 
11
- > @faststore/core@3.80.0 generate /home/runner/work/faststore/faststore/packages/core
11
+ > @faststore/core@3.82.0 generate /home/runner/work/faststore/faststore/packages/core
12
12
  > na run generate:schema && na run generate:codegen && na run format:generated
13
13
 
14
14
 
15
- > @faststore/core@3.80.0 generate:schema /home/runner/work/faststore/faststore/packages/core
15
+ > @faststore/core@3.82.0 generate:schema /home/runner/work/faststore/faststore/packages/core
16
16
  > tsx src/server/generator/generateGraphQLSchemaFile.ts
17
17
 
18
18
  Schema GraphQL file generated successfully
19
19
 
20
- > @faststore/core@3.80.0 generate:codegen /home/runner/work/faststore/faststore/packages/core
20
+ > @faststore/core@3.82.0 generate:codegen /home/runner/work/faststore/faststore/packages/core
21
21
  > graphql-codegen
22
22
 
23
23
  [STARTED] Parse Configuration
@@ -37,11 +37,11 @@ Running lifecycle hook "afterStart" scripts...
37
37
  [CLI] Loading Documents
38
38
  [CLI] Generating output
39
39
 
40
- > @faststore/core@3.80.0 format:generated /home/runner/work/faststore/faststore/packages/core
40
+ > @faststore/core@3.82.0 format:generated /home/runner/work/faststore/faststore/packages/core
41
41
  > prettier --write "@generated/**/*.{ts,js,tsx,jsx,json}" --loglevel error
42
42
 
43
43
 
44
- > @faststore/core@3.80.0 build /home/runner/work/faststore/faststore/packages/core
44
+ > @faststore/core@3.82.0 build /home/runner/work/faststore/faststore/packages/core
45
45
  > next build
46
46
 
47
47
  ⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
@@ -65,52 +65,52 @@ Browserslist: browsers data (caniuse-lite) is 8 months old. Please run:
65
65
  Collecting page data ...
66
66
  Generating static pages (0/6) ...
67
67
 
68
68
  Generating static pages (1/6)
69
-
70
69
  Generating static pages (2/6)
71
70
  Warning: Dynamic Content not found for the page: home. Refer to the Dynamic Content documentation at https://developers.vtex.com/docs/guides/faststore/dynamic-content-overview for mapping the page and the corresponding data-fetching function.
71
+
72
72
  Generating static pages (2/6)
73
73
 
74
74
  Generating static pages (4/6)
75
75
 
76
76
  ✓ Generating static pages (6/6)
77
77
  Finalizing page optimization ...
78
78
  Collecting build traces ...
79
79
 
80
80
  Route (pages) Size First Load JS
81
- ┌ ● / 3.66 kB 140 kB
81
+ ┌ ● / 3.66 kB 141 kB
82
82
  ├ └ css/b1806cbafd0c1f81.css 3.06 kB
83
- ├ /_app 0 B 106 kB
84
- ├ ● /[...slug] 2.45 kB 154 kB
83
+ ├ /_app 0 B 107 kB
84
+ ├ ● /[...slug] 2.45 kB 155 kB
85
85
  ├ ● /[slug]/p 33.2 kB 170 kB
86
86
  ├ ├ css/a3ca6a9b63f657be.css 5.75 kB
87
87
  ├ ├ css/62a5153ac7061286.css 6.11 kB
88
88
  ├ └ css/6d92375b6ee8276a.css 16.1 kB
89
- ├ ○ /404 1.55 kB 138 kB
90
- ├ ● /500 1.55 kB 138 kB
91
- ├ λ /account 240 B 106 kB
92
- ├ ● /account/[...unknown] 281 B 106 kB
89
+ ├ ○ /404 1.55 kB 139 kB
90
+ ├ ● /500 1.55 kB 139 kB
91
+ ├ λ /account 240 B 107 kB
92
+ ├ ● /account/[...unknown] 281 B 107 kB
93
93
  ├ λ /account/403 2.44 kB 139 kB
94
94
  ├ └ css/b7bba8fce075688b.css 4.2 kB
95
95
  ├ λ /account/404 2.13 kB 139 kB
96
96
  ├ └ css/5347dbc8b71de47d.css 4.25 kB
97
97
  ├ λ /account/orders 10.1 kB 147 kB
98
98
  ├ └ css/38e3a4a55b13b062.css 12.7 kB
99
- ├ λ /account/orders/[id] 12.1 kB 149 kB
99
+ ├ λ /account/orders/[id] 12.2 kB 149 kB
100
100
  ├ └ css/297be4be3be36ff0.css 12.6 kB
101
- ├ λ /account/profile 1.79 kB 138 kB
101
+ ├ λ /account/profile 1.79 kB 139 kB
102
102
  ├ └ css/831a1f72fe4b2d80.css 3.97 kB
103
- ├ λ /account/security 3.76 kB 140 kB
103
+ ├ λ /account/security 3.76 kB 141 kB
104
104
  ├ └ css/ec7fdad03808422d.css 5.22 kB
105
- ├ λ /account/user-details 1.74 kB 138 kB
105
+ ├ λ /account/user-details 1.74 kB 139 kB
106
106
  ├ └ css/e46393a76c5d93a9.css 4.17 kB
107
- ├ λ /api/graphql 0 B 106 kB
108
- ├ λ /api/health/live 0 B 106 kB
109
- ├ λ /api/health/ready 0 B 106 kB
110
- ├ λ /api/preview 0 B 106 kB
111
- ├ ● /checkout 737 B 137 kB
112
- ├ ● /login 1.68 kB 138 kB
107
+ ├ λ /api/graphql 0 B 107 kB
108
+ ├ λ /api/health/live 0 B 107 kB
109
+ ├ λ /api/health/ready 0 B 107 kB
110
+ ├ λ /api/preview 0 B 107 kB
111
+ ├ ● /checkout 737 B 138 kB
112
+ ├ ● /login 1.68 kB 139 kB
113
113
  └ ● /s 3.3 kB 155 kB
114
114
  + First Load JS shared by all 110 kB
115
115
  ├ chunks/framework-807b0f81cbc129f0.js 45.4 kB
116
116
  ├ chunks/main-f658704b53a96ab1.js 33.1 kB
117
- ├ chunks/pages/_app-57478e0d1d2ddf62.js 23.8 kB
118
- ├ chunks/webpack-39f2e04144d694ad.js 3.85 kB
117
+ ├ chunks/pages/_app-f8a8608651b3f06b.js 24.3 kB
118
+ ├ chunks/webpack-3f872192534f3b6d.js 3.85 kB
119
119
  └ css/4b8252ed2f23ac67.css 3.51 kB
120
120
 
121
121
  λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
@@ -1,14 +1,14 @@
1
1
 
2
- > @faststore/core@3.80.0 test /home/runner/work/faststore/faststore/packages/core
2
+ > @faststore/core@3.82.0 test /home/runner/work/faststore/faststore/packages/core
3
3
  > jest
4
4
 
5
- PASS test/utils/multipleTemplates.test.ts (26.996 s)
6
- PASS test/server/cms/global.test.ts (27.008 s)
5
+ PASS test/server/cms/global.test.ts (27.279 s)
6
+ PASS test/utils/multipleTemplates.test.ts (27.591 s)
7
7
  PASS test/server/cms/index.test.ts
8
- PASS test/server/index.test.ts (30.315 s)
8
+ PASS test/server/index.test.ts (31.521 s)
9
9
 
10
10
  Test Suites: 4 passed, 4 total
11
11
  Tests: 22 passed, 22 total
12
12
  Snapshots: 0 total
13
- Time: 31.607 s
13
+ Time: 32.836 s
14
14
  Ran all test suites.
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
+ ## [3.82.2](https://github.com/vtex/faststore/compare/v3.82.1...v3.82.2) (2025-09-05)
7
+
8
+ **Note:** Version bump only for package @faststore/core
9
+
10
+ # [3.82.0](https://github.com/vtex/faststore/compare/v3.81.0...v3.82.0) (2025-09-05)
11
+
12
+ ### Features
13
+
14
+ - Delivery Promise 2.1 - filters by Delivery Option ([#2926](https://github.com/vtex/faststore/issues/2926)) ([d365a5e](https://github.com/vtex/faststore/commit/d365a5ea0da451a58c87fd6bcfd7f49df2c96158)), closes [#2928](https://github.com/vtex/faststore/issues/2928) [#2930](https://github.com/vtex/faststore/issues/2930) [#2937](https://github.com/vtex/faststore/issues/2937)
15
+
6
16
  # 3.81.0 (2025-09-05)
7
17
 
8
18
  ### Features
@@ -234,6 +234,27 @@
234
234
  }
235
235
  }
236
236
  }
237
+ },
238
+ "deliveryOptions": {
239
+ "title": "PLP/Search Filter: Delivery Options",
240
+ "type": "object",
241
+ "properties": {
242
+ "enabled": {
243
+ "title": "Should enable Delivery Options?",
244
+ "type": "boolean",
245
+ "default": true
246
+ },
247
+ "title": {
248
+ "title": "Delivery Options title",
249
+ "type": "string",
250
+ "default": "Delivery Option"
251
+ },
252
+ "allDeliveryOptions": {
253
+ "title": "All delivery options label",
254
+ "type": "string",
255
+ "default": "All delivery options"
256
+ }
257
+ }
237
258
  }
238
259
  }
239
260
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "3.81.0",
3
+ "version": "3.82.2",
4
4
  "license": "MIT",
5
5
  "repository": "vtex/faststore",
6
6
  "browserslist": "supports es6-module and not dead",
@@ -44,7 +44,7 @@
44
44
  "@envelop/graphql-jit": "^8.0.3",
45
45
  "@envelop/parser-cache": "^6.0.2",
46
46
  "@envelop/validation-cache": "^6.0.2",
47
- "@faststore/api": "^3.81.0",
47
+ "@faststore/api": "^3.82.0",
48
48
  "@faststore/graphql-utils": "^3.81.0",
49
49
  "@faststore/lighthouse": "^3.81.0",
50
50
  "@faststore/sdk": "^3.81.0",
@@ -108,5 +108,5 @@
108
108
  "ts-jest": "29.1.1",
109
109
  "typescript": "5.3.2"
110
110
  },
111
- "gitHead": "37ac845dce3df8c22a348a2e6895f5b65dc9de45"
111
+ "gitHead": "fbbcce83dabcc215933fa167adc54ced9473c9f0"
112
112
  }
package/src/Layout.tsx CHANGED
@@ -1,12 +1,10 @@
1
1
  import { useMemo, type PropsWithChildren, type ReactElement } from 'react'
2
2
 
3
- import { useRegionModal } from './components/region/RegionModal/useRegionModal'
4
3
  import { usePageViewEvent } from './sdk/analytics/hooks/usePageViewEvent'
5
4
 
6
5
  function Layout({ children }: PropsWithChildren) {
7
6
  const props = useMemo(() => (children as ReactElement)?.props, [])
8
7
  usePageViewEvent(props)
9
- useRegionModal()
10
8
 
11
9
  return <>{children}</>
12
10
  }
@@ -1,20 +1,16 @@
1
- import {
2
- regionSliderTypes,
3
- type RegionBarProps as UIRegionBarProps,
4
- } from '@faststore/ui'
1
+ import type { RegionBarProps as UIRegionBarProps } from '@faststore/ui'
5
2
  import { useEffect, useRef } from 'react'
6
3
 
7
- import { useUI } from '@faststore/ui'
8
- import { useSession } from 'src/sdk/session'
4
+ import { regionSliderTypes, useUI } from '@faststore/ui'
5
+ import { sessionStore, useSession } from 'src/sdk/session'
9
6
  import { useDeliveryPromise } from 'src/sdk/deliveryPromise'
10
7
 
11
- import { deliveryPromise, session as initialSession } from 'discovery.config'
12
8
  import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
13
9
  import { textToTitleCase } from 'src/utils/utilities'
14
10
  import { getGlobalSettings } from 'src/utils/globalSettings'
11
+ import { useCheckRegionState } from 'src/sdk/userLocation'
15
12
 
16
- import { useRegionModal } from '../RegionModal/useRegionModal'
17
-
13
+ import { deliveryPromise } from 'discovery.config'
18
14
  export interface RegionBarProps {
19
15
  /**
20
16
  * A React component that will be rendered as the location icon.
@@ -55,40 +51,38 @@ function RegionBar({
55
51
  FilterButtonIcon,
56
52
  } = useOverrideComponents<'RegionBar'>()
57
53
 
58
- const { openModal, openPopover, openRegionSlider } = useUI()
59
54
  const { city, postalCode } = useSession()
60
- const { isValidationComplete } = useRegionModal()
55
+ const regionBarRef = useRef<HTMLDivElement>(null)
56
+ const { openPopover, openRegionSlider } = useUI()
57
+ const { openModal } = useCheckRegionState(regionBarRef)
61
58
  const { globalPickupPoint } = useDeliveryPromise()
62
59
  const {
63
60
  deliveryPromise: { filterByPickupPoint } = {},
64
61
  } = getGlobalSettings()
65
- const regionBarRef = useRef<HTMLDivElement>(null)
62
+ const initialSession = sessionStore.readInitial()
66
63
 
67
- const defaultPostalCode =
68
- !!initialSession?.postalCode && postalCode === initialSession.postalCode
69
64
  const shouldDisplayGlobalFilter =
70
65
  deliveryPromise.enabled && !!postalCode && filterByPickupPoint?.enabled
71
66
 
72
- // If location is not mandatory, and default zipCode is provided or if the user has not set a zipCode, show the popover.
73
- const displayRegionPopover =
74
- defaultPostalCode || (!postalCode && !deliveryPromise.mandatory)
75
-
76
67
  useEffect(() => {
77
68
  if (!deliveryPromise.enabled) {
78
69
  return
79
70
  }
80
71
 
81
- if (!isValidationComplete) {
82
- return
83
- }
72
+ const defaultPostalCode =
73
+ !!initialSession?.postalCode && postalCode === initialSession.postalCode
74
+
75
+ // If location is not mandatory, and default zipCode is provided or if the user has not set a zipCode, show the popover.
76
+ const displayRegionPopover =
77
+ defaultPostalCode || (!postalCode && !deliveryPromise.mandatory)
84
78
 
85
- if (isValidationComplete && displayRegionPopover && regionBarRef.current) {
79
+ if (displayRegionPopover && regionBarRef.current) {
86
80
  openPopover({
87
81
  isOpen: true,
88
82
  triggerRef: regionBarRef,
89
83
  })
90
84
  }
91
- }, [isValidationComplete])
85
+ }, [])
92
86
 
93
87
  return (
94
88
  <RegionBarWrapper.Component
@@ -1,45 +1,14 @@
1
- import { useEffect, useRef } from 'react'
1
+ import { useRef } from 'react'
2
2
 
3
- import { Button as UIButton, Icon as UIIcon, useUI } from '@faststore/ui'
4
- import { deliveryPromise, session as initialSession } from 'discovery.config'
3
+ import { Button as UIButton, Icon as UIIcon } from '@faststore/ui'
5
4
  import { useSession } from 'src/sdk/session'
6
5
  import { textToTitleCase } from 'src/utils/utilities'
7
-
8
- import { useRegionModal } from '../RegionModal/useRegionModal'
6
+ import { useCheckRegionState } from 'src/sdk/userLocation'
9
7
 
10
8
  function RegionButton({ icon, label }: { icon: string; label: string }) {
11
- const { openModal, openPopover } = useUI()
12
9
  const { city, postalCode } = useSession()
13
- const { isValidationComplete } = useRegionModal()
14
10
  const regionButtonRef = useRef<HTMLButtonElement>(null)
15
-
16
- const defaultPostalCode =
17
- !!initialSession?.postalCode && postalCode === initialSession.postalCode
18
-
19
- // If location is not mandatory, and default zipCode is provided or if the user has not set a zipCode, show the popover.
20
- const displayRegionPopover =
21
- defaultPostalCode || (!postalCode && !deliveryPromise.mandatory)
22
-
23
- useEffect(() => {
24
- if (!deliveryPromise.enabled) {
25
- return
26
- }
27
-
28
- if (!isValidationComplete) {
29
- return
30
- }
31
-
32
- if (
33
- isValidationComplete &&
34
- displayRegionPopover &&
35
- regionButtonRef.current
36
- ) {
37
- openPopover({
38
- isOpen: true,
39
- triggerRef: regionButtonRef,
40
- })
41
- }
42
- }, [isValidationComplete])
11
+ const { openModal } = useCheckRegionState(regionButtonRef)
43
12
 
44
13
  return (
45
14
  <UIButton
@@ -1,17 +1,11 @@
1
1
  import { regionSliderTypes, Button as UIButton, useUI } from '@faststore/ui'
2
+ import type { StoreFacetValueBoolean } from '@generated/graphql'
2
3
  import { sessionStore } from 'src/sdk/session'
3
4
  import type { GlobalCmsData } from 'src/utils/globalSettings'
4
5
  import { textToTitleCase } from 'src/utils/utilities'
5
6
 
6
- interface FacetValue {
7
- value: string
8
- label: string
9
- selected: boolean
10
- quantity: number
11
- }
12
-
13
7
  interface FilterDeliveryMethodFacetProps {
14
- item: FacetValue
8
+ item: StoreFacetValueBoolean
15
9
  deliveryMethods: GlobalCmsData['deliveryPromise']['deliveryMethods']
16
10
  }
17
11
 
@@ -18,8 +18,8 @@ import type { useFilter } from 'src/sdk/search/useFilter'
18
18
  import type { FilterSliderProps } from './FilterSlider'
19
19
 
20
20
  import {
21
- useDeliveryPromise,
22
21
  PICKUP_ALL_FACET_VALUE,
22
+ useDeliveryPromise,
23
23
  } from 'src/sdk/deliveryPromise'
24
24
  import { getGlobalSettings } from 'src/utils/globalSettings'
25
25
  import FilterDeliveryMethodFacet from './FilterDeliveryMethodFacet'
@@ -48,6 +48,7 @@ function FilterDesktop({
48
48
  const {
49
49
  facets: filteredFacets,
50
50
  deliveryLabel,
51
+ deliveryOptionsLabel,
51
52
  isPickupAllEnabled,
52
53
  shouldDisplayDeliveryButton,
53
54
  onDeliveryFacetChange,
@@ -92,17 +93,24 @@ function FilterDesktop({
92
93
  const index = shouldDisplayDeliveryButton ? idx + 1 : idx
93
94
  const { __typename: type, label } = facet
94
95
  const isExpanded = expanded.has(index)
95
- const isDeliveryFacet = facet.key === 'shipping'
96
+ const isDeliveryMethodFacet = facet.key === 'shipping'
97
+ const isDeliveryOptionFacet = facet.key === 'delivery-options'
98
+
99
+ const sectionLabel = isDeliveryMethodFacet
100
+ ? deliveryLabel
101
+ : isDeliveryOptionFacet
102
+ ? deliveryOptionsLabel
103
+ : label
96
104
 
97
105
  return (
98
106
  <UIFilterFacets
99
- key={`${testId}-${label}-${index}`}
107
+ key={`${testId}-${sectionLabel}-${index}`}
100
108
  testId={testId}
101
109
  index={index}
102
110
  type={type}
103
- label={isDeliveryFacet ? deliveryLabel : label}
111
+ label={sectionLabel}
104
112
  description={
105
- isDeliveryFacet
113
+ isDeliveryMethodFacet
106
114
  ? deliveryPromiseSettings?.deliveryMethods?.description
107
115
  : undefined
108
116
  }
@@ -126,7 +134,7 @@ function FilterDesktop({
126
134
  quantity={item.quantity}
127
135
  facetKey={facet.key}
128
136
  label={
129
- isDeliveryFacet ? (
137
+ isDeliveryMethodFacet ? (
130
138
  <FilterDeliveryMethodFacet
131
139
  item={item}
132
140
  deliveryMethods={
@@ -137,7 +145,11 @@ function FilterDesktop({
137
145
  item.label
138
146
  )
139
147
  }
140
- type={isDeliveryFacet ? 'radio' : 'checkbox'}
148
+ type={
149
+ isDeliveryMethodFacet || isDeliveryOptionFacet
150
+ ? 'radio'
151
+ : 'checkbox'
152
+ }
141
153
  />
142
154
  )
143
155
  )}
@@ -12,17 +12,16 @@ import {
12
12
  type FilterSliderProps as UIFilterSliderProps,
13
13
  type IconProps as UIIconProps,
14
14
  } from '@faststore/ui'
15
-
16
15
  import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice'
17
16
 
18
17
  import type { Filter_FacetsFragment } from '@generated/graphql'
19
18
  import FilterDeliveryMethodFacet from './FilterDeliveryMethodFacet'
20
19
 
21
- import type { useFilter } from 'src/sdk/search/useFilter'
22
20
  import {
23
- useDeliveryPromise,
24
21
  PICKUP_ALL_FACET_VALUE,
22
+ useDeliveryPromise,
25
23
  } from 'src/sdk/deliveryPromise'
24
+ import type { useFilter } from 'src/sdk/search/useFilter'
26
25
  import { getGlobalSettings } from 'src/utils/globalSettings'
27
26
 
28
27
  import styles from './section.module.scss'
@@ -104,6 +103,7 @@ function FilterSlider({
104
103
  const {
105
104
  facets: filteredFacets,
106
105
  deliveryLabel,
106
+ deliveryOptionsLabel,
107
107
  isPickupAllEnabled,
108
108
  shouldDisplayDeliveryButton,
109
109
  onDeliveryFacetChange,
@@ -190,17 +190,24 @@ function FilterSlider({
190
190
  const index = shouldDisplayDeliveryButton ? idx + 1 : idx
191
191
  const { __typename: type, label } = facet
192
192
  const isExpanded = expanded.has(index)
193
- const isDeliveryFacet = facet.key === 'shipping'
193
+ const isDeliveryMethodFacet = facet.key === 'shipping'
194
+ const isDeliveryOptionFacet = facet.key === 'delivery-options'
195
+
196
+ const sectionLabel = isDeliveryMethodFacet
197
+ ? deliveryLabel
198
+ : isDeliveryOptionFacet
199
+ ? deliveryOptionsLabel
200
+ : label
194
201
 
195
202
  return (
196
203
  <UIFilterFacets
197
- key={`${testId}-${label}-${index}`}
204
+ key={`${testId}-${sectionLabel}-${index}`}
198
205
  testId={`mobile-${testId}`}
199
206
  index={index}
200
207
  type={type}
201
- label={isDeliveryFacet ? deliveryLabel : label}
208
+ label={sectionLabel}
202
209
  description={
203
- isDeliveryFacet
210
+ isDeliveryMethodFacet
204
211
  ? deliveryPromiseSettings?.deliveryMethods?.description
205
212
  : undefined
206
213
  }
@@ -226,7 +233,7 @@ function FilterSlider({
226
233
  quantity={item.quantity}
227
234
  facetKey={facet.key}
228
235
  label={
229
- isDeliveryFacet ? (
236
+ isDeliveryMethodFacet ? (
230
237
  <FilterDeliveryMethodFacet
231
238
  item={item}
232
239
  deliveryMethods={
@@ -237,7 +244,11 @@ function FilterSlider({
237
244
  item.label
238
245
  )
239
246
  }
240
- type={isDeliveryFacet ? 'radio' : 'checkbox'}
247
+ type={
248
+ isDeliveryMethodFacet || isDeliveryOptionFacet
249
+ ? 'radio'
250
+ : 'checkbox'
251
+ }
241
252
  />
242
253
  )
243
254
  )}
@@ -1,4 +1,4 @@
1
- import { formatSearchState, useSearch } from '@faststore/sdk'
1
+ import { useSearch } from '@faststore/sdk'
2
2
  import type {
3
3
  ServerCollectionPageQueryQuery,
4
4
  ServerManyProductsQueryQuery,
@@ -22,8 +22,8 @@ import { useDelayedPagination } from 'src/sdk/search/useDelayedPagination'
22
22
  import { useFilter } from 'src/sdk/search/useFilter'
23
23
  import useScreenResize from 'src/sdk/ui/useScreenResize'
24
24
 
25
- import styles from '../../sections/ProductGallery/section.module.scss'
26
25
  import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice'
26
+ import styles from '../../sections/ProductGallery/section.module.scss'
27
27
 
28
28
  const ProductGalleryPage = lazy(() => import('./ProductGalleryPage'))
29
29
  const FilterSkeleton = dynamic(