@faststore/core 2.1.33 → 2.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +7 -7
- package/package.json +3 -3
- package/src/components/common/Alert/Alert.tsx +5 -8
- package/src/components/navigation/Navbar/Navbar.tsx +22 -22
- package/src/components/navigation/NavbarLinks/NavbarLinks.tsx +8 -7
- package/src/components/navigation/NavbarSlider/NavbarSlider.tsx +15 -14
- package/src/components/product/ProductGrid/ProductGrid.tsx +5 -10
- package/src/components/region/RegionBar/RegionBar.tsx +27 -13
- package/src/components/search/Filter/Filter.tsx +6 -11
- package/src/components/sections/Alert/Alert.tsx +17 -13
- package/src/components/sections/Alert/Overrides.tsx +13 -25
- package/src/components/sections/BannerText/BannerText.tsx +24 -20
- package/src/components/sections/BannerText/Overrides.tsx +11 -23
- package/src/components/sections/Breadcrumb/Overrides.tsx +13 -25
- package/src/components/sections/EmptyState/EmptyState.tsx +6 -8
- package/src/components/sections/EmptyState/Overrides.tsx +12 -24
- package/src/components/sections/Hero/Hero.tsx +15 -12
- package/src/components/sections/Hero/Overrides.tsx +12 -24
- package/src/components/sections/Navbar/Overrides.tsx +43 -31
- package/src/components/sections/Newsletter/Overrides.tsx +28 -26
- package/src/components/sections/ProductDetails/Overrides.tsx +51 -38
- package/src/components/sections/ProductDetails/ProductDetails.tsx +22 -30
- package/src/components/sections/ProductGallery/Overrides.tsx +44 -35
- package/src/components/sections/ProductShelf/Overrides.tsx +14 -28
- package/src/components/sections/RegionBar/Overrides.tsx +12 -24
- package/src/components/ui/Breadcrumb/Breadcrumb.tsx +9 -7
- package/src/components/ui/ImageGallery/ImageGallery.tsx +13 -19
- package/src/components/ui/Newsletter/Newsletter.tsx +23 -24
- package/src/components/ui/ProductDetails/ProductDetailsSettings.tsx +21 -17
- package/src/components/ui/ProductGallery/ProductGallery.tsx +31 -38
- package/src/components/ui/ProductShelf/ProductShelf.tsx +11 -16
- package/src/components/ui/ShippingSimulation/ShippingSimulation.tsx +2 -3
- package/src/components/ui/SkuSelector/Selectors.tsx +8 -7
- package/src/customizations/components/overrides/Alert.tsx +3 -7
- package/src/customizations/components/overrides/BannerText.tsx +3 -7
- package/src/customizations/components/overrides/Breadcrumb.tsx +3 -7
- package/src/customizations/components/overrides/EmptyState.tsx +3 -6
- package/src/customizations/components/overrides/Hero.tsx +3 -8
- package/src/customizations/components/overrides/Navbar.tsx +3 -16
- package/src/customizations/components/overrides/Newsletter.tsx +3 -11
- package/src/customizations/components/overrides/ProductDetails.tsx +3 -18
- package/src/customizations/components/overrides/ProductGallery.tsx +3 -16
- package/src/customizations/components/overrides/ProductShelf.tsx +3 -8
- package/src/customizations/components/overrides/RegionBar.tsx +3 -8
- package/src/typings/overrideDefinitionUtils.ts +40 -0
- package/src/typings/overrides.ts +267 -0
- package/src/utils/overrides.ts +53 -0
- package/src/typings/overrides.d.ts +0 -97
|
@@ -1,34 +1,20 @@
|
|
|
1
1
|
import { ProductShelf as UIProductShelf } from '@faststore/ui'
|
|
2
|
+
|
|
2
3
|
import ProductCard from 'src/components/product/ProductCard'
|
|
3
4
|
import Carousel from 'src/components/ui/Carousel'
|
|
4
5
|
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const productShelfPropsCustomization = {} as any
|
|
10
|
-
|
|
11
|
-
Object.entries(ProductShelfCustomizations.components).forEach(
|
|
12
|
-
([key, value]) => {
|
|
13
|
-
if (value.Component) {
|
|
14
|
-
productShelfComponentsCustomization[key] = value.Component
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
Object.entries(ProductShelfCustomizations.components).forEach(
|
|
20
|
-
([key, value]) => {
|
|
21
|
-
if (value.props) {
|
|
22
|
-
productShelfPropsCustomization[key] = value.props
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
)
|
|
6
|
+
import { getSectionOverrides } from 'src/utils/overrides'
|
|
7
|
+
import { override } from 'src/customizations/components/overrides/ProductShelf'
|
|
8
|
+
import type { ProductShelfOverrideDefinition } from 'src/typings/overrides'
|
|
26
9
|
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
10
|
+
const { ProductShelf, __experimentalCarousel, __experimentalProductCard } =
|
|
11
|
+
getSectionOverrides(
|
|
12
|
+
{
|
|
13
|
+
ProductShelf: UIProductShelf,
|
|
14
|
+
__experimentalCarousel: Carousel,
|
|
15
|
+
__experimentalProductCard: ProductCard,
|
|
16
|
+
},
|
|
17
|
+
override as ProductShelfOverrideDefinition
|
|
18
|
+
)
|
|
33
19
|
|
|
34
|
-
export {
|
|
20
|
+
export { ProductShelf, __experimentalCarousel, __experimentalProductCard }
|
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
import { RegionBar as UIRegionBar, Icon as UIIcon } from '@faststore/ui'
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { getSectionOverrides } from 'src/utils/overrides'
|
|
4
|
+
import { override } from 'src/customizations/components/overrides/RegionBar'
|
|
5
|
+
import type { RegionBarOverrideDefinition } from 'src/typings/overrides'
|
|
4
6
|
|
|
5
|
-
const
|
|
7
|
+
const { RegionBar, LocationIcon, ButtonIcon } = getSectionOverrides(
|
|
8
|
+
{
|
|
9
|
+
RegionBar: UIRegionBar,
|
|
10
|
+
LocationIcon: UIIcon,
|
|
11
|
+
ButtonIcon: UIIcon,
|
|
12
|
+
},
|
|
13
|
+
override as RegionBarOverrideDefinition
|
|
14
|
+
)
|
|
6
15
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Object.entries(RegionBarCustomizations.components).forEach(([key, value]) => {
|
|
10
|
-
if (value.Component) {
|
|
11
|
-
regionBarComponentsCustomization[key] = value.Component
|
|
12
|
-
}
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
Object.entries(RegionBarCustomizations.components).forEach(([key, value]) => {
|
|
16
|
-
if (value.props) {
|
|
17
|
-
regionBarPropsCustomization[key] = value.props
|
|
18
|
-
}
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
const Components = {
|
|
22
|
-
RegionBar: UIRegionBar,
|
|
23
|
-
LocationIcon: UIIcon,
|
|
24
|
-
ButtonIcon: UIIcon,
|
|
25
|
-
...regionBarComponentsCustomization,
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { Components, regionBarPropsCustomization as Props }
|
|
16
|
+
export { RegionBar, LocationIcon, ButtonIcon }
|
|
@@ -3,8 +3,10 @@ import { memo } from 'react'
|
|
|
3
3
|
|
|
4
4
|
import Link from 'src/components/ui/Link'
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import {
|
|
7
|
+
Breadcrumb as BreadcrumbWrapper,
|
|
8
|
+
Icon,
|
|
9
|
+
} from 'src/components/sections/Breadcrumb/Overrides'
|
|
8
10
|
|
|
9
11
|
export interface BreadcrumbProps extends UIBreadcrumbProps {
|
|
10
12
|
icon: string
|
|
@@ -12,11 +14,11 @@ export interface BreadcrumbProps extends UIBreadcrumbProps {
|
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
const Breadcrumb = ({
|
|
15
|
-
icon =
|
|
17
|
+
icon = Icon.props.name ?? 'Home',
|
|
16
18
|
alt = 'Go to homepage',
|
|
17
19
|
...otherProps
|
|
18
20
|
}: BreadcrumbProps) => (
|
|
19
|
-
<BreadcrumbWrapper
|
|
21
|
+
<BreadcrumbWrapper.Component
|
|
20
22
|
homeLink={
|
|
21
23
|
<Link
|
|
22
24
|
data-fs-breadcrumb-link
|
|
@@ -25,11 +27,11 @@ const Breadcrumb = ({
|
|
|
25
27
|
href="/"
|
|
26
28
|
prefetch={false}
|
|
27
29
|
>
|
|
28
|
-
<Icon
|
|
30
|
+
<Icon.Component
|
|
29
31
|
width={18}
|
|
30
32
|
height={18}
|
|
31
33
|
weight="bold"
|
|
32
|
-
{...
|
|
34
|
+
{...Icon.props}
|
|
33
35
|
name={icon}
|
|
34
36
|
/>
|
|
35
37
|
</Link>
|
|
@@ -39,7 +41,7 @@ const Breadcrumb = ({
|
|
|
39
41
|
{name}
|
|
40
42
|
</Link>
|
|
41
43
|
)}
|
|
42
|
-
{...
|
|
44
|
+
{...BreadcrumbWrapper.props}
|
|
43
45
|
{...otherProps}
|
|
44
46
|
/>
|
|
45
47
|
)
|
|
@@ -4,14 +4,15 @@ import { useEffect, useState } from 'react'
|
|
|
4
4
|
import { useRouter } from 'next/router'
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
ImageGallery as ImageGalleryWrapper,
|
|
8
|
+
ImageZoom,
|
|
9
|
+
__experimentalImageGalleryImage as Image,
|
|
9
10
|
} from 'src/components/sections/ProductDetails/Overrides'
|
|
10
11
|
|
|
11
12
|
const ImageComponent = ({ url, alternateName }) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
return (
|
|
14
|
+
<Image.Component src={url} alt={alternateName} width={68} height={68} />
|
|
15
|
+
)
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export interface ImageGalleryProps {
|
|
@@ -25,34 +26,27 @@ const ImageGallery = ({ images, ...otherProps }: ImageGalleryProps) => {
|
|
|
25
26
|
|
|
26
27
|
useEffect(() => setSelectedImageIdx(0), [dynamicRoute])
|
|
27
28
|
|
|
28
|
-
// Deconstructing the object to avoid circular dependency errors
|
|
29
|
-
const {
|
|
30
|
-
ImageGallery: ImageGalleryWrapper,
|
|
31
|
-
ImageZoom,
|
|
32
|
-
__experimentalImageGalleryImage: Image,
|
|
33
|
-
} = Components
|
|
34
|
-
|
|
35
29
|
return (
|
|
36
|
-
<ImageGalleryWrapper
|
|
37
|
-
{...
|
|
30
|
+
<ImageGalleryWrapper.Component
|
|
31
|
+
{...ImageGalleryWrapper.props}
|
|
38
32
|
images={images}
|
|
39
33
|
ImageComponent={ImageComponent}
|
|
40
34
|
selectedImageIdx={selectedImageIdx}
|
|
41
35
|
setSelectedImageIdx={setSelectedImageIdx}
|
|
42
36
|
{...otherProps}
|
|
43
37
|
>
|
|
44
|
-
<ImageZoom {...
|
|
45
|
-
<Image
|
|
38
|
+
<ImageZoom.Component {...ImageZoom.props}>
|
|
39
|
+
<Image.Component
|
|
46
40
|
sizes="(max-width: 360px) 50vw, (max-width: 768px) 90vw, 50vw"
|
|
47
41
|
width={691}
|
|
48
42
|
height={691 * (3 / 4)}
|
|
49
43
|
loading="eager"
|
|
50
|
-
{...
|
|
44
|
+
{...Image.props}
|
|
51
45
|
src={currentImage.url}
|
|
52
46
|
alt={currentImage.alternateName}
|
|
53
47
|
/>
|
|
54
|
-
</ImageZoom>
|
|
55
|
-
</ImageGalleryWrapper>
|
|
48
|
+
</ImageZoom.Component>
|
|
49
|
+
</ImageGalleryWrapper.Component>
|
|
56
50
|
)
|
|
57
51
|
}
|
|
58
52
|
|
|
@@ -3,18 +3,17 @@ import { forwardRef, useRef } from 'react'
|
|
|
3
3
|
import { convertFromRaw } from 'draft-js'
|
|
4
4
|
import { stateToHTML } from 'draft-js-export-html'
|
|
5
5
|
import { useUI } from '@faststore/ui'
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { Components, Props } from 'src/components/sections/Newsletter/Overrides'
|
|
6
|
+
import type { InputFieldProps } from '@faststore/ui'
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
import { useNewsletter } from 'src/sdk/newsletter/useNewsletter'
|
|
9
|
+
import {
|
|
11
10
|
ToastIconSuccess,
|
|
12
11
|
ToastIconError,
|
|
13
12
|
HeaderIcon,
|
|
14
|
-
InputFieldEmail,
|
|
15
13
|
InputFieldName,
|
|
14
|
+
InputFieldEmail,
|
|
16
15
|
Button,
|
|
17
|
-
}
|
|
16
|
+
} from 'src/components/sections/Newsletter/Overrides'
|
|
18
17
|
|
|
19
18
|
const cmsToHtml = (content) => {
|
|
20
19
|
if (!content) {
|
|
@@ -146,11 +145,11 @@ const Newsletter = forwardRef<HTMLFormElement, NewsletterProps>(
|
|
|
146
145
|
...toastSubscribe,
|
|
147
146
|
status: 'INFO',
|
|
148
147
|
icon: (
|
|
149
|
-
<ToastIconSuccess
|
|
148
|
+
<ToastIconSuccess.Component
|
|
150
149
|
width={30}
|
|
151
150
|
height={30}
|
|
152
|
-
{...
|
|
153
|
-
name={toastSubscribe.icon ??
|
|
151
|
+
{...ToastIconSuccess.props}
|
|
152
|
+
name={toastSubscribe.icon ?? ToastIconSuccess.props.name}
|
|
154
153
|
/>
|
|
155
154
|
),
|
|
156
155
|
})
|
|
@@ -159,11 +158,11 @@ const Newsletter = forwardRef<HTMLFormElement, NewsletterProps>(
|
|
|
159
158
|
...toastSubscribeError,
|
|
160
159
|
status: 'ERROR',
|
|
161
160
|
icon: (
|
|
162
|
-
<ToastIconError
|
|
161
|
+
<ToastIconError.Component
|
|
163
162
|
width={30}
|
|
164
163
|
height={30}
|
|
165
|
-
{...
|
|
166
|
-
name={toastSubscribe.icon ??
|
|
164
|
+
{...ToastIconError.props}
|
|
165
|
+
name={toastSubscribe.icon ?? ToastIconError.props.name}
|
|
167
166
|
/>
|
|
168
167
|
),
|
|
169
168
|
})
|
|
@@ -184,11 +183,11 @@ const Newsletter = forwardRef<HTMLFormElement, NewsletterProps>(
|
|
|
184
183
|
>
|
|
185
184
|
<header data-fs-newsletter-header>
|
|
186
185
|
<h3>
|
|
187
|
-
<HeaderIcon
|
|
186
|
+
<HeaderIcon.Component
|
|
188
187
|
width={32}
|
|
189
188
|
height={32}
|
|
190
|
-
{...
|
|
191
|
-
name={icon?.icon ??
|
|
189
|
+
{...HeaderIcon.props}
|
|
190
|
+
name={icon?.icon ?? HeaderIcon.props.name}
|
|
192
191
|
/>
|
|
193
192
|
{title}
|
|
194
193
|
</h3>
|
|
@@ -198,22 +197,22 @@ const Newsletter = forwardRef<HTMLFormElement, NewsletterProps>(
|
|
|
198
197
|
<div data-fs-newsletter-controls>
|
|
199
198
|
<>
|
|
200
199
|
{displayNameInput ? (
|
|
201
|
-
<InputFieldName
|
|
200
|
+
<InputFieldName.Component
|
|
202
201
|
id="newsletter-name"
|
|
203
202
|
required
|
|
204
|
-
{...
|
|
205
|
-
label={nameInputLabel ??
|
|
203
|
+
{...(InputFieldName.props as InputFieldProps)}
|
|
204
|
+
label={nameInputLabel ?? InputFieldName.props.label}
|
|
206
205
|
// Dynamic props shouldn't be overridable
|
|
207
206
|
// This decision can be reviewed later if needed
|
|
208
207
|
inputRef={nameInputRef}
|
|
209
208
|
/>
|
|
210
209
|
) : null}
|
|
211
|
-
<InputFieldEmail
|
|
210
|
+
<InputFieldEmail.Component
|
|
212
211
|
id="newsletter-email"
|
|
213
212
|
type="email"
|
|
214
213
|
required
|
|
215
|
-
{...
|
|
216
|
-
label={emailInputLabel ??
|
|
214
|
+
{...(InputFieldEmail.props as InputFieldProps)}
|
|
215
|
+
label={emailInputLabel ?? InputFieldEmail.props.label}
|
|
217
216
|
// Dynamic props shouldn't be overridable
|
|
218
217
|
// This decision can be reviewed later if needed
|
|
219
218
|
inputRef={emailInputRef}
|
|
@@ -224,14 +223,14 @@ const Newsletter = forwardRef<HTMLFormElement, NewsletterProps>(
|
|
|
224
223
|
__html: cmsToHtml(privacyPolicy),
|
|
225
224
|
}}
|
|
226
225
|
></span>
|
|
227
|
-
<Button
|
|
226
|
+
<Button.Component
|
|
228
227
|
variant="secondary"
|
|
229
228
|
inverse
|
|
230
229
|
type="submit"
|
|
231
|
-
{...
|
|
230
|
+
{...Button.props}
|
|
232
231
|
>
|
|
233
232
|
{loading ? subscribeButtonLoadingLabel : subscribeButtonLabel}
|
|
234
|
-
</Button>
|
|
233
|
+
</Button.Component>
|
|
235
234
|
</>
|
|
236
235
|
</div>
|
|
237
236
|
</form>
|
|
@@ -9,12 +9,12 @@ import Selectors from 'src/components/ui/SkuSelector'
|
|
|
9
9
|
import AddToCartLoadingSkeleton from './AddToCartLoadingSkeleton'
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
BuyButton,
|
|
13
|
+
Icon,
|
|
14
|
+
Price,
|
|
15
|
+
QuantitySelector,
|
|
14
16
|
} from 'src/components/sections/ProductDetails/Overrides'
|
|
15
17
|
|
|
16
|
-
const { BuyButton, Icon, Price, QuantitySelector } = Components
|
|
17
|
-
|
|
18
18
|
interface ProductDetailsSettingsProps {
|
|
19
19
|
product: ProductDetailsFragment_ProductFragment
|
|
20
20
|
buyButtonTitle: string
|
|
@@ -34,8 +34,8 @@ function ProductDetailsSettings({
|
|
|
34
34
|
quantity,
|
|
35
35
|
setQuantity,
|
|
36
36
|
buyButtonIcon: {
|
|
37
|
-
icon: buyButtonIconName =
|
|
38
|
-
alt: buyButtonIconAlt =
|
|
37
|
+
icon: buyButtonIconName = Icon.props.name,
|
|
38
|
+
alt: buyButtonIconAlt = Icon.props['aria-label'],
|
|
39
39
|
},
|
|
40
40
|
}: ProductDetailsSettingsProps) {
|
|
41
41
|
const {
|
|
@@ -77,30 +77,34 @@ function ProductDetailsSettings({
|
|
|
77
77
|
<>
|
|
78
78
|
<section data-fs-product-details-values>
|
|
79
79
|
<div data-fs-product-details-prices>
|
|
80
|
-
<Price
|
|
80
|
+
<Price.Component
|
|
81
81
|
formatter={useFormattedPrice}
|
|
82
82
|
testId="list-price"
|
|
83
83
|
variant="listing"
|
|
84
84
|
SRText="Original price:"
|
|
85
|
-
{...
|
|
85
|
+
{...Price.props}
|
|
86
|
+
// Dynamic props shouldn't be overridable
|
|
87
|
+
// This decision can be reviewed later if needed
|
|
86
88
|
value={listPrice}
|
|
87
89
|
data-value={listPrice}
|
|
88
90
|
/>
|
|
89
|
-
<Price
|
|
91
|
+
<Price.Component
|
|
90
92
|
formatter={useFormattedPrice}
|
|
91
93
|
testId="price"
|
|
92
94
|
variant="spot"
|
|
93
95
|
className="text__lead"
|
|
94
96
|
SRText="Sale Price:"
|
|
95
|
-
{...
|
|
97
|
+
{...Price.props}
|
|
98
|
+
// Dynamic props shouldn't be overridable
|
|
99
|
+
// This decision can be reviewed later if needed
|
|
96
100
|
value={lowPrice}
|
|
97
101
|
data-value={lowPrice}
|
|
98
102
|
/>
|
|
99
103
|
</div>
|
|
100
|
-
<QuantitySelector
|
|
104
|
+
<QuantitySelector.Component
|
|
101
105
|
min={1}
|
|
102
106
|
max={10}
|
|
103
|
-
{...
|
|
107
|
+
{...QuantitySelector.props}
|
|
104
108
|
// Dynamic props shouldn't be overridable
|
|
105
109
|
// This decision can be reviewed later if needed
|
|
106
110
|
onChange={setQuantity}
|
|
@@ -122,11 +126,11 @@ function ProductDetailsSettings({
|
|
|
122
126
|
isValidating ? (
|
|
123
127
|
<AddToCartLoadingSkeleton />
|
|
124
128
|
) : (
|
|
125
|
-
<BuyButton
|
|
126
|
-
{...
|
|
129
|
+
<BuyButton.Component
|
|
130
|
+
{...BuyButton.props}
|
|
127
131
|
icon={
|
|
128
|
-
<Icon
|
|
129
|
-
{...
|
|
132
|
+
<Icon.Component
|
|
133
|
+
{...Icon.props}
|
|
130
134
|
aria-label={buyButtonIconAlt}
|
|
131
135
|
name={buyButtonIconName}
|
|
132
136
|
/>
|
|
@@ -135,7 +139,7 @@ function ProductDetailsSettings({
|
|
|
135
139
|
{...buyProps}
|
|
136
140
|
>
|
|
137
141
|
{buyButtonTitle || 'Add to Cart'}
|
|
138
|
-
</BuyButton>
|
|
142
|
+
</BuyButton.Component>
|
|
139
143
|
)
|
|
140
144
|
}
|
|
141
145
|
</>
|
|
@@ -17,15 +17,7 @@ import { useDelayedFacets } from './useDelayedFacets'
|
|
|
17
17
|
import { useDelayedPagination } from './useDelayedPagination'
|
|
18
18
|
import { useProductsPrefetch } from './usePageProducts'
|
|
19
19
|
import {
|
|
20
|
-
|
|
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
|
-
}
|
|
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
|
-
{...
|
|
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
|
-
{...
|
|
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
|
-
{...
|
|
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
|
-
<
|
|
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
|
-
{...
|
|
151
|
+
{...FilterIcon.props}
|
|
157
152
|
name={
|
|
158
153
|
filter?.mobileOnly?.filterButton?.icon?.icon ??
|
|
159
|
-
|
|
154
|
+
FilterIcon.props.name
|
|
160
155
|
}
|
|
161
156
|
aria-label={
|
|
162
157
|
filter?.mobileOnly?.filterButton?.icon?.alt ??
|
|
163
|
-
|
|
158
|
+
FilterIcon.props['aria-label']
|
|
164
159
|
}
|
|
165
160
|
/>
|
|
166
161
|
}
|
|
167
162
|
iconPosition="left"
|
|
168
|
-
{...
|
|
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
|
-
</
|
|
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
|
-
{...
|
|
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
|
-
|
|
193
|
+
PrevIcon.props['aria-label']
|
|
201
194
|
}
|
|
202
195
|
/>
|
|
203
196
|
}
|
|
204
|
-
{...
|
|
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
|
-
{...
|
|
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
|
-
|
|
10
|
-
|
|
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 =
|
|
51
|
-
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 {...
|
|
89
|
-
<Carousel id={titleId || id} {...
|
|
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
|
-
{...
|
|
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
|
)
|