@faststore/core 2.1.0 → 2.1.3

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 (99) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +43 -43
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/config.json +7 -0
  5. package/.next/cache/eslint/.cache_1gneedd +1 -0
  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 +5 -5
  14. package/.next/required-server-files.json +1 -1
  15. package/.next/routes-manifest.json +1 -1
  16. package/.next/server/chunks/184.js +61 -0
  17. package/.next/server/chunks/205.js +1 -1
  18. package/.next/server/chunks/{280.js → 269.js} +233 -41
  19. package/.next/server/chunks/289.js +22 -9
  20. package/.next/server/chunks/350.js +1 -1
  21. package/.next/server/chunks/378.js +6 -6
  22. package/.next/server/chunks/74.js +54 -3
  23. package/.next/server/chunks/907.js +334 -180
  24. package/.next/server/middleware-build-manifest.js +1 -1
  25. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  26. package/.next/server/pages/404.js +0 -7
  27. package/.next/server/pages/404.js.nft.json +1 -1
  28. package/.next/server/pages/500.js +0 -7
  29. package/.next/server/pages/500.js.nft.json +1 -1
  30. package/.next/server/pages/[...slug].js +1 -9
  31. package/.next/server/pages/[...slug].js.nft.json +1 -1
  32. package/.next/server/pages/[slug]/p.js +948 -907
  33. package/.next/server/pages/[slug]/p.js.nft.json +1 -1
  34. package/.next/server/pages/_app.js.nft.json +1 -1
  35. package/.next/server/pages/_document.js.nft.json +1 -1
  36. package/.next/server/pages/_error.js.nft.json +1 -1
  37. package/.next/server/pages/account.js +0 -7
  38. package/.next/server/pages/account.js.nft.json +1 -1
  39. package/.next/server/pages/api/graphql.js +1 -1
  40. package/.next/server/pages/checkout.js +0 -7
  41. package/.next/server/pages/checkout.js.nft.json +1 -1
  42. package/.next/server/pages/en-US/404.html +2 -2
  43. package/.next/server/pages/en-US/500.html +2 -2
  44. package/.next/server/pages/en-US/account.html +2 -2
  45. package/.next/server/pages/en-US/checkout.html +2 -2
  46. package/.next/server/pages/en-US/login.html +2 -2
  47. package/.next/server/pages/en-US/s.html +2 -2
  48. package/.next/server/pages/en-US.html +2 -2
  49. package/.next/server/pages/index.js +1 -9
  50. package/.next/server/pages/index.js.nft.json +1 -1
  51. package/.next/server/pages/login.js +0 -7
  52. package/.next/server/pages/login.js.nft.json +1 -1
  53. package/.next/server/pages/s.js +1 -8
  54. package/.next/server/pages/s.js.nft.json +1 -1
  55. package/.next/server/pages-manifest.json +4 -4
  56. package/.next/static/chunks/64.7ea3677ac3a10e00.js +1 -0
  57. package/.next/static/chunks/{682-dc059ce3e47eb9e1.js → 682-5cfea9ed52851ed1.js} +1 -1
  58. package/.next/static/chunks/738-a5ff304828f20cbf.js +1 -0
  59. package/.next/static/chunks/791-727eda8f766aa791.js +1 -0
  60. package/.next/static/chunks/pages/{404-e7a1846b72ad3430.js → 404-c3b320b915df45bb.js} +1 -1
  61. package/.next/static/chunks/pages/{500-0f4d738fa1caac78.js → 500-d37a3a2e931f6995.js} +1 -1
  62. package/.next/static/chunks/pages/[...slug]-d4e0a671c6248369.js +1 -0
  63. package/.next/static/chunks/pages/[slug]/p-2ad8b84fd5d98814.js +1 -0
  64. package/.next/static/chunks/pages/{account-bbe1795b8566f75a.js → account-86a1b6e7db03bab6.js} +1 -1
  65. package/.next/static/chunks/pages/{checkout-4321004c6cdaf5c7.js → checkout-c77dbc66c0b35ec3.js} +1 -1
  66. package/.next/static/chunks/pages/{index-949a5393471484d5.js → index-2912eeade1da43bf.js} +1 -1
  67. package/.next/static/chunks/pages/{login-b09e2dd0941c8882.js → login-bbf85bc59afce37c.js} +1 -1
  68. package/.next/static/chunks/pages/{s-e603b0c6e5eef0a7.js → s-dd486933e8ba7fbf.js} +1 -1
  69. package/.next/static/chunks/webpack-c5cf5350bcb7f6f4.js +1 -0
  70. package/.next/static/css/{8988ac07eb0af0ca.css → 0f8ce5203de8ae6f.css} +1 -1
  71. package/.next/static/hHM-WaPbC6D9MU3Qh2tZ1/_buildManifest.js +1 -0
  72. package/.next/trace +72 -72
  73. package/.turbo/turbo-build.log +14 -8
  74. package/.turbo/turbo-lint.log +2 -0
  75. package/package.json +8 -8
  76. package/src/components/product/ProductGrid/ProductGrid.tsx +22 -6
  77. package/src/components/search/Filter/Filter.tsx +12 -3
  78. package/src/components/sections/ProductDetails/Overrides.tsx +38 -2
  79. package/src/components/sections/ProductDetails/ProductDetails.tsx +45 -16
  80. package/src/components/sections/ProductDetails/section.module.scss +1 -0
  81. package/src/components/sections/ProductGallery/Overrides.tsx +52 -0
  82. package/src/components/ui/ImageGallery/ImageGallery.tsx +25 -14
  83. package/src/components/ui/ProductDetails/ProductDetailsSettings.tsx +32 -18
  84. package/src/components/ui/ProductGallery/ProductGallery.tsx +77 -37
  85. package/src/components/ui/ProductShelf/ProductShelf.tsx +1 -1
  86. package/src/components/ui/ShippingSimulation/ShippingSimulation.tsx +1 -2
  87. package/src/customizations/components/overrides/ProductDetails.tsx +15 -1
  88. package/src/customizations/components/overrides/ProductGallery.tsx +24 -0
  89. package/src/typings/overrides.d.ts +23 -0
  90. package/.next/cache/eslint/.cache_abdhua +0 -1
  91. package/.next/server/chunks/368.js +0 -253
  92. package/.next/static/chunks/21-5b0c50a44b0ed6ce.js +0 -1
  93. package/.next/static/chunks/460-08f41a79ff49f7be.js +0 -1
  94. package/.next/static/chunks/64.ebbe1d2b40f980c7.js +0 -1
  95. package/.next/static/chunks/pages/[...slug]-119a323292c7e3af.js +0 -1
  96. package/.next/static/chunks/pages/[slug]/p-3c424924080d88cb.js +0 -1
  97. package/.next/static/chunks/webpack-9ba6546d294eb768.js +0 -1
  98. package/.next/static/eLm2Cd_zypP0KQaj5UlQ2/_buildManifest.js +0 -1
  99. /package/.next/static/{eLm2Cd_zypP0KQaj5UlQ2 → hHM-WaPbC6D9MU3Qh2tZ1}/_ssgManifest.js +0 -0
@@ -236,14 +236,15 @@ __webpack_async_result__();
236
236
 
237
237
  /***/ }),
238
238
 
239
- /***/ 32449:
239
+ /***/ 27534:
240
240
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
241
241
 
242
242
  "use strict";
243
243
 
244
244
  // EXPORTS
245
245
  __webpack_require__.d(__webpack_exports__, {
246
- "z": () => (/* binding */ Components)
246
+ "z": () => (/* binding */ Components),
247
+ "x": () => (/* binding */ productDetailsPropsCustomization)
247
248
  });
248
249
 
249
250
  // EXTERNAL MODULE: external "react"
@@ -280,6 +281,12 @@ function BuyButton({ testId = 'fs-buy-button', icon, children, ...otherProps })
280
281
  }
281
282
  /* harmony default export */ const BuyButton_BuyButton = (BuyButton);
282
283
  //# sourceMappingURL=BuyButton.js.map
284
+ // EXTERNAL MODULE: ../components/dist/atoms/Icon/Icon.js
285
+ var Icon = __webpack_require__(25045);
286
+ // EXTERNAL MODULE: ../components/dist/atoms/Price/Price.js
287
+ var Price = __webpack_require__(57549);
288
+ // EXTERNAL MODULE: ../components/dist/molecules/QuantitySelector/QuantitySelector.js
289
+ var QuantitySelector = __webpack_require__(60123);
283
290
  // EXTERNAL MODULE: ../components/dist/atoms/Label/Label.js
284
291
  var Label = __webpack_require__(57216);
285
292
  // EXTERNAL MODULE: ../components/dist/atoms/Link/Link.js
