@ubnt/store.core 9.17.0-alpha.5 → 9.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -158
- package/lib/_virtual/_virtual_multi-entry.js +12 -27
- package/lib/_virtual/_virtual_multi-entry.js.map +1 -1
- package/lib/_virtual/_virtual_multi-entry.mjs +10 -14
- package/lib/_virtual/_virtual_multi-entry.mjs.map +1 -1
- package/lib/apis/smartcat.js +1 -4
- package/lib/apis/smartcat.js.map +1 -1
- package/lib/apis/smartcat.mjs +1 -4
- package/lib/apis/smartcat.mjs.map +1 -1
- package/lib/assets/attention.svg +5 -5
- package/lib/assets/attention2.svg +5 -5
- package/lib/{components/ResourceCalculatorV1/assets/consoles/ucg-max.png.js → assets/icons/menu/icon-globe.svg.js} +6 -6
- package/lib/assets/icons/menu/icon-globe.svg.js.map +1 -0
- package/lib/assets/icons/menu/icon-globe.svg.mjs +3 -0
- package/lib/assets/icons/menu/icon-globe.svg.mjs.map +1 -0
- package/lib/assets/udmPro.jpg +0 -0
- package/lib/assets/udmPro2.jpg +0 -0
- package/lib/assets/udmProMax.jpg +0 -0
- package/lib/assets/udmProMax2.jpg +0 -0
- package/lib/assets/udmProSpecial.jpg +0 -0
- package/lib/assets/udmProSpecial2.jpg +0 -0
- package/lib/components/CategoryTabs/CategoryTabs.styles.d.ts +1 -1
- package/lib/components/CategoryTabs/CategoryTabs.types.d.ts +1 -1
- package/lib/components/CloserLookSection/CloserLookSection.js.map +1 -1
- package/lib/components/CloserLookSection/CloserLookSection.mjs.map +1 -1
- package/lib/components/Compare/Compare.styles.d.ts +5 -5
- package/lib/components/Container/Container.d.ts +1 -1
- package/lib/components/Container/Container.js +3 -4
- package/lib/components/Container/Container.js.map +1 -1
- package/lib/components/Container/Container.mjs +4 -5
- package/lib/components/Container/Container.mjs.map +1 -1
- package/lib/components/CustomImage/CustomImage.js.map +1 -1
- package/lib/components/CustomImage/CustomImage.mjs.map +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.js.map +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.mjs.map +1 -1
- package/lib/components/Footer/hooks/useFooterContent.d.ts +3 -1
- package/lib/components/Footer/hooks/useFooterContent.js +8 -1
- package/lib/components/Footer/hooks/useFooterContent.js.map +1 -1
- package/lib/components/Footer/hooks/useFooterContent.mjs +8 -1
- package/lib/components/Footer/hooks/useFooterContent.mjs.map +1 -1
- package/lib/components/Footer/translations/ar.json.js +1 -1
- package/lib/components/Footer/translations/ar.json.mjs +1 -1
- package/lib/components/Footer/translations/de.json.js +1 -1
- package/lib/components/Footer/translations/de.json.mjs +1 -1
- package/lib/components/Footer/translations/el.json.js +1 -1
- package/lib/components/Footer/translations/el.json.mjs +1 -1
- package/lib/components/Footer/translations/en.json.js +1 -0
- package/lib/components/Footer/translations/en.json.js.map +1 -1
- package/lib/components/Footer/translations/en.json.mjs +1 -0
- package/lib/components/Footer/translations/en.json.mjs.map +1 -1
- package/lib/components/Footer/translations/es.json.js +1 -1
- package/lib/components/Footer/translations/es.json.mjs +1 -1
- package/lib/components/Footer/translations/fr.json.js +4 -4
- package/lib/components/Footer/translations/fr.json.mjs +4 -4
- package/lib/components/Footer/translations/it.json.js +1 -1
- package/lib/components/Footer/translations/it.json.mjs +1 -1
- package/lib/components/Footer/translations/ja.json.js +2 -2
- package/lib/components/Footer/translations/ja.json.mjs +2 -2
- package/lib/components/Footer/translations/pt-BR.json.js +1 -1
- package/lib/components/Footer/translations/pt-BR.json.mjs +1 -1
- package/lib/components/Footer/translations/zh-Hans.json.js +4 -4
- package/lib/components/Footer/translations/zh-Hans.json.mjs +4 -4
- package/lib/components/Footer/translations/zh-Hant-TW.json.js +1 -1
- package/lib/components/Footer/translations/zh-Hant-TW.json.mjs +1 -1
- package/lib/components/GridGallery/GridGallery.js.map +1 -1
- package/lib/components/GridGallery/GridGallery.mjs.map +1 -1
- package/lib/components/Header/AccountMenu/AccountMenu.js +12 -20
- package/lib/components/Header/AccountMenu/AccountMenu.js.map +1 -1
- package/lib/components/Header/AccountMenu/AccountMenu.mjs +14 -22
- package/lib/components/Header/AccountMenu/AccountMenu.mjs.map +1 -1
- package/lib/components/Header/AccountMenu/megaphone.http.service.js +1 -4
- package/lib/components/Header/AccountMenu/megaphone.http.service.js.map +1 -1
- package/lib/components/Header/AccountMenu/megaphone.http.service.mjs +1 -4
- package/lib/components/Header/AccountMenu/megaphone.http.service.mjs.map +1 -1
- package/lib/components/Header/CartModalV2/CartModal.js.map +1 -1
- package/lib/components/Header/CartModalV2/CartModal.mjs.map +1 -1
- package/lib/components/Header/Header.js.map +1 -1
- package/lib/components/Header/Header.mjs.map +1 -1
- package/lib/components/Header/Header.styles.d.ts +2 -2
- package/lib/components/Header/Header.types.d.ts +4 -8
- package/lib/components/Header/Header.types.js +1 -2
- package/lib/components/Header/Header.types.js.map +1 -1
- package/lib/components/Header/Header.types.mjs +1 -2
- package/lib/components/Header/Header.types.mjs.map +1 -1
- package/lib/components/Header/LanguageFrame/LanguageFrame.js.map +1 -1
- package/lib/components/Header/LanguageFrame/LanguageFrame.mjs.map +1 -1
- package/lib/components/Header/LanguageFrame/Mobile/Mobile.js.map +1 -1
- package/lib/components/Header/LanguageFrame/Mobile/Mobile.mjs.map +1 -1
- package/lib/components/Header/MenuItem/MenuItem.styles.d.ts +1 -1
- package/lib/components/Header/MenuItem/MenuItem.styles.js +1 -1
- package/lib/components/Header/MenuItem/MenuItem.styles.js.map +1 -1
- package/lib/components/Header/MenuItem/MenuItem.styles.mjs +1 -1
- package/lib/components/Header/MenuItem/MenuItem.styles.mjs.map +1 -1
- package/lib/components/Header/Navigation/MicrositeMenu/MicrositeMenu.styles.d.ts +1 -1
- package/lib/components/Header/Navigation/MobileMenu/MobileMenu.styles.d.ts +1 -1
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.d.ts +1 -1
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.js +63 -85
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.js.map +1 -1
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.mjs +64 -86
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.mjs.map +1 -1
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.styles.d.ts +0 -6
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.styles.js +1 -11
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.styles.js.map +1 -1
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.styles.mjs +2 -10
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.styles.mjs.map +1 -1
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.types.d.ts +1 -5
- package/lib/components/Header/Overlay/Overlay.js.map +1 -1
- package/lib/components/Header/Overlay/Overlay.mjs.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.d.ts +4 -2
- package/lib/components/Header/ProHeader/ProHeader.js +36 -148
- package/lib/components/Header/ProHeader/ProHeader.js.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.mjs +39 -149
- package/lib/components/Header/ProHeader/ProHeader.mjs.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.styles.d.ts +1 -4
- package/lib/components/Header/ProHeader/ProHeader.styles.js +18 -20
- package/lib/components/Header/ProHeader/ProHeader.styles.js.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.styles.mjs +19 -18
- package/lib/components/Header/ProHeader/ProHeader.styles.mjs.map +1 -1
- package/lib/components/Header/translations/en.json.js +1 -4
- package/lib/components/Header/translations/en.json.js.map +1 -1
- package/lib/components/Header/translations/en.json.mjs +2 -4
- package/lib/components/Header/translations/en.json.mjs.map +1 -1
- package/lib/components/Hero/Hero.styles.d.ts +2 -2
- package/lib/components/HeroFadeGallery/HeroFadeGallery.styles.d.ts +1 -1
- package/lib/components/HowToUseSection/HowToUseSection.styles.d.ts +2 -2
- package/lib/components/ImageSequence/ImageSequence.js.map +1 -1
- package/lib/components/ImageSequence/ImageSequence.mjs.map +1 -1
- package/lib/components/LandingPage/Cards/Card/Card.js.map +1 -1
- package/lib/components/LandingPage/Cards/Card/Card.mjs.map +1 -1
- package/lib/components/LandingPage/Cards/Cards.js.map +1 -1
- package/lib/components/LandingPage/Cards/Cards.mjs.map +1 -1
- package/lib/components/LandingPagePro/LandingPagePro.d.ts +0 -3
- package/lib/components/LandingPagePro/LandingPagePro.js +3 -3
- package/lib/components/LandingPagePro/LandingPagePro.js.map +1 -1
- package/lib/components/LandingPagePro/LandingPagePro.mjs +2 -2
- package/lib/components/LandingPagePro/LandingPagePro.mjs.map +1 -1
- package/lib/components/LandingPagePro/LandingPagePro.styles.d.ts +1 -1
- package/lib/components/LayoutRenderer/LayoutRenderer.styles.d.ts +1 -1
- package/lib/components/LayoutRendererV1/LayoutRenderer.styles.d.ts +3 -3
- package/lib/components/LayoutRendererV2/LayoutRenderer.styles.d.ts +3 -3
- package/lib/components/MicrositeIntroductionBlock/MicrositeIntroductionBlock.js.map +1 -1
- package/lib/components/MicrositeIntroductionBlock/MicrositeIntroductionBlock.mjs.map +1 -1
- package/lib/components/MicrositeMediaGrid/MicrositeMediaGrid.js.map +1 -1
- package/lib/components/MicrositeMediaGrid/MicrositeMediaGrid.mjs.map +1 -1
- package/lib/components/MicrositeProductGrid/MicrositeProductGrid.js.map +1 -1
- package/lib/components/MicrositeProductGrid/MicrositeProductGrid.mjs.map +1 -1
- package/lib/components/MicrositeSectionWrap/MicrositeSectionWrap.styles.d.ts +1 -1
- package/lib/components/Microsites/MicrositeProductPage.js +39 -0
- package/lib/components/Microsites/MicrositeProductPage.js.map +1 -1
- package/lib/components/Microsites/MicrositeProductPage.mjs +39 -0
- package/lib/components/Microsites/MicrositeProductPage.mjs.map +1 -1
- package/lib/components/ModelCompareV3/StickyGrid/StickyGridHeader.js.map +1 -1
- package/lib/components/ModelCompareV3/StickyGrid/StickyGridHeader.mjs.map +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmPro.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmPro.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProMax.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProMax.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProSpecial.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProSpecial.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/udmPro.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/udmPro.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/udmProMax.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/udmProMax.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/udmProSpecial.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/udmProSpecial.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/data/CloudGateways.js +9 -9
- package/lib/components/ModelCompareV3/data/CloudGateways.mjs +6 -6
- package/lib/components/ModelCompareV3/data/products/udmPro.js +1 -1
- package/lib/components/ModelCompareV3/data/products/udmPro.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProMax.js +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProMax.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProSpecial.js +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProSpecial.mjs +1 -1
- package/lib/components/ProductCompare/ProductCompare.js.map +1 -1
- package/lib/components/ProductCompare/ProductCompare.mjs.map +1 -1
- package/lib/components/ProductSectionNavigation/ProductSectionNavigation.styles.d.ts +1 -1
- package/lib/components/ProductSectionNavigationV2/ProductSectionNavigation.styles.d.ts +1 -1
- package/lib/components/ProductTechSpecs/ProductTechSpecs.styles.d.ts +1 -1
- package/lib/components/QuantityControls/QuantityControls.js.map +1 -1
- package/lib/components/QuantityControls/QuantityControls.mjs.map +1 -1
- package/lib/components/RelatedProducts/RelatedProducts.js.map +1 -1
- package/lib/components/RelatedProducts/RelatedProducts.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.js +17 -313
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.mjs +17 -311
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.d.ts +2 -3
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.js +0 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.mjs +0 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.js +34 -120
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.mjs +34 -120
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.styles.d.ts +2 -16
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.styles.js +12 -54
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.styles.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.styles.mjs +11 -50
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/DeviceSelect.styles.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/assets/ArrowLeftPrimary.svg.js +5 -5
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/DeviceSelect/assets/ArrowRightPrimary.svg.js +5 -5
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.js +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.js +0 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.mjs +0 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/useComputeResourceCalculator.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/useComputeResourceCalculator.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/useComputeResourceCalculator.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/useComputeResourceCalculator.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.js +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ResourceCalculator.js +2 -1
- package/lib/components/ResourceCalculatorV1/ResourceCalculator.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ResourceCalculator.mjs +2 -1
- package/lib/components/ResourceCalculatorV1/ResourceCalculator.mjs.map +1 -1
- package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/HorizontalOptionSelect.d.ts +1 -1
- package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/HorizontalOptionSelect.js +1 -3
- package/lib/components/ResourceCalculatorV1/components/HorizontalOptionSelect/HorizontalOptionSelect.js.map +1 -0
- package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/HorizontalOptionSelect.mjs +1 -3
- package/lib/components/ResourceCalculatorV1/components/HorizontalOptionSelect/HorizontalOptionSelect.mjs.map +1 -0
- package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/HorizontalOptionSelect.styles.d.ts +0 -1
- package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/HorizontalOptionSelect.styles.js +7 -10
- package/lib/components/ResourceCalculatorV1/components/HorizontalOptionSelect/HorizontalOptionSelect.styles.js.map +1 -0
- package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/HorizontalOptionSelect.styles.mjs +7 -10
- package/lib/components/ResourceCalculatorV1/components/HorizontalOptionSelect/HorizontalOptionSelect.styles.mjs.map +1 -0
- package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/HorizontalOptionSelect.types.d.ts +0 -1
- package/lib/components/ResourceCalculatorV1/components/index.d.ts +1 -0
- package/lib/components/ResourceCalculatorV1/components/index.js +5 -0
- package/lib/components/{Header/Navigation/ProMenu → ResourceCalculatorV1/components}/index.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/components/index.mjs +3 -0
- package/lib/components/ResourceCalculatorV1/translations/en.json.js +4 -6
- package/lib/components/ResourceCalculatorV1/translations/en.json.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/translations/en.json.mjs +4 -6
- package/lib/components/ResourceCalculatorV1/translations/en.json.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/translations/useResourceCalculatorTranslation.d.ts +2 -2
- package/lib/components/ReverseLoopingVideo/ReverseLoopingVideo.js.map +1 -1
- package/lib/components/ReverseLoopingVideo/ReverseLoopingVideo.mjs.map +1 -1
- package/lib/components/ScrollWrapper/ScrollWrapper.js.map +1 -1
- package/lib/components/ScrollWrapper/ScrollWrapper.mjs.map +1 -1
- package/lib/components/StorageSliders/Slider/Slider.js.map +1 -1
- package/lib/components/StorageSliders/Slider/Slider.mjs.map +1 -1
- package/lib/components/StorageSliders/StorageSliders.context.js.map +1 -1
- package/lib/components/StorageSliders/StorageSliders.context.mjs.map +1 -1
- package/lib/components/VariantSelector/Variant/Compatibility/Compatibility.js.map +1 -1
- package/lib/components/VariantSelector/Variant/Compatibility/Compatibility.mjs.map +1 -1
- package/lib/components/VariantSelector/Variant/Variant.js.map +1 -1
- package/lib/components/VariantSelector/Variant/Variant.mjs.map +1 -1
- package/lib/components/index.d.ts +0 -1
- package/lib/components/index.js +0 -2
- package/lib/components/index.js.map +1 -1
- package/lib/components/index.mjs +0 -2
- package/lib/components/index.mjs.map +1 -1
- package/lib/constants/icons/options/colors/black.svg.js +5 -5
- package/lib/constants/icons/options/colors/index.js +3 -3
- package/lib/constants/icons/options/styles/black.svg.js +5 -5
- package/lib/constants/icons/options/styles/index.js +3 -3
- package/lib/constants/optionIcons.js +6 -6
- package/lib/constants/optionIcons.mjs +4 -4
- package/lib/constants/proStoreCategories/mapping/index.d.ts +0 -1
- package/lib/constants/proStoreCategories/mapping/index.js +10 -15
- package/lib/constants/proStoreCategories/mapping/index.js.map +1 -1
- package/lib/constants/proStoreCategories/mapping/index.mjs +10 -15
- package/lib/constants/proStoreCategories/mapping/index.mjs.map +1 -1
- package/lib/constants/proStoreCategories/mapping/unifi.d.ts +1 -2
- package/lib/constants/proStoreCategories/mapping/unifi.js +0 -1
- package/lib/constants/proStoreCategories/mapping/unifi.js.map +1 -1
- package/lib/constants/proStoreCategories/mapping/unifi.mjs +0 -1
- package/lib/constants/proStoreCategories/mapping/unifi.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/en.json.js +0 -3
- package/lib/constants/proStoreCategories/translations/en.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/en.json.mjs +1 -3
- package/lib/constants/proStoreCategories/translations/en.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/fr.json.js +1 -1
- package/lib/constants/proStoreCategories/translations/fr.json.mjs +1 -1
- package/lib/constants/proStoreCategories/translations/zh-Hans.json.js +1 -1
- package/lib/constants/proStoreCategories/translations/zh-Hans.json.mjs +1 -1
- package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.js +1 -1
- package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.mjs +1 -1
- package/lib/constants/url.d.ts +2 -1
- package/lib/constants/url.js +1 -0
- package/lib/constants/url.js.map +1 -1
- package/lib/constants/url.mjs +1 -0
- package/lib/constants/url.mjs.map +1 -1
- package/lib/contexts/MenuContext/context.js +1 -1
- package/lib/contexts/MenuContext/context.js.map +1 -1
- package/lib/contexts/MenuContext/context.mjs +1 -1
- package/lib/contexts/MenuContext/context.mjs.map +1 -1
- package/lib/contexts/MenuContext/utils.js +1 -0
- package/lib/contexts/MenuContext/utils.js.map +1 -1
- package/lib/contexts/MenuContext/utils.mjs +1 -0
- package/lib/contexts/MenuContext/utils.mjs.map +1 -1
- package/lib/helpers/index.d.ts +0 -1
- package/lib/helpers/index.js +0 -11
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/index.mjs +0 -1
- package/lib/helpers/index.mjs.map +1 -1
- package/lib/helpers/ux.d.ts +1 -9
- package/lib/helpers/ux.js +0 -15
- package/lib/helpers/ux.js.map +1 -1
- package/lib/helpers/ux.mjs +1 -15
- package/lib/helpers/ux.mjs.map +1 -1
- package/lib/hooks/useHasTouch.js.map +1 -1
- package/lib/hooks/useHasTouch.mjs.map +1 -1
- package/lib/hooks/useHorizontalScroll.js.map +1 -1
- package/lib/hooks/useHorizontalScroll.mjs.map +1 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/types/index.js +0 -2
- package/lib/types/index.js.map +1 -1
- package/lib/types/index.mjs +0 -1
- package/lib/types/index.mjs.map +1 -1
- package/lib/utils/array.d.ts +0 -4
- package/lib/utils/array.js +0 -10
- package/lib/utils/array.js.map +1 -1
- package/lib/utils/array.mjs +1 -10
- package/lib/utils/array.mjs.map +1 -1
- package/lib/utils/money/constants.d.ts +25 -56
- package/lib/utils/money/constants.js +7 -72
- package/lib/utils/money/constants.js.map +1 -1
- package/lib/utils/money/constants.mjs +7 -70
- package/lib/utils/money/constants.mjs.map +1 -1
- package/lib/utils/money/format.d.ts +5 -10
- package/lib/utils/money/format.js +14 -22
- package/lib/utils/money/format.js.map +1 -1
- package/lib/utils/money/format.mjs +16 -23
- package/lib/utils/money/format.mjs.map +1 -1
- package/lib/utils/money/index.d.ts +1 -4
- package/lib/utils/money/index.js +8 -26
- package/lib/utils/money/index.js.map +1 -1
- package/lib/utils/money/index.mjs +4 -8
- package/lib/utils/money/index.mjs.map +1 -1
- package/lib/utils/money/misc.d.ts +28 -68
- package/lib/utils/money/misc.js +64 -35
- package/lib/utils/money/misc.js.map +1 -1
- package/lib/utils/money/misc.mjs +43 -32
- package/lib/utils/money/misc.mjs.map +1 -1
- package/lib/utils/money/tax.d.ts +2 -38
- package/lib/utils/money/tax.js +10 -46
- package/lib/utils/money/tax.js.map +1 -1
- package/lib/utils/money/tax.mjs +11 -42
- package/lib/utils/money/tax.mjs.map +1 -1
- package/lib/utils/money/types.d.ts +3 -78
- package/lib/utils/number.d.ts +1 -1
- package/lib/utils/number.js +1 -1
- package/lib/utils/number.js.map +1 -1
- package/lib/utils/number.mjs +1 -1
- package/lib/utils/number.mjs.map +1 -1
- package/lib/utils/validations/postalCodeSuperRefinement.js +3 -0
- package/lib/utils/validations/postalCodeSuperRefinement.js.map +1 -1
- package/lib/utils/validations/postalCodeSuperRefinement.mjs +3 -0
- package/lib/utils/validations/postalCodeSuperRefinement.mjs.map +1 -1
- package/lib/utils/validations/stateRegistrationNumberSuperRefinement.js +2 -0
- package/lib/utils/validations/stateRegistrationNumberSuperRefinement.js.map +1 -1
- package/lib/utils/validations/stateRegistrationNumberSuperRefinement.mjs +2 -0
- package/lib/utils/validations/stateRegistrationNumberSuperRefinement.mjs.map +1 -1
- package/lib/utils/validations/taxIdSuperRefinement.js +2 -0
- package/lib/utils/validations/taxIdSuperRefinement.js.map +1 -1
- package/lib/utils/validations/taxIdSuperRefinement.mjs +2 -0
- package/lib/utils/validations/taxIdSuperRefinement.mjs.map +1 -1
- package/lib/utils/validations.d.ts +15 -0
- package/lib/utils/validations.js +23 -0
- package/lib/utils/validations.js.map +1 -0
- package/lib/utils/validations.mjs +21 -0
- package/lib/utils/validations.mjs.map +1 -0
- package/lib/utils/variant.js.map +1 -1
- package/lib/utils/variant.mjs.map +1 -1
- package/lib/utils/wattage.js.map +1 -1
- package/lib/utils/wattage.mjs.map +1 -1
- package/package.json +1 -1
- package/lib/assets/efg.png +0 -0
- package/lib/assets/icon-location-pin.svg +0 -5
- package/lib/assets/icons/menu/icon-location-pin.svg.js +0 -27
- package/lib/assets/icons/menu/icon-location-pin.svg.js.map +0 -1
- package/lib/assets/icons/menu/icon-location-pin.svg.mjs +0 -3
- package/lib/assets/icons/menu/icon-location-pin.svg.mjs.map +0 -1
- package/lib/assets/ucg-max.png +0 -0
- package/lib/components/Header/Navigation/ProMenu/ProMenu.d.ts +0 -2
- package/lib/components/Header/Navigation/ProMenu/ProMenu.js +0 -109
- package/lib/components/Header/Navigation/ProMenu/ProMenu.js.map +0 -1
- package/lib/components/Header/Navigation/ProMenu/ProMenu.mjs +0 -87
- package/lib/components/Header/Navigation/ProMenu/ProMenu.mjs.map +0 -1
- package/lib/components/Header/Navigation/ProMenu/ProMenu.styles.d.ts +0 -24
- package/lib/components/Header/Navigation/ProMenu/ProMenu.styles.js +0 -154
- package/lib/components/Header/Navigation/ProMenu/ProMenu.styles.js.map +0 -1
- package/lib/components/Header/Navigation/ProMenu/ProMenu.styles.mjs +0 -138
- package/lib/components/Header/Navigation/ProMenu/ProMenu.styles.mjs.map +0 -1
- package/lib/components/Header/Navigation/ProMenu/ProMenu.types.d.ts +0 -13
- package/lib/components/Header/Navigation/ProMenu/index.d.ts +0 -1
- package/lib/components/Header/Navigation/ProMenu/index.js +0 -6
- package/lib/components/Header/Navigation/ProMenu/index.mjs +0 -3
- package/lib/components/HorizontalOptionSelect/HorizontalOptionSelect.js.map +0 -1
- package/lib/components/HorizontalOptionSelect/HorizontalOptionSelect.mjs.map +0 -1
- package/lib/components/HorizontalOptionSelect/HorizontalOptionSelect.styles.js.map +0 -1
- package/lib/components/HorizontalOptionSelect/HorizontalOptionSelect.styles.mjs.map +0 -1
- package/lib/components/ResourceCalculatorV1/assets/consoles/efg.png.js +0 -27
- package/lib/components/ResourceCalculatorV1/assets/consoles/efg.png.js.map +0 -1
- package/lib/components/ResourceCalculatorV1/assets/consoles/efg.png.mjs +0 -3
- package/lib/components/ResourceCalculatorV1/assets/consoles/efg.png.mjs.map +0 -1
- package/lib/components/ResourceCalculatorV1/assets/consoles/ucg-max.png.js.map +0 -1
- package/lib/components/ResourceCalculatorV1/assets/consoles/ucg-max.png.mjs +0 -3
- package/lib/components/ResourceCalculatorV1/assets/consoles/ucg-max.png.mjs.map +0 -1
- package/lib/helpers/product.d.ts +0 -87
- package/lib/helpers/product.js +0 -346
- package/lib/helpers/product.js.map +0 -1
- package/lib/helpers/product.mjs +0 -335
- package/lib/helpers/product.mjs.map +0 -1
- package/lib/types/product.d.ts +0 -87
- package/lib/types/product.js +0 -14
- package/lib/types/product.js.map +0 -1
- package/lib/types/product.mjs +0 -13
- package/lib/types/product.mjs.map +0 -1
- package/lib/utils/money/allocators/fixedAmount.d.ts +0 -26
- package/lib/utils/money/allocators/fixedAmount.js +0 -55
- package/lib/utils/money/allocators/fixedAmount.js.map +0 -1
- package/lib/utils/money/allocators/fixedAmount.mjs +0 -53
- package/lib/utils/money/allocators/fixedAmount.mjs.map +0 -1
- package/lib/utils/money/allocators/index.d.ts +0 -2
- package/lib/utils/money/allocators/index.js +0 -8
- package/lib/utils/money/allocators/index.js.map +0 -1
- package/lib/utils/money/allocators/index.mjs +0 -4
- package/lib/utils/money/allocators/index.mjs.map +0 -1
- package/lib/utils/money/allocators/productAmount.d.ts +0 -13
- package/lib/utils/money/allocators/productAmount.js +0 -110
- package/lib/utils/money/allocators/productAmount.js.map +0 -1
- package/lib/utils/money/allocators/productAmount.mjs +0 -108
- package/lib/utils/money/allocators/productAmount.mjs.map +0 -1
- package/lib/utils/money/exchangeRate.d.ts +0 -31
- package/lib/utils/money/exchangeRate.js +0 -27
- package/lib/utils/money/exchangeRate.js.map +0 -1
- package/lib/utils/money/exchangeRate.mjs +0 -23
- package/lib/utils/money/exchangeRate.mjs.map +0 -1
- package/lib/utils/money/misc.private.d.ts +0 -23
- package/lib/utils/money/misc.private.js +0 -46
- package/lib/utils/money/misc.private.js.map +0 -1
- package/lib/utils/money/misc.private.mjs +0 -21
- package/lib/utils/money/misc.private.mjs.map +0 -1
- package/lib/utils/money/shipping.d.ts +0 -5
- package/lib/utils/money/shipping.js +0 -8
- package/lib/utils/money/shipping.js.map +0 -1
- package/lib/utils/money/shipping.mjs +0 -6
- package/lib/utils/money/shipping.mjs.map +0 -1
- package/lib/utils/money/tax.private.d.ts +0 -17
- package/lib/utils/money/tax.private.js +0 -65
- package/lib/utils/money/tax.private.js.map +0 -1
- package/lib/utils/money/tax.private.mjs +0 -60
- package/lib/utils/money/tax.private.mjs.map +0 -1
- package/lib/utils/productSort.d.ts +0 -41
- package/lib/utils/productSort.js +0 -66
- package/lib/utils/productSort.js.map +0 -1
- package/lib/utils/productSort.mjs +0 -59
- package/lib/utils/productSort.mjs.map +0 -1
- /package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/index.d.ts +0 -0
- /package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/index.js +0 -0
- /package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/index.js.map +0 -0
- /package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/index.mjs +0 -0
- /package/lib/components/{HorizontalOptionSelect → ResourceCalculatorV1/components/HorizontalOptionSelect}/index.mjs.map +0 -0
- /package/lib/components/{Header/Navigation/ProMenu → ResourceCalculatorV1/components}/index.mjs.map +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductCompare.js","sources":["../../../src/components/ProductCompare/ProductCompare.tsx"],"sourcesContent":["import merge from \"lodash/merge\";\nimport { useCallback, useMemo, useRef } from \"react\";\n\nimport { getTemplateIconSvg } from \"../../helpers/shopify/iconParsing\";\nimport { formatPrice } from \"../../utils/money\";\nimport { Button, CartButton } from \"../Button\";\nimport { CustomImage } from \"../CustomImage\";\nimport { ScrollWrapper } from \"../ScrollWrapper\";\nimport { StyleableSvgImage } from \"../StyleableSvgImage\";\nimport { PRODUCT_COMPARE_MAPPING } from \"./mapping\";\nimport type { ProductCompareSection } from \"./mapping\";\nimport { defaultProductCompareTranslations } from \"./ProductCompare.constants\";\nimport * as S from \"./ProductCompare.styles\";\nimport type {\n ProductCompareLayoutVariant,\n ProductCompareProps,\n} from \"./ProductCompare.types\";\nimport { parseProductCompareVariants } from \"./ProductCompare.utils\";\n\nexport const ProductCompare = function ProductCompare({\n className,\n renderImage,\n variants,\n translations: initialTranslations,\n onVariantLearnMore,\n onVariantAddToCart,\n}: ProductCompareProps) {\n // #############################################################################\n // Merge translations\n // #############################################################################\n const translations = useMemo(() => {\n return merge(defaultProductCompareTranslations, initialTranslations);\n }, [initialTranslations]);\n\n // #############################################################################\n // Misc\n // #############################################################################\n const getVariantImage = useCallback(\n (variant: ProductCompareProps[\"variants\"][number]) => {\n return variant.images?.find((el) => !el.isVideo);\n },\n [],\n );\n\n // #############################################################################\n // Parse variants and compare data\n // #############################################################################\n const parsedVariants = useMemo((): ProductCompareLayoutVariant[] => {\n return parseProductCompareVariants(variants);\n }, [variants]);\n\n // const anyHasFeatureText = useMemo(() => {\n // return parsedVariants.some(\n // (variant) => !!getVariantFeatureText(variant, translations)\n // );\n // }, [parsedVariants, translations]);\n\n // #############################################################################\n // Compare section\n // #############################################################################\n const section = useMemo((): ProductCompareSection | null => {\n // Use the first found item's section id\n for (const parsedVariant of parsedVariants) {\n return (\n PRODUCT_COMPARE_MAPPING.sections.find(\n (section) => section.id === parsedVariant.compareSectionId,\n ) ?? null\n );\n }\n\n return null;\n }, [parsedVariants]);\n\n // #############################################################################\n // Price\n // #############################################################################\n const getPrice = useCallback(\n (variant: ProductCompareProps[\"variants\"][number]) => {\n const price = formatPrice(variant.displayPrice);\n\n const fromPrice = variant.fromPrice\n ? translations.fromPrice(formatPrice(variant.fromPrice))\n : undefined;\n\n return fromPrice || price;\n },\n [translations],\n );\n\n // #############################################################################\n // Row heights\n // #############################################################################\n const allRowHeights = useRef<Record<number, number[]>>(\n parsedVariants.reduce<Record<number, number[]>>((map, variant) => {\n for (let row = 0; row < variant.compare.features.length; row++) {\n if (!map[row]) {\n map[row] = [];\n }\n }\n return map;\n }, {}),\n );\n\n // #############################################################################\n // Render\n // #############################################################################\n if (!section || parsedVariants.length < 2) {\n return null;\n }\n\n return (\n <S.Wrap className={className}>\n {/* Main section */}\n <S.Section>\n {section.title && <S.SectionTitle>{section.title}</S.SectionTitle>}\n <S.ItemsWrap>\n <ScrollWrapper\n align=\"center\"\n direction=\"horizontal\"\n scrollStepType=\"itemWidth\"\n fillType=\"gradient\"\n items={parsedVariants.map((variant) => ({\n id: variant.variantId,\n render: function Render() {\n // const featureText = getVariantFeatureText(\n // variant,\n // translations\n // );\n\n return (\n <S.Item>\n <S.HeaderWrap>\n <S.ImageWrap>\n <CustomImage\n renderImage={renderImage}\n asset={getVariantImage(variant)}\n sizes=\"150px\"\n layout=\"fill\"\n objectFit=\"contain\"\n />\n </S.ImageWrap>\n {/* Comment out for now, maybe will be used in the future */}\n {/* {anyHasFeatureText && (\n <ProductFeatureText\n $isInactive={variant.isSoldOut}\n $hidden={!featureText}\n >\n {featureText ?? \"-\"}\n </ProductFeatureText>\n )} */}\n <S.Title>{variant.title}</S.Title>\n </S.HeaderWrap>\n <S.FeaturesWrap>\n {variant.compare.features.map((feature, row) => {\n const featureIconSvg = getTemplateIconSvg(feature.icon);\n\n const rowHeights = allRowHeights.current[row];\n const height = rowHeights?.length\n ? Math.max(...rowHeights)\n : undefined;\n\n return (\n <S.Feature\n key={feature.icon + row}\n ref={(el) => {\n if (!rowHeights || !el) return;\n rowHeights.push(el.offsetHeight);\n }}\n $height={height}\n >\n <S.FeatureIcon>\n {feature.value ? (\n <>\n {featureIconSvg && (\n <StyleableSvgImage\n src={featureIconSvg}\n width={16}\n height={16}\n />\n )}\n </>\n ) : (\n <S.FeatureDash />\n )}\n </S.FeatureIcon>\n {feature.value && (\n <S.FeatureText\n dangerouslySetInnerHTML={{\n __html: feature.value,\n }}\n />\n )}\n </S.Feature>\n );\n })}\n\n {/* Footnotes */}\n {variant.compare.footnotes?.map((footnote, i) => (\n <S.FeatureFootnote key={footnote + i}>\n {footnote}\n </S.FeatureFootnote>\n ))}\n </S.FeaturesWrap>\n <S.FooterWrap>\n <S.PriceWrap>\n <S.Title>{getPrice(variant)}</S.Title>\n {onVariantLearnMore && (\n <Button\n variant=\"link\"\n onClick={() => onVariantLearnMore(variant.id)}\n >\n <S.ButtonText>\n {translations.learnMore}\n </S.ButtonText>\n </Button>\n )}\n </S.PriceWrap>\n {onVariantAddToCart && (\n <CartButton\n variant=\"primary\"\n disabled={!variant.isInStock}\n onClick={() =>\n variant.isInStock &&\n onVariantAddToCart(variant.variantId, 1)\n }\n />\n )}\n </S.FooterWrap>\n </S.Item>\n );\n },\n }))}\n />\n </S.ItemsWrap>\n </S.Section>\n\n {/* Sub-sections */}\n {section.subSections?.map((subSection, i) => (\n <S.Section key={subSection.title + i}>\n <S.SectionTitle>{subSection.title}</S.SectionTitle>\n {subSection.image && (\n <CustomImage\n renderImage={renderImage}\n asset={subSection.image}\n sizes={`${subSection.image.width}px`}\n responsive\n />\n )}\n </S.Section>\n ))}\n </S.Wrap>\n );\n};\n"],"names":["ProductCompare","ProductCompare2","className","renderImage","variants","translations","initialTranslations","onVariantLearnMore","onVariantAddToCart","useMemo","merge","defaultProductCompareTranslations","getVariantImage","useCallback","variant","images","find","el","isVideo","parsedVariants","parseProductCompareVariants","section","parsedVariant","PRODUCT_COMPARE_MAPPING","sections","id","compareSectionId","getPrice","price","formatPrice","displayPrice","fromPrice","allRowHeights","useRef","reduce","map","row","compare","features","length","jsxs","S.Wrap","children","S.Section","title","jsx","S.SectionTitle","S.ItemsWrap","ScrollWrapper","align","direction","scrollStepType","fillType","items","variantId","render","Render","S.Item","S.HeaderWrap","S.ImageWrap","CustomImage","asset","sizes","layout","objectFit","S.Title","S.FeaturesWrap","feature","featureIconSvg","getTemplateIconSvg","icon","rowHeights","current","height","Math","max","S.Feature","Feature","ref","push","offsetHeight","$height","S.FeatureIcon","FeatureIcon","value","StyleableSvgImage","src","width","S.FeatureDash","S.FeatureText","FeatureText","dangerouslySetInnerHTML","__html","footnotes","footnote","i","S.FeatureFootnote","FeatureFootnote","S.FooterWrap","S.PriceWrap","Title","Button","onClick","S.ButtonText","ButtonText","learnMore","CartButton","disabled","isInStock","subSections","subSection","image","responsive"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBa,MAAAA,cAAA,GAAiB,SAASA,eAAeC,CAAA;EACpDC,SAAA;EACAC,WAAA;EACAC,QAAA;EACAC,YAAc,EAAAC,mBAAA;EACdC,kBAAA;EACAC;AACF,CAAwB,EAAA;EAIhB,MAAAH,YAAA,GAAeI,KAAAA,CAAAA,QAAQ,MAAM;IAC1B,OAAAC,cAAA,CAAA,SAAA,CAAA,CAAMC,4DAAmCL,mBAAmB,CAAA;EAAA,CACrE,EAAG,CAACA,mBAAmB,CAAC,CAAA;EAKxB,MAAMM,eAAkB,GAAAC,KAAA,CAAAA,WAAA,CACrBC,OAAqD,IAAA;IACpD,OAAOA,QAAQC,MAAQ,EAAAC,IAAA,CAAMC,EAAO,IAAA,CAACA,GAAGC,OAAO,CAAA;EACjD,CAAA,EACA,EAAC,CACH;EAKM,MAAAC,cAAA,GAAiBV,KAAAA,CAAAA,QAAQ,MAAqC;IAClE,OAAOW,oBAAAA,CAAAA,4BAA4BhB,QAAQ,CAAA;EAAA,CAC7C,EAAG,CAACA,QAAQ,CAAC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AAA,CAAAA,IAAA,CAACG,6BAAE,EAAF;MACCD,QAAA,EAAA,CAAAG,eAAAA,UAAAA,CAAAA,GAAA,CAACC,qBAAAA,CAAAA,YAAE,EAAF;QAAgBJ,QAAA,EAAAoE,UAAA,CAAWlE;MAAM,CAAA,CAAA,EACjCkE,WAAWC,KACV,IAAA,eAAAlE,UAAA,CAAAA,GAAA,CAACe,WAAA,CAAAA,WAAA,EAAA;QACCzD,WAAA;QACA0D,OAAOiD,UAAW,CAAAC,KAAA;QAClBjD,KAAO,EAAA,GAAGgD,UAAW,CAAAC,KAAA,CAAMxB,KAAK,IAAA;QAChCyB,UAAU,EAAA;MAAA,CACZ,CAAA;IARY,CAAA,EAAAF,UAAA,CAAWlE,KAAQ,GAAAmD,CAUnC,CACD,CAAA;EACH,CAAA,CAAA;AAEJ,CAAA;"}
|
|
1
|
+
{"version":3,"file":"ProductCompare.js","sources":["../../../src/components/ProductCompare/ProductCompare.tsx"],"sourcesContent":["import merge from \"lodash/merge\";\nimport { useCallback, useMemo, useRef } from \"react\";\n\nimport { getTemplateIconSvg } from \"../../helpers/shopify/iconParsing\";\nimport { formatPrice } from \"../../utils/money\";\nimport { Button, CartButton } from \"../Button\";\nimport { CustomImage } from \"../CustomImage\";\nimport { ScrollWrapper } from \"../ScrollWrapper\";\nimport { StyleableSvgImage } from \"../StyleableSvgImage\";\nimport { PRODUCT_COMPARE_MAPPING } from \"./mapping\";\nimport type { ProductCompareSection } from \"./mapping\";\nimport { defaultProductCompareTranslations } from \"./ProductCompare.constants\";\nimport * as S from \"./ProductCompare.styles\";\nimport type {\n ProductCompareLayoutVariant,\n ProductCompareProps,\n} from \"./ProductCompare.types\";\nimport { parseProductCompareVariants } from \"./ProductCompare.utils\";\n\nexport const ProductCompare = function ProductCompare({\n className,\n renderImage,\n variants,\n translations: initialTranslations,\n onVariantLearnMore,\n onVariantAddToCart,\n}: ProductCompareProps) {\n // #############################################################################\n // Merge translations\n // #############################################################################\n const translations = useMemo(() => {\n return merge(defaultProductCompareTranslations, initialTranslations);\n }, [initialTranslations]);\n\n // #############################################################################\n // Misc\n // #############################################################################\n const getVariantImage = useCallback(\n (variant: ProductCompareProps[\"variants\"][number]) => {\n return variant.images?.find((el) => !el.isVideo);\n },\n [],\n );\n\n // #############################################################################\n // Parse variants and compare data\n // #############################################################################\n const parsedVariants = useMemo((): ProductCompareLayoutVariant[] => {\n return parseProductCompareVariants(variants);\n }, [variants]);\n\n // const anyHasFeatureText = useMemo(() => {\n // return parsedVariants.some(\n // (variant) => !!getVariantFeatureText(variant, translations)\n // );\n // }, [parsedVariants, translations]);\n\n // #############################################################################\n // Compare section\n // #############################################################################\n const section = useMemo((): ProductCompareSection | null => {\n // Use the first found item's section id\n for (const parsedVariant of parsedVariants) {\n return (\n PRODUCT_COMPARE_MAPPING.sections.find(\n (section) => section.id === parsedVariant.compareSectionId,\n ) ?? null\n );\n }\n\n return null;\n }, [parsedVariants]);\n\n // #############################################################################\n // Price\n // #############################################################################\n const getPrice = useCallback(\n (variant: ProductCompareProps[\"variants\"][number]) => {\n const price = formatPrice(variant.displayPrice);\n\n const fromPrice = variant.fromPrice\n ? translations.fromPrice(formatPrice(variant.fromPrice))\n : undefined;\n\n return fromPrice || price;\n },\n [translations],\n );\n\n // #############################################################################\n // Row heights\n // #############################################################################\n const allRowHeights = useRef<Record<number, number[]>>(\n parsedVariants.reduce<Record<number, number[]>>((map, variant) => {\n for (let row = 0; row < variant.compare.features.length; row++) {\n if (!map[row]) {\n map[row] = [];\n }\n }\n return map;\n }, {}),\n );\n\n // #############################################################################\n // Render\n // #############################################################################\n if (!section || parsedVariants.length < 2) {\n return null;\n }\n\n return (\n <S.Wrap className={className}>\n {/* Main section */}\n <S.Section>\n {section.title && <S.SectionTitle>{section.title}</S.SectionTitle>}\n <S.ItemsWrap>\n <ScrollWrapper\n align=\"center\"\n direction=\"horizontal\"\n scrollStepType=\"itemWidth\"\n fillType=\"gradient\"\n items={parsedVariants.map((variant) => ({\n id: variant.variantId,\n render: function Render() {\n // const featureText = getVariantFeatureText(\n // variant,\n // translations\n // );\n\n return (\n <S.Item>\n <S.HeaderWrap>\n <S.ImageWrap>\n <CustomImage\n renderImage={renderImage}\n asset={getVariantImage(variant)}\n sizes=\"150px\"\n layout=\"fill\"\n objectFit=\"contain\"\n />\n </S.ImageWrap>\n {/* Comment out for now, maybe will be used in the future */}\n {/* {anyHasFeatureText && (\n <ProductFeatureText\n $isInactive={variant.isSoldOut}\n $hidden={!featureText}\n >\n {featureText ?? \"-\"}\n </ProductFeatureText>\n )} */}\n <S.Title>{variant.title}</S.Title>\n </S.HeaderWrap>\n <S.FeaturesWrap>\n {variant.compare.features.map((feature, row) => {\n const featureIconSvg = getTemplateIconSvg(feature.icon);\n\n const rowHeights = allRowHeights.current[row];\n const height = rowHeights?.length\n ? Math.max(...rowHeights)\n : undefined;\n\n return (\n <S.Feature\n key={feature.icon + row}\n ref={(el) => {\n if (!rowHeights || !el) return;\n rowHeights.push(el.offsetHeight);\n }}\n $height={height}\n >\n <S.FeatureIcon>\n {feature.value ? (\n <>\n {featureIconSvg && (\n <StyleableSvgImage\n src={featureIconSvg}\n width={16}\n height={16}\n />\n )}\n </>\n ) : (\n <S.FeatureDash />\n )}\n </S.FeatureIcon>\n {feature.value && (\n <S.FeatureText\n dangerouslySetInnerHTML={{\n __html: feature.value,\n }}\n />\n )}\n </S.Feature>\n );\n })}\n\n {/* Footnotes */}\n {variant.compare.footnotes?.map((footnote, i) => (\n <S.FeatureFootnote key={footnote + i}>\n {footnote}\n </S.FeatureFootnote>\n ))}\n </S.FeaturesWrap>\n <S.FooterWrap>\n <S.PriceWrap>\n <S.Title>{getPrice(variant)}</S.Title>\n {onVariantLearnMore && (\n <Button\n variant=\"link\"\n onClick={() => onVariantLearnMore(variant.id)}\n >\n <S.ButtonText>\n {translations.learnMore}\n </S.ButtonText>\n </Button>\n )}\n </S.PriceWrap>\n {onVariantAddToCart && (\n <CartButton\n variant=\"primary\"\n disabled={!variant.isInStock}\n onClick={() =>\n variant.isInStock &&\n onVariantAddToCart(variant.variantId, 1)\n }\n />\n )}\n </S.FooterWrap>\n </S.Item>\n );\n },\n }))}\n />\n </S.ItemsWrap>\n </S.Section>\n\n {/* Sub-sections */}\n {section.subSections?.map((subSection, i) => (\n <S.Section key={subSection.title + i}>\n <S.SectionTitle>{subSection.title}</S.SectionTitle>\n {subSection.image && (\n <CustomImage\n renderImage={renderImage}\n asset={subSection.image}\n sizes={`${subSection.image.width}px`}\n responsive\n />\n )}\n </S.Section>\n ))}\n </S.Wrap>\n );\n};\n"],"names":["ProductCompare","ProductCompare2","className","renderImage","variants","translations","initialTranslations","onVariantLearnMore","onVariantAddToCart","useMemo","merge","defaultProductCompareTranslations","getVariantImage","useCallback","variant","images","find","el","isVideo","parsedVariants","parseProductCompareVariants","section","parsedVariant","PRODUCT_COMPARE_MAPPING","sections","id","compareSectionId","getPrice","price","formatPrice","displayPrice","fromPrice","allRowHeights","useRef","reduce","map","row","compare","features","length","jsxs","S.Wrap","children","S.Section","title","jsx","S.SectionTitle","S.ItemsWrap","ScrollWrapper","align","direction","scrollStepType","fillType","items","variantId","render","Render","S.Item","S.HeaderWrap","S.ImageWrap","CustomImage","asset","sizes","layout","objectFit","S.Title","S.FeaturesWrap","feature","featureIconSvg","getTemplateIconSvg","icon","rowHeights","current","height","Math","max","S.Feature","Feature","ref","push","offsetHeight","$height","S.FeatureIcon","FeatureIcon","value","StyleableSvgImage","src","width","S.FeatureDash","S.FeatureText","FeatureText","dangerouslySetInnerHTML","__html","footnotes","footnote","i","S.FeatureFootnote","FeatureFootnote","S.FooterWrap","S.PriceWrap","Title","Button","onClick","S.ButtonText","ButtonText","learnMore","CartButton","disabled","isInStock","subSections","subSection","image","responsive"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBa,MAAAA,cAAA,GAAiB,SAASA,eAAeC,CAAA;EACpDC,SAAA;EACAC,WAAA;EACAC,QAAA;EACAC,YAAc,EAAAC,mBAAA;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A,CAAAA,GAAA,CAAA0D,qBAAA,CAAAC,UAAA,EAAA;wBACE9D,uBAAa+D;uBAChB;oBAAA,CACF,CAAA;mBAEJ,CAAA,EACCjG,kBACC,mBAAAqC,UAAA,CAAAA,GAAA,CAAC6D,UAAA,CAAAA,UAAA,EAAA;oBACC5F,OAAQ,EAAA,SAAA;oBACR6F,QAAA,EAAU,CAAC7F,OAAQ,CAAA8F,SAAA;oBACnBN,SAASA,CAAA,KACPxF,OAAA,CAAQ8F,aACRpG,kBAAmB,CAAAM,OAAA,CAAQwC,WAAW,CAAC;kBAAA,CAE3C,CAAA;iBAEJ,CAAA;cACF,CAAA,CAAA;YAEJ;UAAA,CACA,CAAA;QAAA,CAAA;OAEN,CAAA;KACF,CAAA,EAGCjC,OAAA,CAAQwF,aAAa1E,GAAI,CAAA,CAAC2E,YAAYf,CACrC,oBAAAvD,UAAA,CAAAA,IAAA,CAACG,6BAAE,EAAF;MACCD,QAAA,EAAA,CAAAG,eAAAA,UAAAA,CAAAA,GAAA,CAACC,qBAAAA,CAAAA,YAAE,EAAF;QAAgBJ,QAAA,EAAAoE,UAAA,CAAWlE;MAAM,CAAA,CAAA,EACjCkE,WAAWC,KACV,IAAA,eAAAlE,UAAA,CAAAA,GAAA,CAACe,WAAA,CAAAA,WAAA,EAAA;QACCzD,WAAA;QACA0D,OAAOiD,UAAW,CAAAC,KAAA;QAClBjD,KAAO,EAAA,GAAGgD,UAAW,CAAAC,KAAA,CAAMxB,KAAK,IAAA;QAChCyB,UAAU,EAAA;MAAA,CACZ,CAAA;IARY,CAAA,EAAAF,UAAA,CAAWlE,KAAQ,GAAAmD,CAUnC,CACD,CAAA;EACH,CAAA,CAAA;AAEJ,CAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductCompare.mjs","sources":["../../../src/components/ProductCompare/ProductCompare.tsx"],"sourcesContent":["import merge from \"lodash/merge\";\nimport { useCallback, useMemo, useRef } from \"react\";\n\nimport { getTemplateIconSvg } from \"../../helpers/shopify/iconParsing\";\nimport { formatPrice } from \"../../utils/money\";\nimport { Button, CartButton } from \"../Button\";\nimport { CustomImage } from \"../CustomImage\";\nimport { ScrollWrapper } from \"../ScrollWrapper\";\nimport { StyleableSvgImage } from \"../StyleableSvgImage\";\nimport { PRODUCT_COMPARE_MAPPING } from \"./mapping\";\nimport type { ProductCompareSection } from \"./mapping\";\nimport { defaultProductCompareTranslations } from \"./ProductCompare.constants\";\nimport * as S from \"./ProductCompare.styles\";\nimport type {\n ProductCompareLayoutVariant,\n ProductCompareProps,\n} from \"./ProductCompare.types\";\nimport { parseProductCompareVariants } from \"./ProductCompare.utils\";\n\nexport const ProductCompare = function ProductCompare({\n className,\n renderImage,\n variants,\n translations: initialTranslations,\n onVariantLearnMore,\n onVariantAddToCart,\n}: ProductCompareProps) {\n // #############################################################################\n // Merge translations\n // #############################################################################\n const translations = useMemo(() => {\n return merge(defaultProductCompareTranslations, initialTranslations);\n }, [initialTranslations]);\n\n // #############################################################################\n // Misc\n // #############################################################################\n const getVariantImage = useCallback(\n (variant: ProductCompareProps[\"variants\"][number]) => {\n return variant.images?.find((el) => !el.isVideo);\n },\n [],\n );\n\n // #############################################################################\n // Parse variants and compare data\n // #############################################################################\n const parsedVariants = useMemo((): ProductCompareLayoutVariant[] => {\n return parseProductCompareVariants(variants);\n }, [variants]);\n\n // const anyHasFeatureText = useMemo(() => {\n // return parsedVariants.some(\n // (variant) => !!getVariantFeatureText(variant, translations)\n // );\n // }, [parsedVariants, translations]);\n\n // #############################################################################\n // Compare section\n // #############################################################################\n const section = useMemo((): ProductCompareSection | null => {\n // Use the first found item's section id\n for (const parsedVariant of parsedVariants) {\n return (\n PRODUCT_COMPARE_MAPPING.sections.find(\n (section) => section.id === parsedVariant.compareSectionId,\n ) ?? null\n );\n }\n\n return null;\n }, [parsedVariants]);\n\n // #############################################################################\n // Price\n // #############################################################################\n const getPrice = useCallback(\n (variant: ProductCompareProps[\"variants\"][number]) => {\n const price = formatPrice(variant.displayPrice);\n\n const fromPrice = variant.fromPrice\n ? translations.fromPrice(formatPrice(variant.fromPrice))\n : undefined;\n\n return fromPrice || price;\n },\n [translations],\n );\n\n // #############################################################################\n // Row heights\n // #############################################################################\n const allRowHeights = useRef<Record<number, number[]>>(\n parsedVariants.reduce<Record<number, number[]>>((map, variant) => {\n for (let row = 0; row < variant.compare.features.length; row++) {\n if (!map[row]) {\n map[row] = [];\n }\n }\n return map;\n }, {}),\n );\n\n // #############################################################################\n // Render\n // #############################################################################\n if (!section || parsedVariants.length < 2) {\n return null;\n }\n\n return (\n <S.Wrap className={className}>\n {/* Main section */}\n <S.Section>\n {section.title && <S.SectionTitle>{section.title}</S.SectionTitle>}\n <S.ItemsWrap>\n <ScrollWrapper\n align=\"center\"\n direction=\"horizontal\"\n scrollStepType=\"itemWidth\"\n fillType=\"gradient\"\n items={parsedVariants.map((variant) => ({\n id: variant.variantId,\n render: function Render() {\n // const featureText = getVariantFeatureText(\n // variant,\n // translations\n // );\n\n return (\n <S.Item>\n <S.HeaderWrap>\n <S.ImageWrap>\n <CustomImage\n renderImage={renderImage}\n asset={getVariantImage(variant)}\n sizes=\"150px\"\n layout=\"fill\"\n objectFit=\"contain\"\n />\n </S.ImageWrap>\n {/* Comment out for now, maybe will be used in the future */}\n {/* {anyHasFeatureText && (\n <ProductFeatureText\n $isInactive={variant.isSoldOut}\n $hidden={!featureText}\n >\n {featureText ?? \"-\"}\n </ProductFeatureText>\n )} */}\n <S.Title>{variant.title}</S.Title>\n </S.HeaderWrap>\n <S.FeaturesWrap>\n {variant.compare.features.map((feature, row) => {\n const featureIconSvg = getTemplateIconSvg(feature.icon);\n\n const rowHeights = allRowHeights.current[row];\n const height = rowHeights?.length\n ? Math.max(...rowHeights)\n : undefined;\n\n return (\n <S.Feature\n key={feature.icon + row}\n ref={(el) => {\n if (!rowHeights || !el) return;\n rowHeights.push(el.offsetHeight);\n }}\n $height={height}\n >\n <S.FeatureIcon>\n {feature.value ? (\n <>\n {featureIconSvg && (\n <StyleableSvgImage\n src={featureIconSvg}\n width={16}\n height={16}\n />\n )}\n </>\n ) : (\n <S.FeatureDash />\n )}\n </S.FeatureIcon>\n {feature.value && (\n <S.FeatureText\n dangerouslySetInnerHTML={{\n __html: feature.value,\n }}\n />\n )}\n </S.Feature>\n );\n })}\n\n {/* Footnotes */}\n {variant.compare.footnotes?.map((footnote, i) => (\n <S.FeatureFootnote key={footnote + i}>\n {footnote}\n </S.FeatureFootnote>\n ))}\n </S.FeaturesWrap>\n <S.FooterWrap>\n <S.PriceWrap>\n <S.Title>{getPrice(variant)}</S.Title>\n {onVariantLearnMore && (\n <Button\n variant=\"link\"\n onClick={() => onVariantLearnMore(variant.id)}\n >\n <S.ButtonText>\n {translations.learnMore}\n </S.ButtonText>\n </Button>\n )}\n </S.PriceWrap>\n {onVariantAddToCart && (\n <CartButton\n variant=\"primary\"\n disabled={!variant.isInStock}\n onClick={() =>\n variant.isInStock &&\n onVariantAddToCart(variant.variantId, 1)\n }\n />\n )}\n </S.FooterWrap>\n </S.Item>\n );\n },\n }))}\n />\n </S.ItemsWrap>\n </S.Section>\n\n {/* Sub-sections */}\n {section.subSections?.map((subSection, i) => (\n <S.Section key={subSection.title + i}>\n <S.SectionTitle>{subSection.title}</S.SectionTitle>\n {subSection.image && (\n <CustomImage\n renderImage={renderImage}\n asset={subSection.image}\n sizes={`${subSection.image.width}px`}\n responsive\n />\n )}\n </S.Section>\n ))}\n </S.Wrap>\n );\n};\n"],"names":["ProductCompare","ProductCompare2","className","renderImage","variants","translations","initialTranslations","onVariantLearnMore","onVariantAddToCart","useMemo","merge","defaultProductCompareTranslations","getVariantImage","useCallback","variant","images","find","el","isVideo","parsedVariants","parseProductCompareVariants","section","parsedVariant","PRODUCT_COMPARE_MAPPING","sections","id","compareSectionId","getPrice","price","formatPrice","displayPrice","fromPrice","allRowHeights","useRef","reduce","map","row","compare","features","length","jsxs","S.Wrap","children","S.Section","title","jsx","S.SectionTitle","S.ItemsWrap","ScrollWrapper","align","direction","scrollStepType","fillType","items","variantId","render","Render","S.Item","S.HeaderWrap","S.ImageWrap","CustomImage","asset","sizes","layout","objectFit","S.Title","S.FeaturesWrap","feature","featureIconSvg","getTemplateIconSvg","icon","rowHeights","current","height","Math","max","S.Feature","ref","push","offsetHeight","$height","S.FeatureIcon","value","StyleableSvgImage","src","width","S.FeatureDash","S.FeatureText","dangerouslySetInnerHTML","__html","footnotes","footnote","i","S.FeatureFootnote","S.FooterWrap","S.PriceWrap","Button","onClick","S.ButtonText","learnMore","CartButton","disabled","isInStock","subSections","subSection","image","responsive"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBa,MAAAA,cAAA,GAAiB,SAASA,eAAeC,CAAA;EACpDC,SAAA;EACAC,WAAA;EACAC,QAAA;EACAC,YAAc,EAAAC,mBAAA;EACdC,kBAAA;EACAC;AACF,CAAwB,EAAA;EAIhB,MAAAH,YAAA,GAAeI,QAAQ,MAAM;IAC1B,OAAAC,KAAA,CAAMC,mCAAmCL,mBAAmB,CAAA;EAAA,CACrE,EAAG,CAACA,mBAAmB,CAAC,CAAA;EAKxB,MAAMM,eAAkB,GAAAC,WAAA,CACrBC,OAAqD,IAAA;IACpD,OAAOA,QAAQC,MAAQ,EAAAC,IAAA,CAAMC,EAAO,IAAA,CAACA,GAAGC,OAAO,CAAA;EACjD,CAAA,EACA,EAAC,CACH;EAKM,MAAAC,cAAA,GAAiBV,QAAQ,MAAqC;IAClE,OAAOW,4BAA4BhB,QAAQ,CAAA;EAAA,CAC7C,EAAG,CAACA,QAAQ,CAAC,CAAA;EAWP,MAAAiB,OAAA,GAAUZ,QAAQ,MAAoC;IAE1D,KAAA,MAAWa,iBAAiBH,cAAgB,EAAA;MAC1C,OACEI,wBAAwBC,QAAS,CAAAR,IAAA,CAC9BK,QAAAA,IAAYA,QAAQ,CAAAI,EAAA,KAAOH,aAAc,CAAAI,gBACvC,CAAA,IAAA,IAAA;IAET;IAEO,OAAA,IAAA;EAAA,CACT,E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CtF,OAAQ,EAAA,SAAA;oBACRuF,QAAA,EAAU,CAACvF,OAAQ,CAAAwF,SAAA;oBACnBL,SAASA,CAAA,KACPnF,OAAA,CAAQwF,aACR9F,kBAAmB,CAAAM,OAAA,CAAQwC,WAAW,CAAC;kBAAA,CAE3C,CAAA;iBAEJ,CAAA;cACF,CAAA,CAAA;YAEJ;UAAA,CACA,CAAA;QAAA,CAAA;OAEN,CAAA;KACF,CAAA,EAGCjC,OAAA,CAAQkF,aAAapE,GAAI,CAAA,CAACqE,YAAYZ,CACrC,oBAAApD,IAAA,CAACG,OAAE,EAAF;MACCD,QAAA,EAAA,CAAA,eAAAG,GAAA,CAACC,YAAE,EAAF;QAAgBJ,QAAA,EAAA8D,UAAA,CAAW5D;MAAM,CAAA,CAAA,EACjC4D,WAAWC,KACV,IAAA,eAAA5D,GAAA,CAACe,WAAA,EAAA;QACCzD,WAAA;QACA0D,OAAO2C,UAAW,CAAAC,KAAA;QAClB3C,KAAO,EAAA,GAAG0C,UAAW,CAAAC,KAAA,CAAMpB,KAAK,IAAA;QAChCqB,UAAU,EAAA;MAAA,CACZ,CAAA;IARY,CAAA,EAAAF,UAAA,CAAW5D,KAAQ,GAAAgD,CAUnC,CACD,CAAA;EACH,CAAA,CAAA;AAEJ,CAAA;"}
|
|
1
|
+
{"version":3,"file":"ProductCompare.mjs","sources":["../../../src/components/ProductCompare/ProductCompare.tsx"],"sourcesContent":["import merge from \"lodash/merge\";\nimport { useCallback, useMemo, useRef } from \"react\";\n\nimport { getTemplateIconSvg } from \"../../helpers/shopify/iconParsing\";\nimport { formatPrice } from \"../../utils/money\";\nimport { Button, CartButton } from \"../Button\";\nimport { CustomImage } from \"../CustomImage\";\nimport { ScrollWrapper } from \"../ScrollWrapper\";\nimport { StyleableSvgImage } from \"../StyleableSvgImage\";\nimport { PRODUCT_COMPARE_MAPPING } from \"./mapping\";\nimport type { ProductCompareSection } from \"./mapping\";\nimport { defaultProductCompareTranslations } from \"./ProductCompare.constants\";\nimport * as S from \"./ProductCompare.styles\";\nimport type {\n ProductCompareLayoutVariant,\n ProductCompareProps,\n} from \"./ProductCompare.types\";\nimport { parseProductCompareVariants } from \"./ProductCompare.utils\";\n\nexport const ProductCompare = function ProductCompare({\n className,\n renderImage,\n variants,\n translations: initialTranslations,\n onVariantLearnMore,\n onVariantAddToCart,\n}: ProductCompareProps) {\n // #############################################################################\n // Merge translations\n // #############################################################################\n const translations = useMemo(() => {\n return merge(defaultProductCompareTranslations, initialTranslations);\n }, [initialTranslations]);\n\n // #############################################################################\n // Misc\n // #############################################################################\n const getVariantImage = useCallback(\n (variant: ProductCompareProps[\"variants\"][number]) => {\n return variant.images?.find((el) => !el.isVideo);\n },\n [],\n );\n\n // #############################################################################\n // Parse variants and compare data\n // #############################################################################\n const parsedVariants = useMemo((): ProductCompareLayoutVariant[] => {\n return parseProductCompareVariants(variants);\n }, [variants]);\n\n // const anyHasFeatureText = useMemo(() => {\n // return parsedVariants.some(\n // (variant) => !!getVariantFeatureText(variant, translations)\n // );\n // }, [parsedVariants, translations]);\n\n // #############################################################################\n // Compare section\n // #############################################################################\n const section = useMemo((): ProductCompareSection | null => {\n // Use the first found item's section id\n for (const parsedVariant of parsedVariants) {\n return (\n PRODUCT_COMPARE_MAPPING.sections.find(\n (section) => section.id === parsedVariant.compareSectionId,\n ) ?? null\n );\n }\n\n return null;\n }, [parsedVariants]);\n\n // #############################################################################\n // Price\n // #############################################################################\n const getPrice = useCallback(\n (variant: ProductCompareProps[\"variants\"][number]) => {\n const price = formatPrice(variant.displayPrice);\n\n const fromPrice = variant.fromPrice\n ? translations.fromPrice(formatPrice(variant.fromPrice))\n : undefined;\n\n return fromPrice || price;\n },\n [translations],\n );\n\n // #############################################################################\n // Row heights\n // #############################################################################\n const allRowHeights = useRef<Record<number, number[]>>(\n parsedVariants.reduce<Record<number, number[]>>((map, variant) => {\n for (let row = 0; row < variant.compare.features.length; row++) {\n if (!map[row]) {\n map[row] = [];\n }\n }\n return map;\n }, {}),\n );\n\n // #############################################################################\n // Render\n // #############################################################################\n if (!section || parsedVariants.length < 2) {\n return null;\n }\n\n return (\n <S.Wrap className={className}>\n {/* Main section */}\n <S.Section>\n {section.title && <S.SectionTitle>{section.title}</S.SectionTitle>}\n <S.ItemsWrap>\n <ScrollWrapper\n align=\"center\"\n direction=\"horizontal\"\n scrollStepType=\"itemWidth\"\n fillType=\"gradient\"\n items={parsedVariants.map((variant) => ({\n id: variant.variantId,\n render: function Render() {\n // const featureText = getVariantFeatureText(\n // variant,\n // translations\n // );\n\n return (\n <S.Item>\n <S.HeaderWrap>\n <S.ImageWrap>\n <CustomImage\n renderImage={renderImage}\n asset={getVariantImage(variant)}\n sizes=\"150px\"\n layout=\"fill\"\n objectFit=\"contain\"\n />\n </S.ImageWrap>\n {/* Comment out for now, maybe will be used in the future */}\n {/* {anyHasFeatureText && (\n <ProductFeatureText\n $isInactive={variant.isSoldOut}\n $hidden={!featureText}\n >\n {featureText ?? \"-\"}\n </ProductFeatureText>\n )} */}\n <S.Title>{variant.title}</S.Title>\n </S.HeaderWrap>\n <S.FeaturesWrap>\n {variant.compare.features.map((feature, row) => {\n const featureIconSvg = getTemplateIconSvg(feature.icon);\n\n const rowHeights = allRowHeights.current[row];\n const height = rowHeights?.length\n ? Math.max(...rowHeights)\n : undefined;\n\n return (\n <S.Feature\n key={feature.icon + row}\n ref={(el) => {\n if (!rowHeights || !el) return;\n rowHeights.push(el.offsetHeight);\n }}\n $height={height}\n >\n <S.FeatureIcon>\n {feature.value ? (\n <>\n {featureIconSvg && (\n <StyleableSvgImage\n src={featureIconSvg}\n width={16}\n height={16}\n />\n )}\n </>\n ) : (\n <S.FeatureDash />\n )}\n </S.FeatureIcon>\n {feature.value && (\n <S.FeatureText\n dangerouslySetInnerHTML={{\n __html: feature.value,\n }}\n />\n )}\n </S.Feature>\n );\n })}\n\n {/* Footnotes */}\n {variant.compare.footnotes?.map((footnote, i) => (\n <S.FeatureFootnote key={footnote + i}>\n {footnote}\n </S.FeatureFootnote>\n ))}\n </S.FeaturesWrap>\n <S.FooterWrap>\n <S.PriceWrap>\n <S.Title>{getPrice(variant)}</S.Title>\n {onVariantLearnMore && (\n <Button\n variant=\"link\"\n onClick={() => onVariantLearnMore(variant.id)}\n >\n <S.ButtonText>\n {translations.learnMore}\n </S.ButtonText>\n </Button>\n )}\n </S.PriceWrap>\n {onVariantAddToCart && (\n <CartButton\n variant=\"primary\"\n disabled={!variant.isInStock}\n onClick={() =>\n variant.isInStock &&\n onVariantAddToCart(variant.variantId, 1)\n }\n />\n )}\n </S.FooterWrap>\n </S.Item>\n );\n },\n }))}\n />\n </S.ItemsWrap>\n </S.Section>\n\n {/* Sub-sections */}\n {section.subSections?.map((subSection, i) => (\n <S.Section key={subSection.title + i}>\n <S.SectionTitle>{subSection.title}</S.SectionTitle>\n {subSection.image && (\n <CustomImage\n renderImage={renderImage}\n asset={subSection.image}\n sizes={`${subSection.image.width}px`}\n responsive\n />\n )}\n </S.Section>\n ))}\n </S.Wrap>\n );\n};\n"],"names":["ProductCompare","ProductCompare2","className","renderImage","variants","translations","initialTranslations","onVariantLearnMore","onVariantAddToCart","useMemo","merge","defaultProductCompareTranslations","getVariantImage","useCallback","variant","images","find","el","isVideo","parsedVariants","parseProductCompareVariants","section","parsedVariant","PRODUCT_COMPARE_MAPPING","sections","id","compareSectionId","getPrice","price","formatPrice","displayPrice","fromPrice","allRowHeights","useRef","reduce","map","row","compare","features","length","jsxs","S.Wrap","children","S.Section","title","jsx","S.SectionTitle","S.ItemsWrap","ScrollWrapper","align","direction","scrollStepType","fillType","items","variantId","render","Render","S.Item","S.HeaderWrap","S.ImageWrap","CustomImage","asset","sizes","layout","objectFit","S.Title","S.FeaturesWrap","feature","featureIconSvg","getTemplateIconSvg","icon","rowHeights","current","height","Math","max","S.Feature","ref","push","offsetHeight","$height","S.FeatureIcon","value","StyleableSvgImage","src","width","S.FeatureDash","S.FeatureText","dangerouslySetInnerHTML","__html","footnotes","footnote","i","S.FeatureFootnote","S.FooterWrap","S.PriceWrap","Button","onClick","S.ButtonText","learnMore","CartButton","disabled","isInStock","subSections","subSection","image","responsive"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBa,MAAAA,cAAA,GAAiB,SAASA,eAAeC,CAAA;EACpDC,SAAA;EACAC,WAAA;EACAC,QAAA;EACAC,YAAc,EAAAC,mBAAA;EACdC,kBAAA;EACAC;AACF,CAAwB,EAAA;EAIhB,MAAAH,YAAA,GAAeI,QAAQ,MAAM;IAC1B,OAAAC,KAAA,CAAMC,mCAAmCL,mBAAmB,CAAA;EAAA,CACrE,EAAG,CAACA,mBAAmB,CAAC,CAAA;EAKxB,MAAMM,eAAkB,GAAAC,WAAA,CACrBC,OAAqD,IAAA;IACpD,OAAOA,QAAQC,MAAQ,EAAAC,IAAA,CAAMC,EAAO,IAAA,CAACA,GAAGC,OAAO,CAAA;EACjD,CAAA,EACA,EAAC,CACH;EAKM,MAAAC,cAAA,GAAiBV,QAAQ,MAAqC;IAClE,OAAOW,4BAA4BhB,QAAQ,CAAA;EAAA,CAC7C,EAAG,CAACA,QAAQ,CAAC,CAAA;EAWP,MAAAiB,OAAA,GAAUZ,QAAQ,MAAoC;IAE1D,KAAA,MAAWa,iBAAiBH,cAAgB,EAAA;MAC1C,OACEI,wBAAwBC,QAAS,CAAAR,IAAA,CAC9BK,QAAAA,IAAYA,QAAQ,CAAAI,EAAA,KAAOH,aAAc,CAAAI,gBACvC,CAAA,IAAA,IAAA;IAET;IAEO,OAAA,IAAA;EAAA,CACT,EAAG,CAACP,cAAc,CAAC,CAAA;EAKnB,MAAMQ,QAAW,GAAAd,WAAA,CACdC,OAAqD,IAAA;IAC9C,MAAAc,KAAA,GAAQC,WAAY,CAAAf,OAAA,CAAQgB,YAAY,CAAA;IAExC,MAAAC,SAAA,GAAYjB,QAAQiB,SACtB,GAAA1B,YAAA,CAAa0B,UAAUF,WAAY,CAAAf,OAAA,CAAQiB,SAAS,CAAC,CACrD,GAAA,KAAA,CAAA;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jC,OAAA,CAAQkF,aAAapE,GAAI,CAAA,CAACqE,YAAYZ,CACrC,oBAAApD,IAAA,CAACG,OAAE,EAAF;MACCD,QAAA,EAAA,CAAA,eAAAG,GAAA,CAACC,YAAE,EAAF;QAAgBJ,QAAA,EAAA8D,UAAA,CAAW5D;MAAM,CAAA,CAAA,EACjC4D,WAAWC,KACV,IAAA,eAAA5D,GAAA,CAACe,WAAA,EAAA;QACCzD,WAAA;QACA0D,OAAO2C,UAAW,CAAAC,KAAA;QAClB3C,KAAO,EAAA,GAAG0C,UAAW,CAAAC,KAAA,CAAMpB,KAAK,IAAA;QAChCqB,UAAU,EAAA;MAAA,CACZ,CAAA;IARY,CAAA,EAAAF,UAAA,CAAW5D,KAAQ,GAAAgD,CAUnC,CACD,CAAA;EACH,CAAA,CAAA;AAEJ,CAAA;"}
|
|
@@ -2,7 +2,7 @@ export declare const PRODUCT_SECTION_NAVIGATION_HEIGHT = 48;
|
|
|
2
2
|
export declare const PRODUCT_SECTION_NAVIGATION_ANIMATION_MS = 300;
|
|
3
3
|
export declare const NAV_ITEM_GAP_SIZE = 30;
|
|
4
4
|
export declare const Wrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
-
export declare const Container: import("styled-components").StyledComponent<import("react").
|
|
5
|
+
export declare const Container: import("styled-components").StyledComponent<import("react").NamedExoticComponent<import("../Container/Container.types").ContainerProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
6
6
|
export declare const NavItemWrapOuter: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
7
7
|
export declare const NavItemWrapInner: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
8
8
|
export declare const NavItem: import("styled-components").StyledComponent<"a", import("styled-components").DefaultTheme, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const NAV_ITEM_GAP_SIZE = 30;
|
|
2
2
|
export declare const Wrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
3
|
-
export declare const Container: import("styled-components").StyledComponent<import("react").
|
|
3
|
+
export declare const Container: import("styled-components").StyledComponent<import("react").NamedExoticComponent<import("../Container/Container.types").ContainerProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
4
4
|
export declare const Item: import("styled-components").StyledComponent<"a", import("styled-components").DefaultTheme, {
|
|
5
5
|
active?: boolean;
|
|
6
6
|
}, never>;
|
|
@@ -10,7 +10,7 @@ export declare const SpecData: import("styled-components").StyledComponent<"div"
|
|
|
10
10
|
}, never>;
|
|
11
11
|
export declare const SpecsWrap: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
12
12
|
export declare const SectionWrap: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
13
|
-
export declare const Container: import("styled-components").StyledComponent<import("react").
|
|
13
|
+
export declare const Container: import("styled-components").StyledComponent<import("react").NamedExoticComponent<import("../Container/Container.types").ContainerProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
14
14
|
export declare const GradientButton: import("styled-components").StyledComponent<({ children, active, className, ...props }: import("../GradientButton/GradientButton.types").GradientButtonProps) => JSX.Element, import("styled-components").DefaultTheme, {}, never>;
|
|
15
15
|
export declare const Title: import("styled-components").StyledComponent<"h2", import("styled-components").DefaultTheme, {}, never>;
|
|
16
16
|
export declare const ScrollWrapper: import("styled-components").StyledComponent<({ align, direction, items, fillType, fillColor, accentColor, arrowColor, scrollStepType, gap, className, arrowFadeColor, activeIndex, circleArrowBackground, arrowGap, gradientSize, hideArrows, onScrollChange, enableWheelScroll, arrowIcon, }: import("../ScrollWrapper/ScrollWrapper.types").ScrollWrapperProps) => JSX.Element, import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuantityControls.js","sources":["../../../src/components/QuantityControls/QuantityControls.tsx"],"sourcesContent":["import type { ChangeEvent } from \"react\";\nimport { useCallback, useMemo } from \"react\";\n\nimport { CartButton } from \"../Button\";\nimport * as S from \"./QuantityControls.styles\";\nimport type { QuantityControlsProps } from \"./QuantityControls.types\";\n\nexport const QuantityControls = function QuantityControls({\n className,\n disabled,\n quantity,\n onUpdateQuantity,\n onAddToCart,\n hideQuantityInput,\n cartButton,\n allowZero,\n}: QuantityControlsProps) {\n const handleOnUpdateQuantity = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n const value = Math.max(0, parseInt(e.target.value) || 0);\n\n onUpdateQuantity(value);\n },\n [onUpdateQuantity],\n );\n\n const handleOnAddToCart = useCallback(() => {\n if (!allowZero && quantity < 1) return;\n\n onAddToCart();\n }, [allowZero, onAddToCart, quantity]);\n\n const cartButtonDisabled = useMemo(() => {\n return disabled || (!allowZero && quantity < 1) || cartButton?.disabled;\n }, [allowZero, cartButton?.disabled, disabled, quantity]);\n\n // #############################################################################\n // Render\n // #############################################################################\n return (\n <S.Wrap className={className}>\n {!hideQuantityInput && (\n <S.QuantityInput\n disabled={disabled}\n quantity={quantity}\n onUpdateQuantity={handleOnUpdateQuantity}\n onIncreaseQuantity={() => onUpdateQuantity(quantity + 1)}\n onDecreaseQuantity={() =>\n onUpdateQuantity(quantity > 0 ? quantity - 1 : 0)\n }\n />\n )}\n <CartButton\n data-test-id=\"add-to-cart-btn\"\n variant=\"primary\"\n {...cartButton}\n disabled={cartButtonDisabled}\n onClick={(e) => {\n e.stopPropagation();\n handleOnAddToCart();\n }}\n />\n </S.Wrap>\n );\n};\n"],"names":["QuantityControls","QuantityControls2","className","disabled","quantity","onUpdateQuantity","onAddToCart","hideQuantityInput","cartButton","allowZero","handleOnUpdateQuantity","useCallback","e","value","Math","max","parseInt","target","handleOnAddToCart","cartButtonDisabled","useMemo","jsxs","S.Wrap","children","jsx","S.QuantityInput","QuantityInput","onIncreaseQuantity","onDecreaseQuantity","CartButton","variant","onClick","stopPropagation"],"mappings":";;;;;;;;AAOa,MAAAA,gBAAA,GAAmB,SAASA,iBAAiBC,CAAA;EACxDC,SAAA;EACAC,QAAA;EACAC,QAAA;EACAC,gBAAA;EACAC,WAAA;EACAC,iBAAA;EACAC,UAAA;EACAC;AACF,CAA0B,EAAA;EACxB,MAAMC,sBAAyB,GAAAC,KAAA,CAAAA,WAAA,CAC5BC,CAAqC,IAAA;IAC9B,MAAAC,KAAA,GAAQC,KAAKC,GAAI,CAAA,CAAA,EAAGC,SAASJ,CAAE,CAAAK,MAAA,CAAOJ,KAAK,CAAA,IAAK,CAAC,CAAA;IAEvDR,gBAAA,CAAiBQ,KAAK,CAAA;EACxB,CAAA,EACA,CAACR,gBAAgB,CAAA,CACnB;EAEM,MAAAa,iBAAA,GAAoBP,KAAAA,CAAAA,YAAY,MAAM;IACtC,IAAA,CAACF,
|
|
1
|
+
{"version":3,"file":"QuantityControls.js","sources":["../../../src/components/QuantityControls/QuantityControls.tsx"],"sourcesContent":["import type { ChangeEvent } from \"react\";\nimport { useCallback, useMemo } from \"react\";\n\nimport { CartButton } from \"../Button\";\nimport * as S from \"./QuantityControls.styles\";\nimport type { QuantityControlsProps } from \"./QuantityControls.types\";\n\nexport const QuantityControls = function QuantityControls({\n className,\n disabled,\n quantity,\n onUpdateQuantity,\n onAddToCart,\n hideQuantityInput,\n cartButton,\n allowZero,\n}: QuantityControlsProps) {\n const handleOnUpdateQuantity = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n const value = Math.max(0, parseInt(e.target.value) || 0);\n\n onUpdateQuantity(value);\n },\n [onUpdateQuantity],\n );\n\n const handleOnAddToCart = useCallback(() => {\n if (!allowZero && quantity < 1) return;\n\n onAddToCart();\n }, [allowZero, onAddToCart, quantity]);\n\n const cartButtonDisabled = useMemo(() => {\n return disabled || (!allowZero && quantity < 1) || cartButton?.disabled;\n }, [allowZero, cartButton?.disabled, disabled, quantity]);\n\n // #############################################################################\n // Render\n // #############################################################################\n return (\n <S.Wrap className={className}>\n {!hideQuantityInput && (\n <S.QuantityInput\n disabled={disabled}\n quantity={quantity}\n onUpdateQuantity={handleOnUpdateQuantity}\n onIncreaseQuantity={() => onUpdateQuantity(quantity + 1)}\n onDecreaseQuantity={() =>\n onUpdateQuantity(quantity > 0 ? quantity - 1 : 0)\n }\n />\n )}\n <CartButton\n data-test-id=\"add-to-cart-btn\"\n variant=\"primary\"\n {...cartButton}\n disabled={cartButtonDisabled}\n onClick={(e) => {\n e.stopPropagation();\n handleOnAddToCart();\n }}\n />\n </S.Wrap>\n );\n};\n"],"names":["QuantityControls","QuantityControls2","className","disabled","quantity","onUpdateQuantity","onAddToCart","hideQuantityInput","cartButton","allowZero","handleOnUpdateQuantity","useCallback","e","value","Math","max","parseInt","target","handleOnAddToCart","cartButtonDisabled","useMemo","jsxs","S.Wrap","children","jsx","S.QuantityInput","QuantityInput","onIncreaseQuantity","onDecreaseQuantity","CartButton","variant","onClick","stopPropagation"],"mappings":";;;;;;;;AAOa,MAAAA,gBAAA,GAAmB,SAASA,iBAAiBC,CAAA;EACxDC,SAAA;EACAC,QAAA;EACAC,QAAA;EACAC,gBAAA;EACAC,WAAA;EACAC,iBAAA;EACAC,UAAA;EACAC;AACF,CAA0B,EAAA;EACxB,MAAMC,sBAAyB,GAAAC,KAAA,CAAAA,WAAA,CAC5BC,CAAqC,IAAA;IAC9B,MAAAC,KAAA,GAAQC,KAAKC,GAAI,CAAA,CAAA,EAAGC,SAASJ,CAAE,CAAAK,MAAA,CAAOJ,KAAK,CAAA,IAAK,CAAC,CAAA;IAEvDR,gBAAA,CAAiBQ,KAAK,CAAA;EACxB,CAAA,EACA,CAACR,gBAAgB,CAAA,CACnB;EAEM,MAAAa,iBAAA,GAAoBP,KAAAA,CAAAA,YAAY,MAAM;IACtC,IAAA,CAACF,SAAa,IAAAL,QAAA,GAAW,CAAG,EAAA;IAEpBE,WAAA,EAAA;EACX,CAAA,EAAA,CAACG,SAAW,EAAAH,WAAA,EAAaF,QAAQ,CAAC,CAAA;EAE/B,MAAAe,kBAAA,GAAqBC,KAAAA,CAAAA,QAAQ,MAAM;IACvC,OAAOjB,QAAa,IAAA,CAACM,SAAa,IAAAL,QAAA,GAAW,KAAMI,UAAY,EAAAL,QAAA;EAAA,GAC9D,CAACM,SAAA,EAAWD,YAAYL,QAAU,EAAAA,QAAA,EAAUC,QAAQ,CAAC,CAAA;EAKxD,OAAA,eACGiB,eAAA,CAAAC,uBAAAA,CAAAA,IAAA,EAAA;IAAOpB,SACL;IAAAqB,QAAA,EAAA,CAAA,CAAChB,iBACA,IAAA,eAAAiB,UAAA,CAAAA,GAAA,CAACC,uBAAE,CAAAC,aAAA,EAAF;MACCvB,QAAA;MACAC,QAAA;MACAC,gBAAkB,EAAAK,sBAAA;MAClBiB,kBAAoB,EAAAA,CAAA,KAAMtB,gBAAiB,CAAAD,QAAA,GAAW,CAAC,CAAA;MACvDwB,oBAAoBA,CAAA,KAClBvB,gBAAA,CAAiBD,WAAW,CAAI,GAAAA,QAAA,GAAW,IAAI,CAAC;IAAA,CAEpD,CAAA,EAAA,eAEFoB,UAAA,CAAAA,GAAA,CAACK,UAAA,CAAAA,UAAA,EAAA;MACC,cAAa,EAAA,iBAAA;MACbC,OAAQ,EAAA,SAAA;MACP,GAAGtB,UAAA;MACJL,QAAU,EAAAgB,kBAAA;MACVY,OAAA,EAAUnB,CAAM,IAAA;QACdA,CAAA,CAAEoB,eAAgB,CAAA,CAAA;QACAd,iBAAA,EAAA;MACpB;IAAA,CACF,CAAA;EACF,CAAA,CAAA;AAEJ,CAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuantityControls.mjs","sources":["../../../src/components/QuantityControls/QuantityControls.tsx"],"sourcesContent":["import type { ChangeEvent } from \"react\";\nimport { useCallback, useMemo } from \"react\";\n\nimport { CartButton } from \"../Button\";\nimport * as S from \"./QuantityControls.styles\";\nimport type { QuantityControlsProps } from \"./QuantityControls.types\";\n\nexport const QuantityControls = function QuantityControls({\n className,\n disabled,\n quantity,\n onUpdateQuantity,\n onAddToCart,\n hideQuantityInput,\n cartButton,\n allowZero,\n}: QuantityControlsProps) {\n const handleOnUpdateQuantity = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n const value = Math.max(0, parseInt(e.target.value) || 0);\n\n onUpdateQuantity(value);\n },\n [onUpdateQuantity],\n );\n\n const handleOnAddToCart = useCallback(() => {\n if (!allowZero && quantity < 1) return;\n\n onAddToCart();\n }, [allowZero, onAddToCart, quantity]);\n\n const cartButtonDisabled = useMemo(() => {\n return disabled || (!allowZero && quantity < 1) || cartButton?.disabled;\n }, [allowZero, cartButton?.disabled, disabled, quantity]);\n\n // #############################################################################\n // Render\n // #############################################################################\n return (\n <S.Wrap className={className}>\n {!hideQuantityInput && (\n <S.QuantityInput\n disabled={disabled}\n quantity={quantity}\n onUpdateQuantity={handleOnUpdateQuantity}\n onIncreaseQuantity={() => onUpdateQuantity(quantity + 1)}\n onDecreaseQuantity={() =>\n onUpdateQuantity(quantity > 0 ? quantity - 1 : 0)\n }\n />\n )}\n <CartButton\n data-test-id=\"add-to-cart-btn\"\n variant=\"primary\"\n {...cartButton}\n disabled={cartButtonDisabled}\n onClick={(e) => {\n e.stopPropagation();\n handleOnAddToCart();\n }}\n />\n </S.Wrap>\n );\n};\n"],"names":["QuantityControls","QuantityControls2","className","disabled","quantity","onUpdateQuantity","onAddToCart","hideQuantityInput","cartButton","allowZero","handleOnUpdateQuantity","useCallback","e","value","Math","max","parseInt","target","handleOnAddToCart","cartButtonDisabled","useMemo","jsxs","S.Wrap","children","jsx","S.QuantityInput","onIncreaseQuantity","onDecreaseQuantity","CartButton","variant","onClick","stopPropagation"],"mappings":";;;;;;AAOa,MAAAA,gBAAA,GAAmB,SAASA,iBAAiBC,CAAA;EACxDC,SAAA;EACAC,QAAA;EACAC,QAAA;EACAC,gBAAA;EACAC,WAAA;EACAC,iBAAA;EACAC,UAAA;EACAC;AACF,CAA0B,EAAA;EACxB,MAAMC,sBAAyB,GAAAC,WAAA,CAC5BC,CAAqC,IAAA;IAC9B,MAAAC,KAAA,GAAQC,KAAKC,GAAI,CAAA,CAAA,EAAGC,SAASJ,CAAE,CAAAK,MAAA,CAAOJ,KAAK,CAAA,IAAK,CAAC,CAAA;IAEvDR,gBAAA,CAAiBQ,KAAK,CAAA;EACxB,CAAA,EACA,CAACR,gBAAgB,CAAA,CACnB;EAEM,MAAAa,iBAAA,GAAoBP,YAAY,MAAM;IACtC,IAAA,CAACF,
|
|
1
|
+
{"version":3,"file":"QuantityControls.mjs","sources":["../../../src/components/QuantityControls/QuantityControls.tsx"],"sourcesContent":["import type { ChangeEvent } from \"react\";\nimport { useCallback, useMemo } from \"react\";\n\nimport { CartButton } from \"../Button\";\nimport * as S from \"./QuantityControls.styles\";\nimport type { QuantityControlsProps } from \"./QuantityControls.types\";\n\nexport const QuantityControls = function QuantityControls({\n className,\n disabled,\n quantity,\n onUpdateQuantity,\n onAddToCart,\n hideQuantityInput,\n cartButton,\n allowZero,\n}: QuantityControlsProps) {\n const handleOnUpdateQuantity = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n const value = Math.max(0, parseInt(e.target.value) || 0);\n\n onUpdateQuantity(value);\n },\n [onUpdateQuantity],\n );\n\n const handleOnAddToCart = useCallback(() => {\n if (!allowZero && quantity < 1) return;\n\n onAddToCart();\n }, [allowZero, onAddToCart, quantity]);\n\n const cartButtonDisabled = useMemo(() => {\n return disabled || (!allowZero && quantity < 1) || cartButton?.disabled;\n }, [allowZero, cartButton?.disabled, disabled, quantity]);\n\n // #############################################################################\n // Render\n // #############################################################################\n return (\n <S.Wrap className={className}>\n {!hideQuantityInput && (\n <S.QuantityInput\n disabled={disabled}\n quantity={quantity}\n onUpdateQuantity={handleOnUpdateQuantity}\n onIncreaseQuantity={() => onUpdateQuantity(quantity + 1)}\n onDecreaseQuantity={() =>\n onUpdateQuantity(quantity > 0 ? quantity - 1 : 0)\n }\n />\n )}\n <CartButton\n data-test-id=\"add-to-cart-btn\"\n variant=\"primary\"\n {...cartButton}\n disabled={cartButtonDisabled}\n onClick={(e) => {\n e.stopPropagation();\n handleOnAddToCart();\n }}\n />\n </S.Wrap>\n );\n};\n"],"names":["QuantityControls","QuantityControls2","className","disabled","quantity","onUpdateQuantity","onAddToCart","hideQuantityInput","cartButton","allowZero","handleOnUpdateQuantity","useCallback","e","value","Math","max","parseInt","target","handleOnAddToCart","cartButtonDisabled","useMemo","jsxs","S.Wrap","children","jsx","S.QuantityInput","onIncreaseQuantity","onDecreaseQuantity","CartButton","variant","onClick","stopPropagation"],"mappings":";;;;;;AAOa,MAAAA,gBAAA,GAAmB,SAASA,iBAAiBC,CAAA;EACxDC,SAAA;EACAC,QAAA;EACAC,QAAA;EACAC,gBAAA;EACAC,WAAA;EACAC,iBAAA;EACAC,UAAA;EACAC;AACF,CAA0B,EAAA;EACxB,MAAMC,sBAAyB,GAAAC,WAAA,CAC5BC,CAAqC,IAAA;IAC9B,MAAAC,KAAA,GAAQC,KAAKC,GAAI,CAAA,CAAA,EAAGC,SAASJ,CAAE,CAAAK,MAAA,CAAOJ,KAAK,CAAA,IAAK,CAAC,CAAA;IAEvDR,gBAAA,CAAiBQ,KAAK,CAAA;EACxB,CAAA,EACA,CAACR,gBAAgB,CAAA,CACnB;EAEM,MAAAa,iBAAA,GAAoBP,YAAY,MAAM;IACtC,IAAA,CAACF,SAAa,IAAAL,QAAA,GAAW,CAAG,EAAA;IAEpBE,WAAA,EAAA;EACX,CAAA,EAAA,CAACG,SAAW,EAAAH,WAAA,EAAaF,QAAQ,CAAC,CAAA;EAE/B,MAAAe,kBAAA,GAAqBC,QAAQ,MAAM;IACvC,OAAOjB,QAAa,IAAA,CAACM,SAAa,IAAAL,QAAA,GAAW,KAAMI,UAAY,EAAAL,QAAA;EAAA,GAC9D,CAACM,SAAA,EAAWD,YAAYL,QAAU,EAAAA,QAAA,EAAUC,QAAQ,CAAC,CAAA;EAKxD,OAAA,eACGiB,IAAA,CAAAC,IAAA,EAAA;IAAOpB,SACL;IAAAqB,QAAA,EAAA,CAAA,CAAChB,iBACA,IAAA,eAAAiB,GAAA,CAACC,aAAE,EAAF;MACCtB,QAAA;MACAC,QAAA;MACAC,gBAAkB,EAAAK,sBAAA;MAClBgB,kBAAoB,EAAAA,CAAA,KAAMrB,gBAAiB,CAAAD,QAAA,GAAW,CAAC,CAAA;MACvDuB,oBAAoBA,CAAA,KAClBtB,gBAAA,CAAiBD,WAAW,CAAI,GAAAA,QAAA,GAAW,IAAI,CAAC;IAAA,CAEpD,CAAA,EAAA,eAEFoB,GAAA,CAACI,UAAA,EAAA;MACC,cAAa,EAAA,iBAAA;MACbC,OAAQ,EAAA,SAAA;MACP,GAAGrB,UAAA;MACJL,QAAU,EAAAgB,kBAAA;MACVW,OAAA,EAAUlB,CAAM,IAAA;QACdA,CAAA,CAAEmB,eAAgB,CAAA,CAAA;QACAb,iBAAA,EAAA;MACpB;IAAA,CACF,CAAA;EACF,CAAA,CAAA;AAEJ,CAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelatedProducts.js","sources":["../../../src/components/RelatedProducts/RelatedProducts.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\n\nimport AddToCartIcon from \"../../assets/icons/addToCart.svg\";\nimport { formatPrice } from \"../../utils/money\";\nimport { ProductCardPopup } from \"../ProductCardPopup\";\n// import { ScrollWrapper } from \"../ScrollWrapper\";\nimport { SkeletonLinearLoader } from \"../SkeletonLoader\";\nimport * as S from \"./RelatedProducts.styles\";\nimport type { RelatedProductsProps } from \"./RelatedProducts.types\";\n\nconst AddToCartIconAsset = {\n src: typeof AddToCartIcon === \"string\" ? AddToCartIcon : AddToCartIcon.src,\n width: 21.52,\n height: 15.72,\n};\n\n/**\n * Clean up:\n * - If we don't require tabs anymore in the future, we can remove all logic\n * (currently commented out) that is related to tabination\n * - Pass just a list of products (change the data structure from categorized\n * products to just an array of products)\n * - Don't forget to clean up styles\n */\nexport const RelatedProducts = ({\n categories,\n onAddToCart,\n activePopupProduct,\n renderImage,\n translations,\n}: RelatedProductsProps) => {\n // #############################################################################\n // States\n // #############################################################################\n const isLoading = useMemo(() => categories === null, [categories]);\n\n // const [selectedCategoryId, setSelectedCategoryId] = useState<string | null>(\n // categories?.[0]?.id ?? null\n // );\n\n // const selectedCategory = useMemo(() => {\n // if (!selectedCategoryId) {\n // return categories?.[0];\n // }\n\n // return (\n // categories?.find((category) => category.id === selectedCategoryId) ??\n // categories?.[0]\n // );\n // }, [categories, selectedCategoryId]);\n\n // #############################################################################\n // Popup\n // #############################################################################\n /**\n * This state is used to prevent data loss before closing animation is complete\n * when the popup is closed.\n */\n const [popupProduct, setPopupProduct] = useState(activePopupProduct);\n\n const isPopupOpen = useMemo(() => !!activePopupProduct, [activePopupProduct]);\n\n useEffect(() => {\n if (activePopupProduct !== undefined) {\n setPopupProduct(activePopupProduct);\n }\n }, [activePopupProduct]);\n\n // #############################################################################\n // Render\n // #############################################################################\n\n // Loading state\n if (isLoading) {\n return (\n <S.Container>\n {translations?.title && <S.Title>{translations?.title}</S.Title>}\n {/* <S.CategoryWrapper>\n <SkeletonLinearLoader height={20} />\n </S.CategoryWrapper> */}\n\n <S.Grid>\n {[...Array(2)].map((_, index) => (\n <SkeletonLinearLoader\n key={`product-loader-${index}`}\n height={100}\n />\n ))}\n </S.Grid>\n </S.Container>\n );\n }\n\n // No categories\n if (!categories?.length) return null;\n\n return (\n <S.Container>\n {translations?.title && <S.Title>{translations?.title}</S.Title>}\n {/* TODO: Use TabinationButtons components */}\n {/* {categories?.length > 1 && (\n <S.CategoryWrapper>\n <ScrollWrapper\n align=\"left\"\n fillType=\"gradient\"\n direction=\"horizontal\"\n gap={4}\n items={categories.map((category) => ({\n id: category.id,\n render: function Render() {\n return (\n <S.CategoryButton\n onClick={() => setSelectedCategoryId(category.id)}\n selected={selectedCategory?.id === category.id}\n >\n {category.title}\n </S.CategoryButton>\n );\n },\n }))}\n />\n </S.CategoryWrapper>\n )} */}\n <S.Grid>\n {categories\n .flatMap((category) => category.products)\n .map((product) => (\n <S.ProductContainer key={product.id}>\n <S.Wrap>\n <S.CustomImage\n sizes=\"60px\"\n responsive\n renderImage={renderImage}\n asset={product.image}\n />\n <S.Details>\n <S.ProductTitle>{product.title}</S.ProductTitle>\n <S.ProductPrice>\n {formatPrice(product.displayPrice, {\n removeTrailingZeros: true,\n })}\n </S.ProductPrice>\n </S.Details>\n </S.Wrap>\n <S.AddToCartButton onClick={() => onAddToCart?.(product.id)}>\n <S.StyleableSvgImage {...AddToCartIconAsset} />\n </S.AddToCartButton>\n </S.ProductContainer>\n ))}\n </S.Grid>\n <ProductCardPopup\n {...popupProduct}\n isOpen={isPopupOpen}\n renderImage={renderImage}\n translations={translations.productCardPopup}\n />\n </S.Container>\n );\n};\n"],"names":["AddToCartIconAsset","src","AddToCartIcon","width","height","RelatedProducts","categories","onAddToCart","activePopupProduct","renderImage","translations","isLoading","useMemo","popupProduct","setPopupProduct","useState","isPopupOpen","useEffect","jsxs","S.Container","children","title","jsx","S.Title","S.Grid","Grid","Array","map","_","index","SkeletonLinearLoader","length","flatMap","category","products","product","S.ProductContainer","S.Wrap","S.CustomImage","CustomImage","sizes","responsive","asset","image","S.Details","S.ProductTitle","S.ProductPrice","ProductPrice","formatPrice","displayPrice","removeTrailingZeros","S.AddToCartButton","onClick","id","S.StyleableSvgImage","StyleableSvgImage","ProductCardPopup","isOpen","productCardPopup"],"mappings":";;;;;;;;;;;;;;;;;;;;AAUA,MAAMA,kBAAqB,GAAA;EACzBC,GAAK,EAAA,OAAOC,sBAAkB,CAAA,SAAA,CAAA,KAAA,QAAA,GAAWA,oCAAgBA,sBAAc,CAAA,SAAA,CAAA,CAAAD,GAAA;EACvEE,KAAO,EAAA,KAAA;EACPC,MAAQ,EAAA;AACV,CAAA;AAUO,MAAMC,kBAAkBA,CAAC;EAC9BC,UAAA;EACAC,WAAA;EACAC,kBAAA;EACAC,WAAA;EACAC;AACF,CAA4B,KAAA;EAI1B,MAAMC,YAAYC,KAAAA,CAAAA,OAAQ,CAAA,MAAMN,eAAe,IAAM,EAAA,CAACA,UAAU,CAAC,CAAA;EAwBjE,MAAM,CAACO,YAAA,EAAcC,eAAe,CAAA,GAAIC,eAASP,kBAAkB,CAAA;EAE7D,MAAAQ,WAAA,GAAcJ,KAAAA,CAAAA,QAAQ,MAAM,CAAC,CAACJ,kBAAoB,EAAA,CAACA,kBAAkB,CAAC,CAAA;EAE5ES,KAAAA,CAAAA,SAAA,CAAU,MAAM;IACd,IAAIT,uBAAuB,KAAW,CAAA,EAAA;MACpCM,eAAA,CAAgBN,kBAAkB,CAAA;IACpC;EAAA,CACF,EAAG,CAACA,kBAAkB,CAAC,CAAA;EAOvB,IAAIG,SAAW,EAAA;IAEX,sBAAAO,UAAA,CAAAA,IAAA,CAACC,gCAAE,EAAF;MACEC,QAAA,EAAA,CAAAV,YAAA,EAAcW,wBAAUC,cAAA,CAAAC,sBAAAA,CAAAA,KAAA,EAAA;QAASH,wBAAcC;OAAM,CAAA,EAKrDC,eAAAA,UAAAA,CAAAA,GAAA,CAAAE,sBAAA,CAAAC,IAAA,EAAA;QACEL,QAAC,EAAA,CAAA,GAAGM,KAAM,CAAA,CAAC,CAAC,CAAA,CAAEC,GAAI,CAAA,CAACC,GAAGC,KACrB,KAAA,eAAAP,UAAA,CAAAA,GAAA,CAACQ,oBAAA,CAAAA,oBAAA,EAAA;UAEC1B,MAAQ,EAAA;QAAA,CAAA,oBADeyB,KAAK,EAG/B,CAAA;OACH,CAAA;IACF,CAAA,CAAA;EAEJ;
|
|
1
|
+
{"version":3,"file":"RelatedProducts.js","sources":["../../../src/components/RelatedProducts/RelatedProducts.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\n\nimport AddToCartIcon from \"../../assets/icons/addToCart.svg\";\nimport { formatPrice } from \"../../utils/money\";\nimport { ProductCardPopup } from \"../ProductCardPopup\";\n// import { ScrollWrapper } from \"../ScrollWrapper\";\nimport { SkeletonLinearLoader } from \"../SkeletonLoader\";\nimport * as S from \"./RelatedProducts.styles\";\nimport type { RelatedProductsProps } from \"./RelatedProducts.types\";\n\nconst AddToCartIconAsset = {\n src: typeof AddToCartIcon === \"string\" ? AddToCartIcon : AddToCartIcon.src,\n width: 21.52,\n height: 15.72,\n};\n\n/**\n * Clean up:\n * - If we don't require tabs anymore in the future, we can remove all logic\n * (currently commented out) that is related to tabination\n * - Pass just a list of products (change the data structure from categorized\n * products to just an array of products)\n * - Don't forget to clean up styles\n */\nexport const RelatedProducts = ({\n categories,\n onAddToCart,\n activePopupProduct,\n renderImage,\n translations,\n}: RelatedProductsProps) => {\n // #############################################################################\n // States\n // #############################################################################\n const isLoading = useMemo(() => categories === null, [categories]);\n\n // const [selectedCategoryId, setSelectedCategoryId] = useState<string | null>(\n // categories?.[0]?.id ?? null\n // );\n\n // const selectedCategory = useMemo(() => {\n // if (!selectedCategoryId) {\n // return categories?.[0];\n // }\n\n // return (\n // categories?.find((category) => category.id === selectedCategoryId) ??\n // categories?.[0]\n // );\n // }, [categories, selectedCategoryId]);\n\n // #############################################################################\n // Popup\n // #############################################################################\n /**\n * This state is used to prevent data loss before closing animation is complete\n * when the popup is closed.\n */\n const [popupProduct, setPopupProduct] = useState(activePopupProduct);\n\n const isPopupOpen = useMemo(() => !!activePopupProduct, [activePopupProduct]);\n\n useEffect(() => {\n if (activePopupProduct !== undefined) {\n setPopupProduct(activePopupProduct);\n }\n }, [activePopupProduct]);\n\n // #############################################################################\n // Render\n // #############################################################################\n\n // Loading state\n if (isLoading) {\n return (\n <S.Container>\n {translations?.title && <S.Title>{translations?.title}</S.Title>}\n {/* <S.CategoryWrapper>\n <SkeletonLinearLoader height={20} />\n </S.CategoryWrapper> */}\n\n <S.Grid>\n {[...Array(2)].map((_, index) => (\n <SkeletonLinearLoader\n key={`product-loader-${index}`}\n height={100}\n />\n ))}\n </S.Grid>\n </S.Container>\n );\n }\n\n // No categories\n if (!categories?.length) return null;\n\n return (\n <S.Container>\n {translations?.title && <S.Title>{translations?.title}</S.Title>}\n {/* TODO: Use TabinationButtons components */}\n {/* {categories?.length > 1 && (\n <S.CategoryWrapper>\n <ScrollWrapper\n align=\"left\"\n fillType=\"gradient\"\n direction=\"horizontal\"\n gap={4}\n items={categories.map((category) => ({\n id: category.id,\n render: function Render() {\n return (\n <S.CategoryButton\n onClick={() => setSelectedCategoryId(category.id)}\n selected={selectedCategory?.id === category.id}\n >\n {category.title}\n </S.CategoryButton>\n );\n },\n }))}\n />\n </S.CategoryWrapper>\n )} */}\n <S.Grid>\n {categories\n .flatMap((category) => category.products)\n .map((product) => (\n <S.ProductContainer key={product.id}>\n <S.Wrap>\n <S.CustomImage\n sizes=\"60px\"\n responsive\n renderImage={renderImage}\n asset={product.image}\n />\n <S.Details>\n <S.ProductTitle>{product.title}</S.ProductTitle>\n <S.ProductPrice>\n {formatPrice(product.displayPrice, {\n removeTrailingZeros: true,\n })}\n </S.ProductPrice>\n </S.Details>\n </S.Wrap>\n <S.AddToCartButton onClick={() => onAddToCart?.(product.id)}>\n <S.StyleableSvgImage {...AddToCartIconAsset} />\n </S.AddToCartButton>\n </S.ProductContainer>\n ))}\n </S.Grid>\n <ProductCardPopup\n {...popupProduct}\n isOpen={isPopupOpen}\n renderImage={renderImage}\n translations={translations.productCardPopup}\n />\n </S.Container>\n );\n};\n"],"names":["AddToCartIconAsset","src","AddToCartIcon","width","height","RelatedProducts","categories","onAddToCart","activePopupProduct","renderImage","translations","isLoading","useMemo","popupProduct","setPopupProduct","useState","isPopupOpen","useEffect","jsxs","S.Container","children","title","jsx","S.Title","S.Grid","Grid","Array","map","_","index","SkeletonLinearLoader","length","flatMap","category","products","product","S.ProductContainer","S.Wrap","S.CustomImage","CustomImage","sizes","responsive","asset","image","S.Details","S.ProductTitle","S.ProductPrice","ProductPrice","formatPrice","displayPrice","removeTrailingZeros","S.AddToCartButton","onClick","id","S.StyleableSvgImage","StyleableSvgImage","ProductCardPopup","isOpen","productCardPopup"],"mappings":";;;;;;;;;;;;;;;;;;;;AAUA,MAAMA,kBAAqB,GAA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AC,iBAAA,EAAF;YAAqB,GAAGvD;WAAoB;QAC/C,CAAA,CAAA;MAnBuB,CAAA,EAAAmC,OAAA,CAAQkB,EAoBjC,CACD;KACL,CAAA,EAAA,eACA/B,UAAA,CAAAA,GAAA,CAACkC,gBAAA,CAAAA,gBAAA,EAAA;MACE,GAAG3C,YAAA;MACJ4C,MAAQ,EAAAzC,WAAA;MACRP,WAAA;MACAC,cAAcA,YAAa,CAAAgD;IAAA,CAC7B,CAAA;EACF,CAAA,CAAA;AAEJ,CAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelatedProducts.mjs","sources":["../../../src/components/RelatedProducts/RelatedProducts.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\n\nimport AddToCartIcon from \"../../assets/icons/addToCart.svg\";\nimport { formatPrice } from \"../../utils/money\";\nimport { ProductCardPopup } from \"../ProductCardPopup\";\n// import { ScrollWrapper } from \"../ScrollWrapper\";\nimport { SkeletonLinearLoader } from \"../SkeletonLoader\";\nimport * as S from \"./RelatedProducts.styles\";\nimport type { RelatedProductsProps } from \"./RelatedProducts.types\";\n\nconst AddToCartIconAsset = {\n src: typeof AddToCartIcon === \"string\" ? AddToCartIcon : AddToCartIcon.src,\n width: 21.52,\n height: 15.72,\n};\n\n/**\n * Clean up:\n * - If we don't require tabs anymore in the future, we can remove all logic\n * (currently commented out) that is related to tabination\n * - Pass just a list of products (change the data structure from categorized\n * products to just an array of products)\n * - Don't forget to clean up styles\n */\nexport const RelatedProducts = ({\n categories,\n onAddToCart,\n activePopupProduct,\n renderImage,\n translations,\n}: RelatedProductsProps) => {\n // #############################################################################\n // States\n // #############################################################################\n const isLoading = useMemo(() => categories === null, [categories]);\n\n // const [selectedCategoryId, setSelectedCategoryId] = useState<string | null>(\n // categories?.[0]?.id ?? null\n // );\n\n // const selectedCategory = useMemo(() => {\n // if (!selectedCategoryId) {\n // return categories?.[0];\n // }\n\n // return (\n // categories?.find((category) => category.id === selectedCategoryId) ??\n // categories?.[0]\n // );\n // }, [categories, selectedCategoryId]);\n\n // #############################################################################\n // Popup\n // #############################################################################\n /**\n * This state is used to prevent data loss before closing animation is complete\n * when the popup is closed.\n */\n const [popupProduct, setPopupProduct] = useState(activePopupProduct);\n\n const isPopupOpen = useMemo(() => !!activePopupProduct, [activePopupProduct]);\n\n useEffect(() => {\n if (activePopupProduct !== undefined) {\n setPopupProduct(activePopupProduct);\n }\n }, [activePopupProduct]);\n\n // #############################################################################\n // Render\n // #############################################################################\n\n // Loading state\n if (isLoading) {\n return (\n <S.Container>\n {translations?.title && <S.Title>{translations?.title}</S.Title>}\n {/* <S.CategoryWrapper>\n <SkeletonLinearLoader height={20} />\n </S.CategoryWrapper> */}\n\n <S.Grid>\n {[...Array(2)].map((_, index) => (\n <SkeletonLinearLoader\n key={`product-loader-${index}`}\n height={100}\n />\n ))}\n </S.Grid>\n </S.Container>\n );\n }\n\n // No categories\n if (!categories?.length) return null;\n\n return (\n <S.Container>\n {translations?.title && <S.Title>{translations?.title}</S.Title>}\n {/* TODO: Use TabinationButtons components */}\n {/* {categories?.length > 1 && (\n <S.CategoryWrapper>\n <ScrollWrapper\n align=\"left\"\n fillType=\"gradient\"\n direction=\"horizontal\"\n gap={4}\n items={categories.map((category) => ({\n id: category.id,\n render: function Render() {\n return (\n <S.CategoryButton\n onClick={() => setSelectedCategoryId(category.id)}\n selected={selectedCategory?.id === category.id}\n >\n {category.title}\n </S.CategoryButton>\n );\n },\n }))}\n />\n </S.CategoryWrapper>\n )} */}\n <S.Grid>\n {categories\n .flatMap((category) => category.products)\n .map((product) => (\n <S.ProductContainer key={product.id}>\n <S.Wrap>\n <S.CustomImage\n sizes=\"60px\"\n responsive\n renderImage={renderImage}\n asset={product.image}\n />\n <S.Details>\n <S.ProductTitle>{product.title}</S.ProductTitle>\n <S.ProductPrice>\n {formatPrice(product.displayPrice, {\n removeTrailingZeros: true,\n })}\n </S.ProductPrice>\n </S.Details>\n </S.Wrap>\n <S.AddToCartButton onClick={() => onAddToCart?.(product.id)}>\n <S.StyleableSvgImage {...AddToCartIconAsset} />\n </S.AddToCartButton>\n </S.ProductContainer>\n ))}\n </S.Grid>\n <ProductCardPopup\n {...popupProduct}\n isOpen={isPopupOpen}\n renderImage={renderImage}\n translations={translations.productCardPopup}\n />\n </S.Container>\n );\n};\n"],"names":["AddToCartIconAsset","src","AddToCartIcon","width","height","RelatedProducts","categories","onAddToCart","activePopupProduct","renderImage","translations","isLoading","useMemo","popupProduct","setPopupProduct","useState","isPopupOpen","useEffect","jsxs","S.Container","children","title","jsx","S.Title","S.Grid","Array","map","_","index","SkeletonLinearLoader","length","flatMap","category","products","product","S.ProductContainer","S.Wrap","S.CustomImage","sizes","responsive","asset","image","S.Details","S.ProductTitle","S.ProductPrice","formatPrice","displayPrice","removeTrailingZeros","S.AddToCartButton","onClick","id","S.StyleableSvgImage","ProductCardPopup","isOpen","productCardPopup"],"mappings":";;;;;;;;;;;;AAUA,MAAMA,kBAAqB,GAAA;EACzBC,GAAK,EAAA,OAAOC,sBAAkB,KAAA,QAAA,GAAWA,yBAAgBA,sBAAc,CAAAD,GAAA;EACvEE,KAAO,EAAA,KAAA;EACPC,MAAQ,EAAA;AACV,CAAA;AAUO,MAAMC,kBAAkBA,CAAC;EAC9BC,UAAA;EACAC,WAAA;EACAC,kBAAA;EACAC,WAAA;EACAC;AACF,CAA4B,KAAA;EAI1B,MAAMC,YAAYC,OAAQ,CAAA,MAAMN,eAAe,IAAM,EAAA,CAACA,UAAU,CAAC,CAAA;EAwBjE,MAAM,CAACO,YAAA,EAAcC,eAAe,CAAA,GAAIC,SAASP,kBAAkB,CAAA;EAE7D,MAAAQ,WAAA,GAAcJ,QAAQ,MAAM,CAAC,CAACJ,kBAAoB,EAAA,CAACA,kBAAkB,CAAC,CAAA;EAE5ES,SAAA,CAAU,MAAM;IACd,IAAIT,uBAAuB,KAAW,CAAA,EAAA;MACpCM,eAAA,CAAgBN,kBAAkB,CAAA;IACpC;EAAA,CACF,EAAG,CAACA,kBAAkB,CAAC,CAAA;EAOvB,IAAIG,SAAW,EAAA;IAEX,sBAAAO,IAAA,CAACC,SAAE,EAAF;MACEC,QAAA,EAAA,CAAAV,YAAA,EAAcW,wBAAUC,GAAA,CAAAC,KAAA,EAAA;QAASH,wBAAcC;OAAM,CAAA,EAKrD,eAAAC,GAAA,CAAAE,IAAA,EAAA;QACEJ,QAAC,EAAA,CAAA,GAAGK,KAAM,CAAA,CAAC,CAAC,CAAA,CAAEC,GAAI,CAAA,CAACC,GAAGC,KACrB,KAAA,eAAAN,GAAA,CAACO,oBAAA,EAAA;UAECzB,MAAQ,EAAA;QAAA,CAAA,oBADewB,KAAK,EAG/B,CAAA;OACH,CAAA;IACF,CAAA,CAAA;EAEJ;
|
|
1
|
+
{"version":3,"file":"RelatedProducts.mjs","sources":["../../../src/components/RelatedProducts/RelatedProducts.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\n\nimport AddToCartIcon from \"../../assets/icons/addToCart.svg\";\nimport { formatPrice } from \"../../utils/money\";\nimport { ProductCardPopup } from \"../ProductCardPopup\";\n// import { ScrollWrapper } from \"../ScrollWrapper\";\nimport { SkeletonLinearLoader } from \"../SkeletonLoader\";\nimport * as S from \"./RelatedProducts.styles\";\nimport type { RelatedProductsProps } from \"./RelatedProducts.types\";\n\nconst AddToCartIconAsset = {\n src: typeof AddToCartIcon === \"string\" ? AddToCartIcon : AddToCartIcon.src,\n width: 21.52,\n height: 15.72,\n};\n\n/**\n * Clean up:\n * - If we don't require tabs anymore in the future, we can remove all logic\n * (currently commented out) that is related to tabination\n * - Pass just a list of products (change the data structure from categorized\n * products to just an array of products)\n * - Don't forget to clean up styles\n */\nexport const RelatedProducts = ({\n categories,\n onAddToCart,\n activePopupProduct,\n renderImage,\n translations,\n}: RelatedProductsProps) => {\n // #############################################################################\n // States\n // #############################################################################\n const isLoading = useMemo(() => categories === null, [categories]);\n\n // const [selectedCategoryId, setSelectedCategoryId] = useState<string | null>(\n // categories?.[0]?.id ?? null\n // );\n\n // const selectedCategory = useMemo(() => {\n // if (!selectedCategoryId) {\n // return categories?.[0];\n // }\n\n // return (\n // categories?.find((category) => category.id === selectedCategoryId) ??\n // categories?.[0]\n // );\n // }, [categories, selectedCategoryId]);\n\n // #############################################################################\n // Popup\n // #############################################################################\n /**\n * This state is used to prevent data loss before closing animation is complete\n * when the popup is closed.\n */\n const [popupProduct, setPopupProduct] = useState(activePopupProduct);\n\n const isPopupOpen = useMemo(() => !!activePopupProduct, [activePopupProduct]);\n\n useEffect(() => {\n if (activePopupProduct !== undefined) {\n setPopupProduct(activePopupProduct);\n }\n }, [activePopupProduct]);\n\n // #############################################################################\n // Render\n // #############################################################################\n\n // Loading state\n if (isLoading) {\n return (\n <S.Container>\n {translations?.title && <S.Title>{translations?.title}</S.Title>}\n {/* <S.CategoryWrapper>\n <SkeletonLinearLoader height={20} />\n </S.CategoryWrapper> */}\n\n <S.Grid>\n {[...Array(2)].map((_, index) => (\n <SkeletonLinearLoader\n key={`product-loader-${index}`}\n height={100}\n />\n ))}\n </S.Grid>\n </S.Container>\n );\n }\n\n // No categories\n if (!categories?.length) return null;\n\n return (\n <S.Container>\n {translations?.title && <S.Title>{translations?.title}</S.Title>}\n {/* TODO: Use TabinationButtons components */}\n {/* {categories?.length > 1 && (\n <S.CategoryWrapper>\n <ScrollWrapper\n align=\"left\"\n fillType=\"gradient\"\n direction=\"horizontal\"\n gap={4}\n items={categories.map((category) => ({\n id: category.id,\n render: function Render() {\n return (\n <S.CategoryButton\n onClick={() => setSelectedCategoryId(category.id)}\n selected={selectedCategory?.id === category.id}\n >\n {category.title}\n </S.CategoryButton>\n );\n },\n }))}\n />\n </S.CategoryWrapper>\n )} */}\n <S.Grid>\n {categories\n .flatMap((category) => category.products)\n .map((product) => (\n <S.ProductContainer key={product.id}>\n <S.Wrap>\n <S.CustomImage\n sizes=\"60px\"\n responsive\n renderImage={renderImage}\n asset={product.image}\n />\n <S.Details>\n <S.ProductTitle>{product.title}</S.ProductTitle>\n <S.ProductPrice>\n {formatPrice(product.displayPrice, {\n removeTrailingZeros: true,\n })}\n </S.ProductPrice>\n </S.Details>\n </S.Wrap>\n <S.AddToCartButton onClick={() => onAddToCart?.(product.id)}>\n <S.StyleableSvgImage {...AddToCartIconAsset} />\n </S.AddToCartButton>\n </S.ProductContainer>\n ))}\n </S.Grid>\n <ProductCardPopup\n {...popupProduct}\n isOpen={isPopupOpen}\n renderImage={renderImage}\n translations={translations.productCardPopup}\n />\n </S.Container>\n );\n};\n"],"names":["AddToCartIconAsset","src","AddToCartIcon","width","height","RelatedProducts","categories","onAddToCart","activePopupProduct","renderImage","translations","isLoading","useMemo","popupProduct","setPopupProduct","useState","isPopupOpen","useEffect","jsxs","S.Container","children","title","jsx","S.Title","S.Grid","Array","map","_","index","SkeletonLinearLoader","length","flatMap","category","products","product","S.ProductContainer","S.Wrap","S.CustomImage","sizes","responsive","asset","image","S.Details","S.ProductTitle","S.ProductPrice","formatPrice","displayPrice","removeTrailingZeros","S.AddToCartButton","onClick","id","S.StyleableSvgImage","ProductCardPopup","isOpen","productCardPopup"],"mappings":";;;;;;;;;;;;AAUA,MAAMA,kBAAqB,GAAA;EACzBC,GAAK,EAAA,OAAOC,sBAAkB,KAAA,QAAA,GAAWA,yBAAgBA,sBAAc,CAAAD,GAAA;EACvEE,KAAO,EAAA,KAAA;EACPC,MAAQ,EAAA;AACV,CAAA;AAUO,MAAMC,kBAAkBA,CAAC;EAC9BC,UAAA;EACAC,WAAA;EACAC,kBAAA;EACAC,WAAA;EACAC;AACF,CAA4B,KAAA;EAI1B,MAAMC,YAAYC,OAAQ,CAAA,MAAMN,eAAe,IAAM,EAAA,CAACA,UAAU,CAAC,CAAA;EAwBjE,MAAM,CAACO,YAAA,EAAcC,eAAe,CAAA,GAAIC,SAASP,kBAAkB,CAAA;EAE7D,MAAAQ,WAAA,GAAcJ,QAAQ,MAAM,CAAC,CAACJ,kBAAoB,EAAA,CAACA,kBAA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