@faststore/core 2.2.70 → 2.2.71

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 (139) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +62 -52
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/config.json +3 -3
  5. package/.next/cache/eslint/.cache_1gneedd +1 -1
  6. package/.next/cache/next-server.js.nft.json +1 -1
  7. package/.next/cache/webpack/client-production/0.pack +0 -0
  8. package/.next/cache/webpack/client-production/index.pack +0 -0
  9. package/.next/cache/webpack/server-production/0.pack +0 -0
  10. package/.next/cache/webpack/server-production/index.pack +0 -0
  11. package/.next/next-server.js.nft.json +1 -1
  12. package/.next/prerender-manifest.json +1 -1
  13. package/.next/react-loadable-manifest.json +4 -4
  14. package/.next/routes-manifest.json +1 -1
  15. package/.next/server/chunks/117.js +427 -0
  16. package/.next/server/chunks/184.js +61 -0
  17. package/.next/server/chunks/350.js +2846 -35
  18. package/.next/server/chunks/585.js +22 -0
  19. package/.next/server/chunks/632.js +514 -0
  20. package/.next/server/chunks/661.js +1451 -0
  21. package/.next/server/chunks/693.js +58 -0
  22. package/.next/server/chunks/719.js +84 -0
  23. package/.next/server/chunks/74.js +569 -6467
  24. package/.next/server/chunks/779.js +58 -0
  25. package/.next/server/chunks/854.js +72 -0
  26. package/.next/server/chunks/863.js +22 -0
  27. package/.next/server/chunks/{520.js → 898.js} +250 -30
  28. package/.next/server/chunks/903.js +1926 -0
  29. package/.next/server/middleware-build-manifest.js +1 -1
  30. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  31. package/.next/server/pages/404.js +0 -21
  32. package/.next/server/pages/404.js.nft.json +1 -1
  33. package/.next/server/pages/500.js +0 -21
  34. package/.next/server/pages/500.js.nft.json +1 -1
  35. package/.next/server/pages/[...slug].js +9 -9
  36. package/.next/server/pages/[...slug].js.nft.json +1 -1
  37. package/.next/server/pages/[slug]/p.js +1373 -33
  38. package/.next/server/pages/[slug]/p.js.nft.json +1 -1
  39. package/.next/server/pages/_app.js.nft.json +1 -1
  40. package/.next/server/pages/_error.js.nft.json +1 -1
  41. package/.next/server/pages/account.js +0 -21
  42. package/.next/server/pages/account.js.nft.json +1 -1
  43. package/.next/server/pages/api/graphql.js.nft.json +1 -1
  44. package/.next/server/pages/checkout.js +0 -21
  45. package/.next/server/pages/checkout.js.nft.json +1 -1
  46. package/.next/server/pages/en-US/404.html +2 -2
  47. package/.next/server/pages/en-US/500.html +2 -2
  48. package/.next/server/pages/en-US/account.html +2 -2
  49. package/.next/server/pages/en-US/checkout.html +2 -2
  50. package/.next/server/pages/en-US/login.html +2 -2
  51. package/.next/server/pages/en-US/s.html +2 -2
  52. package/.next/server/pages/en-US.html +2 -2
  53. package/.next/server/pages/index.js +5 -5
  54. package/.next/server/pages/index.js.nft.json +1 -1
  55. package/.next/server/pages/login.js +0 -21
  56. package/.next/server/pages/login.js.nft.json +1 -1
  57. package/.next/server/pages/s.js +4 -58
  58. package/.next/server/pages/s.js.nft.json +1 -1
  59. package/.next/static/IDskqcKTB7kE5quFZAhgJ/_buildManifest.js +1 -0
  60. package/.next/static/chunks/223-cb77217cce52d45c.js +1 -0
  61. package/.next/static/chunks/251.11f5198fc8bef3a4.js +1 -0
  62. package/.next/static/chunks/397-0d3aada1012cd78b.js +1 -0
  63. package/.next/static/chunks/585.6561778b7763b79e.js +1 -0
  64. package/.next/static/chunks/675-479a97aecebead97.js +1 -0
  65. package/.next/static/chunks/800.5d92de2974baf641.js +1 -0
  66. package/.next/static/chunks/881-57643fb90f59e576.js +1 -0
  67. package/.next/static/chunks/988.afda042dd9ba11d1.js +1 -0
  68. package/.next/static/chunks/pages/404-e106cb9a78182f5f.js +1 -0
  69. package/.next/static/chunks/pages/500-d28aa4a8ce88bddd.js +1 -0
  70. package/.next/static/chunks/pages/[...slug]-cf872b9e9befd47c.js +1 -0
  71. package/.next/static/chunks/pages/[slug]/p-4a75b11857b82b5c.js +1 -0
  72. package/.next/static/chunks/pages/{account-3741291b1e89c2e7.js → account-bf9c88a9cac80d8a.js} +1 -1
  73. package/.next/static/chunks/pages/{checkout-95066de007bdbbdb.js → checkout-6ca76c1e88a28ac4.js} +1 -1
  74. package/.next/static/chunks/pages/index-629ba146ae5f0ecf.js +1 -0
  75. package/.next/static/chunks/pages/login-d2af0de13ea75848.js +1 -0
  76. package/.next/static/chunks/pages/s-d729254b91430d1c.js +1 -0
  77. package/.next/static/chunks/webpack-54ce04ec11860b0b.js +1 -0
  78. package/.next/static/css/021de9c7b050d301.css +1 -0
  79. package/.next/static/css/510895065f32ed2f.css +1 -0
  80. package/.next/static/css/7e897ebb936fac09.css +1 -0
  81. package/.next/static/css/938781cdc945862e.css +1 -0
  82. package/.next/static/css/9558da13053ac066.css +1 -0
  83. package/.next/static/css/def381bf7c69fa2e.css +1 -0
  84. package/.next/trace +82 -82
  85. package/.turbo/turbo-build.log +19 -19
  86. package/.turbo/turbo-test.log +11 -11
  87. package/index.ts +13 -0
  88. package/package.json +2 -2
  89. package/src/components/sections/Alert/Alert.tsx +11 -3
  90. package/src/components/sections/Alert/OverriddenDefaultAlert.ts +7 -4
  91. package/src/components/sections/BannerText/BannerText.tsx +10 -2
  92. package/src/components/sections/BannerText/OverriddenDefaultBannerText.ts +7 -4
  93. package/src/components/sections/Breadcrumb/Breadcrumb.tsx +9 -3
  94. package/src/components/sections/Breadcrumb/OverriddenDefaultBreadcrumb.ts +7 -4
  95. package/src/components/sections/CrossSellingShelf/CrossSellingShelf.tsx +8 -2
  96. package/src/components/sections/CrossSellingShelf/OverriddenDefaultCrossSellingShelf.ts +2 -1
  97. package/src/components/sections/EmptyState/Overrides.tsx +2 -2
  98. package/src/components/sections/Hero/Hero.tsx +11 -3
  99. package/src/components/sections/Hero/OverriddenDefaultHero.ts +7 -4
  100. package/src/components/sections/Navbar/Navbar.tsx +10 -2
  101. package/src/components/sections/Navbar/OverriddenDefaultNavbar.ts +6 -4
  102. package/src/components/sections/Newsletter/Newsletter.tsx +10 -2
  103. package/src/components/sections/Newsletter/OverriddenDefaultNewsletter.ts +6 -4
  104. package/src/components/sections/ProductDetails/OverriddenDefaultProductDetails.ts +7 -4
  105. package/src/components/sections/ProductDetails/ProductDetails.tsx +16 -8
  106. package/src/components/sections/ProductGallery/OverriddenDefaultProductGallery.ts +6 -4
  107. package/src/components/sections/ProductGallery/ProductGallery.tsx +13 -5
  108. package/src/components/sections/ProductShelf/OverriddenDefaultProductShelf.ts +7 -4
  109. package/src/components/sections/ProductShelf/ProductShelf.tsx +12 -2
  110. package/src/components/sections/RegionBar/OverriddenDefaultRegionBar.ts +6 -4
  111. package/src/components/sections/RegionBar/RegionBar.tsx +11 -5
  112. package/src/sdk/overrides/getOverriddenSection.tsx +45 -44
  113. package/src/sdk/overrides/overrides.ts +2 -2
  114. package/src/typings/overrides.ts +265 -187
  115. package/src/typings/overridesDefinition.ts +20 -6
  116. package/.next/server/chunks/445.js +0 -167
  117. package/.next/server/chunks/829.js +0 -2938
  118. package/.next/server/chunks/934.js +0 -125
  119. package/.next/static/9t0jxL0Q7hZ_ItlxJLOtn/_buildManifest.js +0 -1
  120. package/.next/static/chunks/251.65e0bb7a2f58b3db.js +0 -1
  121. package/.next/static/chunks/464-bc1301cb64b71518.js +0 -1
  122. package/.next/static/chunks/557-4f8a963d7e07e582.js +0 -1
  123. package/.next/static/chunks/585.ee7478bead8853ae.js +0 -1
  124. package/.next/static/chunks/800.8f4f91b39aa47346.js +0 -1
  125. package/.next/static/chunks/988.a57dac6501fb5184.js +0 -1
  126. package/.next/static/chunks/pages/404-8aa1a5d5e6a66a9a.js +0 -1
  127. package/.next/static/chunks/pages/500-36ea8ba52ee65fe2.js +0 -1
  128. package/.next/static/chunks/pages/[...slug]-29c2c581a7246de4.js +0 -1
  129. package/.next/static/chunks/pages/[slug]/p-d4a3fd33abda8f62.js +0 -1
  130. package/.next/static/chunks/pages/index-bbd90798e45dc0ff.js +0 -1
  131. package/.next/static/chunks/pages/login-f0d8dfab2f856c25.js +0 -1
  132. package/.next/static/chunks/pages/s-e9b663c3e4f84b0a.js +0 -1
  133. package/.next/static/chunks/webpack-776cfd646b505dc5.js +0 -1
  134. package/.next/static/css/0c844be3b8585e70.css +0 -1
  135. package/.next/static/css/557d58510041152c.css +0 -1
  136. package/.next/static/css/a6bcc59f42b42f36.css +0 -1
  137. package/.next/static/css/ecdecb8d639a8311.css +0 -1
  138. package/src/sdk/overrides/sections.tsx +0 -58
  139. /package/.next/static/{9t0jxL0Q7hZ_ItlxJLOtn → IDskqcKTB7kE5quFZAhgJ}/_ssgManifest.js +0 -0
