@faststore/core 2.1.31 → 2.1.35

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 (140) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +67 -67
  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 +3 -3
  14. package/.next/routes-manifest.json +1 -1
  15. package/.next/server/chunks/186.js +16 -39
  16. package/.next/server/chunks/253.js +22 -48
  17. package/.next/server/chunks/289.js +4 -7
  18. package/.next/server/chunks/350.js +1 -1
  19. package/.next/server/chunks/721.js +22 -51
  20. package/.next/server/chunks/74.js +154 -215
  21. package/.next/server/chunks/81.js +88 -172
  22. package/.next/server/chunks/907.js +54 -100
  23. package/.next/server/middleware-build-manifest.js +1 -1
  24. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  25. package/.next/server/pages/404.js.nft.json +1 -1
  26. package/.next/server/pages/500.js.nft.json +1 -1
  27. package/.next/server/pages/[...slug].js.nft.json +1 -1
  28. package/.next/server/pages/[slug]/p.js +82 -135
  29. package/.next/server/pages/[slug]/p.js.nft.json +1 -1
  30. package/.next/server/pages/_app.js.nft.json +1 -1
  31. package/.next/server/pages/account.js.nft.json +1 -1
  32. package/.next/server/pages/api/graphql.js +1 -1
  33. package/.next/server/pages/checkout.js.nft.json +1 -1
  34. package/.next/server/pages/en-US/404.html +2 -2
  35. package/.next/server/pages/en-US/500.html +2 -2
  36. package/.next/server/pages/en-US/account.html +2 -2
  37. package/.next/server/pages/en-US/checkout.html +2 -2
  38. package/.next/server/pages/en-US/login.html +2 -2
  39. package/.next/server/pages/en-US/s.html +2 -2
  40. package/.next/server/pages/en-US.html +2 -2
  41. package/.next/server/pages/index.js.nft.json +1 -1
  42. package/.next/server/pages/login.js.nft.json +1 -1
  43. package/.next/server/pages/s.js.nft.json +1 -1
  44. package/.next/server/pages-manifest.json +2 -2
  45. package/.next/static/chunks/209-d1d2eeaeefbc68f7.js +1 -0
  46. package/.next/static/chunks/548-6b23e7ad82cd22b9.js +1 -0
  47. package/.next/static/chunks/{64.7ea3677ac3a10e00.js → 64.2f385ef39cd5877d.js} +1 -1
  48. package/.next/static/chunks/706-1020d118bb59b204.js +1 -0
  49. package/.next/static/chunks/{738-67a288ca3569cdbb.js → 738-a5ff304828f20cbf.js} +1 -1
  50. package/.next/static/chunks/791-681afeb766a9098f.js +1 -0
  51. package/.next/static/chunks/pages/404-14d27e3706f3d2c3.js +1 -0
  52. package/.next/static/chunks/pages/500-250ccf5c9626e451.js +1 -0
  53. package/.next/static/chunks/pages/[...slug]-bcfaf0c5d60b57a0.js +1 -0
  54. package/.next/static/chunks/pages/[slug]/p-c1f2b05344981f12.js +1 -0
  55. package/.next/static/chunks/pages/index-bdbfb082027ed2b7.js +1 -0
  56. package/.next/static/chunks/pages/login-b1bdf30c951bb60d.js +1 -0
  57. package/.next/static/chunks/webpack-73cade94715ad9e1.js +1 -0
  58. package/.next/static/css/208b7dd52a0981bd.css +1 -0
  59. package/.next/static/css/41ef280537acec50.css +1 -0
  60. package/.next/static/css/4ad5a6bd11a9f8d8.css +1 -0
  61. package/.next/static/css/5330ae3076254840.css +1 -0
  62. package/.next/static/css/5972921daee792bb.css +1 -0
  63. package/.next/static/css/6e1a7434f061d0ef.css +1 -0
  64. package/.next/static/css/82a475e147f4b2ee.css +1 -0
  65. package/.next/static/css/af5ef0767b748cb3.css +1 -0
  66. package/.next/static/css/cb7d1fcea42fab9c.css +1 -0
  67. package/.next/static/css/d67fbe2a613293c1.css +1 -0
  68. package/.next/static/uXS-aZT8ClbPcIudKFF0d/_buildManifest.js +1 -0
  69. package/.next/trace +80 -80
  70. package/.turbo/turbo-build.log +10 -19
  71. package/package.json +8 -8
  72. package/src/components/common/Alert/Alert.tsx +5 -8
  73. package/src/components/navigation/Navbar/Navbar.tsx +22 -22
  74. package/src/components/navigation/NavbarLinks/NavbarLinks.tsx +8 -7
  75. package/src/components/navigation/NavbarSlider/NavbarSlider.tsx +15 -14
  76. package/src/components/product/ProductGrid/ProductGrid.tsx +5 -10
  77. package/src/components/region/RegionBar/RegionBar.tsx +27 -13
  78. package/src/components/search/Filter/Filter.tsx +6 -11
  79. package/src/components/sections/Alert/Alert.tsx +17 -13
  80. package/src/components/sections/Alert/Overrides.tsx +13 -25
  81. package/src/components/sections/BannerText/BannerText.tsx +24 -20
  82. package/src/components/sections/BannerText/Overrides.tsx +11 -23
  83. package/src/components/sections/Breadcrumb/Overrides.tsx +13 -25
  84. package/src/components/sections/EmptyState/EmptyState.tsx +6 -8
  85. package/src/components/sections/EmptyState/Overrides.tsx +12 -24
  86. package/src/components/sections/Hero/Hero.tsx +15 -12
  87. package/src/components/sections/Hero/Overrides.tsx +12 -24
  88. package/src/components/sections/Navbar/Overrides.tsx +43 -31
  89. package/src/components/sections/Newsletter/Overrides.tsx +28 -26
  90. package/src/components/sections/ProductDetails/Overrides.tsx +51 -38
  91. package/src/components/sections/ProductDetails/ProductDetails.tsx +22 -30
  92. package/src/components/sections/ProductGallery/Overrides.tsx +44 -35
  93. package/src/components/sections/ProductShelf/Overrides.tsx +14 -28
  94. package/src/components/sections/RegionBar/Overrides.tsx +12 -24
  95. package/src/components/ui/Breadcrumb/Breadcrumb.tsx +9 -7
  96. package/src/components/ui/ImageGallery/ImageGallery.tsx +13 -19
  97. package/src/components/ui/Newsletter/Newsletter.tsx +23 -24
  98. package/src/components/ui/ProductDetails/ProductDetailsSettings.tsx +21 -17
  99. package/src/components/ui/ProductGallery/ProductGallery.tsx +31 -38
  100. package/src/components/ui/ProductShelf/ProductShelf.tsx +11 -16
  101. package/src/components/ui/ShippingSimulation/ShippingSimulation.tsx +2 -3
  102. package/src/components/ui/SkuSelector/Selectors.tsx +8 -7
  103. package/src/customizations/components/overrides/Alert.tsx +3 -7
  104. package/src/customizations/components/overrides/BannerText.tsx +3 -7
  105. package/src/customizations/components/overrides/Breadcrumb.tsx +3 -7
  106. package/src/customizations/components/overrides/EmptyState.tsx +3 -6
  107. package/src/customizations/components/overrides/Hero.tsx +3 -8
  108. package/src/customizations/components/overrides/Navbar.tsx +3 -16
  109. package/src/customizations/components/overrides/Newsletter.tsx +3 -11
  110. package/src/customizations/components/overrides/ProductDetails.tsx +3 -18
  111. package/src/customizations/components/overrides/ProductGallery.tsx +3 -16
  112. package/src/customizations/components/overrides/ProductShelf.tsx +3 -8
  113. package/src/customizations/components/overrides/RegionBar.tsx +3 -8
  114. package/src/typings/overrideDefinitionUtils.ts +40 -0
  115. package/src/typings/overrides.ts +267 -0
  116. package/src/utils/overrides.ts +53 -0
  117. package/.next/static/chunks/209-9a50f2317fccb202.js +0 -1
  118. package/.next/static/chunks/548-ab84e9e8b49413ab.js +0 -1
  119. package/.next/static/chunks/706-5aea41dd07970d2d.js +0 -1
  120. package/.next/static/chunks/791-63b1ccf9964b6517.js +0 -1
  121. package/.next/static/chunks/pages/404-d5f20744ecd83121.js +0 -1
  122. package/.next/static/chunks/pages/500-3911549ab88d0378.js +0 -1
  123. package/.next/static/chunks/pages/[...slug]-2232ce78cb672654.js +0 -1
  124. package/.next/static/chunks/pages/[slug]/p-16595182cbda6bb9.js +0 -1
  125. package/.next/static/chunks/pages/index-7c2ec2e4b6081dbc.js +0 -1
  126. package/.next/static/chunks/pages/login-4cc4b8e52608f076.js +0 -1
  127. package/.next/static/chunks/webpack-a86bbea19dfdfd35.js +0 -1
  128. package/.next/static/css/08e3fc80f9bad95d.css +0 -1
  129. package/.next/static/css/1b23beb5af203ffb.css +0 -1
  130. package/.next/static/css/4b19e1e142e038b0.css +0 -1
  131. package/.next/static/css/584640ffee46aa49.css +0 -1
  132. package/.next/static/css/7486a2a5fcda5283.css +0 -1
  133. package/.next/static/css/7d822a137c54a781.css +0 -1
  134. package/.next/static/css/a49f71ae6bb528e0.css +0 -1
  135. package/.next/static/css/d1ad1d89f8d5c7a1.css +0 -1
  136. package/.next/static/css/e02cdad8fc000339.css +0 -1
  137. package/.next/static/css/f9d59f597a4d8f82.css +0 -1
  138. package/.next/static/xYGxa3PwWTjNHEfOkCiX-/_buildManifest.js +0 -1
  139. package/src/typings/overrides.d.ts +0 -97
  140. /package/.next/static/{xYGxa3PwWTjNHEfOkCiX- → uXS-aZT8ClbPcIudKFF0d}/_ssgManifest.js +0 -0
