@faststore/core 2.2.57 → 2.2.58
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +37 -37
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/eslint/.cache_1gneedd +1 -1
- package/.next/cache/next-server.js.nft.json +1 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +2 -2
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/74.js +1593 -166
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.js.nft.json +1 -1
- package/.next/server/pages/[...slug].js +1 -1
- package/.next/server/pages/[...slug].js.nft.json +1 -1
- package/.next/server/pages/[slug]/p.js +30 -1278
- package/.next/server/pages/[slug]/p.js.nft.json +1 -1
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/account.js.nft.json +1 -1
- package/.next/server/pages/checkout.js.nft.json +1 -1
- package/.next/server/pages/en-US/404.html +2 -2
- package/.next/server/pages/en-US/500.html +2 -2
- package/.next/server/pages/en-US/account.html +2 -2
- package/.next/server/pages/en-US/checkout.html +2 -2
- package/.next/server/pages/en-US/login.html +2 -2
- package/.next/server/pages/en-US/s.html +2 -2
- package/.next/server/pages/en-US.html +2 -2
- package/.next/server/pages/index.js +1 -1
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/login.js.nft.json +1 -1
- package/.next/server/pages/s.js +1 -1
- package/.next/server/pages/s.js.nft.json +1 -1
- package/.next/static/chunks/158-3ad2d91ade721ede.js +1 -0
- package/.next/static/chunks/497-e24ad9b81a2b2cba.js +1 -0
- package/.next/static/chunks/{585.4e673e43d8daf336.js → 585.f056dcd6e8625c41.js} +1 -1
- package/.next/static/chunks/988.a57dac6501fb5184.js +1 -0
- package/.next/static/chunks/pages/{[...slug]-b82b56ce1651ea4f.js → [...slug]-73ed6192e9f16de9.js} +1 -1
- package/.next/static/chunks/pages/[slug]/p-0006885a8666b680.js +1 -0
- package/.next/static/chunks/pages/index-eb26d4cf53e13666.js +1 -0
- package/.next/static/chunks/{webpack-ec84ae4e89cebb1f.js → webpack-3382def1b25b17f8.js} +1 -1
- package/.next/static/css/4729e602d10c1332.css +1 -0
- package/.next/static/css/f2ab72459fcdabcc.css +1 -0
- package/.next/static/{sToiuT4rncwaUIk2owcIX → j13kfoTKrIiAVuMZNkLYr}/_buildManifest.js +1 -1
- package/.next/trace +81 -81
- package/.turbo/turbo-build.log +12 -12
- package/.turbo/turbo-test.log +10 -10
- package/package.json +2 -2
- package/src/components/sections/ProductDetails/DefaultComponents.ts +34 -0
- package/src/components/sections/ProductDetails/OverriddenDefaultProductDetails.ts +12 -0
- package/src/components/sections/ProductDetails/ProductDetails.tsx +33 -34
- package/src/components/ui/ImageGallery/ImageGallery.tsx +10 -6
- package/src/components/ui/ProductDetails/ProductDetailsSettings.tsx +12 -13
- package/src/components/ui/ShippingSimulation/ShippingSimulation.tsx +4 -2
- package/src/components/ui/SkuSelector/Selectors.tsx +3 -1
- package/src/pages/[slug]/p.tsx +1 -1
- package/src/sdk/overrides/sections.tsx +5 -1
- package/src/typings/overrides.ts +1 -1
- package/.next/server/chunks/693.js +0 -58
- package/.next/server/chunks/779.js +0 -58
- package/.next/static/chunks/158-ef35da4842083552.js +0 -1
- package/.next/static/chunks/497-37c1e4e1d862b354.js +0 -1
- package/.next/static/chunks/988.afda042dd9ba11d1.js +0 -1
- package/.next/static/chunks/pages/[slug]/p-39599bd4d6faeeb6.js +0 -1
- package/.next/static/chunks/pages/index-84457d91d9060925.js +0 -1
- package/.next/static/css/0cb5d7afb952bb02.css +0 -1
- package/.next/static/css/cbccabebb36f7f92.css +0 -1
- package/src/components/sections/ProductDetails/Overrides.tsx +0 -73
- /package/.next/static/{sToiuT4rncwaUIk2owcIX → j13kfoTKrIiAVuMZNkLYr}/_ssgManifest.js +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
$ yarn partytown & yarn generate && next build
|
|
2
|
-
$ faststore generate-graphql -c
|
|
3
2
|
$ partytown copylib ./public/~partytown
|
|
3
|
+
$ faststore generate-graphql -c
|
|
4
4
|
Partytown lib copied to: /home/runner/work/faststore/faststore/packages/core/public/~partytown
|
|
5
5
|
success - GraphQL schema, types, and optimizations successfully generated 🎉
|
|
6
6
|
warn - You have enabled experimental feature (scrollRestoration) in next.config.js.
|
|
@@ -38,28 +38,28 @@ info - Generating static pages (7/7)
|
|
|
38
38
|
info - Finalizing page optimization...
|
|
39
39
|
|
|
40
40
|
Route (pages) Size First Load JS
|
|
41
|
-
┌ ● / 6.
|
|
41
|
+
┌ ● / 6.23 kB 133 kB
|
|
42
42
|
├ └ css/cf062feb79245123.css 8.38 kB
|
|
43
43
|
├ /_app 0 B 83.7 kB
|
|
44
|
-
├ ● /[...slug] 7.35 kB
|
|
44
|
+
├ ● /[...slug] 7.35 kB 145 kB
|
|
45
45
|
├ └ css/0dc997f9da3027b7.css 8.8 kB
|
|
46
|
-
├ ● /[slug]/p
|
|
47
|
-
├ └ css/
|
|
48
|
-
├ ○ /404 1.19 kB
|
|
49
|
-
├ ● /500 1.21 kB
|
|
50
|
-
├ ● /account 677 B
|
|
46
|
+
├ ● /[slug]/p 8.02 kB 135 kB
|
|
47
|
+
├ └ css/f2ab72459fcdabcc.css 5.4 kB
|
|
48
|
+
├ ○ /404 1.19 kB 128 kB
|
|
49
|
+
├ ● /500 1.21 kB 128 kB
|
|
50
|
+
├ ● /account 677 B 128 kB
|
|
51
51
|
├ λ /api/graphql 0 B 83.7 kB
|
|
52
52
|
├ λ /api/health/live 0 B 83.7 kB
|
|
53
53
|
├ λ /api/health/ready 0 B 83.7 kB
|
|
54
54
|
├ λ /api/preview 0 B 83.7 kB
|
|
55
|
-
├ ● /checkout 662 B
|
|
56
|
-
├ ● /login 1.14 kB
|
|
57
|
-
└ ● /s 1.38 kB
|
|
55
|
+
├ ● /checkout 662 B 128 kB
|
|
56
|
+
├ ● /login 1.14 kB 128 kB
|
|
57
|
+
└ ● /s 1.38 kB 139 kB
|
|
58
58
|
+ First Load JS shared by all 86.8 kB
|
|
59
59
|
├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
|
|
60
60
|
├ chunks/main-e4e873ee741162eb.js 24.2 kB
|
|
61
61
|
├ chunks/pages/_app-30b9666307e4b3b1.js 12.1 kB
|
|
62
|
-
├ chunks/webpack-
|
|
62
|
+
├ chunks/webpack-3382def1b25b17f8.js 2.23 kB
|
|
63
63
|
└ css/5d1f64b61ea581f4.css 3.05 kB
|
|
64
64
|
|
|
65
65
|
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
$ jest
|
|
2
|
-
PASS test/server/index.test.ts (21.
|
|
2
|
+
PASS test/server/index.test.ts (21.563 s)
|
|
3
3
|
FastStore GraphQL Layer
|
|
4
4
|
@faststore/api
|
|
5
|
-
✓ should return a valid GraphQL schema (
|
|
6
|
-
✓ should return a valid GraphQL schema contain all expected types (
|
|
5
|
+
✓ should return a valid GraphQL schema (11 ms)
|
|
6
|
+
✓ should return a valid GraphQL schema contain all expected types (6 ms)
|
|
7
7
|
✓ should return a valid GraphQL schema contain all expected queries (1 ms)
|
|
8
|
-
✓ should return a valid GraphQL schema contain all expected mutations
|
|
8
|
+
✓ should return a valid GraphQL schema contain all expected mutations
|
|
9
9
|
VTEX API Extension
|
|
10
|
-
✓ getTypeDefsFromFolder function should return an Array (
|
|
10
|
+
✓ getTypeDefsFromFolder function should return an Array (9 ms)
|
|
11
11
|
Third Party API Extension
|
|
12
|
-
✓ getTypeDefsFromFolder function should return an Array (
|
|
12
|
+
✓ getTypeDefsFromFolder function should return an Array (7 ms)
|
|
13
13
|
Final Schema after merging
|
|
14
|
-
✓ should return a valid merged GraphQL schema (
|
|
14
|
+
✓ should return a valid merged GraphQL schema (44 ms)
|
|
15
15
|
Envelop
|
|
16
|
-
✓ should exist with its plugins (
|
|
17
|
-
✓ should handle options and execute (
|
|
16
|
+
✓ should exist with its plugins (42 ms)
|
|
17
|
+
✓ should handle options and execute (133 ms)
|
|
18
18
|
|
|
19
19
|
Test Suites: 1 passed, 1 total
|
|
20
20
|
Tests: 9 passed, 9 total
|
|
21
21
|
Snapshots: 0 total
|
|
22
|
-
Time: 21.
|
|
22
|
+
Time: 21.631 s
|
|
23
23
|
Ran all test suites.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.58",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "vtex/faststore",
|
|
6
6
|
"browserslist": "supports es6-module and not dead",
|
|
@@ -123,5 +123,5 @@
|
|
|
123
123
|
"node": "18.19.0",
|
|
124
124
|
"yarn": "1.19.1"
|
|
125
125
|
},
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "c91481382943a5f0ac98414f4aa287179688a978"
|
|
127
127
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ProductTitle as UIProductTitle,
|
|
3
|
+
DiscountBadge as UIDiscountBadge,
|
|
4
|
+
BuyButton as UIBuyButton,
|
|
5
|
+
SkuSelector as UISkuSelector,
|
|
6
|
+
ShippingSimulation as UIShippingSimulation,
|
|
7
|
+
Icon as UIIcon,
|
|
8
|
+
Price as UIPrice,
|
|
9
|
+
QuantitySelector as UIQuantitySelector,
|
|
10
|
+
ImageGalleryViewer as UIImageGalleryViewer,
|
|
11
|
+
ImageGallery as UIImageGallery,
|
|
12
|
+
} from '@faststore/ui'
|
|
13
|
+
|
|
14
|
+
import LocalImageGallery from 'src/components/ui/ImageGallery'
|
|
15
|
+
import LocalShippingSimulation from 'src/components/ui/ShippingSimulation/ShippingSimulation'
|
|
16
|
+
import { Image } from 'src/components/ui/Image'
|
|
17
|
+
import LocalNotAvailableButton from 'src/components/product/NotAvailableButton'
|
|
18
|
+
|
|
19
|
+
export const ProductDetailsDefaultComponents = {
|
|
20
|
+
ProductTitle: UIProductTitle,
|
|
21
|
+
DiscountBadge: UIDiscountBadge,
|
|
22
|
+
BuyButton: UIBuyButton,
|
|
23
|
+
Icon: UIIcon,
|
|
24
|
+
Price: UIPrice,
|
|
25
|
+
QuantitySelector: UIQuantitySelector,
|
|
26
|
+
SkuSelector: UISkuSelector,
|
|
27
|
+
ShippingSimulation: UIShippingSimulation,
|
|
28
|
+
ImageGallery: UIImageGallery,
|
|
29
|
+
ImageGalleryViewer: UIImageGalleryViewer,
|
|
30
|
+
__experimentalImageGalleryImage: Image,
|
|
31
|
+
__experimentalImageGallery: LocalImageGallery,
|
|
32
|
+
__experimentalShippingSimulation: LocalShippingSimulation,
|
|
33
|
+
__experimentalNotAvailableButton: LocalNotAvailableButton,
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { override } from 'src/customizations/src/components/overrides/ProductDetails'
|
|
2
|
+
import { getOverriddenSection } from 'src/sdk/overrides/getOverriddenSection'
|
|
3
|
+
import type { SectionOverrideDefinition } from 'src/typings/overridesDefinition'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This component exists to support overrides 1.0
|
|
7
|
+
*
|
|
8
|
+
* This allows users to override the default ProductDetails section present in the Headless CMS
|
|
9
|
+
*/
|
|
10
|
+
export const OverriddenDefaultProductDetails = getOverriddenSection(
|
|
11
|
+
override as SectionOverrideDefinition<'ProductDetails'>
|
|
12
|
+
)
|
|
@@ -14,15 +14,8 @@ import { ProductDetailsSettings } from 'src/components/ui/ProductDetails'
|
|
|
14
14
|
|
|
15
15
|
import styles from './section.module.scss'
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
DiscountBadge,
|
|
19
|
-
ProductTitle,
|
|
20
|
-
__experimentalImageGallery as ImageGallery,
|
|
21
|
-
__experimentalShippingSimulation as ShippingSimulation,
|
|
22
|
-
__experimentalNotAvailableButton as NotAvailableButton,
|
|
23
|
-
} from 'src/components/sections/ProductDetails/Overrides'
|
|
24
|
-
|
|
25
17
|
import { usePDP } from 'src/sdk/overrides/PageProvider'
|
|
18
|
+
import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
|
|
26
19
|
|
|
27
20
|
export interface ProductDetailsProps {
|
|
28
21
|
productTitle: {
|
|
@@ -61,35 +54,29 @@ export interface ProductDetailsProps {
|
|
|
61
54
|
function ProductDetails({
|
|
62
55
|
productTitle: {
|
|
63
56
|
refNumber: showRefNumber,
|
|
64
|
-
discountBadge: {
|
|
65
|
-
showDiscountBadge,
|
|
66
|
-
size: discountBadgeSize = DiscountBadge.props.size,
|
|
67
|
-
},
|
|
57
|
+
discountBadge: { showDiscountBadge, size: discountBadgeSize },
|
|
68
58
|
},
|
|
69
59
|
buyButton: { icon: buyButtonIcon, title: buyButtonTitle },
|
|
70
60
|
shippingSimulator: {
|
|
71
|
-
title: shippingSimulatorTitle
|
|
72
|
-
inputLabel: shippingSimulatorInputLabel
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
shippingSimulatorOptionsTableTitle = ShippingSimulation.props
|
|
76
|
-
.optionsLabel,
|
|
77
|
-
link: {
|
|
78
|
-
to: shippingSimulatorLinkUrl = ShippingSimulation.props
|
|
79
|
-
.idkPostalCodeLinkProps?.href,
|
|
80
|
-
text: shippingSimulatorLinkText = ShippingSimulation.props
|
|
81
|
-
.idkPostalCodeLinkProps?.children,
|
|
82
|
-
},
|
|
61
|
+
title: shippingSimulatorTitle,
|
|
62
|
+
inputLabel: shippingSimulatorInputLabel,
|
|
63
|
+
shippingOptionsTableTitle: shippingSimulatorOptionsTableTitle,
|
|
64
|
+
link: { to: shippingSimulatorLinkUrl, text: shippingSimulatorLinkText },
|
|
83
65
|
},
|
|
84
66
|
productDescription: {
|
|
85
67
|
title: productDescriptionDetailsTitle,
|
|
86
68
|
initiallyExpanded: productDescriptionInitiallyExpanded,
|
|
87
69
|
displayDescription: shouldDisplayProductDescription,
|
|
88
70
|
},
|
|
89
|
-
notAvailableButton: {
|
|
90
|
-
title: notAvailableButtonTitle = NotAvailableButton.props.title,
|
|
91
|
-
},
|
|
71
|
+
notAvailableButton: { title: notAvailableButtonTitle },
|
|
92
72
|
}: ProductDetailsProps) {
|
|
73
|
+
const {
|
|
74
|
+
DiscountBadge,
|
|
75
|
+
ProductTitle,
|
|
76
|
+
__experimentalImageGallery: ImageGallery,
|
|
77
|
+
__experimentalShippingSimulation: ShippingSimulation,
|
|
78
|
+
__experimentalNotAvailableButton: NotAvailableButton,
|
|
79
|
+
} = useOverrideComponents<'ProductDetails'>()
|
|
93
80
|
const { currency } = useSession()
|
|
94
81
|
const [quantity, setQuantity] = useState(1)
|
|
95
82
|
const context = usePDP()
|
|
@@ -168,7 +155,7 @@ function ProductDetails({
|
|
|
168
155
|
showDiscountBadge && (
|
|
169
156
|
<DiscountBadge.Component
|
|
170
157
|
{...DiscountBadge.props}
|
|
171
|
-
size={discountBadgeSize}
|
|
158
|
+
size={discountBadgeSize ?? DiscountBadge.props.size}
|
|
172
159
|
// Dynamic props shouldn't be overridable
|
|
173
160
|
// This decision can be reviewed later if needed
|
|
174
161
|
listPrice={listPrice}
|
|
@@ -196,7 +183,9 @@ function ProductDetails({
|
|
|
196
183
|
quantity={quantity}
|
|
197
184
|
setQuantity={setQuantity}
|
|
198
185
|
buyButtonIcon={buyButtonIcon}
|
|
199
|
-
notAvailableButtonTitle={
|
|
186
|
+
notAvailableButtonTitle={
|
|
187
|
+
notAvailableButtonTitle ?? NotAvailableButton.props.title
|
|
188
|
+
}
|
|
200
189
|
/>
|
|
201
190
|
</section>
|
|
202
191
|
|
|
@@ -208,17 +197,27 @@ function ProductDetails({
|
|
|
208
197
|
{...ShippingSimulation.props}
|
|
209
198
|
idkPostalCodeLinkProps={{
|
|
210
199
|
...ShippingSimulation.props.idkPostalCodeLinkProps,
|
|
211
|
-
href:
|
|
212
|
-
|
|
200
|
+
href:
|
|
201
|
+
shippingSimulatorLinkUrl ??
|
|
202
|
+
ShippingSimulation.props.idkPostalCodeLinkProps?.href,
|
|
203
|
+
children:
|
|
204
|
+
shippingSimulatorLinkText ??
|
|
205
|
+
ShippingSimulation.props.idkPostalCodeLinkProps?.children,
|
|
213
206
|
}}
|
|
214
207
|
productShippingInfo={{
|
|
215
208
|
id,
|
|
216
209
|
quantity,
|
|
217
210
|
seller: seller.identifier,
|
|
218
211
|
}}
|
|
219
|
-
title={shippingSimulatorTitle}
|
|
220
|
-
inputLabel={
|
|
221
|
-
|
|
212
|
+
title={shippingSimulatorTitle ?? ShippingSimulation.props.title}
|
|
213
|
+
inputLabel={
|
|
214
|
+
shippingSimulatorInputLabel ??
|
|
215
|
+
ShippingSimulation.props.inputLabel
|
|
216
|
+
}
|
|
217
|
+
optionsLabel={
|
|
218
|
+
shippingSimulatorOptionsTableTitle ??
|
|
219
|
+
ShippingSimulation.props.optionsLabel
|
|
220
|
+
}
|
|
222
221
|
/>
|
|
223
222
|
)}
|
|
224
223
|
</section>
|
|
@@ -2,15 +2,13 @@ import { useEffect, useState } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import { useRouter } from 'next/router'
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
ImageGallery as ImageGalleryWrapper,
|
|
7
|
-
ImageGalleryViewer,
|
|
8
|
-
__experimentalImageGalleryImage as Image,
|
|
9
|
-
} from 'src/components/sections/ProductDetails/Overrides'
|
|
10
|
-
|
|
11
5
|
import type { ImageGalleryProps as UIImageGalleryProps } from '@faststore/ui'
|
|
6
|
+
import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
|
|
12
7
|
|
|
13
8
|
const ImageComponent = ({ url, alternateName }) => {
|
|
9
|
+
const { __experimentalImageGalleryImage: Image } =
|
|
10
|
+
useOverrideComponents<'ProductDetails'>()
|
|
11
|
+
|
|
14
12
|
return (
|
|
15
13
|
<Image.Component src={url} alt={alternateName} width={68} height={68} />
|
|
16
14
|
)
|
|
@@ -21,6 +19,12 @@ export interface ImageGalleryProps {
|
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
const ImageGallery = ({ images, ...otherProps }: ImageGalleryProps) => {
|
|
22
|
+
const {
|
|
23
|
+
ImageGallery: ImageGalleryWrapper,
|
|
24
|
+
ImageGalleryViewer,
|
|
25
|
+
__experimentalImageGalleryImage: Image,
|
|
26
|
+
} = useOverrideComponents<'ProductDetails'>()
|
|
27
|
+
|
|
24
28
|
const [selectedImageIdx, setSelectedImageIdx] = useState(0)
|
|
25
29
|
const currentImage = images[selectedImageIdx] ?? images[0]
|
|
26
30
|
const dynamicRoute = useRouter().asPath
|
|
@@ -9,13 +9,7 @@ import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice'
|
|
|
9
9
|
import Selectors from 'src/components/ui/SkuSelector'
|
|
10
10
|
import AddToCartLoadingSkeleton from './AddToCartLoadingSkeleton'
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
BuyButton,
|
|
14
|
-
Icon,
|
|
15
|
-
Price,
|
|
16
|
-
QuantitySelector,
|
|
17
|
-
__experimentalNotAvailableButton as NotAvailableButton,
|
|
18
|
-
} from 'src/components/sections/ProductDetails/Overrides'
|
|
12
|
+
import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
|
|
19
13
|
|
|
20
14
|
interface ProductDetailsSettingsProps {
|
|
21
15
|
product: ProductDetailsFragment_ProductFragment
|
|
@@ -36,12 +30,17 @@ function ProductDetailsSettings({
|
|
|
36
30
|
isValidating,
|
|
37
31
|
quantity,
|
|
38
32
|
setQuantity,
|
|
39
|
-
buyButtonIcon: {
|
|
40
|
-
icon: buyButtonIconName = Icon.props.name,
|
|
41
|
-
alt: buyButtonIconAlt = Icon.props['aria-label'],
|
|
42
|
-
},
|
|
33
|
+
buyButtonIcon: { icon: buyButtonIconName, alt: buyButtonIconAlt },
|
|
43
34
|
notAvailableButtonTitle,
|
|
44
35
|
}: ProductDetailsSettingsProps) {
|
|
36
|
+
const {
|
|
37
|
+
BuyButton,
|
|
38
|
+
Icon,
|
|
39
|
+
Price,
|
|
40
|
+
QuantitySelector,
|
|
41
|
+
__experimentalNotAvailableButton: NotAvailableButton,
|
|
42
|
+
} = useOverrideComponents<'ProductDetails'>()
|
|
43
|
+
|
|
45
44
|
const {
|
|
46
45
|
id,
|
|
47
46
|
sku,
|
|
@@ -96,8 +95,8 @@ function ProductDetailsSettings({
|
|
|
96
95
|
icon={
|
|
97
96
|
<Icon.Component
|
|
98
97
|
{...Icon.props}
|
|
99
|
-
name={buyButtonIconName}
|
|
100
|
-
aria-label={buyButtonIconAlt}
|
|
98
|
+
name={buyButtonIconName ?? Icon.props.name}
|
|
99
|
+
aria-label={buyButtonIconAlt ?? Icon.props['aria-label']}
|
|
101
100
|
/>
|
|
102
101
|
}
|
|
103
102
|
{...buyProps}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ShippingSimulationProps as UIShippingSimulationProps } from '@faststore/ui'
|
|
2
2
|
|
|
3
|
-
import { useSession } from 'src/sdk/session'
|
|
4
3
|
import { useShippingSimulation } from 'src/sdk/shipping/useShippingSimulation'
|
|
5
4
|
|
|
6
|
-
import {
|
|
5
|
+
import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
|
|
7
6
|
|
|
8
7
|
type ShippingSimulationOptionalProps =
|
|
9
8
|
| 'title'
|
|
@@ -31,6 +30,9 @@ export default function ShippingSimulation({
|
|
|
31
30
|
idkPostalCodeLinkProps,
|
|
32
31
|
...otherProps
|
|
33
32
|
}: ShippingSimulationProps) {
|
|
33
|
+
const { ShippingSimulation: ShippingSimulationWrapper } =
|
|
34
|
+
useOverrideComponents<'ProductDetails'>()
|
|
35
|
+
|
|
34
36
|
const {
|
|
35
37
|
input,
|
|
36
38
|
shippingSimulation,
|
|
@@ -4,7 +4,7 @@ import { SkuSelectorProps } from '@faststore/ui'
|
|
|
4
4
|
import NextLink from 'next/link'
|
|
5
5
|
import { Image } from '../Image'
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
|
|
8
8
|
|
|
9
9
|
export type SkuVariantsByName = Record<
|
|
10
10
|
string,
|
|
@@ -38,6 +38,8 @@ function Selectors({
|
|
|
38
38
|
availableVariations,
|
|
39
39
|
...otherProps
|
|
40
40
|
}: Props) {
|
|
41
|
+
const { SkuSelector } = useOverrideComponents<'ProductDetails'>()
|
|
42
|
+
|
|
41
43
|
return (
|
|
42
44
|
<section {...otherProps}>
|
|
43
45
|
{availableVariations &&
|
package/src/pages/[slug]/p.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import BannerNewsletter from 'src/components/sections/BannerNewsletter/BannerNew
|
|
|
15
15
|
import { OverriddenDefaultBannerText as BannerText } from 'src/components/sections/BannerText/OverriddenDefaultBannerText'
|
|
16
16
|
import Breadcrumb from 'src/components/sections/Breadcrumb'
|
|
17
17
|
import { OverriddenDefaultCrossSellingShelf as CrossSellingShelf } from 'src/components/sections/CrossSellingShelf/OverriddenDefaultCrossSellingShelf'
|
|
18
|
-
import ProductDetails from 'src/components/sections/ProductDetails'
|
|
18
|
+
import { OverriddenDefaultProductDetails as ProductDetails } from 'src/components/sections/ProductDetails/OverriddenDefaultProductDetails'
|
|
19
19
|
import CUSTOM_COMPONENTS from 'src/customizations/src/components'
|
|
20
20
|
import { useSession } from 'src/sdk/session'
|
|
21
21
|
import { mark } from 'src/sdk/tests/mark'
|
|
@@ -3,6 +3,7 @@ import BannerText from '../../components/sections/BannerText'
|
|
|
3
3
|
import Hero from '../../components/sections/Hero'
|
|
4
4
|
import ProductShelf from '../../components/sections/ProductShelf'
|
|
5
5
|
import CrossSellingShelf from '../../components/sections/CrossSellingShelf'
|
|
6
|
+
import ProductDetails from '../../components/sections/ProductDetails'
|
|
6
7
|
|
|
7
8
|
import type { DefaultSectionComponentsDefinitions } from '../../typings/overridesDefinition'
|
|
8
9
|
import type { SectionsOverrides } from '../../typings/overrides'
|
|
@@ -11,12 +12,14 @@ import { BannerTextDefaultComponents } from '../../components/sections/BannerTex
|
|
|
11
12
|
import { CrossSellingShelfDefaultComponents } from 'src/components/sections/CrossSellingShelf/DefaultComponents'
|
|
12
13
|
import { HeroDefaultComponents } from '../../components/sections/Hero/DefaultComponents'
|
|
13
14
|
import { ProductShelfDefaultComponents } from '../../components/sections/ProductShelf/DefaultComponents'
|
|
15
|
+
import { ProductDetailsDefaultComponents } from '../../components/sections/ProductDetails/DefaultComponents'
|
|
14
16
|
|
|
15
17
|
export const Sections = {
|
|
16
18
|
Alert,
|
|
17
19
|
BannerText,
|
|
18
20
|
CrossSellingShelf,
|
|
19
21
|
Hero,
|
|
22
|
+
ProductDetails,
|
|
20
23
|
ProductShelf,
|
|
21
24
|
}
|
|
22
25
|
|
|
@@ -28,7 +31,8 @@ export const DefaultComponents: Partial<
|
|
|
28
31
|
> = {
|
|
29
32
|
Alert: AlertDefaultComponents,
|
|
30
33
|
BannerText: BannerTextDefaultComponents,
|
|
34
|
+
CrossSellingShelf: CrossSellingShelfDefaultComponents,
|
|
31
35
|
Hero: HeroDefaultComponents,
|
|
36
|
+
ProductDetails: ProductDetailsDefaultComponents,
|
|
32
37
|
ProductShelf: ProductShelfDefaultComponents,
|
|
33
|
-
CrossSellingShelf: CrossSellingShelfDefaultComponents,
|
|
34
38
|
}
|
package/src/typings/overrides.ts
CHANGED
|
@@ -49,7 +49,7 @@ export type SectionOverride = {
|
|
|
49
49
|
/** TODO: every use of this type should be replaced by SectionsOverrides after all sections are supported */
|
|
50
50
|
export type SupportedSectionsOverridesV2 = Pick<
|
|
51
51
|
SectionsOverrides,
|
|
52
|
-
'Alert' | 'BannerText' | 'CrossSellingShelf' | 'Hero' | 'ProductShelf'
|
|
52
|
+
'Alert' | 'BannerText' | 'CrossSellingShelf' | 'Hero' | 'ProductShelf' | 'ProductDetails'
|
|
53
53
|
>
|
|
54
54
|
|
|
55
55
|
/**
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.id = 693;
|
|
3
|
-
exports.ids = [693];
|
|
4
|
-
exports.modules = {
|
|
5
|
-
|
|
6
|
-
/***/ 6693:
|
|
7
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
|
-
|
|
9
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10
|
-
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
11
|
-
/* harmony export */ });
|
|
12
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
13
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
14
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7041);
|
|
15
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2614);
|
|
16
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2256);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const QuantitySelector = ({ max, min = 1, initial, disabled = false, onChange, testId = 'fs-quantity-selector', ...otherProps }) => {
|
|
20
|
-
const [quantity, setQuantity] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initial ?? min);
|
|
21
|
-
const isLeftDisabled = quantity === min;
|
|
22
|
-
const isRightDisabled = quantity === max;
|
|
23
|
-
const changeQuantity = (increaseValue) => {
|
|
24
|
-
const quantityValue = validateQuantityBounds(quantity + increaseValue);
|
|
25
|
-
onChange?.(quantityValue);
|
|
26
|
-
setQuantity(quantityValue);
|
|
27
|
-
};
|
|
28
|
-
const increase = () => changeQuantity(1);
|
|
29
|
-
const decrease = () => changeQuantity(-1);
|
|
30
|
-
function validateQuantityBounds(n) {
|
|
31
|
-
const maxValue = min ? Math.max(n, min) : n;
|
|
32
|
-
return max ? Math.min(maxValue, max) : maxValue;
|
|
33
|
-
}
|
|
34
|
-
function validateInput(e) {
|
|
35
|
-
const val = e.currentTarget.value;
|
|
36
|
-
if (!Number.isNaN(Number(val))) {
|
|
37
|
-
setQuantity(() => {
|
|
38
|
-
const quantityValue = validateQuantityBounds(Number(val));
|
|
39
|
-
onChange?.(quantityValue);
|
|
40
|
-
return quantityValue;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
45
|
-
initial && setQuantity(initial);
|
|
46
|
-
}, [initial]);
|
|
47
|
-
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { "data-fs-quantity-selector": disabled ? 'disabled' : 'true', "data-testid": testId, ...otherProps },
|
|
48
|
-
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, { "data-quantity-selector-button": "left", icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, { name: "Minus", width: 16, height: 16, weight: "bold" }), "aria-label": "Decrement Quantity", "aria-controls": "quantity-selector-input", disabled: isLeftDisabled || disabled, onClick: decrease, testId: `${testId}-left-button`, size: "small" }),
|
|
49
|
-
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, { "data-quantity-selector-input": true, id: "quantity-selector-input", "aria-label": "Quantity", value: quantity, onChange: validateInput, disabled: disabled }),
|
|
50
|
-
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, { "data-quantity-selector-button": "right", "aria-controls": "quantity-selector-input", "aria-label": "Increment Quantity", disabled: isRightDisabled || disabled, icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, { name: "Plus", width: 16, height: 16, weight: "bold" }), onClick: increase, testId: `${testId}-right-button`, size: "small" })));
|
|
51
|
-
};
|
|
52
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (QuantitySelector);
|
|
53
|
-
//# sourceMappingURL=QuantitySelector.js.map
|
|
54
|
-
|
|
55
|
-
/***/ })
|
|
56
|
-
|
|
57
|
-
};
|
|
58
|
-
;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.id = 779;
|
|
3
|
-
exports.ids = [779];
|
|
4
|
-
exports.modules = {
|
|
5
|
-
|
|
6
|
-
/***/ 1953:
|
|
7
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
|
-
|
|
9
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10
|
-
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
11
|
-
/* harmony export */ });
|
|
12
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
13
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
14
|
-
|
|
15
|
-
const Label = (0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function Label({ testId = 'fs-label', children, ...otherProps }, ref) {
|
|
16
|
-
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("label", { ref: ref, "data-fs-label": true, "data-testid": testId, ...otherProps }, children));
|
|
17
|
-
});
|
|
18
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Label);
|
|
19
|
-
//# sourceMappingURL=Label.js.map
|
|
20
|
-
|
|
21
|
-
/***/ }),
|
|
22
|
-
|
|
23
|
-
/***/ 3779:
|
|
24
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
25
|
-
|
|
26
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
28
|
-
/* harmony export */ });
|
|
29
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
30
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
31
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2256);
|
|
32
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1953);
|
|
33
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7041);
|
|
34
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2614);
|
|
35
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3339);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const InputField = ({ id, label, type = 'text', error, displayClearButton, actionable, buttonActionText = 'Apply', onSubmit, onClear, placeholder = ' ', // initializes with an empty space to style float label using `placeholder-shown`
|
|
39
|
-
inputRef, disabled, value, testId = 'fs-input-field', ...otherProps }) => {
|
|
40
|
-
const shouldDisplayError = !disabled && error && error !== '';
|
|
41
|
-
const shouldDisplayButton = actionable && !disabled && value !== '';
|
|
42
|
-
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { "data-fs-input-field": true, "data-fs-input-field-actionable": actionable, "data-fs-input-field-error": error && error !== '', "data-testid": testId },
|
|
43
|
-
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, { id: id, type: type, value: value, ref: inputRef, disabled: disabled, placeholder: placeholder, ...otherProps }),
|
|
44
|
-
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, { htmlFor: id }, label),
|
|
45
|
-
shouldDisplayButton &&
|
|
46
|
-
(displayClearButton || error ? (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, { size: "small", "aria-label": "Clear Field", icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, { name: "XCircle" }), onClick: () => {
|
|
47
|
-
onClear?.();
|
|
48
|
-
inputRef?.current?.focus();
|
|
49
|
-
} })) : (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { variant: "tertiary", size: "small", onClick: onSubmit }, buttonActionText))),
|
|
50
|
-
shouldDisplayError && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", { "data-fs-input-field-error-message": true }, error))));
|
|
51
|
-
};
|
|
52
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (InputField);
|
|
53
|
-
//# sourceMappingURL=InputField.js.map
|
|
54
|
-
|
|
55
|
-
/***/ })
|
|
56
|
-
|
|
57
|
-
};
|
|
58
|
-
;
|