@@ -1,12 +1,14 @@
1
1
  import { override } from 'src/customizations/src/components/overrides/RegionBar'
2
2
  import { getOverriddenSection } from 'src/sdk/overrides/getOverriddenSection'
3
- import type { SectionOverrideDefinition } from 'src/typings/overridesDefinition'
3
+ import type { SectionOverrideDefinitionV1 } from 'src/typings/overridesDefinition'
4
+ import RegionBar from '.'
4
5
 
5
6
  /**
6
7
  * This component exists to support overrides 1.0
7
8
  *
8
9
  * This allows users to override the default RegionBar section present in the Headless CMS
9
10
  */
10
- export const OverriddenDefaultRegionBar = getOverriddenSection(
11
- override as SectionOverrideDefinition<'RegionBar'>
12
- )
11
+ export const OverriddenDefaultRegionBar = getOverriddenSection({
12
+ ...(override as SectionOverrideDefinitionV1<'RegionBar'>),
13
+ Section: RegionBar,
14
+ })
@@ -1,8 +1,8 @@
1
- import RegionBar, {
2
- RegionBarProps,
3
- } from 'src/components/region/RegionBar/RegionBar'
4
- import Section from 'src/components/sections/Section/Section'
1
+ import RegionBar, { RegionBarProps } from '../../region/RegionBar/RegionBar'
2
+ import Section from '../Section/Section'
5
3
  import styles from './section.module.scss'