@@ -17,15 +17,7 @@ import { useDelayedFacets } from './useDelayedFacets'
17
17
  import { useDelayedPagination } from './useDelayedPagination'
18
18
  import { useProductsPrefetch } from './usePageProducts'
19
19
  import {
20
- Components,
21
- Props,
22
- } from 'src/components/sections/ProductGallery/Overrides'
23
-
24
- const GalleryPage = lazy(() => import('./ProductGalleryPage'))
25
- const GalleryPageSkeleton = <ProductGridSkeleton loading />
26
-
27
- const {
28
- Button,
20
+ MobileFilterButton,
29
21
  FilterIcon,
30
22
  PrevIcon,
31
23
  ResultsCountSkeleton,
@@ -33,7 +25,10 @@ const {
33
25
  FilterButtonSkeleton,
34
26
  LinkButtonPrev,
35
27
  LinkButtonNext,
36
- } = Components
28
+ } from 'src/components/sections/ProductGallery/Overrides'
29
+
30
+ const GalleryPage = lazy(() => import('./ProductGalleryPage'))
31
+ const GalleryPageSkeleton = <ProductGridSkeleton loading />
37
32
 
38
33
  export interface ProductGalleryProps {
39
34
  title?: string
@@ -111,10 +106,10 @@ function ProductGallery({
111
106
  </FilterSkeleton>
112
107
  </div>
113
108
  <div data-fs-product-listing-results-count data-count={totalCount}>
114
- <ResultsCountSkeleton
109
+ <ResultsCountSkeleton.Component
115
110
  data-fs-product-listing-results-count-skeleton
116
111
  size={{ width: '100%', height: '1.5rem' }}
117
- {...Props['ResultsCountSkeleton']}
112
+ {...ResultsCountSkeleton.props}
118
113
  // Dynamic props shouldn't be overridable
119
114
  // This decision can be reviewed later if needed
120
115
  loading={!productGalleryData}
@@ -122,13 +117,13 @@ function ProductGallery({
122
117
  <h2 data-testid="total-product-count">
123
118
  {totalCount} {totalCountLabel}
124
119
  </h2>
125
- </ResultsCountSkeleton>
120
+ </ResultsCountSkeleton.Component>
126
121
  </div>
127
122
  <div data-fs-product-listing-sort>
128
- <SortSkeleton
123
+ <SortSkeleton.Component
129
124
  data-fs-product-listing-sort-skeleton
130
125
  size={{ width: 'auto', height: '1.5rem' }}
131
- {...Props['SortSkeleton']}
126
+ {...SortSkeleton.props}
132
127
  // Dynamic props shouldn't be overridable
133
128
  // This decision can be reviewed later if needed
134
129
  loading={facets?.length === 0}
@@ -137,42 +132,42 @@ function ProductGallery({
137
132
  label={sortBySelector?.label}
138
133
  options={sortBySelector?.options}
139
134
  />
140
- </SortSkeleton>
141
- <FilterButtonSkeleton
135
+ </SortSkeleton.Component>
136
+ <FilterButtonSkeleton.Component
142
137
  data-fs-product-listing-filter-button-skeleton
143
138
  size={{ width: '6rem', height: '1.5rem' }}
144
- {...Props['FilterButtonSkeleton']}
139
+ {...FilterButtonSkeleton.props}
145
140
  // Dynamic props shouldn't be overridable
146
141
  // This decision can be reviewed later if needed
147
142
  loading={facets?.length === 0}
148
143
  >
149
- <Button
144
+ <MobileFilterButton.Component
150
145
  variant="tertiary"
151
146
  data-testid="open-filter-button"
152
147
  icon={
153
- <FilterIcon
148
+ <FilterIcon.Component
154
149
  width={16}
155
150
  height={16}
156
- {...Props['FilterIcon']}
151
+ {...FilterIcon.props}
157
152
  name={
158
153
  filter?.mobileOnly?.filterButton?.icon?.icon ??
159
- Props['FilterIcon'].name
154
+ FilterIcon.props.name
160
155
  }
161
156
  aria-label={
162
157
  filter?.mobileOnly?.filterButton?.icon?.alt ??
163
- Props['FilterIcon']['aria-label']
158
+ FilterIcon.props['aria-label']
164
159
  }
165
160
  />
166
161
  }
167
162
  iconPosition="left"
168
- {...Props['Button']}
163
+ {...MobileFilterButton.props}
169
164
  // Dynamic props shouldn't be overridable
170
165
  // This decision can be reviewed later if needed
171
166
  onClick={openFilter}
172
167
  >
173
168
  {filter?.mobileOnly?.filterButton?.label}
174
- </Button>
175
- </FilterButtonSkeleton>
169
+ </MobileFilterButton.Component>
170
+ </FilterButtonSkeleton.Component>
176
171
  </div>
177
172
  <div data-fs-product-listing-results>
178
173
  {/* Add link to previous page. This helps on SEO */}
@@ -181,27 +176,25 @@ function ProductGallery({
181
176
  <NextSeo
182
177
  additionalLinkTags={[{ rel: 'prev', href: prev.link }]}
183
178
  />
184
- <LinkButtonPrev
179
+ <LinkButtonPrev.Component
185
180
  rel="prev"
186
181
  variant="secondary"
187
182
  iconPosition="left"
188
183
  icon={
189
- <PrevIcon
184
+ <PrevIcon.Component
190
185
  width={16}
191
186
  height={16}
192
187
  weight="bold"
193
- {...Props['PrevIcon']}
194
- name={
195
- previousPageButton?.icon?.icon ?? Props['PrevIcon'].name
196
- }
188
+ {...PrevIcon.props}
189
+ name={previousPageButton?.icon?.icon ?? PrevIcon.props.name}
197
190
  aria-label={
198
191
  previousPageButton?.icon?.alt ??
199
192
  previousPageButton?.label ??
200
- Props['PrevIcon']['aria-label']
193
+ PrevIcon.props['aria-label']
201
194
  }
202
195
  />
203
196
  }
204
- {...Props['LinkButtonPrev']}
197
+ {...LinkButtonPrev.props}
205
198
  // Dynamic props shouldn't be overridable
206
199
  // This decision can be reviewed later if needed
207
200
  onClick={(e: MouseEvent<HTMLElement>) => {
@@ -212,7 +205,7 @@ function ProductGallery({
212
205
  href={prev.link}
213
206
  >
214
207
  {previousPageButton?.label}
215
- </LinkButtonPrev>
208
+ </LinkButtonPrev.Component>
216
209
  </div>
217
210
  )}
218
211
  {/* Render ALL products */}
@@ -236,11 +229,11 @@ function ProductGallery({
236
229
  <NextSeo
237
230
  additionalLinkTags={[{ rel: 'next', href: next.link }]}
238
231
  />
239
- <LinkButtonNext
232
+ <LinkButtonNext.Component
240
233
  testId="show-more"
241
234
  rel="next"
242
235
  variant="secondary"
243
- {...Props['LinkButtonNext']}
236
+ {...LinkButtonNext.props}
244
237
  // Dynamic props shouldn't be overridable
245
238
  // This decision can be reviewed later if needed
246
239
  onClick={(e: MouseEvent<HTMLElement>) => {
@@ -251,7 +244,7 @@ function ProductGallery({
251
244
  href={next.link}
252
245
  >
253
246
  {loadMorePageButton?.label}
254
- </LinkButtonNext>
247
+ </LinkButtonNext.Component>
255
248
  </div>
256
249
  )}
257
250
  </div>
@@ -6,16 +6,11 @@ import { useProductsQuery } from 'src/sdk/product/useProductsQuery'
6
6
  import { textToKebabCase } from 'src/utils/utilities'
7
7
 
8
8
  import {
9
- Components,
10
- Props,
9
+ ProductShelf as ProductShelfWrapper,
10
+ __experimentalCarousel as Carousel,
11
+ __experimentalProductCard as ProductCard,
11
12
  } from 'src/components/sections/ProductShelf/Overrides'
12
13
 
13
- const {
14
- ProductShelf: ProductShelfWrapper,
15
- __experimentalCarousel: Carousel,
16
- __experimentalProductCard: ProductCard,
17
- } = Components
18
-
19
14
  type Sort =
20
15
  | 'discount_desc'
21
16
  | 'name_asc'
@@ -47,8 +42,8 @@ function ProductShelf({
47
42
  title,
48
43
  inView,
49
44
  productCardConfiguration: {
50
- bordered = Props['__experimentalProductCard'].bordered,
51
- showDiscountBadge = Props['__experimentalProductCard'].showDiscountBadge,
45
+ bordered = ProductCard.props.bordered,
46
+ showDiscountBadge = ProductCard.props.showDiscountBadge,
52
47
  } = {},
53
48
  ...variables
54
49
  }: ProductShelfProps) {
@@ -85,17 +80,17 @@ function ProductShelf({
85
80
  aspectRatio={aspectRatio}
86
81
  loading={products === undefined}
87
82
  >
88
- <ProductShelfWrapper {...Props['ProductShelfWrapper']}>
89
- <Carousel id={titleId || id} {...Props['__experimentalCarousel']}>
83
+ <ProductShelfWrapper.Component {...ProductShelfWrapper.props}>
84
+ <Carousel.Component id={titleId || id} {...Carousel.props}>
90
85
  {productEdges.map((product, idx) => (
91
- <ProductCard
86
+ <ProductCard.Component
92
87
  aspectRatio={aspectRatio}
93
88
  imgProps={{
94
89
  width: 216,
95
90
  height: 216,
96
91
  sizes: '(max-width: 768px) 42vw, 30vw',
97
92
  }}
98
- {...Props['__experimentalProductCard']}
93
+ {...ProductCard.props}
99
94
  bordered={bordered}
100
95
  showDiscountBadge={showDiscountBadge}
101
96
  // Dynamic props shouldn't be overridable
@@ -105,8 +100,8 @@ function ProductShelf({
105
100
  index={idx + 1}
106
101
  />
107
102
  ))}
108
- </Carousel>
109
- </ProductShelfWrapper>
103
+ </Carousel.Component>
104
+ </ProductShelfWrapper.Component>
110
105
  </ProductShelfSkeleton>
111
106
  </>
112
107
  )
@@ -6,7 +6,7 @@ import { useSession } from 'src/sdk/session'
6
6
  import { IShippingItem } from '@faststore/api'
7
7
  import { useShippingSimulation } from './useShippingSimulation'
8
8
 
9
- import { Components } from 'src/components/sections/ProductDetails/Overrides'
9
+ import { ShippingSimulation as ShippingSimulationWrapper } from 'src/components/sections/ProductDetails/Overrides'
10
10
 
11
11
  type ShippingSimulationOptionalProps =
12
12
  | 'title'
@@ -56,7 +56,6 @@ export default function ShippingSimulation({
56
56
  ...otherProps
57
57
  }: ShippingSimulationProps) {
58
58
  const { country, postalCode: sessionPostalCode } = useSession()
59
- const { ShippingSimulation: ShippingSimulationWrapper } = Components
60
59
 
61
60
  const {
62
61
  input,
@@ -76,7 +75,7 @@ export default function ShippingSimulation({
76
75
  const { location, options } = shippingSimulation
77
76
 
78
77
  return (
79
- <ShippingSimulationWrapper
78
+ <ShippingSimulationWrapper.Component
80
79
  formatter={formatter}
81
80
  onInput={handleOnInput}
82
81
  onSubmit={handleSubmit}
@@ -4,9 +4,7 @@ import { SkuSelectorProps } from '@faststore/ui'
4
4
  import NextLink from 'next/link'
5
5
  import { Image } from '../Image'
6
6
 
7
- import { Components } from 'src/components/sections/ProductDetails/Overrides'
8
-
9
- const { SkuSelector } = Components
7
+ import { SkuSelector } from 'src/components/sections/ProductDetails/Overrides'
10
8
 
11
9
  export type SkuVariantsByName = Record<
12
10
  string,
@@ -44,16 +42,19 @@ function Selectors({
44
42
  <section {...otherProps}>
45
43
  {availableVariations &&
46
44
  Object.keys(availableVariations).map((skuVariant) => (
47
- <SkuSelector
45
+ <SkuSelector.Component
46
+ ImageComponent={ImageComponent}
47
+ {...SkuSelector.props}
48
48
  key={skuVariant}
49
49
  skuPropertyName={skuVariant}
50
50
  availableVariations={availableVariations}
51
- ImageComponent={ImageComponent}
52
51
  activeVariations={activeVariations}
53
52
  slugsMap={slugsMap}
54
53
  linkProps={{
55
- as: NextLink,
56
- legacyBehavior: false,
54
+ ...(SkuSelector.props.linkProps ?? {}),
55
+ as: SkuSelector.props.linkProps?.as ?? NextLink,
56
+ legacyBehavior:
57
+ SkuSelector.props.linkProps?.legacyBehavior ?? false,
57
58
  }}
58
59
  />
59
60
  ))}
@@ -4,12 +4,8 @@ import { SectionOverride } from 'src/typings/overrides'
4
4
 
5
5
  const SECTION = 'Alert' as const
6
6
 
7
- const overrides: SectionOverride[typeof SECTION] = {
8
- name: SECTION,
9
- components: {
10
- Alert: { props: {} },
11
- Icon: { props: {} },
12
- },
7
+ const override: SectionOverride = {
8
+ section: SECTION,
13
9
  }
14
10
 
15
- export default overrides
11
+ export { override }
@@ -4,12 +4,8 @@ import { SectionOverride } from 'src/typings/overrides'
4
4
 
5
5
  const SECTION = 'BannerText' as const
6
6
 
7
- const overrides: SectionOverride[typeof SECTION] = {
8
- name: SECTION,
9
- components: {
10
- BannerText: { props: {} },
11
- BannerTextContent: { props: {} },
12
- },
7
+ const override: SectionOverride = {
8
+ section: SECTION,
13
9
  }
14
10
 
15
- export default overrides
11
+ export { override }
@@ -4,12 +4,8 @@ import { SectionOverride } from 'src/typings/overrides'
4
4
 
5
5
  const SECTION = 'Breadcrumb' as const
6
6
 
7
- const overrides: SectionOverride[typeof SECTION] = {
8
- name: SECTION,
9
- components: {
10
- Breadcrumb: { props: {} },
11
- Icon: { props: {} },
12
- },
7
+ const override: SectionOverride = {
8
+ section: SECTION,
13
9
  }
14
10
 
15
- export default overrides
11
+ export { override }
@@ -3,11 +3,8 @@ import { SectionOverride } from 'src/typings/overrides'
3
3
 
4
4
  const SECTION = 'EmptyState' as const
5
5
 
6
- const overrides: SectionOverride[typeof SECTION] = {
7
- name: SECTION,
8
- components: {
9
- EmptyState: { props: {} },
10
- },
6
+ const override: SectionOverride = {
7
+ section: SECTION,
11
8
  }
12
9
 
13
- export default overrides
10
+ export { override }
@@ -4,13 +4,8 @@ import { SectionOverride } from 'src/typings/overrides'
4
4
 
5
5
  const SECTION = 'Hero' as const
6
6
 
7
- const overrides: SectionOverride[typeof SECTION] = {
8
- name: SECTION,
9
- components: {
10
- Hero: { props: {} },
11
- HeroImage: { props: {} },
12
- HeroHeader: { props: {} },
13
- },
7
+ const override: SectionOverride = {
8
+ section: SECTION,
14
9
  }
15
10
 
16
- export default overrides
11
+ export { override }
@@ -4,21 +4,8 @@ import { SectionOverride } from 'src/typings/overrides'
4
4
 
5
5
  const SECTION = 'Navbar' as const
6
6
 
7
- const overrides: SectionOverride[typeof SECTION] = {
8
- name: SECTION,
9
- components: {
10
- Navbar: { props: {} },
11
- NavbarLinks: { props: {} },
12
- NavbarLinksList: { props: {} },
13
- NavbarSlider: { props: {} },
14
- NavbarSliderHeader: { props: {} },
15
- NavbarSliderContent: { props: {} },
16
- NavbarSliderFooter: { props: {} },
17
- NavbarHeader: { props: {} },
18
- NavbarRow: { props: {} },
19
- NavbarButtons: { props: {} },
20
- IconButton: { props: {} },
21
- },
7
+ const override: SectionOverride = {
8
+ section: SECTION,
22
9
  }
23
10
 
24
- export default overrides
11
+ export { override }
@@ -4,16 +4,8 @@ import { SectionOverride } from 'src/typings/overrides'
4
4
 
5
5
  const SECTION = 'Newsletter' as const
6
6
 
7
- const overrides: SectionOverride[typeof SECTION] = {
8
- name: SECTION,
9
- components: {
10
- ToastIconSuccess: { props: {} },
11
- ToastIconError: { props: {} },
12
- HeaderIcon: { props: {} },
13
- InputFieldName: { props: {} },
14
- InputFieldEmail: { props: {} },
15
- Button: { props: {} },
16
- },
7
+ const override: SectionOverride = {
8
+ section: SECTION,
17
9
  }
18
10
 
19
- export default overrides
11
+ export { override }
@@ -4,23 +4,8 @@ import { SectionOverride } from 'src/typings/overrides'
4
4
 
5
5
  const SECTION = 'ProductDetails' as const
6
6
 
7
- const overrides: SectionOverride[typeof SECTION] = {
8
- name: SECTION,
9
- components: {
10
- ProductTitle: { props: {} },
11
- DiscountBadge: { props: {} },
12
- BuyButton: { props: {} },
13
- Icon: { props: {} },
14
- Price: { props: {} },
15
- QuantitySelector: { props: {} },
16
- SkuSelector: { props: {} },
17
- ShippingSimulation: { props: {} },
18
- ImageGallery: { props: {} },
19
- ImageZoom: { props: {} },
20
- __experimentalImageGalleryImage: { props: {} },
21
- __experimentalImageGallery: { props: {} },
22
- __experimentalShippingSimulation: { props: {} },
23
- },
7
+ const override: SectionOverride = {
8
+ section: SECTION,
24
9
  }
25
10
 
26
- export default overrides
11
+ export { override }
@@ -4,21 +4,8 @@ import { SectionOverride } from 'src/typings/overrides'
4
4
 
5
5
  const SECTION = 'ProductGallery' as const
6
6
 
7
- const overrides: SectionOverride[typeof SECTION] = {
8
- name: SECTION,
9
- components: {
10
- Button: { props: {} },
11
- FilterIcon: { props: {} },
12
- PrevIcon: { props: {} },
13
- ResultsCountSkeleton: { props: {} },
14
- SortSkeleton: { props: {} },
15
- FilterButtonSkeleton: { props: {} },
16
- LinkButtonPrev: { props: {} },
17
- LinkButtonNext: { props: {} },
18
- __experimentalFilterDesktop: { props: {} },
19
- __experimentalFilterSlider: { props: {} },
20
- __experimentalProductCard: { props: {} },
21
- },
7
+ const override: SectionOverride = {
8
+ section: SECTION,
22
9
  }
23
10
 
24
- export default overrides
11
+ export { override }
@@ -4,13 +4,8 @@ import { SectionOverride } from 'src/typings/overrides'
4
4
 
5
5
  const SECTION = 'ProductShelf' as const
6
6
 
7
- const overrides: SectionOverride[typeof SECTION] = {
8
- name: SECTION,
9
- components: {
10
- ProductShelf: { props: {} },
11
- __experimentalCarousel: { props: {} },
12
- __experimentalProductCard: { props: {} },
13
- },
7
+ const override: SectionOverride = {
8
+ section: SECTION,
14
9
  }
15
10
 
16
- export default overrides
11
+ export { override }
@@ -4,13 +4,8 @@ import { SectionOverride } from 'src/typings/overrides'
4
4
 
5
5
  const SECTION = 'RegionBar' as const
6
6
 
7
- const overrides: SectionOverride[typeof SECTION] = {
8
- name: SECTION,
9
- components: {
10
- RegionBar: { props: {} },
11
- LocationIcon: { props: {} },
12
- ButtonIcon: { props: {} },
13
- },
7
+ const override: SectionOverride = {
8
+ section: SECTION,
14
9
  }
15
10
 
16
- export default overrides
11
+ export { override }
@@ -0,0 +1,40 @@
1
+ export type DefaultSectionComponentsDefinitions<
2
+ T extends SectionOverrideDefinition
3
+ > = Record<keyof T['components'], React.ComponentType>
4
+
5
+ export type SectionOverrideDefinition<
6
+ SectionName extends string = string,
7
+ OC extends Record<string, ComponentOverrideDefinition<any, any>> = Record<
8
+ string,
9
+ ComponentOverrideDefinition<any, any>
10
+ >
11
+ > = {
12
+ section: SectionName
13
+ components?: Partial<Prettify<OC>>
14
+ }
15
+
16
+ export type ComponentOverrideDefinition<ComponentProps, Props> =
17
+ | {
18
+ Component?: never
19
+ props: Partial<Props>
20
+ }
21
+ | {
22
+ Component: React.ComponentType<ComponentProps>
23
+ props?: never
24
+ }
25
+
26
+ /** This type makes complex types (usually generics) easier to read */
27
+ export type Prettify<T> = {
28
+ [K in keyof T]: T[K]
29
+ } & {}
30
+
31
+ // Taken from https://dev.to/lucianbc/union-type-merging-in-typescript-9al
32
+ type AllKeys<T> = T extends any ? keyof T : never
33
+
34
+ type PickType<T, K extends AllKeys<T>> = T extends { [k in K]?: any }
35
+ ? T[K]
36
+ : undefined
37
+
38
+ export type Merge<T> = {
39
+ [k in AllKeys<T>]: PickType<T, k>
40
+ }