@@ -372,8 +379,6 @@ const SkuSelector = (0,external_react_.forwardRef)(function SkuSelector({ availa
372
379
  //# sourceMappingURL=SkuSelector.js.map
373
380
  // EXTERNAL MODULE: ../components/dist/molecules/InputField/InputField.js
374
381
  var InputField = __webpack_require__(28287);
375
- // EXTERNAL MODULE: ../components/dist/atoms/Icon/Icon.js
376
- var Icon = __webpack_require__(25045);
377
382
  ;// CONCATENATED MODULE: ../components/dist/molecules/Table/Table.js
378
383
 
379
384
  const Table = (0,external_react_.forwardRef)(function Table({ children, variant = 'colored', testId = 'fs-table', ...otherProps }, ref) {
@@ -404,8 +409,6 @@ const TableCell = (0,external_react_.forwardRef)(function TableCell({ scope, ali
404
409
  });
405
410
  /* harmony default export */ const Table_TableCell = (TableCell);
406
411
  //# sourceMappingURL=TableCell.js.map
407
- // EXTERNAL MODULE: ../components/dist/atoms/Price/Price.js
408
- var Price = __webpack_require__(57549);
409
412
  ;// CONCATENATED MODULE: ../components/dist/organisms/ShippingSimulation/ShippingSimulation.js
410
413
 
411
414
 
@@ -429,286 +432,10 @@ function ShippingSimulation({ testId = 'fs-shipping-simulation', formatter, titl
429
432
  }
430
433
  /* harmony default export */ const ShippingSimulation_ShippingSimulation = (ShippingSimulation);
431
434
  //# sourceMappingURL=ShippingSimulation.js.map
432
- ;// CONCATENATED MODULE: ./src/customizations/components/overrides/ProductDetails.tsx
433
- // This is an example of how it can be used on the starter.
434
- const SECTION = 'ProductDetails';
435
- const overrides = {
436
- name: SECTION,
437
- components: {}
438
- };
439
- /* harmony default export */ const ProductDetails = (overrides);
440
- ;// CONCATENATED MODULE: ./src/components/sections/ProductDetails/Overrides.tsx
441
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
442
-
443
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
444
-
445
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
446
-
447
-
448
-
449
-
450
- const Components = _objectSpread({
451
- ProductTitle: ProductTitle_ProductTitle,
452
- DiscountBadge: DiscountBadge/* default */.Z,
453
- BuyButton: BuyButton_BuyButton,
454
- SkuSelector: SkuSelector_SkuSelector,
455
- ShippingSimulation: ShippingSimulation_ShippingSimulation
456
- }, ProductDetails.components);
457
-
458
-
459
-
460
- /***/ }),
461
-
462
- /***/ 81644:
463
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
464
-
465
- "use strict";
466
- __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
467
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
468
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
469
- /* harmony export */ });
470
- /* unused harmony export fragment */
471
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689);
472
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
473
- /* harmony import */ var _faststore_sdk__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(71072);
474
- /* harmony import */ var src_sdk_session__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(97295);
475
- /* harmony import */ var src_sdk_product_useProduct__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(63874);
476
- /* harmony import */ var src_sdk_product_useFormattedPrice__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(95346);
477
- /* harmony import */ var _Section__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(57067);
478
- /* harmony import */ var src_components_product_OutOfStock__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(40492);
479
- /* harmony import */ var src_components_ui_ImageGallery__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(75693);
480
- /* harmony import */ var src_components_ui_ShippingSimulation__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(77281);
481
- /* harmony import */ var src_components_ui_ProductDescription__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(90509);
482
- /* harmony import */ var src_components_ui_ProductDetails__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(33183);
483
- /* harmony import */ var _section_module_scss__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(79034);
484
- /* harmony import */ var _section_module_scss__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_section_module_scss__WEBPACK_IMPORTED_MODULE_13__);
485
- /* harmony import */ var src_components_sections_ProductDetails_Overrides__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(32449);
486
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(20997);
487
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__);
488
- var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([src_sdk_product_useProduct__WEBPACK_IMPORTED_MODULE_2__]);
489
- src_sdk_product_useProduct__WEBPACK_IMPORTED_MODULE_2__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
490
-
491
-
492
-
493
-
494
-
495
-
496
-
497
-
498
-
499
-
500
-
501
-
502
-
503
-
504
-
505
- const {
506
- ProductTitle,
507
- DiscountBadge
508
- } = src_components_sections_ProductDetails_Overrides__WEBPACK_IMPORTED_MODULE_10__/* .Components */ .z;
509
-
510
- function ProductDetails({
511
- context: staleProduct,
512
- productTitle: {
513
- refNumber: showRefNumber,
514
- discountBadge: {
515
- showDiscountBadge,
516
- size: discountBadgeSize
517
- }
518
- },
519
- buyButton: {
520
- icon: buyButtonIcon,
521
- title: buyButtonTitle
522
- },
523
- shippingSimulator: {
524
- title: shippingSimulatorTitle,
525
- inputLabel: shippingSimulatorInputLabel,
526
- shippingOptionsTableTitle: shippingSimulatorOptionsTableTitle,
527
- link: {
528
- to: shippingSimulatorLinkUrl,
529
- text: shippingSimulatorLinkText
530
- }
531
- },
532
- productDescription: {
533
- title: productDescriptionDetailsTitle,
534
- initiallyExpanded: productDescriptionInitiallyExpanded,
535
- displayDescription: shouldDisplayProductDescription
536
- }
537
- }) {
538
- const {
539
- currency
540
- } = (0,src_sdk_session__WEBPACK_IMPORTED_MODULE_1__/* .useSession */ .kP)();
541
- const {
542
- 0: quantity,
543
- 1: setQuantity
544
- } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(1); // Stale while revalidate the product for fetching the new price etc
545
-
546
- const {
547
- data,
548
- isValidating
549
- } = (0,src_sdk_product_useProduct__WEBPACK_IMPORTED_MODULE_2__/* .useProduct */ .i)(staleProduct.id, {
550
- product: staleProduct
551
- });
552
-
553
- if (!data) {
554
- throw new Error('NotFound');
555
- }
556
-
557
- const {
558
- product: {
559
- id,
560
- sku,
561
- gtin,
562
- name: variantName,
563
- brand,
564
- isVariantOf,
565
- description,
566
- isVariantOf: {
567
- name,
568
- productGroupID: productId
569
- },
570
- image: productImages,
571
- offers: {
572
- offers: [{
573
- availability,
574
- price,
575
- listPrice,
576
- seller
577
- }],
578
- lowPrice
579
- }
580
- }
581
- } = data;
582
- (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
583
- (0,_faststore_sdk__WEBPACK_IMPORTED_MODULE_12__/* .sendAnalyticsEvent */ ._)({
584
- name: 'view_item',
585
- params: {
586
- currency: currency.code,
587
- value: price,
588
- items: [{
589
- item_id: isVariantOf.productGroupID,
590
- item_name: isVariantOf.name,
591
- item_brand: brand.name,
592
- item_variant: sku,
593
- price,
594
- discount: listPrice - price,
595
- currency: currency.code,
596
- item_variant_name: variantName,
597
- product_reference_id: gtin
598
- }]
599
- }
600
- });
601
- }, [isVariantOf.productGroupID, isVariantOf.name, brand.name, sku, price, listPrice, currency.code, variantName, gtin]);
602
- return /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx(_Section__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
603
- className: `${(_section_module_scss__WEBPACK_IMPORTED_MODULE_13___default().section)} section-product-details layout__content layout__section`,
604
- children: /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx("section", {
605
- "data-fs-product-details": true,
606
- children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("section", {
607
- "data-fs-product-details-body": true,
608
- children: [/*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx("header", {
609
- "data-fs-product-details-title": true,
610
- "data-fs-product-details-section": true,
611
- children: /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx(ProductTitle, {
612
- title: /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx("h1", {
613
- children: name
614
- }),
615
- label: showDiscountBadge && /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx(DiscountBadge, {
616
- listPrice: listPrice,
617
- spotPrice: lowPrice,
618
- size: discountBadgeSize
619
- }),
620
- refNumber: showRefNumber && productId
621
- })
622
- }), /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx(src_components_ui_ImageGallery__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
623
- "data-fs-product-details-gallery": true,
624
- images: productImages
625
- }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("section", {
626
- "data-fs-product-details-info": true,
627
- children: [/*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx("section", {
628
- "data-fs-product-details-settings": true,
629
- "data-fs-product-details-section": true,
630
- children: availability ? /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx(src_components_ui_ProductDetails__WEBPACK_IMPORTED_MODULE_9__/* .ProductDetailsSettings */ .m, {
631
- product: data.product,
632
- isValidating: isValidating,
633
- buyButtonTitle: buyButtonTitle,
634
- quantity: quantity,
635
- setQuantity: setQuantity,
636
- buyButtonIcon: buyButtonIcon
637
- }) : /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx(src_components_product_OutOfStock__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {})
638
- }), availability && /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx(src_components_ui_ShippingSimulation__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, {
639
- "data-fs-product-details-section": true,
640
- "data-fs-product-details-shipping": true,
641
- productShippingInfo: {
642
- id,
643
- quantity,
644
- seller: seller.identifier
645
- },
646
- formatter: src_sdk_product_useFormattedPrice__WEBPACK_IMPORTED_MODULE_3__/* .useFormattedPrice */ .P,
647
- title: shippingSimulatorTitle,
648
- inputLabel: shippingSimulatorInputLabel,
649
- idkPostalCodeLinkProps: {
650
- href: shippingSimulatorLinkUrl,
651
- children: shippingSimulatorLinkText
652
- },
653
- optionsLabel: shippingSimulatorOptionsTableTitle
654
- })]
655
- }), shouldDisplayProductDescription && /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx(src_components_ui_ProductDescription__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, {
656
- initiallyExpanded: productDescriptionInitiallyExpanded,
657
- descriptionData: [{
658
- title: productDescriptionDetailsTitle,
659
- content: description
660
- }]
661
- })]
662
- })
663
- })
664
- });
665
- }
666
-
667
- const fragment = "unknown";
668
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ProductDetails);
669
- __webpack_async_result__();
670
- } catch(e) { __webpack_async_result__(e); } });
671
-
672
- /***/ }),
673
-
674
- /***/ 93220:
675
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
676
-
677
- "use strict";
678
- __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
679
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
680
- /* harmony export */ "Z": () => (/* reexport safe */ _ProductDetails__WEBPACK_IMPORTED_MODULE_0__.Z)
681
- /* harmony export */ });
682
- /* harmony import */ var _ProductDetails__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81644);
683
- var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_ProductDetails__WEBPACK_IMPORTED_MODULE_0__]);
684
- _ProductDetails__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
685
-
686
- __webpack_async_result__();
687
- } catch(e) { __webpack_async_result__(e); } });
688
-
689
- /***/ }),
690
-
691
- /***/ 75693:
692
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
693
-
694
- "use strict";
695
-
696
- // EXPORTS
697
- __webpack_require__.d(__webpack_exports__, {
698
- "Z": () => (/* reexport */ ui_ImageGallery_ImageGallery)
699
- });
700
-
701
- // EXTERNAL MODULE: external "react"
702
- var external_react_ = __webpack_require__(16689);
703
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
704
435
  // EXTERNAL MODULE: external "react-intersection-observer"
705
436
  var external_react_intersection_observer_ = __webpack_require__(19785);
706
437
  // EXTERNAL MODULE: ../components/dist/molecules/IconButton/IconButton.js
707
438
  var IconButton = __webpack_require__(82765);
708
- // EXTERNAL MODULE: ../components/dist/atoms/Icon/Icon.js
709
- var Icon = __webpack_require__(25045);
710
- // EXTERNAL MODULE: ../components/dist/atoms/Button/Button.js
711
- var Button = __webpack_require__(57578);
712
439
  ;// CONCATENATED MODULE: ../components/dist/organisms/ImageGallery/ImageGallerySelector.js
713
440
 
714
441
 
@@ -776,8 +503,6 @@ const ImageZoom = ({ children }) => {
776
503
  //# sourceMappingURL=ImageZoom.js.map
777
504
  // EXTERNAL MODULE: external "next/router"
778
505
  var router_ = __webpack_require__(71853);
779
- // EXTERNAL MODULE: ./src/components/ui/Image/index.ts + 2 modules
780
- var Image = __webpack_require__(79266);
781
506
  // EXTERNAL MODULE: external "react/jsx-runtime"
782
507
  var jsx_runtime_ = __webpack_require__(20997);
783
508
  ;// CONCATENATED MODULE: ./src/components/ui/ImageGallery/ImageGallery.tsx
@@ -798,16 +523,20 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
798
523
 
799
524
 
800
525
 
801
-
802
526
  const ImageComponent = ({
803
527
  url,
804
528
  alternateName
805
- }) => /*#__PURE__*/jsx_runtime_.jsx(Image/* Image */.E, {
806
- src: url,
807
- alt: alternateName,
808
- width: 68,
809
- height: 68
810
- });
529
+ }) => {
530
+ const {
531
+ __experimentalImageGalleryImage: Image
532
+ } = Components;
533
+ return /*#__PURE__*/jsx_runtime_.jsx(Image, {
534
+ src: url,
535
+ alt: alternateName,
536
+ width: 68,
537
+ height: 68
538
+ });
539
+ };
811
540
 
