@ubnt/store.core 9.40.1-new-design → 9.41.0-beta.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 +345 -42
- package/lib/_virtual/_virtual_multi-entry.js +15 -2
- package/lib/_virtual/_virtual_multi-entry.js.map +1 -1
- package/lib/_virtual/_virtual_multi-entry.mjs +2 -0
- package/lib/_virtual/_virtual_multi-entry.mjs.map +1 -1
- package/lib/apis/smartcat.js.map +1 -1
- package/lib/apis/smartcat.mjs.map +1 -1
- package/lib/assets/apple.svg +8 -0
- package/lib/assets/close2.svg +2 -3
- package/lib/assets/close3.svg +3 -2
- package/lib/assets/contact.svg +5 -0
- package/lib/assets/crestron.svg +3 -0
- package/lib/assets/door-hub-mini.jpg +0 -0
- package/lib/assets/door-hub.jpg +0 -0
- package/lib/assets/g2-reader-pro.jpg +0 -0
- package/lib/assets/g2-reader.jpg +0 -0
- package/lib/assets/g3-reader-flex.jpg +0 -0
- package/lib/assets/g3-reader-pro.jpg +0 -0
- package/lib/assets/g3-reader.jpg +0 -0
- package/lib/assets/g3-starter-kit-pro.jpg +0 -0
- package/lib/assets/g3-starter-kit.jpg +0 -0
- package/lib/assets/icons/menu/icon-globe.svg.js +27 -0
- package/lib/assets/icons/menu/icon-globe.svg.js.map +1 -0
- package/lib/assets/icons/menu/icon-globe.svg.mjs +3 -0
- package/lib/assets/icons/menu/icon-globe.svg.mjs.map +1 -0
- package/lib/assets/intercom.jpg +0 -0
- package/lib/assets/logoUnifi.svg +2 -10
- package/lib/assets/pause.svg +3 -3
- package/lib/assets/pause2.svg +3 -3
- package/lib/assets/reader-lite.jpg +0 -0
- package/lib/components/Accordion/Accordion.js.map +1 -1
- package/lib/components/Accordion/Accordion.mjs.map +1 -1
- package/lib/components/Accordion/Accordion.styles.js.map +1 -1
- package/lib/components/Accordion/Accordion.styles.mjs.map +1 -1
- package/lib/components/Avatar/Avatar.js.map +1 -1
- package/lib/components/Avatar/Avatar.mjs.map +1 -1
- package/lib/components/Banner/Banner.styles.js.map +1 -1
- package/lib/components/Banner/Banner.styles.mjs.map +1 -1
- package/lib/components/Button/Button.js +0 -7
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Button/Button.mjs +1 -8
- package/lib/components/Button/Button.mjs.map +1 -1
- package/lib/components/Button/CartButton.d.ts +1 -3
- package/lib/components/Button/CartButton.js +4 -9
- package/lib/components/Button/CartButton.js.map +1 -1
- package/lib/components/Button/CartButton.mjs +4 -8
- package/lib/components/Button/CartButton.mjs.map +1 -1
- package/lib/components/ButtonGroup/ButtonGroup.js.map +1 -1
- package/lib/components/ButtonGroup/ButtonGroup.mjs.map +1 -1
- package/lib/components/ButtonGroup/ButtonGroup.styles.js.map +1 -1
- package/lib/components/ButtonGroup/ButtonGroup.styles.mjs.map +1 -1
- package/lib/components/ButtonGroupBasic/ButtonGroupBasic.js.map +1 -1
- package/lib/components/ButtonGroupBasic/ButtonGroupBasic.mjs.map +1 -1
- package/lib/components/CardSection/CardSection.styles.d.ts +1 -1
- package/lib/components/CategoryTabs/CategoryTabs.styles.d.ts +2 -4
- package/lib/components/CategoryTabs/CategoryTabs.styles.js +5 -8
- package/lib/components/CategoryTabs/CategoryTabs.styles.js.map +1 -1
- package/lib/components/CategoryTabs/CategoryTabs.styles.mjs +6 -7
- package/lib/components/CategoryTabs/CategoryTabs.styles.mjs.map +1 -1
- package/lib/components/CloserLookSection/CloserLookSection.js.map +1 -1
- package/lib/components/CloserLookSection/CloserLookSection.mjs.map +1 -1
- package/lib/components/CloserLookSection/CloserLookSection.styles.js.map +1 -1
- package/lib/components/CloserLookSection/CloserLookSection.styles.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/Container/Container.styles.js.map +1 -1
- package/lib/components/Container/Container.styles.mjs.map +1 -1
- package/lib/components/CustomImage/CustomImage.js +1 -1
- package/lib/components/CustomImage/CustomImage.js.map +1 -1
- package/lib/components/CustomImage/CustomImage.mjs +1 -1
- package/lib/components/CustomImage/CustomImage.mjs.map +1 -1
- package/lib/components/CustomImage/CustomImage.styles.js.map +1 -1
- package/lib/components/CustomImage/CustomImage.styles.mjs.map +1 -1
- package/lib/components/Explore/Explore.js.map +1 -1
- package/lib/components/Explore/Explore.mjs.map +1 -1
- package/lib/components/Explore/ExploreData.js.map +1 -1
- package/lib/components/Explore/ExploreData.mjs.map +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.js +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.js.map +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.mjs +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.mjs.map +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.styles.js.map +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.styles.mjs.map +1 -1
- package/lib/components/FeaturesSection_deprecated/assets/close.svg.js +1 -1
- package/lib/components/FeaturesSection_deprecated/assets/close.svg.mjs +2 -2
- package/lib/components/Footer/Footer.js +1 -1
- package/lib/components/Footer/Footer.js.map +1 -1
- package/lib/components/Footer/Footer.mjs +1 -1
- package/lib/components/Footer/Footer.mjs.map +1 -1
- package/lib/components/Footer/Footer.styles.js.map +1 -1
- package/lib/components/Footer/Footer.styles.mjs.map +1 -1
- package/lib/components/Gallery/Gallery.js.map +1 -1
- package/lib/components/Gallery/Gallery.mjs.map +1 -1
- package/lib/components/Gallery/Gallery.styles.js.map +1 -1
- package/lib/components/Gallery/Gallery.styles.mjs.map +1 -1
- package/lib/components/Gallery/GalleryThumbnails/GalleryThumbnails.js.map +1 -1
- package/lib/components/Gallery/GalleryThumbnails/GalleryThumbnails.mjs.map +1 -1
- package/lib/components/Gallery/GalleryThumbnails/GalleryThumbnails.styles.js.map +1 -1
- package/lib/components/Gallery/GalleryThumbnails/GalleryThumbnails.styles.mjs.map +1 -1
- package/lib/components/GradientButton/GradientButton.styles.js.map +1 -1
- package/lib/components/GradientButton/GradientButton.styles.mjs.map +1 -1
- package/lib/components/GridGallery/GridGallery.js.map +1 -1
- package/lib/components/GridGallery/GridGallery.mjs.map +1 -1
- package/lib/components/Header/AccountFrame/AccountFrame.js.map +1 -1
- package/lib/components/Header/AccountFrame/AccountFrame.mjs.map +1 -1
- package/lib/components/Header/AccountFrame/AccountFrame.styles.js.map +1 -1
- package/lib/components/Header/AccountFrame/AccountFrame.styles.mjs.map +1 -1
- package/lib/components/Header/AccountMenu/AccountMenu.js +1 -11
- package/lib/components/Header/AccountMenu/AccountMenu.js.map +1 -1
- package/lib/components/Header/AccountMenu/AccountMenu.mjs +3 -13
- package/lib/components/Header/AccountMenu/AccountMenu.mjs.map +1 -1
- package/lib/components/Header/AccountMenu/megaphone.http.service.js.map +1 -1
- package/lib/components/Header/AccountMenu/megaphone.http.service.mjs.map +1 -1
- package/lib/components/Header/CartModalV2/Item/Item.js.map +1 -1
- package/lib/components/Header/CartModalV2/Item/Item.mjs.map +1 -1
- package/lib/components/Header/CartModalV2/Item/Item.styles.d.ts +1 -1
- package/lib/components/Header/Header.js +6 -6
- package/lib/components/Header/Header.js.map +1 -1
- package/lib/components/Header/Header.mjs +6 -6
- package/lib/components/Header/Header.mjs.map +1 -1
- package/lib/components/Header/Header.styles.d.ts +12 -7
- package/lib/components/Header/Header.styles.js +32 -10
- package/lib/components/Header/Header.styles.js.map +1 -1
- package/lib/components/Header/Header.styles.mjs +31 -10
- package/lib/components/Header/Header.styles.mjs.map +1 -1
- package/lib/components/Header/Header.types.d.ts +5 -29
- 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/IsolatedHeader.d.ts +0 -1
- package/lib/components/Header/IsolatedHeader.js +44 -44
- package/lib/components/Header/IsolatedHeader.js.map +1 -1
- package/lib/components/Header/IsolatedHeader.mjs +46 -47
- package/lib/components/Header/IsolatedHeader.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/LanguageFrame.styles.js.map +1 -1
- package/lib/components/Header/LanguageFrame/LanguageFrame.styles.mjs.map +1 -1
- package/lib/components/Header/MenuItem/MenuItem.styles.d.ts +1 -1
- package/lib/components/Header/MenuItem/MenuItem.styles.js +3 -3
- package/lib/components/Header/MenuItem/MenuItem.styles.js.map +1 -1
- package/lib/components/Header/MenuItem/MenuItem.styles.mjs +3 -3
- package/lib/components/Header/MenuItem/MenuItem.styles.mjs.map +1 -1
- package/lib/components/Header/MenuItem/MenuItem.types.d.ts +0 -1
- package/lib/components/Header/Navigation/Carousel/Carousel.js.map +1 -1
- package/lib/components/Header/Navigation/Carousel/Carousel.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/MobileMenu/MobileMenu.styles.js.map +1 -1
- package/lib/components/Header/Navigation/MobileMenu/MobileMenu.styles.mjs.map +1 -1
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.d.ts +1 -1
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.js +103 -110
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.js.map +1 -1
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.mjs +104 -111
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.mjs.map +1 -1
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.styles.d.ts +0 -9
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.styles.js +1 -15
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.styles.js.map +1 -1
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.styles.mjs +2 -13
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.styles.mjs.map +1 -1
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.types.d.ts +6 -12
- package/lib/components/Header/ProHeader/ProHeader.d.ts +5 -9
- package/lib/components/Header/ProHeader/ProHeader.js +168 -249
- package/lib/components/Header/ProHeader/ProHeader.js.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.mjs +170 -250
- package/lib/components/Header/ProHeader/ProHeader.mjs.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.styles.d.ts +25 -30
- package/lib/components/Header/ProHeader/ProHeader.styles.js +66 -119
- package/lib/components/Header/ProHeader/ProHeader.styles.js.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.styles.mjs +65 -112
- package/lib/components/Header/ProHeader/ProHeader.styles.mjs.map +1 -1
- package/lib/components/Header/translations/ar.json.js +1 -4
- package/lib/components/Header/translations/ar.json.js.map +1 -1
- package/lib/components/Header/translations/ar.json.mjs +2 -4
- package/lib/components/Header/translations/ar.json.mjs.map +1 -1
- package/lib/components/Header/translations/de.json.js +1 -4
- package/lib/components/Header/translations/de.json.js.map +1 -1
- package/lib/components/Header/translations/de.json.mjs +2 -4
- package/lib/components/Header/translations/de.json.mjs.map +1 -1
- package/lib/components/Header/translations/el.json.js +1 -4
- package/lib/components/Header/translations/el.json.js.map +1 -1
- package/lib/components/Header/translations/el.json.mjs +2 -4
- package/lib/components/Header/translations/el.json.mjs.map +1 -1
- package/lib/components/Header/translations/en.json.js +1 -7
- package/lib/components/Header/translations/en.json.js.map +1 -1
- package/lib/components/Header/translations/en.json.mjs +2 -6
- package/lib/components/Header/translations/en.json.mjs.map +1 -1
- package/lib/components/Header/translations/es.json.js +1 -4
- package/lib/components/Header/translations/es.json.js.map +1 -1
- package/lib/components/Header/translations/es.json.mjs +2 -4
- package/lib/components/Header/translations/es.json.mjs.map +1 -1
- package/lib/components/Header/translations/fr.json.js +1 -4
- package/lib/components/Header/translations/fr.json.js.map +1 -1
- package/lib/components/Header/translations/fr.json.mjs +2 -4
- package/lib/components/Header/translations/fr.json.mjs.map +1 -1
- package/lib/components/Header/translations/it.json.js +1 -4
- package/lib/components/Header/translations/it.json.js.map +1 -1
- package/lib/components/Header/translations/it.json.mjs +2 -4
- package/lib/components/Header/translations/it.json.mjs.map +1 -1
- package/lib/components/Header/translations/ja.json.js +1 -4
- package/lib/components/Header/translations/ja.json.js.map +1 -1
- package/lib/components/Header/translations/ja.json.mjs +2 -4
- package/lib/components/Header/translations/ja.json.mjs.map +1 -1
- package/lib/components/Header/translations/pt-BR.json.js +1 -4
- package/lib/components/Header/translations/pt-BR.json.js.map +1 -1
- package/lib/components/Header/translations/pt-BR.json.mjs +2 -4
- package/lib/components/Header/translations/pt-BR.json.mjs.map +1 -1
- package/lib/components/Header/translations/zh-Hans.json.js +1 -4
- package/lib/components/Header/translations/zh-Hans.json.js.map +1 -1
- package/lib/components/Header/translations/zh-Hans.json.mjs +2 -4
- package/lib/components/Header/translations/zh-Hans.json.mjs.map +1 -1
- package/lib/components/Header/translations/zh-Hant-TW.json.js +1 -4
- package/lib/components/Header/translations/zh-Hant-TW.json.js.map +1 -1
- package/lib/components/Header/translations/zh-Hant-TW.json.mjs +2 -4
- package/lib/components/Header/translations/zh-Hant-TW.json.mjs.map +1 -1
- package/lib/components/Hero/Hero.js.map +1 -1
- package/lib/components/Hero/Hero.mjs.map +1 -1
- package/lib/components/Hero/Hero.styles.d.ts +2 -2
- package/lib/components/Hero/Hero.styles.js.map +1 -1
- package/lib/components/Hero/Hero.styles.mjs.map +1 -1
- package/lib/components/HeroFadeGallery/HeroFadeGallery.styles.d.ts +1 -1
- package/lib/components/HowToUseSection/HowToUseSection.styles.d.ts +2 -2
- package/lib/components/ImageCarousel/ImageCarousel.styles.js.map +1 -1
- package/lib/components/ImageCarousel/ImageCarousel.styles.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/LandingPage/Cards/Cards.styles.js.map +1 -1
- package/lib/components/LandingPage/Cards/Cards.styles.mjs.map +1 -1
- package/lib/components/LandingPage/LandingPage.js.map +1 -1
- package/lib/components/LandingPage/LandingPage.mjs.map +1 -1
- package/lib/components/LandingPagePro/LandingPagePro.js.map +1 -1
- package/lib/components/LandingPagePro/LandingPagePro.mjs.map +1 -1
- package/lib/components/LandingPagePro/LandingPagePro.styles.d.ts +1 -1
- package/lib/components/LandingPageSearch/Modal/Modal.js.map +1 -1
- package/lib/components/LandingPageSearch/Modal/Modal.mjs.map +1 -1
- package/lib/components/LandingPageSidebar/LandingPageSidebar.js.map +1 -1
- package/lib/components/LandingPageSidebar/LandingPageSidebar.mjs.map +1 -1
- package/lib/components/LandingPageSidebar/LandingPageSidebar.styles.js.map +1 -1
- package/lib/components/LandingPageSidebar/LandingPageSidebar.styles.mjs.map +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/LoaderDots/LoaderDots.d.ts +1 -1
- package/lib/components/LoaderDots/LoaderDots.js +1 -3
- package/lib/components/LoaderDots/LoaderDots.js.map +1 -1
- package/lib/components/LoaderDots/LoaderDots.mjs +1 -3
- package/lib/components/LoaderDots/LoaderDots.mjs.map +1 -1
- package/lib/components/LoaderDots/LoaderDots.styles.d.ts +1 -2
- package/lib/components/LoaderDots/LoaderDots.styles.js +1 -11
- package/lib/components/LoaderDots/LoaderDots.styles.js.map +1 -1
- package/lib/components/LoaderDots/LoaderDots.styles.mjs +1 -11
- package/lib/components/LoaderDots/LoaderDots.styles.mjs.map +1 -1
- package/lib/components/LoaderDots/LoaderDots.types.d.ts +0 -2
- package/lib/components/MeetUniFiVideoPlayer/MeetUniFiVideoPlayer.helpers.js.map +1 -1
- package/lib/components/MeetUniFiVideoPlayer/MeetUniFiVideoPlayer.helpers.mjs.map +1 -1
- package/lib/components/MeetUniFiVideoPlayer/MeetUniFiVideoPlayer.styles.d.ts +1 -1
- package/lib/components/MicrositeExploreCards/MicrositeExploreCards.styles.js.map +1 -1
- package/lib/components/MicrositeExploreCards/MicrositeExploreCards.styles.mjs.map +1 -1
- package/lib/components/MicrositeFeatureList/MicrositeFeatureList.styles.js.map +1 -1
- package/lib/components/MicrositeFeatureList/MicrositeFeatureList.styles.mjs.map +1 -1
- package/lib/components/MicrositeHero/MicrositeHero.js.map +1 -1
- package/lib/components/MicrositeHero/MicrositeHero.mjs.map +1 -1
- package/lib/components/MicrositeHero/MicrositeHero.styles.js.map +1 -1
- package/lib/components/MicrositeHero/MicrositeHero.styles.mjs.map +1 -1
- package/lib/components/MicrositeMediaGrid/MicrositeMediaGrid.styles.js.map +1 -1
- package/lib/components/MicrositeMediaGrid/MicrositeMediaGrid.styles.mjs.map +1 -1
- package/lib/components/MicrositeProductGrid/MicrositeProductGrid.styles.js.map +1 -1
- package/lib/components/MicrositeProductGrid/MicrositeProductGrid.styles.mjs.map +1 -1
- package/lib/components/MicrositeProductLearnMoreBlock/MicrositeProductLearnMoreBlockWrap.js.map +1 -1
- package/lib/components/MicrositeProductLearnMoreBlock/MicrositeProductLearnMoreBlockWrap.mjs.map +1 -1
- package/lib/components/MicrositeSectionWrap/MicrositeSectionWrap.styles.d.ts +1 -1
- package/lib/components/MicrositeVideoSlideshow/MicrositeVideoSlideshow.js +1 -1
- package/lib/components/MicrositeVideoSlideshow/MicrositeVideoSlideshow.mjs +1 -1
- package/lib/components/MicrositeVideoSlideshow/assets/pause.svg.js +1 -1
- package/lib/components/MicrositeVideoSlideshow/assets/pause.svg.mjs +2 -2
- package/lib/components/Microsites/MicrositeProductPage.js.map +1 -1
- package/lib/components/Microsites/MicrositeProductPage.mjs.map +1 -1
- package/lib/components/MobileModal/MobileModal.styles.js.map +1 -1
- package/lib/components/MobileModal/MobileModal.styles.mjs.map +1 -1
- package/lib/components/ModelCompareV3/HeaderShadow.js.map +1 -1
- package/lib/components/ModelCompareV3/HeaderShadow.mjs.map +1 -1
- package/lib/components/ModelCompareV3/ModelCompareV3.js.map +1 -1
- package/lib/components/ModelCompareV3/ModelCompareV3.mjs.map +1 -1
- package/lib/components/ModelCompareV3/ModelCompareV3.styles.js.map +1 -1
- package/lib/components/ModelCompareV3/ModelCompareV3.styles.mjs.map +1 -1
- package/lib/components/ModelCompareV3/ModelCompareV3.types.d.ts +13 -2
- package/lib/components/ModelCompareV3/assets/DoorAccess/door-hub-mini.jpg.js +27 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/door-hub-mini.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/door-hub-mini.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/door-hub-mini.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/{g2Reader.jpg.js → door-hub.jpg.js} +2 -2
- package/lib/components/ModelCompareV3/assets/DoorAccess/door-hub.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/door-hub.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/door-hub.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g2-reader-pro.jpg.js +27 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g2-reader-pro.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g2-reader-pro.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g2-reader-pro.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/{AccessHub.jpg.js → g2-reader.jpg.js} +2 -2
- package/lib/components/ModelCompareV3/assets/DoorAccess/g2-reader.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g2-reader.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g2-reader.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-reader-flex.jpg.js +27 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-reader-flex.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-reader-flex.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-reader-flex.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-reader-pro.jpg.js +27 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-reader-pro.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-reader-pro.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-reader-pro.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/{readerLite.jpg.js → g3-reader.jpg.js} +2 -2
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-reader.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-reader.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-reader.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-starter-kit-pro.jpg.js +27 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-starter-kit-pro.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-starter-kit-pro.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-starter-kit-pro.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-starter-kit.jpg.js +27 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-starter-kit.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-starter-kit.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/g3-starter-kit.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/{g2ReaderPro.jpg.js → intercom.jpg.js} +2 -2
- package/lib/components/ModelCompareV3/assets/DoorAccess/intercom.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/intercom.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/intercom.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/reader-lite.jpg.js +27 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/reader-lite.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/reader-lite.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/reader-lite.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/apple.svg.js +27 -0
- package/lib/components/ModelCompareV3/assets/apple.svg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/apple.svg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/apple.svg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/contact.svg.js +27 -0
- package/lib/components/ModelCompareV3/assets/contact.svg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/contact.svg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/contact.svg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/crestron.svg.js +27 -0
- package/lib/components/ModelCompareV3/assets/crestron.svg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/crestron.svg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/crestron.svg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/AccessHubs.js +7 -5
- package/lib/components/ModelCompareV3/data/AccessHubs.js.map +1 -1
- package/lib/components/ModelCompareV3/data/AccessHubs.mjs +7 -5
- package/lib/components/ModelCompareV3/data/AccessHubs.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/EnterpriseSwitching.js +3 -2
- package/lib/components/ModelCompareV3/data/EnterpriseSwitching.js.map +1 -1
- package/lib/components/ModelCompareV3/data/EnterpriseSwitching.mjs +3 -2
- package/lib/components/ModelCompareV3/data/EnterpriseSwitching.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/ProfessionalMaxSwitching.js +10 -3
- package/lib/components/ModelCompareV3/data/ProfessionalMaxSwitching.js.map +1 -1
- package/lib/components/ModelCompareV3/data/ProfessionalMaxSwitching.mjs +10 -3
- package/lib/components/ModelCompareV3/data/ProfessionalMaxSwitching.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/Readers.js +15 -9
- package/lib/components/ModelCompareV3/data/Readers.js.map +1 -1
- package/lib/components/ModelCompareV3/data/Readers.mjs +15 -9
- package/lib/components/ModelCompareV3/data/Readers.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/StarterKit.js +6 -2
- package/lib/components/ModelCompareV3/data/StarterKit.js.map +1 -1
- package/lib/components/ModelCompareV3/data/StarterKit.mjs +6 -2
- package/lib/components/ModelCompareV3/data/StarterKit.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/Switching.js +3 -2
- package/lib/components/ModelCompareV3/data/Switching.js.map +1 -1
- package/lib/components/ModelCompareV3/data/Switching.mjs +3 -2
- package/lib/components/ModelCompareV3/data/Switching.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/UispRouter.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/UispRouter.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/UispRouterPro.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/UispRouterPro.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/aggregation.js +7 -0
- package/lib/components/ModelCompareV3/data/products/aggregation.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/aggregation.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/aggregation.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airFiber11.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airFiber11.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airFiber24.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airFiber24.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airFiber24HiDensity.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airFiber24HiDensity.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airFiber2X.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airFiber2X.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airFiber5.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airFiber5.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airMAX5GHz16dBi120Sector.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airMAX5GHz16dBi120Sector.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airMAX5GHz17dBi90Sector.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airMAX5GHz17dBi90Sector.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airMAX5GHz19dBi120Sector.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airMAX5GHz19dBi120Sector.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airMAX5GHz20dBi90Sector.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/airMAX5GHz20dBi90Sector.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/baseStationXG.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/baseStationXG.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/buildingBridge.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/buildingBridge.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/buildingBridgeXG.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/buildingBridgeXG.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/cloudKeyEnterprise.js +1 -1
- package/lib/components/ModelCompareV3/data/products/cloudKeyEnterprise.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/cloudKeyEnterprise.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/cloudKeyEnterprise.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/doorHub.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/products/{accessHub.js → doorHub.js} +22 -20
- package/lib/components/ModelCompareV3/data/products/doorHub.js.map +1 -0
- package/lib/components/ModelCompareV3/data/products/{accessHub.mjs → doorHub.mjs} +22 -20
- package/lib/components/ModelCompareV3/data/products/doorHub.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/products/doorHubMini.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/products/doorHubMini.js +69 -0
- package/lib/components/ModelCompareV3/data/products/doorHubMini.js.map +1 -0
- package/lib/components/ModelCompareV3/data/products/doorHubMini.mjs +61 -0
- package/lib/components/ModelCompareV3/data/products/doorHubMini.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/products/e7.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/e7.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgePointR6.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgePointR6.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgePointR8.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgePointR8.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgePointS16Switch.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgePointS16Switch.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeRouter10x.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeRouter10x.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeRouter12.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeRouter12.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeRouter12p.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeRouter12p.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeRouter4.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeRouter4.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeRouter6Poe.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeRouter6Poe.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeRouterInfinity.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeRouterInfinity.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeRouterX.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeRouterX.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeRouterXSfp.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeRouterXSfp.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch10x.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch10x.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch10xp.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch10xp.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch16xg.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch16xg.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch16xp.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch16xp.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch16xpoe150.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch16xpoe150.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch18x.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch18x.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch24lite.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch24lite.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch24poe-500.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch24poe-500.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch24poe.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch24poe.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch48lite.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch48lite.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch48poe.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeSwitch48poe.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeswitch48poe-750.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeswitch48poe-750.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeswitch5xp.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeswitch5xp.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeswitch8poe.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/edgeswitch8poe.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/elevatorStarterKit.js +8 -0
- package/lib/components/ModelCompareV3/data/products/elevatorStarterKit.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/elevatorStarterKit.mjs +8 -0
- package/lib/components/ModelCompareV3/data/products/elevatorStarterKit.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/enterpriseAggregation.js +7 -0
- package/lib/components/ModelCompareV3/data/products/enterpriseAggregation.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/enterpriseAggregation.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/enterpriseAggregation.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/enterpriseCampus24PoE.js +7 -0
- package/lib/components/ModelCompareV3/data/products/enterpriseCampus24PoE.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/enterpriseCampus24PoE.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/enterpriseCampus24PoE.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/enterpriseCampus48PoE.js +7 -0
- package/lib/components/ModelCompareV3/data/products/enterpriseCampus48PoE.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/enterpriseCampus48PoE.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/enterpriseCampus48PoE.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/fiberInstant.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/fiberInstant.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/fiberNanog.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/fiberNanog.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/g2Reader.js +23 -8
- package/lib/components/ModelCompareV3/data/products/g2Reader.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/g2Reader.mjs +23 -8
- package/lib/components/ModelCompareV3/data/products/g2Reader.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/g2ReaderPro.js +25 -9
- package/lib/components/ModelCompareV3/data/products/g2ReaderPro.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/g2ReaderPro.mjs +25 -9
- package/lib/components/ModelCompareV3/data/products/g2ReaderPro.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/g2StarterKit.js +8 -0
- package/lib/components/ModelCompareV3/data/products/g2StarterKit.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/g2StarterKit.mjs +8 -0
- package/lib/components/ModelCompareV3/data/products/g2StarterKit.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/g2StarterKitPro.js +8 -0
- package/lib/components/ModelCompareV3/data/products/g2StarterKitPro.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/g2StarterKitPro.mjs +8 -0
- package/lib/components/ModelCompareV3/data/products/g2StarterKitPro.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/g3Reader.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/products/g3Reader.js +104 -0
- package/lib/components/ModelCompareV3/data/products/g3Reader.js.map +1 -0
- package/lib/components/ModelCompareV3/data/products/g3Reader.mjs +96 -0
- package/lib/components/ModelCompareV3/data/products/g3Reader.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/products/g3ReaderFlex.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/products/g3ReaderFlex.js +104 -0
- package/lib/components/ModelCompareV3/data/products/g3ReaderFlex.js.map +1 -0
- package/lib/components/ModelCompareV3/data/products/g3ReaderFlex.mjs +96 -0
- package/lib/components/ModelCompareV3/data/products/g3ReaderFlex.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/products/g3ReaderPro.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/products/g3ReaderPro.js +105 -0
- package/lib/components/ModelCompareV3/data/products/g3ReaderPro.js.map +1 -0
- package/lib/components/ModelCompareV3/data/products/g3ReaderPro.mjs +97 -0
- package/lib/components/ModelCompareV3/data/products/g3ReaderPro.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/products/g3StarterKit.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/products/g3StarterKit.js +63 -0
- package/lib/components/ModelCompareV3/data/products/g3StarterKit.js.map +1 -0
- package/lib/components/ModelCompareV3/data/products/g3StarterKit.mjs +55 -0
- package/lib/components/ModelCompareV3/data/products/g3StarterKit.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/products/g3StarterKitPro.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/products/g3StarterKitPro.js +62 -0
- package/lib/components/ModelCompareV3/data/products/g3StarterKitPro.js.map +1 -0
- package/lib/components/ModelCompareV3/data/products/g3StarterKitPro.mjs +54 -0
- package/lib/components/ModelCompareV3/data/products/g3StarterKitPro.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/products/gateAccessStarterKit.js +7 -0
- package/lib/components/ModelCompareV3/data/products/gateAccessStarterKit.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/gateAccessStarterKit.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/gateAccessStarterKit.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/highCapacityAggregation.js +7 -0
- package/lib/components/ModelCompareV3/data/products/highCapacityAggregation.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/highCapacityAggregation.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/highCapacityAggregation.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/intercom.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/products/intercom.js +105 -0
- package/lib/components/ModelCompareV3/data/products/intercom.js.map +1 -0
- package/lib/components/ModelCompareV3/data/products/intercom.mjs +97 -0
- package/lib/components/ModelCompareV3/data/products/intercom.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/products/ltuExtremeRange.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/ltuExtremeRange.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/ltuLongRange.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/ltuLongRange.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/ltuPro.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/ltuPro.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/missionCritical.js +7 -0
- package/lib/components/ModelCompareV3/data/products/missionCritical.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/missionCritical.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/missionCritical.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/nanoStation5AC.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/nanoStation5AC.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/nanoStation5ACLoco.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/nanoStation5ACLoco.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/prismStation5AC.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/prismStation5AC.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professionalMax16.js +7 -0
- package/lib/components/ModelCompareV3/data/products/professionalMax16.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professionalMax16.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/professionalMax16.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professionalMax16PoE.js +7 -0
- package/lib/components/ModelCompareV3/data/products/professionalMax16PoE.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professionalMax16PoE.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/professionalMax16PoE.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professionalMax24.js +7 -0
- package/lib/components/ModelCompareV3/data/products/professionalMax24.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professionalMax24.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/professionalMax24.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professionalMax24PoE.js +7 -0
- package/lib/components/ModelCompareV3/data/products/professionalMax24PoE.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professionalMax24PoE.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/professionalMax24PoE.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professionalMax48.js +7 -0
- package/lib/components/ModelCompareV3/data/products/professionalMax48.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professionalMax48.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/professionalMax48.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professionalMax48PoE.js +7 -0
- package/lib/components/ModelCompareV3/data/products/professionalMax48PoE.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professionalMax48PoE.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/professionalMax48PoE.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/readerLite.js +23 -8
- package/lib/components/ModelCompareV3/data/products/readerLite.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/readerLite.mjs +23 -8
- package/lib/components/ModelCompareV3/data/products/readerLite.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/switchesEnterprise.js +8 -0
- package/lib/components/ModelCompareV3/data/products/switchesEnterprise.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/switchesEnterprise.mjs +8 -0
- package/lib/components/ModelCompareV3/data/products/switchesEnterprise.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/switchesProfessional.js +7 -0
- package/lib/components/ModelCompareV3/data/products/switchesProfessional.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/switchesProfessional.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/switchesProfessional.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/switchesProfessionalMax.js +10 -1
- package/lib/components/ModelCompareV3/data/products/switchesProfessionalMax.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/switchesProfessionalMax.mjs +10 -1
- package/lib/components/ModelCompareV3/data/products/switchesProfessionalMax.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/switchesStandard.js +7 -0
- package/lib/components/ModelCompareV3/data/products/switchesStandard.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/switchesStandard.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/switchesStandard.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/udb.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/udb.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/udbPro.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/udbPro.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/uispSwitch.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/uispSwitch.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/properties/appleTouchPassSupport.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/properties/appleTouchPassSupport.js +18 -0
- package/lib/components/ModelCompareV3/data/properties/appleTouchPassSupport.js.map +1 -0
- package/lib/components/ModelCompareV3/data/properties/appleTouchPassSupport.mjs +10 -0
- package/lib/components/ModelCompareV3/data/properties/appleTouchPassSupport.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/properties/crestronNaxNvxCertified.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/properties/crestronNaxNvxCertified.js +18 -0
- package/lib/components/ModelCompareV3/data/properties/crestronNaxNvxCertified.js.map +1 -0
- package/lib/components/ModelCompareV3/data/properties/crestronNaxNvxCertified.mjs +10 -0
- package/lib/components/ModelCompareV3/data/properties/crestronNaxNvxCertified.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/properties/{intercom.d.ts → directory.d.ts} +1 -1
- package/lib/components/ModelCompareV3/data/properties/directory.js +18 -0
- package/lib/components/ModelCompareV3/data/properties/directory.js.map +1 -0
- package/lib/components/ModelCompareV3/data/properties/directory.mjs +10 -0
- package/lib/components/ModelCompareV3/data/properties/directory.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/properties/index.d.ts +5 -2
- package/lib/components/ModelCompareV3/data/properties/index.js +10 -4
- package/lib/components/ModelCompareV3/data/properties/index.js.map +1 -1
- package/lib/components/ModelCompareV3/data/properties/index.mjs +5 -2
- package/lib/components/ModelCompareV3/data/properties/index.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/properties/twoWayIntercom.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/properties/{intercom.js → twoWayIntercom.js} +5 -5
- package/lib/components/ModelCompareV3/data/properties/twoWayIntercom.js.map +1 -0
- package/lib/components/ModelCompareV3/data/properties/twoWayIntercom.mjs +10 -0
- package/lib/components/ModelCompareV3/data/properties/twoWayIntercom.mjs.map +1 -0
- package/lib/components/ModelCompareV3/translations/en.json.js +39 -4
- package/lib/components/ModelCompareV3/translations/en.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/en.json.mjs +39 -4
- package/lib/components/ModelCompareV3/translations/en.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/useModelCompareTranslation.d.ts +2 -2
- package/lib/components/Pagination/Pagination.js.map +1 -1
- package/lib/components/Pagination/Pagination.mjs.map +1 -1
- package/lib/components/PriceRangeSlider/PriceRangeSlider.js.map +1 -1
- package/lib/components/PriceRangeSlider/PriceRangeSlider.mjs.map +1 -1
- package/lib/components/ProductCard/ProductCard.js.map +1 -1
- package/lib/components/ProductCard/ProductCard.mjs.map +1 -1
- package/lib/components/ProductCardPopup/ProductCardPopup.js.map +1 -1
- package/lib/components/ProductCardPopup/ProductCardPopup.mjs.map +1 -1
- package/lib/components/ProductGrid/ProductGrid.js.map +1 -1
- package/lib/components/ProductGrid/ProductGrid.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/ProductSectionTabs/ProductSectionTabs.js.map +1 -1
- package/lib/components/ProductSectionTabs/ProductSectionTabs.mjs.map +1 -1
- package/lib/components/ProductTechSpecs/ProductTechSpecs.styles.d.ts +2 -2
- package/lib/components/ProductTechSpecs/ProductTechSpecs.styles.js.map +1 -1
- package/lib/components/ProductTechSpecs/ProductTechSpecs.styles.mjs.map +1 -1
- package/lib/components/ProductWizardFootnotes/ProductWizardFootnotes.js.map +1 -1
- package/lib/components/ProductWizardFootnotes/ProductWizardFootnotes.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.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/HddSlots/HddSlots.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/HddSlots/HddSlots.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputSections/Layout.styles.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputSections/Layout.styles.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerConfigurator.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerConfigurator.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/RecommendedPoeSwitches.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/RecommendedPoeSwitches.mjs.map +1 -1
- package/lib/components/ScrollWrapper/ScrollWrapper.d.ts +1 -1
- package/lib/components/ScrollWrapper/ScrollWrapper.js +8 -16
- package/lib/components/ScrollWrapper/ScrollWrapper.js.map +1 -1
- package/lib/components/ScrollWrapper/ScrollWrapper.mjs +8 -16
- package/lib/components/ScrollWrapper/ScrollWrapper.mjs.map +1 -1
- package/lib/components/ScrollWrapper/ScrollWrapper.styles.js.map +1 -1
- package/lib/components/ScrollWrapper/ScrollWrapper.styles.mjs.map +1 -1
- package/lib/components/ScrollWrapper/ScrollWrapper.types.d.ts +0 -2
- package/lib/components/Search/Input/Input.d.ts +1 -1
- package/lib/components/Search/Input/Input.js +4 -4
- package/lib/components/Search/Input/Input.js.map +1 -1
- package/lib/components/Search/Input/Input.mjs +4 -4
- package/lib/components/Search/Input/Input.mjs.map +1 -1
- package/lib/components/Search/Input/Input.styles.js +1 -0
- package/lib/components/Search/Input/Input.styles.js.map +1 -1
- package/lib/components/Search/Input/Input.styles.mjs +1 -0
- package/lib/components/Search/Input/Input.styles.mjs.map +1 -1
- package/lib/components/Search/Input/Input.types.d.ts +2 -3
- package/lib/components/Search/Modal/Modal.js.map +1 -1
- package/lib/components/Search/Modal/Modal.mjs.map +1 -1
- package/lib/components/SkeletonLoader/SkeletonLoaderTable/SkeletonLoaderTable.js.map +1 -1
- package/lib/components/SkeletonLoader/SkeletonLoaderTable/SkeletonLoaderTable.mjs.map +1 -1
- package/lib/components/StorageSliders/StorageSliders.utils.js.map +1 -1
- package/lib/components/StorageSliders/StorageSliders.utils.mjs.map +1 -1
- package/lib/components/StyleableSvgImage/StyleableSvgImage.js.map +1 -1
- package/lib/components/StyleableSvgImage/StyleableSvgImage.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/Compatibility/Compatibility.styles.js.map +1 -1
- package/lib/components/VariantSelector/Variant/Compatibility/Compatibility.styles.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/VariantSelector/VariantSelector.constants.js.map +1 -1
- package/lib/components/VariantSelector/VariantSelector.constants.mjs.map +1 -1
- package/lib/components/VideoPlayerNew/VideoPlayer.js +2 -2
- package/lib/components/VideoPlayerNew/VideoPlayer.mjs +2 -2
- package/lib/components/VideoPlayerNew/assets/close.svg.js +1 -1
- package/lib/components/VideoPlayerNew/assets/close.svg.mjs +2 -2
- package/lib/components/VideoPlayerNew/assets/pause.svg.js +1 -1
- package/lib/components/VideoPlayerNew/assets/pause.svg.mjs +2 -2
- package/lib/constants/icons/options/colors/black.svg.js +5 -5
- package/lib/constants/icons/options/colors/index.js +3 -3
- package/lib/constants/icons/options/styles/black.svg.js +5 -5
- package/lib/constants/icons/options/styles/index.js +3 -3
- package/lib/constants/layout.js.map +1 -1
- package/lib/constants/layout.mjs.map +1 -1
- package/lib/constants/optionIcons.js +6 -6
- package/lib/constants/optionIcons.mjs +4 -4
- package/lib/constants/postalCode.js.map +1 -1
- package/lib/constants/postalCode.mjs.map +1 -1
- package/lib/constants/proStoreCategories/mapping/filters.d.ts +0 -16
- package/lib/constants/proStoreCategories/mapping/filters.js +0 -16
- package/lib/constants/proStoreCategories/mapping/filters.js.map +1 -1
- package/lib/constants/proStoreCategories/mapping/filters.mjs +0 -16
- package/lib/constants/proStoreCategories/mapping/filters.mjs.map +1 -1
- package/lib/constants/proStoreCategories/mapping/index.d.ts +1 -1
- package/lib/constants/proStoreCategories/mapping/index.js +11 -15
- package/lib/constants/proStoreCategories/mapping/index.js.map +1 -1
- package/lib/constants/proStoreCategories/mapping/index.mjs +11 -15
- package/lib/constants/proStoreCategories/mapping/index.mjs.map +1 -1
- package/lib/constants/proStoreCategories/mapping/mapping.d.ts +0 -5
- package/lib/constants/proStoreCategories/mapping/uisp.d.ts +1 -0
- package/lib/constants/proStoreCategories/mapping/uisp.js +1 -0
- package/lib/constants/proStoreCategories/mapping/uisp.js.map +1 -1
- package/lib/constants/proStoreCategories/mapping/uisp.mjs +1 -0
- package/lib/constants/proStoreCategories/mapping/uisp.mjs.map +1 -1
- package/lib/constants/proStoreCategories/mapping/unifi.d.ts +0 -1
- 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/ar.json.js +5 -2
- package/lib/constants/proStoreCategories/translations/ar.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/ar.json.mjs +5 -3
- package/lib/constants/proStoreCategories/translations/ar.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/de.json.js +5 -2
- package/lib/constants/proStoreCategories/translations/de.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/de.json.mjs +5 -3
- package/lib/constants/proStoreCategories/translations/de.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/el.json.js +6 -3
- package/lib/constants/proStoreCategories/translations/el.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/el.json.mjs +6 -4
- package/lib/constants/proStoreCategories/translations/el.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/en.json.js +1 -1
- package/lib/constants/proStoreCategories/translations/en.json.mjs +1 -1
- package/lib/constants/proStoreCategories/translations/es.json.js +5 -2
- package/lib/constants/proStoreCategories/translations/es.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/es.json.mjs +5 -3
- package/lib/constants/proStoreCategories/translations/es.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/fr.json.js +2 -2
- package/lib/constants/proStoreCategories/translations/fr.json.mjs +2 -2
- package/lib/constants/proStoreCategories/translations/it.json.js +5 -2
- package/lib/constants/proStoreCategories/translations/it.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/it.json.mjs +5 -3
- package/lib/constants/proStoreCategories/translations/it.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/ja.json.js +5 -2
- package/lib/constants/proStoreCategories/translations/ja.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/ja.json.mjs +5 -3
- package/lib/constants/proStoreCategories/translations/ja.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/pt-BR.json.js +5 -2
- package/lib/constants/proStoreCategories/translations/pt-BR.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/pt-BR.json.mjs +5 -3
- package/lib/constants/proStoreCategories/translations/pt-BR.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/zh-Hans.json.js +2 -2
- package/lib/constants/proStoreCategories/translations/zh-Hans.json.mjs +2 -2
- package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.js +2 -2
- package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.mjs +2 -2
- package/lib/constants/proStoreFilters/mapping.d.ts +7 -33
- package/lib/constants/proStoreFilters/mapping.js +14 -108
- package/lib/constants/proStoreFilters/mapping.js.map +1 -1
- package/lib/constants/proStoreFilters/mapping.mjs +14 -108
- package/lib/constants/proStoreFilters/mapping.mjs.map +1 -1
- package/lib/constants/theme.js +0 -4
- package/lib/constants/theme.js.map +1 -1
- package/lib/constants/theme.mjs +0 -4
- package/lib/constants/theme.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/mapping.js.map +1 -1
- package/lib/contexts/MenuContext/mapping.mjs.map +1 -1
- package/lib/contexts/MenuContext/utils.js.map +1 -1
- package/lib/contexts/MenuContext/utils.mjs.map +1 -1
- package/lib/helpers/index.d.ts +1 -0
- package/lib/helpers/index.js +11 -0
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/index.mjs +1 -0
- package/lib/helpers/index.mjs.map +1 -1
- package/lib/helpers/product.d.ts +87 -0
- package/lib/helpers/product.js +346 -0
- package/lib/helpers/product.js.map +1 -0
- package/lib/helpers/product.mjs +335 -0
- package/lib/helpers/product.mjs.map +1 -0
- package/lib/helpers/product.test.d.ts +1 -0
- package/lib/helpers/time.js.map +1 -1
- package/lib/helpers/time.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/useTranslation.js.map +1 -1
- package/lib/hooks/useTranslation.mjs.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +2 -0
- package/lib/types/index.js.map +1 -1
- package/lib/types/index.mjs +1 -0
- package/lib/types/index.mjs.map +1 -1
- package/lib/types/product.d.ts +87 -0
- package/lib/types/product.js +14 -0
- package/lib/types/product.js.map +1 -0
- package/lib/types/product.mjs +13 -0
- package/lib/types/product.mjs.map +1 -0
- package/lib/utils/address.d.ts +278 -62
- package/lib/utils/address.js +11 -8
- package/lib/utils/address.js.map +1 -1
- package/lib/utils/address.mjs +11 -8
- package/lib/utils/address.mjs.map +1 -1
- package/lib/utils/array.d.ts +4 -0
- package/lib/utils/array.js +10 -0
- package/lib/utils/array.js.map +1 -1
- package/lib/utils/array.mjs +10 -1
- package/lib/utils/array.mjs.map +1 -1
- package/lib/utils/money/allocators/fixedAmount.js.map +1 -1
- package/lib/utils/money/allocators/fixedAmount.mjs.map +1 -1
- package/lib/utils/money/format.js +2 -1
- package/lib/utils/money/format.js.map +1 -1
- package/lib/utils/money/format.mjs +2 -1
- package/lib/utils/money/format.mjs.map +1 -1
- package/lib/utils/money/misc.js.map +1 -1
- package/lib/utils/money/misc.mjs.map +1 -1
- package/lib/utils/nextjs/createInlineScript.js.map +1 -1
- package/lib/utils/nextjs/createInlineScript.mjs.map +1 -1
- package/lib/utils/nextjs/index.d.ts +3 -0
- package/lib/utils/nextjs/index.js +5 -0
- package/lib/utils/nextjs/index.js.map +1 -1
- package/lib/utils/nextjs/index.mjs +3 -0
- package/lib/utils/nextjs/index.mjs.map +1 -1
- package/lib/utils/nextjs/patch.d.ts +1 -0
- package/lib/utils/nextjs/patch.js +53 -0
- package/lib/utils/nextjs/patch.js.map +1 -0
- package/lib/utils/nextjs/patch.mjs +41 -0
- package/lib/utils/nextjs/patch.mjs.map +1 -0
- package/lib/utils/nextjs/plugin.d.ts +14 -0
- package/lib/utils/nextjs/plugin.js +41 -0
- package/lib/utils/nextjs/plugin.js.map +1 -0
- package/lib/utils/nextjs/plugin.mjs +39 -0
- package/lib/utils/nextjs/plugin.mjs.map +1 -0
- package/lib/utils/nextjs/ssr/constants.d.ts +8 -0
- package/lib/utils/nextjs/ssr/constants.js +8 -0
- package/lib/utils/nextjs/ssr/constants.js.map +1 -0
- package/lib/utils/nextjs/ssr/constants.mjs +6 -0
- package/lib/utils/nextjs/ssr/constants.mjs.map +1 -0
- package/lib/utils/nextjs/ssr/registry.d.ts +52 -0
- package/lib/utils/nextjs/ssr/registry.js +22 -0
- package/lib/utils/nextjs/ssr/registry.js.map +1 -0
- package/lib/utils/nextjs/ssr/registry.mjs +20 -0
- package/lib/utils/nextjs/ssr/registry.mjs.map +1 -0
- package/lib/utils/nextjs/ssr/style-inject.d.ts +21 -0
- package/lib/utils/nextjs/ssr/style-inject.js +47 -0
- package/lib/utils/nextjs/ssr/style-inject.js.map +1 -0
- package/lib/utils/nextjs/ssr/style-inject.mjs +43 -0
- package/lib/utils/nextjs/ssr/style-inject.mjs.map +1 -0
- package/lib/utils/nextjs/ssr/transform-css-module.d.ts +11 -0
- package/lib/utils/nextjs/ssr/transform-css-module.js +115 -0
- package/lib/utils/nextjs/ssr/transform-css-module.js.map +1 -0
- package/lib/utils/nextjs/ssr/transform-css-module.mjs +87 -0
- package/lib/utils/nextjs/ssr/transform-css-module.mjs.map +1 -0
- package/lib/utils/nextjs/ssr/transform-css-module.test.d.ts +1 -0
- package/lib/utils/nextjs/ssr/types.d.ts +10 -0
- package/lib/utils/nextjs/stringifyForInject.js.map +1 -1
- package/lib/utils/nextjs/stringifyForInject.mjs.map +1 -1
- package/lib/utils/number.js.map +1 -1
- package/lib/utils/number.mjs.map +1 -1
- package/lib/utils/productSort.d.ts +41 -0
- package/lib/utils/productSort.js +67 -0
- package/lib/utils/productSort.js.map +1 -0
- package/lib/utils/productSort.mjs +60 -0
- package/lib/utils/productSort.mjs.map +1 -0
- package/lib/utils/tax/brazil.js.map +1 -1
- package/lib/utils/tax/brazil.mjs.map +1 -1
- package/lib/utils/validations/lastNameSuperRefinement.d.ts +11 -0
- package/lib/utils/validations/lastNameSuperRefinement.js +25 -0
- package/lib/utils/validations/lastNameSuperRefinement.js.map +1 -0
- package/lib/utils/validations/lastNameSuperRefinement.mjs +21 -0
- package/lib/utils/validations/lastNameSuperRefinement.mjs.map +1 -0
- package/lib/utils/wattage.js.map +1 -1
- package/lib/utils/wattage.mjs.map +1 -1
- package/package.json +3 -1
- package/lib/assets/AccessHub.jpg +0 -0
- package/lib/assets/cart-secondary.svg +0 -5
- package/lib/assets/g2Reader.jpg +0 -0
- package/lib/assets/g2ReaderPro.jpg +0 -0
- package/lib/assets/icon-location-pin.svg +0 -5
- package/lib/assets/icons/cart-secondary.svg.js +0 -27
- package/lib/assets/icons/cart-secondary.svg.js.map +0 -1
- package/lib/assets/icons/cart-secondary.svg.mjs +0 -3
- package/lib/assets/icons/cart-secondary.svg.mjs.map +0 -1
- 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/readerLite.jpg +0 -0
- package/lib/components/Header/LogoIcon/LogoIcon.d.ts +0 -7
- package/lib/components/Header/LogoIcon/LogoIcon.js +0 -46
- package/lib/components/Header/LogoIcon/LogoIcon.js.map +0 -1
- package/lib/components/Header/LogoIcon/LogoIcon.mjs +0 -36
- package/lib/components/Header/LogoIcon/LogoIcon.mjs.map +0 -1
- package/lib/components/Header/LogoIcon/index.d.ts +0 -1
- package/lib/components/Header/LogoIcon/index.js +0 -6
- package/lib/components/Header/LogoIcon/index.js.map +0 -1
- package/lib/components/Header/LogoIcon/index.mjs +0 -3
- package/lib/components/Header/LogoIcon/index.mjs.map +0 -1
- package/lib/components/ModelCompareV3/assets/DoorAccess/AccessHub.jpg.js.map +0 -1
- package/lib/components/ModelCompareV3/assets/DoorAccess/AccessHub.jpg.mjs +0 -3
- package/lib/components/ModelCompareV3/assets/DoorAccess/AccessHub.jpg.mjs.map +0 -1
- package/lib/components/ModelCompareV3/assets/DoorAccess/g2Reader.jpg.js.map +0 -1
- package/lib/components/ModelCompareV3/assets/DoorAccess/g2Reader.jpg.mjs +0 -3
- package/lib/components/ModelCompareV3/assets/DoorAccess/g2Reader.jpg.mjs.map +0 -1
- package/lib/components/ModelCompareV3/assets/DoorAccess/g2ReaderPro.jpg.js.map +0 -1
- package/lib/components/ModelCompareV3/assets/DoorAccess/g2ReaderPro.jpg.mjs +0 -3
- package/lib/components/ModelCompareV3/assets/DoorAccess/g2ReaderPro.jpg.mjs.map +0 -1
- package/lib/components/ModelCompareV3/assets/DoorAccess/readerLite.jpg.js.map +0 -1
- package/lib/components/ModelCompareV3/assets/DoorAccess/readerLite.jpg.mjs +0 -3
- package/lib/components/ModelCompareV3/assets/DoorAccess/readerLite.jpg.mjs.map +0 -1
- package/lib/components/ModelCompareV3/data/products/accessHub.js.map +0 -1
- package/lib/components/ModelCompareV3/data/products/accessHub.mjs.map +0 -1
- package/lib/components/ModelCompareV3/data/properties/intercom.js.map +0 -1
- package/lib/components/ModelCompareV3/data/properties/intercom.mjs +0 -10
- package/lib/components/ModelCompareV3/data/properties/intercom.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"misc.js","sources":["../../../src/utils/money/misc.ts"],"sourcesContent":["import {\n add,\n dinero,\n hasSubUnits,\n multiply,\n subtract,\n toSnapshot,\n toUnit,\n transformScale,\n} from \"dinero.js\";\n\nimport { Currency } from \"../../types\";\nimport { assert } from \"../errors\";\nimport { isFloat, isInt } from \"../number\";\nimport { capitalize } from \"../string\";\nimport { smallestSubunitLookup } from \"./constants\";\nimport {\n currencyLookup,\n dineroCurrenciesLookup,\n floatToInt,\n} from \"./misc.private\";\nimport type { Cents, Dino, DinoCurrency, Money, RoundingFn } from \"./types\";\n\n/**\n * Some currencies have subunits in their currency spec that are not used in reality. This causes Dinero to return incorrect subunit values for those currencies.\n * This util rounds down any unused subunits to closest subunit resolution.\n *\n * ! Not to be confused with prettifyTotal\n */\nexport const toSmallestSubunit = (total: Dino): Dino => {\n // Nothing to round\n if (!hasSubUnits(total)) {\n return total;\n }\n\n const totalJson = total.toJSON();\n\n const [roundToDigits, roundingMode] =\n smallestSubunitLookup.get(totalJson.currency.code) ?? [];\n\n if (roundToDigits == null || roundingMode == null) {\n return total;\n }\n\n return roundDinero(total, roundingMode);\n};\n\n/**\n * Find Dinero.js currency instance from our Currency enum.\n * @throws Throws an error if currency is not found!\n *\n * @example\n * getDineroCurrency(Currency.Usd); // => Dinero.js currency instance\n * getDineroCurrency(\"invalid\"); // => throws AssertionError\n */\nexport const getDineroCurrency = (currency: Currency): DinoCurrency => {\n const dineroCurrency = dineroCurrenciesLookup.get(currency);\n assert(!!dineroCurrency, `Unsupported currency: \"${currency}\"`);\n return dineroCurrency;\n};\n\n/**\n * Convert Dinero currency (case-insensitive) to local currency type\n * @throws Throws an error if currency is not found!\n *\n * @example\n * parseCurrencyCode('usd') // Currency.Usd\n * parseCurrencyCode('JPY') // Currency.Jpy\n * parseCurrencyCode('invalid') // throws AssertionError\n */\nexport const parseCurrencyCode = (code: string): Currency => {\n const normalizedCode = capitalize(code.toLowerCase());\n assert(\n currencyLookup.has(normalizedCode),\n `Invalid currency code: ${normalizedCode}`,\n );\n return Currency[normalizedCode as keyof typeof Currency];\n};\n\n/**\n * Utility to quickly convert cents to a to currency float amount number\n *\n * @example\n * centsToCurrencyUnit(100, \"USD\") // 1\n * centsToCurrencyUnit(1, \"USD\") // 0.01\n * centsToCurrencyUnit(420, \"USD\") // 4.2\n * centsToCurrencyUnit(420, \"JPY\") // 420\n * FIXME: worth moving to a combined method of centsToCurrencyUnit & dineroToCurrencyUnit that accepts Money|Dino as input\n */\nexport const centsToCurrencyUnit = (\n centsAmount: Cents,\n currency: Currency,\n): number => {\n const dineroCurrency = getDineroCurrency(currency);\n const dineroObj = dinero({ amount: centsAmount, currency: dineroCurrency });\n return dineroToCurrencyUnit(dineroObj);\n};\n\n/**\n * Utility to quickly convert dinero instance to a to currency amount number\n *\n * @example\n * dineroToCurrencyUnit(getDinero(100, Currency.Usd)) // 1\n * dineroToCurrencyUnit(getDinero(1, Currency.Usd)) // 0.01\n * dineroToCurrencyUnit(getDinero(420, Currency.Usd)) // 4.2\n */\nexport const dineroToCurrencyUnit = (dineroObj: Dino): number => {\n return toUnit(dineroObj);\n};\n\n/**\n * Parse arbitrary float amount in a given currency to a dinero object.\n * Wrapper around `parseFloatToDineroRaw` for easier usage.\n *\n * Doesn't work on string float amounts!\n * @example\n * parseFloatToDinero(420, Currency.Usd); // => Dinero.js instance\n */\nexport const parseFloatToDinero = (floatAmount: number, currency: Currency) => {\n const dineroCurrency = getDineroCurrency(currency);\n return parseFloatToDineroRaw(floatAmount, dineroCurrency);\n};\n\n/**\n * Parse arbitrary float amount in a given dinero like currency object to a dinero object.\n * ! Typically use `parseFloatToDinero` instead of this method ! But this one is useful for custom currencies (e.g. custom exchange rates)\n */\nexport const parseFloatToDineroRaw = (\n floatAmount: number,\n dineroCurrency: DinoCurrency,\n) => {\n isFloat(floatAmount, \"Amount\");\n\n /**\n * Try to determine given input scale after comma, if not found, use currency default as that would indicate that\n * given input was an integer instead of a float\n *\n * FIXME: Won't work correctly if some currencies use dot/comma separation for decimal digits:\n * At least MacOS shows 4 different kind of formats to numbers.\n * 1. \"1234567,89\"\n * 2. \"1,234,567,89\"\n * 3. \"1.234.567,89\"\n * 4. \"1 234 567,89\"\n * Have to research if there are any more standards we should try to parse support\n */\n const scaleOfGivenAmount =\n String(floatAmount).split(\".\")[1]?.length ?? dineroCurrency.exponent;\n\n if (\n scaleOfGivenAmount == null ||\n scaleOfGivenAmount > dineroCurrency.exponent\n ) {\n throw new Error(`scaleOfGivenAmount is unsupported ${scaleOfGivenAmount}`);\n }\n const rateInt = floatToInt(\n floatAmount,\n dineroCurrency.base,\n dineroCurrency.exponent,\n );\n return dinero({\n amount: rateInt,\n currency: dineroCurrency,\n });\n};\n\n/**\n * Shorthand for dinero constructor\n *\n * @example\n * getDinero(100, Currency.Usd); // => Dinero.js instance (representing $1)\n */\nexport const getDinero = (amount: Cents, currency: Currency): Dino => {\n // TODO: verify if this is even needed, as dinero might already handle this\n isInt(amount, \"Amount\");\n return dinero({ amount, currency: getDineroCurrency(currency) });\n};\n\n/**\n * Shorthand to get amount from dinero instance\n *\n * FIXME: There is potential issue because we are not trimming scale:\n * multiply(getDinero(100, Currency.Usd), { amount: 100 + percentIncrease, scale: 2 })\n * will result in amount:10600, scale:4 (2*2), because dinero is rounding to safest scale.\n * @see https://v2.dinerojs.com/docs/core-concepts/scale#trimming-scale\n *\n * We should call something like: transformScale(d, currency.exponent)\n * @see https://v2.dinerojs.com/docs/api/conversions/transform-scale\n *\n * @example\n * amount(getDinero(100, Currency.Usd)); // 100\n */\nexport const amount = (dinero: Dino): Cents => {\n return toSnapshot(dinero).amount;\n};\n\n/**\n * Method to multiply dinero amount by full percent.\n * It also transforms scale back to currency exponent.\n * Where in case 20.34*1.06=21,5604, it will round to 21.56\n *\n * Will convert 0.01 - 12% to 0, but thats edge case we can tolerate, because\n * of dinero version we do not control rounding\n */\nexport const multiplyByFullPercent = (\n dinero: Dino,\n percentIncrease: number,\n): Dino => {\n assert(\n percentIncrease >= -100 && percentIncrease <= 100,\n \"Range should be in [-100, 100]\",\n );\n // (106 / 10^2 = 1.06)\n const multiplyResult = multiply(dinero, {\n amount: 100 + percentIncrease,\n scale: 2,\n });\n return transformScale(\n multiplyResult,\n multiplyResult.toJSON().currency.exponent,\n );\n};\n\n/**\n * Shorthand to get currency from dinero instance\n *\n * @example\n * currency(getDinero(100, Currency.Usd)); // Currency.Usd\n */\nexport const currency = (dinero: Dino): Currency => {\n return parseCurrencyCode(toSnapshot(dinero).currency.code);\n};\n\n/**\n * Shorthand to get our GraphQL Money type from dinero instance\n *\n * @example\n * money(getDinero(100, Currency.Usd)); // { amount: 100, currency: Currency.Usd }\n */\nexport const money = (dinero: Dino): Money => {\n const { amount, currency } = toSnapshot(dinero);\n\n return {\n amount,\n currency: parseCurrencyCode(currency.code),\n };\n};\n\n/**\n * Helper to quickly add multiple dinero instances with same currency\n *\n * @example\n * addMany([getDinero(100, Currency.Usd), getDinero(200, Currency.Usd)], Currency.Usd); // => Dinero.js instance (representing $3)\n */\nexport const addMany = (addends: Array<Dino>, defaultCurrency: Currency) =>\n [...addends, getDinero(0, defaultCurrency)].reduce(add);\n\n/**\n * Helper to quickly subtract multiple dinero instances with same currency\n */\nexport const subtractMany = (\n subtractions: Array<Dino>,\n defaultCurrency: Currency,\n) => [...subtractions, getDinero(0, defaultCurrency)].reduce(subtract);\n\n/**\n * Helper to quickly get dinero object from string\n */\nexport const stringAmountToDinero = (price: string, currency: Currency) =>\n // FIXME: parseFloat seems dangerous O_O\n parseFloatToDinero(parseFloat(price), currency);\n\n/**\n * Helper to quickly round dinero object to closest integer by a given rounding function\n * FIXME: add tests\n *\n * @example\n * roundDinero(getDinero(120, Currency.Usd), Math.floor); // => Dinero.js instance (representing $1)\n * roundDinero(getDinero(120, Currency.Usd), Math.ceil); // => Dinero.js instance (representing $2)\n */\nexport const roundDinero = (dinero: Dino, roundingFn: RoundingFn): Dino => {\n const roundedUnitPrice = toUnit(dinero, { digits: 0, round: roundingFn });\n\n const snapshot = toSnapshot(dinero);\n\n return dinero.create({\n /**\n * Rounding to mitigate floating precision errors:\n *\n * 8.2 * 10 ** 2 = 819.9999999999999\n * 2.2 * 10 ** 2 = 220.00000000000003\n */\n amount: Math.round(\n roundedUnitPrice * snapshot.currency.base ** snapshot.currency.exponent,\n ),\n currency: snapshot.currency,\n });\n};\n"],"names":["toSmallestSubunit","total","hasSubUnits","totalJson","toJSON","roundToDigits","roundingMode","smallestSubunitLookup","get","currency","code","roundDinero","getDineroCurrency","dineroCurrency","dineroCurrenciesLookup","assert","parseCurrencyCode","normalizedCode","capitalize","toLowerCase","currencyLookup","has","Currency","centsToCurrencyUnit","centsAmount","dineroObj","dinero","amount","dineroToCurrencyUnit","toUnit","parseFloatToDinero","floatAmount","parseFloatToDineroRaw","isFloat","scaleOfGivenAmount","String","split","length","exponent","Error","rateInt","floatToInt","base","getDinero","isInt","toSnapshot","multiplyByFullPercent","percentIncrease","multiplyResult","multiply","scale","transformScale","money","addMany","addends","defaultCurrency","reduce","add","subtractMany","subtractions","subtract","stringAmountToDinero","price","parseFloat","roundingFn","roundedUnitPrice","digits","round","snapshot","create","Math"],"mappings":";;;;;;;;;;;AA6Ba,MAAAA,iBAAA,GAAqBC,KAAsB,IAAA;EAElD,IAAA,CAACC,SAAAA,CAAAA,WAAY,CAAAD,KAAK,CAAG,EAAA;IAChB,OAAAA,KAAA;EACT;EAEM,MAAAE,SAAA,GAAYF,MAAMG,MAAO,EAAA;EAEzB,MAAA,CAACC,aAAe,EAAAC,YAAY,CAChC,GAAAC,SAAA,CAAAA,qBAAA,CAAsBC,IAAIL,SAAU,CAAAM,QAAA,CAASC,IAAI,CAAA,IAAK,EAAC;EAErD,IAAAL,aAAA,IAAiB,IAAQ,IAAAC,YAAA,IAAgB,IAAM,EAAA;IAC1C,OAAAL,KAAA;EACT;EAEO,OAAAU,WAAA,CAAYV,OAAOK,YAAY,CAAA;AACxC,CAAA;AAUa,MAAAM,iBAAA,GAAqBH,SAAqC,IAAA;EAC/D,MAAAI,cAAA,GAAiBC,YAAAA,CAAAA,s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CAAA;IACA7B,UAAU2D,QAAS,CAAA3D;EAAA,CACpB,CAAA;AACH,CAAA;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"misc.js","sources":["../../../src/utils/money/misc.ts"],"sourcesContent":["import {\n add,\n dinero,\n hasSubUnits,\n multiply,\n subtract,\n toSnapshot,\n toUnit,\n transformScale,\n} from \"dinero.js\";\n\nimport { Currency } from \"../../types\";\nimport { assert } from \"../errors\";\nimport { isFloat, isInt } from \"../number\";\nimport { capitalize } from \"../string\";\nimport { smallestSubunitLookup } from \"./constants\";\nimport {\n currencyLookup,\n dineroCurrenciesLookup,\n floatToInt,\n} from \"./misc.private\";\nimport type { Cents, Dino, DinoCurrency, Money, RoundingFn } from \"./types\";\n\n/**\n * Some currencies have subunits in their currency spec that are not used in reality. This causes Dinero to return incorrect subunit values for those currencies.\n * This util rounds down any unused subunits to closest subunit resolution.\n *\n * ! Not to be confused with prettifyTotal\n */\nexport const toSmallestSubunit = (total: Dino): Dino => {\n // Nothing to round\n if (!hasSubUnits(total)) {\n return total;\n }\n\n const totalJson = total.toJSON();\n\n const [roundToDigits, roundingMode] =\n smallestSubunitLookup.get(totalJson.currency.code) ?? [];\n\n if (roundToDigits == null || roundingMode == null) {\n return total;\n }\n\n return roundDinero(total, roundingMode);\n};\n\n/**\n * Find Dinero.js currency instance from our Currency enum.\n * @throws Throws an error if currency is not found!\n *\n * @example\n * getDineroCurrency(Currency.Usd); // => Dinero.js currency instance\n * getDineroCurrency(\"invalid\"); // => throws AssertionError\n */\nexport const getDineroCurrency = (currency: Currency): DinoCurrency => {\n const dineroCurrency = dineroCurrenciesLookup.get(currency);\n assert(!!dineroCurrency, `Unsupported currency: \"${currency}\"`);\n return dineroCurrency;\n};\n\n/**\n * Convert Dinero currency (case-insensitive) to local currency type\n * @throws Throws an error if currency is not found!\n *\n * @example\n * parseCurrencyCode('usd') // Currency.Usd\n * parseCurrencyCode('JPY') // Currency.Jpy\n * parseCurrencyCode('invalid') // throws AssertionError\n */\nexport const parseCurrencyCode = (code: string): Currency => {\n const normalizedCode = capitalize(code.toLowerCase());\n assert(\n currencyLookup.has(normalizedCode),\n `Invalid currency code: ${normalizedCode}`,\n );\n return Currency[normalizedCode as keyof typeof Currency];\n};\n\n/**\n * Utility to quickly convert cents to a to currency float amount number\n *\n * @example\n * centsToCurrencyUnit(100, \"USD\") // 1\n * centsToCurrencyUnit(1, \"USD\") // 0.01\n * centsToCurrencyUnit(420, \"USD\") // 4.2\n * centsToCurrencyUnit(420, \"JPY\") // 420\n * FIXME: worth moving to a combined method of centsToCurrencyUnit & dineroToCurrencyUnit that accepts Money|Dino as input\n */\nexport const centsToCurrencyUnit = (\n centsAmount: Cents,\n currency: Currency,\n): number => {\n const dineroCurrency = getDineroCurrency(currency);\n const dineroObj = dinero({ amount: centsAmount, currency: dineroCurrency });\n return dineroToCurrencyUnit(dineroObj);\n};\n\n/**\n * Utility to quickly convert dinero instance to a to currency amount number\n *\n * @example\n * dineroToCurrencyUnit(getDinero(100, Currency.Usd)) // 1\n * dineroToCurrencyUnit(getDinero(1, Currency.Usd)) // 0.01\n * dineroToCurrencyUnit(getDinero(420, Currency.Usd)) // 4.2\n */\nexport const dineroToCurrencyUnit = (dineroObj: Dino): number => {\n return toUnit(dineroObj);\n};\n\n/**\n * Parse arbitrary float amount in a given currency to a dinero object.\n * Wrapper around `parseFloatToDineroRaw` for easier usage.\n *\n * Doesn't work on string float amounts!\n * @example\n * parseFloatToDinero(420, Currency.Usd); // => Dinero.js instance\n */\nexport const parseFloatToDinero = (floatAmount: number, currency: Currency) => {\n const dineroCurrency = getDineroCurrency(currency);\n return parseFloatToDineroRaw(floatAmount, dineroCurrency);\n};\n\n/**\n * Parse arbitrary float amount in a given dinero like currency object to a dinero object.\n * ! Typically use `parseFloatToDinero` instead of this method ! But this one is useful for custom currencies (e.g. custom exchange rates)\n */\nexport const parseFloatToDineroRaw = (\n floatAmount: number,\n dineroCurrency: DinoCurrency,\n) => {\n isFloat(floatAmount, \"Amount\");\n\n /**\n * Try to determine given input scale after comma, if not found, use currency default as that would indicate that\n * given input was an integer instead of a float\n *\n * FIXME: Won't work correctly if some currencies use dot/comma separation for decimal digits:\n * At least MacOS shows 4 different kind of formats to numbers.\n * 1. \"1234567,89\"\n * 2. \"1,234,567,89\"\n * 3. \"1.234.567,89\"\n * 4. \"1 234 567,89\"\n * Have to research if there are any more standards we should try to parse support\n */\n const scaleOfGivenAmount =\n String(floatAmount).split(\".\")[1]?.length ?? dineroCurrency.exponent;\n\n if (\n scaleOfGivenAmount == null ||\n scaleOfGivenAmount > dineroCurrency.exponent\n ) {\n throw new Error(`scaleOfGivenAmount is unsupported ${scaleOfGivenAmount}`);\n }\n const rateInt = floatToInt(\n floatAmount,\n dineroCurrency.base,\n dineroCurrency.exponent,\n );\n return dinero({\n amount: rateInt,\n currency: dineroCurrency,\n });\n};\n\n/**\n * Shorthand for dinero constructor\n *\n * @example\n * getDinero(100, Currency.Usd); // => Dinero.js instance (representing $1)\n */\nexport const getDinero = (amount: Cents, currency: Currency): Dino => {\n // TODO: verify if this is even needed, as dinero might already handle this\n isInt(amount, \"Amount\");\n return dinero({ amount, currency: getDineroCurrency(currency) });\n};\n\n/**\n * Shorthand to get amount from dinero instance\n *\n * FIXME: There is potential issue because we are not trimming scale:\n * multiply(getDinero(100, Currency.Usd), { amount: 100 + percentIncrease, scale: 2 })\n * will result in amount:10600, scale:4 (2*2), because dinero is rounding to safest scale.\n * @see https://v2.dinerojs.com/docs/core-concepts/scale#trimming-scale\n *\n * We should call something like: transformScale(d, currency.exponent)\n * @see https://v2.dinerojs.com/docs/api/conversions/transform-scale\n *\n * @example\n * amount(getDinero(100, Currency.Usd)); // 100\n */\nexport const amount = (dinero: Dino): Cents => {\n return toSnapshot(dinero).amount;\n};\n\n/**\n * Method to multiply dinero amount by full percent.\n * It also transforms scale back to currency exponent.\n * Where in case 20.34*1.06=21,5604, it will round to 21.56\n *\n * Will convert 0.01 - 12% to 0, but thats edge case we can tolerate, because\n * of dinero version we do not control rounding\n */\nexport const multiplyByFullPercent = (\n dinero: Dino,\n percentIncrease: number,\n): Dino => {\n assert(\n percentIncrease >= -100 && percentIncrease <= 100,\n \"Range should be in [-100, 100]\",\n );\n // (106 / 10^2 = 1.06)\n const multiplyResult = multiply(dinero, {\n amount: 100 + percentIncrease,\n scale: 2,\n });\n return transformScale(\n multiplyResult,\n multiplyResult.toJSON().currency.exponent,\n );\n};\n\n/**\n * Shorthand to get currency from dinero instance\n *\n * @example\n * currency(getDinero(100, Currency.Usd)); // Currency.Usd\n */\nexport const currency = (dinero: Dino): Currency => {\n return parseCurrencyCode(toSnapshot(dinero).currency.code);\n};\n\n/**\n * Shorthand to get our GraphQL Money type from dinero instance\n *\n * @example\n * money(getDinero(100, Currency.Usd)); // { amount: 100, currency: Currency.Usd }\n */\nexport const money = (dinero: Dino): Money => {\n const { amount, currency } = toSnapshot(dinero);\n\n return {\n amount,\n currency: parseCurrencyCode(currency.code),\n };\n};\n\n/**\n * Helper to quickly add multiple dinero instances with same currency\n *\n * @example\n * addMany([getDinero(100, Currency.Usd), getDinero(200, Currency.Usd)], Currency.Usd); // => Dinero.js instance (representing $3)\n */\nexport const addMany = (addends: Array<Dino>, defaultCurrency: Currency) =>\n [...addends, getDinero(0, defaultCurrency)].reduce(add);\n\n/**\n * Helper to quickly subtract multiple dinero instances with same currency\n */\nexport const subtractMany = (\n subtractions: Array<Dino>,\n defaultCurrency: Currency,\n) => [...subtractions, getDinero(0, defaultCurrency)].reduce(subtract);\n\n/**\n * Helper to quickly get dinero object from string\n */\nexport const stringAmountToDinero = (price: string, currency: Currency) =>\n // FIXME: parseFloat seems dangerous O_O\n parseFloatToDinero(parseFloat(price), currency);\n\n/**\n * Helper to quickly round dinero object to closest integer by a given rounding function\n * FIXME: add tests\n *\n * @example\n * roundDinero(getDinero(120, Currency.Usd), Math.floor); // => Dinero.js instance (representing $1)\n * roundDinero(getDinero(120, Currency.Usd), Math.ceil); // => Dinero.js instance (representing $2)\n */\nexport const roundDinero = (dinero: Dino, roundingFn: RoundingFn): Dino => {\n const roundedUnitPrice = toUnit(dinero, { digits: 0, round: roundingFn });\n\n const snapshot = toSnapshot(dinero);\n\n return dinero.create({\n /**\n * Rounding to mitigate floating precision errors:\n *\n * 8.2 * 10 ** 2 = 819.9999999999999\n * 2.2 * 10 ** 2 = 220.00000000000003\n */\n amount: Math.round(\n roundedUnitPrice * snapshot.currency.base ** snapshot.currency.exponent,\n ),\n currency: snapshot.currency,\n });\n};\n"],"names":["toSmallestSubunit","total","hasSubUnits","totalJson","toJSON","roundToDigits","roundingMode","smallestSubunitLookup","get","currency","code","roundDinero","getDineroCurrency","dineroCurrency","dineroCurrenciesLookup","assert","parseCurrencyCode","normalizedCode","capitalize","toLowerCase","currencyLookup","has","Currency","centsToCurrencyUnit","centsAmount","dineroObj","dinero","amount","dineroToCurrencyUnit","toUnit","parseFloatToDinero","floatAmount","parseFloatToDineroRaw","isFloat","scaleOfGivenAmount","String","split","length","exponent","Error","rateInt","floatToInt","base","getDinero","isInt","toSnapshot","multiplyByFullPercent","percentIncrease","multiplyResult","multiply","scale","transformScale","money","addMany","addends","defaultCurrency","reduce","add","subtractMany","subtractions","subtract","stringAmountToDinero","price","parseFloat","roundingFn","roundedUnitPrice","digits","round","snapshot","create","Math"],"mappings":";;;;;;;;;;;AA6Ba,MAAAA,iBAAA,GAAqBC,KAAsB,IAAA;EAElD,IAAA,CAACC,SAAAA,CAAAA,WAAY,CAAAD,KAAK,CAAG,EAAA;IAChB,OAAAA,KAAA;EACT;EAEM,MAAAE,SAAA,GAAYF,MAAMG,MAAO,EAAA;EAEzB,MAAA,CAACC,aAAe,EAAAC,YAAY,CAChC,GAAAC,SAAA,CAAAA,qBAAA,CAAsBC,IAAIL,SAAU,CAAAM,QAAA,CAASC,IAAI,CAAA,IAAK,EAAC;EAErD,IAAAL,aAAA,IAAiB,IAAQ,IAAAC,YAAA,IAAgB,IAAM,EAAA;IAC1C,OAAAL,K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AAAA;AAAA;AAAA;AAAA;AAAA;IAOnB1C,QAAQ2C,IAAK,CAAAH,KAAA,CACXF,gBAAmB,GAAAG,QAAA,CAAS3D,QAAS,CAAAiC,IAAA,IAAQ0B,SAAS3D,QAAS,CAAA6B,QACjE,CAAA;IACA7B,UAAU2D,QAAS,CAAA3D;EAAA,CACpB,CAAA;AACH,CAAA;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"misc.mjs","sources":["../../../src/utils/money/misc.ts"],"sourcesContent":["import {\n add,\n dinero,\n hasSubUnits,\n multiply,\n subtract,\n toSnapshot,\n toUnit,\n transformScale,\n} from \"dinero.js\";\n\nimport { Currency } from \"../../types\";\nimport { assert } from \"../errors\";\nimport { isFloat, isInt } from \"../number\";\nimport { capitalize } from \"../string\";\nimport { smallestSubunitLookup } from \"./constants\";\nimport {\n currencyLookup,\n dineroCurrenciesLookup,\n floatToInt,\n} from \"./misc.private\";\nimport type { Cents, Dino, DinoCurrency, Money, RoundingFn } from \"./types\";\n\n/**\n * Some currencies have subunits in their currency spec that are not used in reality. This causes Dinero to return incorrect subunit values for those currencies.\n * This util rounds down any unused subunits to closest subunit resolution.\n *\n * ! Not to be confused with prettifyTotal\n */\nexport const toSmallestSubunit = (total: Dino): Dino => {\n // Nothing to round\n if (!hasSubUnits(total)) {\n return total;\n }\n\n const totalJson = total.toJSON();\n\n const [roundToDigits, roundingMode] =\n smallestSubunitLookup.get(totalJson.currency.code) ?? [];\n\n if (roundToDigits == null || roundingMode == null) {\n return total;\n }\n\n return roundDinero(total, roundingMode);\n};\n\n/**\n * Find Dinero.js currency instance from our Currency enum.\n * @throws Throws an error if currency is not found!\n *\n * @example\n * getDineroCurrency(Currency.Usd); // => Dinero.js currency instance\n * getDineroCurrency(\"invalid\"); // => throws AssertionError\n */\nexport const getDineroCurrency = (currency: Currency): DinoCurrency => {\n const dineroCurrency = dineroCurrenciesLookup.get(currency);\n assert(!!dineroCurrency, `Unsupported currency: \"${currency}\"`);\n return dineroCurrency;\n};\n\n/**\n * Convert Dinero currency (case-insensitive) to local currency type\n * @throws Throws an error if currency is not found!\n *\n * @example\n * parseCurrencyCode('usd') // Currency.Usd\n * parseCurrencyCode('JPY') // Currency.Jpy\n * parseCurrencyCode('invalid') // throws AssertionError\n */\nexport const parseCurrencyCode = (code: string): Currency => {\n const normalizedCode = capitalize(code.toLowerCase());\n assert(\n currencyLookup.has(normalizedCode),\n `Invalid currency code: ${normalizedCode}`,\n );\n return Currency[normalizedCode as keyof typeof Currency];\n};\n\n/**\n * Utility to quickly convert cents to a to currency float amount number\n *\n * @example\n * centsToCurrencyUnit(100, \"USD\") // 1\n * centsToCurrencyUnit(1, \"USD\") // 0.01\n * centsToCurrencyUnit(420, \"USD\") // 4.2\n * centsToCurrencyUnit(420, \"JPY\") // 420\n * FIXME: worth moving to a combined method of centsToCurrencyUnit & dineroToCurrencyUnit that accepts Money|Dino as input\n */\nexport const centsToCurrencyUnit = (\n centsAmount: Cents,\n currency: Currency,\n): number => {\n const dineroCurrency = getDineroCurrency(currency);\n const dineroObj = dinero({ amount: centsAmount, currency: dineroCurrency });\n return dineroToCurrencyUnit(dineroObj);\n};\n\n/**\n * Utility to quickly convert dinero instance to a to currency amount number\n *\n * @example\n * dineroToCurrencyUnit(getDinero(100, Currency.Usd)) // 1\n * dineroToCurrencyUnit(getDinero(1, Currency.Usd)) // 0.01\n * dineroToCurrencyUnit(getDinero(420, Currency.Usd)) // 4.2\n */\nexport const dineroToCurrencyUnit = (dineroObj: Dino): number => {\n return toUnit(dineroObj);\n};\n\n/**\n * Parse arbitrary float amount in a given currency to a dinero object.\n * Wrapper around `parseFloatToDineroRaw` for easier usage.\n *\n * Doesn't work on string float amounts!\n * @example\n * parseFloatToDinero(420, Currency.Usd); // => Dinero.js instance\n */\nexport const parseFloatToDinero = (floatAmount: number, currency: Currency) => {\n const dineroCurrency = getDineroCurrency(currency);\n return parseFloatToDineroRaw(floatAmount, dineroCurrency);\n};\n\n/**\n * Parse arbitrary float amount in a given dinero like currency object to a dinero object.\n * ! Typically use `parseFloatToDinero` instead of this method ! But this one is useful for custom currencies (e.g. custom exchange rates)\n */\nexport const parseFloatToDineroRaw = (\n floatAmount: number,\n dineroCurrency: DinoCurrency,\n) => {\n isFloat(floatAmount, \"Amount\");\n\n /**\n * Try to determine given input scale after comma, if not found, use currency default as that would indicate that\n * given input was an integer instead of a float\n *\n * FIXME: Won't work correctly if some currencies use dot/comma separation for decimal digits:\n * At least MacOS shows 4 different kind of formats to numbers.\n * 1. \"1234567,89\"\n * 2. \"1,234,567,89\"\n * 3. \"1.234.567,89\"\n * 4. \"1 234 567,89\"\n * Have to research if there are any more standards we should try to parse support\n */\n const scaleOfGivenAmount =\n String(floatAmount).split(\".\")[1]?.length ?? dineroCurrency.exponent;\n\n if (\n scaleOfGivenAmount == null ||\n scaleOfGivenAmount > dineroCurrency.exponent\n ) {\n throw new Error(`scaleOfGivenAmount is unsupported ${scaleOfGivenAmount}`);\n }\n const rateInt = floatToInt(\n floatAmount,\n dineroCurrency.base,\n dineroCurrency.exponent,\n );\n return dinero({\n amount: rateInt,\n currency: dineroCurrency,\n });\n};\n\n/**\n * Shorthand for dinero constructor\n *\n * @example\n * getDinero(100, Currency.Usd); // => Dinero.js instance (representing $1)\n */\nexport const getDinero = (amount: Cents, currency: Currency): Dino => {\n // TODO: verify if this is even needed, as dinero might already handle this\n isInt(amount, \"Amount\");\n return dinero({ amount, currency: getDineroCurrency(currency) });\n};\n\n/**\n * Shorthand to get amount from dinero instance\n *\n * FIXME: There is potential issue because we are not trimming scale:\n * multiply(getDinero(100, Currency.Usd), { amount: 100 + percentIncrease, scale: 2 })\n * will result in amount:10600, scale:4 (2*2), because dinero is rounding to safest scale.\n * @see https://v2.dinerojs.com/docs/core-concepts/scale#trimming-scale\n *\n * We should call something like: transformScale(d, currency.exponent)\n * @see https://v2.dinerojs.com/docs/api/conversions/transform-scale\n *\n * @example\n * amount(getDinero(100, Currency.Usd)); // 100\n */\nexport const amount = (dinero: Dino): Cents => {\n return toSnapshot(dinero).amount;\n};\n\n/**\n * Method to multiply dinero amount by full percent.\n * It also transforms scale back to currency exponent.\n * Where in case 20.34*1.06=21,5604, it will round to 21.56\n *\n * Will convert 0.01 - 12% to 0, but thats edge case we can tolerate, because\n * of dinero version we do not control rounding\n */\nexport const multiplyByFullPercent = (\n dinero: Dino,\n percentIncrease: number,\n): Dino => {\n assert(\n percentIncrease >= -100 && percentIncrease <= 100,\n \"Range should be in [-100, 100]\",\n );\n // (106 / 10^2 = 1.06)\n const multiplyResult = multiply(dinero, {\n amount: 100 + percentIncrease,\n scale: 2,\n });\n return transformScale(\n multiplyResult,\n multiplyResult.toJSON().currency.exponent,\n );\n};\n\n/**\n * Shorthand to get currency from dinero instance\n *\n * @example\n * currency(getDinero(100, Currency.Usd)); // Currency.Usd\n */\nexport const currency = (dinero: Dino): Currency => {\n return parseCurrencyCode(toSnapshot(dinero).currency.code);\n};\n\n/**\n * Shorthand to get our GraphQL Money type from dinero instance\n *\n * @example\n * money(getDinero(100, Currency.Usd)); // { amount: 100, currency: Currency.Usd }\n */\nexport const money = (dinero: Dino): Money => {\n const { amount, currency } = toSnapshot(dinero);\n\n return {\n amount,\n currency: parseCurrencyCode(currency.code),\n };\n};\n\n/**\n * Helper to quickly add multiple dinero instances with same currency\n *\n * @example\n * addMany([getDinero(100, Currency.Usd), getDinero(200, Currency.Usd)], Currency.Usd); // => Dinero.js instance (representing $3)\n */\nexport const addMany = (addends: Array<Dino>, defaultCurrency: Currency) =>\n [...addends, getDinero(0, defaultCurrency)].reduce(add);\n\n/**\n * Helper to quickly subtract multiple dinero instances with same currency\n */\nexport const subtractMany = (\n subtractions: Array<Dino>,\n defaultCurrency: Currency,\n) => [...subtractions, getDinero(0, defaultCurrency)].reduce(subtract);\n\n/**\n * Helper to quickly get dinero object from string\n */\nexport const stringAmountToDinero = (price: string, currency: Currency) =>\n // FIXME: parseFloat seems dangerous O_O\n parseFloatToDinero(parseFloat(price), currency);\n\n/**\n * Helper to quickly round dinero object to closest integer by a given rounding function\n * FIXME: add tests\n *\n * @example\n * roundDinero(getDinero(120, Currency.Usd), Math.floor); // => Dinero.js instance (representing $1)\n * roundDinero(getDinero(120, Currency.Usd), Math.ceil); // => Dinero.js instance (representing $2)\n */\nexport const roundDinero = (dinero: Dino, roundingFn: RoundingFn): Dino => {\n const roundedUnitPrice = toUnit(dinero, { digits: 0, round: roundingFn });\n\n const snapshot = toSnapshot(dinero);\n\n return dinero.create({\n /**\n * Rounding to mitigate floating precision errors:\n *\n * 8.2 * 10 ** 2 = 819.9999999999999\n * 2.2 * 10 ** 2 = 220.00000000000003\n */\n amount: Math.round(\n roundedUnitPrice * snapshot.currency.base ** snapshot.currency.exponent,\n ),\n currency: snapshot.currency,\n });\n};\n"],"names":["toSmallestSubunit","total","hasSubUnits","totalJson","toJSON","roundToDigits","roundingMode","smallestSubunitLookup","get","currency","code","roundDinero","getDineroCurrency","dineroCurrency","dineroCurrenciesLookup","assert","parseCurrencyCode","normalizedCode","capitalize","toLowerCase","currencyLookup","has","Currency","centsToCurrencyUnit","centsAmount","dineroObj","dinero","amount","dineroToCurrencyUnit","toUnit","parseFloatToDinero","floatAmount","parseFloatToDineroRaw","isFloat","scaleOfGivenAmount","String","split","length","exponent","Error","rateInt","floatToInt","base","getDinero","isInt","toSnapshot","multiplyByFullPercent","percentIncrease","multiplyResult","multiply","scale","transformScale","money","addMany","addends","defaultCurrency","reduce","add","subtractMany","subtractions","subtract","stringAmountToDinero","price","parseFloat","roundingFn","roundedUnitPrice","digits","round","snapshot","create","Math"],"mappings":";;;;;;;;;AA6Ba,MAAAA,iBAAA,GAAqBC,KAAsB,IAAA;EAElD,IAAA,CAACC,WAAY,CAAAD,KAAK,CAAG,EAAA;IAChB,OAAAA,KAAA;EACT;EAEM,MAAAE,SAAA,GAAYF,MAAMG,MAAO,EAAA;EAEzB,MAAA,CAACC,aAAe,EAAAC,YAAY,CAChC,GAA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AAA,CAAS3D,QAAS,CAAAiC,IAAA,IAAQ0B,SAAS3D,QAAS,CAAA6B,QACjE,CAAA;IACA7B,UAAU2D,QAAS,CAAA3D;EAAA,CACpB,CAAA;AACH,CAAA;"}
|
|
1
|
+
{"version":3,"file":"misc.mjs","sources":["../../../src/utils/money/misc.ts"],"sourcesContent":["import {\n add,\n dinero,\n hasSubUnits,\n multiply,\n subtract,\n toSnapshot,\n toUnit,\n transformScale,\n} from \"dinero.js\";\n\nimport { Currency } from \"../../types\";\nimport { assert } from \"../errors\";\nimport { isFloat, isInt } from \"../number\";\nimport { capitalize } from \"../string\";\nimport { smallestSubunitLookup } from \"./constants\";\nimport {\n currencyLookup,\n dineroCurrenciesLookup,\n floatToInt,\n} from \"./misc.private\";\nimport type { Cents, Dino, DinoCurrency, Money, RoundingFn } from \"./types\";\n\n/**\n * Some currencies have subunits in their currency spec that are not used in reality. This causes Dinero to return incorrect subunit values for those currencies.\n * This util rounds down any unused subunits to closest subunit resolution.\n *\n * ! Not to be confused with prettifyTotal\n */\nexport const toSmallestSubunit = (total: Dino): Dino => {\n // Nothing to round\n if (!hasSubUnits(total)) {\n return total;\n }\n\n const totalJson = total.toJSON();\n\n const [roundToDigits, roundingMode] =\n smallestSubunitLookup.get(totalJson.currency.code) ?? [];\n\n if (roundToDigits == null || roundingMode == null) {\n return total;\n }\n\n return roundDinero(total, roundingMode);\n};\n\n/**\n * Find Dinero.js currency instance from our Currency enum.\n * @throws Throws an error if currency is not found!\n *\n * @example\n * getDineroCurrency(Currency.Usd); // => Dinero.js currency instance\n * getDineroCurrency(\"invalid\"); // => throws AssertionError\n */\nexport const getDineroCurrency = (currency: Currency): DinoCurrency => {\n const dineroCurrency = dineroCurrenciesLookup.get(currency);\n assert(!!dineroCurrency, `Unsupported currency: \"${currency}\"`);\n return dineroCurrency;\n};\n\n/**\n * Convert Dinero currency (case-insensitive) to local currency type\n * @throws Throws an error if currency is not found!\n *\n * @example\n * parseCurrencyCode('usd') // Currency.Usd\n * parseCurrencyCode('JPY') // Currency.Jpy\n * parseCurrencyCode('invalid') // throws AssertionError\n */\nexport const parseCurrencyCode = (code: string): Currency => {\n const normalizedCode = capitalize(code.toLowerCase());\n assert(\n currencyLookup.has(normalizedCode),\n `Invalid currency code: ${normalizedCode}`,\n );\n return Currency[normalizedCode as keyof typeof Currency];\n};\n\n/**\n * Utility to quickly convert cents to a to currency float amount number\n *\n * @example\n * centsToCurrencyUnit(100, \"USD\") // 1\n * centsToCurrencyUnit(1, \"USD\") // 0.01\n * centsToCurrencyUnit(420, \"USD\") // 4.2\n * centsToCurrencyUnit(420, \"JPY\") // 420\n * FIXME: worth moving to a combined method of centsToCurrencyUnit & dineroToCurrencyUnit that accepts Money|Dino as input\n */\nexport const centsToCurrencyUnit = (\n centsAmount: Cents,\n currency: Currency,\n): number => {\n const dineroCurrency = getDineroCurrency(currency);\n const dineroObj = dinero({ amount: centsAmount, currency: dineroCurrency });\n return dineroToCurrencyUnit(dineroObj);\n};\n\n/**\n * Utility to quickly convert dinero instance to a to currency amount number\n *\n * @example\n * dineroToCurrencyUnit(getDinero(100, Currency.Usd)) // 1\n * dineroToCurrencyUnit(getDinero(1, Currency.Usd)) // 0.01\n * dineroToCurrencyUnit(getDinero(420, Currency.Usd)) // 4.2\n */\nexport const dineroToCurrencyUnit = (dineroObj: Dino): number => {\n return toUnit(dineroObj);\n};\n\n/**\n * Parse arbitrary float amount in a given currency to a dinero object.\n * Wrapper around `parseFloatToDineroRaw` for easier usage.\n *\n * Doesn't work on string float amounts!\n * @example\n * parseFloatToDinero(420, Currency.Usd); // => Dinero.js instance\n */\nexport const parseFloatToDinero = (floatAmount: number, currency: Currency) => {\n const dineroCurrency = getDineroCurrency(currency);\n return parseFloatToDineroRaw(floatAmount, dineroCurrency);\n};\n\n/**\n * Parse arbitrary float amount in a given dinero like currency object to a dinero object.\n * ! Typically use `parseFloatToDinero` instead of this method ! But this one is useful for custom currencies (e.g. custom exchange rates)\n */\nexport const parseFloatToDineroRaw = (\n floatAmount: number,\n dineroCurrency: DinoCurrency,\n) => {\n isFloat(floatAmount, \"Amount\");\n\n /**\n * Try to determine given input scale after comma, if not found, use currency default as that would indicate that\n * given input was an integer instead of a float\n *\n * FIXME: Won't work correctly if some currencies use dot/comma separation for decimal digits:\n * At least MacOS shows 4 different kind of formats to numbers.\n * 1. \"1234567,89\"\n * 2. \"1,234,567,89\"\n * 3. \"1.234.567,89\"\n * 4. \"1 234 567,89\"\n * Have to research if there are any more standards we should try to parse support\n */\n const scaleOfGivenAmount =\n String(floatAmount).split(\".\")[1]?.length ?? dineroCurrency.exponent;\n\n if (\n scaleOfGivenAmount == null ||\n scaleOfGivenAmount > dineroCurrency.exponent\n ) {\n throw new Error(`scaleOfGivenAmount is unsupported ${scaleOfGivenAmount}`);\n }\n const rateInt = floatToInt(\n floatAmount,\n dineroCurrency.base,\n dineroCurrency.exponent,\n );\n return dinero({\n amount: rateInt,\n currency: dineroCurrency,\n });\n};\n\n/**\n * Shorthand for dinero constructor\n *\n * @example\n * getDinero(100, Currency.Usd); // => Dinero.js instance (representing $1)\n */\nexport const getDinero = (amount: Cents, currency: Currency): Dino => {\n // TODO: verify if this is even needed, as dinero might already handle this\n isInt(amount, \"Amount\");\n return dinero({ amount, currency: getDineroCurrency(currency) });\n};\n\n/**\n * Shorthand to get amount from dinero instance\n *\n * FIXME: There is potential issue because we are not trimming scale:\n * multiply(getDinero(100, Currency.Usd), { amount: 100 + percentIncrease, scale: 2 })\n * will result in amount:10600, scale:4 (2*2), because dinero is rounding to safest scale.\n * @see https://v2.dinerojs.com/docs/core-concepts/scale#trimming-scale\n *\n * We should call something like: transformScale(d, currency.exponent)\n * @see https://v2.dinerojs.com/docs/api/conversions/transform-scale\n *\n * @example\n * amount(getDinero(100, Currency.Usd)); // 100\n */\nexport const amount = (dinero: Dino): Cents => {\n return toSnapshot(dinero).amount;\n};\n\n/**\n * Method to multiply dinero amount by full percent.\n * It also transforms scale back to currency exponent.\n * Where in case 20.34*1.06=21,5604, it will round to 21.56\n *\n * Will convert 0.01 - 12% to 0, but thats edge case we can tolerate, because\n * of dinero version we do not control rounding\n */\nexport const multiplyByFullPercent = (\n dinero: Dino,\n percentIncrease: number,\n): Dino => {\n assert(\n percentIncrease >= -100 && percentIncrease <= 100,\n \"Range should be in [-100, 100]\",\n );\n // (106 / 10^2 = 1.06)\n const multiplyResult = multiply(dinero, {\n amount: 100 + percentIncrease,\n scale: 2,\n });\n return transformScale(\n multiplyResult,\n multiplyResult.toJSON().currency.exponent,\n );\n};\n\n/**\n * Shorthand to get currency from dinero instance\n *\n * @example\n * currency(getDinero(100, Currency.Usd)); // Currency.Usd\n */\nexport const currency = (dinero: Dino): Currency => {\n return parseCurrencyCode(toSnapshot(dinero).currency.code);\n};\n\n/**\n * Shorthand to get our GraphQL Money type from dinero instance\n *\n * @example\n * money(getDinero(100, Currency.Usd)); // { amount: 100, currency: Currency.Usd }\n */\nexport const money = (dinero: Dino): Money => {\n const { amount, currency } = toSnapshot(dinero);\n\n return {\n amount,\n currency: parseCurrencyCode(currency.code),\n };\n};\n\n/**\n * Helper to quickly add multiple dinero instances with same currency\n *\n * @example\n * addMany([getDinero(100, Currency.Usd), getDinero(200, Currency.Usd)], Currency.Usd); // => Dinero.js instance (representing $3)\n */\nexport const addMany = (addends: Array<Dino>, defaultCurrency: Currency) =>\n [...addends, getDinero(0, defaultCurrency)].reduce(add);\n\n/**\n * Helper to quickly subtract multiple dinero instances with same currency\n */\nexport const subtractMany = (\n subtractions: Array<Dino>,\n defaultCurrency: Currency,\n) => [...subtractions, getDinero(0, defaultCurrency)].reduce(subtract);\n\n/**\n * Helper to quickly get dinero object from string\n */\nexport const stringAmountToDinero = (price: string, currency: Currency) =>\n // FIXME: parseFloat seems dangerous O_O\n parseFloatToDinero(parseFloat(price), currency);\n\n/**\n * Helper to quickly round dinero object to closest integer by a given rounding function\n * FIXME: add tests\n *\n * @example\n * roundDinero(getDinero(120, Currency.Usd), Math.floor); // => Dinero.js instance (representing $1)\n * roundDinero(getDinero(120, Currency.Usd), Math.ceil); // => Dinero.js instance (representing $2)\n */\nexport const roundDinero = (dinero: Dino, roundingFn: RoundingFn): Dino => {\n const roundedUnitPrice = toUnit(dinero, { digits: 0, round: roundingFn });\n\n const snapshot = toSnapshot(dinero);\n\n return dinero.create({\n /**\n * Rounding to mitigate floating precision errors:\n *\n * 8.2 * 10 ** 2 = 819.9999999999999\n * 2.2 * 10 ** 2 = 220.00000000000003\n */\n amount: Math.round(\n roundedUnitPrice * snapshot.currency.base ** snapshot.currency.exponent,\n ),\n currency: snapshot.currency,\n });\n};\n"],"names":["toSmallestSubunit","total","hasSubUnits","totalJson","toJSON","roundToDigits","roundingMode","smallestSubunitLookup","get","currency","code","roundDinero","getDineroCurrency","dineroCurrency","dineroCurrenciesLookup","assert","parseCurrencyCode","normalizedCode","capitalize","toLowerCase","currencyLookup","has","Currency","centsToCurrencyUnit","centsAmount","dineroObj","dinero","amount","dineroToCurrencyUnit","toUnit","parseFloatToDinero","floatAmount","parseFloatToDineroRaw","isFloat","scaleOfGivenAmount","String","split","length","exponent","Error","rateInt","floatToInt","base","getDinero","isInt","toSnapshot","multiplyByFullPercent","percentIncrease","multiplyResult","multiply","scale","transformScale","money","addMany","addends","defaultCurrency","reduce","add","subtractMany","subtractions","subtract","stringAmountToDinero","price","parseFloat","roundingFn","roundedUnitPrice","digits","round","snapshot","create","Math"],"mappings":";;;;;;;;;AA6Ba,MAAAA,iBAAA,GAAqBC,KAAsB,IAAA;EAElD,IAAA,CAACC,WAAY,CAAAD,KAAK,CAAG,EAAA;IAChB,OAAAA,KAAA;EACT;EAEM,MAAAE,SAAA,GAAYF,MAAMG,MAAO,EAAA;EAEzB,MAAA,CAACC,aAAe,EAAAC,YAAY,CAChC,GAAAC,qBAAA,CAAsBC,IAAIL,SAAU,CAAAM,QAAA,CAASC,IAAI,CAAA,IAAK,EAAC;EAErD,IAAAL,aAAA,IAAiB,IAAQ,IAAAC,YAAA,IAAgB,I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AAA;AACH,CAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInlineScript.js","sources":["../../../src/utils/nextjs/createInlineScript.ts"],"sourcesContent":["import { createHash } from \"crypto\";\nimport { minify } from \"terser\";\n\n/**\n * Returns a SHA256 hash using SHA-2 for the given `content`.\n * @private Internal library method!\n * @see https://en.wikipedia.org/wiki/SHA-2\n * @See https://futurestud.io/tutorials/node-js-calculate-a-sha256-hash\n */\nexport const _cspHash = (scriptContent: string): string => {\n if (\n // Naive approach but it sufficiernt for our use case\n scriptContent.startsWith(\"<script\") ||\n scriptContent.endsWith(\"</script>\")\n ) {\n throw new Error(\n \"Inline script should not be wrapped inside of <script><script/>\",\n );\n }\n const hash = createHash(\"sha256\").update(scriptContent).digest(\"base64\");\n return `'sha256-${hash}'`;\n};\n\n/**\n * Minifies the inline script for \"machine\" consumption\n * Uses `terser` (webpack minifier of choice) to minify the script\n * @private Internal library method!\n * @see https://github.com/terser/terser\n */\nexport const _minifyScript = async (scriptContent: string): Promise<string> => {\n const minifiedContent = (await minify(scriptContent, {})).code;\n if (!minifiedContent) {\n throw new Error(\n \"Missing minified code for some reason, check input for script content\",\n );\n }\n return minifiedContent;\n};\n\n/**\n * Utility to create safe & optimized inline-script\n * It does two things:\n * 1. Optimizes the minifies script as bundlers don't do that\n * 2. Creates `'sha256 ...'` (already escaped!) to use in CSP header\n */\nexport const createInlineScript = async (inlineScriptContent: string) => {\n const optimizedInlineScriptContent = await _minifyScript(inlineScriptContent);\n\n return {\n cspSha: _cspHash(optimizedInlineScriptContent),\n inlineScript: optimizedInlineScriptContent,\n };\n};\n"],"names":["_cspHash","scriptContent","startsWith","endsWith","Error","hash","createHash","update","digest","_minifyScript","minifiedContent","minify","code","createInlineScript","inlineScriptContent","optimizedInlineScriptContent","cspSha","inlineScript"],"mappings":";;;;;AASa,MAAAA,QAAA,GAAYC,aAAkC,IAAA;EACzD;EAAA;EAEEA,cAAcC,UAAW,CAAA,SAAS,CAClC,IAAAD,aAAA,CAAcE,SAAS,YAAW,CAAA,EAClC;IACA,MAAM,IAAIC,KAAA,CACR,iEAAA,CACF;EACF;EACM,MAAAC,IAAA,GAAOC,kBAAW,QAAQ,CAAA,CAAEC,OAAON,aAAa,CAAA,CAAEO,OAAO,QAAQ,CAAA;EACvE,
|
|
1
|
+
{"version":3,"file":"createInlineScript.js","sources":["../../../src/utils/nextjs/createInlineScript.ts"],"sourcesContent":["import { createHash } from \"crypto\";\nimport { minify } from \"terser\";\n\n/**\n * Returns a SHA256 hash using SHA-2 for the given `content`.\n * @private Internal library method!\n * @see https://en.wikipedia.org/wiki/SHA-2\n * @See https://futurestud.io/tutorials/node-js-calculate-a-sha256-hash\n */\nexport const _cspHash = (scriptContent: string): string => {\n if (\n // Naive approach but it sufficiernt for our use case\n scriptContent.startsWith(\"<script\") ||\n scriptContent.endsWith(\"</script>\")\n ) {\n throw new Error(\n \"Inline script should not be wrapped inside of <script><script/>\",\n );\n }\n const hash = createHash(\"sha256\").update(scriptContent).digest(\"base64\");\n return `'sha256-${hash}'`;\n};\n\n/**\n * Minifies the inline script for \"machine\" consumption\n * Uses `terser` (webpack minifier of choice) to minify the script\n * @private Internal library method!\n * @see https://github.com/terser/terser\n */\nexport const _minifyScript = async (scriptContent: string): Promise<string> => {\n const minifiedContent = (await minify(scriptContent, {})).code;\n if (!minifiedContent) {\n throw new Error(\n \"Missing minified code for some reason, check input for script content\",\n );\n }\n return minifiedContent;\n};\n\n/**\n * Utility to create safe & optimized inline-script\n * It does two things:\n * 1. Optimizes the minifies script as bundlers don't do that\n * 2. Creates `'sha256 ...'` (already escaped!) to use in CSP header\n */\nexport const createInlineScript = async (inlineScriptContent: string) => {\n const optimizedInlineScriptContent = await _minifyScript(inlineScriptContent);\n\n return {\n cspSha: _cspHash(optimizedInlineScriptContent),\n inlineScript: optimizedInlineScriptContent,\n };\n};\n"],"names":["_cspHash","scriptContent","startsWith","endsWith","Error","hash","createHash","update","digest","_minifyScript","minifiedContent","minify","code","createInlineScript","inlineScriptContent","optimizedInlineScriptContent","cspSha","inlineScript"],"mappings":";;;;;AASa,MAAAA,QAAA,GAAYC,aAAkC,IAAA;EACzD;EAAA;EAEEA,cAAcC,UAAW,CAAA,SAAS,CAClC,IAAAD,aAAA,CAAcE,SAAS,YAAW,CAAA,EAClC;IACA,MAAM,IAAIC,KAAA,CACR,iEAAA,CACF;EACF;EACM,MAAAC,IAAA,GAAOC,kBAAW,QAAQ,CAAA,CAAEC,OAAON,aAAa,CAAA,CAAEO,OAAO,QAAQ,CAAA;EACvE,OAAO,WAAWH,IAAI,GAAA;AACxB,CAAA;AAQa,MAAAI,aAAA,GAAgB,MAAOR,aAA2C,IAAA;EAC7E,MAAMS,mBAAmB,MAAMC,MAAAA,CAAAA,MAAA,CAAOV,aAAe,EAAA,CAAA,CAAE,CAAG,EAAAW,IAAA;EAC1D,IAAI,CAACF,eAAiB,EAAA;IACpB,MAAM,IAAIN,KAAA,CACR,uEAAA,CACF;EACF;EACO,OAAAM,eAAA;AACT,CAAA;AAQa,MAAAG,kBAAA,GAAqB,MAAOC,mBAAgC,IAAA;EACjE,MAAAC,4BAAA,GAA+B,MAAMN,aAAA,CAAcK,mBAAmB,CAAA;EAErE,OAAA;IACLE,MAAA,EAAQhB,SAASe,4BAA4B,CAAA;IAC7CE,YAAc,EAAAF;EAAA,CAChB;AACF,CAAA;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInlineScript.mjs","sources":["../../../src/utils/nextjs/createInlineScript.ts"],"sourcesContent":["import { createHash } from \"crypto\";\nimport { minify } from \"terser\";\n\n/**\n * Returns a SHA256 hash using SHA-2 for the given `content`.\n * @private Internal library method!\n * @see https://en.wikipedia.org/wiki/SHA-2\n * @See https://futurestud.io/tutorials/node-js-calculate-a-sha256-hash\n */\nexport const _cspHash = (scriptContent: string): string => {\n if (\n // Naive approach but it sufficiernt for our use case\n scriptContent.startsWith(\"<script\") ||\n scriptContent.endsWith(\"</script>\")\n ) {\n throw new Error(\n \"Inline script should not be wrapped inside of <script><script/>\",\n );\n }\n const hash = createHash(\"sha256\").update(scriptContent).digest(\"base64\");\n return `'sha256-${hash}'`;\n};\n\n/**\n * Minifies the inline script for \"machine\" consumption\n * Uses `terser` (webpack minifier of choice) to minify the script\n * @private Internal library method!\n * @see https://github.com/terser/terser\n */\nexport const _minifyScript = async (scriptContent: string): Promise<string> => {\n const minifiedContent = (await minify(scriptContent, {})).code;\n if (!minifiedContent) {\n throw new Error(\n \"Missing minified code for some reason, check input for script content\",\n );\n }\n return minifiedContent;\n};\n\n/**\n * Utility to create safe & optimized inline-script\n * It does two things:\n * 1. Optimizes the minifies script as bundlers don't do that\n * 2. Creates `'sha256 ...'` (already escaped!) to use in CSP header\n */\nexport const createInlineScript = async (inlineScriptContent: string) => {\n const optimizedInlineScriptContent = await _minifyScript(inlineScriptContent);\n\n return {\n cspSha: _cspHash(optimizedInlineScriptContent),\n inlineScript: optimizedInlineScriptContent,\n };\n};\n"],"names":["_cspHash","scriptContent","startsWith","endsWith","Error","hash","createHash","update","digest","_minifyScript","minifiedContent","minify","code","createInlineScript","inlineScriptContent","optimizedInlineScriptContent","cspSha","inlineScript"],"mappings":";;;AASa,MAAAA,QAAA,GAAYC,aAAkC,IAAA;EACzD;EAAA;EAEEA,cAAcC,UAAW,CAAA,SAAS,CAClC,IAAAD,aAAA,CAAcE,SAAS,YAAW,CAAA,EAClC;IACA,MAAM,IAAIC,KAAA,CACR,iEAAA,CACF;EACF;EACM,MAAAC,IAAA,GAAOC,WAAW,QAAQ,CAAA,CAAEC,OAAON,aAAa,CAAA,CAAEO,OAAO,QAAQ,CAAA;EACvE,
|
|
1
|
+
{"version":3,"file":"createInlineScript.mjs","sources":["../../../src/utils/nextjs/createInlineScript.ts"],"sourcesContent":["import { createHash } from \"crypto\";\nimport { minify } from \"terser\";\n\n/**\n * Returns a SHA256 hash using SHA-2 for the given `content`.\n * @private Internal library method!\n * @see https://en.wikipedia.org/wiki/SHA-2\n * @See https://futurestud.io/tutorials/node-js-calculate-a-sha256-hash\n */\nexport const _cspHash = (scriptContent: string): string => {\n if (\n // Naive approach but it sufficiernt for our use case\n scriptContent.startsWith(\"<script\") ||\n scriptContent.endsWith(\"</script>\")\n ) {\n throw new Error(\n \"Inline script should not be wrapped inside of <script><script/>\",\n );\n }\n const hash = createHash(\"sha256\").update(scriptContent).digest(\"base64\");\n return `'sha256-${hash}'`;\n};\n\n/**\n * Minifies the inline script for \"machine\" consumption\n * Uses `terser` (webpack minifier of choice) to minify the script\n * @private Internal library method!\n * @see https://github.com/terser/terser\n */\nexport const _minifyScript = async (scriptContent: string): Promise<string> => {\n const minifiedContent = (await minify(scriptContent, {})).code;\n if (!minifiedContent) {\n throw new Error(\n \"Missing minified code for some reason, check input for script content\",\n );\n }\n return minifiedContent;\n};\n\n/**\n * Utility to create safe & optimized inline-script\n * It does two things:\n * 1. Optimizes the minifies script as bundlers don't do that\n * 2. Creates `'sha256 ...'` (already escaped!) to use in CSP header\n */\nexport const createInlineScript = async (inlineScriptContent: string) => {\n const optimizedInlineScriptContent = await _minifyScript(inlineScriptContent);\n\n return {\n cspSha: _cspHash(optimizedInlineScriptContent),\n inlineScript: optimizedInlineScriptContent,\n };\n};\n"],"names":["_cspHash","scriptContent","startsWith","endsWith","Error","hash","createHash","update","digest","_minifyScript","minifiedContent","minify","code","createInlineScript","inlineScriptContent","optimizedInlineScriptContent","cspSha","inlineScript"],"mappings":";;;AASa,MAAAA,QAAA,GAAYC,aAAkC,IAAA;EACzD;EAAA;EAEEA,cAAcC,UAAW,CAAA,SAAS,CAClC,IAAAD,aAAA,CAAcE,SAAS,YAAW,CAAA,EAClC;IACA,MAAM,IAAIC,KAAA,CACR,iEAAA,CACF;EACF;EACM,MAAAC,IAAA,GAAOC,WAAW,QAAQ,CAAA,CAAEC,OAAON,aAAa,CAAA,CAAEO,OAAO,QAAQ,CAAA;EACvE,OAAO,WAAWH,IAAI,GAAA;AACxB,CAAA;AAQa,MAAAI,aAAA,GAAgB,MAAOR,aAA2C,IAAA;EAC7E,MAAMS,mBAAmB,MAAMC,MAAA,CAAOV,aAAe,EAAA,CAAA,CAAE,CAAG,EAAAW,IAAA;EAC1D,IAAI,CAACF,eAAiB,EAAA;IACpB,MAAM,IAAIN,KAAA,CACR,uEAAA,CACF;EACF;EACO,OAAAM,eAAA;AACT,CAAA;AAQa,MAAAG,kBAAA,GAAqB,MAAOC,mBAAgC,IAAA;EACjE,MAAAC,4BAAA,GAA+B,MAAMN,aAAA,CAAcK,mBAAmB,CAAA;EAErE,OAAA;IACLE,MAAA,EAAQhB,SAASe,4BAA4B,CAAA;IAC7CE,YAAc,EAAAF;EAAA,CAChB;AACF,CAAA;"}
|
|
@@ -2,4 +2,7 @@ export { createInlineScript } from "./createInlineScript";
|
|
|
2
2
|
export { stringifyForInject } from "./stringifyForInject";
|
|
3
3
|
export { mergeCspDirectives } from "./mergeCspDirectives";
|
|
4
4
|
export { sanitizeImageDomains } from "./sanitizeImageDomains";
|
|
5
|
+
export { withUbntLibraries } from "./plugin";
|
|
6
|
+
export { UiComponentsSsrStyleRegistryPagesRouter } from "./ssr/registry";
|
|
7
|
+
import "./ssr/style-inject";
|
|
5
8
|
export * from "./navigationPresets";
|
|
@@ -4,12 +4,17 @@ var createInlineScript = require('./createInlineScript.js');
|
|
|
4
4
|
var stringifyForInject = require('./stringifyForInject.js');
|
|
5
5
|
var mergeCspDirectives = require('./mergeCspDirectives.js');
|
|
6
6
|
var sanitizeImageDomains = require('./sanitizeImageDomains.js');
|
|
7
|
+
var plugin = require('./plugin.js');
|
|
8
|
+
var registry = require('./ssr/registry.js');
|
|
9
|
+
require('./ssr/style-inject.js');
|
|
7
10
|
var navigationPresets = require('./navigationPresets.js');
|
|
8
11
|
"use strict";
|
|
9
12
|
exports.createInlineScript = createInlineScript.createInlineScript;
|
|
10
13
|
exports.stringifyForInject = stringifyForInject.stringifyForInject;
|
|
11
14
|
exports.mergeCspDirectives = mergeCspDirectives.mergeCspDirectives;
|
|
12
15
|
exports.sanitizeImageDomains = sanitizeImageDomains.sanitizeImageDomains;
|
|
16
|
+
exports.withUbntLibraries = plugin.withUbntLibraries;
|
|
17
|
+
exports.UiComponentsSsrStyleRegistryPagesRouter = registry.UiComponentsSsrStyleRegistryPagesRouter;
|
|
13
18
|
exports.getGlobalSiteConfigByEnv = navigationPresets.getGlobalSiteConfigByEnv;
|
|
14
19
|
exports.getStoreRootUrlsByEnv = navigationPresets.getStoreRootUrlsByEnv;
|
|
15
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,6 +2,9 @@ export { createInlineScript } from './createInlineScript.mjs';
|
|
|
2
2
|
export { stringifyForInject } from './stringifyForInject.mjs';
|
|
3
3
|
export { mergeCspDirectives } from './mergeCspDirectives.mjs';
|
|
4
4
|
export { sanitizeImageDomains } from './sanitizeImageDomains.mjs';
|
|
5
|
+
export { withUbntLibraries } from './plugin.mjs';
|
|
6
|
+
export { UiComponentsSsrStyleRegistryPagesRouter } from './ssr/registry.mjs';
|
|
7
|
+
import './ssr/style-inject.mjs';
|
|
5
8
|
export { getGlobalSiteConfigByEnv, getStoreRootUrlsByEnv } from './navigationPresets.mjs';
|
|
6
9
|
"use strict";
|
|
7
10
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function patchUiComponentsAndIcons(): void;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var core = require('@babel/core');
|
|
7
|
+
var glob = require('glob');
|
|
8
|
+
var fs = require('node:fs');
|
|
9
|
+
var path = require('node:path');
|
|
10
|
+
var transformCssModule = require('./ssr/transform-css-module.js');
|
|
11
|
+
function _interopDefault(e) {
|
|
12
|
+
return e && e.__esModule ? e : {
|
|
13
|
+
default: e
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
17
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
18
|
+
"use strict";
|
|
19
|
+
function patchUiComponentsAndIcons() {
|
|
20
|
+
const uiComponentsPath = path__default["default"].dirname(require.resolve("@ubnt/ui-components"));
|
|
21
|
+
const ourStyleInjectPath = path__default["default"].resolve(__dirname, "./ssr/style-inject.mjs");
|
|
22
|
+
const originalStyleInjectPath = path__default["default"].resolve(uiComponentsPath, "./docs/helpers/style-inject.es.js");
|
|
23
|
+
fs__default["default"].copyFileSync(ourStyleInjectPath, originalStyleInjectPath);
|
|
24
|
+
const files = glob.sync("**/*.module.css.js", {
|
|
25
|
+
cwd: uiComponentsPath,
|
|
26
|
+
absolute: true
|
|
27
|
+
});
|
|
28
|
+
for (const file of files) {
|
|
29
|
+
const code = fs__default["default"].readFileSync(path__default["default"].resolve(file), {
|
|
30
|
+
encoding: "utf-8"
|
|
31
|
+
});
|
|
32
|
+
if (!code) {
|
|
33
|
+
throw new Error(`Failed to read file: ${file}`);
|
|
34
|
+
}
|
|
35
|
+
const output = core.transformSync(code, {
|
|
36
|
+
plugins: [transformCssModule.transformCssModule],
|
|
37
|
+
filename: file,
|
|
38
|
+
// Ignore .babelrc and babel.config.js for isolate testing of transformation
|
|
39
|
+
babelrc: false,
|
|
40
|
+
configFile: false,
|
|
41
|
+
sourceMaps: false
|
|
42
|
+
// Disable source maps for easier comparison
|
|
43
|
+
})?.code;
|
|
44
|
+
if (!output) {
|
|
45
|
+
throw new Error(`Failed to transform file: ${file}`);
|
|
46
|
+
}
|
|
47
|
+
fs__default["default"].writeFileSync(file, output, {
|
|
48
|
+
encoding: "utf-8"
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports["default"] = patchUiComponentsAndIcons;
|
|
53
|
+
//# sourceMappingURL=patch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch.js","sources":["../../../src/utils/nextjs/patch.ts"],"sourcesContent":["import { transformSync } from \"@babel/core\";\nimport { sync as globSync } from \"glob\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { transformCssModule } from \"./ssr/transform-css-module\";\n\n// #############################################################################\n// Fix @ubnt/icons bundle issue\n// Noticed using `npm run build:analyze` that server and _middleware builds included ~1MB @ubnt/icons even tho' it\n// isn't used. So analyzed it a bit and traced it down to being an issue with how @ubnt/icons are packaged.\n// Ideally @ubnt/icons should be fixed, but as a temporary solution we can use this script to fix it\n// #############################################################################\nexport default function patchUiComponentsAndIcons() {\n // const uiIconsPath = path.dirname(require.resolve(\"@ubnt/icons\"));\n const uiComponentsPath = path.dirname(require.resolve(\"@ubnt/ui-components\"));\n\n // // #############################################################################\n // // Fix package.json\n // // #############################################################################\n // const uiIconPkgJsonPath = path.resolve(uiIconsPath, \"./package.json\");\n // const uiIconPkgJson = JSON.parse(fs.readFileSync(uiIconPkgJsonPath, \"utf-8\"));\n\n // // Convert package from commonjs to module as it uses `exports` syntax but isn't marked as module thus the bundler\n // // opts out of certain optimizations\n // // Based on https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-move-my-commonjs-project-to-esm\n // delete uiIconPkgJson.main;\n // uiIconPkgJson.type = \"module\";\n // uiIconPkgJson.exports = {\n // \".\": \"./index.js\",\n // \"./*\": \"./*.js\",\n // };\n\n // // Mark that package doesn't have side-effects, it already had this but, just in case attempt to add it again\n // uiIconPkgJson.sideEffects = false;\n\n // // Update the file\n // fs.writeFileSync(uiIconPkgJsonPath, JSON.stringify(uiIconPkgJson, null, 2));\n\n // // #############################################################################\n // // Reimplement index.js file, as it reimplements same icon instead of re-exporting it, thus creating duplicate code\n // // So it was:\n // // const a = /* ...*/\n // // const b = /* ...*/\n // // exports { a as UiIconA, b as UiIconB };\n // //\n // // But it should be:\n // // export {default as UiIconA} from './UiIconA.js';\n // // export {default as UiIconB} from './UiIconB.js';\n // //\n // // To fix that we list all icon files and create a index.js from the ground where a re-export things\n // // #############################################################################\n // // Find all icon files - right now all files that end with .js\n // const uiIconsFilesRaw = fs.readdirSync(uiIconsPath);\n // const filesToExclude = [\"index.js\"];\n // const uiIconsFiles = uiIconsFilesRaw.filter(\n // (file) => file.endsWith(\".js\") && !filesToExclude.includes(file),\n // );\n\n // // Create content of new file\n // const newIndexJs = uiIconsFiles\n // .map((fileWithExtension) => {\n // const file = path.parse(fileWithExtension).name;\n // return `export {default as ${file}} from \"./${fileWithExtension}\";`;\n // })\n // .join(\"\\n\");\n\n // // Overwrite the current file\n // fs.writeFileSync(path.join(uiIconsPath, \"index.js\"), newIndexJs);\n\n // // #############################################################################\n // // Fix @ubnt/ui-components package.json\n // // #############################################################################\n // const uiComponentsPkgJsonPath = path.resolve(\n // uiComponentsIconsPath,\n // \"./package.json\",\n // );\n // const uiComponentsPkgJson = JSON.parse(\n // fs.readFileSync(uiComponentsPkgJsonPath, \"utf-8\"),\n // );\n\n // // Convert package from commonjs to module as it uses `exports` syntax but isn't marked as module thus the bundler\n // // opts out of certain optimizations\n // // Based on https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-move-my-commonjs-project-to-esm\n // // delete uiComponentsPkgJson.main;\n // // \"main\": \"index.js\",\n // uiComponentsPkgJson.type = \"module\";\n // // uiComponentsPkgJson.exports = {\n // // \".\": \"./index.js\",\n // // \"./*\": \"*/index.js\",\n // // \"./styles/normalize.css\": \"./styles/normalize.css\"\n // // };\n\n // // Update the file\n // fs.writeFileSync(\n // uiComponentsPkgJsonPath,\n // JSON.stringify(uiComponentsPkgJson, null, 2),\n // );\n\n // #############################################################################\n // Replace `@ubnt/ui-components/docs/helpers/style-inject.es.js` with our own SSR compatible version\n // #############################################################################\n // Using mjs version as it doesn't have extra unneeded module-->cjs fluff\n const ourStyleInjectPath = path.resolve(__dirname, \"./ssr/style-inject.mjs\");\n const originalStyleInjectPath = path.resolve(\n uiComponentsPath,\n \"./docs/helpers/style-inject.es.js\",\n );\n // FIXME: minify our file\n fs.copyFileSync(ourStyleInjectPath, originalStyleInjectPath);\n\n // #############################################################################\n // Transform all `@ubnt/ui-components/**/*.module.css.js` files\n // #############################################################################\n const files = globSync(\"**/*.module.css.js\", {\n cwd: uiComponentsPath,\n absolute: true,\n });\n\n for (const file of files) {\n const code = fs.readFileSync(path.resolve(file), { encoding: \"utf-8\" });\n if (!code) {\n throw new Error(`Failed to read file: ${file}`);\n }\n const output = transformSync(code, {\n plugins: [transformCssModule],\n filename: file,\n // Ignore .babelrc and babel.config.js for isolate testing of transformation\n babelrc: false,\n configFile: false,\n sourceMaps: false, // Disable source maps for easier comparison\n })?.code;\n if (!output) {\n throw new Error(`Failed to transform file: ${file}`);\n }\n fs.writeFileSync(file, output, { encoding: \"utf-8\" });\n }\n}\n"],"names":["patchUiComponentsAndIcons","uiComponentsPath","path","dirname","require","resolve","ourStyleInjectPath","__dirname","originalStyleInjectPath","fs","copyFileSync","files","globSync","cwd","absolute","file","code","readFileSync","encoding","Error","output","transformSync","plugins","transformCssModule","filename","babelrc","configFile","sourceMaps","writeFileSync"],"mappings":";;;;;;;;;;;;;;;;;;AAaA,SAAwBA,yBAA4BA,CAAA,EAAA;EAElD,MAAMC,mBAAmBC,aAAAA,CAAAA,SAAAA,CAAK,CAAAC,OAAA,CAAQC,OAAQ,CAAAC,OAAA,CAAQ,qBAAqB,CAAC,CAAA;EAwF5E,MAAMC,kBAAqB,GAAAJ,aAA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node:path';
|
|
5
|
+
import { transformCssModule } from './ssr/transform-css-module.mjs';
|
|
6
|
+
"use strict";
|
|
7
|
+
function patchUiComponentsAndIcons() {
|
|
8
|
+
const uiComponentsPath = path.dirname(require.resolve("@ubnt/ui-components"));
|
|
9
|
+
const ourStyleInjectPath = path.resolve(__dirname, "./ssr/style-inject.mjs");
|
|
10
|
+
const originalStyleInjectPath = path.resolve(uiComponentsPath, "./docs/helpers/style-inject.es.js");
|
|
11
|
+
fs.copyFileSync(ourStyleInjectPath, originalStyleInjectPath);
|
|
12
|
+
const files = sync("**/*.module.css.js", {
|
|
13
|
+
cwd: uiComponentsPath,
|
|
14
|
+
absolute: true
|
|
15
|
+
});
|
|
16
|
+
for (const file of files) {
|
|
17
|
+
const code = fs.readFileSync(path.resolve(file), {
|
|
18
|
+
encoding: "utf-8"
|
|
19
|
+
});
|
|
20
|
+
if (!code) {
|
|
21
|
+
throw new Error(`Failed to read file: ${file}`);
|
|
22
|
+
}
|
|
23
|
+
const output = transformSync(code, {
|
|
24
|
+
plugins: [transformCssModule],
|
|
25
|
+
filename: file,
|
|
26
|
+
// Ignore .babelrc and babel.config.js for isolate testing of transformation
|
|
27
|
+
babelrc: false,
|
|
28
|
+
configFile: false,
|
|
29
|
+
sourceMaps: false
|
|
30
|
+
// Disable source maps for easier comparison
|
|
31
|
+
})?.code;
|
|
32
|
+
if (!output) {
|
|
33
|
+
throw new Error(`Failed to transform file: ${file}`);
|
|
34
|
+
}
|
|
35
|
+
fs.writeFileSync(file, output, {
|
|
36
|
+
encoding: "utf-8"
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export { patchUiComponentsAndIcons as default };
|
|
41
|
+
//# sourceMappingURL=patch.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch.mjs","sources":["../../../src/utils/nextjs/patch.ts"],"sourcesContent":["import { transformSync } from \"@babel/core\";\nimport { sync as globSync } from \"glob\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { transformCssModule } from \"./ssr/transform-css-module\";\n\n// #############################################################################\n// Fix @ubnt/icons bundle issue\n// Noticed using `npm run build:analyze` that server and _middleware builds included ~1MB @ubnt/icons even tho' it\n// isn't used. So analyzed it a bit and traced it down to being an issue with how @ubnt/icons are packaged.\n// Ideally @ubnt/icons should be fixed, but as a temporary solution we can use this script to fix it\n// #############################################################################\nexport default function patchUiComponentsAndIcons() {\n // const uiIconsPath = path.dirname(require.resolve(\"@ubnt/icons\"));\n const uiComponentsPath = path.dirname(require.resolve(\"@ubnt/ui-components\"));\n\n // // #############################################################################\n // // Fix package.json\n // // #############################################################################\n // const uiIconPkgJsonPath = path.resolve(uiIconsPath, \"./package.json\");\n // const uiIconPkgJson = JSON.parse(fs.readFileSync(uiIconPkgJsonPath, \"utf-8\"));\n\n // // Convert package from commonjs to module as it uses `exports` syntax but isn't marked as module thus the bundler\n // // opts out of certain optimizations\n // // Based on https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-move-my-commonjs-project-to-esm\n // delete uiIconPkgJson.main;\n // uiIconPkgJson.type = \"module\";\n // uiIconPkgJson.exports = {\n // \".\": \"./index.js\",\n // \"./*\": \"./*.js\",\n // };\n\n // // Mark that package doesn't have side-effects, it already had this but, just in case attempt to add it again\n // uiIconPkgJson.sideEffects = false;\n\n // // Update the file\n // fs.writeFileSync(uiIconPkgJsonPath, JSON.stringify(uiIconPkgJson, null, 2));\n\n // // #############################################################################\n // // Reimplement index.js file, as it reimplements same icon instead of re-exporting it, thus creating duplicate code\n // // So it was:\n // // const a = /* ...*/\n // // const b = /* ...*/\n // // exports { a as UiIconA, b as UiIconB };\n // //\n // // But it should be:\n // // export {default as UiIconA} from './UiIconA.js';\n // // export {default as UiIconB} from './UiIconB.js';\n // //\n // // To fix that we list all icon files and create a index.js from the ground where a re-export things\n // // #############################################################################\n // // Find all icon files - right now all files that end with .js\n // const uiIconsFilesRaw = fs.readdirSync(uiIconsPath);\n // const filesToExclude = [\"index.js\"];\n // const uiIconsFiles = uiIconsFilesRaw.filter(\n // (file) => file.endsWith(\".js\") && !filesToExclude.includes(file),\n // );\n\n // // Create content of new file\n // const newIndexJs = uiIconsFiles\n // .map((fileWithExtension) => {\n // const file = path.parse(fileWithExtension).name;\n // return `export {default as ${file}} from \"./${fileWithExtension}\";`;\n // })\n // .join(\"\\n\");\n\n // // Overwrite the current file\n // fs.writeFileSync(path.join(uiIconsPath, \"index.js\"), newIndexJs);\n\n // // #############################################################################\n // // Fix @ubnt/ui-components package.json\n // // #############################################################################\n // const uiComponentsPkgJsonPath = path.resolve(\n // uiComponentsIconsPath,\n // \"./package.json\",\n // );\n // const uiComponentsPkgJson = JSON.parse(\n // fs.readFileSync(uiComponentsPkgJsonPath, \"utf-8\"),\n // );\n\n // // Convert package from commonjs to module as it uses `exports` syntax but isn't marked as module thus the bundler\n // // opts out of certain optimizations\n // // Based on https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-move-my-commonjs-project-to-esm\n // // delete uiComponentsPkgJson.main;\n // // \"main\": \"index.js\",\n // uiComponentsPkgJson.type = \"module\";\n // // uiComponentsPkgJson.exports = {\n // // \".\": \"./index.js\",\n // // \"./*\": \"*/index.js\",\n // // \"./styles/normalize.css\": \"./styles/normalize.css\"\n // // };\n\n // // Update the file\n // fs.writeFileSync(\n // uiComponentsPkgJsonPath,\n // JSON.stringify(uiComponentsPkgJson, null, 2),\n // );\n\n // #############################################################################\n // Replace `@ubnt/ui-components/docs/helpers/style-inject.es.js` with our own SSR compatible version\n // #############################################################################\n // Using mjs version as it doesn't have extra unneeded module-->cjs fluff\n const ourStyleInjectPath = path.resolve(__dirname, \"./ssr/style-inject.mjs\");\n const originalStyleInjectPath = path.resolve(\n uiComponentsPath,\n \"./docs/helpers/style-inject.es.js\",\n );\n // FIXME: minify our file\n fs.copyFileSync(ourStyleInjectPath, originalStyleInjectPath);\n\n // #############################################################################\n // Transform all `@ubnt/ui-components/**/*.module.css.js` files\n // #############################################################################\n const files = globSync(\"**/*.module.css.js\", {\n cwd: uiComponentsPath,\n absolute: true,\n });\n\n for (const file of files) {\n const code = fs.readFileSync(path.resolve(file), { encoding: \"utf-8\" });\n if (!code) {\n throw new Error(`Failed to read file: ${file}`);\n }\n const output = transformSync(code, {\n plugins: [transformCssModule],\n filename: file,\n // Ignore .babelrc and babel.config.js for isolate testing of transformation\n babelrc: false,\n configFile: false,\n sourceMaps: false, // Disable source maps for easier comparison\n })?.code;\n if (!output) {\n throw new Error(`Failed to transform file: ${file}`);\n }\n fs.writeFileSync(file, output, { encoding: \"utf-8\" });\n }\n}\n"],"names":["patchUiComponentsAndIcons","uiComponentsPath","path","dirname","require","resolve","ourStyleInjectPath","__dirname","originalStyleInjectPath","fs","copyFileSync","files","globSync","cwd","absolute","file","code","readFileSync","encoding","Error","output","transformSync","plugins","transformCssModule","filename","babelrc","configFile","sourceMaps","writeFileSync"],"mappings":";;;;;;AAaA,SAAwBA,yBAA4BA,CAAA,EAAA;EAElD,MAAMC,mBAAmBC,IAAK,CAAAC,OAAA,CAAQC,OAAQ,CAAAC,OAAA,CAAQ,qBAAqB,CAAC,CAAA;EAwF5E,MAAMC,kBAAqB,GAAAJ,IAAA,CAAKG,OAAQ,CAAAE,SAAA,EAAW,wBAAwB,CAAA;EAC3E,MAAMC,0BAA0BN,IAAK,CAAAG,OAAA,CACnCJ,gBAAA,EACA,mCAAA,CACF;EAEGQ,EAAA,CAAAC,YAAA,CAAaJ,oBAAoBE,uBAAuB,CAAA;EAKrD,MAAAG,KAAA,GAAQC,KAAS,oBAAsB,EAAA;IAC3CC,GAAK,EAAAZ,gBAAA;IACLa,QAAU,EAAA;EAAA,CACX,CAAA;EAED,KAAA,MAAWC,QAAQJ,KAAO,EAAA;IAClB,MAAAK,IAAA,GAAOP,EAAG,CAAAQ,YAAA,CAAaf,IAAK,CAAAG,OAAA,CAAQU,IAAI,CAAG,EAAA;MAAEG,QAAU,EAAA;IAAA,CAAS,CAAA;IACtE,IAAI,CAACF,IAAM,EAAA;MACT,MAAM,IAAIG,KAAA,CAAM,wBAAwBJ,IAAI,EAAE,CAAA;IAChD;IACM,MAAAK,MAAA,GAASC,cAAcL,IAAM,EAAA;MACjCM,OAAA,EAAS,CAACC,kBAAkB,CAAA;MAC5BC,QAAU,EAAAT,IAAA;MAAA;MAEVU,OAAS,EAAA,KAAA;MACTC,UAAY,EAAA,KAAA;MACZC,UAAY,EAAA;MAAA;IACb,CAAA,CAAG,EAAAX,IAAA;IACJ,IAAI,CAACI,MAAQ,EAAA;MACX,MAAM,IAAID,KAAA,CAAM,6BAA6BJ,IAAI,EAAE,CAAA;IACrD;IACAN,EAAA,CAAGmB,cAAcb,IAAM,EAAAK,MAAA,EAAQ;MAAEF,QAAA,EAAU;KAAS,CAAA;EACtD;AACF;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { NextConfig } from "next";
|
|
2
|
+
export type WithUbntLibrariesConfig = {
|
|
3
|
+
/**
|
|
4
|
+
* ESM Modules to transpile
|
|
5
|
+
*/
|
|
6
|
+
transpilePackages?: string[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Next.config.js plugin to enable support for @ubnt/ui-components, @ubnt/icons, @ubnt/store.core and other common
|
|
10
|
+
* patterns for next.js projects
|
|
11
|
+
*
|
|
12
|
+
* ! Don't forget about adding SSR registry, see `./registry.tsx` for more info!
|
|
13
|
+
*/
|
|
14
|
+
export declare function withUbntLibraries(options?: WithUbntLibrariesConfig): (nextConfig: NextConfig) => NextConfig;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var array = require('../array.js');
|
|
4
|
+
var patch = require('./patch.js');
|
|
5
|
+
"use strict";
|
|
6
|
+
function withUbntLibraries(options) {
|
|
7
|
+
patch["default"]();
|
|
8
|
+
const transpilePackages = [
|
|
9
|
+
// Extra libs
|
|
10
|
+
...(options?.transpilePackages ?? []),
|
|
11
|
+
// Core repos
|
|
12
|
+
"@ubnt/ui-components", "@ubnt/icons", "@ubnt/store.core",
|
|
13
|
+
// Additional dependencies needed for @ubnt/ui-components, @ubnt/store.core, ...
|
|
14
|
+
"lodash-es", "styled-components", "react-use", "convert-units"
|
|
15
|
+
// Currently as of 3.0.0-beta.5 caused prod build issues on consumer projects
|
|
16
|
+
];
|
|
17
|
+
return nextConfig => {
|
|
18
|
+
if (!nextConfig.experimental) {
|
|
19
|
+
nextConfig.experimental = {};
|
|
20
|
+
}
|
|
21
|
+
nextConfig.experimental.optimizePackageImports = array.dedupe([...(nextConfig.experimental.optimizePackageImports ?? []), ...transpilePackages]);
|
|
22
|
+
nextConfig.transpilePackages = array.dedupe([...(nextConfig.transpilePackages ?? []), ...transpilePackages]);
|
|
23
|
+
nextConfig.experimental.esmExternals = "loose";
|
|
24
|
+
const oldWebpackFn = nextConfig.webpack;
|
|
25
|
+
nextConfig.webpack = (webpackConfig, options2) => {
|
|
26
|
+
if (oldWebpackFn) {
|
|
27
|
+
webpackConfig = oldWebpackFn(webpackConfig, options2);
|
|
28
|
+
}
|
|
29
|
+
const jsExtIndex = webpackConfig.resolve.extensions.indexOf(".js");
|
|
30
|
+
const mjsExtIndex = webpackConfig.resolve.extensions.indexOf(".mjs");
|
|
31
|
+
if (jsExtIndex !== -1 && mjsExtIndex !== -1 && mjsExtIndex > jsExtIndex) {
|
|
32
|
+
webpackConfig.resolve.extensions[jsExtIndex] = ".mjs";
|
|
33
|
+
webpackConfig.resolve.extensions[mjsExtIndex] = ".js";
|
|
34
|
+
}
|
|
35
|
+
return webpackConfig;
|
|
36
|
+
};
|
|
37
|
+
return nextConfig;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
exports.withUbntLibraries = withUbntLibraries;
|
|
41
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["../../../src/utils/nextjs/plugin.ts"],"sourcesContent":["import type { NextConfig } from \"next\";\n\nimport { dedupe } from \"../array\";\nimport patchUiComponentsAndIcons from \"./patch\";\n\nexport type WithUbntLibrariesConfig = {\n /**\n * ESM Modules to transpile\n */\n transpilePackages?: string[];\n};\n\n/**\n * Next.config.js plugin to enable support for @ubnt/ui-components, @ubnt/icons, @ubnt/store.core and other common\n * patterns for next.js projects\n *\n * ! Don't forget about adding SSR registry, see `./registry.tsx` for more info!\n */\nexport function withUbntLibraries(options?: WithUbntLibrariesConfig) {\n /**\n * Run script that patches `@ubnt/ui-components` and `@ubnt/icons` files\n */\n patchUiComponentsAndIcons();\n\n const transpilePackages = [\n // Extra libs\n ...(options?.transpilePackages ?? []),\n // Core repos\n \"@ubnt/ui-components\",\n \"@ubnt/icons\",\n \"@ubnt/store.core\",\n // Additional dependencies needed for @ubnt/ui-components, @ubnt/store.core, ...\n \"lodash-es\",\n \"styled-components\",\n \"react-use\",\n \"convert-units\", // Currently as of 3.0.0-beta.5 caused prod build issues on consumer projects\n ];\n\n return (nextConfig: NextConfig): NextConfig => {\n /**\n * Needed to transpile `@ubnt/ui-components` and `@ubnt/icons` packages as they are packaged as ESM modules\n * @see https://nextjs.org/docs/app/api-reference/next-config-js/optimizePackageImports\n */\n if (!nextConfig.experimental) {\n nextConfig.experimental = {};\n }\n nextConfig.experimental.optimizePackageImports = dedupe([\n ...(nextConfig.experimental.optimizePackageImports ?? []),\n ...transpilePackages,\n ]);\n nextConfig.transpilePackages = dedupe([\n ...(nextConfig.transpilePackages ?? []),\n ...transpilePackages,\n ]);\n\n /**\n * Solution to fix `@ubnt/store.core` using ui-components which is \"esm+module\" mix-match and fix following error:\n *\n * ./node_modules/@ubnt/store.core/lib/components/VariantSelector/VariantSelector.styles.js\n * Module not found: ESM packages (@ubnt/ui-components/Button) need to be imported. Use 'import' to reference the\n * package instead. https://nextjs.org/docs/messages/import-esm-externals\n *\n * @see https://nextjs.org/docs/messages/import-esm-externals\n */\n nextConfig.experimental.esmExternals = \"loose\";\n\n /**\n * Needed only to resolve issue with SSR for @ubnt/store.core package using @ubnt/ui-components as they are\n * packaged as CJS while it's actually MJS.\n * In order to fix the issue we to flip how next.js resolved modules for Node.js SSR builds, so we split ordering so\n * .mjs which our @ubnt/store.core has is a preferred over CJS\n * @see https://github.com/vercel/next.js/blob/canary/packages/next/build/webpack-config.ts#L875\n */\n const oldWebpackFn = nextConfig.webpack;\n nextConfig.webpack = (webpackConfig, options) => {\n if (oldWebpackFn) {\n webpackConfig = oldWebpackFn(webpackConfig, options);\n }\n\n const jsExtIndex = webpackConfig.resolve.extensions.indexOf(\".js\");\n const mjsExtIndex = webpackConfig.resolve.extensions.indexOf(\".mjs\");\n if (jsExtIndex !== -1 && mjsExtIndex !== -1 && mjsExtIndex > jsExtIndex) {\n webpackConfig.resolve.extensions[jsExtIndex] = \".mjs\";\n webpackConfig.resolve.extensions[mjsExtIndex] = \".js\";\n }\n\n return webpackConfig;\n };\n\n return nextConfig;\n };\n}\n"],"names":["withUbntLibraries","options","patchUiComponentsAndIcons","transpilePackages","nextConfig","experimental","optimizePackageImports","dedupe","esmExternals","oldWebpackFn","webpack","webpackConfig","jsExtIndex","resolve","extensions","indexOf","mjsExtIndex"],"mappings":";;;;;AAkBO,SAASA,kBAAkBC,OAAmC,EAAA;EAIzCC,KAAAA,CAAAA,SAAAA,CAAA,EAAA;EAE1B,MAAMC,iBAAoB,GAAA;EAAA;EAExB,IAAIF,OAAS,EAAAE,iBAAA,IAAqB,EAAC;EAAA;EAEnC,qBAAA,EACA,aAAA,EACA,kBAAA;EAAA;EAEA,WAAA,EACA,mBAAA,EACA,WAAA,EACA;EAAA;EAAA,CACF;EAEA,OAAQC,UAAuC,IAAA;IAKzC,IAAA,CAACA,WAAWC,YAAc,EAAA;MAC5BD,UAAA,CAAWC,eAAe,EAAC;IAC7B;IACWD,UAAA,CAAAC,YAAA,CAAaC,yBAAyBC,YAAO,CAAA,CACtD,IAAIH,UAAA,CAAWC,YAAa,CAAAC,sBAAA,IAA0B,EAAC,GACvD,GAAGH,iBAAA,CACJ,CAAA;IACDC,UAAA,CAAWD,oBAAoBI,YAAO,CAAA,CACpC,IAAIH,UAAW,CAAAD,iBAAA,IAAqB,EAAC,GACrC,GAAGA,iBAAA,CACJ,CAAA;IAWDC,UAAA,CAAWC,aAAaG,YAAe,GAAA,OAAA;IASvC,MAAMC,eAAeL,UAAW,CAAAM,OAAA;IACrBN,UAAA,CAAAM,OAAA,GAAU,CAACC,aAAA,EAAeV,QAAY,KAAA;MAC/C,IAAIQ,YAAc,EAAA;QACAE,aAAA,GAAAF,YAAA,CAAaE,eAAeV,QAAO,CAAA;MACrD;MAEA,MAAMW,UAAa,GAAAD,aAAA,CAAcE,OAAQ,CAAAC,UAAA,CAAWC,QAAQ,KAAK,CAAA;MACjE,MAAMC,WAAc,GAAAL,aAAA,CAAcE,OAAQ,CAAAC,UAAA,CAAWC,QAAQ,MAAM,CAAA;MACnE,IAAIH,UAAe,KAAA,CAAA,CAAA,IAAMI,WAAgB,KAAA,CAAA,CAAA,IAAMA,cAAcJ,UAAY,EAAA;QACzDD,aAAA,CAAAE,OAAA,CAAQC,UAAW,CAAAF,UAAU,CAAI,GAAA,MAAA;QACjCD,aAAA,CAAAE,OAAA,CAAQC,UAAW,CAAAE,WAAW,CAAI,GAAA,KAAA;MAClD;MAEO,OAAAL,aAAA;IAAA,CACT;IAEO,OAAAP,UAAA;EAAA,CACT;AACF;"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { dedupe } from '../array.mjs';
|
|
2
|
+
import patchUiComponentsAndIcons from './patch.mjs';
|
|
3
|
+
"use strict";
|
|
4
|
+
function withUbntLibraries(options) {
|
|
5
|
+
patchUiComponentsAndIcons();
|
|
6
|
+
const transpilePackages = [
|
|
7
|
+
// Extra libs
|
|
8
|
+
...(options?.transpilePackages ?? []),
|
|
9
|
+
// Core repos
|
|
10
|
+
"@ubnt/ui-components", "@ubnt/icons", "@ubnt/store.core",
|
|
11
|
+
// Additional dependencies needed for @ubnt/ui-components, @ubnt/store.core, ...
|
|
12
|
+
"lodash-es", "styled-components", "react-use", "convert-units"
|
|
13
|
+
// Currently as of 3.0.0-beta.5 caused prod build issues on consumer projects
|
|
14
|
+
];
|
|
15
|
+
return nextConfig => {
|
|
16
|
+
if (!nextConfig.experimental) {
|
|
17
|
+
nextConfig.experimental = {};
|
|
18
|
+
}
|
|
19
|
+
nextConfig.experimental.optimizePackageImports = dedupe([...(nextConfig.experimental.optimizePackageImports ?? []), ...transpilePackages]);
|
|
20
|
+
nextConfig.transpilePackages = dedupe([...(nextConfig.transpilePackages ?? []), ...transpilePackages]);
|
|
21
|
+
nextConfig.experimental.esmExternals = "loose";
|
|
22
|
+
const oldWebpackFn = nextConfig.webpack;
|
|
23
|
+
nextConfig.webpack = (webpackConfig, options2) => {
|
|
24
|
+
if (oldWebpackFn) {
|
|
25
|
+
webpackConfig = oldWebpackFn(webpackConfig, options2);
|
|
26
|
+
}
|
|
27
|
+
const jsExtIndex = webpackConfig.resolve.extensions.indexOf(".js");
|
|
28
|
+
const mjsExtIndex = webpackConfig.resolve.extensions.indexOf(".mjs");
|
|
29
|
+
if (jsExtIndex !== -1 && mjsExtIndex !== -1 && mjsExtIndex > jsExtIndex) {
|
|
30
|
+
webpackConfig.resolve.extensions[jsExtIndex] = ".mjs";
|
|
31
|
+
webpackConfig.resolve.extensions[mjsExtIndex] = ".js";
|
|
32
|
+
}
|
|
33
|
+
return webpackConfig;
|
|
34
|
+
};
|
|
35
|
+
return nextConfig;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export { withUbntLibraries };
|
|
39
|
+
//# sourceMappingURL=plugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.mjs","sources":["../../../src/utils/nextjs/plugin.ts"],"sourcesContent":["import type { NextConfig } from \"next\";\n\nimport { dedupe } from \"../array\";\nimport patchUiComponentsAndIcons from \"./patch\";\n\nexport type WithUbntLibrariesConfig = {\n /**\n * ESM Modules to transpile\n */\n transpilePackages?: string[];\n};\n\n/**\n * Next.config.js plugin to enable support for @ubnt/ui-components, @ubnt/icons, @ubnt/store.core and other common\n * patterns for next.js projects\n *\n * ! Don't forget about adding SSR registry, see `./registry.tsx` for more info!\n */\nexport function withUbntLibraries(options?: WithUbntLibrariesConfig) {\n /**\n * Run script that patches `@ubnt/ui-components` and `@ubnt/icons` files\n */\n patchUiComponentsAndIcons();\n\n const transpilePackages = [\n // Extra libs\n ...(options?.transpilePackages ?? []),\n // Core repos\n \"@ubnt/ui-components\",\n \"@ubnt/icons\",\n \"@ubnt/store.core\",\n // Additional dependencies needed for @ubnt/ui-components, @ubnt/store.core, ...\n \"lodash-es\",\n \"styled-components\",\n \"react-use\",\n \"convert-units\", // Currently as of 3.0.0-beta.5 caused prod build issues on consumer projects\n ];\n\n return (nextConfig: NextConfig): NextConfig => {\n /**\n * Needed to transpile `@ubnt/ui-components` and `@ubnt/icons` packages as they are packaged as ESM modules\n * @see https://nextjs.org/docs/app/api-reference/next-config-js/optimizePackageImports\n */\n if (!nextConfig.experimental) {\n nextConfig.experimental = {};\n }\n nextConfig.experimental.optimizePackageImports = dedupe([\n ...(nextConfig.experimental.optimizePackageImports ?? []),\n ...transpilePackages,\n ]);\n nextConfig.transpilePackages = dedupe([\n ...(nextConfig.transpilePackages ?? []),\n ...transpilePackages,\n ]);\n\n /**\n * Solution to fix `@ubnt/store.core` using ui-components which is \"esm+module\" mix-match and fix following error:\n *\n * ./node_modules/@ubnt/store.core/lib/components/VariantSelector/VariantSelector.styles.js\n * Module not found: ESM packages (@ubnt/ui-components/Button) need to be imported. Use 'import' to reference the\n * package instead. https://nextjs.org/docs/messages/import-esm-externals\n *\n * @see https://nextjs.org/docs/messages/import-esm-externals\n */\n nextConfig.experimental.esmExternals = \"loose\";\n\n /**\n * Needed only to resolve issue with SSR for @ubnt/store.core package using @ubnt/ui-components as they are\n * packaged as CJS while it's actually MJS.\n * In order to fix the issue we to flip how next.js resolved modules for Node.js SSR builds, so we split ordering so\n * .mjs which our @ubnt/store.core has is a preferred over CJS\n * @see https://github.com/vercel/next.js/blob/canary/packages/next/build/webpack-config.ts#L875\n */\n const oldWebpackFn = nextConfig.webpack;\n nextConfig.webpack = (webpackConfig, options) => {\n if (oldWebpackFn) {\n webpackConfig = oldWebpackFn(webpackConfig, options);\n }\n\n const jsExtIndex = webpackConfig.resolve.extensions.indexOf(\".js\");\n const mjsExtIndex = webpackConfig.resolve.extensions.indexOf(\".mjs\");\n if (jsExtIndex !== -1 && mjsExtIndex !== -1 && mjsExtIndex > jsExtIndex) {\n webpackConfig.resolve.extensions[jsExtIndex] = \".mjs\";\n webpackConfig.resolve.extensions[mjsExtIndex] = \".js\";\n }\n\n return webpackConfig;\n };\n\n return nextConfig;\n };\n}\n"],"names":["withUbntLibraries","options","patchUiComponentsAndIcons","transpilePackages","nextConfig","experimental","optimizePackageImports","dedupe","esmExternals","oldWebpackFn","webpack","webpackConfig","jsExtIndex","resolve","extensions","indexOf","mjsExtIndex"],"mappings":";;;AAkBO,SAASA,kBAAkBC,OAAmC,EAAA;EAIzCC,yBAAA,EAAA;EAE1B,MAAMC,iBAAoB,GAAA;EAAA;EAExB,IAAIF,OAAS,EAAAE,iBAAA,IAAqB,EAAC;EAAA;EAEnC,qBAAA,EACA,aAAA,EACA,kBAAA;EAAA;EAEA,WAAA,EACA,mBAAA,EACA,WAAA,EACA;EAAA;EAAA,CACF;EAEA,OAAQC,UAAuC,IAAA;IAKzC,IAAA,CAACA,WAAWC,YAAc,EAAA;MAC5BD,UAAA,CAAWC,eAAe,EAAC;IAC7B;IACWD,UAAA,CAAAC,YAAA,CAAaC,yBAAyBC,MAAO,CAAA,CACtD,IAAIH,UAAA,CAAWC,YAAa,CAAAC,sBAAA,IAA0B,EAAC,GACvD,GAAGH,iBAAA,CACJ,CAAA;IACDC,UAAA,CAAWD,oBAAoBI,MAAO,CAAA,CACpC,IAAIH,UAAW,CAAAD,iBAAA,IAAqB,EAAC,GACrC,GAAGA,iBAAA,CACJ,CAAA;IAWDC,UAAA,CAAWC,aAAaG,YAAe,GAAA,OAAA;IASvC,MAAMC,eAAeL,UAAW,CAAAM,OAAA;IACrBN,UAAA,CAAAM,OAAA,GAAU,CAACC,aAAA,EAAeV,QAAY,KAAA;MAC/C,IAAIQ,YAAc,EAAA;QACAE,aAAA,GAAAF,YAAA,CAAaE,eAAeV,QAAO,CAAA;MACrD;MAEA,MAAMW,UAAa,GAAAD,aAAA,CAAcE,OAAQ,CAAAC,UAAA,CAAWC,QAAQ,KAAK,CAAA;MACjE,MAAMC,WAAc,GAAAL,aAAA,CAAcE,OAAQ,CAAAC,UAAA,CAAWC,QAAQ,MAAM,CAAA;MACnE,IAAIH,UAAe,KAAA,CAAA,CAAA,IAAMI,WAAgB,KAAA,CAAA,CAAA,IAAMA,cAAcJ,UAAY,EAAA;QACzDD,aAAA,CAAAE,OAAA,CAAQC,UAAW,CAAAF,UAAU,CAAI,GAAA,MAAA;QACjCD,aAAA,CAAAE,OAAA,CAAQC,UAAW,CAAAE,WAAW,CAAI,GAAA,KAAA;MAClD;MAEO,OAAAL,aAAA;IAAA,CACT;IAEO,OAAAP,UAAA;EAAA,CACT;AACF;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Name for the global object that will be used to store the SSR modules when injecting them into the page.
|
|
3
|
+
*/
|
|
4
|
+
export declare const SSR_INJECT_ID = "__styleInject_SSR_MODULES";
|
|
5
|
+
/**
|
|
6
|
+
* Data attribute that indicates that given `<style>` node was injected by us
|
|
7
|
+
*/
|
|
8
|
+
export declare const SSR_NODE_DATA_ID = "data-uic-style";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/utils/nextjs/ssr/constants.ts"],"sourcesContent":["// #############################################################################\n// ! If making changes make sure to update `style-inject.ts` as well\n// #############################################################################\n/**\n * Name for the global object that will be used to store the SSR modules when injecting them into the page.\n */\nexport const SSR_INJECT_ID = \"__styleInject_SSR_MODULES\";\n\n/**\n * Data attribute that indicates that given `<style>` node was injected by us\n */\nexport const SSR_NODE_DATA_ID = \"data-uic-style\";\n"],"names":["SSR_INJECT_ID","SSR_NODE_DATA_ID"],"mappings":";;;AAMO,MAAMA,aAAgB,GAAA,2BAAA;AAKtB,MAAMC,gBAAmB,GAAA,gBAAA;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","sources":["../../../../src/utils/nextjs/ssr/constants.ts"],"sourcesContent":["// #############################################################################\n// ! If making changes make sure to update `style-inject.ts` as well\n// #############################################################################\n/**\n * Name for the global object that will be used to store the SSR modules when injecting them into the page.\n */\nexport const SSR_INJECT_ID = \"__styleInject_SSR_MODULES\";\n\n/**\n * Data attribute that indicates that given `<style>` node was injected by us\n */\nexport const SSR_NODE_DATA_ID = \"data-uic-style\";\n"],"names":["SSR_INJECT_ID","SSR_NODE_DATA_ID"],"mappings":";;AAMO,MAAMA,aAAgB,GAAA,2BAAA;AAKtB,MAAMC,gBAAmB,GAAA,gBAAA;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper to read injected styles from SSR and inject them into header so first-render is styled correctly.
|
|
3
|
+
* See `./style-inject.ts` for more info!
|
|
4
|
+
*
|
|
5
|
+
* Based on:
|
|
6
|
+
* @see https://github.com/egoist/style-inject/pull/28/files
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* \/**
|
|
10
|
+
* * Add styled-components server-side render support
|
|
11
|
+
* * Taken from https://github.com/vercel/next.js/blob/master/examples/with-styled-components/pages/_document.js
|
|
12
|
+
* *\/
|
|
13
|
+
* static override async getInitialProps(ctx: DocumentContext): Promise<{
|
|
14
|
+
* styles: JSX.Element;
|
|
15
|
+
* html: string;
|
|
16
|
+
* head?: (JSX.Element | null)[] | undefined;
|
|
17
|
+
* }> {
|
|
18
|
+
* const sheet = new ServerStyleSheet();
|
|
19
|
+
* const originalRenderPage = ctx.renderPage;
|
|
20
|
+
*
|
|
21
|
+
* try {
|
|
22
|
+
* ctx.renderPage = () =>
|
|
23
|
+
* originalRenderPage({
|
|
24
|
+
* enhanceApp: (App) =>
|
|
25
|
+
* function AppEnhanced(props) {
|
|
26
|
+
* return sheet.collectStyles(<App {...props} />);
|
|
27
|
+
* },
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* const initialProps = await Document.getInitialProps(ctx);
|
|
31
|
+
* return {
|
|
32
|
+
* ...initialProps,
|
|
33
|
+
* styles: (
|
|
34
|
+
* <>
|
|
35
|
+
* {\/**
|
|
36
|
+
* * Order of injecting important so we:
|
|
37
|
+
* * 1. Inject global css from next
|
|
38
|
+
* * 2. Inject ui-component styles
|
|
39
|
+
* * 3. Inject our styled-component styles (with possible overrides ui-component overrides)
|
|
40
|
+
* *\/}
|
|
41
|
+
* {initialProps.styles}
|
|
42
|
+
* <UiComponentsSsrStyleRegistry />
|
|
43
|
+
* {sheet.getStyleElement()}
|
|
44
|
+
* </>
|
|
45
|
+
* ),
|
|
46
|
+
* };
|
|
47
|
+
* } finally {
|
|
48
|
+
* sheet.seal();
|
|
49
|
+
* }
|
|
50
|
+
* }
|
|
51
|
+
*/
|
|
52
|
+
export declare const UiComponentsSsrStyleRegistryPagesRouter: import("react").NamedExoticComponent<object>;
|