@faststore/core 3.67.0 → 3.68.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.
Files changed (247) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +74 -74
  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 +86 -71
  12. package/.next/routes-manifest.json +1 -1
  13. package/.next/server/chunks/1333.js +1 -0
  14. package/.next/server/chunks/2778.js +2 -2
  15. package/.next/server/chunks/2792.js +1 -1
  16. package/.next/server/chunks/3006.js +1 -1
  17. package/.next/server/chunks/3836.js +1 -1
  18. package/.next/server/chunks/3918.js +1 -1
  19. package/.next/server/chunks/3963.js +1 -1
  20. package/.next/server/chunks/6789.js +1 -1
  21. package/.next/server/chunks/7178.js +1 -1
  22. package/.next/server/chunks/7228.js +1 -1
  23. package/.next/server/chunks/7794.js +1 -1
  24. package/.next/server/chunks/83.js +1 -1
  25. package/.next/server/chunks/831.js +1 -1
  26. package/.next/server/chunks/839.js +1 -0
  27. package/.next/server/chunks/8569.js +1 -1
  28. package/.next/server/chunks/8687.js +1 -1
  29. package/.next/server/chunks/948.js +2 -2
  30. package/.next/server/chunks/9563.js +2 -2
  31. package/.next/server/chunks/9630.js +4 -4
  32. package/.next/server/chunks/UIBannerText.js +1 -1
  33. package/.next/server/functions-config-manifest.json +1 -1
  34. package/.next/server/middleware-build-manifest.js +1 -1
  35. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  36. package/.next/server/pages/404.js +1 -1
  37. package/.next/server/pages/404.js.nft.json +1 -1
  38. package/.next/server/pages/500.js +1 -1
  39. package/.next/server/pages/500.js.nft.json +1 -1
  40. package/.next/server/pages/[...slug].js +1 -1
  41. package/.next/server/pages/[...slug].js.nft.json +1 -1
  42. package/.next/server/pages/[slug]/p.js +1 -1
  43. package/.next/server/pages/[slug]/p.js.nft.json +1 -1
  44. package/.next/server/pages/_app.js.nft.json +1 -1
  45. package/.next/server/pages/_document.js.nft.json +1 -1
  46. package/.next/server/pages/_error.js.nft.json +1 -1
  47. package/.next/server/pages/account/403.js +1 -1
  48. package/.next/server/pages/account/403.js.nft.json +1 -1
  49. package/.next/server/pages/account/404.js +1 -1
  50. package/.next/server/pages/account/404.js.nft.json +1 -1
  51. package/.next/server/pages/account/[...unknown].js.nft.json +1 -1
  52. package/.next/server/pages/account/orders/[id].js +1 -1
  53. package/.next/server/pages/account/orders/[id].js.nft.json +1 -1
  54. package/.next/server/pages/account/orders.js +1 -1
  55. package/.next/server/pages/account/orders.js.nft.json +1 -1
  56. package/.next/server/pages/account/profile.js +1 -1
  57. package/.next/server/pages/account/profile.js.nft.json +1 -1
  58. package/.next/server/pages/account/security.js +1 -1
  59. package/.next/server/pages/account/security.js.nft.json +1 -1
  60. package/.next/server/pages/account/user-details.js +1 -1
  61. package/.next/server/pages/account/user-details.js.nft.json +1 -1
  62. package/.next/server/pages/account.js.nft.json +1 -1
  63. package/.next/server/pages/api/graphql.js +2 -2
  64. package/.next/server/pages/api/graphql.js.nft.json +1 -1
  65. package/.next/server/pages/api/health/live.js.nft.json +1 -1
  66. package/.next/server/pages/api/health/ready.js.nft.json +1 -1
  67. package/.next/server/pages/api/preview.js.nft.json +1 -1
  68. package/.next/server/pages/checkout.js +1 -1
  69. package/.next/server/pages/checkout.js.nft.json +1 -1
  70. package/.next/server/pages/en-US/404.html +1 -1
  71. package/.next/server/pages/en-US/500.html +1 -1
  72. package/.next/server/pages/en-US/checkout.html +1 -1
  73. package/.next/server/pages/en-US/login.html +1 -1
  74. package/.next/server/pages/en-US/s.html +1 -1
  75. package/.next/server/pages/en-US.html +1 -1
  76. package/.next/server/pages/index.js +1 -1
  77. package/.next/server/pages/index.js.nft.json +1 -1
  78. package/.next/server/pages/login.js +1 -1
  79. package/.next/server/pages/login.js.nft.json +1 -1
  80. package/.next/server/pages/s.js +1 -1
  81. package/.next/server/pages/s.js.nft.json +1 -1
  82. package/.next/server/pages-manifest.json +1 -1
  83. package/.next/static/chunks/2284.6dd050e60172189a.js +1 -0
  84. package/.next/static/chunks/3155.243c7558a71f0695.js +1 -0
  85. package/.next/static/chunks/3166-6af5e854c2f2913a.js +1 -0
  86. package/.next/static/chunks/3399.93804fb74f79436c.js +1 -0
  87. package/.next/static/chunks/353.7f2181843462717d.js +1 -0
  88. package/.next/static/chunks/4803.412bf2a7e15626a6.js +1 -0
  89. package/.next/static/chunks/5781.28d03feacead66ad.js +1 -0
  90. package/.next/static/chunks/6355.57d1a07f50ee6cc9.js +1 -0
  91. package/.next/static/chunks/{6393.361c44eb0818eb7e.js → 6393.53e9ea4f29d1bf23.js} +1 -1
  92. package/.next/static/chunks/6700.f046aa86e2c83b53.js +1 -0
  93. package/.next/static/chunks/6857.b2c06171638955ea.js +1 -0
  94. package/.next/static/chunks/7191-9bdd5f0c18fbd942.js +1 -0
  95. package/.next/static/chunks/{6410.bd3fa399df59cc80.js → 7351.e90a4cc21797c136.js} +1 -1
  96. package/.next/static/chunks/7481.3c4ad3642e346232.js +1 -0
  97. package/.next/static/chunks/7498-0dc4f9a9ed199d3a.js +1 -0
  98. package/.next/static/chunks/83.ee1fdbe283ac65b6.js +1 -0
  99. package/.next/static/chunks/9173-9fc2b806c0ac0b8d.js +1 -0
  100. package/.next/static/chunks/BannerNewsletter.a9ea51c53885c80f.js +1 -0
  101. package/.next/static/chunks/{BannerText.695d4d4b6a3f7309.js → BannerText.21f106b180339df1.js} +1 -1
  102. package/.next/static/chunks/CartSidebar.55cc31a37ffa6ee6.js +1 -0
  103. package/.next/static/chunks/{Footer.5ed205d931401110.js → Footer.09dddd47ce6c816f.js} +1 -1
  104. package/.next/static/chunks/Newsletter.2c79d1813e9f9c95.js +1 -0
  105. package/.next/static/chunks/ProductShelf.299d0989eea49a79.js +1 -0
  106. package/.next/static/chunks/ProductTiles.ab99b919f3c0215f.js +1 -0
  107. package/.next/static/chunks/RegionModal.503f063f2e19b936.js +1 -0
  108. package/.next/static/chunks/RegionSlider.00de4571775d04cc.js +1 -0
  109. package/.next/static/chunks/Toast.75a18f47eb23b703.js +1 -0
  110. package/.next/static/chunks/UIBannerText.f4167ceafb96cf67.js +1 -0
  111. package/.next/static/chunks/UISKUMatrixSidebar.8b6fac58c48f999c.js +1 -0
  112. package/.next/static/chunks/UIToast.a49584c87d3adc17.js +1 -0
  113. package/.next/static/chunks/pages/{404-3582ed9196afdf1e.js → 404-dca50618ea3e6fb6.js} +1 -1
  114. package/.next/static/chunks/pages/{500-1b4eca062588da7f.js → 500-ae6697c7631fb07a.js} +1 -1
  115. package/.next/static/chunks/pages/[...slug]-debd8b208a0e3d02.js +1 -0
  116. package/.next/static/chunks/pages/[slug]/p-d782ecb21200f200.js +1 -0
  117. package/.next/static/chunks/pages/_app-728289774860e9d9.js +1 -0
  118. package/.next/static/chunks/pages/account/{403-c791997011f970b6.js → 403-a3d8b31b4e9ee8a6.js} +1 -1
  119. package/.next/static/chunks/pages/account/{404-74e64bb12e8f5a68.js → 404-22b789f04fcdce39.js} +1 -1
  120. package/.next/static/chunks/pages/account/orders/[id]-a2f44ba3963b81cd.js +1 -0
  121. package/.next/static/chunks/pages/account/orders-ec040e06c4b516d0.js +1 -0
  122. package/.next/static/chunks/pages/account/profile-29f93f4c5a55bd87.js +1 -0
  123. package/.next/static/chunks/pages/account/security-94874fc477520f74.js +1 -0
  124. package/.next/static/chunks/pages/account/{user-details-6f9fe72e02f5c5df.js → user-details-143cb45d5080d1d9.js} +1 -1
  125. package/.next/static/chunks/pages/checkout-b0637ee59b1cdca8.js +1 -0
  126. package/.next/static/chunks/pages/index-b45c9535696b5ab1.js +1 -0
  127. package/.next/static/chunks/pages/login-bae3a4cdaaed110c.js +1 -0
  128. package/.next/static/chunks/pages/s-011eedb19dcdccc6.js +1 -0
  129. package/.next/static/chunks/webpack-8b6c086380cf1398.js +1 -0
  130. package/.next/static/css/{e4b714970415f2eb.css → 2a4b7072e47636f1.css} +1 -1
  131. package/.next/static/css/{8a3f440e0ff9cd8e.css → 3d41485722b4e3f5.css} +1 -1
  132. package/.next/static/css/{2841bab51b99dd53.css → 92960607d6088082.css} +1 -1
  133. package/.next/static/css/d26cb0a54378b3d9.css +1 -0
  134. package/.next/static/css/f93cf36b16950027.css +1 -0
  135. package/.next/static/xNn8gOkRDimAnfL8TiLx0/_buildManifest.js +1 -0
  136. package/.next/trace +135 -132
  137. package/.turbo/turbo-build.log +36 -33
  138. package/.turbo/turbo-test.log +5 -5
  139. package/@generated/gql.ts +8 -0
  140. package/@generated/graphql.ts +83 -0
  141. package/@generated/persisted-documents.json +1 -0
  142. package/@generated/schema.graphql +51 -0
  143. package/CHANGELOG.md +12 -0
  144. package/cms/faststore/content-types.json +238 -1
  145. package/cms/faststore/sections.json +34 -33
  146. package/cypress/integration/plp.test.js +2 -2
  147. package/index.ts +9 -0
  148. package/package.json +5 -5
  149. package/src/components/account/MyAccountDrawer/OrganizationDrawer/OrganizationDrawer.tsx +3 -3
  150. package/src/components/cms/GlobalSections.tsx +1 -0
  151. package/src/components/cms/RenderSections.tsx +8 -4
  152. package/src/components/cms/global/Components.ts +8 -0
  153. package/src/components/navigation/Navbar/Navbar.tsx +5 -6
  154. package/src/components/navigation/NavbarLinks/NavbarLinks.tsx +23 -4
  155. package/src/components/region/RegionBar/RegionBar.tsx +48 -12
  156. package/src/components/region/RegionFilterButton/RegionFilterButton.tsx +57 -0
  157. package/src/components/region/RegionFilterButton/index.ts +1 -0
  158. package/src/components/region/RegionModal/RegionModal.tsx +26 -16
  159. package/src/components/region/RegionModal/useRegion.ts +12 -11
  160. package/src/components/region/RegionPopover/RegionPopover.tsx +37 -22
  161. package/src/components/region/RegionSlider/RegionSlider.tsx +407 -0
  162. package/src/components/region/RegionSlider/index.ts +1 -0
  163. package/src/components/region/RegionSlider/section.module.scss +72 -0
  164. package/src/components/search/Filter/FilterDeliveryMethodFacet.tsx +68 -0
  165. package/src/components/search/Filter/FilterDesktop.tsx +148 -90
  166. package/src/components/search/Filter/FilterSlider.tsx +193 -104
  167. package/src/components/search/Filter/section.module.scss +2 -0
  168. package/src/components/sections/ProductGallery/section.module.scss +2 -0
  169. package/src/components/sections/RegionBar/DefaultComponents.ts +1 -0
  170. package/src/components/sections/RegionBar/RegionBar.tsx +2 -1
  171. package/src/components/templates/LandingPage/LandingPage.tsx +6 -3
  172. package/src/components/templates/ProductListingPage/ProductListing.tsx +4 -1
  173. package/src/components/templates/ProductListingPage/ProductListingPage.tsx +3 -0
  174. package/src/components/templates/SearchPage/SearchPage.tsx +3 -0
  175. package/src/components/templates/SearchPage/SearchWrapper.tsx +15 -7
  176. package/src/components/ui/PickupPoints/PickupPointCard.tsx +39 -0
  177. package/src/components/ui/PickupPoints/PickupPointCards.tsx +102 -0
  178. package/src/components/ui/PickupPoints/index.ts +5 -0
  179. package/src/components/ui/ProductGallery/ProductGallery.tsx +6 -9
  180. package/src/experimental/index.ts +6 -0
  181. package/src/pages/404.tsx +15 -6
  182. package/src/pages/500.tsx +15 -6
  183. package/src/pages/[...slug].tsx +14 -5
  184. package/src/pages/[slug]/p.tsx +6 -3
  185. package/src/pages/_app.tsx +15 -10
  186. package/src/pages/account/403.tsx +30 -27
  187. package/src/pages/account/404.tsx +27 -20
  188. package/src/pages/account/orders/[id].tsx +22 -19
  189. package/src/pages/account/orders/index.tsx +25 -22
  190. package/src/pages/account/profile.tsx +27 -23
  191. package/src/pages/account/security.tsx +28 -23
  192. package/src/pages/account/user-details.tsx +20 -17
  193. package/src/pages/checkout.tsx +11 -8
  194. package/src/pages/index.tsx +7 -4
  195. package/src/pages/login.tsx +16 -7
  196. package/src/pages/s.tsx +5 -2
  197. package/src/sdk/deliveryPromise/index.ts +22 -0
  198. package/src/sdk/deliveryPromise/provider.tsx +119 -0
  199. package/src/sdk/deliveryPromise/queries.ts +80 -0
  200. package/src/sdk/deliveryPromise/reducer.ts +137 -0
  201. package/src/sdk/deliveryPromise/useDeliveryPromise.ts +419 -0
  202. package/src/sdk/overrides/PageProvider.tsx +9 -4
  203. package/src/sdk/product/useLocalizedVariables.ts +20 -6
  204. package/src/sdk/search/useFilter.ts +12 -1
  205. package/src/typings/overrides.ts +2 -1
  206. package/src/utils/globalSettings.ts +74 -0
  207. package/test/server/index.test.ts +1 -0
  208. package/.next/server/chunks/6272.js +0 -1
  209. package/.next/static/auvpWeN2p6A4M2zTGhXzk/_buildManifest.js +0 -1
  210. package/.next/static/chunks/2284.1b43aea18c23c79e.js +0 -1
  211. package/.next/static/chunks/3155.ea52e06317dab557.js +0 -1
  212. package/.next/static/chunks/3166-50d81179a0f5a894.js +0 -1
  213. package/.next/static/chunks/3399.13a97fefb512c902.js +0 -1
  214. package/.next/static/chunks/3465.af28497e8069330f.js +0 -1
  215. package/.next/static/chunks/353.52612dbf516cbaee.js +0 -1
  216. package/.next/static/chunks/4803.de5b14237d616808.js +0 -1
  217. package/.next/static/chunks/6355.c0b326c539dbaa90.js +0 -1
  218. package/.next/static/chunks/6700.4e9426fe8b826dab.js +0 -1
  219. package/.next/static/chunks/7191-2a7b8ddbd07128b6.js +0 -1
  220. package/.next/static/chunks/7498-5246b607527180dd.js +0 -1
  221. package/.next/static/chunks/83.b87d797323ff2034.js +0 -1
  222. package/.next/static/chunks/9173-ae6b6ebdc42876f1.js +0 -1
  223. package/.next/static/chunks/9540.69781e999f27cc05.js +0 -1
  224. package/.next/static/chunks/BannerNewsletter.7c592f132e7048e5.js +0 -1
  225. package/.next/static/chunks/CartSidebar.a00083c44c87c268.js +0 -1
  226. package/.next/static/chunks/Newsletter.1004055f09f76d3c.js +0 -1
  227. package/.next/static/chunks/ProductShelf.d51ba3e6a1b4a57d.js +0 -1
  228. package/.next/static/chunks/ProductTiles.77284431e2b8c898.js +0 -1
  229. package/.next/static/chunks/RegionModal.f61aa62e0a09182a.js +0 -1
  230. package/.next/static/chunks/Toast.6116bc845cd67f49.js +0 -1
  231. package/.next/static/chunks/UIBannerText.6cc5c00d4ba9b64e.js +0 -1
  232. package/.next/static/chunks/UISKUMatrixSidebar.782c55a97889e84a.js +0 -1
  233. package/.next/static/chunks/UIToast.494d0b0ce2c6106a.js +0 -1
  234. package/.next/static/chunks/pages/[...slug]-d0f23d907ec6fbe3.js +0 -1
  235. package/.next/static/chunks/pages/[slug]/p-a255e4a7352455df.js +0 -1
  236. package/.next/static/chunks/pages/_app-1885a948b243078c.js +0 -1
  237. package/.next/static/chunks/pages/account/orders/[id]-b9feb0c860ff1cec.js +0 -1
  238. package/.next/static/chunks/pages/account/orders-1d8409a8b4b0e581.js +0 -1
  239. package/.next/static/chunks/pages/account/profile-5a919fa02b76a422.js +0 -1
  240. package/.next/static/chunks/pages/account/security-b5ab3d1ecbbea9d9.js +0 -1
  241. package/.next/static/chunks/pages/checkout-3a4983b22625c4e3.js +0 -1
  242. package/.next/static/chunks/pages/index-6e68be53d1fef20e.js +0 -1
  243. package/.next/static/chunks/pages/login-de3dd10c6b35159a.js +0 -1
  244. package/.next/static/chunks/pages/s-9b0f606f120d66b0.js +0 -1
  245. package/.next/static/chunks/webpack-f661e0efeacf6028.js +0 -1
  246. package/.next/static/css/202a74b80e6ce63f.css +0 -1
  247. /package/.next/static/{auvpWeN2p6A4M2zTGhXzk → xNn8gOkRDimAnfL8TiLx0}/_ssgManifest.js +0 -0