812
541
  const ImageGallery_ImageGallery_ImageGallery = _ref => {
813
542
  let {
@@ -821,691 +550,959 @@ const ImageGallery_ImageGallery_ImageGallery = _ref => {
821
550
  } = (0,external_react_.useState)(0);
822
551
  const currentImage = images[selectedImageIdx] ?? images[0];
823
552
  const dynamicRoute = (0,router_.useRouter)().asPath;
824
- (0,external_react_.useEffect)(() => setSelectedImageIdx(0), [dynamicRoute]);
825
- return /*#__PURE__*/jsx_runtime_.jsx(ImageGallery_ImageGallery, _objectSpread(_objectSpread({
553
+ (0,external_react_.useEffect)(() => setSelectedImageIdx(0), [dynamicRoute]); // Deconstructing the object to avoid circular dependency errors
554
+
555
+ const {
556
+ ImageGallery: ImageGalleryWrapper,
557
+ ImageZoom,
558
+ __experimentalImageGalleryImage: Image
559
+ } = Components;
560
+ return /*#__PURE__*/jsx_runtime_.jsx(ImageGalleryWrapper, _objectSpread(_objectSpread(_objectSpread({}, productDetailsPropsCustomization.ImageGallery), {}, {
826
561
  images: images,
827
562
  ImageComponent: ImageComponent,
828
563
  selectedImageIdx: selectedImageIdx,
829
564
  setSelectedImageIdx: setSelectedImageIdx
830
565
  }, otherProps), {}, {
831
- children: /*#__PURE__*/jsx_runtime_.jsx(ImageGallery_ImageZoom, {
832
- children: /*#__PURE__*/jsx_runtime_.jsx(Image/* Image */.E, {
833
- src: currentImage.url,
834
- alt: currentImage.alternateName,
566
+ children: /*#__PURE__*/jsx_runtime_.jsx(ImageZoom, _objectSpread(_objectSpread({}, productDetailsPropsCustomization.ImageZoom), {}, {
567
+ children: /*#__PURE__*/jsx_runtime_.jsx(Image, _objectSpread(_objectSpread({
835
568
  sizes: "(max-width: 360px) 50vw, (max-width: 768px) 90vw, 50vw",
836
569
  width: 691,
837
570
  height: 691 * (3 / 4),
838
571
  loading: "eager"
839
- })
840
- })
572
+ }, productDetailsPropsCustomization.__experimentalImageGalleryImage), {}, {
573
+ src: currentImage.url,
574
+ alt: currentImage.alternateName
575
+ }))
576
+ }))
841
577
  }));
842
578
  };
843
579
 
844
580
  /* harmony default export */ const ui_ImageGallery_ImageGallery = (ImageGallery_ImageGallery_ImageGallery);
845
581
  ;// CONCATENATED MODULE: ./src/components/ui/ImageGallery/index.ts
846
582
 
583
+ // EXTERNAL MODULE: ./src/sdk/graphql/request.ts
584
+ var request = __webpack_require__(180);
585
+ ;// CONCATENATED MODULE: ./src/sdk/shipping/index.ts
847
586
 
848
- /***/ }),
849
-
850
- /***/ 90509:
851
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
587
+ const query = "ShippingSimulationQuery";
588
+ const getShippingSimulation = async ({
589
+ items,
590
+ postalCode,
591
+ country
592
+ }) => {
593
+ const data = await (0,request/* request */.W)(query, {
594
+ items,
595
+ postalCode,
596
+ country
597
+ });
598
+ return data.shipping;
599
+ };
600
+ /* harmony default export */ const shipping = ((/* unused pure expression or super */ null && (getShippingSimulation)));
601
+ // EXTERNAL MODULE: ./src/sdk/session/index.ts + 1 modules
602
+ var session = __webpack_require__(97295);
603
+ ;// CONCATENATED MODULE: ./src/components/ui/ShippingSimulation/useShippingSimulation.ts
604
+ function useShippingSimulation_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
852
605
 
853
- "use strict";
606
+ function useShippingSimulation_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? useShippingSimulation_ownKeys(Object(source), !0).forEach(function (key) { useShippingSimulation_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : useShippingSimulation_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
854
607
 
855
- // EXPORTS
856
- __webpack_require__.d(__webpack_exports__, {
857
- "Z": () => (/* reexport */ ProductDescription_ProductDescription)
608
+ function useShippingSimulation_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
609
+
610
+
611
+
612
+ const createEmptySimulation = () => ({
613
+ input: {
614
+ postalCode: '',
615
+ displayClearButton: false,
616
+ errorMessage: ''
617
+ },
618
+ shippingSimulation: {
619
+ location: '',
620
+ options: []
621
+ }
858
622
  });
859
623
 
860
- // EXTERNAL MODULE: external "react"
861
- var external_react_ = __webpack_require__(16689);
862
- // EXTERNAL MODULE: ../components/dist/molecules/Accordion/Accordion.js
863
- var Accordion = __webpack_require__(39739);
864
- // EXTERNAL MODULE: ../components/dist/molecules/Accordion/AccordionItem.js
865
- var AccordionItem = __webpack_require__(60997);
866
- // EXTERNAL MODULE: ../components/dist/molecules/Accordion/AccordionButton.js
867
- var AccordionButton = __webpack_require__(47743);
868
- // EXTERNAL MODULE: ../components/dist/molecules/Accordion/AccordionPanel.js
869
- var AccordionPanel = __webpack_require__(20331);
870
- // EXTERNAL MODULE: external "react/jsx-runtime"
871
- var jsx_runtime_ = __webpack_require__(20997);
872
- ;// CONCATENATED MODULE: ./src/components/ui/ProductDescription/ProductDescription.tsx
624
+ const reducer = (state, action) => {
625
+ const {
626
+ type
627
+ } = action;
628
+
629
+ switch (type) {
630
+ case 'clear':
631
+ {
632
+ return createEmptySimulation();
633
+ }
873
634
 
635
+ case 'update':
636
+ {
637
+ const {
638
+ payload
639
+ } = action;
640
+ return {
641
+ input: useShippingSimulation_objectSpread(useShippingSimulation_objectSpread({}, state.input), payload.input),
642
+ shippingSimulation: useShippingSimulation_objectSpread(useShippingSimulation_objectSpread({}, state.shippingSimulation), payload.shippingSimulation)
643
+ };
644
+ }
874
645
 
646
+ case 'onInput':
647
+ {
648
+ const {
649
+ payload
650
+ } = action;
651
+ return useShippingSimulation_objectSpread(useShippingSimulation_objectSpread({}, state), {}, {
652
+ input: useShippingSimulation_objectSpread({}, payload)
653
+ });
654
+ }
875
655
 
656
+ case 'onError':
657
+ {
658
+ const {
659
+ payload
660
+ } = action;
661
+ return useShippingSimulation_objectSpread(useShippingSimulation_objectSpread({}, state), {}, {
662
+ input: useShippingSimulation_objectSpread(useShippingSimulation_objectSpread({}, state.input), payload)
663
+ });
664
+ }
876
665
 
666
+ default:
667
+ throw new Error(`Action ${type} not implemented`);
668
+ }
669
+ };
877
670
 
878
- function ProductDescription({
879
- descriptionData,
880
- initiallyExpanded = 'first'
881
- }) {
882
- /**
883
- * Maps 'initiallyExpanded' prop values to indices
884
- */
885
- const INITIALLY_EXPANDED_MAP = (0,external_react_.useMemo)(() => ({
886
- none: [],
887
- first: [0],
888
- all: [0, 1, 2, 3]
889
- }), []);
671
+ const useShippingSimulation = (shippingItem, fetchShippingSimulationFn, sessionPostalCode, country) => {
890
672
  const {
891
- 0: indices,
892
- 1: setIndices
893
- } = (0,external_react_.useState)(new Set(INITIALLY_EXPANDED_MAP[initiallyExpanded]));
673
+ 0: {
674
+ input,
675
+ shippingSimulation
676
+ },
677
+ 1: dispatch
678
+ } = (0,external_react_.useReducer)(reducer, null, createEmptySimulation);
679
+ const {
680
+ postalCode: shippingPostalCode
681
+ } = input;
682
+ (0,external_react_.useEffect)(() => {
683
+ if (!sessionPostalCode || shippingPostalCode) {
684
+ return;
685
+ } // Use sessionPostalCode if there is no shippingPostalCode
894
686
 
895
- const onChange = index => {
896
- setIndices(currentIndices => {
897
- const newIndices = new Set(currentIndices);
898
687
 
899
- if (currentIndices.has(index)) {
900
- newIndices.delete(index);
901
- } else {
902
- newIndices.add(index);
903
- }
688
+ async function fetchShipping() {
689
+ const [location, options] = await fetchShippingSimulationFn(shippingItem, country, sessionPostalCode ?? '');
690
+ dispatch({
691
+ type: 'update',
692
+ payload: {
693
+ input: {
694
+ postalCode: sessionPostalCode ?? '',
695
+ displayClearButton: true,
696
+ errorMessage: ''
697
+ },
698
+ shippingSimulation: {
699
+ location,
700
+ options
701
+ }
702
+ }
703
+ });
704
+ }
904
705
 
905
- return newIndices;
906
- });
706
+ fetchShipping();
707
+ }, [country, fetchShippingSimulationFn, sessionPostalCode, shippingItem, shippingPostalCode]);
708
+ const handleSubmit = (0,external_react_.useCallback)(async () => {
709
+ try {
710
+ const [location, options] = await fetchShippingSimulationFn(shippingItem, country, shippingPostalCode ?? '');
711
+ dispatch({
712
+ type: 'update',
713
+ payload: {
714
+ input: {
715
+ displayClearButton: true,
716
+ errorMessage: ''
717
+ },
718
+ shippingSimulation: {
719
+ location,
720
+ options
721
+ }
722
+ }
723
+ });
724
+ } catch (error) {
725
+ dispatch({
726
+ type: 'onError',
727
+ payload: {
728
+ displayClearButton: true,
729
+ errorMessage: 'You entered an invalid Postal Code'
730
+ }
731
+ });
732
+ }
733
+ }, [country, fetchShippingSimulationFn, shippingItem, shippingPostalCode]);
734
+ const handleOnInput = (0,external_react_.useCallback)(e => {
735
+ const currentValue = e.currentTarget.value;
736
+
737
+ if (currentValue) {
738
+ dispatch({
739
+ type: 'onInput',
740
+ payload: {
741
+ postalCode: currentValue,
742
+ displayClearButton: false,
743
+ errorMessage: ''
744
+ }
745
+ });
746
+ } else {
747
+ dispatch({
748
+ type: 'clear'
749
+ });
750
+ }
751
+ }, []);
752
+ return {
753
+ input,
754
+ shippingSimulation,
755
+ handleOnClear: () => {
756
+ dispatch({
757
+ type: 'clear'
758
+ });
759
+ },
760
+ handleSubmit,
761
+ handleOnInput
907
762
  };
763
+ };
764
+ ;// CONCATENATED MODULE: ./src/components/ui/ShippingSimulation/ShippingSimulation.tsx
765
+ const ShippingSimulation_excluded = ["productShippingInfo", "formatter", "inputLabel", "title", "idkPostalCodeLinkProps"];
908
766
 
909
- return /*#__PURE__*/jsx_runtime_.jsx("section", {
910
- "data-fs-product-description": true,
911
- children: /*#__PURE__*/jsx_runtime_.jsx(Accordion/* default */.Z, {
912
- indices: indices,
913
- onChange: onChange,
914
- "aria-label": "Product Details Content",
915
- children: descriptionData.map(({
916
- title,
917
- content
918
- }, index) => /*#__PURE__*/(0,jsx_runtime_.jsxs)(AccordionItem/* default */.Z, {
919
- as: "article",
920
- index: index,
921
- prefixId: "product-description",
922
- "data-fs-product-details-description": true,
923
- children: [/*#__PURE__*/jsx_runtime_.jsx(AccordionButton/* default */.Z, {
924
- children: title
925
- }), /*#__PURE__*/jsx_runtime_.jsx(AccordionPanel/* default */.Z, {
926
- children: /*#__PURE__*/jsx_runtime_.jsx("p", {
927
- className: "text__body",
928
- children: content
929
- })
930
- })]
931
- }, String(index)))
932
- })
933
- });
934
- }
767
+ function ShippingSimulation_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
935
768
 
936
- /* harmony default export */ const ProductDescription_ProductDescription = (ProductDescription);
937
- ;// CONCATENATED MODULE: ./src/components/ui/ProductDescription/index.ts
769
+ function ShippingSimulation_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ShippingSimulation_ownKeys(Object(source), !0).forEach(function (key) { ShippingSimulation_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ShippingSimulation_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
938
770
 
771
+ function ShippingSimulation_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
939
772
 
940
- /***/ }),
773
+ function ShippingSimulation_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = ShippingSimulation_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
941
774
 
942
- /***/ 33183:
943
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
775
+ function ShippingSimulation_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
944
776
 
945
- "use strict";
946
777
 
947
- // EXPORTS
948
- __webpack_require__.d(__webpack_exports__, {
949
- "m": () => (/* reexport */ ProductDetails_ProductDetailsSettings)
950
- });
951
778
 
952
- // UNUSED EXPORTS: AddToCartLoadingSkeleton
953
779
 
954
- // EXTERNAL MODULE: ../components/dist/atoms/Price/Price.js
955
- var Price = __webpack_require__(57549);
956
- // EXTERNAL MODULE: ../components/dist/molecules/QuantitySelector/QuantitySelector.js
957
- var QuantitySelector = __webpack_require__(60123);
958
- // EXTERNAL MODULE: ../components/dist/atoms/Icon/Icon.js
959
- var Icon = __webpack_require__(25045);
960
- // EXTERNAL MODULE: ../sdk/dist/analytics/sendAnalyticsEvent.js
961
- var sendAnalyticsEvent = __webpack_require__(71072);
962
- // EXTERNAL MODULE: external "react"
963
- var external_react_ = __webpack_require__(16689);
964
- // EXTERNAL MODULE: ./src/sdk/session/index.ts + 1 modules
965
- var session = __webpack_require__(97295);
966
- // EXTERNAL MODULE: ../components/dist/hooks/UIProvider.js
967
- var UIProvider = __webpack_require__(90395);
968
- // EXTERNAL MODULE: ./src/sdk/cart/index.ts + 1 modules
969
- var cart = __webpack_require__(46073);
970
- ;// CONCATENATED MODULE: ./src/sdk/cart/useBuyButton.ts
971
780
 
972
781
 
973
782
 
783
+ const fetchShippingSimulation = async (shippingItem, country, postalCode) => {
784
+ const shipping = await getShippingSimulation({
785
+ country,
786
+ postalCode: postalCode,
787
+ items: [shippingItem]
788
+ });
789
+ const location = [shipping?.address?.neighborhood, shipping?.address?.city].filter(Boolean).join(' / ') ?? '';
790
+ const options = shipping?.logisticsInfo?.[0]?.slas ?? [];
791
+ return [location, options];
792
+ };
974
793
 
794
+ function ShippingSimulation_ShippingSimulation_ShippingSimulation(_ref) {
795
+ let {
796
+ productShippingInfo,
797
+ formatter,
798
+ inputLabel,
799
+ title,
800
+ idkPostalCodeLinkProps
801
+ } = _ref,
802
+ otherProps = ShippingSimulation_objectWithoutProperties(_ref, ShippingSimulation_excluded);
975
803
 
976
- const useBuyButton = item => {
977
804
  const {
978
- openCart
979
- } = (0,UIProvider/* useUI */.l)();
805
+ country,
806
+ postalCode: sessionPostalCode
807
+ } = (0,session/* useSession */.kP)();
980
808
  const {
981
- currency: {
982
- code
809
+ ShippingSimulation: ShippingSimulationWrapper
810
+ } = Components;
811
+ const {
812
+ input,
813
+ shippingSimulation,
814
+ handleSubmit,
815
+ handleOnInput,
816
+ handleOnClear
817
+ } = useShippingSimulation(productShippingInfo, fetchShippingSimulation, sessionPostalCode, country);
818
+ const {
819
+ postalCode,
820
+ displayClearButton,
821
+ errorMessage
822
+ } = input;
823
+ const {
824
+ location,
825
+ options
826
+ } = shippingSimulation;
827
+ return /*#__PURE__*/jsx_runtime_.jsx(ShippingSimulationWrapper, ShippingSimulation_objectSpread({
828
+ formatter: formatter,
829
+ onInput: handleOnInput,
830
+ onSubmit: handleSubmit,
831
+ onClear: handleOnClear,
832
+ location: location,
833
+ options: options,
834
+ displayClearButton: displayClearButton,
835
+ errorMessage: errorMessage,
836
+ postalCode: postalCode,
837
+ inputLabel: inputLabel,
838
+ title: title,
839
+ idkPostalCodeLinkProps: idkPostalCodeLinkProps
840
+ }, otherProps));
841
+ }
842
+ // EXTERNAL MODULE: ./src/components/ui/Image/index.ts + 2 modules
843
+ var Image = __webpack_require__(79266);
844
+ ;// CONCATENATED MODULE: ./src/customizations/components/overrides/ProductDetails.tsx
845
+ // This is an example of how it can be used on the starter.
846
+ const SECTION = 'ProductDetails';
847
+ const overrides = {
848
+ name: SECTION,
849
+ components: {
850
+ ProductTitle: {
851
+ props: {}
852
+ },
853
+ DiscountBadge: {
854
+ props: {}
855
+ },
856
+ BuyButton: {
857
+ props: {}
858
+ },
859
+ Icon: {
860
+ props: {}
861
+ },
862
+ Price: {
863
+ props: {}
864
+ },
865
+ QuantitySelector: {
866
+ props: {}
867
+ },
868
+ SkuSelector: {
869
+ props: {}
870
+ },
871
+ ShippingSimulation: {
872
+ props: {}
873
+ },
874
+ ImageGallery: {
875
+ props: {}
876
+ },
877
+ ImageZoom: {
878
+ props: {}
879
+ },
880
+ __experimentalImageGalleryImage: {
881
+ props: {}
882
+ },
883
+ __experimentalImageGallery: {
884
+ props: {}
885
+ },
886
+ __experimentalShippingSimulation: {
887
+ props: {}
983
888
  }
984
- } = (0,session/* useSession */.kP)();
985
- const onClick = (0,external_react_.useCallback)(e => {
986
- e.preventDefault();
889
+ }
890
+ };
891
+ /* harmony default export */ const ProductDetails = (overrides);
892
+ ;// CONCATENATED MODULE: ./src/components/sections/ProductDetails/Overrides.tsx
893
+ function Overrides_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
987
894
 
988
- if (!item) {
989
- return;
990
- }
895
+ function Overrides_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? Overrides_ownKeys(Object(source), !0).forEach(function (key) { Overrides_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : Overrides_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
991
896
 
992
- (0,sendAnalyticsEvent/* sendAnalyticsEvent */._)({
993
- name: 'add_to_cart',
994
- params: {
995
- currency: code,
996
- // TODO: In the future, we can explore more robust ways of
997
- // calculating the value (gift items, discounts, etc.).
998
- value: item.price * item.quantity,
999
- items: [{
1000
- item_id: item.itemOffered.isVariantOf.productGroupID,
1001
- item_name: item.itemOffered.isVariantOf.name,
1002
- item_brand: item.itemOffered.brand.name,
1003
- item_variant: item.itemOffered.sku,
1004
- quantity: item.quantity,
1005
- price: item.price,
1006
- discount: item.listPrice - item.price,
1007
- currency: code,
1008
- item_variant_name: item.itemOffered.name,
1009
- product_reference_id: item.itemOffered.gtin
1010
- }]
1011
- }
1012
- });
1013
- cart/* cartStore.addItem */.i8.addItem(item);
1014
- openCart();
1015
- }, [code, item, openCart]);
1016
- return {
1017
- onClick,
1018
- 'data-testid': 'buy-button',
1019
- 'data-sku': item?.itemOffered.sku,
1020
- 'data-seller': item?.seller.identifier
1021
- };
1022
- };
1023
- // EXTERNAL MODULE: ./src/sdk/product/useFormattedPrice.ts
1024
- var useFormattedPrice = __webpack_require__(95346);
1025
- // EXTERNAL MODULE: ./node_modules/next/link.js
1026
- var next_link = __webpack_require__(41664);
1027
- var link_default = /*#__PURE__*/__webpack_require__.n(next_link);
1028
- // EXTERNAL MODULE: ./src/components/ui/Image/index.ts + 2 modules
1029
- var Image = __webpack_require__(79266);
1030
- // EXTERNAL MODULE: ./src/components/sections/ProductDetails/Overrides.tsx + 11 modules
1031
- var Overrides = __webpack_require__(32449);
1032
- // EXTERNAL MODULE: external "react/jsx-runtime"
1033
- var jsx_runtime_ = __webpack_require__(20997);
1034
- ;// CONCATENATED MODULE: ./src/components/ui/SkuSelector/Selectors.tsx
1035
- const _excluded = ["src", "alt"],
1036
- _excluded2 = ["slugsMap", "activeVariations", "availableVariations"];
897
+ function Overrides_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
898
+
899
+
900
+
901
+
902
+
903
+
904
+ const productDetailsComponentsCustomization = {};
905
+ const productDetailsPropsCustomization = {};
906
+ Object.entries(ProductDetails.components).forEach(([key, value]) => {
907
+ if (value.Component) {
908
+ productDetailsComponentsCustomization[key] = value.Component;
909
+ }
910
+ });
911
+ Object.entries(ProductDetails.components).forEach(([key, value]) => {
912
+ if (value.props) {
913
+ productDetailsPropsCustomization[key] = value.props;
914
+ }
915
+ });
916
+
917
+ const Components = Overrides_objectSpread({
918
+ ProductTitle: ProductTitle_ProductTitle,
919
+ DiscountBadge: DiscountBadge/* default */.Z,
920
+ BuyButton: BuyButton_BuyButton,
921
+ Icon: Icon/* default */.Z,
922
+ Price: Price/* default */.Z,
923
+ QuantitySelector: QuantitySelector/* default */.Z,
924
+ SkuSelector: SkuSelector_SkuSelector,
925
+ ShippingSimulation: ShippingSimulation_ShippingSimulation,
926
+ ImageGallery: ImageGallery_ImageGallery,
927
+ ImageZoom: ImageGallery_ImageZoom,
928
+ __experimentalImageGalleryImage: Image/* Image */.E,
929
+ __experimentalImageGallery: ui_ImageGallery_ImageGallery,
930
+ __experimentalShippingSimulation: ShippingSimulation_ShippingSimulation_ShippingSimulation
931
+ }, productDetailsComponentsCustomization);
932
+
933
+
934
+
935
+ /***/ }),
936
+
937
+ /***/ 81644:
938
+ /***/ ((module, __webpack_exports__, __webpack_require__) => {
1037
939
 
940
+ "use strict";
941
+ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
942
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
943
+ /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
944
+ /* harmony export */ });
945
+ /* unused harmony export fragment */
946
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689);
947
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
948
+ /* harmony import */ var _faststore_sdk__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(71072);
949
+ /* harmony import */ var src_sdk_session__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(97295);
950
+ /* harmony import */ var src_sdk_product_useProduct__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(63874);
951
+ /* harmony import */ var src_sdk_product_useFormattedPrice__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(95346);
952
+ /* harmony import */ var _Section__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(57067);
953
+ /* harmony import */ var src_components_product_OutOfStock__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(40492);
954
+ /* harmony import */ var src_components_ui_ProductDescription__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(90509);
955
+ /* harmony import */ var src_components_ui_ProductDetails__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(33183);
956
+ /* harmony import */ var _section_module_scss__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(79034);
957
+ /* harmony import */ var _section_module_scss__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_section_module_scss__WEBPACK_IMPORTED_MODULE_11__);
958
+ /* harmony import */ var src_components_sections_ProductDetails_Overrides__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(27534);
959
+ /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(20997);
960
+ /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__);
961
+ var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([src_sdk_product_useProduct__WEBPACK_IMPORTED_MODULE_2__]);
962
+ src_sdk_product_useProduct__WEBPACK_IMPORTED_MODULE_2__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
1038
963
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1039
964
 
1040
965
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1041
966
 
1042
967
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1043
968
 
1044
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1045
969
 
1046
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1047
970
 
1048
971
 
1049
972
 
1050
973
 
1051
974
 
1052
- const {
1053
- SkuSelector
1054
- } = Overrides/* Components */.z;
1055
975
 
1056
- const ImageComponent = _ref => {
1057
- let {
1058
- src,
1059
- alt
1060
- } = _ref,
1061
- otherProps = _objectWithoutProperties(_ref, _excluded);
1062
976
 
1063
- return /*#__PURE__*/jsx_runtime_.jsx(Image/* Image */.E, _objectSpread({
1064
- src: src,
1065
- alt: alt,
1066
- width: 34,
1067
- height: 34
1068
- }, otherProps));
1069
- };
1070
977
 
1071
- function Selectors(_ref2) {
1072
- let {
1073
- slugsMap,
1074
- activeVariations,
1075
- availableVariations
1076
- } = _ref2,
1077
- otherProps = _objectWithoutProperties(_ref2, _excluded2);
1078
978
 
1079
- return /*#__PURE__*/jsx_runtime_.jsx("section", _objectSpread(_objectSpread({}, otherProps), {}, {
1080
- children: availableVariations && Object.keys(availableVariations).map(skuVariant => /*#__PURE__*/jsx_runtime_.jsx(SkuSelector, {
1081
- skuPropertyName: skuVariant,
1082
- availableVariations: availableVariations,
1083
- ImageComponent: ImageComponent,
1084
- activeVariations: activeVariations,
1085
- slugsMap: slugsMap,
1086
- linkProps: {
1087
- as: (link_default()),
1088
- legacyBehavior: false
1089
- }
1090
- }, skuVariant))
1091
- }));
1092
- }
1093
979
 
1094
- /* harmony default export */ const SkuSelector_Selectors = (Selectors);
1095
- ;// CONCATENATED MODULE: ./src/components/ui/SkuSelector/index.ts
1096
980
 
1097
- ;// CONCATENATED MODULE: ./src/components/ui/ProductDetails/AddToCartLoadingSkeleton.tsx
1098
981
 
982
+ const {
983
+ ProductTitle,
984
+ DiscountBadge,
985
+ __experimentalImageGallery: ImageGallery,
986
+ __experimentalShippingSimulation: ShippingSimulation
987
+ } = src_components_sections_ProductDetails_Overrides__WEBPACK_IMPORTED_MODULE_8__/* .Components */ .z;
1099
988
 
1100
- function AddToCartLoadingSkeleton() {
1101
- return (
1102
- /*#__PURE__*/
1103
- // Generated via https://skeletonreact.com/.
1104
- (0,jsx_runtime_.jsxs)("svg", {
1105
- role: "img",
1106
- width: "100%",
1107
- height: "48",
1108
- "aria-labelledby": "loading-aria",
1109
- viewBox: "0 0 112 48",
1110
- preserveAspectRatio: "none",
1111
- children: [/*#__PURE__*/jsx_runtime_.jsx("title", {
1112
- id: "loading-aria",
1113
- children: "Loading..."
1114
- }), /*#__PURE__*/jsx_runtime_.jsx("rect", {
1115
- x: "0",
1116
- y: "0",
1117
- width: "100%",
1118
- height: "100%",
1119
- clipPath: "url(#clip-path)",
1120
- style: {
1121
- fill: 'url("#fill")'
1122
- }
1123
- }), /*#__PURE__*/(0,jsx_runtime_.jsxs)("defs", {
1124
- children: [/*#__PURE__*/jsx_runtime_.jsx("clipPath", {
1125
- id: "clip-path",
1126
- children: /*#__PURE__*/jsx_runtime_.jsx("rect", {
1127
- x: "0",
1128
- y: "0",
1129
- rx: "2",
1130
- ry: "2",
1131
- width: "112",
1132
- height: "48"
1133
- })
1134
- }), /*#__PURE__*/(0,jsx_runtime_.jsxs)("linearGradient", {
1135
- id: "fill",
1136
- children: [/*#__PURE__*/jsx_runtime_.jsx("stop", {
1137
- offset: "0.599964",
1138
- stopColor: "#f3f3f3",
1139
- stopOpacity: "1",
1140
- children: /*#__PURE__*/jsx_runtime_.jsx("animate", {
1141
- attributeName: "offset",
1142
- values: "-2; -2; 1",
1143
- keyTimes: "0; 0.25; 1",
1144
- dur: "2s",
1145
- repeatCount: "indefinite"
1146
- })
1147
- }), /*#__PURE__*/jsx_runtime_.jsx("stop", {
1148
- offset: "1.59996",
1149
- stopColor: "#ecebeb",
1150
- stopOpacity: "1",
1151
- children: /*#__PURE__*/jsx_runtime_.jsx("animate", {
1152
- attributeName: "offset",
1153
- values: "-1; -1; 2",
1154
- keyTimes: "0; 0.25; 1",
1155
- dur: "2s",
1156
- repeatCount: "indefinite"
1157
- })
1158
- }), /*#__PURE__*/jsx_runtime_.jsx("stop", {
1159
- offset: "2.59996",
1160
- stopColor: "#f3f3f3",
1161
- stopOpacity: "1",
1162
- children: /*#__PURE__*/jsx_runtime_.jsx("animate", {
1163
- attributeName: "offset",
1164
- values: "0; 0; 3",
1165
- keyTimes: "0; 0.25; 1",
1166
- dur: "2s",
1167
- repeatCount: "indefinite"
989
+ function ProductDetails({
990
+ context: staleProduct,
991
+ productTitle: {
992
+ refNumber: showRefNumber,
993
+ discountBadge: {
994
+ showDiscountBadge,
995
+ size: discountBadgeSize = src_components_sections_ProductDetails_Overrides__WEBPACK_IMPORTED_MODULE_8__/* .Props.DiscountBadge.size */ .x.DiscountBadge.size
996
+ }
997
+ },
998
+ buyButton: {
999
+ icon: buyButtonIcon,
1000
+ title: buyButtonTitle
1001
+ },
1002
+ shippingSimulator: {
1003
+ title: shippingSimulatorTitle = src_components_sections_ProductDetails_Overrides__WEBPACK_IMPORTED_MODULE_8__/* .Props.__experimentalShippingSimulation.title */ .x.__experimentalShippingSimulation.title,
1004
+ inputLabel: shippingSimulatorInputLabel = src_components_sections_ProductDetails_Overrides__WEBPACK_IMPORTED_MODULE_8__/* .Props.__experimentalShippingSimulation.inputLabel */ .x.__experimentalShippingSimulation.inputLabel,
1005
+ shippingOptionsTableTitle: shippingSimulatorOptionsTableTitle = src_components_sections_ProductDetails_Overrides__WEBPACK_IMPORTED_MODULE_8__/* .Props.__experimentalShippingSimulation.optionsLabel */ .x.__experimentalShippingSimulation.optionsLabel,
1006
+ link: {
1007
+ to: shippingSimulatorLinkUrl = src_components_sections_ProductDetails_Overrides__WEBPACK_IMPORTED_MODULE_8__/* .Props.__experimentalShippingSimulation.idkPostalCodeLinkProps */ .x.__experimentalShippingSimulation.idkPostalCodeLinkProps?.href,
1008
+ text: shippingSimulatorLinkText = src_components_sections_ProductDetails_Overrides__WEBPACK_IMPORTED_MODULE_8__/* .Props.__experimentalShippingSimulation.idkPostalCodeLinkProps */ .x.__experimentalShippingSimulation.idkPostalCodeLinkProps?.children
1009
+ }
1010
+ },
1011
+ productDescription: {
1012
+ title: productDescriptionDetailsTitle,
1013
+ initiallyExpanded: productDescriptionInitiallyExpanded,
1014
+ displayDescription: shouldDisplayProductDescription
1015
+ }
1016
+ }) {
1017
+ const {
1018
+ currency
1019
+ } = (0,src_sdk_session__WEBPACK_IMPORTED_MODULE_1__/* .useSession */ .kP)();
1020
+ const {
1021
+ 0: quantity,
1022
+ 1: setQuantity
1023
+ } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(1); // Stale while revalidate the product for fetching the new price etc
1024
+
1025
+ const {
1026
+ data,
1027
+ isValidating
1028
+ } = (0,src_sdk_product_useProduct__WEBPACK_IMPORTED_MODULE_2__/* .useProduct */ .i)(staleProduct.id, {
1029
+ product: staleProduct
1030
+ });
1031
+
1032
+ if (!data) {
1033
+ throw new Error('NotFound');
1034
+ }
1035
+
1036
+ const {
1037
+ product: {
1038
+ id,
1039
+ sku,
1040
+ gtin,
1041
+ name: variantName,
1042
+ brand,
1043
+ isVariantOf,
1044
+ description,
1045
+ isVariantOf: {
1046
+ name,
1047
+ productGroupID: productId
1048
+ },
1049
+ image: productImages,
1050
+ offers: {
1051
+ offers: [{
1052
+ availability,
1053
+ price,
1054
+ listPrice,
1055
+ seller
1056
+ }],
1057
+ lowPrice
1058
+ }
1059
+ }
1060
+ } = data;
1061
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
1062
+ (0,_faststore_sdk__WEBPACK_IMPORTED_MODULE_10__/* .sendAnalyticsEvent */ ._)({
1063
+ name: 'view_item',
1064
+ params: {
1065
+ currency: currency.code,
1066
+ value: price,
1067
+ items: [{
1068
+ item_id: isVariantOf.productGroupID,
1069
+ item_name: isVariantOf.name,
1070
+ item_brand: brand.name,
1071
+ item_variant: sku,
1072
+ price,
1073
+ discount: listPrice - price,
1074
+ currency: currency.code,
1075
+ item_variant_name: variantName,
1076
+ product_reference_id: gtin
1077
+ }]
1078
+ }
1079
+ });
1080
+ }, [isVariantOf.productGroupID, isVariantOf.name, brand.name, sku, price, listPrice, currency.code, variantName, gtin]);
1081
+ return /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx(_Section__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
1082
+ className: `${(_section_module_scss__WEBPACK_IMPORTED_MODULE_11___default().section)} section-product-details layout__content layout__section`,
1083
+ children: /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx("section", {
1084
+ "data-fs-product-details": true,
1085
+ children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("section", {
1086
+ "data-fs-product-details-body": true,
1087
+ children: [/*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx("header", {
1088
+ "data-fs-product-details-title": true,
1089
+ "data-fs-product-details-section": true,
1090
+ children: /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx(ProductTitle // TODO: We should review this prop. There's now way to override the title and use the dynamic name value.
1091
+ // Maybe passing a ProductTitleHeader component as a prop would be better, as it would be overridable.
1092
+ // Maybe now it's worth to make title always a h1 and receive only the name, as it would be easier for users to override.
1093
+ , _objectSpread(_objectSpread({
1094
+ title: /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx("h1", {
1095
+ children: name
1168
1096
  })
1169
- })]
1097
+ }, src_components_sections_ProductDetails_Overrides__WEBPACK_IMPORTED_MODULE_8__/* .Props.ProductTitle */ .x.ProductTitle), {}, {
1098
+ label: showDiscountBadge && /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx(DiscountBadge, _objectSpread(_objectSpread({}, src_components_sections_ProductDetails_Overrides__WEBPACK_IMPORTED_MODULE_8__/* .Props.DiscountBadge */ .x.DiscountBadge), {}, {
1099
+ size: discountBadgeSize // Dynamic props shouldn't be overridable
1100
+ // This decision can be reviewed later if needed
1101
+ ,
1102
+ listPrice: listPrice,
1103
+ spotPrice: lowPrice
1104
+ })),
1105
+ refNumber: showRefNumber && productId
1106
+ }))
1107
+ }), /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx(ImageGallery, _objectSpread(_objectSpread({
1108
+ "data-fs-product-details-gallery": true
1109
+ }, src_components_sections_ProductDetails_Overrides__WEBPACK_IMPORTED_MODULE_8__/* .Props.__experimentalImageGallery */ .x.__experimentalImageGallery), {}, {
1110
+ images: productImages
1111
+ })), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)("section", {
1112
+ "data-fs-product-details-info": true,
1113
+ children: [/*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx("section", {
1114
+ "data-fs-product-details-settings": true,
1115
+ "data-fs-product-details-section": true,
1116
+ children: availability ? /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx(src_components_ui_ProductDetails__WEBPACK_IMPORTED_MODULE_7__/* .ProductDetailsSettings */ .m, {
1117
+ product: data.product,
1118
+ isValidating: isValidating,
1119
+ buyButtonTitle: buyButtonTitle,
1120
+ quantity: quantity,
1121
+ setQuantity: setQuantity,
1122
+ buyButtonIcon: buyButtonIcon
1123
+ }) : /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx(src_components_product_OutOfStock__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {})
1124
+ }), availability && /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx(ShippingSimulation, _objectSpread(_objectSpread({
1125
+ "data-fs-product-details-section": true,
1126
+ "data-fs-product-details-shipping": true,
1127
+ formatter: src_sdk_product_useFormattedPrice__WEBPACK_IMPORTED_MODULE_3__/* .useFormattedPrice */ .P
1128
+ }, src_components_sections_ProductDetails_Overrides__WEBPACK_IMPORTED_MODULE_8__/* .Props.__experimentalShippingSimulation */ .x.__experimentalShippingSimulation), {}, {
1129
+ idkPostalCodeLinkProps: _objectSpread(_objectSpread({}, src_components_sections_ProductDetails_Overrides__WEBPACK_IMPORTED_MODULE_8__/* .Props.idkPostalCodeLinkProps */ .x.idkPostalCodeLinkProps), {}, {
1130
+ href: shippingSimulatorLinkUrl,
1131
+ children: shippingSimulatorLinkText
1132
+ }),
1133
+ productShippingInfo: {
1134
+ id,
1135
+ quantity,
1136
+ seller: seller.identifier
1137
+ },
1138
+ title: shippingSimulatorTitle,
1139
+ inputLabel: shippingSimulatorInputLabel,
1140
+ optionsLabel: shippingSimulatorOptionsTableTitle
1141
+ }))]
1142
+ }), shouldDisplayProductDescription && /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx(src_components_ui_ProductDescription__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
1143
+ initiallyExpanded: productDescriptionInitiallyExpanded,
1144
+ descriptionData: [{
1145
+ title: productDescriptionDetailsTitle,
1146
+ content: description
1147
+ }]
1170
1148
  })]
1171
- })]
1149
+ })
1172
1150
  })
1173
- );
1151
+ });
1174
1152
  }
1175
- ;// CONCATENATED MODULE: ./src/components/ui/ProductDetails/ProductDetailsSettings.tsx
1176
- function ProductDetailsSettings_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1177
1153
 
1178
- function ProductDetailsSettings_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ProductDetailsSettings_ownKeys(Object(source), !0).forEach(function (key) { ProductDetailsSettings_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ProductDetailsSettings_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1154
+ const fragment = "unknown";
1155
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ProductDetails);
1156
+ __webpack_async_result__();
1157
+ } catch(e) { __webpack_async_result__(e); } });
1179
1158
 