4
+ import { RegionBarDefaultComponents } from './DefaultComponents'
5
+ import { getOverridableSection } from '../../..//sdk/overrides/getOverriddenSection'
6
6
 
7
7
  type RegionBarSectionProps = {
8
8
  /**
@@ -38,4 +38,10 @@ function RegionBarSection({
38
38
  )
39
39
  }
40
40
 
41
- export default RegionBarSection
41
+ const OverridableRegionBar = getOverridableSection<typeof RegionBarSection>(
42
+ 'RegionBar',
43
+ RegionBarSection,
44
+ RegionBarDefaultComponents
45
+ )
46
+
47
+ export default OverridableRegionBar
@@ -1,44 +1,52 @@
1
- import type { ComponentProps, ComponentType } from 'react'
1
+ import { useMemo, type ComponentProps, type ComponentType } from 'react'
2
2
 
3
- import { OverrideProvider } from './OverrideContext'
4
- import { DefaultComponents, Sections } from './sections'
5
- import { getSectionOverrides } from './overrides'
6
3
  import type {
7
4
  DefaultSectionComponentsDefinitions,
8
- OverriddenComponents,
9
5
  SectionOverrideDefinition,
6
+ SectionOverrideDefinitionV1,
10
7
  } from '../../typings/overridesDefinition'
11
- import type { SupportedSectionsOverridesV2 } from '../../typings/overrides'
12
-
13
- /**
14
- * This function adds OverrideContext to the tree. It is essential for the compatible sections
15
- * to consume the components it provides.
16
- */
17
- function createOverriddenSection<
18
- SectionName extends keyof SupportedSectionsOverridesV2
19
- >({
20
- Section,
21
- sectionOverrides,
22
- className,
23
- }: {
24
- Section: (typeof Sections)[SectionName]
25
- sectionOverrides: OverriddenComponents<SectionName>
26
- className?: string
27
- }) {
28
- const overrideContextValue = { className, components: sectionOverrides }
8
+ import type { SectionsOverrides } from '../../typings/overrides'
9
+ import { getSectionOverrides } from './overrides'
10
+ import { OverrideProvider } from './OverrideContext'
29
11
 
30
- return function OverriddenSection(
31
- props: React.ComponentProps<typeof Section>
12
+ export function getOverridableSection<
13
+ Section extends ComponentType,
14
+ SectionName extends keyof SectionsOverrides = keyof SectionsOverrides
15
+ >(
16
+ sectionName: SectionName,
17
+ Section: Section,
18
+ defaultComponents: DefaultSectionComponentsDefinitions<SectionName>
19
+ ) {
20
+ function OverridableSection(
21
+ propsWithOverrides: ComponentProps<typeof Section> & {
22
+ __overrides?: Omit<SectionOverrideDefinitionV1<SectionName>, 'Section'>
23
+ }
32
24
  ) {
25
+ const { __overrides: overrides, ...props } = propsWithOverrides
26
+
27
+ const overrideContextValue = useMemo(
28
+ () => ({
29
+ ...(overrides ?? {}),
30
+ components: getSectionOverrides<SectionName>(defaultComponents, {
31
+ ...(overrides ?? {}),
32
+ section: sectionName,
33
+ }),
34
+ }),
35
+ [overrides]
36
+ )
37
+
33
38
  /** This type wizardry is here because the props won't behave correctly if nothing is done */
34
- const SectionComponent = Section as ComponentType<typeof props>
39
+ const SectionComponent = Section as ComponentType<ComponentProps<Section>>
35
40
 
36
41
  return (
37
42
  <OverrideProvider value={overrideContextValue}>
38
- <SectionComponent {...props} />
43
+ <SectionComponent {...(props as ComponentProps<typeof Section>)} />
39
44
  </OverrideProvider>
40
45
  )
41
46
  }
47
+
48
+ // This type cast is here so the symbol prop doesn't show up in the type definition
49
+ return OverridableSection as Section
42
50
  }
43
51
 
44
52
  /**
@@ -50,23 +58,16 @@ function createOverriddenSection<
50
58
  * @see https://www.faststore.dev/docs/building-sections/overriding-components-and-props
51
59
  */
52
60
  export function getOverriddenSection<
53
- SectionName extends keyof SupportedSectionsOverridesV2
54
- >(override: SectionOverrideDefinition<SectionName>) {
55
- const defaultComponents = DefaultComponents[
56
- override.section
57
- ] as DefaultSectionComponentsDefinitions<SectionName>
61
+ Section extends SectionsOverrides[keyof SectionsOverrides]['Section']
62
+ >(override: SectionOverrideDefinition<Section>) {
63
+ const { Section, ...rest } = override
58
64
 
59
- if (!defaultComponents) {
60
- throw new Error(
61
- `Section ${override.section} does not exist. Please provide a valid section name to override.`
62
- )
63
- }
65
+ /** This type wizardry is here because the props won't behave correctly if nothing is done */
66
+ const OverridableSection = Section as ComponentType<ComponentProps<Section>>
64
67
 
65
- const sectionOverrides = getSectionOverrides(defaultComponents, override)
66
-
67
- return createOverriddenSection({
68
- Section: Sections[override.section],
69
- sectionOverrides: sectionOverrides,
70
- className: override.className,
71
- })
68
+ return function OverriddenSection(
69
+ props: ComponentProps<typeof OverridableSection>
70
+ ) {
71
+ return <OverridableSection {...props} {...{ __overrides: rest }} />
72
+ }
72
73
  }
@@ -1,8 +1,8 @@
1
1
  import type {
2
2
  DefaultSectionComponentsDefinitions,
3
3
  ComponentOverrideDefinition,
4
- SectionOverrideDefinition,
5
4
  OverriddenComponents,
5
+ SectionOverrideDefinitionV1,
6
6
  } from '../../typings/overridesDefinition'
7
7
 
8
8
  import type { SectionsOverrides } from '../../typings/overrides'
@@ -11,7 +11,7 @@ export function getSectionOverrides<
11
11
  SectionName extends keyof SectionsOverrides
12
12
  >(
13
13
  defaultComponents: DefaultSectionComponentsDefinitions<SectionName>,
14
- override: SectionOverrideDefinition<SectionName>
14
+ override: SectionOverrideDefinitionV1<SectionName>
15
15
  ): OverriddenComponents<SectionName> {
16
16
  const overriddenComponents = {} as OverriddenComponents<SectionName>
17
17