@@ -1,6 +1,7 @@
1
1
  import { NextSeo, SiteLinksSearchBoxJsonLd } from 'next-seo'
2
2
  import type { ComponentType } from 'react'
3
3
 
4
+ import { default as GLOBAL_COMPONENTS } from 'src/components/cms/global/Components'
4
5
  import RenderSections from 'src/components/cms/RenderSections'
5
6
  import BannerNewsletter from 'src/components/sections/BannerNewsletter/BannerNewsletter'
6
7
  import { OverriddenDefaultBannerText as BannerText } from 'src/components/sections/BannerText/OverriddenDefaultBannerText'
@@ -10,16 +11,15 @@ import Incentives from 'src/components/sections/Incentives'
10
11
  import { OverriddenDefaultNewsletter as Newsletter } from 'src/components/sections/Newsletter/OverriddenDefaultNewsletter'
11
12
  import { OverriddenDefaultProductShelf as ProductShelf } from 'src/components/sections/ProductShelf/OverriddenDefaultProductShelf'
12
13
  import ProductTiles from 'src/components/sections/ProductTiles'
13
- import PLUGINS_COMPONENTS from 'src/plugins'
14
14
  import CUSTOM_COMPONENTS from 'src/customizations/src/components'
15
- import { default as GLOBAL_COMPONENTS } from 'src/components/cms/global/Components'
15
+ import PLUGINS_COMPONENTS from 'src/plugins'
16
16
  import MissingContentError from 'src/sdk/error/MissingContentError/MissingContentError'