1180
- function ProductDetailsSettings_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1159
+ /***/ }),
1160
+
1161
+ /***/ 93220:
1162
+ /***/ ((module, __webpack_exports__, __webpack_require__) => {
1181
1163
 
1164
+ "use strict";
1165
+ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
1166
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1167
+ /* harmony export */ "Z": () => (/* reexport safe */ _ProductDetails__WEBPACK_IMPORTED_MODULE_0__.Z)
1168
+ /* harmony export */ });
1169
+ /* harmony import */ var _ProductDetails__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81644);
1170
+ var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_ProductDetails__WEBPACK_IMPORTED_MODULE_0__]);
1171
+ _ProductDetails__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
1182
1172
 
1173
+ __webpack_async_result__();
1174
+ } catch(e) { __webpack_async_result__(e); } });
1183
1175
 
1176
+ /***/ }),
1184
1177
 
1178
+ /***/ 90509:
1179
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1185
1180
 
1181
+ "use strict";
1186
1182
 
1183
+ // EXPORTS
1184
+ __webpack_require__.d(__webpack_exports__, {
1185
+ "Z": () => (/* reexport */ ProductDescription_ProductDescription)
1186
+ });
1187
1187
 
1188
+ // EXTERNAL MODULE: external "react"
1189
+ var external_react_ = __webpack_require__(16689);
1190
+ // EXTERNAL MODULE: ../components/dist/molecules/Accordion/Accordion.js
1191
+ var Accordion = __webpack_require__(39739);
1192
+ // EXTERNAL MODULE: ../components/dist/molecules/Accordion/AccordionItem.js
1193
+ var AccordionItem = __webpack_require__(60997);
1194
+ // EXTERNAL MODULE: ../components/dist/molecules/Accordion/AccordionButton.js
1195
+ var AccordionButton = __webpack_require__(47743);
1196
+ // EXTERNAL MODULE: ../components/dist/molecules/Accordion/AccordionPanel.js
1197
+ var AccordionPanel = __webpack_require__(20331);
1198
+ // EXTERNAL MODULE: external "react/jsx-runtime"
1199
+ var jsx_runtime_ = __webpack_require__(20997);
1200
+ ;// CONCATENATED MODULE: ./src/components/ui/ProductDescription/ProductDescription.tsx
1188
1201
 
