@@ -11,11 +11,22 @@ import Section from '../Section'
11
11
12
12
import styles from './section.module.scss'
13
13
14
+ import storeConfig from 'discovery.config'
14
15
import { getOverridableSection } from '../../../sdk/overrides/getOverriddenSection'
15
16
import { useOverrideComponents } from '../../../sdk/overrides/OverrideContext'
16
17
import { usePDP } from '../../../sdk/overrides/PageProvider'
17
18
import { ProductDetailsDefaultComponents } from './DefaultComponents'
18
19
20
+ type StoreConfig = typeof storeConfig & {
21
+ experimental : {
22
+ revalidate ?: number
23
+ enableClientOffer ?: boolean
24
+ }
25
+ }
26
+
27
+ const isClientOfferEnabled = ( storeConfig as StoreConfig ) . experimental
28
+ . enableClientOffer
29
+
19
30
export interface ProductDetailsProps {
20
31
productTitle : {
21
32
refNumber : boolean
@@ -214,82 +225,77 @@ function ProductDetails({
214
225
{ ...ImageGallery . props }
215
226
images = { productImages }
216
227
/>
217
- < section data-fs-product-details-info >
218
- < section
219
- data-fs-product-details-settings
220
- data-fs-product-details-section
221
- >
222
- < ProductDetailsSettings . Component
223
- buyButtonTitle = { buyButtonTitle }
224
- buyButtonIcon = { buyButtonIcon }
225
- notAvailableButtonTitle = {
226
- notAvailableButtonTitle ?? NotAvailableButton . props . title
227
- }
228
- useUnitMultiplier = { quantitySelector ?. useUnitMultiplier ?? false }
229
- { ...ProductDetailsSettings . props }
230
- // Dynamic props shouldn't be overridable
231
- // This decision can be reviewed later if needed
232
- quantity = { quantity }
233
- setQuantity = { setQuantity }
234
- product = { product }
235
- isValidating = { isValidating }
236
- taxesConfiguration = { taxesConfiguration }
237
- />
238
-
239
- { skuMatrix ?. shouldDisplaySKUMatrix &&
240
- Object . keys ( slugsMap ) . length > 1 && (
241
- < >
242
- < div data-fs-product-details-settings-separator >
243
- { skuMatrix . separatorButtonsText }
244
- </ div >
245
-
246
- < SKUMatrix . Component >
247
- < SKUMatrixTrigger . Component disabled = { isValidating } >
248
- { skuMatrix . triggerButtonLabel }
249
- </ SKUMatrixTrigger . Component >
250
228
251
- < SKUMatrixSidebar . Component
252
- formatter = { useFormattedPrice }
253
- columns = { skuMatrix . columns }
254
- overlayProps = { { className : styles . section } }
255
- />
256
- </ SKUMatrix . Component >
257
- </ >
258
- ) }
229
+ { isClientOfferEnabled && isValidating ? (
230
+ < section data-fs-product-details-info >
231
+ < section
232
+ data-fs-product-details-settings
233
+ data-fs-product-details-section
234
+ >
235
+ < p > Loading... </ p >
236
+ </ section >
259
237
</ section >
260
-
261
- { ! outOfStock && (
262
- < ShippingSimulation . Component
238
+ ) : (
239
+ < section data-fs-product-details-info >
240
+ < section
241
+ data-fs-product-details-settings
263
242
data-fs-product-details-section
264
- data-fs-product-details-shipping
265
- formatter = { useFormattedPrice }
266
- { ...ShippingSimulation . props }
267
- idkPostalCodeLinkProps = { {
268
- ...ShippingSimulation . props . idkPostalCodeLinkProps ,
269
- href :
270
- shippingSimulatorLinkUrl ??
271
- ShippingSimulation . props . idkPostalCodeLinkProps ?. href ,
272
- children :
273
- shippingSimulatorLinkText ??
274
- ShippingSimulation . props . idkPostalCodeLinkProps ?. children ,
275
- } }
276
- productShippingInfo = { {
277
- id,
278
- quantity,
279
- seller : seller . identifier ,
280
- } }
281
- title = { shippingSimulatorTitle ?? ShippingSimulation . props . title }
282
- inputLabel = {
283
- shippingSimulatorInputLabel ??
284
- ShippingSimulation . props . inputLabel
285
- }
286
- optionsLabel = {
287
- shippingSimulatorOptionsTableTitle ??
288
- ShippingSimulation . props . optionsLabel
289
- }
290
- />
291
- ) }
292
- </ section >
243
+ >
244
+ < ProductDetailsSettings . Component
245
+ buyButtonTitle = { buyButtonTitle }
246
+ buyButtonIcon = { buyButtonIcon }
247
+ notAvailableButtonTitle = {
248
+ notAvailableButtonTitle ?? NotAvailableButton . props . title
249
+ }
250
+ useUnitMultiplier = {
251
+ quantitySelector ?. useUnitMultiplier ?? false
252
+ }
253
+ { ...ProductDetailsSettings . props }
254
+ // Dynamic props shouldn't be overridable
255
+ // This decision can be reviewed later if needed
256
+ quantity = { quantity }
257
+ setQuantity = { setQuantity }
258
+ product = { product }
259
+ isValidating = { isValidating }
260
+ taxesConfiguration = { taxesConfiguration }
261
+ />
262
+ </ section >
263
+
264
+ { ! outOfStock && (
265
+ < ShippingSimulation . Component
266
+ data-fs-product-details-section
267
+ data-fs-product-details-shipping
268
+ formatter = { useFormattedPrice }
269
+ { ...ShippingSimulation . props }
270
+ idkPostalCodeLinkProps = { {
271
+ ...ShippingSimulation . props . idkPostalCodeLinkProps ,
272
+ href :
273
+ shippingSimulatorLinkUrl ??
274
+ ShippingSimulation . props . idkPostalCodeLinkProps ?. href ,
275
+ children :
276
+ shippingSimulatorLinkText ??
277
+ ShippingSimulation . props . idkPostalCodeLinkProps ?. children ,
278
+ } }
279
+ productShippingInfo = { {
280
+ id,
281
+ quantity,
282
+ seller : seller . identifier ,
283
+ } }
284
+ title = {
285
+ shippingSimulatorTitle ?? ShippingSimulation . props . title
286
+ }
287
+ inputLabel = {
288
+ shippingSimulatorInputLabel ??
289
+ ShippingSimulation . props . inputLabel
290
+ }
291
+ optionsLabel = {
292
+ shippingSimulatorOptionsTableTitle ??
293
+ ShippingSimulation . props . optionsLabel
294
+ }
295
+ />
296
+ ) }
297
+ </ section >
298
+ ) }
293
299
294
300
{ shouldDisplayProductDescription && (
295
301
< ProductDescription . Component
0 commit comments