@ubnt/store.core 9.17.0-alpha.4 → 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 -154
- 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/{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/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 -145
- package/lib/components/Header/ProHeader/ProHeader.js.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.mjs +39 -146
- 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/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 +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.mjs +1 -1
- 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/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/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":"taxIdSuperRefinement.js","sources":["../../../src/utils/validations/taxIdSuperRefinement.ts"],"sourcesContent":["import type { SuperRefinement } from \"zod\";\nimport { ZodIssueCode } from \"zod\";\n\nimport type { AddressType, CountryCode, Nullish } from \"../../types\";\nimport { AddressUsageType, ValidateTaxStatus } from \"../../types\";\nimport { assertUnreachable, checkUnreachable } from \"../errors\";\nimport {\n getTaxCountry,\n getTaxLabelTypeByCountry,\n getValidationMappingByType,\n hasTaxNumberPatternValidation,\n isValidTaxNumberPattern,\n} from \"../tax\";\nimport { TaxLabelType } from \"../tax/types\";\nimport { addCustomZodIssue, CustomZodIssueCode } from \"../zod\";\n\nexport type ValidateTaxIdExternally = (opts: {\n type: AddressType;\n countryCode: CountryCode;\n province: Nullish<string>;\n taxId: string;\n}) => Promise<Nullish<ValidateTaxStatus>>;\n\nexport const createTaxIdSuperRefinement =\n ({\n addressUsageType,\n validateTaxIdExternally,\n }: {\n addressUsageType: AddressUsageType;\n validateTaxIdExternally?: ValidateTaxIdExternally;\n }): SuperRefinement<{\n type: AddressType;\n country: CountryCode;\n province?: Nullish<string>;\n taxId?: Nullish<string>;\n }> =>\n async ({ type, country, province, taxId }, ctx) => {\n switch (addressUsageType) {\n // Exit early because tax ID is generally not needed for billing addresses.\n case AddressUsageType.Billing:\n return;\n // Don't do anything and proceed with the validation logic below.\n case AddressUsageType.ReturnShipping:\n case AddressUsageType.Shipping:\n break;\n default:\n assertUnreachable(addressUsageType);\n }\n\n const taxCountryCode = getTaxCountry({\n country,\n province,\n });\n\n // Doesn't require strict validation\n if (!hasTaxNumberPatternValidation(type, taxCountryCode)) {\n return;\n }\n\n const mapping = getValidationMappingByType(type);\n const { isOptional } = mapping[taxCountryCode];\n\n if (!taxId && isOptional) {\n return;\n }\n\n // Ensure that we have tax ID before passing it to the validation\n if (!taxId) {\n return ctx.addIssue({\n path: [\"taxId\"],\n code: ZodIssueCode.too_small,\n type: \"string\",\n minimum: 1,\n inclusive: true,\n });\n }\n\n const taxLabelType = getTaxLabelTypeByCountry(country, {\n type: \"specific\",\n addressType: type,\n });\n const shouldUppercaseTaxLabel = [\n TaxLabelType.Gst,\n TaxLabelType.Vat,\n TaxLabelType.Cpf,\n TaxLabelType.Cnpj,\n ].includes(taxLabelType);\n const label = shouldUppercaseTaxLabel\n ? taxLabelType.toUpperCase()\n : taxLabelType;\n\n // If the pattern is invalid, error\n if (!isValidTaxNumberPattern(type, taxCountryCode, taxId)) {\n return addCustomZodIssue(ctx, \"taxId\", CustomZodIssueCode.TaxFormat, {\n label,\n });\n }\n\n if (!validateTaxIdExternally) {\n return;\n }\n\n // Additionally validate tax id externally depending on environment\n const taxStatus = await validateTaxIdExternally({\n type,\n countryCode: country,\n province,\n taxId,\n });\n\n switch (taxStatus) {\n case ValidateTaxStatus.Invalid: {\n addCustomZodIssue(ctx, \"taxId\", CustomZodIssueCode.TaxInvalid, {\n label,\n });\n break;\n }\n\n case ValidateTaxStatus.Unavailable: {\n addCustomZodIssue(ctx, \"taxId\", CustomZodIssueCode.TaxUnavailable, {\n label,\n });\n break;\n }\n\n case ValidateTaxStatus.Valid:\n case ValidateTaxStatus.NotValidated:\n case null:\n case undefined: {\n // Do nothing;\n break;\n }\n\n default: {\n // Do nothing as well (but in a type safe way)\n checkUnreachable(taxStatus);\n }\n }\n };\n"],"names":["createTaxIdSuperRefinement","addressUsageType","validateTaxIdExternally","type","country","province","taxId","ctx","AddressUsageType","Billing","ReturnShipping","Shipping","assertUnreachable","taxCountryCode","getTaxCountry","hasTaxNumberPatternValidation","mapping","getValidationMappingByType","isOptional","addIssue","path","code","ZodIssueCode","too_small","minimum","inclusive","taxLabelType","getTaxLabelTypeByCountry","addressType","shouldUppercaseTaxLabel","TaxLabelType","Gst","Vat","Cpf","Cnpj","includes","label","toUpperCase","isValidTaxNumberPattern","addCustomZodIssue","CustomZodIssueCode","TaxFormat","taxStatus","countryCode","ValidateTaxStatus","Invalid","TaxInvalid","Unavailable","TaxUnavailable","Valid","NotValidated","checkUnreachable"],"mappings":";;;;;;;;;;;AAuBO,MAAMA,6BACXA,CAAC;EACCC,gBAAA;EACAC;AACF,CAAA,KASA,OAAO;EAAEC,IAAA;EAAMC;EAASC,QAAU;EAAAC;GAASC,GAAQ,KAAA;EACjD,QAAQN,gBAAkB;IAExB,KAAKO,SAAiB,CAAAA,gBAAA,CAAAC,OAAA;MACpB;IAEF,KAAKD,SAAAA,CAAAA,gBAAiB,CAAAE,cAAA;IACtB,KAAKF,SAAiB,CAAAA,gBAAA,CAAAG,QAAA;MACpB;IACF;MACEC,MAAA,CAAAA,iBAAA,CAAkBX,gBAAgB,CAAA;EACtC;EAEA,MAAMY,iBAAiBC,KAAAA,CAAAA,aAAc,CAAA;IACnCV,OAAA;IACAC;EAAA,CACD,CAAA;EAGD,IAAI,CAACU,KAAA,CAAAA,6BAAA,CAA8BZ,IAAM,EAAAU,cAAc,CAAG,EAAA;IACxD;EACF;EAEM,MAAAG,OAAA,GAAUC,iCAA2Bd,IAA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,kBAAkBC,OAAS;MAAA;QACZN,KAAAA,CAAAA,iBAAA,CAAAhC,GAAA,EAAK,OAAS,EAAAiC,KAAAA,CAAAA,kBAAA,CAAmBM,UAAY,EAAA;UAC7DV;QAAA,CACD,CAAA;QACD;MACF;IAEA,KAAKQ,SAAAA,CAAAA,kBAAkBG,WAAa;MAAA;QAChBR,KAAAA,CAAAA,iBAAA,CAAAhC,GAAA,EAAK,OAAS,EAAAiC,KAAAA,CAAAA,kBAAA,CAAmBQ,cAAgB,EAAA;UACjEZ;QAAA,CACD,CAAA;QACD;MACF;IAEA,KAAKQ,SAAAA,CAAAA,iBAAkB,CAAAK,KAAA;IACvB,KAAKL,SAAAA,CAAAA,iBAAkB,CAAAM,YAAA;IACvB,KAAK,IAAA;IACL,KAAK,KAAW,CAAA;MAAA;QAEd;MACF;IAEA;MAAS;QAEPC,MAAA,CAAAA,gBAAA,CAAiBT,SAAS,CAAA;MAC5B;EACF;AACF,CAAA;"}
|
|
1
|
+
{"version":3,"file":"taxIdSuperRefinement.js","sources":["../../../src/utils/validations/taxIdSuperRefinement.ts"],"sourcesContent":["import type { SuperRefinement } from \"zod\";\nimport { ZodIssueCode } from \"zod\";\n\nimport type { AddressType, CountryCode, Nullish } from \"../../types\";\nimport { AddressUsageType, ValidateTaxStatus } from \"../../types\";\nimport { assertUnreachable, checkUnreachable } from \"../errors\";\nimport {\n getTaxCountry,\n getTaxLabelTypeByCountry,\n getValidationMappingByType,\n hasTaxNumberPatternValidation,\n isValidTaxNumberPattern,\n} from \"../tax\";\nimport { TaxLabelType } from \"../tax/types\";\nimport { addCustomZodIssue, CustomZodIssueCode } from \"../zod\";\n\nexport type ValidateTaxIdExternally = (opts: {\n type: AddressType;\n countryCode: CountryCode;\n province: Nullish<string>;\n taxId: string;\n}) => Promise<Nullish<ValidateTaxStatus>>;\n\nexport const createTaxIdSuperRefinement =\n ({\n addressUsageType,\n validateTaxIdExternally,\n }: {\n addressUsageType: AddressUsageType;\n validateTaxIdExternally?: ValidateTaxIdExternally;\n }): SuperRefinement<{\n type: AddressType;\n country: CountryCode;\n province?: Nullish<string>;\n taxId?: Nullish<string>;\n }> =>\n async ({ type, country, province, taxId }, ctx) => {\n switch (addressUsageType) {\n // Exit early because tax ID is generally not needed for billing addresses.\n case AddressUsageType.Billing:\n return;\n // Don't do anything and proceed with the validation logic below.\n case AddressUsageType.ReturnShipping:\n case AddressUsageType.Shipping:\n break;\n default:\n assertUnreachable(addressUsageType);\n }\n\n const taxCountryCode = getTaxCountry({\n country,\n province,\n });\n\n // Doesn't require strict validation\n if (!hasTaxNumberPatternValidation(type, taxCountryCode)) {\n return;\n }\n\n const mapping = getValidationMappingByType(type);\n const { isOptional } = mapping[taxCountryCode];\n\n if (!taxId && isOptional) {\n return;\n }\n\n // Ensure that we have tax ID before passing it to the validation\n if (!taxId) {\n return ctx.addIssue({\n path: [\"taxId\"],\n code: ZodIssueCode.too_small,\n type: \"string\",\n minimum: 1,\n inclusive: true,\n });\n }\n\n const taxLabelType = getTaxLabelTypeByCountry(country, {\n type: \"specific\",\n addressType: type,\n });\n const shouldUppercaseTaxLabel = [\n TaxLabelType.Gst,\n TaxLabelType.Vat,\n TaxLabelType.Cpf,\n TaxLabelType.Cnpj,\n ].includes(taxLabelType);\n const label = shouldUppercaseTaxLabel\n ? taxLabelType.toUpperCase()\n : taxLabelType;\n\n // If the pattern is invalid, error\n if (!isValidTaxNumberPattern(type, taxCountryCode, taxId)) {\n return addCustomZodIssue(ctx, \"taxId\", CustomZodIssueCode.TaxFormat, {\n label,\n });\n }\n\n if (!validateTaxIdExternally) {\n return;\n }\n\n // Additionally validate tax id externally depending on environment\n const taxStatus = await validateTaxIdExternally({\n type,\n countryCode: country,\n province,\n taxId,\n });\n\n switch (taxStatus) {\n case ValidateTaxStatus.Invalid: {\n addCustomZodIssue(ctx, \"taxId\", CustomZodIssueCode.TaxInvalid, {\n label,\n });\n break;\n }\n\n case ValidateTaxStatus.Unavailable: {\n addCustomZodIssue(ctx, \"taxId\", CustomZodIssueCode.TaxUnavailable, {\n label,\n });\n break;\n }\n\n case ValidateTaxStatus.Valid:\n case ValidateTaxStatus.NotValidated:\n case null:\n case undefined: {\n // Do nothing;\n break;\n }\n\n default: {\n // Do nothing as well (but in a type safe way)\n checkUnreachable(taxStatus);\n }\n }\n };\n"],"names":["createTaxIdSuperRefinement","addressUsageType","validateTaxIdExternally","type","country","province","taxId","ctx","AddressUsageType","Billing","ReturnShipping","Shipping","assertUnreachable","taxCountryCode","getTaxCountry","hasTaxNumberPatternValidation","mapping","getValidationMappingByType","isOptional","addIssue","path","code","ZodIssueCode","too_small","minimum","inclusive","taxLabelType","getTaxLabelTypeByCountry","addressType","shouldUppercaseTaxLabel","TaxLabelType","Gst","Vat","Cpf","Cnpj","includes","label","toUpperCase","isValidTaxNumberPattern","addCustomZodIssue","CustomZodIssueCode","TaxFormat","taxStatus","countryCode","ValidateTaxStatus","Invalid","TaxInvalid","Unavailable","TaxUnavailable","Valid","NotValidated","checkUnreachable"],"mappings":";;;;;;;;;;;AAuBO,MAAMA,6BACXA,CAAC;EACCC,gBAAA;EACAC;AACF,CAAA,KASA,OAAO;EAAEC,IAAA;EAAMC;EAASC,QAAU;EAAAC;GAASC,GAAQ,KAAA;EACjD,QAAQN,gBAAkB;IAAA;IAExB,KAAKO,SAAiB,CAAAA,gBAAA,CAAAC,OAAA;MACpB;IAAA;IAEF,KAAKD,SAAAA,CAAAA,gBAAiB,CAAAE,cAAA;IACtB,KAAKF,SAAiB,CAAAA,gBAAA,CAAAG,QAAA;MACpB;IACF;MACEC,MAAA,CAAAA,iBAAA,CAAkBX,gBAAgB,CAAA;EACtC;EAEA,MAAMY,iBAAiBC,KAAAA,CAAAA,aAAc,CAAA;IACnCV,OAAA;IACAC;EAAA,CACD,CAAA;EAGD,IAAI,CAACU,KAAA,CAAAA,6BAAA,CAA8BZ,IAAM,EAAAU,cAAc,CAAG,EAAA;IACxD;EACF;EAEM,MAAAG,OAAA,GAAUC,iCAA2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A,CAAAA,kBAAkBC,OAAS;MAAA;QACZN,KAAAA,CAAAA,iBAAA,CAAAhC,GAAA,EAAK,OAAS,EAAAiC,KAAAA,CAAAA,kBAAA,CAAmBM,UAAY,EAAA;UAC7DV;QAAA,CACD,CAAA;QACD;MACF;IAEA,KAAKQ,SAAAA,CAAAA,kBAAkBG,WAAa;MAAA;QAChBR,KAAAA,CAAAA,iBAAA,CAAAhC,GAAA,EAAK,OAAS,EAAAiC,KAAAA,CAAAA,kBAAA,CAAmBQ,cAAgB,EAAA;UACjEZ;QAAA,CACD,CAAA;QACD;MACF;IAEA,KAAKQ,SAAAA,CAAAA,iBAAkB,CAAAK,KAAA;IACvB,KAAKL,SAAAA,CAAAA,iBAAkB,CAAAM,YAAA;IACvB,KAAK,IAAA;IACL,KAAK,KAAW,CAAA;MAAA;QAEd;MACF;IAEA;MAAS;QAEPC,MAAA,CAAAA,gBAAA,CAAiBT,SAAS,CAAA;MAC5B;EACF;AACF,CAAA;"}
|
|
@@ -17,8 +17,10 @@ const createTaxIdSuperRefinement = ({
|
|
|
17
17
|
taxId
|
|
18
18
|
}, ctx) => {
|
|
19
19
|
switch (addressUsageType) {
|
|
20
|
+
// Exit early because tax ID is generally not needed for billing addresses.
|
|
20
21
|
case AddressUsageType.Billing:
|
|
21
22
|
return;
|
|
23
|
+
// Don't do anything and proceed with the validation logic below.
|
|
22
24
|
case AddressUsageType.ReturnShipping:
|
|
23
25
|
case AddressUsageType.Shipping:
|
|
24
26
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taxIdSuperRefinement.mjs","sources":["../../../src/utils/validations/taxIdSuperRefinement.ts"],"sourcesContent":["import type { SuperRefinement } from \"zod\";\nimport { ZodIssueCode } from \"zod\";\n\nimport type { AddressType, CountryCode, Nullish } from \"../../types\";\nimport { AddressUsageType, ValidateTaxStatus } from \"../../types\";\nimport { assertUnreachable, checkUnreachable } from \"../errors\";\nimport {\n getTaxCountry,\n getTaxLabelTypeByCountry,\n getValidationMappingByType,\n hasTaxNumberPatternValidation,\n isValidTaxNumberPattern,\n} from \"../tax\";\nimport { TaxLabelType } from \"../tax/types\";\nimport { addCustomZodIssue, CustomZodIssueCode } from \"../zod\";\n\nexport type ValidateTaxIdExternally = (opts: {\n type: AddressType;\n countryCode: CountryCode;\n province: Nullish<string>;\n taxId: string;\n}) => Promise<Nullish<ValidateTaxStatus>>;\n\nexport const createTaxIdSuperRefinement =\n ({\n addressUsageType,\n validateTaxIdExternally,\n }: {\n addressUsageType: AddressUsageType;\n validateTaxIdExternally?: ValidateTaxIdExternally;\n }): SuperRefinement<{\n type: AddressType;\n country: CountryCode;\n province?: Nullish<string>;\n taxId?: Nullish<string>;\n }> =>\n async ({ type, country, province, taxId }, ctx) => {\n switch (addressUsageType) {\n // Exit early because tax ID is generally not needed for billing addresses.\n case AddressUsageType.Billing:\n return;\n // Don't do anything and proceed with the validation logic below.\n case AddressUsageType.ReturnShipping:\n case AddressUsageType.Shipping:\n break;\n default:\n assertUnreachable(addressUsageType);\n }\n\n const taxCountryCode = getTaxCountry({\n country,\n province,\n });\n\n // Doesn't require strict validation\n if (!hasTaxNumberPatternValidation(type, taxCountryCode)) {\n return;\n }\n\n const mapping = getValidationMappingByType(type);\n const { isOptional } = mapping[taxCountryCode];\n\n if (!taxId && isOptional) {\n return;\n }\n\n // Ensure that we have tax ID before passing it to the validation\n if (!taxId) {\n return ctx.addIssue({\n path: [\"taxId\"],\n code: ZodIssueCode.too_small,\n type: \"string\",\n minimum: 1,\n inclusive: true,\n });\n }\n\n const taxLabelType = getTaxLabelTypeByCountry(country, {\n type: \"specific\",\n addressType: type,\n });\n const shouldUppercaseTaxLabel = [\n TaxLabelType.Gst,\n TaxLabelType.Vat,\n TaxLabelType.Cpf,\n TaxLabelType.Cnpj,\n ].includes(taxLabelType);\n const label = shouldUppercaseTaxLabel\n ? taxLabelType.toUpperCase()\n : taxLabelType;\n\n // If the pattern is invalid, error\n if (!isValidTaxNumberPattern(type, taxCountryCode, taxId)) {\n return addCustomZodIssue(ctx, \"taxId\", CustomZodIssueCode.TaxFormat, {\n label,\n });\n }\n\n if (!validateTaxIdExternally) {\n return;\n }\n\n // Additionally validate tax id externally depending on environment\n const taxStatus = await validateTaxIdExternally({\n type,\n countryCode: country,\n province,\n taxId,\n });\n\n switch (taxStatus) {\n case ValidateTaxStatus.Invalid: {\n addCustomZodIssue(ctx, \"taxId\", CustomZodIssueCode.TaxInvalid, {\n label,\n });\n break;\n }\n\n case ValidateTaxStatus.Unavailable: {\n addCustomZodIssue(ctx, \"taxId\", CustomZodIssueCode.TaxUnavailable, {\n label,\n });\n break;\n }\n\n case ValidateTaxStatus.Valid:\n case ValidateTaxStatus.NotValidated:\n case null:\n case undefined: {\n // Do nothing;\n break;\n }\n\n default: {\n // Do nothing as well (but in a type safe way)\n checkUnreachable(taxStatus);\n }\n }\n };\n"],"names":["createTaxIdSuperRefinement","addressUsageType","validateTaxIdExternally","type","country","province","taxId","ctx","AddressUsageType","Billing","ReturnShipping","Shipping","assertUnreachable","taxCountryCode","getTaxCountry","hasTaxNumberPatternValidation","mapping","getValidationMappingByType","isOptional","addIssue","path","code","ZodIssueCode","too_small","minimum","inclusive","taxLabelType","getTaxLabelTypeByCountry","addressType","shouldUppercaseTaxLabel","TaxLabelType","Gst","Vat","Cpf","Cnpj","includes","label","toUpperCase","isValidTaxNumberPattern","addCustomZodIssue","CustomZodIssueCode","TaxFormat","taxStatus","countryCode","ValidateTaxStatus","Invalid","TaxInvalid","Unavailable","TaxUnavailable","Valid","NotValidated","checkUnreachable"],"mappings":";;;;;;;;;AAuBO,MAAMA,6BACXA,CAAC;EACCC,gBAAA;EACAC;AACF,CAAA,KASA,OAAO;EAAEC,IAAA;EAAMC;EAASC,QAAU;EAAAC;GAASC,GAAQ,KAAA;EACjD,QAAQN,gBAAkB;IAExB,KAAKO,gBAAiB,CAAAC,OAAA;MACpB;IAEF,KAAKD,gBAAiB,CAAAE,cAAA;IACtB,KAAKF,gBA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,MAAMxC,uBAAwB,CAAA;IAC9CC,IAAA;IACAwC,WAAa,EAAAvC,OAAA;IACbC,QAAA;IACAC;EAAA,CACD,CAAA;EAED,QAAQoC,SAAW;IACjB,KAAKE,kBAAkBC,OAAS;MAAA;QACZN,iBAAA,CAAAhC,GAAA,EAAK,OAAS,EAAAiC,kBAAA,CAAmBM,UAAY,EAAA;UAC7DV;QAAA,CACD,CAAA;QACD;MACF;IAEA,KAAKQ,kBAAkBG,WAAa;MAAA;QAChBR,iBAAA,CAAAhC,GAAA,EAAK,OAAS,EAAAiC,kBAAA,CAAmBQ,cAAgB,EAAA;UACjEZ;QAAA,CACD,CAAA;QACD;MACF;IAEA,KAAKQ,iBAAkB,CAAAK,KAAA;IACvB,KAAKL,iBAAkB,CAAAM,YAAA;IACvB,KAAK,IAAA;IACL,KAAK,KAAW,CAAA;MAAA;QAEd;MACF;IAEA;MAAS;QAEPC,gBAAA,CAAiBT,SAAS,CAAA;MAC5B;EACF;AACF,CAAA;"}
|
|
1
|
+
{"version":3,"file":"taxIdSuperRefinement.mjs","sources":["../../../src/utils/validations/taxIdSuperRefinement.ts"],"sourcesContent":["import type { SuperRefinement } from \"zod\";\nimport { ZodIssueCode } from \"zod\";\n\nimport type { AddressType, CountryCode, Nullish } from \"../../types\";\nimport { AddressUsageType, ValidateTaxStatus } from \"../../types\";\nimport { assertUnreachable, checkUnreachable } from \"../errors\";\nimport {\n getTaxCountry,\n getTaxLabelTypeByCountry,\n getValidationMappingByType,\n hasTaxNumberPatternValidation,\n isValidTaxNumberPattern,\n} from \"../tax\";\nimport { TaxLabelType } from \"../tax/types\";\nimport { addCustomZodIssue, CustomZodIssueCode } from \"../zod\";\n\nexport type ValidateTaxIdExternally = (opts: {\n type: AddressType;\n countryCode: CountryCode;\n province: Nullish<string>;\n taxId: string;\n}) => Promise<Nullish<ValidateTaxStatus>>;\n\nexport const createTaxIdSuperRefinement =\n ({\n addressUsageType,\n validateTaxIdExternally,\n }: {\n addressUsageType: AddressUsageType;\n validateTaxIdExternally?: ValidateTaxIdExternally;\n }): SuperRefinement<{\n type: AddressType;\n country: CountryCode;\n province?: Nullish<string>;\n taxId?: Nullish<string>;\n }> =>\n async ({ type, country, province, taxId }, ctx) => {\n switch (addressUsageType) {\n // Exit early because tax ID is generally not needed for billing addresses.\n case AddressUsageType.Billing:\n return;\n // Don't do anything and proceed with the validation logic below.\n case AddressUsageType.ReturnShipping:\n case AddressUsageType.Shipping:\n break;\n default:\n assertUnreachable(addressUsageType);\n }\n\n const taxCountryCode = getTaxCountry({\n country,\n province,\n });\n\n // Doesn't require strict validation\n if (!hasTaxNumberPatternValidation(type, taxCountryCode)) {\n return;\n }\n\n const mapping = getValidationMappingByType(type);\n const { isOptional } = mapping[taxCountryCode];\n\n if (!taxId && isOptional) {\n return;\n }\n\n // Ensure that we have tax ID before passing it to the validation\n if (!taxId) {\n return ctx.addIssue({\n path: [\"taxId\"],\n code: ZodIssueCode.too_small,\n type: \"string\",\n minimum: 1,\n inclusive: true,\n });\n }\n\n const taxLabelType = getTaxLabelTypeByCountry(country, {\n type: \"specific\",\n addressType: type,\n });\n const shouldUppercaseTaxLabel = [\n TaxLabelType.Gst,\n TaxLabelType.Vat,\n TaxLabelType.Cpf,\n TaxLabelType.Cnpj,\n ].includes(taxLabelType);\n const label = shouldUppercaseTaxLabel\n ? taxLabelType.toUpperCase()\n : taxLabelType;\n\n // If the pattern is invalid, error\n if (!isValidTaxNumberPattern(type, taxCountryCode, taxId)) {\n return addCustomZodIssue(ctx, \"taxId\", CustomZodIssueCode.TaxFormat, {\n label,\n });\n }\n\n if (!validateTaxIdExternally) {\n return;\n }\n\n // Additionally validate tax id externally depending on environment\n const taxStatus = await validateTaxIdExternally({\n type,\n countryCode: country,\n province,\n taxId,\n });\n\n switch (taxStatus) {\n case ValidateTaxStatus.Invalid: {\n addCustomZodIssue(ctx, \"taxId\", CustomZodIssueCode.TaxInvalid, {\n label,\n });\n break;\n }\n\n case ValidateTaxStatus.Unavailable: {\n addCustomZodIssue(ctx, \"taxId\", CustomZodIssueCode.TaxUnavailable, {\n label,\n });\n break;\n }\n\n case ValidateTaxStatus.Valid:\n case ValidateTaxStatus.NotValidated:\n case null:\n case undefined: {\n // Do nothing;\n break;\n }\n\n default: {\n // Do nothing as well (but in a type safe way)\n checkUnreachable(taxStatus);\n }\n }\n };\n"],"names":["createTaxIdSuperRefinement","addressUsageType","validateTaxIdExternally","type","country","province","taxId","ctx","AddressUsageType","Billing","ReturnShipping","Shipping","assertUnreachable","taxCountryCode","getTaxCountry","hasTaxNumberPatternValidation","mapping","getValidationMappingByType","isOptional","addIssue","path","code","ZodIssueCode","too_small","minimum","inclusive","taxLabelType","getTaxLabelTypeByCountry","addressType","shouldUppercaseTaxLabel","TaxLabelType","Gst","Vat","Cpf","Cnpj","includes","label","toUpperCase","isValidTaxNumberPattern","addCustomZodIssue","CustomZodIssueCode","TaxFormat","taxStatus","countryCode","ValidateTaxStatus","Invalid","TaxInvalid","Unavailable","TaxUnavailable","Valid","NotValidated","checkUnreachable"],"mappings":";;;;;;;;;AAuBO,MAAMA,6BACXA,CAAC;EACCC,gBAAA;EACAC;AACF,CAAA,KASA,OAAO;EAAEC,IAAA;EAAMC;EAASC,QAAU;EAAAC;GAASC,GAAQ,KAAA;EACjD,QAAQN,gBAAkB;IAAA;IAExB,KAAKO,gBAAiB,CAAAC,OAAA;MACpB;IAAA;IAEF,KAAKD,gBAAiB,CAAAE,cAAA;IACtB,KAAKF,gBAAiB,CAAAG,QAAA;MACpB;IACF;MACEC,iBAAA,CAAkBX,gBAAgB,CAAA;EACtC;EAEA,MAAMY,iBAAiBC,aAAc,CAAA;IACnCV,OAAA;IACAC;EAAA,CACD,CAAA;EAGD,IAAI,CAACU,6BAAA,CAA8BZ,IAAM,EAAAU,cAAc,CAAG,EAAA;IACxD;EACF;EAEM,MAAAG,OAAA,GAAUC,2BAA2Bd,IAAI,CAAA;EAC/C,MAAM;IAAEe;EAAA,CAAe,GAAAF,OAAA,C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,CAAAhC,GAAA,EAAK,OAAS,EAAAiC,kBAAA,CAAmBQ,cAAgB,EAAA;UACjEZ;QAAA,CACD,CAAA;QACD;MACF;IAEA,KAAKQ,iBAAkB,CAAAK,KAAA;IACvB,KAAKL,iBAAkB,CAAAM,YAAA;IACvB,KAAK,IAAA;IACL,KAAK,KAAW,CAAA;MAAA;QAEd;MACF;IAEA;MAAS;QAEPC,gBAAA,CAAiBT,SAAS,CAAA;MAC5B;EACF;AACF,CAAA;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Util to easily parse that any given input is a finite number (not NaN, Infinity, -Infinity, etc.)
|
|
3
|
+
* @throws If given input is not a finite number
|
|
4
|
+
*/
|
|
5
|
+
export declare function isFiniteNumber(value: unknown, entity?: string, ErrorClass?: new (message: string) => void): asserts value is number;
|
|
6
|
+
/**
|
|
7
|
+
* Custom isInt validation function that returns a more fine-grained error message otherwise for type safety alone a
|
|
8
|
+
* Number.isSafeInteger would be sufficient.
|
|
9
|
+
*
|
|
10
|
+
* Code inspired from graphql-scalars library.
|
|
11
|
+
* @see
|
|
12
|
+
* https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L20-L32
|
|
13
|
+
* @throws If given input is not a valid integer
|
|
14
|
+
*/
|
|
15
|
+
export declare function isInt(value: unknown, entity?: string, ErrorClass?: new (message: string) => void): asserts value is number;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
function isFiniteNumber(value, entity = "Value", ErrorClass = TypeError) {
|
|
5
|
+
if (typeof value !== "number" || Number.isNaN(value)) {
|
|
6
|
+
throw new ErrorClass(`${entity} is not a number: ${value}`);
|
|
7
|
+
}
|
|
8
|
+
if (!Number.isFinite(value)) {
|
|
9
|
+
throw new ErrorClass(`${entity} is not a finite number: ${value}`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function isInt(value, entity = "Value", ErrorClass = TypeError) {
|
|
13
|
+
isFiniteNumber(value, entity, ErrorClass);
|
|
14
|
+
if (!Number.isInteger(value)) {
|
|
15
|
+
throw new ErrorClass(`${entity} is not an integer: ${value}`);
|
|
16
|
+
}
|
|
17
|
+
if (!Number.isSafeInteger(value)) {
|
|
18
|
+
throw new ErrorClass(`${entity} is not a safe integer: ${value}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.isFiniteNumber = isFiniteNumber;
|
|
22
|
+
exports.isInt = isInt;
|
|
23
|
+
//# sourceMappingURL=validations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validations.js","sources":["../../src/utils/validations.ts"],"sourcesContent":["/**\n * Util to easily parse that any given input is a finite number (not NaN, Infinity, -Infinity, etc.)\n * @throws If given input is not a finite number\n */\nexport function isFiniteNumber(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n if (typeof value !== \"number\" || Number.isNaN(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a number: ${value}`);\n }\n\n if (!Number.isFinite(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a finite number: ${value}`);\n }\n}\n\n/**\n * Custom isInt validation function that returns a more fine-grained error message otherwise for type safety alone a\n * Number.isSafeInteger would be sufficient.\n *\n * Code inspired from graphql-scalars library.\n * @see\n * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L20-L32\n * @throws If given input is not a valid integer\n */\nexport function isInt(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n isFiniteNumber(value, entity, ErrorClass);\n\n if (!Number.isInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not an integer: ${value}`);\n }\n\n if (!Number.isSafeInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a safe integer: ${value}`);\n }\n}\n"],"names":["isFiniteNumber","value","entity","ErrorClass","TypeError","Number","isNaN","isFinite","isInt","isInteger","isSafeInteger"],"mappings":";;;AAIO,SAASA,cACdA,CAAAC,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACzB,IAAI,OAAOH,KAAU,KAAA,QAAA,IAAYI,MAAO,CAAAC,KAAA,CAAML,KAAK,CAAG,EAAA;IAEpD,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,qBAAqBD,KAAO,EAAA,CAAA;EAC5D;EAEA,IAAI,CAACI,MAAA,CAAOE,QAAS,CAAAN,KAAK,CAAG,EAAA;IAE3B,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,4BAA4BD,KAAO,EAAA,CAAA;EACnE;AACF;AAWO,SAASO,KACdA,CAAAP,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACVJ,cAAA,CAAAC,KAAA,EAAOC,QAAQC,UAAU,CAAA;EAExC,IAAI,CAACE,MAAA,CAAOI,SAAU,CAAAR,KAAK,CAAG,EAAA;IAE5B,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,uBAAuBD,KAAO,EAAA,CAAA;EAC9D;EAEA,IAAI,CAACI,MAAA,CAAOK,aAAc,CAAAT,KAAK,CAAG,EAAA;IAEhC,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,2BAA2BD,KAAO,EAAA,CAAA;EAClE;AACF;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function isFiniteNumber(value, entity = "Value", ErrorClass = TypeError) {
|
|
4
|
+
if (typeof value !== "number" || Number.isNaN(value)) {
|
|
5
|
+
throw new ErrorClass(`${entity} is not a number: ${value}`);
|
|
6
|
+
}
|
|
7
|
+
if (!Number.isFinite(value)) {
|
|
8
|
+
throw new ErrorClass(`${entity} is not a finite number: ${value}`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function isInt(value, entity = "Value", ErrorClass = TypeError) {
|
|
12
|
+
isFiniteNumber(value, entity, ErrorClass);
|
|
13
|
+
if (!Number.isInteger(value)) {
|
|
14
|
+
throw new ErrorClass(`${entity} is not an integer: ${value}`);
|
|
15
|
+
}
|
|
16
|
+
if (!Number.isSafeInteger(value)) {
|
|
17
|
+
throw new ErrorClass(`${entity} is not a safe integer: ${value}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export { isFiniteNumber, isInt };
|
|
21
|
+
//# sourceMappingURL=validations.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validations.mjs","sources":["../../src/utils/validations.ts"],"sourcesContent":["/**\n * Util to easily parse that any given input is a finite number (not NaN, Infinity, -Infinity, etc.)\n * @throws If given input is not a finite number\n */\nexport function isFiniteNumber(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n if (typeof value !== \"number\" || Number.isNaN(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a number: ${value}`);\n }\n\n if (!Number.isFinite(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a finite number: ${value}`);\n }\n}\n\n/**\n * Custom isInt validation function that returns a more fine-grained error message otherwise for type safety alone a\n * Number.isSafeInteger would be sufficient.\n *\n * Code inspired from graphql-scalars library.\n * @see\n * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L20-L32\n * @throws If given input is not a valid integer\n */\nexport function isInt(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n isFiniteNumber(value, entity, ErrorClass);\n\n if (!Number.isInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not an integer: ${value}`);\n }\n\n if (!Number.isSafeInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a safe integer: ${value}`);\n }\n}\n"],"names":["isFiniteNumber","value","entity","ErrorClass","TypeError","Number","isNaN","isFinite","isInt","isInteger","isSafeInteger"],"mappings":";;AAIO,SAASA,cACdA,CAAAC,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACzB,IAAI,OAAOH,KAAU,KAAA,QAAA,IAAYI,MAAO,CAAAC,KAAA,CAAML,KAAK,CAAG,EAAA;IAEpD,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,qBAAqBD,KAAO,EAAA,CAAA;EAC5D;EAEA,IAAI,CAACI,MAAA,CAAOE,QAAS,CAAAN,KAAK,CAAG,EAAA;IAE3B,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,4BAA4BD,KAAO,EAAA,CAAA;EACnE;AACF;AAWO,SAASO,KACdA,CAAAP,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACVJ,cAAA,CAAAC,KAAA,EAAOC,QAAQC,UAAU,CAAA;EAExC,IAAI,CAACE,MAAA,CAAOI,SAAU,CAAAR,KAAK,CAAG,EAAA;IAE5B,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,uBAAuBD,KAAO,EAAA,CAAA;EAC9D;EAEA,IAAI,CAACI,MAAA,CAAOK,aAAc,CAAAT,KAAK,CAAG,EAAA;IAEhC,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,2BAA2BD,KAAO,EAAA,CAAA;EAClE;AACF;"}
|
package/lib/utils/variant.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variant.js","sources":["../../src/utils/variant.ts"],"sourcesContent":["/**\n * Removes the regional (and other) SKU postfix from the SKU.\n */\n\nconst REGIONAL_SKU_POSTFIX = [\n \" EU\",\n \"-EU\",\n \"(EU)\",\n \" US\",\n \"(US)\",\n \"-US\",\n \"-BR\",\n \"-CN\",\n \"-TW\",\n \"-JP\",\n \"-AU\",\n \"-AR\",\n \"-UK\",\n \"-U\",\n \"-IND\",\n \"-Standalone\",\n];\n\nexport const removeRegionalSkuPostfix = (sku?: string) => {\n const trimmedSku = sku?.trim();\n\n if (!trimmedSku) return undefined;\n\n const postfix = REGIONAL_SKU_POSTFIX.find((postfix) =>\n trimmedSku.trim().toUpperCase().endsWith(postfix.toUpperCase()),\n );\n\n if (!postfix) return trimmedSku;\n\n return trimmedSku.slice(0, -postfix.length).trim();\n};\n\n/**\n * Returns the SKU text with the extra label if it exists.\n */\nexport const getSkuText = (sku?: string, extraLabel?: string) => {\n if (!sku) return undefined;\n\n const preparedSku = removeRegionalSkuPostfix(sku);\n\n if (!extraLabel) return preparedSku;\n\n return `${preparedSku} (${extraLabel})`;\n};\n"],"names":["REGIONAL_SKU_POSTFIX","removeRegionalSkuPostfix","sku","trimmedSku","trim","postfix","find","toUpperCase","endsWith","slice","length","getSkuText","extraLabel","preparedSku"],"mappings":";;;AAIA,MAAMA,oBAAuB,GAAA,CAC3B,KAAA,EACA,KAAA,EACA,MAAA,EACA,KAAA,EACA,MAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,IAAA,EACA,MAAA,EACA,aAAA,CACF;AAEa,MAAAC,wBAAA,GAA4BC,GAAiB,IAAA;EAClD,MAAAC,UAAA,GAAaD,KAAKE,IAAK,EAAA;
|
|
1
|
+
{"version":3,"file":"variant.js","sources":["../../src/utils/variant.ts"],"sourcesContent":["/**\n * Removes the regional (and other) SKU postfix from the SKU.\n */\n\nconst REGIONAL_SKU_POSTFIX = [\n \" EU\",\n \"-EU\",\n \"(EU)\",\n \" US\",\n \"(US)\",\n \"-US\",\n \"-BR\",\n \"-CN\",\n \"-TW\",\n \"-JP\",\n \"-AU\",\n \"-AR\",\n \"-UK\",\n \"-U\",\n \"-IND\",\n \"-Standalone\",\n];\n\nexport const removeRegionalSkuPostfix = (sku?: string) => {\n const trimmedSku = sku?.trim();\n\n if (!trimmedSku) return undefined;\n\n const postfix = REGIONAL_SKU_POSTFIX.find((postfix) =>\n trimmedSku.trim().toUpperCase().endsWith(postfix.toUpperCase()),\n );\n\n if (!postfix) return trimmedSku;\n\n return trimmedSku.slice(0, -postfix.length).trim();\n};\n\n/**\n * Returns the SKU text with the extra label if it exists.\n */\nexport const getSkuText = (sku?: string, extraLabel?: string) => {\n if (!sku) return undefined;\n\n const preparedSku = removeRegionalSkuPostfix(sku);\n\n if (!extraLabel) return preparedSku;\n\n return `${preparedSku} (${extraLabel})`;\n};\n"],"names":["REGIONAL_SKU_POSTFIX","removeRegionalSkuPostfix","sku","trimmedSku","trim","postfix","find","toUpperCase","endsWith","slice","length","getSkuText","extraLabel","preparedSku"],"mappings":";;;AAIA,MAAMA,oBAAuB,GAAA,CAC3B,KAAA,EACA,KAAA,EACA,MAAA,EACA,KAAA,EACA,MAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,IAAA,EACA,MAAA,EACA,aAAA,CACF;AAEa,MAAAC,wBAAA,GAA4BC,GAAiB,IAAA;EAClD,MAAAC,UAAA,GAAaD,KAAKE,IAAK,EAAA;EAEzB,IAAA,CAACD,YAAmB,OAAA,KAAA,CAAA;EAExB,MAAME,UAAUL,oBAAqB,CAAAM,IAAA,CAAMD,QACzC,IAAAF,UAAA,CAAWC,IAAK,CAAA,CAAA,CAAEG,aAAc,CAAAC,QAAA,CAASH,QAAQ,CAAAE,WAAA,EAAa,CAAA,CAChE;EAEI,IAAA,CAACF,SAAgB,OAAAF,UAAA;EAErB,OAAOA,WAAWM,KAAM,CAAA,CAAA,EAAG,CAACJ,OAAQ,CAAAK,MAAM,EAAEN,IAAK,EAAA;AACnD,CAAA;AAKa,MAAAO,UAAA,GAAaA,CAACT,GAAA,EAAcU,UAAwB,KAAA;EAC3D,IAAA,CAACV,KAAY,OAAA,KAAA,CAAA;EAEX,MAAAW,WAAA,GAAcZ,yBAAyBC,GAAG,CAAA;EAE5C,IAAA,CAACU,YAAmB,OAAAC,WAAA;EAEjB,OAAA,GAAGA,WAAW,KAAKD,UAAU,GAAA;AACtC,CAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variant.mjs","sources":["../../src/utils/variant.ts"],"sourcesContent":["/**\n * Removes the regional (and other) SKU postfix from the SKU.\n */\n\nconst REGIONAL_SKU_POSTFIX = [\n \" EU\",\n \"-EU\",\n \"(EU)\",\n \" US\",\n \"(US)\",\n \"-US\",\n \"-BR\",\n \"-CN\",\n \"-TW\",\n \"-JP\",\n \"-AU\",\n \"-AR\",\n \"-UK\",\n \"-U\",\n \"-IND\",\n \"-Standalone\",\n];\n\nexport const removeRegionalSkuPostfix = (sku?: string) => {\n const trimmedSku = sku?.trim();\n\n if (!trimmedSku) return undefined;\n\n const postfix = REGIONAL_SKU_POSTFIX.find((postfix) =>\n trimmedSku.trim().toUpperCase().endsWith(postfix.toUpperCase()),\n );\n\n if (!postfix) return trimmedSku;\n\n return trimmedSku.slice(0, -postfix.length).trim();\n};\n\n/**\n * Returns the SKU text with the extra label if it exists.\n */\nexport const getSkuText = (sku?: string, extraLabel?: string) => {\n if (!sku) return undefined;\n\n const preparedSku = removeRegionalSkuPostfix(sku);\n\n if (!extraLabel) return preparedSku;\n\n return `${preparedSku} (${extraLabel})`;\n};\n"],"names":["REGIONAL_SKU_POSTFIX","removeRegionalSkuPostfix","sku","trimmedSku","trim","postfix","find","toUpperCase","endsWith","slice","length","getSkuText","extraLabel","preparedSku"],"mappings":";;AAIA,MAAMA,oBAAuB,GAAA,CAC3B,KAAA,EACA,KAAA,EACA,MAAA,EACA,KAAA,EACA,MAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,IAAA,EACA,MAAA,EACA,aAAA,CACF;AAEa,MAAAC,wBAAA,GAA4BC,GAAiB,IAAA;EAClD,MAAAC,UAAA,GAAaD,KAAKE,IAAK,EAAA;
|
|
1
|
+
{"version":3,"file":"variant.mjs","sources":["../../src/utils/variant.ts"],"sourcesContent":["/**\n * Removes the regional (and other) SKU postfix from the SKU.\n */\n\nconst REGIONAL_SKU_POSTFIX = [\n \" EU\",\n \"-EU\",\n \"(EU)\",\n \" US\",\n \"(US)\",\n \"-US\",\n \"-BR\",\n \"-CN\",\n \"-TW\",\n \"-JP\",\n \"-AU\",\n \"-AR\",\n \"-UK\",\n \"-U\",\n \"-IND\",\n \"-Standalone\",\n];\n\nexport const removeRegionalSkuPostfix = (sku?: string) => {\n const trimmedSku = sku?.trim();\n\n if (!trimmedSku) return undefined;\n\n const postfix = REGIONAL_SKU_POSTFIX.find((postfix) =>\n trimmedSku.trim().toUpperCase().endsWith(postfix.toUpperCase()),\n );\n\n if (!postfix) return trimmedSku;\n\n return trimmedSku.slice(0, -postfix.length).trim();\n};\n\n/**\n * Returns the SKU text with the extra label if it exists.\n */\nexport const getSkuText = (sku?: string, extraLabel?: string) => {\n if (!sku) return undefined;\n\n const preparedSku = removeRegionalSkuPostfix(sku);\n\n if (!extraLabel) return preparedSku;\n\n return `${preparedSku} (${extraLabel})`;\n};\n"],"names":["REGIONAL_SKU_POSTFIX","removeRegionalSkuPostfix","sku","trimmedSku","trim","postfix","find","toUpperCase","endsWith","slice","length","getSkuText","extraLabel","preparedSku"],"mappings":";;AAIA,MAAMA,oBAAuB,GAAA,CAC3B,KAAA,EACA,KAAA,EACA,MAAA,EACA,KAAA,EACA,MAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,KAAA,EACA,IAAA,EACA,MAAA,EACA,aAAA,CACF;AAEa,MAAAC,wBAAA,GAA4BC,GAAiB,IAAA;EAClD,MAAAC,UAAA,GAAaD,KAAKE,IAAK,EAAA;EAEzB,IAAA,CAACD,YAAmB,OAAA,KAAA,CAAA;EAExB,MAAME,UAAUL,oBAAqB,CAAAM,IAAA,CAAMD,QACzC,IAAAF,UAAA,CAAWC,IAAK,CAAA,CAAA,CAAEG,aAAc,CAAAC,QAAA,CAASH,QAAQ,CAAAE,WAAA,EAAa,CAAA,CAChE;EAEI,IAAA,CAACF,SAAgB,OAAAF,UAAA;EAErB,OAAOA,WAAWM,KAAM,CAAA,CAAA,EAAG,CAACJ,OAAQ,CAAAK,MAAM,EAAEN,IAAK,EAAA;AACnD,CAAA;AAKa,MAAAO,UAAA,GAAaA,CAACT,GAAA,EAAcU,UAAwB,KAAA;EAC3D,IAAA,CAACV,KAAY,OAAA,KAAA,CAAA;EAEX,MAAAW,WAAA,GAAcZ,yBAAyBC,GAAG,CAAA;EAE5C,IAAA,CAACU,YAAmB,OAAAC,WAAA;EAEjB,OAAA,GAAGA,WAAW,KAAKD,UAAU,GAAA;AACtC,CAAA;"}
|
package/lib/utils/wattage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wattage.js","sources":["../../src/utils/wattage.ts"],"sourcesContent":["// #############################################################################\n// PoE Wattage Tags\n// #############################################################################\n\nconst POE_WATTAGE_REGEX = /poe:(\\d+)w/i;\n\n/**\n * Get the PoE wattage from a tag\n * @example \"poe:100w\" => \"100W\"\n */\nexport const getPoeWattageFromTag = (tagName: string | undefined) => {\n // If there is no wattage tag, return undefined\n if (!tagName) return undefined;\n\n // Get the wattage from the tag\n const wattage = POE_WATTAGE_REGEX.exec(tagName)?.[1];\n\n // If there is no wattage, return undefined\n if (!wattage || !wattage.length) return undefined;\n\n // Return the wattage\n return `${wattage}W`;\n};\n\n/**\n * Finds first PoE wattage tag and returns the wattage\n */\nexport const getPoeWattageFromTags = (\n tags: { name: string }[],\n): string | undefined => {\n for (const tag of tags) {\n const watts = getPoeWattageFromTag(tag.name);\n\n if (watts) return watts;\n }\n\n return undefined;\n};\n"],"names":["POE_WATTAGE_REGEX","getPoeWattageFromTag","tagName","wattage","exec","length","getPoeWattageFromTags","tags","tag","watts","name"],"mappings":";;;AAIA,MAAMA,iBAAoB,GAAA,aAAA;AAMb,MAAAC,oBAAA,GAAwBC,OAAgC,IAAA;
|
|
1
|
+
{"version":3,"file":"wattage.js","sources":["../../src/utils/wattage.ts"],"sourcesContent":["// #############################################################################\n// PoE Wattage Tags\n// #############################################################################\n\nconst POE_WATTAGE_REGEX = /poe:(\\d+)w/i;\n\n/**\n * Get the PoE wattage from a tag\n * @example \"poe:100w\" => \"100W\"\n */\nexport const getPoeWattageFromTag = (tagName: string | undefined) => {\n // If there is no wattage tag, return undefined\n if (!tagName) return undefined;\n\n // Get the wattage from the tag\n const wattage = POE_WATTAGE_REGEX.exec(tagName)?.[1];\n\n // If there is no wattage, return undefined\n if (!wattage || !wattage.length) return undefined;\n\n // Return the wattage\n return `${wattage}W`;\n};\n\n/**\n * Finds first PoE wattage tag and returns the wattage\n */\nexport const getPoeWattageFromTags = (\n tags: { name: string }[],\n): string | undefined => {\n for (const tag of tags) {\n const watts = getPoeWattageFromTag(tag.name);\n\n if (watts) return watts;\n }\n\n return undefined;\n};\n"],"names":["POE_WATTAGE_REGEX","getPoeWattageFromTag","tagName","wattage","exec","length","getPoeWattageFromTags","tags","tag","watts","name"],"mappings":";;;AAIA,MAAMA,iBAAoB,GAAA,aAAA;AAMb,MAAAC,oBAAA,GAAwBC,OAAgC,IAAA;EAE/D,IAAA,CAACA,SAAgB,OAAA,KAAA,CAAA;EAGrB,MAAMC,OAAU,GAAAH,iBAAA,CAAkBI,IAAK,CAAAF,OAAO,IAAI,CAAC,CAAA;EAGnD,IAAI,CAACC,OAAA,IAAW,CAACA,OAAA,CAAQE,QAAe,OAAA,KAAA,CAAA;EAGxC,UAAUF,OAAO,GAAA;AACnB,CAAA;AAKa,MAAAG,qBAAA,GACXC,IACuB,IAAA;EACvB,KAAA,MAAWC,OAAOD,IAAM,EAAA;IAChB,MAAAE,KAAA,GAAQR,oBAAqB,CAAAO,GAAA,CAAIE,IAAI,CAAA;IAE3C,IAAID,OAAc,OAAAA,KAAA;EACpB;EAEO,OAAA,KAAA,CAAA;AACT,CAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wattage.mjs","sources":["../../src/utils/wattage.ts"],"sourcesContent":["// #############################################################################\n// PoE Wattage Tags\n// #############################################################################\n\nconst POE_WATTAGE_REGEX = /poe:(\\d+)w/i;\n\n/**\n * Get the PoE wattage from a tag\n * @example \"poe:100w\" => \"100W\"\n */\nexport const getPoeWattageFromTag = (tagName: string | undefined) => {\n // If there is no wattage tag, return undefined\n if (!tagName) return undefined;\n\n // Get the wattage from the tag\n const wattage = POE_WATTAGE_REGEX.exec(tagName)?.[1];\n\n // If there is no wattage, return undefined\n if (!wattage || !wattage.length) return undefined;\n\n // Return the wattage\n return `${wattage}W`;\n};\n\n/**\n * Finds first PoE wattage tag and returns the wattage\n */\nexport const getPoeWattageFromTags = (\n tags: { name: string }[],\n): string | undefined => {\n for (const tag of tags) {\n const watts = getPoeWattageFromTag(tag.name);\n\n if (watts) return watts;\n }\n\n return undefined;\n};\n"],"names":["POE_WATTAGE_REGEX","getPoeWattageFromTag","tagName","wattage","exec","length","getPoeWattageFromTags","tags","tag","watts","name"],"mappings":";;AAIA,MAAMA,iBAAoB,GAAA,aAAA;AAMb,MAAAC,oBAAA,GAAwBC,OAAgC,IAAA;
|
|
1
|
+
{"version":3,"file":"wattage.mjs","sources":["../../src/utils/wattage.ts"],"sourcesContent":["// #############################################################################\n// PoE Wattage Tags\n// #############################################################################\n\nconst POE_WATTAGE_REGEX = /poe:(\\d+)w/i;\n\n/**\n * Get the PoE wattage from a tag\n * @example \"poe:100w\" => \"100W\"\n */\nexport const getPoeWattageFromTag = (tagName: string | undefined) => {\n // If there is no wattage tag, return undefined\n if (!tagName) return undefined;\n\n // Get the wattage from the tag\n const wattage = POE_WATTAGE_REGEX.exec(tagName)?.[1];\n\n // If there is no wattage, return undefined\n if (!wattage || !wattage.length) return undefined;\n\n // Return the wattage\n return `${wattage}W`;\n};\n\n/**\n * Finds first PoE wattage tag and returns the wattage\n */\nexport const getPoeWattageFromTags = (\n tags: { name: string }[],\n): string | undefined => {\n for (const tag of tags) {\n const watts = getPoeWattageFromTag(tag.name);\n\n if (watts) return watts;\n }\n\n return undefined;\n};\n"],"names":["POE_WATTAGE_REGEX","getPoeWattageFromTag","tagName","wattage","exec","length","getPoeWattageFromTags","tags","tag","watts","name"],"mappings":";;AAIA,MAAMA,iBAAoB,GAAA,aAAA;AAMb,MAAAC,oBAAA,GAAwBC,OAAgC,IAAA;EAE/D,IAAA,CAACA,SAAgB,OAAA,KAAA,CAAA;EAGrB,MAAMC,OAAU,GAAAH,iBAAA,CAAkBI,IAAK,CAAAF,OAAO,IAAI,CAAC,CAAA;EAGnD,IAAI,CAACC,OAAA,IAAW,CAACA,OAAA,CAAQE,QAAe,OAAA,KAAA,CAAA;EAGxC,UAAUF,OAAO,GAAA;AACnB,CAAA;AAKa,MAAAG,qBAAA,GACXC,IACuB,IAAA;EACvB,KAAA,MAAWC,OAAOD,IAAM,EAAA;IAChB,MAAAE,KAAA,GAAQR,oBAAqB,CAAAO,GAAA,CAAIE,IAAI,CAAA;IAE3C,IAAID,OAAc,OAAAA,KAAA;EACpB;EAEO,OAAA,KAAA,CAAA;AACT,CAAA;"}
|
package/package.json
CHANGED
package/lib/assets/efg.png
DELETED
|
Binary file
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<svg width="17" height="17" viewBox="0 0 17 17" fill="none"
|
|
2
|
-
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.0499 6.80268C11.0499 8.21196 9.90823 9.3544 8.4999 9.3544C7.09158 9.3544 5.9499 8.21196 5.9499 6.80268C5.9499 5.3934 7.09158 4.25095 8.4999 4.25095C9.90823 4.25095 11.0499 5.3934 11.0499 6.80268ZM10.1999 6.80268C10.1999 7.7422 9.43879 8.50383 8.4999 8.50383C7.56102 8.50383 6.7999 7.7422 6.7999 6.80268C6.7999 5.86316 7.56102 5.10152 8.4999 5.10152C9.43879 5.10152 10.1999 5.86316 10.1999 6.80268Z" fill="currentColor"/>
|
|
4
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.4999 1.69922C5.68325 1.69922 3.3999 3.98411 3.3999 6.80268C3.3999 8.76181 4.31062 10.6139 5.31026 12.0638C6.31479 13.5208 7.44298 14.6203 7.94931 15.0835C8.26361 15.3711 8.73619 15.3711 9.0505 15.0835C9.55683 14.6203 10.685 13.5208 11.6895 12.0638C12.6892 10.6139 13.5999 8.76181 13.5999 6.80268C13.5999 3.98411 11.3166 1.69922 8.4999 1.69922ZM4.2499 6.80268C4.2499 4.45387 6.15269 2.54979 8.4999 2.54979C10.8471 2.54979 12.7499 4.45387 12.7499 6.80268C12.7499 8.51023 11.9489 10.1898 10.9899 11.5808C10.0506 12.9431 8.99195 13.9825 8.4999 14.4347C8.00786 13.9825 6.94916 12.9431 6.00991 11.5808C5.0509 10.1898 4.2499 8.51023 4.2499 6.80268Z" fill="currentColor"/>
|
|
5
|
-
</svg>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var LocationPinIcon = require("../../icon-location-pin.svg");
|
|
7
|
-
function _interopDefault(e) {
|
|
8
|
-
return e && e.__esModule ? e : {
|
|
9
|
-
default: e
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
var LocationPinIcon__default = /*#__PURE__*/_interopDefault(LocationPinIcon);
|
|
13
|
-
Object.defineProperty(exports, "default", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () {
|
|
16
|
-
return LocationPinIcon__default["default"];
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
Object.keys(LocationPinIcon).forEach(function (k) {
|
|
20
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () {
|
|
23
|
-
return LocationPinIcon[k];
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
//# sourceMappingURL=icon-location-pin.svg.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icon-location-pin.svg.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icon-location-pin.svg.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/lib/assets/ucg-max.png
DELETED
|
Binary file
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import type { NavigationProMenuPrivateProps } from "./ProMenu.types";
|
|
2
|
-
export declare const NavigationProMenu: ({ show, onClose, currentCountryName, handleStorePickerClick, productLineValue, productLineOptions, onProductLineChange, }: NavigationProMenuPrivateProps) => JSX.Element;
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var react = require('react');
|
|
5
|
-
var reactUse = require('react-use');
|
|
6
|
-
require('../../../../contexts/MenuContext/index.js');
|
|
7
|
-
require('../../../../contexts/MenuContext/mapping.js');
|
|
8
|
-
require('../../../../hooks/index.js');
|
|
9
|
-
var useHasTouch = require('../../../../hooks/useHasTouch.js');
|
|
10
|
-
require('../../translations/index.js');
|
|
11
|
-
var ProMenu_styles = require('./ProMenu.styles.js');
|
|
12
|
-
var context = require('../../../../contexts/MenuContext/context.js');
|
|
13
|
-
var useTranslation = require('../../../../hooks/useTranslation.js');
|
|
14
|
-
var en = require('../../translations/en.json.js');
|
|
15
|
-
var constants = require('../../../../types/constants.js');
|
|
16
|
-
"use strict";
|
|
17
|
-
const NavigationProMenu = ({
|
|
18
|
-
show,
|
|
19
|
-
onClose,
|
|
20
|
-
currentCountryName,
|
|
21
|
-
handleStorePickerClick,
|
|
22
|
-
productLineValue,
|
|
23
|
-
productLineOptions,
|
|
24
|
-
onProductLineChange
|
|
25
|
-
}) => {
|
|
26
|
-
const {
|
|
27
|
-
motif
|
|
28
|
-
} = context.useMenu();
|
|
29
|
-
const {
|
|
30
|
-
formatMessage
|
|
31
|
-
} = useTranslation.useTranslation({
|
|
32
|
-
defaultTranslation: en["default"],
|
|
33
|
-
additionalTranslations: {
|
|
34
|
-
[constants.Language.Ja]: () => Promise.resolve().then(function () {
|
|
35
|
-
return require('../../translations/ja.json.js');
|
|
36
|
-
}).then(res => res.default),
|
|
37
|
-
[constants.Language.Ar]: () => Promise.resolve().then(function () {
|
|
38
|
-
return require('../../translations/ar.json.js');
|
|
39
|
-
}).then(res => res.default),
|
|
40
|
-
[constants.Language.De]: () => Promise.resolve().then(function () {
|
|
41
|
-
return require('../../translations/de.json.js');
|
|
42
|
-
}).then(res => res.default),
|
|
43
|
-
[constants.Language.Es]: () => Promise.resolve().then(function () {
|
|
44
|
-
return require('../../translations/es.json.js');
|
|
45
|
-
}).then(res => res.default),
|
|
46
|
-
[constants.Language.El]: () => Promise.resolve().then(function () {
|
|
47
|
-
return require('../../translations/el.json.js');
|
|
48
|
-
}).then(res => res.default),
|
|
49
|
-
[constants.Language.It]: () => Promise.resolve().then(function () {
|
|
50
|
-
return require('../../translations/it.json.js');
|
|
51
|
-
}).then(res => res.default),
|
|
52
|
-
[constants.Language.Pt]: () => Promise.resolve().then(function () {
|
|
53
|
-
return require('../../translations/pt-BR.json.js');
|
|
54
|
-
}).then(res => res.default),
|
|
55
|
-
[constants.Language.Zh]: () => Promise.resolve().then(function () {
|
|
56
|
-
return require('../../translations/zh-Hans.json.js');
|
|
57
|
-
}).then(res => res.default),
|
|
58
|
-
[constants.Language.Fr]: () => Promise.resolve().then(function () {
|
|
59
|
-
return require('../../translations/fr.json.js');
|
|
60
|
-
}).then(res => res.default),
|
|
61
|
-
[constants.Language.Tw]: () => Promise.resolve().then(function () {
|
|
62
|
-
return require('../../translations/zh-Hant-TW.json.js');
|
|
63
|
-
}).then(res => res.default)
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
const wrapRef = react.useRef(null);
|
|
67
|
-
const wrapHover = reactUse.useHoverDirty(wrapRef);
|
|
68
|
-
const hasTouch = useHasTouch.useHasTouch();
|
|
69
|
-
const slideInView = react.useMemo(() => {
|
|
70
|
-
const hasHover = !hasTouch && wrapHover;
|
|
71
|
-
return show || hasHover;
|
|
72
|
-
}, [hasTouch, show, wrapHover]);
|
|
73
|
-
return /* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
74
|
-
children: [/* @__PURE__ */jsxRuntime.jsx(ProMenu_styles.GlassCover, {
|
|
75
|
-
$show: hasTouch && slideInView,
|
|
76
|
-
onClick: onClose
|
|
77
|
-
}), /* @__PURE__ */jsxRuntime.jsx(ProMenu_styles.Wrap, {
|
|
78
|
-
ref: wrapRef,
|
|
79
|
-
motif,
|
|
80
|
-
slideInView,
|
|
81
|
-
children: /* @__PURE__ */jsxRuntime.jsx(ProMenu_styles.MenuWrap, {
|
|
82
|
-
motif,
|
|
83
|
-
children: /* @__PURE__ */jsxRuntime.jsx(ProMenu_styles.MenuWrapInner, {
|
|
84
|
-
children: /* @__PURE__ */jsxRuntime.jsxs(ProMenu_styles.Container, {
|
|
85
|
-
size: "desktop",
|
|
86
|
-
noVerticalMargin: true,
|
|
87
|
-
children: [/* @__PURE__ */jsxRuntime.jsx(ProMenu_styles.ContainerRow, {
|
|
88
|
-
children: productLineOptions.map(option => /* @__PURE__ */jsxRuntime.jsx(ProMenu_styles.LinkButton, {
|
|
89
|
-
motif,
|
|
90
|
-
$active: option.value === productLineValue,
|
|
91
|
-
onClick: () => onProductLineChange?.(option.value),
|
|
92
|
-
children: option.label
|
|
93
|
-
}, option.value))
|
|
94
|
-
}), currentCountryName && /* @__PURE__ */jsxRuntime.jsxs(ProMenu_styles.ContainerRow, {
|
|
95
|
-
children: [currentCountryName, /* @__PURE__ */jsxRuntime.jsx(ProMenu_styles.LinkButton, {
|
|
96
|
-
motif,
|
|
97
|
-
$active: true,
|
|
98
|
-
onClick: handleStorePickerClick,
|
|
99
|
-
children: formatMessage("Change")
|
|
100
|
-
})]
|
|
101
|
-
})]
|
|
102
|
-
})
|
|
103
|
-
})
|
|
104
|
-
})
|
|
105
|
-
})]
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
exports.NavigationProMenu = NavigationProMenu;
|
|
109
|
-
//# sourceMappingURL=ProMenu.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProMenu.js","sources":["../../../../../src/components/Header/Navigation/ProMenu/ProMenu.tsx"],"sourcesContent":["import { useMemo, useRef } from \"react\";\nimport { useHoverDirty } from \"react-use\";\n\nimport { useMenu } from \"../../../../contexts/MenuContext\";\nimport { Language } from \"../../../../contexts/MenuContext/mapping\";\nimport { useTranslation } from \"../../../../hooks\";\nimport { useHasTouch } from \"../../../../hooks/useHasTouch\";\nimport { en as EN_TRANSLATION } from \"../../translations\";\nimport * as S from \"./ProMenu.styles\";\nimport type { NavigationProMenuPrivateProps } from \"./ProMenu.types\";\n\nexport const NavigationProMenu = ({\n show,\n onClose,\n currentCountryName,\n handleStorePickerClick,\n productLineValue,\n productLineOptions,\n onProductLineChange,\n}: NavigationProMenuPrivateProps) => {\n const { motif } = useMenu();\n const { formatMessage } = useTranslation({\n defaultTranslation: EN_TRANSLATION,\n additionalTranslations: {\n [Language.Ja]: () =>\n import(\"../../translations/ja.json\").then((res) => res.default),\n [Language.Ar]: () =>\n import(\"../../translations/ar.json\").then((res) => res.default),\n [Language.De]: () =>\n import(\"../../translations/de.json\").then((res) => res.default),\n [Language.Es]: () =>\n import(\"../../translations/es.json\").then((res) => res.default),\n [Language.El]: () =>\n import(\"../../translations/el.json\").then((res) => res.default),\n [Language.It]: () =>\n import(\"../../translations/it.json\").then((res) => res.default),\n [Language.Pt]: () =>\n import(\"../../translations/pt-BR.json\").then((res) => res.default),\n [Language.Zh]: () =>\n import(\"../../translations/zh-Hans.json\").then((res) => res.default),\n [Language.Fr]: () =>\n import(\"../../translations/fr.json\").then((res) => res.default),\n [Language.Tw]: () =>\n import(\"../../translations/zh-Hant-TW.json\").then((res) => res.default),\n },\n });\n\n // #############################################################################\n // Refs\n // #############################################################################\n const wrapRef = useRef<HTMLDivElement>(null);\n\n // #############################################################################\n // Handle show\n // #############################################################################\n const wrapHover = useHoverDirty(wrapRef);\n const hasTouch = useHasTouch();\n\n const slideInView = useMemo((): boolean => {\n // Ignore hover on touch devices\n const hasHover = !hasTouch && wrapHover;\n\n // Show when parent or wrap has hover\n return show || hasHover;\n }, [hasTouch, show, wrapHover]);\n\n // #############################################################################\n // Render\n // #############################################################################\n return (\n <>\n <S.GlassCover $show={hasTouch && slideInView} onClick={onClose} />\n <S.Wrap ref={wrapRef} motif={motif} slideInView={slideInView}>\n <S.MenuWrap motif={motif}>\n <S.MenuWrapInner>\n <S.Container size=\"desktop\" noVerticalMargin>\n {/* Product line */}\n <S.ContainerRow>\n {productLineOptions.map((option) => (\n <S.LinkButton\n key={option.value}\n motif={motif}\n $active={option.value === productLineValue}\n onClick={() => onProductLineChange?.(option.value)}\n >\n {option.label}\n </S.LinkButton>\n ))}\n </S.ContainerRow>\n\n {/* Country */}\n {currentCountryName && (\n <S.ContainerRow>\n {currentCountryName}\n <S.LinkButton\n motif={motif}\n $active\n onClick={handleStorePickerClick}\n >\n {formatMessage(\"Change\")}\n </S.LinkButton>\n </S.ContainerRow>\n )}\n </S.Container>\n </S.MenuWrapInner>\n </S.MenuWrap>\n </S.Wrap>\n </>\n );\n};\n"],"names":["NavigationProMenu","show","onClose","currentCountryName","handleStorePickerClick","productLineValue","productLineOptions","onProductLineChange","motif","useMenu","formatMessage","useTranslation","defaultTranslation","EN_TRANSLATION","additionalTranslations","Language","Ja","Promise","then","res","default","Ar","De","Es","El","It","Pt","Zh","Fr","Tw","wrapRef","useRef","wrapHover","useHoverDirty","hasTouch","useHasTouch","slideInView","useMemo","hasHover","jsxs","Fragment","children","jsx","S.GlassCover","GlassCover","$show","onClick","S.Wrap","Wrap","ref","S.MenuWrap","MenuWrap","S.MenuWrapInner","MenuWrapInner","S.Container","size","noVerticalMargin","S.ContainerRow","ContainerRow","map","option","S.LinkButton","LinkButton","$active","value","label"],"mappings":";;;;;;;;;;;;;;;;AAWO,MAAMA,oBAAoBA,CAAC;EAChCC,IAAA;EACAC,OAAA;EACAC,kBAAA;EACAC,sBAAA;EACAC,gBAAA;EACAC,kBAAA;EACAC;AACF,CAAqC,KAAA;EAC7B,MAAA;IAAEC;GAAM,GAAIC,OAAAA,CAAAA,OAAQ,EAAA;EACpB,MAAA;IAAEC;EAAc,CAAA,GAAIC,6BAAe,CAAA;IACvCC,kBAAoB,EAAAC,EAAA,CAAA,SAAA,CAAA;IACpBC,sBAAwB,EAAA;MACtB,CAACC,SAAA,CAAAA,QAAA,CAASC,EAAE,GAAG,MACbC;uBAAO,+BAA4B,CAAA;MAAA,CAAA,CAAA,CAAEC,IAAK,CAACC,GAAQ,IAAAA,GAAA,CAAIC,OAAO,CAAA;MAChE,CAACL,SAAA,CAAAA,QAAA,CAASM,EAAE,GAAG,MACbJ;uBAAO,+BAA4B,CAAA;MAAA,CAAA,CAAA,CAAEC,IAAK,CAACC,GAAQ,IAAAA,GAAA,CAAIC,OAAO,CAAA;MAChE,CAACL,SAAA,CAAAA,QAAA,CAASO,EAAE,GAAG,MACbL;uBAAO,+BAA4B,CAAA;MAAA,CAAA,CAAA,CAAEC,IAAK,CAACC,GAAQ,IAAAA,GAAA,CA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CAAA,EALHL,MAAO,CAAAI,KAOf,CAAA;aACH,CAAA,EAGC7D,kBACC,mBAAAoC,UAAA,CAAAA,IAAA,CAACkB,2BAAE,EAAF;cACEhB,QAAA,EAAA,CAAAtC,kBAAA,EAAA,eACDuC,UAAA,CAAAA,GAAA,CAACmB,cAAE,CAAAC,UAAA,EAAF;gBACCtD,KAAA;gBACAuD,OAAO,EAAA,IAAA;gBACPjB,OAAS,EAAA1C,sBAAA;gBAERqC,wBAAc,QAAQ;cAAA,CACzB,CAAA;aACF,CAAA;WAEJ;QAAA,CACF;MACF,CAAA;KACF,CAAA;EACF,CAAA,CAAA;AAEJ,CAAA;"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useRef, useMemo } from 'react';
|
|
3
|
-
import { useHoverDirty } from 'react-use';
|
|
4
|
-
import '../../../../contexts/MenuContext/index.mjs';
|
|
5
|
-
import '../../../../contexts/MenuContext/mapping.mjs';
|
|
6
|
-
import '../../../../hooks/index.mjs';
|
|
7
|
-
import { useHasTouch } from '../../../../hooks/useHasTouch.mjs';
|
|
8
|
-
import '../../translations/index.mjs';
|
|
9
|
-
import { GlassCover, Wrap, MenuWrap, MenuWrapInner, Container, ContainerRow, LinkButton } from './ProMenu.styles.mjs';
|
|
10
|
-
import { useMenu } from '../../../../contexts/MenuContext/context.mjs';
|
|
11
|
-
import { useTranslation } from '../../../../hooks/useTranslation.mjs';
|
|
12
|
-
import EN_TRANSLATION from '../../translations/en.json.mjs';
|
|
13
|
-
import { Language } from '../../../../types/constants.mjs';
|
|
14
|
-
"use strict";
|
|
15
|
-
const NavigationProMenu = ({
|
|
16
|
-
show,
|
|
17
|
-
onClose,
|
|
18
|
-
currentCountryName,
|
|
19
|
-
handleStorePickerClick,
|
|
20
|
-
productLineValue,
|
|
21
|
-
productLineOptions,
|
|
22
|
-
onProductLineChange
|
|
23
|
-
}) => {
|
|
24
|
-
const {
|
|
25
|
-
motif
|
|
26
|
-
} = useMenu();
|
|
27
|
-
const {
|
|
28
|
-
formatMessage
|
|
29
|
-
} = useTranslation({
|
|
30
|
-
defaultTranslation: EN_TRANSLATION,
|
|
31
|
-
additionalTranslations: {
|
|
32
|
-
[Language.Ja]: () => import('../../translations/ja.json.mjs').then(res => res.default),
|
|
33
|
-
[Language.Ar]: () => import('../../translations/ar.json.mjs').then(res => res.default),
|
|
34
|
-
[Language.De]: () => import('../../translations/de.json.mjs').then(res => res.default),
|
|
35
|
-
[Language.Es]: () => import('../../translations/es.json.mjs').then(res => res.default),
|
|
36
|
-
[Language.El]: () => import('../../translations/el.json.mjs').then(res => res.default),
|
|
37
|
-
[Language.It]: () => import('../../translations/it.json.mjs').then(res => res.default),
|
|
38
|
-
[Language.Pt]: () => import('../../translations/pt-BR.json.mjs').then(res => res.default),
|
|
39
|
-
[Language.Zh]: () => import('../../translations/zh-Hans.json.mjs').then(res => res.default),
|
|
40
|
-
[Language.Fr]: () => import('../../translations/fr.json.mjs').then(res => res.default),
|
|
41
|
-
[Language.Tw]: () => import('../../translations/zh-Hant-TW.json.mjs').then(res => res.default)
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
const wrapRef = useRef(null);
|
|
45
|
-
const wrapHover = useHoverDirty(wrapRef);
|
|
46
|
-
const hasTouch = useHasTouch();
|
|
47
|
-
const slideInView = useMemo(() => {
|
|
48
|
-
const hasHover = !hasTouch && wrapHover;
|
|
49
|
-
return show || hasHover;
|
|
50
|
-
}, [hasTouch, show, wrapHover]);
|
|
51
|
-
return /* @__PURE__ */jsxs(Fragment, {
|
|
52
|
-
children: [/* @__PURE__ */jsx(GlassCover, {
|
|
53
|
-
$show: hasTouch && slideInView,
|
|
54
|
-
onClick: onClose
|
|
55
|
-
}), /* @__PURE__ */jsx(Wrap, {
|
|
56
|
-
ref: wrapRef,
|
|
57
|
-
motif,
|
|
58
|
-
slideInView,
|
|
59
|
-
children: /* @__PURE__ */jsx(MenuWrap, {
|
|
60
|
-
motif,
|
|
61
|
-
children: /* @__PURE__ */jsx(MenuWrapInner, {
|
|
62
|
-
children: /* @__PURE__ */jsxs(Container, {
|
|
63
|
-
size: "desktop",
|
|
64
|
-
noVerticalMargin: true,
|
|
65
|
-
children: [/* @__PURE__ */jsx(ContainerRow, {
|
|
66
|
-
children: productLineOptions.map(option => /* @__PURE__ */jsx(LinkButton, {
|
|
67
|
-
motif,
|
|
68
|
-
$active: option.value === productLineValue,
|
|
69
|
-
onClick: () => onProductLineChange?.(option.value),
|
|
70
|
-
children: option.label
|
|
71
|
-
}, option.value))
|
|
72
|
-
}), currentCountryName && /* @__PURE__ */jsxs(ContainerRow, {
|
|
73
|
-
children: [currentCountryName, /* @__PURE__ */jsx(LinkButton, {
|
|
74
|
-
motif,
|
|
75
|
-
$active: true,
|
|
76
|
-
onClick: handleStorePickerClick,
|
|
77
|
-
children: formatMessage("Change")
|
|
78
|
-
})]
|
|
79
|
-
})]
|
|
80
|
-
})
|
|
81
|
-
})
|
|
82
|
-
})
|
|
83
|
-
})]
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
export { NavigationProMenu };
|
|
87
|
-
//# sourceMappingURL=ProMenu.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProMenu.mjs","sources":["../../../../../src/components/Header/Navigation/ProMenu/ProMenu.tsx"],"sourcesContent":["import { useMemo, useRef } from \"react\";\nimport { useHoverDirty } from \"react-use\";\n\nimport { useMenu } from \"../../../../contexts/MenuContext\";\nimport { Language } from \"../../../../contexts/MenuContext/mapping\";\nimport { useTranslation } from \"../../../../hooks\";\nimport { useHasTouch } from \"../../../../hooks/useHasTouch\";\nimport { en as EN_TRANSLATION } from \"../../translations\";\nimport * as S from \"./ProMenu.styles\";\nimport type { NavigationProMenuPrivateProps } from \"./ProMenu.types\";\n\nexport const NavigationProMenu = ({\n show,\n onClose,\n currentCountryName,\n handleStorePickerClick,\n productLineValue,\n productLineOptions,\n onProductLineChange,\n}: NavigationProMenuPrivateProps) => {\n const { motif } = useMenu();\n const { formatMessage } = useTranslation({\n defaultTranslation: EN_TRANSLATION,\n additionalTranslations: {\n [Language.Ja]: () =>\n import(\"../../translations/ja.json\").then((res) => res.default),\n [Language.Ar]: () =>\n import(\"../../translations/ar.json\").then((res) => res.default),\n [Language.De]: () =>\n import(\"../../translations/de.json\").then((res) => res.default),\n [Language.Es]: () =>\n import(\"../../translations/es.json\").then((res) => res.default),\n [Language.El]: () =>\n import(\"../../translations/el.json\").then((res) => res.default),\n [Language.It]: () =>\n import(\"../../translations/it.json\").then((res) => res.default),\n [Language.Pt]: () =>\n import(\"../../translations/pt-BR.json\").then((res) => res.default),\n [Language.Zh]: () =>\n import(\"../../translations/zh-Hans.json\").then((res) => res.default),\n [Language.Fr]: () =>\n import(\"../../translations/fr.json\").then((res) => res.default),\n [Language.Tw]: () =>\n import(\"../../translations/zh-Hant-TW.json\").then((res) => res.default),\n },\n });\n\n // #############################################################################\n // Refs\n // #############################################################################\n const wrapRef = useRef<HTMLDivElement>(null);\n\n // #############################################################################\n // Handle show\n // #############################################################################\n const wrapHover = useHoverDirty(wrapRef);\n const hasTouch = useHasTouch();\n\n const slideInView = useMemo((): boolean => {\n // Ignore hover on touch devices\n const hasHover = !hasTouch && wrapHover;\n\n // Show when parent or wrap has hover\n return show || hasHover;\n }, [hasTouch, show, wrapHover]);\n\n // #############################################################################\n // Render\n // #############################################################################\n return (\n <>\n <S.GlassCover $show={hasTouch && slideInView} onClick={onClose} />\n <S.Wrap ref={wrapRef} motif={motif} slideInView={slideInView}>\n <S.MenuWrap motif={motif}>\n <S.MenuWrapInner>\n <S.Container size=\"desktop\" noVerticalMargin>\n {/* Product line */}\n <S.ContainerRow>\n {productLineOptions.map((option) => (\n <S.LinkButton\n key={option.value}\n motif={motif}\n $active={option.value === productLineValue}\n onClick={() => onProductLineChange?.(option.value)}\n >\n {option.label}\n </S.LinkButton>\n ))}\n </S.ContainerRow>\n\n {/* Country */}\n {currentCountryName && (\n <S.ContainerRow>\n {currentCountryName}\n <S.LinkButton\n motif={motif}\n $active\n onClick={handleStorePickerClick}\n >\n {formatMessage(\"Change\")}\n </S.LinkButton>\n </S.ContainerRow>\n )}\n </S.Container>\n </S.MenuWrapInner>\n </S.MenuWrap>\n </S.Wrap>\n </>\n );\n};\n"],"names":["NavigationProMenu","show","onClose","currentCountryName","handleStorePickerClick","productLineValue","productLineOptions","onProductLineChange","motif","useMenu","formatMessage","useTranslation","defaultTranslation","EN_TRANSLATION","additionalTranslations","Language","Ja","then","res","default","Ar","De","Es","El","It","Pt","Zh","Fr","Tw","wrapRef","useRef","wrapHover","useHoverDirty","hasTouch","useHasTouch","slideInView","useMemo","hasHover","jsxs","Fragment","children","jsx","S.GlassCover","$show","onClick","S.Wrap","ref","S.MenuWrap","S.MenuWrapInner","S.Container","size","noVerticalMargin","S.ContainerRow","map","option","S.LinkButton","$active","value","label"],"mappings":";;;;;;;;;;;;;;AAWO,MAAMA,oBAAoBA,CAAC;EAChCC,IAAA;EACAC,OAAA;EACAC,kBAAA;EACAC,sBAAA;EACAC,gBAAA;EACAC,kBAAA;EACAC;AACF,CAAqC,KAAA;EAC7B,MAAA;IAAEC;GAAM,GAAIC,OAAQ,EAAA;EACpB,MAAA;IAAEC;EAAc,CAAA,GAAIC,cAAe,CAAA;IACvCC,kBAAoB,EAAAC,cAAA;IACpBC,sBAAwB,EAAA;MACtB,CAACC,QAAA,CAASC,EAAE,GAAG,MACb,OAAO,gCAA4B,CAAA,CAAEC,IAAK,CAACC,GAAQ,IAAAA,GAAA,CAAIC,OAAO,CAAA;MAChE,CAACJ,QAAA,CAASK,EAAE,GAAG,MACb,OAAO,gCAA4B,CAAA,CAAEH,IAAK,CAACC,GAAQ,IAAAA,GAAA,CAAIC,OAAO,CAAA;MAChE,CAACJ,QAAA,CAASM,EAAE,GAAG,MACb,OAAO,gCAA4B,CAAA,CAAEJ,IAAK,CAACC,GAAQ,IAAAA,GAAA,CAA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_MS = 250;
|
|
3
|
-
export declare const GLASS_COVER_Z_INDEX: number;
|
|
4
|
-
export declare const MenuWrapInner: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
-
export declare const MenuWrap: import("styled-components").StyledComponent<"nav", import("styled-components").DefaultTheme, {
|
|
6
|
-
motif: Motif;
|
|
7
|
-
}, never>;
|
|
8
|
-
export declare const Wrap: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
9
|
-
motif: Motif;
|
|
10
|
-
slideInView: boolean;
|
|
11
|
-
}, never>;
|
|
12
|
-
export declare const Container: import("styled-components").StyledComponent<import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("../../../Container/Container.types").ContainerProps & import("react").RefAttributes<HTMLDivElement>>>, import("styled-components").DefaultTheme, {}, never>;
|
|
13
|
-
export declare const ContainerRow: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
14
|
-
export declare const LinkButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../../Button/Button.types").ButtonProps & {
|
|
15
|
-
children?: import("react").ReactNode;
|
|
16
|
-
} & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement | null>>, import("styled-components").DefaultTheme, {
|
|
17
|
-
variant: "link";
|
|
18
|
-
} & {
|
|
19
|
-
$active?: boolean;
|
|
20
|
-
motif: Motif;
|
|
21
|
-
}, "variant">;
|
|
22
|
-
export declare const GlassCover: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
23
|
-
$show?: boolean;
|
|
24
|
-
}, never>;
|