1189
1202
 
1190
1203
 
1191
- const {
1192
- BuyButton
1193
- } = Overrides/* Components */.z;
1194
1204
 
1195
- function ProductDetailsSettings({
1196
- product,
1197
- buyButtonTitle,
1198
- isValidating,
1199
- quantity,
1200
- setQuantity,
1201
- buyButtonIcon: {
1202
- icon: buyButtonIconName,
1203
- alt: buyButtonIconAlt
1204
- }
1205
+
1206
+ function ProductDescription({
1207
+ descriptionData,
1208
+ initiallyExpanded = 'first'
1205
1209
  }) {
1210
+ /**
1211
+ * Maps 'initiallyExpanded' prop values to indices
1212
+ */
1213
+ const INITIALLY_EXPANDED_MAP = (0,external_react_.useMemo)(() => ({
1214
+ none: [],
1215
+ first: [0],
1216
+ all: [0, 1, 2, 3]
1217
+ }), []);
1206
1218
  const {
1207
- id,
1208
- sku,
1209
- gtin,
1210
- name: variantName,
1211
- brand,
1212
- isVariantOf,
1213
- isVariantOf: {
1214
- skuVariants
1215
- },
1216
- image: productImages,
1217
- additionalProperty,
1218
- offers: {
1219
- lowPrice,
1220
- offers: [{
1221
- availability,
1222
- price,
1223
- listPrice,
1224
- seller
1225
- }]
1226
- }
1227
- } = product;
1228
- const buyDisabled = availability !== 'https://schema.org/InStock';
1229
- const buyProps = useBuyButton({
1230
- id,
1231
- price,
1232
- listPrice,
1233
- seller,
1234
- quantity,
1235
- itemOffered: {
1236
- sku,
1237
- name: variantName,
1238
- gtin,
1239
- image: productImages,
1240
- brand,
1241
- isVariantOf,
1242
- additionalProperty
1243
- }
1244
- });
1245
- return /*#__PURE__*/(0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
1246
- children: [/*#__PURE__*/(0,jsx_runtime_.jsxs)("section", {
1247
- "data-fs-product-details-values": true,
1248
- children: [/*#__PURE__*/(0,jsx_runtime_.jsxs)("div", {
1249
- "data-fs-product-details-prices": true,
1250
- children: [/*#__PURE__*/jsx_runtime_.jsx(Price/* default */.Z, {
1251
- value: listPrice,
1252
- formatter: useFormattedPrice/* useFormattedPrice */.P,
1253
- testId: "list-price",
1254
- "data-value": listPrice,
1255
- variant: "listing",
1256
- SRText: "Original price:"
1257
- }), /*#__PURE__*/jsx_runtime_.jsx(Price/* default */.Z, {
1258
- value: lowPrice,
1259
- formatter: useFormattedPrice/* useFormattedPrice */.P,
1260
- testId: "price",
1261
- "data-value": lowPrice,
1262
- variant: "spot",
1263
- className: "text__lead",
1264
- SRText: "Sale Price:"
1265
- })]
1266
- }), /*#__PURE__*/jsx_runtime_.jsx(QuantitySelector/* default */.Z, {
1267
- min: 1,
1268
- max: 10,
1269
- onChange: setQuantity
1270
- })]
1271
- }), skuVariants && /*#__PURE__*/jsx_runtime_.jsx(SkuSelector_Selectors, {
1272
- slugsMap: skuVariants.slugsMap,
1273
- availableVariations: skuVariants.availableVariations,
1274
- activeVariations: skuVariants.activeVariations,
1275
- "data-fs-product-details-selectors": true
1276
- }),
1277
- /* NOTE: A loading skeleton had to be used to avoid a Lighthouse's
1278
- non-composited animation violation due to the button transitioning its
1279
- background color when changing from its initial disabled to active state.
1280
- See full explanation on commit https://git.io/JyXV5. */
1281
- isValidating ? /*#__PURE__*/jsx_runtime_.jsx(AddToCartLoadingSkeleton, {}) : /*#__PURE__*/jsx_runtime_.jsx(BuyButton, ProductDetailsSettings_objectSpread(ProductDetailsSettings_objectSpread({
1282
- disabled: buyDisabled,
1283
- icon: /*#__PURE__*/jsx_runtime_.jsx(Icon/* default */.Z, {
1284
- "aria-label": buyButtonIconAlt,
1285
- name: buyButtonIconName
1286
- })
1287
- }, buyProps), {}, {
1288
- children: buyButtonTitle || 'Add to Cart'
1289
- }))]
1219
+ 0: indices,
1220
+ 1: setIndices
1221
+ } = (0,external_react_.useState)(new Set(INITIALLY_EXPANDED_MAP[initiallyExpanded]));
1222
+
1223
+ const onChange = index => {
1224
+ setIndices(currentIndices => {
1225
+ const newIndices = new Set(currentIndices);
1226
+
1227
+ if (currentIndices.has(index)) {
1228
+ newIndices.delete(index);
1229
+ } else {
1230
+ newIndices.add(index);
1231
+ }
1232
+
1233
+ return newIndices;
1234
+ });
1235
+ };
1236
+
1237
+ return /*#__PURE__*/jsx_runtime_.jsx("section", {
1238
+ "data-fs-product-description": true,
1239
+ children: /*#__PURE__*/jsx_runtime_.jsx(Accordion/* default */.Z, {
1240
+ indices: indices,
1241
+ onChange: onChange,
1242
+ "aria-label": "Product Details Content",
1243
+ children: descriptionData.map(({
1244
+ title,
1245
+ content
1246
+ }, index) => /*#__PURE__*/(0,jsx_runtime_.jsxs)(AccordionItem/* default */.Z, {
1247
+ as: "article",
1248
+ index: index,
1249
+ prefixId: "product-description",
1250
+ "data-fs-product-details-description": true,
1251
+ children: [/*#__PURE__*/jsx_runtime_.jsx(AccordionButton/* default */.Z, {
1252
+ children: title
1253
+ }), /*#__PURE__*/jsx_runtime_.jsx(AccordionPanel/* default */.Z, {
1254
+ children: /*#__PURE__*/jsx_runtime_.jsx("p", {
1255
+ className: "text__body",
1256
+ children: content
1257
+ })
1258
+ })]
1259
+ }, String(index)))
1260
+ })
1290
1261
  });
1291
1262
  }
1292
1263
 
1293
- /* harmony default export */ const ProductDetails_ProductDetailsSettings = (ProductDetailsSettings);
1294
- ;// CONCATENATED MODULE: ./src/components/ui/ProductDetails/index.ts
1295
-
1264
+ /* harmony default export */ const ProductDescription_ProductDescription = (ProductDescription);
1265
+ ;// CONCATENATED MODULE: ./src/components/ui/ProductDescription/index.ts
1296
1266
 
1297
1267
 
1298
1268
  /***/ }),