17
17
  import PageProvider from 'src/sdk/overrides/PageProvider'
18
18
  import type { PageContentType } from 'src/server/cms'
19
19
 
20
20
  import storeConfig from 'discovery.config'
21
- import type { PreviewData } from 'src/server/content/types'
22
21
  import { contentService } from 'src/server/content/service'
22
+ import type { PreviewData } from 'src/server/content/types'
23
23
 
24
24
  /* A list of components that can be used in the CMS. */
25
25
  const COMPONENTS: Record<string, ComponentType<any>> = {
@@ -41,6 +41,7 @@ export type LandingPageProps = {
41
41
  slug?: string
42
42
  serverData?: unknown
43
43
  globalSections?: Array<{ name: string; data: any }>
44
+ globalSettings?: Record<string, unknown>
44
45
  }
45
46
 
46
47
  export default function LandingPage({
@@ -48,9 +49,11 @@ export default function LandingPage({
48
49
  slug,
49
50
  serverData,
50
51
  globalSections,
52
+ globalSettings,
51
53
  }: LandingPageProps) {
52
54
  const context = {
53
55
  data: serverData,
56
+ globalSettings,
54
57
  }
55
58
 
56
59
  return (
@@ -15,6 +15,7 @@ import RenderSections, {
15
15
  } from 'src/components/cms/RenderSections'
16
16
  import type { PLPContentType } from 'src/server/cms/plp'
17
17
 
18
+ import { useRouter } from 'next/router'
18
19
  import { useEffect } from 'react'
19
20
  import PageProvider, { type PLPContext } from 'src/sdk/overrides/PageProvider'
20
21
  import {
@@ -23,7 +24,6 @@ import {
23
24
  } from 'src/sdk/product/usePageProductsQuery'
24
25
  import { useProductGalleryQuery } from 'src/sdk/product/useProductGalleryQuery'
25
26
  import { useApplySearchState } from 'src/sdk/search/state'
26
- import { useRouter } from 'next/router'
27
27
  import { isContentPlatformSource } from 'src/server/content/utils'
28
28
 
29
29
  const ScrollToTopButton = dynamic(
@@ -39,6 +39,7 @@ export type ProductListingPageProps = {
39
39
  serverManyProductsVariables: ServerManyProductsQueryQueryVariables
40
40
  page: PLPContentType
41
41
  globalSections?: Array<{ name: string; data: any }>
42
+ globalSettings?: Record<string, unknown>
42
43
  }
43
44
 
44
45
  // Array merging strategy from deepmerge that makes client arrays overwrite server array
@@ -50,6 +51,7 @@ export default function ProductListing({
50
51
  data: server,
51
52
  serverManyProductsVariables,
52
53
  globalSections,
54
+ globalSettings,
53
55
  }: ProductListingPageProps) {
54
56
  const router = useRouter()
55
57
  const { state, serializedState } = useSearch()
@@ -86,6 +88,7 @@ export default function ProductListing({
86
88
  ),
87
89
  pages,
88
90
  },
91
+ globalSettings,
89
92
  } as PLPContext
90
93
 
91
94
  return (
@@ -26,6 +26,7 @@ export type ProductListingPageProps = {
26
26
  serverManyProductsVariables: ServerManyProductsQueryQueryVariables
27
27
  page: PLPContentType
28
28
  globalSections?: Array<{ name: string; data: any }>
29
+ globalSettings?: Record<string, unknown>
29
30
  }
30
31
 
31
32
  type UseSearchParams = {
@@ -76,6 +77,7 @@ export default function ProductListingPage({
76
77
  data: server,
77
78
  serverManyProductsVariables,
78
79
  globalSections,
80
+ globalSettings,
79
81
  }: ProductListingPageProps) {
80
82
  const { settings } = plpContentType
81
83
  const collection = server.collection
@@ -134,6 +136,7 @@ export default function ProductListingPage({
134
136
 
135
137
  <ProductListing
136
138
  globalSections={globalSections}
139
+ globalSettings={globalSettings}
137
140
  page={plpContentType}
138
141
  data={server}
139
142
  serverManyProductsVariables={serverManyProductsVariables}
@@ -15,12 +15,14 @@ export type SearchPageProps = {
15
15
  data: SearchPageContextType & ClientProductGalleryQuery
16
16
  page: SearchContentType
17
17
  globalSections?: Array<{ name: string; data: any }>
18
+ globalSettings?: Record<string, unknown>
18
19
  }
19
20
 
20
21
  function SearchPage({
21
22
  page: { sections },
22
23
  data: serverData,
23
24
  globalSections,
25
+ globalSettings,
24
26
  }: SearchPageProps) {
25
27
  const { pages, useGalleryPage } = useCreateUseGalleryPage()
26
28
 
@@ -29,6 +31,7 @@ function SearchPage({
29
31
  ...serverData,
30
32
  pages,
31
33
  },
34
+ globalSettings,
32
35
  } as SearchPageContext
33
36
 
34
37
  return (
@@ -1,12 +1,13 @@
1
1
  import { useSearch } from '@faststore/sdk'
2
2
  import { useRouter } from 'next/router'
3
3
 
4
+ import storeConfig from 'discovery.config'
4
5
  import type { SearchPageContextType } from 'src/pages/s'
5
6
  import { useProductGalleryQuery } from 'src/sdk/product/useProductGalleryQuery'
6
7
  import type { SearchContentType } from 'src/server/cms'
7
- import storeConfig from 'discovery.config'
8
8
 
9
9
  import RenderSections from 'src/components/cms/RenderSections'
10
+ import PageProvider from 'src/sdk/overrides/PageProvider'
10
11
  import EmptySearch from './EmptySearch'
11
12
  import SearchPage from './SearchPage'
12
13
 
@@ -15,6 +16,7 @@ export type SearchWrapperProps = {
15
16
  searchContentType: SearchContentType
16
17
  serverData: SearchPageContextType
17
18
  globalSections?: Array<{ name: string; data: any }>
19
+ globalSettings?: Record<string, unknown>
18
20
  }
19
21
 
20
22
  export default function SearchWrapper({
@@ -22,6 +24,7 @@ export default function SearchWrapper({
22
24
  searchContentType,
23
25
  serverData,
24
26
  globalSections,
27
+ globalSettings,
25
28
  }: SearchWrapperProps) {
26
29
  const router = useRouter()
27
30
  const {
@@ -46,9 +49,11 @@ export default function SearchWrapper({
46
49
 
47
50
  if (!pageProductGalleryData) {
48
51
  return (
49
- <RenderSections globalSections={globalSections}>
50
- <EmptySearch {...emptySearchProps} />
51
- </RenderSections>
52
+ <PageProvider context={{ globalSettings }}>
53
+ <RenderSections globalSections={globalSections}>
54
+ <EmptySearch {...emptySearchProps} />
55
+ </RenderSections>
56
+ </PageProvider>
52
57
  )
53
58
  }
54
59
 
@@ -59,9 +64,11 @@ export default function SearchWrapper({
59
64
  })
60
65
 
61
66
  return (
62
- <RenderSections globalSections={globalSections}>
63
- <EmptySearch {...emptySearchProps} />
64
- </RenderSections>
67
+ <PageProvider context={{ globalSettings }}>
68
+ <RenderSections globalSections={globalSections}>
69
+ <EmptySearch {...emptySearchProps} />
70
+ </RenderSections>
71
+ </PageProvider>
65
72
  )
66
73
  }
67
74
 
@@ -81,6 +88,7 @@ export default function SearchWrapper({
81
88
  page={searchContentType}
82
89
  data={{ ...serverData, ...pageProductGalleryData }}
83
90
  globalSections={globalSections}
91
+ globalSettings={globalSettings}
84
92
  />
85
93
  )
86
94
  }
@@ -0,0 +1,39 @@
1
+ import { Icon as UIIcon } from '@faststore/ui'
2
+ import type { PickupPoint } from 'src/sdk/deliveryPromise'
3
+
4
+ export type PickupPointCardProps = {
5
+ store: PickupPoint
6
+ }
7
+
8
+ function formatDistance(distance: number) {
9
+ return `${distance.toFixed(1).replace('.', ',')}km`
10
+ }
11
+
12
+ function PickupPointCard({ store }: PickupPointCardProps) {
13
+ return (
14
+ <div data-fs-pickup-point-card>
15
+ <header data-fs-pickup-point-card-header>
16
+ <UIIcon name="Storefront" />
17
+ <h3 data-fs-pickup-point-card-header-title>{store?.name}</h3>
18
+ <span data-fs-pickup-point-card-header-postal-code>
19
+ {store?.address?.postalCode}
20
+ </span>
21
+ </header>
22
+ <div data-fs-pickup-point-card-header-content>
23
+ <p data-fs-pickup-point-card-address>
24
+ <span>
25
+ {store?.address?.street}, {store?.address?.number}
26
+ </span>
27
+ <span>
28
+ {store?.address?.city} - {store?.address?.state}
29
+ </span>
30
+ </p>
31
+ <span data-fs-pickup-point-card-distance>
32
+ {store?.distance !== undefined ? formatDistance(store.distance) : ''}
33
+ </span>
34
+ </div>
35
+ </div>
36
+ )
37
+ }
38
+
39
+ export default PickupPointCard
@@ -0,0 +1,102 @@
1
+ import {
2
+ EmptyState as UIEmptyState,
3
+ Icon as UIIcon,
4
+ List as UIList,
5
+ RadioGroup as UIRadioGroup,
6
+ RadioOption as UIRadioOption,
7
+ } from '@faststore/ui'
8
+ import type { ChangeEventHandler, MouseEventHandler } from 'react'
9
+ import type { PickupPoint } from 'src/sdk/deliveryPromise'
10
+ import { PickupPointCard } from '.'
11
+
12
+ export interface PickupPointCardsProps {
13
+ /**
14
+ * Selected option value.
15
+ */
16
+ selectedOption?: string
17
+ /**
18
+ * Function that is triggered when any option is selected.
19
+ */
20
+ onChange?: MouseEventHandler<HTMLInputElement> &
21
+ ChangeEventHandler<HTMLInputElement>
22
+ /**
23
+ * Message to be displayed when no pickup points are available.
24
+ */
25
+ noPickupPointsAvailableMessage?: string
26
+ /**
27
+ * Message to be displayed when there is an error when setting the location.
28
+ */
29
+ errorMessage?: {
30
+ title?: string
31
+ description?: string
32
+ }
33
+ /**
34
+ * Aria label for the radio group.
35
+ */
36
+ choosePickupPointAriaLabel?: string
37
+ /**
38
+ * List of pickup points to be displayed.
39
+ */
40
+ pickupPoints: PickupPoint[]
41
+ }
42
+
43
+ function PickupPointCards({
44
+ pickupPoints,
45
+ selectedOption,
46
+ onChange,
47
+ noPickupPointsAvailableMessage,
48
+ errorMessage: {
49
+ title: regionErrorMessage,
50
+ description: regionErrorHelperMessage,
51
+ },
52
+ choosePickupPointAriaLabel = 'Select a store',
53
+ }: PickupPointCardsProps) {
54
+ if (regionErrorMessage) {
55
+ return (
56
+ <UIEmptyState
57
+ title={regionErrorMessage ?? ''}
58
+ titleIcon={
59
+ <UIIcon name="MapPin" width={56} height={56} weight="thin" />
60
+ }
61
+ bkgColor="light"
62
+ >
63
+ <p>{regionErrorHelperMessage}</p>
64
+ </UIEmptyState>
65
+ )
66
+ }
67
+
68
+ if (noPickupPointsAvailableMessage) {
69
+ return (
70
+ <UIEmptyState
71
+ title={
72
+ noPickupPointsAvailableMessage ?? 'No available stores near location.'
73
+ }
74
+ titleIcon={
75
+ <UIIcon name="Storefront" width={56} height={56} weight="thin" />
76
+ }
77
+ bkgColor="light"
78
+ />
79
+ )
80
+ }
81
+
82
+ return (
83
+ <UIList as="ol" data-fs-pickup-point-cards>
84
+ <UIRadioGroup
85
+ name="stores-radio-group"
86
+ selectedValue={selectedOption}
87
+ onChange={onChange}
88
+ aria-label={choosePickupPointAriaLabel}
89
+ >
90
+ {pickupPoints?.map((item) => (
91
+ <li data-fs-pickup-point-cards-item key={item.id}>
92
+ <UIRadioOption value={item.id} label={item.name} onClick={onChange}>
93
+ <PickupPointCard store={item} />
94
+ </UIRadioOption>
95
+ </li>
96
+ ))}
97
+ </UIRadioGroup>
98
+ </UIList>
99
+ )
100
+ }
101
+
102
+ export default PickupPointCards
@@ -0,0 +1,5 @@
1
+ export { default as PickupPointCards } from './PickupPointCards'
2
+ export type { PickupPointCardsProps } from './PickupPointCards'
3
+
4
+ export { default as PickupPointCard } from './PickupPointCard'
5
+ export type { PickupPointCardProps } from './PickupPointCard'
@@ -1,22 +1,20 @@
1
- import { useSearch } from '@faststore/sdk'
2
1
  import { NextSeo } from 'next-seo'
3
- import type { MouseEvent } from 'react'
4
- import { Suspense, lazy } from 'react'
2
+ import dynamic from 'next/dynamic'
3
+ import { Suspense, lazy, type MouseEvent } from 'react'
5
4
 
5
+ import { useSearch } from '@faststore/sdk'
6
6
  import { useUI } from '@faststore/ui'
7
- import Sort from 'src/components/search/Sort'
8
- import ProductGridSkeleton from 'src/components/skeletons/ProductGridSkeleton'
9
-
10
- import dynamic from 'next/dynamic'
11
7
 
12
8
  import type { ProductCardProps } from 'src/components/product/ProductCard'
13
9
  import type { FilterSliderProps } from 'src/components/search/Filter/FilterSlider'
10
+ import Sort from 'src/components/search/Sort'
14
11
  import type { SortProps } from 'src/components/search/Sort/Sort'
12
+ import ProductGridSkeleton from 'src/components/skeletons/ProductGridSkeleton'
15
13
  import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
16
14
  import {
15
+ usePage,
17
16
  type PLPContext,
18
17
  type SearchPageContext,
19
- usePage,
20
18
  } from 'src/sdk/overrides/PageProvider'
21
19
  import { useProductsPrefetch } from 'src/sdk/product/useProductsPrefetch'
22
20
  import { useDelayedFacets } from 'src/sdk/search/useDelayedFacets'
@@ -104,7 +102,6 @@ function ProductGallery({
104
102
  const data = context?.data
105
103
  const facets = useDelayedFacets(data) ?? []
106
104
  const { next, prev } = useDelayedPagination(totalCount)
107
-
108
105
  const { isDesktop } = useScreenResize()
109
106
 
110
107
  useProductsPrefetch(prev ? prev.cursor : null)
@@ -45,3 +45,9 @@ export { ProfileChallenge as ProfileChallenge_unstable } from '../../src/compone
45
45
  export { ButtonSignIn as ButtonSignIn_unstable } from '../../src/components/ui/Button'
46
46
  export { Image as Image_unstable } from '../../src/components/ui/Image'
47
47
  export { default as Selectors_unstable } from '../../src/components/ui/SkuSelector'
48
+
49
+ // Delivery Promise
50
+ export {
51
+ useDeliveryPromise as useDeliveryPromise_unstable,
52
+ deliveryPromiseStore as deliveryPromiseStore_unstable,
53
+ } from 'src/sdk/deliveryPromise'
package/src/pages/404.tsx CHANGED
@@ -11,6 +11,7 @@ import RenderSections from 'src/components/cms/RenderSections'
11
11
  import { OverriddenDefaultEmptyState as EmptyState } from 'src/components/sections/EmptyState/OverriddenDefaultEmptyState'
12
12
  import CUSTOM_COMPONENTS from 'src/customizations/src/components'
13
13
  import PLUGINS_COMPONENTS from 'src/plugins'
14
+ import PageProvider from 'src/sdk/overrides/PageProvider'
14
15
  import type { PageContentType } from 'src/server/cms'
15
16
  import { injectGlobalSections } from 'src/server/cms/global'
16
17
  import { contentService } from 'src/server/content/service'
@@ -29,7 +30,13 @@ type Props = {
29
30
  globalSections: GlobalSectionsData
30
31
  }
31
32
 
32
- function Page({ page: { sections }, globalSections }: Props) {
33
+ function Page({
34
+ page: { sections },
35
+ globalSections: globalSectionsProp,
36
+ }: Props) {
37
+ const { sections: globalSections, settings: globalSettings } =
38
+ globalSectionsProp ?? {}
39
+
33
40
  return (
34
41
  <>
35
42
  <NextSeo noindex nofollow />
@@ -44,11 +51,13 @@ function Page({ page: { sections }, globalSections }: Props) {
44
51
  If needed, wrap your component in a <Section /> component
45
52
  (not the HTML tag) before rendering it here.
46
53
  */}
47
- <RenderSections
48
- sections={sections}
49
- globalSections={globalSections.sections}
50
- components={COMPONENTS}
51
- />
54
+ <PageProvider context={{ globalSettings }}>
55
+ <RenderSections
56
+ sections={sections}
57
+ globalSections={globalSections}
58
+ components={COMPONENTS}
59
+ />
60
+ </PageProvider>
52
61
  </>
53
62
  )
54
63
  }
package/src/pages/500.tsx CHANGED
@@ -11,6 +11,7 @@ import RenderSections from 'src/components/cms/RenderSections'
11
11
  import { OverriddenDefaultEmptyState as EmptyState } from 'src/components/sections/EmptyState/OverriddenDefaultEmptyState'
12
12
  import CUSTOM_COMPONENTS from 'src/customizations/src/components'
13
13
  import PLUGINS_COMPONENTS from 'src/plugins'
14
+ import PageProvider from 'src/sdk/overrides/PageProvider'
14
15
  import type { PageContentType } from 'src/server/cms'
15
16
  import { injectGlobalSections } from 'src/server/cms/global'
16
17
  import { contentService } from 'src/server/content/service'
@@ -29,7 +30,13 @@ type Props = {
29
30
  globalSections: GlobalSectionsData
30
31
  }
31
32
 
32
- function Page({ page: { sections }, globalSections }: Props) {
33
+ function Page({
34
+ page: { sections },
35
+ globalSections: globalSectionsProp,
36
+ }: Props) {
37
+ const { sections: globalSections, settings: globalSettings } =
38
+ globalSectionsProp ?? {}
39
+
33
40
  return (
34
41
  <>
35
42
  <NextSeo noindex nofollow />
@@ -45,11 +52,13 @@ function Page({ page: { sections }, globalSections }: Props) {
45
52
  If needed, wrap your component in a <Section /> component
46
53
  (not the HTML tag) before rendering it here.
47
54
  */}
48
- <RenderSections
49
- sections={sections}
50
- globalSections={globalSections.sections}
51
- components={COMPONENTS}
52
- />
55
+ <PageProvider context={{ globalSettings }}>
56
+ <RenderSections
57
+ sections={sections}
58
+ globalSections={globalSections}
59
+ components={COMPONENTS}
60
+ />
61
+ </PageProvider>
53
62
  </>
54
63
  )
55
64
  }
@@ -28,10 +28,10 @@ import { getRedirect } from 'src/sdk/redirects'
28
28
  import type { PageContentType } from 'src/server/cms'
29
29
  import { injectGlobalSections } from 'src/server/cms/global'
30
30
  import type { PLPContentType } from 'src/server/cms/plp'
31
- import { getDynamicContent } from 'src/utils/dynamicContent'
32
- import { fetchServerManyProducts } from 'src/utils/fetchProductGallerySSR'
33
31
  import { contentService } from 'src/server/content/service'
34
32
  import type { PreviewData } from 'src/server/content/types'
33
+ import { getDynamicContent } from 'src/utils/dynamicContent'
34
+ import { fetchServerManyProducts } from 'src/utils/fetchProductGallerySSR'
35
35
 
36
36
  const LandingPage = dynamic(
37
37
  () => import('src/components/templates/LandingPage')
@@ -57,18 +57,27 @@ type Props = BaseProps &
57
57
  }
58
58
  )
59
59
 
60
- function Page({ globalSections, type, ...otherProps }: Props) {
60
+ function Page({
61
+ globalSections: globalSectionsProp,
62
+ type,
63
+ ...otherProps
64
+ }: Props) {
65
+ const { sections: globalSections, settings: globalSettings } =
66
+ globalSectionsProp ?? {}
67
+
61
68
  return (
62
69
  <>
63
70
  {type === 'plp' && (
64
71
  <ProductListingPage
65
- globalSections={globalSections.sections}
72
+ globalSections={globalSections}
73
+ globalSettings={globalSettings}
66
74
  {...(otherProps as ProductListingPageProps)}
67
75
  />
68
76
  )}
69
77
  {type === 'page' && (
70
78
  <LandingPage
71
- globalSections={globalSections.sections}
79
+ globalSections={globalSections}
80
+ globalSettings={globalSettings}
72
81
  {...(otherProps as LandingPageProps)}
73
82
  />
74
83
  )}
@@ -23,8 +23,8 @@ import { OverriddenDefaultProductShelf as ProductShelf } from 'src/components/se
23
23
  import ProductTiles from 'src/components/sections/ProductTiles'
24
24
  import CUSTOM_COMPONENTS from 'src/customizations/src/components'
25
25
  import PLUGINS_COMPONENTS from 'src/plugins'
26
- import { useSession } from 'src/sdk/session'
27
26
  import { getRedirect } from 'src/sdk/redirects'
27
+ import { useSession } from 'src/sdk/session'
28
28
  import { execute } from 'src/server'
29
29
 
30
30
  import storeConfig from 'discovery.config'
@@ -87,7 +87,7 @@ function Page({
87
87
  data: server,
88
88
  sections,
89
89
  settings,
90
- globalSections,
90
+ globalSections: globalSectionsProp,
91
91
  offers,
92
92
  meta,
93
93
  }: Props) {
@@ -135,11 +135,14 @@ function Page({
135
135
  }
136
136
  })()
137
137
 
138
+ const { sections: globalSections, settings: globalSettings } =
139
+ globalSectionsProp ?? {}
138
140
  const context = {
139
141
  data: {
140
142
  ...deepmerge(server, client, { arrayMerge: overwriteMerge }),
141
143
  isValidating,
142
144
  },
145
+ globalSettings,
143
146
  } as PDPContext
144
147
 
145
148
  return (
@@ -215,7 +218,7 @@ function Page({
215
218
  <PageProvider context={context}>
216
219
  <RenderSections
217
220
  sections={sections}
218
- globalSections={globalSections.sections}
221
+ globalSections={globalSections}
219
222
  components={COMPONENTS}
220
223
  />
221
224
  </PageProvider>
@@ -1,23 +1,26 @@
1
- import { UIProvider } from '@faststore/ui'
1
+ import { DefaultSeo } from 'next-seo'
2
2
  import type { AppProps } from 'next/app'
3
+ import Head from 'next/head'
4
+ import { useRouter } from 'next/router'
5
+
6
+ import { useSearch } from '@faststore/sdk'
7
+ import { UIProvider } from '@faststore/ui'
8
+
3
9
  import ThirdPartyScripts from 'src/components/ThirdPartyScripts'
4
10
  import Layout from 'src/Layout'
5
11
  import AnalyticsHandler from 'src/sdk/analytics'
12
+ import { DeliveryPromiseProvider } from 'src/sdk/deliveryPromise'
6
13
  import ErrorBoundary from 'src/sdk/error/ErrorBoundary'
7
14
  import useGeolocation from 'src/sdk/geolocation/useGeolocation'
8
- import SEO from '../../next-seo.config'
15
+
16
+ import SEO from 'next-seo.config'
9
17
 
10
18
  // FastStore UI's base styles
11
19
  import '../styles/main.scss'
12
20
 
13
- import { useSearch } from '@faststore/sdk'
14
- import { DefaultSeo } from 'next-seo'
15
- import Head from 'next/head'
16
- import { useRouter } from 'next/router'
17
21
  import { ITEMS_PER_PAGE } from 'src/constants'
18
22
 
19
23
  function App({ Component, pageProps }: AppProps) {
20
- const { key } = pageProps
21
24
  useGeolocation()
22
25
  const router = useRouter()
23
26
  const { start: startGlobalSearchState } = useSearch()
@@ -33,9 +36,11 @@ function App({ Component, pageProps }: AppProps) {
33
36
  <AnalyticsHandler />
34
37
 
35
38
  <UIProvider>
36
- <Layout>
37
- <Component {...pageProps} key={key} />
38
- </Layout>
39
+ <DeliveryPromiseProvider>
40
+ <Layout>
41
+ <Component {...pageProps} key={pageProps?.key} />
42
+ </Layout>
43
+ </DeliveryPromiseProvider>
39
44
  </UIProvider>
40
45
  </ErrorBoundary>
41
46
  )