1299
1269
 
1300
- /***/ 77281:
1270
+ /***/ 33183:
1301
1271
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1302
1272
 
1303
1273
  "use strict";
1304
1274
 
1305
1275
  // EXPORTS
1306
1276
  __webpack_require__.d(__webpack_exports__, {
1307
- "Z": () => (/* reexport */ ShippingSimulation)
1277
+ "m": () => (/* reexport */ ProductDetails_ProductDetailsSettings)
1308
1278
  });
1309
1279
 
1310
- // EXTERNAL MODULE: ./src/sdk/graphql/request.ts
1311
- var request = __webpack_require__(180);
1312
- ;// CONCATENATED MODULE: ./src/sdk/shipping/index.ts
1280
+ // UNUSED EXPORTS: AddToCartLoadingSkeleton
1313
1281
 
1314
- const query = "ShippingSimulationQuery";
1315
- const getShippingSimulation = async ({
1316
- items,
1317
- postalCode,
1318
- country
1319
- }) => {
1320
- const data = await (0,request/* request */.W)(query, {
1321
- items,
1322
- postalCode,
1323
- country
1324
- });
1325
- return data.shipping;
1326
- };
1327
- /* harmony default export */ const shipping = ((/* unused pure expression or super */ null && (getShippingSimulation)));
1328
- // EXTERNAL MODULE: ./src/sdk/session/index.ts + 1 modules
1329
- var session = __webpack_require__(97295);
1282
+ // EXTERNAL MODULE: ../sdk/dist/analytics/sendAnalyticsEvent.js
1283
+ var sendAnalyticsEvent = __webpack_require__(71072);
1330
1284
  // EXTERNAL MODULE: external "react"
1331
1285
  var external_react_ = __webpack_require__(16689);
1332
- ;// CONCATENATED MODULE: ./src/components/ui/ShippingSimulation/useShippingSimulation.ts
1286
+ // EXTERNAL MODULE: ./src/sdk/session/index.ts + 1 modules
1287
+ var session = __webpack_require__(97295);
1288
+ // EXTERNAL MODULE: ../components/dist/hooks/UIProvider.js
1289
+ var UIProvider = __webpack_require__(90395);
1290
+ // EXTERNAL MODULE: ./src/sdk/cart/index.ts + 1 modules
1291
+ var cart = __webpack_require__(46073);
1292
+ ;// CONCATENATED MODULE: ./src/sdk/cart/useBuyButton.ts
1293
+
1294
+
1295
+
1296
+
1297
+
1298
+ const useBuyButton = item => {
1299
+ const {
1300
+ openCart
1301
+ } = (0,UIProvider/* useUI */.l)();
1302
+ const {
1303
+ currency: {
1304
+ code
1305
+ }
1306
+ } = (0,session/* useSession */.kP)();
1307
+ const onClick = (0,external_react_.useCallback)(e => {
1308
+ e.preventDefault();
1309
+
1310
+ if (!item) {
1311
+ return;
1312
+ }
1313
+
1314
+ (0,sendAnalyticsEvent/* sendAnalyticsEvent */._)({
1315
+ name: 'add_to_cart',
1316
+ params: {
1317
+ currency: code,
1318
+ // TODO: In the future, we can explore more robust ways of
1319
+ // calculating the value (gift items, discounts, etc.).
1320
+ value: item.price * item.quantity,
1321
+ items: [{
1322
+ item_id: item.itemOffered.isVariantOf.productGroupID,
1323
+ item_name: item.itemOffered.isVariantOf.name,
1324
+ item_brand: item.itemOffered.brand.name,
1325
+ item_variant: item.itemOffered.sku,
1326
+ quantity: item.quantity,
1327
+ price: item.price,
1328
+ discount: item.listPrice - item.price,
1329
+ currency: code,
1330
+ item_variant_name: item.itemOffered.name,
1331
+ product_reference_id: item.itemOffered.gtin
1332
+ }]
1333
+ }
1334
+ });
1335
+ cart/* cartStore.addItem */.i8.addItem(item);
1336
+ openCart();
1337
+ }, [code, item, openCart]);
1338
+ return {
1339
+ onClick,
1340
+ 'data-testid': 'buy-button',
1341
+ 'data-sku': item?.itemOffered.sku,
1342
+ 'data-seller': item?.seller.identifier
1343
+ };
1344
+ };
1345
+ // EXTERNAL MODULE: ./src/sdk/product/useFormattedPrice.ts
1346
+ var useFormattedPrice = __webpack_require__(95346);
1347
+ // EXTERNAL MODULE: ./node_modules/next/link.js
1348
+ var next_link = __webpack_require__(41664);
1349
+ var link_default = /*#__PURE__*/__webpack_require__.n(next_link);
1350
+ // EXTERNAL MODULE: ./src/components/ui/Image/index.ts + 2 modules
1351
+ var Image = __webpack_require__(79266);
1352
+ // EXTERNAL MODULE: ./src/components/sections/ProductDetails/Overrides.tsx + 19 modules
1353
+ var Overrides = __webpack_require__(27534);
1354
+ // EXTERNAL MODULE: external "react/jsx-runtime"
1355
+ var jsx_runtime_ = __webpack_require__(20997);
1356
+ ;// CONCATENATED MODULE: ./src/components/ui/SkuSelector/Selectors.tsx
1357
+ const _excluded = ["src", "alt"],
1358
+ _excluded2 = ["slugsMap", "activeVariations", "availableVariations"];
1359
+
1333
1360
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1334
1361
 
1335
1362
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1336
1363
 
1337
1364
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1338
1365
 
1366
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1339
1367
 
1368
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1340
1369
 
1341
- const createEmptySimulation = () => ({
1342
- input: {
1343
- postalCode: '',
1344
- displayClearButton: false,
1345
- errorMessage: ''
1346
- },
1347
- shippingSimulation: {
1348
- location: '',
1349
- options: []
1350
- }
1351
- });
1352
1370
 
1353
- const reducer = (state, action) => {
1354
- const {
1355
- type
1356
- } = action;
1357
1371
 
1358
- switch (type) {
1359
- case 'clear':
1360
- {
1361
- return createEmptySimulation();
1362
- }
1363
1372
 
1364
- case 'update':
1365
- {
1366
- const {
1367
- payload
1368
- } = action;
1369
- return {
1370
- input: _objectSpread(_objectSpread({}, state.input), payload.input),
1371
- shippingSimulation: _objectSpread(_objectSpread({}, state.shippingSimulation), payload.shippingSimulation)
1372
- };
1373
- }
1374
1373
 
1375
- case 'onInput':
1376
- {
1377
- const {
1378
- payload
1379
- } = action;
1380
- return _objectSpread(_objectSpread({}, state), {}, {
1381
- input: _objectSpread({}, payload)
1382
- });
1383
- }
1374
+ const {
1375
+ SkuSelector
1376
+ } = Overrides/* Components */.z;
1384
1377
 
1385
- case 'onError':
1386
- {
1387
- const {
1388
- payload
1389
- } = action;
1390
- return _objectSpread(_objectSpread({}, state), {}, {
1391
- input: _objectSpread(_objectSpread({}, state.input), payload)
1392
- });
1393
- }
1378
+ const ImageComponent = _ref => {
1379
+ let {
1380
+ src,
1381
+ alt
1382
+ } = _ref,
1383
+ otherProps = _objectWithoutProperties(_ref, _excluded);
1394
1384
 
1395
- default:
1396
- throw new Error(`Action ${type} not implemented`);
1397
- }
1385
+ return /*#__PURE__*/jsx_runtime_.jsx(Image/* Image */.E, _objectSpread({
1386
+ src: src,
1387
+ alt: alt,
1388
+ width: 34,
1389
+ height: 34
1390
+ }, otherProps));
1398
1391
  };
1399
1392
 
1400
- const useShippingSimulation = (shippingItem, fetchShippingSimulationFn, sessionPostalCode, country) => {
1401
- const {
1402
- 0: {
1403
- input,
1404
- shippingSimulation
1405
- },
1406
- 1: dispatch
1407
- } = (0,external_react_.useReducer)(reducer, null, createEmptySimulation);
1408
- const {
1409
- postalCode: shippingPostalCode
1410
- } = input;
1411
- (0,external_react_.useEffect)(() => {
1412
- if (!sessionPostalCode || shippingPostalCode) {
1413
- return;
1414
- } // Use sessionPostalCode if there is no shippingPostalCode
1393
+ function Selectors(_ref2) {
1394
+ let {
1395
+ slugsMap,
1396
+ activeVariations,
1397
+ availableVariations
1398
+ } = _ref2,
1399
+ otherProps = _objectWithoutProperties(_ref2, _excluded2);
1415
1400
 
1401
+ return /*#__PURE__*/jsx_runtime_.jsx("section", _objectSpread(_objectSpread({}, otherProps), {}, {
1402
+ children: availableVariations && Object.keys(availableVariations).map(skuVariant => /*#__PURE__*/jsx_runtime_.jsx(SkuSelector, {
1403
+ skuPropertyName: skuVariant,
1404
+ availableVariations: availableVariations,
1405
+ ImageComponent: ImageComponent,
1406
+ activeVariations: activeVariations,
1407
+ slugsMap: slugsMap,
1408
+ linkProps: {
1409
+ as: (link_default()),
1410
+ legacyBehavior: false
1411
+ }
1412
+ }, skuVariant))
1413
+ }));
1414
+ }
1416
1415
 
1417
- async function fetchShipping() {
1418
- const [location, options] = await fetchShippingSimulationFn(shippingItem, country, sessionPostalCode ?? '');
1419
- dispatch({
1420
- type: 'update',
1421
- payload: {
1422
- input: {
1423
- postalCode: sessionPostalCode ?? '',
1424
- displayClearButton: true,
1425
- errorMessage: ''
1426
- },
1427
- shippingSimulation: {
1428
- location,
1429
- options
1430
- }
1431
- }
1432
- });
1433
- }
1416
+ /* harmony default export */ const SkuSelector_Selectors = (Selectors);
1417
+ ;// CONCATENATED MODULE: ./src/components/ui/SkuSelector/index.ts
1434
1418
 
1435
- fetchShipping();
1436
- }, [country, fetchShippingSimulationFn, sessionPostalCode, shippingItem, shippingPostalCode]);
1437
- const handleSubmit = (0,external_react_.useCallback)(async () => {
1438
- try {
1439
- const [location, options] = await fetchShippingSimulationFn(shippingItem, country, shippingPostalCode ?? '');
1440
- dispatch({
1441
- type: 'update',
1442
- payload: {
1443
- input: {
1444
- displayClearButton: true,
1445
- errorMessage: ''
1446
- },
1447
- shippingSimulation: {
1448
- location,
1449
- options
1450
- }
1451
- }
1452
- });
1453
- } catch (error) {
1454
- dispatch({
1455
- type: 'onError',
1456
- payload: {
1457
- displayClearButton: true,
1458
- errorMessage: 'You entered an invalid Postal Code'
1459
- }
1460
- });
1461
- }
1462
- }, [country, fetchShippingSimulationFn, shippingItem, shippingPostalCode]);
1463
- const handleOnInput = (0,external_react_.useCallback)(e => {
1464
- const currentValue = e.currentTarget.value;
1419
+ ;// CONCATENATED MODULE: ./src/components/ui/ProductDetails/AddToCartLoadingSkeleton.tsx
1465
1420
 
1466
- if (currentValue) {
1467
- dispatch({
1468
- type: 'onInput',
1469
- payload: {
1470
- postalCode: currentValue,
1471
- displayClearButton: false,
1472
- errorMessage: ''
1421
+
1422
+ function AddToCartLoadingSkeleton() {
1423
+ return (
1424
+ /*#__PURE__*/
1425
+ // Generated via https://skeletonreact.com/.
1426
+ (0,jsx_runtime_.jsxs)("svg", {
1427
+ role: "img",
1428
+ width: "100%",
1429
+ height: "48",
1430
+ "aria-labelledby": "loading-aria",
1431
+ viewBox: "0 0 112 48",
1432
+ preserveAspectRatio: "none",
1433
+ children: [/*#__PURE__*/jsx_runtime_.jsx("title", {
1434
+ id: "loading-aria",
1435
+ children: "Loading..."
1436
+ }), /*#__PURE__*/jsx_runtime_.jsx("rect", {
1437
+ x: "0",
1438
+ y: "0",
1439
+ width: "100%",
1440
+ height: "100%",
1441
+ clipPath: "url(#clip-path)",
1442
+ style: {
1443
+ fill: 'url("#fill")'
1473
1444
  }
1474
- });
1475
- } else {
1476
- dispatch({
1477
- type: 'clear'
1478
- });
1479
- }
1480
- }, []);
1481
- return {
1482
- input,
1483
- shippingSimulation,
1484
- handleOnClear: () => {
1485
- dispatch({
1486
- type: 'clear'
1487
- });
1488
- },
1489
- handleSubmit,
1490
- handleOnInput
1491
- };
1492
- };
1493
- // EXTERNAL MODULE: ./src/components/sections/ProductDetails/Overrides.tsx + 11 modules
1494
- var Overrides = __webpack_require__(32449);
1495
- // EXTERNAL MODULE: external "react/jsx-runtime"
1496
- var jsx_runtime_ = __webpack_require__(20997);
1497
- ;// CONCATENATED MODULE: ./src/components/ui/ShippingSimulation/ShippingSimulation.tsx
1498
- const _excluded = ["productShippingInfo", "formatter", "inputLabel", "title", "idkPostalCodeLinkProps"];
1445
+ }), /*#__PURE__*/(0,jsx_runtime_.jsxs)("defs", {
1446
+ children: [/*#__PURE__*/jsx_runtime_.jsx("clipPath", {
1447
+ id: "clip-path",
1448
+ children: /*#__PURE__*/jsx_runtime_.jsx("rect", {
1449
+ x: "0",
1450
+ y: "0",
1451
+ rx: "2",
1452
+ ry: "2",
1453
+ width: "112",
1454
+ height: "48"
1455
+ })
1456
+ }), /*#__PURE__*/(0,jsx_runtime_.jsxs)("linearGradient", {
1457
+ id: "fill",
1458
+ children: [/*#__PURE__*/jsx_runtime_.jsx("stop", {
1459
+ offset: "0.599964",
1460
+ stopColor: "#f3f3f3",
1461
+ stopOpacity: "1",
1462
+ children: /*#__PURE__*/jsx_runtime_.jsx("animate", {
1463
+ attributeName: "offset",
1464
+ values: "-2; -2; 1",
1465
+ keyTimes: "0; 0.25; 1",
1466
+ dur: "2s",
1467
+ repeatCount: "indefinite"
1468
+ })
1469
+ }), /*#__PURE__*/jsx_runtime_.jsx("stop", {
1470
+ offset: "1.59996",
1471
+ stopColor: "#ecebeb",
1472
+ stopOpacity: "1",
1473
+ children: /*#__PURE__*/jsx_runtime_.jsx("animate", {
1474
+ attributeName: "offset",
1475
+ values: "-1; -1; 2",
1476
+ keyTimes: "0; 0.25; 1",
1477
+ dur: "2s",
1478
+ repeatCount: "indefinite"
1479
+ })
1480
+ }), /*#__PURE__*/jsx_runtime_.jsx("stop", {
1481
+ offset: "2.59996",
1482
+ stopColor: "#f3f3f3",
1483
+ stopOpacity: "1",
1484
+ children: /*#__PURE__*/jsx_runtime_.jsx("animate", {
1485
+ attributeName: "offset",
1486
+ values: "0; 0; 3",
1487
+ keyTimes: "0; 0.25; 1",
1488
+ dur: "2s",
1489
+ repeatCount: "indefinite"
1490
+ })
1491
+ })]
1492
+ })]
1493
+ })]
1494
+ })
1495
+ );
1496
+ }
1497
+ ;// CONCATENATED MODULE: ./src/components/ui/ProductDetails/ProductDetailsSettings.tsx
1498
+ function ProductDetailsSettings_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1499
1499
 
1500
- function ShippingSimulation_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1500
+ function ProductDetailsSettings_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ProductDetailsSettings_ownKeys(Object(source), !0).forEach(function (key) { ProductDetailsSettings_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ProductDetailsSettings_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1501
1501
 
1502
- function ShippingSimulation_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ShippingSimulation_ownKeys(Object(source), !0).forEach(function (key) { ShippingSimulation_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ShippingSimulation_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1502
+ function ProductDetailsSettings_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1503
1503
 
1504
- function ShippingSimulation_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1505
1504
 
1506
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1507
1505
 
1508
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1509
1506
 
1510
1507
 
1511
1508
 
@@ -1513,66 +1510,118 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
1513
1510
 
1514
1511
 
1515
1512
  const {
1516
- ShippingSimulation: ShippingSimulationWrapper
1513
+ BuyButton,
1514
+ Icon,
1515
+ Price,
1516
+ QuantitySelector
1517
1517
  } = Overrides/* Components */.z;
1518
1518
 
1519
- const fetchShippingSimulation = async (shippingItem, country, postalCode) => {
1520
- const shipping = await getShippingSimulation({
1521
- country,
1522
- postalCode: postalCode,
1523
- items: [shippingItem]
1519
+ function ProductDetailsSettings({
1520
+ product,
1521
+ buyButtonTitle,
1522
+ isValidating,
1523
+ quantity,
1524
+ setQuantity,
1525
+ buyButtonIcon: {
1526
+ icon: buyButtonIconName = Overrides/* Props.Icon.name */.x.Icon.name,
1527
+ alt: buyButtonIconAlt = Overrides/* Props.Icon.aria-label */.x.Icon["aria-label"]
1528
+ }
1529
+ }) {
1530
+ const {
1531
+ id,
1532
+ sku,
1533
+ gtin,
1534
+ name: variantName,
1535
+ brand,
1536
+ isVariantOf,
1537
+ isVariantOf: {
1538
+ skuVariants
1539
+ },
1540
+ image: productImages,
1541
+ additionalProperty,
1542
+ offers: {
1543
+ lowPrice,
1544
+ offers: [{
1545
+ availability,
1546
+ price,
1547
+ listPrice,
1548
+ seller
1549
+ }]
1550
+ }
1551
+ } = product;
1552
+ const buyDisabled = availability !== 'https://schema.org/InStock';
1553
+ const buyProps = useBuyButton({
1554
+ id,
1555
+ price,
1556
+ listPrice,
1557
+ seller,
1558
+ quantity,
1559
+ itemOffered: {
1560
+ sku,
1561
+ name: variantName,
1562
+ gtin,
1563
+ image: productImages,
1564
+ brand,
1565
+ isVariantOf,
1566
+ additionalProperty
1567
+ }
1524
1568
  });
1525
- const location = [shipping?.address?.neighborhood, shipping?.address?.city].filter(Boolean).join(' / ') ?? '';
1526
- const options = shipping?.logisticsInfo?.[0]?.slas ?? [];
1527
- return [location, options];
1528
- };
1569
+ return /*#__PURE__*/(0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
1570
+ children: [/*#__PURE__*/(0,jsx_runtime_.jsxs)("section", {
1571
+ "data-fs-product-details-values": true,
1572
+ children: [/*#__PURE__*/(0,jsx_runtime_.jsxs)("div", {
1573
+ "data-fs-product-details-prices": true,
1574
+ children: [/*#__PURE__*/jsx_runtime_.jsx(Price, ProductDetailsSettings_objectSpread(ProductDetailsSettings_objectSpread({
1575
+ formatter: useFormattedPrice/* useFormattedPrice */.P,
1576
+ testId: "list-price",
1577
+ variant: "listing",
1578
+ SRText: "Original price:"
1579
+ }, Overrides/* Props.Price */.x.Price), {}, {
1580
+ value: listPrice,
1581
+ "data-value": listPrice
1582
+ })), /*#__PURE__*/jsx_runtime_.jsx(Price, ProductDetailsSettings_objectSpread(ProductDetailsSettings_objectSpread({
1583
+ formatter: useFormattedPrice/* useFormattedPrice */.P,
1584
+ testId: "price",
1585
+ variant: "spot",
1586
+ className: "text__lead",
1587
+ SRText: "Sale Price:"
1588
+ }, Overrides/* Props.Price */.x.Price), {}, {
1589
+ value: lowPrice,
1590
+ "data-value": lowPrice
1591
+ }))]
1592
+ }), /*#__PURE__*/jsx_runtime_.jsx(QuantitySelector, ProductDetailsSettings_objectSpread(ProductDetailsSettings_objectSpread({
1593
+ min: 1,
1594
+ max: 10
1595
+ }, Overrides/* Props.QuantitySelector */.x.QuantitySelector), {}, {
1596
+ // Dynamic props shouldn't be overridable
1597
+ // This decision can be reviewed later if needed
1598
+ onChange: setQuantity
1599
+ }))]
1600
+ }), skuVariants && /*#__PURE__*/jsx_runtime_.jsx(SkuSelector_Selectors, {
1601
+ slugsMap: skuVariants.slugsMap,
1602
+ availableVariations: skuVariants.availableVariations,
1603
+ activeVariations: skuVariants.activeVariations,
1604
+ "data-fs-product-details-selectors": true
1605
+ }),
1606
+ /* NOTE: A loading skeleton had to be used to avoid a Lighthouse's
1607
+ non-composited animation violation due to the button transitioning its
1608
+ background color when changing from its initial disabled to active state.
1609
+ See full explanation on commit https://git.io/JyXV5. */
1610
+ isValidating ? /*#__PURE__*/jsx_runtime_.jsx(AddToCartLoadingSkeleton, {}) : /*#__PURE__*/jsx_runtime_.jsx(BuyButton, ProductDetailsSettings_objectSpread(ProductDetailsSettings_objectSpread(ProductDetailsSettings_objectSpread({}, Overrides/* Props.BuyButton */.x.BuyButton), {}, {
1611
+ icon: /*#__PURE__*/jsx_runtime_.jsx(Icon, ProductDetailsSettings_objectSpread(ProductDetailsSettings_objectSpread({}, Overrides/* Props.Icon */.x.Icon), {}, {
1612
+ "aria-label": buyButtonIconAlt,
1613
+ name: buyButtonIconName
1614
+ })),
1615
+ disabled: buyDisabled
1616
+ }, buyProps), {}, {
1617
+ children: buyButtonTitle || 'Add to Cart'
1618
+ }))]
1619
+ });
1620
+ }
1529
1621
 
1530
- function ShippingSimulation(_ref) {
1531
- let {
1532
- productShippingInfo,
1533
- formatter,
1534
- inputLabel,
1535
- title,
1536
- idkPostalCodeLinkProps
1537
- } = _ref,
1538
- otherProps = _objectWithoutProperties(_ref, _excluded);
1622
+ /* harmony default export */ const ProductDetails_ProductDetailsSettings = (ProductDetailsSettings);
1623
+ ;// CONCATENATED MODULE: ./src/components/ui/ProductDetails/index.ts
1539
1624
 
1540
- const {
1541
- country,
1542
- postalCode: sessionPostalCode
1543
- } = (0,session/* useSession */.kP)();
1544
- const {
1545
- input,
1546
- shippingSimulation,
1547
- handleSubmit,
1548
- handleOnInput,
1549
- handleOnClear
1550
- } = useShippingSimulation(productShippingInfo, fetchShippingSimulation, sessionPostalCode, country);
1551
- const {
1552
- postalCode,
1553
- displayClearButton,
1554
- errorMessage
1555
- } = input;
1556
- const {
1557
- location,
1558
- options
1559
- } = shippingSimulation;
1560
- return /*#__PURE__*/jsx_runtime_.jsx(ShippingSimulationWrapper, ShippingSimulation_objectSpread({
1561
- formatter: formatter,
1562
- onInput: handleOnInput,
1563
- onSubmit: handleSubmit,
1564
- onClear: handleOnClear,
1565
- location: location,
1566
- options: options,
1567
- displayClearButton: displayClearButton,
1568
- errorMessage: errorMessage,
1569
- postalCode: postalCode,
1570
- inputLabel: inputLabel,
1571
- title: title,
1572
- idkPostalCodeLinkProps: idkPostalCodeLinkProps
1573
- }, otherProps));
1574
- }
1575
- ;// CONCATENATED MODULE: ./src/components/ui/ShippingSimulation/index.ts
1576
1625
 
1577
1626
 
1578
1627
  /***/ }),
@@ -1822,14 +1871,6 @@ module.exports = {
1822
1871
  };
1823
1872
 
1824
1873
 
1825
- /***/ }),
1826
-
1827
- /***/ 35490:
1828
- /***/ ((module) => {
1829
-
1830
- "use strict";
1831
- module.exports = require("@faststore/graphql-utils");
1832
-
1833
1874
  /***/ }),
1834
1875
 
1835
1876
  /***/ 74691:
@@ -2319,7 +2360,7 @@ module.exports = require("crypto");
2319
2360
  var __webpack_require__ = require("../../webpack-runtime.js");
2320
2361
  __webpack_require__.C(exports);
2321
2362
  var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
2322
- var __webpack_exports__ = __webpack_require__.X(0, [676,825,487,183,886,74,247,287,854,280,368,205,253,350,378,123], () => (__webpack_exec__(75779)));
2363
+ var __webpack_exports__ = __webpack_require__.X(0, [676,825,487,183,886,74,247,287,854,269,184,205,253,350,378,123], () => (__webpack_exec__(75779)));
2323
2364
  module.exports = __webpack_exports__;
2324
2365
 
2325
2366
  })();