@ubnt/store.core 9.36.0 → 9.37.0-beta.1
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 +239 -0
- 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/basestation-xg.jpg +0 -0
- package/lib/assets/crestron.svg +3 -0
- package/lib/assets/e7-audience.jpg +0 -0
- package/lib/assets/e7.jpg +0 -0
- package/lib/assets/port.svg +4 -2
- package/lib/assets/port2.svg +3 -0
- package/lib/assets/radio-60g.svg +11 -0
- package/lib/assets/udmPro.jpg +0 -0
- package/lib/assets/udmPro2.jpg +0 -0
- package/lib/assets/udmProMax.jpg +0 -0
- package/lib/assets/udmProMax2.jpg +0 -0
- package/lib/assets/udmProSpecial.jpg +0 -0
- package/lib/assets/udmProSpecial2.jpg +0 -0
- package/lib/assets/wifiEnterprise.svg +3 -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/BackInStock/BackInStock.types.d.ts +1 -0
- package/lib/components/Banner/Banner.styles.js.map +1 -1
- package/lib/components/Banner/Banner.styles.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.d.ts +1 -1
- package/lib/components/ButtonGroupBasic/ButtonGroupBasic.js +16 -4
- package/lib/components/ButtonGroupBasic/ButtonGroupBasic.js.map +1 -1
- package/lib/components/ButtonGroupBasic/ButtonGroupBasic.mjs +17 -5
- package/lib/components/ButtonGroupBasic/ButtonGroupBasic.mjs.map +1 -1
- package/lib/components/ButtonGroupBasic/ButtonGroupBasic.styles.d.ts +5 -1
- package/lib/components/ButtonGroupBasic/ButtonGroupBasic.styles.js +82 -17
- package/lib/components/ButtonGroupBasic/ButtonGroupBasic.styles.js.map +1 -1
- package/lib/components/ButtonGroupBasic/ButtonGroupBasic.styles.mjs +82 -17
- package/lib/components/ButtonGroupBasic/ButtonGroupBasic.styles.mjs.map +1 -1
- package/lib/components/ButtonGroupBasic/ButtonGroupBasic.types.d.ts +4 -0
- 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/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 +15 -13
- package/lib/components/Explore/ExploreData.js.map +1 -1
- package/lib/components/Explore/ExploreData.mjs +15 -13
- package/lib/components/Explore/ExploreData.mjs.map +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.js.map +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.mjs.map +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.styles.js.map +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.styles.mjs.map +1 -1
- 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/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/Header.js +3 -3
- package/lib/components/Header/Header.js.map +1 -1
- package/lib/components/Header/Header.mjs +3 -3
- package/lib/components/Header/Header.mjs.map +1 -1
- package/lib/components/Header/Header.styles.js.map +1 -1
- package/lib/components/Header/Header.styles.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/Navigation/Carousel/Carousel.js.map +1 -1
- package/lib/components/Header/Navigation/Carousel/Carousel.mjs.map +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/ProHeader/ProHeader.js.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.mjs.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.styles.js.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.styles.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.js.map +1 -1
- package/lib/components/Hero/Hero.styles.mjs.map +1 -1
- 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/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/MeetUniFiVideoPlayer/MeetUniFiVideoPlayer.helpers.js.map +1 -1
- package/lib/components/MeetUniFiVideoPlayer/MeetUniFiVideoPlayer.helpers.mjs.map +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/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/ModelComparePropertyValueGridItem.js +1 -0
- package/lib/components/ModelCompareV3/ModelComparePropertyValueGridItem.js.map +1 -1
- package/lib/components/ModelCompareV3/ModelComparePropertyValueGridItem.mjs +1 -0
- package/lib/components/ModelCompareV3/ModelComparePropertyValueGridItem.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 +2 -0
- package/lib/components/ModelCompareV3/ModelCompareV3.styles.js.map +1 -1
- package/lib/components/ModelCompareV3/ModelCompareV3.styles.mjs +2 -0
- package/lib/components/ModelCompareV3/ModelCompareV3.styles.mjs.map +1 -1
- package/lib/components/ModelCompareV3/ModelCompareV3.types.d.ts +10 -1
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmPro.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmPro.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProMax.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProMax.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProSpecial.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProSpecial.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/udmPro.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/udmPro.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/udmProMax.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/udmProMax.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/udmProSpecial.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/udmProSpecial.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/WiFi/basestation-xg.jpg.js +27 -0
- package/lib/components/ModelCompareV3/assets/WiFi/basestation-xg.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/WiFi/basestation-xg.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/WiFi/basestation-xg.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/WiFi/e7-audience.jpg.js +27 -0
- package/lib/components/ModelCompareV3/assets/WiFi/e7-audience.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/WiFi/e7-audience.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/WiFi/e7-audience.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/WiFi/e7.jpg.js +27 -0
- package/lib/components/ModelCompareV3/assets/WiFi/e7.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/WiFi/e7.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/WiFi/e7.jpg.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/assets/port.svg.js +27 -0
- package/lib/components/ModelCompareV3/assets/port.svg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/port.svg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/port.svg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/radio-60g.svg.js +27 -0
- package/lib/components/ModelCompareV3/assets/radio-60g.svg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/radio-60g.svg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/radio-60g.svg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/CloudGateways.js +9 -9
- package/lib/components/ModelCompareV3/data/CloudGateways.mjs +6 -6
- 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/EnterpriseWiFi.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/EnterpriseWiFi.js +28 -0
- package/lib/components/ModelCompareV3/data/EnterpriseWiFi.js.map +1 -0
- package/lib/components/ModelCompareV3/data/EnterpriseWiFi.mjs +26 -0
- package/lib/components/ModelCompareV3/data/EnterpriseWiFi.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/MegaCapacityWiFI.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/MegaCapacityWiFI.js +26 -0
- package/lib/components/ModelCompareV3/data/MegaCapacityWiFI.js.map +1 -0
- package/lib/components/ModelCompareV3/data/MegaCapacityWiFI.mjs +24 -0
- package/lib/components/ModelCompareV3/data/MegaCapacityWiFI.mjs.map +1 -0
- 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/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/index.d.ts +39 -37
- package/lib/components/ModelCompareV3/data/index.js +80 -74
- package/lib/components/ModelCompareV3/data/index.js.map +1 -1
- package/lib/components/ModelCompareV3/data/index.mjs +80 -74
- package/lib/components/ModelCompareV3/data/index.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.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/products/baseStationXG.js +114 -0
- package/lib/components/ModelCompareV3/data/products/baseStationXG.js.map +1 -0
- package/lib/components/ModelCompareV3/data/products/baseStationXG.mjs +106 -0
- package/lib/components/ModelCompareV3/data/products/baseStationXG.mjs.map +1 -0
- 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 +4 -2
- package/lib/components/ModelCompareV3/data/products/cloudKeyEnterprise.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/cloudKeyEnterprise.mjs +4 -2
- package/lib/components/ModelCompareV3/data/products/cloudKeyEnterprise.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/cloudKeyG2Plus.js +2 -2
- package/lib/components/ModelCompareV3/data/products/cloudKeyG2Plus.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/cloudKeyG2Plus.mjs +2 -2
- package/lib/components/ModelCompareV3/data/products/cloudKeyG2Plus.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/e7.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/products/e7.js +121 -0
- package/lib/components/ModelCompareV3/data/products/e7.js.map +1 -0
- package/lib/components/ModelCompareV3/data/products/e7.mjs +113 -0
- package/lib/components/ModelCompareV3/data/products/e7.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/products/e7Audience.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/products/e7Audience.js +135 -0
- package/lib/components/ModelCompareV3/data/products/e7Audience.js.map +1 -0
- package/lib/components/ModelCompareV3/data/products/e7Audience.mjs +127 -0
- package/lib/components/ModelCompareV3/data/products/e7Audience.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/products/e7Campus.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/products/e7Campus.js +119 -0
- package/lib/components/ModelCompareV3/data/products/e7Campus.js.map +1 -0
- package/lib/components/ModelCompareV3/data/products/e7Campus.mjs +111 -0
- package/lib/components/ModelCompareV3/data/products/e7Campus.mjs.map +1 -0
- 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/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/express.js +3 -3
- package/lib/components/ModelCompareV3/data/products/express.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/express.mjs +3 -3
- package/lib/components/ModelCompareV3/data/products/express.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/gatewayEnterprise.js +4 -2
- package/lib/components/ModelCompareV3/data/products/gatewayEnterprise.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/gatewayEnterprise.mjs +4 -2
- package/lib/components/ModelCompareV3/data/products/gatewayEnterprise.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/gatewayLite.js +4 -2
- package/lib/components/ModelCompareV3/data/products/gatewayLite.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/gatewayLite.mjs +4 -2
- package/lib/components/ModelCompareV3/data/products/gatewayLite.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/gatewayMax.js +4 -2
- package/lib/components/ModelCompareV3/data/products/gatewayMax.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/gatewayMax.mjs +4 -2
- package/lib/components/ModelCompareV3/data/products/gatewayMax.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/gatewayProfessional.js +4 -2
- package/lib/components/ModelCompareV3/data/products/gatewayProfessional.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/gatewayProfessional.mjs +4 -2
- package/lib/components/ModelCompareV3/data/products/gatewayProfessional.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/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/officialUniFiHosting.js +3 -1
- package/lib/components/ModelCompareV3/data/products/officialUniFiHosting.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/officialUniFiHosting.mjs +3 -1
- package/lib/components/ModelCompareV3/data/products/officialUniFiHosting.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/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/ucgMax.js +1 -1
- package/lib/components/ModelCompareV3/data/products/ucgMax.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/ucgMax.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/ucgMax.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/ucgUltra.js +3 -3
- package/lib/components/ModelCompareV3/data/products/ucgUltra.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/ucgUltra.mjs +3 -3
- package/lib/components/ModelCompareV3/data/products/ucgUltra.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/udmPro.js +4 -4
- package/lib/components/ModelCompareV3/data/products/udmPro.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/udmPro.mjs +4 -4
- package/lib/components/ModelCompareV3/data/products/udmPro.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProMax.js +4 -4
- package/lib/components/ModelCompareV3/data/products/udmProMax.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProMax.mjs +4 -4
- package/lib/components/ModelCompareV3/data/products/udmProMax.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProSpecial.js +4 -4
- package/lib/components/ModelCompareV3/data/products/udmProSpecial.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProSpecial.mjs +4 -4
- package/lib/components/ModelCompareV3/data/products/udmProSpecial.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/udr.js +5 -41
- package/lib/components/ModelCompareV3/data/products/udr.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/udr.mjs +5 -21
- package/lib/components/ModelCompareV3/data/products/udr.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/udw.js +3 -3
- package/lib/components/ModelCompareV3/data/products/udw.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/udw.mjs +3 -3
- package/lib/components/ModelCompareV3/data/products/udw.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/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/dedicatedSpectral.js +2 -2
- package/lib/components/ModelCompareV3/data/properties/dedicatedSpectral.js.map +1 -1
- package/lib/components/ModelCompareV3/data/properties/dedicatedSpectral.mjs +2 -2
- package/lib/components/ModelCompareV3/data/properties/dedicatedSpectral.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/properties/index.d.ts +5 -0
- package/lib/components/ModelCompareV3/data/properties/index.js +10 -0
- package/lib/components/ModelCompareV3/data/properties/index.js.map +1 -1
- package/lib/components/ModelCompareV3/data/properties/index.mjs +5 -0
- package/lib/components/ModelCompareV3/data/properties/index.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/properties/redundantRj45Port.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/properties/redundantRj45Port.js +18 -0
- package/lib/components/ModelCompareV3/data/properties/redundantRj45Port.js.map +1 -0
- package/lib/components/ModelCompareV3/data/properties/redundantRj45Port.mjs +10 -0
- package/lib/components/ModelCompareV3/data/properties/redundantRj45Port.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/properties/rfFilteringTechnology.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/properties/rfFilteringTechnology.js +18 -0
- package/lib/components/ModelCompareV3/data/properties/rfFilteringTechnology.js.map +1 -0
- package/lib/components/ModelCompareV3/data/properties/rfFilteringTechnology.mjs +10 -0
- package/lib/components/ModelCompareV3/data/properties/rfFilteringTechnology.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/properties/weatherproofing.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/properties/weatherproofing.js +18 -0
- package/lib/components/ModelCompareV3/data/properties/weatherproofing.js.map +1 -0
- package/lib/components/ModelCompareV3/data/properties/weatherproofing.mjs +10 -0
- package/lib/components/ModelCompareV3/data/properties/weatherproofing.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/properties/wifi6Technology.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/properties/wifi6Technology.js +18 -0
- package/lib/components/ModelCompareV3/data/properties/wifi6Technology.js.map +1 -0
- package/lib/components/ModelCompareV3/data/properties/wifi6Technology.mjs +10 -0
- package/lib/components/ModelCompareV3/data/properties/wifi6Technology.mjs.map +1 -0
- package/lib/components/ModelCompareV3/translations/ar.json.js +2 -0
- package/lib/components/ModelCompareV3/translations/ar.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/ar.json.mjs +2 -0
- package/lib/components/ModelCompareV3/translations/ar.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/de.json.js +2 -0
- package/lib/components/ModelCompareV3/translations/de.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/de.json.mjs +2 -0
- package/lib/components/ModelCompareV3/translations/de.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/el.json.js +2 -0
- package/lib/components/ModelCompareV3/translations/el.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/el.json.mjs +2 -0
- package/lib/components/ModelCompareV3/translations/el.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/en.json.js +31 -1
- package/lib/components/ModelCompareV3/translations/en.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/en.json.mjs +31 -1
- package/lib/components/ModelCompareV3/translations/en.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/es.json.js +2 -0
- package/lib/components/ModelCompareV3/translations/es.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/es.json.mjs +2 -0
- package/lib/components/ModelCompareV3/translations/es.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/fr.json.js +2 -0
- package/lib/components/ModelCompareV3/translations/fr.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/fr.json.mjs +2 -0
- package/lib/components/ModelCompareV3/translations/fr.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/it.json.js +2 -0
- package/lib/components/ModelCompareV3/translations/it.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/it.json.mjs +2 -0
- package/lib/components/ModelCompareV3/translations/it.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/ja.json.js +2 -0
- package/lib/components/ModelCompareV3/translations/ja.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/ja.json.mjs +2 -0
- package/lib/components/ModelCompareV3/translations/ja.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/pt-BR.json.js +2 -0
- package/lib/components/ModelCompareV3/translations/pt-BR.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/pt-BR.json.mjs +2 -0
- package/lib/components/ModelCompareV3/translations/pt-BR.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/useModelCompareTranslation.d.ts +2 -2
- package/lib/components/ModelCompareV3/translations/zh-Hans.json.js +2 -0
- package/lib/components/ModelCompareV3/translations/zh-Hans.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/zh-Hans.json.mjs +2 -0
- package/lib/components/ModelCompareV3/translations/zh-Hans.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/zh-Hant-TW.json.js +2 -0
- package/lib/components/ModelCompareV3/translations/zh-Hant-TW.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/zh-Hant-TW.json.mjs +2 -0
- package/lib/components/ModelCompareV3/translations/zh-Hant-TW.json.mjs.map +1 -1
- 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 +2 -2
- package/lib/components/ProductCardPopup/ProductCardPopup.js.map +1 -1
- package/lib/components/ProductCardPopup/ProductCardPopup.mjs +2 -2
- 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/ProductSectionTabs/ProductSectionTabs.js.map +1 -1
- package/lib/components/ProductSectionTabs/ProductSectionTabs.mjs.map +1 -1
- 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 +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/RecommendedPoeSwitches.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/RecommendedPoeSwitches.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/RecommendedPoeSwitches.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/assets/port.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/RecommendedPoeSwitches/assets/port.svg.mjs +2 -2
- package/lib/components/ScrollWrapper/ScrollWrapper.js.map +1 -1
- 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/Search/Input/Input.styles.js.map +1 -1
- package/lib/components/Search/Input/Input.styles.mjs.map +1 -1
- 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/constants/icons/menu/index.d.ts +1 -0
- package/lib/constants/icons/menu/index.js +9 -0
- package/lib/constants/icons/menu/index.js.map +1 -1
- package/lib/constants/icons/menu/index.mjs +2 -0
- package/lib/constants/icons/menu/index.mjs.map +1 -1
- package/lib/constants/icons/menu/wifiEnterprise.svg.js +27 -0
- package/lib/constants/icons/menu/wifiEnterprise.svg.js.map +1 -0
- package/lib/constants/icons/menu/wifiEnterprise.svg.mjs +3 -0
- package/lib/constants/icons/menu/wifiEnterprise.svg.mjs.map +1 -0
- 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/index.d.ts +3 -2
- package/lib/constants/proStoreCategories/mapping/index.js +61 -65
- package/lib/constants/proStoreCategories/mapping/index.js.map +1 -1
- package/lib/constants/proStoreCategories/mapping/index.mjs +60 -63
- package/lib/constants/proStoreCategories/mapping/index.mjs.map +1 -1
- package/lib/constants/proStoreCategories/mapping/redirects.js +18 -3
- package/lib/constants/proStoreCategories/mapping/redirects.js.map +1 -1
- package/lib/constants/proStoreCategories/mapping/redirects.mjs +18 -3
- package/lib/constants/proStoreCategories/mapping/redirects.mjs.map +1 -1
- 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 +8 -9
- package/lib/constants/proStoreCategories/mapping/unifi.js +8 -9
- package/lib/constants/proStoreCategories/mapping/unifi.js.map +1 -1
- package/lib/constants/proStoreCategories/mapping/unifi.mjs +8 -9
- package/lib/constants/proStoreCategories/mapping/unifi.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/ar.json.js +6 -2
- package/lib/constants/proStoreCategories/translations/ar.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/ar.json.mjs +6 -3
- package/lib/constants/proStoreCategories/translations/ar.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/de.json.js +6 -2
- package/lib/constants/proStoreCategories/translations/de.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/de.json.mjs +6 -3
- package/lib/constants/proStoreCategories/translations/de.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/el.json.js +6 -2
- package/lib/constants/proStoreCategories/translations/el.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/el.json.mjs +6 -3
- package/lib/constants/proStoreCategories/translations/el.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/en.json.js +3 -2
- package/lib/constants/proStoreCategories/translations/en.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/en.json.mjs +3 -2
- package/lib/constants/proStoreCategories/translations/en.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/es.json.js +6 -2
- package/lib/constants/proStoreCategories/translations/es.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/es.json.mjs +6 -3
- package/lib/constants/proStoreCategories/translations/es.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/fr.json.js +3 -2
- package/lib/constants/proStoreCategories/translations/fr.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/fr.json.mjs +3 -2
- package/lib/constants/proStoreCategories/translations/fr.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/it.json.js +6 -2
- package/lib/constants/proStoreCategories/translations/it.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/it.json.mjs +6 -3
- package/lib/constants/proStoreCategories/translations/it.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/ja.json.js +6 -2
- package/lib/constants/proStoreCategories/translations/ja.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/ja.json.mjs +6 -3
- package/lib/constants/proStoreCategories/translations/ja.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/pt-BR.json.js +6 -2
- package/lib/constants/proStoreCategories/translations/pt-BR.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/pt-BR.json.mjs +6 -3
- package/lib/constants/proStoreCategories/translations/pt-BR.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/zh-Hans.json.js +3 -2
- package/lib/constants/proStoreCategories/translations/zh-Hans.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/zh-Hans.json.mjs +3 -2
- package/lib/constants/proStoreCategories/translations/zh-Hans.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.js +3 -2
- package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.mjs +3 -2
- package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.mjs.map +1 -1
- package/lib/constants/proStoreFilters/mapping.d.ts +17 -1
- package/lib/constants/proStoreFilters/mapping.js +16 -0
- package/lib/constants/proStoreFilters/mapping.js.map +1 -1
- package/lib/constants/proStoreFilters/mapping.mjs +16 -0
- package/lib/constants/proStoreFilters/mapping.mjs.map +1 -1
- package/lib/contexts/MenuContext/mapping.js +12 -0
- package/lib/contexts/MenuContext/mapping.js.map +1 -1
- package/lib/contexts/MenuContext/mapping.mjs +11 -0
- 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/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/constants.d.ts +13 -4
- package/lib/utils/money/constants.js +15 -5
- package/lib/utils/money/constants.js.map +1 -1
- package/lib/utils/money/constants.mjs +16 -6
- package/lib/utils/money/constants.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/money/tax.d.ts +3 -4
- package/lib/utils/money/tax.js +2 -1
- package/lib/utils/money/tax.js.map +1 -1
- package/lib/utils/money/tax.mjs +4 -3
- package/lib/utils/money/tax.mjs.map +1 -1
- package/lib/utils/money/tax.private.d.ts +3 -12
- package/lib/utils/money/tax.private.js +5 -14
- package/lib/utils/money/tax.private.js.map +1 -1
- package/lib/utils/money/tax.private.mjs +8 -16
- package/lib/utils/money/tax.private.mjs.map +1 -1
- package/lib/utils/money/types.d.ts +8 -8
- 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 +39 -0
- package/lib/utils/nextjs/plugin.js.map +1 -0
- package/lib/utils/nextjs/plugin.mjs +37 -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 +19 -0
- package/lib/utils/nextjs/ssr/registry.js.map +1 -0
- package/lib/utils/nextjs/ssr/registry.mjs +17 -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 +41 -0
- package/lib/utils/nextjs/ssr/style-inject.js.map +1 -0
- package/lib/utils/nextjs/ssr/style-inject.mjs +37 -0
- package/lib/utils/nextjs/ssr/style-inject.mjs.map +1 -0
- package/lib/utils/nextjs/ssr/transform-css-module.d.ts +10 -0
- package/lib/utils/nextjs/ssr/transform-css-module.js +86 -0
- package/lib/utils/nextjs/ssr/transform-css-module.js.map +1 -0
- package/lib/utils/nextjs/ssr/transform-css-module.mjs +58 -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
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var constants = require('./constants.js');
|
|
5
|
+
"use strict";
|
|
6
|
+
const UiComponentsSsrStyleRegistryPagesRouter = () => {
|
|
7
|
+
const injections = globalThis[constants.SSR_INJECT_ID];
|
|
8
|
+
const injectionsExist = !!injections && Array.isArray(injections) && !!injections.length;
|
|
9
|
+
return /* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
10
|
+
children: [/* @__PURE__ */jsxRuntime.jsx("noscript", {
|
|
11
|
+
"data-uic-style": ""
|
|
12
|
+
}, "data-uic-reference"), injectionsExist && injections?.map(module => /* @__PURE__ */jsxRuntime.jsx("style", {
|
|
13
|
+
"data-uic-style": module.id,
|
|
14
|
+
children: module.css
|
|
15
|
+
}, module.id))]
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
exports.UiComponentsSsrStyleRegistryPagesRouter = UiComponentsSsrStyleRegistryPagesRouter;
|
|
19
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sources":["../../../../src/utils/nextjs/ssr/registry.tsx"],"sourcesContent":["import { SSR_INJECT_ID } from \"./constants\";\nimport type { InjectedModule } from \"./types\";\n\n/**\n * Helper to read injected styles from SSR and inject them into header so first-render is styled correctly.\n * See `./style-inject.ts` for more info!\n *\n * Based on:\n * @see https://github.com/egoist/style-inject/pull/28/files\n *\n * @example\n * \\/**\n * * Add styled-components server-side render support\n * * Taken from https://github.com/vercel/next.js/blob/master/examples/with-styled-components/pages/_document.js\n * *\\/\n * static override async getInitialProps(ctx: DocumentContext): Promise<{\n * styles: JSX.Element;\n * html: string;\n * head?: (JSX.Element | null)[] | undefined;\n * }> {\n * const sheet = new ServerStyleSheet();\n * const originalRenderPage = ctx.renderPage;\n *\n * try {\n * ctx.renderPage = () =>\n * originalRenderPage({\n * enhanceApp: (App) =>\n * function AppEnhanced(props) {\n * return sheet.collectStyles(<App {...props} />);\n * },\n * });\n *\n * const initialProps = await Document.getInitialProps(ctx);\n * return {\n * ...initialProps,\n * styles: (\n * <>\n * {\\/**\n * * Order of injecting important so we:\n * * 1. Inject global css from next\n * * 2. Inject ui-component styles\n * * 3. Inject our styled-component styles (with possible overrides ui-component overrides)\n * *\\/}\n * {initialProps.styles}\n * <UiComponentsSsrStyleRegistry />\n * {sheet.getStyleElement()}\n * </>\n * ),\n * };\n * } finally {\n * sheet.seal();\n * }\n * }\n */\nexport const UiComponentsSsrStyleRegistryPagesRouter = () => {\n // @ts-expect-error Dangerously accessing globalThis\n const injections = globalThis[SSR_INJECT_ID] as unknown as\n | InjectedModule[]\n | undefined;\n\n const injectionsExist =\n !!injections && Array.isArray(injections) && !!injections.length;\n\n // TODO: For app router will have to migrate to using `useServerInsertedHTML`, see\n // https://nextjs.org/docs/app/building-your-application/styling/css-in-js#styled-components\n\n // Create a style element for each injection\n return (\n <>\n {/* Empty style element as \"bookmark\" for style-inject to know for first insertion where to place first style tag */}\n <noscript data-uic-style=\"\" key=\"data-uic-reference\" />\n {injectionsExist &&\n injections?.map((module: { id: string; css: string }) => (\n <style data-uic-style={module.id} key={module.id}>\n {module.css}\n </style>\n ))}\n </>\n );\n};\n"],"names":["UiComponentsSsrStyleRegistryPagesRouter","injections","globalThis","SSR_INJECT_ID","injectionsExist","Array","isArray","length","jsxs","Fragment","children","jsx","map","module","id","css"],"mappings":";;;;;AAsDO,MAAMA,0CAA0CA,CAAA,KAAM;EAErD,MAAAC,UAAA,GAAaC,WAAWC,SAAAA,CAAAA,aAAa,CAAA;EAIrC,MAAAC,eAAA,GACJ,CAAC,CAACH,UAAc,IAAAI,KAAA,CAAMC,QAAQL,UAAU,CAAA,IAAK,CAAC,CAACA,UAAW,CAAAM,MAAA;EAM5D,sBAGIC,UAAA,CAAAA,IAAA,CAAAC,mBAAA,EAAA;IAAAC,QAAA,EAAA,CAACC,eAAAA,UAAAA,CAAAA,GAAA,CAAA,UAAA,EAAA;MAAS,gBAAe,EAAA;IAAA,CAAA,EAAO,oBAAqB,CAAA,EACpDP,eACC,IAAAH,UAAA,EAAYW,GAAI,CAACC,UACdF,eAAAA,UAAAA,CAAAA,GAAA,CAAA,OAAA,EAAA;MAAM,gBAAgB,EAAAE,MAAA,CAAOC,EAC3B;MAAAJ,QAAA,EAAAG,MAAA,CAAOE;IAD6B,CAAA,EAAAF,MAAA,CAAOC,EAE9C,CACD,CAAA;EACL,CAAA,CAAA;AAEJ,CAAA;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { SSR_INJECT_ID } from './constants.mjs';
|
|
3
|
+
"use strict";
|
|
4
|
+
const UiComponentsSsrStyleRegistryPagesRouter = () => {
|
|
5
|
+
const injections = globalThis[SSR_INJECT_ID];
|
|
6
|
+
const injectionsExist = !!injections && Array.isArray(injections) && !!injections.length;
|
|
7
|
+
return /* @__PURE__ */jsxs(Fragment, {
|
|
8
|
+
children: [/* @__PURE__ */jsx("noscript", {
|
|
9
|
+
"data-uic-style": ""
|
|
10
|
+
}, "data-uic-reference"), injectionsExist && injections?.map(module => /* @__PURE__ */jsx("style", {
|
|
11
|
+
"data-uic-style": module.id,
|
|
12
|
+
children: module.css
|
|
13
|
+
}, module.id))]
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
export { UiComponentsSsrStyleRegistryPagesRouter };
|
|
17
|
+
//# sourceMappingURL=registry.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.mjs","sources":["../../../../src/utils/nextjs/ssr/registry.tsx"],"sourcesContent":["import { SSR_INJECT_ID } from \"./constants\";\nimport type { InjectedModule } from \"./types\";\n\n/**\n * Helper to read injected styles from SSR and inject them into header so first-render is styled correctly.\n * See `./style-inject.ts` for more info!\n *\n * Based on:\n * @see https://github.com/egoist/style-inject/pull/28/files\n *\n * @example\n * \\/**\n * * Add styled-components server-side render support\n * * Taken from https://github.com/vercel/next.js/blob/master/examples/with-styled-components/pages/_document.js\n * *\\/\n * static override async getInitialProps(ctx: DocumentContext): Promise<{\n * styles: JSX.Element;\n * html: string;\n * head?: (JSX.Element | null)[] | undefined;\n * }> {\n * const sheet = new ServerStyleSheet();\n * const originalRenderPage = ctx.renderPage;\n *\n * try {\n * ctx.renderPage = () =>\n * originalRenderPage({\n * enhanceApp: (App) =>\n * function AppEnhanced(props) {\n * return sheet.collectStyles(<App {...props} />);\n * },\n * });\n *\n * const initialProps = await Document.getInitialProps(ctx);\n * return {\n * ...initialProps,\n * styles: (\n * <>\n * {\\/**\n * * Order of injecting important so we:\n * * 1. Inject global css from next\n * * 2. Inject ui-component styles\n * * 3. Inject our styled-component styles (with possible overrides ui-component overrides)\n * *\\/}\n * {initialProps.styles}\n * <UiComponentsSsrStyleRegistry />\n * {sheet.getStyleElement()}\n * </>\n * ),\n * };\n * } finally {\n * sheet.seal();\n * }\n * }\n */\nexport const UiComponentsSsrStyleRegistryPagesRouter = () => {\n // @ts-expect-error Dangerously accessing globalThis\n const injections = globalThis[SSR_INJECT_ID] as unknown as\n | InjectedModule[]\n | undefined;\n\n const injectionsExist =\n !!injections && Array.isArray(injections) && !!injections.length;\n\n // TODO: For app router will have to migrate to using `useServerInsertedHTML`, see\n // https://nextjs.org/docs/app/building-your-application/styling/css-in-js#styled-components\n\n // Create a style element for each injection\n return (\n <>\n {/* Empty style element as \"bookmark\" for style-inject to know for first insertion where to place first style tag */}\n <noscript data-uic-style=\"\" key=\"data-uic-reference\" />\n {injectionsExist &&\n injections?.map((module: { id: string; css: string }) => (\n <style data-uic-style={module.id} key={module.id}>\n {module.css}\n </style>\n ))}\n </>\n );\n};\n"],"names":["UiComponentsSsrStyleRegistryPagesRouter","injections","globalThis","SSR_INJECT_ID","injectionsExist","Array","isArray","length","jsxs","Fragment","children","jsx","map","module","id","css"],"mappings":";;;AAsDO,MAAMA,0CAA0CA,CAAA,KAAM;EAErD,MAAAC,UAAA,GAAaC,WAAWC,aAAa,CAAA;EAIrC,MAAAC,eAAA,GACJ,CAAC,CAACH,UAAc,IAAAI,KAAA,CAAMC,QAAQL,UAAU,CAAA,IAAK,CAAC,CAACA,UAAW,CAAAM,MAAA;EAM5D,sBAGIC,IAAA,CAAAC,QAAA,EAAA;IAAAC,QAAA,EAAA,CAAC,eAAAC,GAAA,CAAA,UAAA,EAAA;MAAS,gBAAe,EAAA;IAAA,CAAA,EAAO,oBAAqB,CAAA,EACpDP,eACC,IAAAH,UAAA,EAAYW,GAAI,CAACC,UACd,eAAAF,GAAA,CAAA,OAAA,EAAA;MAAM,gBAAgB,EAAAE,MAAA,CAAOC,EAC3B;MAAAJ,QAAA,EAAAG,MAAA,CAAOE;IAD6B,CAAA,EAAAF,MAAA,CAAOC,EAE9C,CACD,CAAA;EACL,CAAA,CAAA;AAEJ,CAAA;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type InjectedModule = {
|
|
2
|
+
/**
|
|
3
|
+
* The ID of the style tag (typically some stable unique hash derived CSS content)
|
|
4
|
+
*/
|
|
5
|
+
id: string;
|
|
6
|
+
/**
|
|
7
|
+
* The CSS string to inject
|
|
8
|
+
*/
|
|
9
|
+
css: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Util to inject styles into the DOM, this is a patched version of the original styled-inject.
|
|
13
|
+
*
|
|
14
|
+
* @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/rollup.config.js
|
|
15
|
+
* @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/scripts/rollup-plugin-local-style-inject.js
|
|
16
|
+
* @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/src/docs/helpers/style-inject.es.js
|
|
17
|
+
* - Original styled-inject: https://github.com/egoist/style-inject/blob/master/src/index.js
|
|
18
|
+
* - SSR Patch: https://github.com/egoist/style-inject/pull/28/files
|
|
19
|
+
*/
|
|
20
|
+
export default function styleInject(css: InjectedModule["css"], id: InjectedModule["id"]): void;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
"use strict";
|
|
7
|
+
const SSR_INJECT_ID = "__styleInject_SSR_MODULES";
|
|
8
|
+
const SSR_NODE_DATA_ID = "data-uic-style";
|
|
9
|
+
function styleInject(css, id) {
|
|
10
|
+
if (!css) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (!globalThis[SSR_INJECT_ID]) {
|
|
14
|
+
globalThis[SSR_INJECT_ID] = [];
|
|
15
|
+
}
|
|
16
|
+
if (globalThis[SSR_INJECT_ID].find(item => item.id === id)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
globalThis[SSR_INJECT_ID].push({
|
|
20
|
+
id,
|
|
21
|
+
css
|
|
22
|
+
});
|
|
23
|
+
if (typeof document === "undefined") {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const style = document.createElement("style");
|
|
27
|
+
style.setAttribute(SSR_NODE_DATA_ID, id);
|
|
28
|
+
style.textContent = css;
|
|
29
|
+
const injectedStyles = document.head.querySelectorAll(`:scope > [${SSR_NODE_DATA_ID}]`);
|
|
30
|
+
const injectedStylesLength = injectedStyles.length;
|
|
31
|
+
if (injectedStyles.length) {
|
|
32
|
+
const lastStyle = injectedStyles[injectedStylesLength - 1];
|
|
33
|
+
if (lastStyle) {
|
|
34
|
+
lastStyle.after(style);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
document.head.appendChild(style);
|
|
39
|
+
}
|
|
40
|
+
exports["default"] = styleInject;
|
|
41
|
+
//# sourceMappingURL=style-inject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-inject.js","sources":["../../../../src/utils/nextjs/ssr/style-inject.ts"],"sourcesContent":["// #############################################################################\n// ! This file can't contain any imports, as it's copy-pasted into the bundled code!\n// #############################################################################\n\n/**\n * Name for the global object that will be used to store the SSR modules when injecting them into the page.\n */\nconst SSR_INJECT_ID = \"__styleInject_SSR_MODULES\";\n\n/**\n * Data attribute that indicates that given `<style>` node was injected by us\n */\nconst SSR_NODE_DATA_ID = \"data-uic-style\";\n\ntype InjectedModule = {\n /**\n * The ID of the style tag (typically some stable unique hash derived CSS content)\n */\n id: string;\n /**\n * The CSS string to inject\n */\n css: string;\n};\n\n// #############################################################################\n\n/**\n * Util to inject styles into the DOM, this is a patched version of the original styled-inject.\n *\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/rollup.config.js\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/scripts/rollup-plugin-local-style-inject.js\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/src/docs/helpers/style-inject.es.js\n * - Original styled-inject: https://github.com/egoist/style-inject/blob/master/src/index.js\n * - SSR Patch: https://github.com/egoist/style-inject/pull/28/files\n */\nexport default function styleInject(\n css: InjectedModule[\"css\"],\n id: InjectedModule[\"id\"],\n) {\n // Nothing to inject\n if (!css) {\n return;\n }\n\n // Patch missing global variable\n // @ts-expect-error Dangerously accessing globalThis\n if (!globalThis[SSR_INJECT_ID]) {\n // @ts-expect-error Dangerously accessing globalThis\n globalThis[SSR_INJECT_ID] = [];\n }\n\n // Exit early if the style is already injected/registered\n // @ts-expect-error Dangerously accessing globalThis\n if (globalThis[SSR_INJECT_ID].find((item) => item.id === id)) {\n return;\n }\n\n // Register the injected module\n // @ts-expect-error Dangerously accessing globalThis\n globalThis[SSR_INJECT_ID].push({ id, css });\n\n // Exit early as we can't inject styles on the server, registering is enough\n if (typeof document === \"undefined\") {\n return;\n }\n\n // Create a style tag\n const style = document.createElement(\"style\");\n\n // Set a data element so for next DOM inject we can append to the last element we appended\n style.setAttribute(SSR_NODE_DATA_ID, id);\n\n // Set CSS content via a safe text escaped approach\n style.textContent = css;\n\n // Try to find either bookmark `<noscript/>` or last injected `<style/>`\n const injectedStyles = document.head.querySelectorAll(\n `:scope > [${SSR_NODE_DATA_ID}]`,\n );\n const injectedStylesLength = injectedStyles.length;\n\n // Attempt to append the style (to preserve overriding logic with styled-components)\n if (injectedStyles.length) {\n const lastStyle = injectedStyles[injectedStylesLength - 1];\n\n if (lastStyle) {\n lastStyle.after(style);\n return;\n }\n }\n\n // If that didn't work append to end of head\n document.head.appendChild(style);\n}\n"],"names":["SSR_INJECT_ID","SSR_NODE_DATA_ID","styleInject","css","id","globalThis","find","item","push","document","style","createElement","setAttribute","textContent","injectedStyles","head","querySelectorAll","injectedStylesLength","length","lastStyle","after","appendChild"],"mappings":";;;;;;AAOA,MAAMA,aAAgB,GAAA,2BAAA;AAKtB,MAAMC,gBAAmB,GAAA,gBAAA;AAwBD,SAAAC,WAAAA,CACtBC,KACAC,EACA,EAAA;EAEA,IAAI,CAACD,GAAK,EAAA;IACR;EACF;EAII,IAAA,CAACE,UAAW,CAAAL,aAAa,CAAG,EAAA;IAEnBK,UAAA,CAAAL,aAAa,IAAI,EAAC;EAC/B;EAII,IAAAK,UAAA,CAAWL,aAAa,CAAE,CAAAM,IAAA,CAAMC,IAAS,IAAAA,IAAA,CAAKH,EAAO,KAAAA,EAAE,CAAG,EAAA;IAC5D;EACF;EAIAC,UAAA,CAAWL,aAAa,CAAE,CAAAQ,IAAA,CAAK;IAAEJ,EAAA;IAAID;GAAK,CAAA;EAGtC,IAAA,OAAOM,aAAa,WAAa,EAAA;IACnC;EACF;EAGM,MAAAC,KAAA,GAAQD,QAAS,CAAAE,aAAA,CAAc,OAAO,CAAA;EAGtCD,KAAA,CAAAE,YAAA,CAAaX,kBAAkBG,EAAE,CAAA;EAGvCM,KAAA,CAAMG,WAAc,GAAAV,GAAA;EAGd,MAAAW,cAAA,GAAiBL,SAASM,IAAK,CAAAC,gBAAA,CACnC,aAAaf,gBAAgB,GAAA,CAC/B;EACA,MAAMgB,uBAAuBH,cAAe,CAAAI,MAAA;EAG5C,IAAIJ,eAAeI,MAAQ,EAAA;IACnB,MAAAC,SAAA,GAAYL,cAAe,CAAAG,oBAAA,GAAuB,CAAC,CAAA;IAEzD,IAAIE,SAAW,EAAA;MACbA,SAAA,CAAUC,MAAMV,KAAK,CAAA;MACrB;IACF;EACF;EAGSD,QAAA,CAAAM,IAAA,CAAKM,YAAYX,KAAK,CAAA;AACjC;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const SSR_INJECT_ID = "__styleInject_SSR_MODULES";
|
|
4
|
+
const SSR_NODE_DATA_ID = "data-uic-style";
|
|
5
|
+
function styleInject(css, id) {
|
|
6
|
+
if (!css) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (!globalThis[SSR_INJECT_ID]) {
|
|
10
|
+
globalThis[SSR_INJECT_ID] = [];
|
|
11
|
+
}
|
|
12
|
+
if (globalThis[SSR_INJECT_ID].find(item => item.id === id)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
globalThis[SSR_INJECT_ID].push({
|
|
16
|
+
id,
|
|
17
|
+
css
|
|
18
|
+
});
|
|
19
|
+
if (typeof document === "undefined") {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const style = document.createElement("style");
|
|
23
|
+
style.setAttribute(SSR_NODE_DATA_ID, id);
|
|
24
|
+
style.textContent = css;
|
|
25
|
+
const injectedStyles = document.head.querySelectorAll(`:scope > [${SSR_NODE_DATA_ID}]`);
|
|
26
|
+
const injectedStylesLength = injectedStyles.length;
|
|
27
|
+
if (injectedStyles.length) {
|
|
28
|
+
const lastStyle = injectedStyles[injectedStylesLength - 1];
|
|
29
|
+
if (lastStyle) {
|
|
30
|
+
lastStyle.after(style);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
document.head.appendChild(style);
|
|
35
|
+
}
|
|
36
|
+
export { styleInject as default };
|
|
37
|
+
//# sourceMappingURL=style-inject.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-inject.mjs","sources":["../../../../src/utils/nextjs/ssr/style-inject.ts"],"sourcesContent":["// #############################################################################\n// ! This file can't contain any imports, as it's copy-pasted into the bundled code!\n// #############################################################################\n\n/**\n * Name for the global object that will be used to store the SSR modules when injecting them into the page.\n */\nconst SSR_INJECT_ID = \"__styleInject_SSR_MODULES\";\n\n/**\n * Data attribute that indicates that given `<style>` node was injected by us\n */\nconst SSR_NODE_DATA_ID = \"data-uic-style\";\n\ntype InjectedModule = {\n /**\n * The ID of the style tag (typically some stable unique hash derived CSS content)\n */\n id: string;\n /**\n * The CSS string to inject\n */\n css: string;\n};\n\n// #############################################################################\n\n/**\n * Util to inject styles into the DOM, this is a patched version of the original styled-inject.\n *\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/rollup.config.js\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/scripts/rollup-plugin-local-style-inject.js\n * @see https://github.com/ubiquiti/shared-ui.ui-components/blob/develop/src/docs/helpers/style-inject.es.js\n * - Original styled-inject: https://github.com/egoist/style-inject/blob/master/src/index.js\n * - SSR Patch: https://github.com/egoist/style-inject/pull/28/files\n */\nexport default function styleInject(\n css: InjectedModule[\"css\"],\n id: InjectedModule[\"id\"],\n) {\n // Nothing to inject\n if (!css) {\n return;\n }\n\n // Patch missing global variable\n // @ts-expect-error Dangerously accessing globalThis\n if (!globalThis[SSR_INJECT_ID]) {\n // @ts-expect-error Dangerously accessing globalThis\n globalThis[SSR_INJECT_ID] = [];\n }\n\n // Exit early if the style is already injected/registered\n // @ts-expect-error Dangerously accessing globalThis\n if (globalThis[SSR_INJECT_ID].find((item) => item.id === id)) {\n return;\n }\n\n // Register the injected module\n // @ts-expect-error Dangerously accessing globalThis\n globalThis[SSR_INJECT_ID].push({ id, css });\n\n // Exit early as we can't inject styles on the server, registering is enough\n if (typeof document === \"undefined\") {\n return;\n }\n\n // Create a style tag\n const style = document.createElement(\"style\");\n\n // Set a data element so for next DOM inject we can append to the last element we appended\n style.setAttribute(SSR_NODE_DATA_ID, id);\n\n // Set CSS content via a safe text escaped approach\n style.textContent = css;\n\n // Try to find either bookmark `<noscript/>` or last injected `<style/>`\n const injectedStyles = document.head.querySelectorAll(\n `:scope > [${SSR_NODE_DATA_ID}]`,\n );\n const injectedStylesLength = injectedStyles.length;\n\n // Attempt to append the style (to preserve overriding logic with styled-components)\n if (injectedStyles.length) {\n const lastStyle = injectedStyles[injectedStylesLength - 1];\n\n if (lastStyle) {\n lastStyle.after(style);\n return;\n }\n }\n\n // If that didn't work append to end of head\n document.head.appendChild(style);\n}\n"],"names":["SSR_INJECT_ID","SSR_NODE_DATA_ID","styleInject","css","id","globalThis","find","item","push","document","style","createElement","setAttribute","textContent","injectedStyles","head","querySelectorAll","injectedStylesLength","length","lastStyle","after","appendChild"],"mappings":";;AAOA,MAAMA,aAAgB,GAAA,2BAAA;AAKtB,MAAMC,gBAAmB,GAAA,gBAAA;AAwBD,SAAAC,WAAAA,CACtBC,KACAC,EACA,EAAA;EAEA,IAAI,CAACD,GAAK,EAAA;IACR;EACF;EAII,IAAA,CAACE,UAAW,CAAAL,aAAa,CAAG,EAAA;IAEnBK,UAAA,CAAAL,aAAa,IAAI,EAAC;EAC/B;EAII,IAAAK,UAAA,CAAWL,aAAa,CAAE,CAAAM,IAAA,CAAMC,IAAS,IAAAA,IAAA,CAAKH,EAAO,KAAAA,EAAE,CAAG,EAAA;IAC5D;EACF;EAIAC,UAAA,CAAWL,aAAa,CAAE,CAAAQ,IAAA,CAAK;IAAEJ,EAAA;IAAID;GAAK,CAAA;EAGtC,IAAA,OAAOM,aAAa,WAAa,EAAA;IACnC;EACF;EAGM,MAAAC,KAAA,GAAQD,QAAS,CAAAE,aAAA,CAAc,OAAO,CAAA;EAGtCD,KAAA,CAAAE,YAAA,CAAaX,kBAAkBG,EAAE,CAAA;EAGvCM,KAAA,CAAMG,WAAc,GAAAV,GAAA;EAGd,MAAAW,cAAA,GAAiBL,SAASM,IAAK,CAAAC,gBAAA,CACnC,aAAaf,gBAAgB,GAAA,CAC/B;EACA,MAAMgB,uBAAuBH,cAAe,CAAAI,MAAA;EAG5C,IAAIJ,eAAeI,MAAQ,EAAA;IACnB,MAAAC,SAAA,GAAYL,cAAe,CAAAG,oBAAA,GAAuB,CAAC,CAAA;IAEzD,IAAIE,SAAW,EAAA;MACbA,SAAA,CAAUC,MAAMV,KAAK,CAAA;MACrB;IACF;EACF;EAGSD,QAAA,CAAAM,IAAA,CAAKM,YAAYX,KAAK,CAAA;AACjC;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PluginObj } from "@babel/core";
|
|
2
|
+
type Plugin = PluginObj<{
|
|
3
|
+
defaultImportName: null | string;
|
|
4
|
+
}>;
|
|
5
|
+
/**
|
|
6
|
+
* Currently this plugin won't:
|
|
7
|
+
* - Handle existing source maps correctly and would strip from the output: "//# sourceMappingURL=BubbleContainer.module.css.js.map"
|
|
8
|
+
*/
|
|
9
|
+
export declare const transformCssModule: () => Plugin;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var babelTypes = require('@babel/types');
|
|
4
|
+
var crypto = require('node:crypto');
|
|
5
|
+
function _interopDefault(e) {
|
|
6
|
+
return e && e.__esModule ? e : {
|
|
7
|
+
default: e
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () {
|
|
20
|
+
return e[k];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
n["default"] = e;
|
|
27
|
+
return Object.freeze(n);
|
|
28
|
+
}
|
|
29
|
+
var babelTypes__namespace = /*#__PURE__*/_interopNamespace(babelTypes);
|
|
30
|
+
var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
31
|
+
"use strict";
|
|
32
|
+
function generateMd5(input) {
|
|
33
|
+
return crypto__default["default"].createHash("md5").update(input).digest("hex");
|
|
34
|
+
}
|
|
35
|
+
const transformCssModule = () => {
|
|
36
|
+
return {
|
|
37
|
+
visitor: {
|
|
38
|
+
// Step 0: Setup state
|
|
39
|
+
Program(_path, state) {
|
|
40
|
+
state["defaultImportName"] = null;
|
|
41
|
+
},
|
|
42
|
+
// Step 1: Find the default import from "style-inject.es.js"
|
|
43
|
+
ImportDeclaration(path, state) {
|
|
44
|
+
if (state["defaultImportName"]) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const importSource = path.node.source.value;
|
|
48
|
+
if (!importSource.endsWith("style-inject.es.js")) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const defaultSpecifier = path.node.specifiers.find(specifier => babelTypes__namespace.isImportDefaultSpecifier(specifier));
|
|
52
|
+
if (defaultSpecifier) {
|
|
53
|
+
state["defaultImportName"] = defaultSpecifier.local.name;
|
|
54
|
+
} else {
|
|
55
|
+
throw new Error("Import for `style-inject.es.js` file not found in file");
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
// Step 2: Find all calls to the imported identifier
|
|
59
|
+
CallExpression(path, state) {
|
|
60
|
+
if (!state["defaultImportName"]) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const callee = path.node.callee;
|
|
64
|
+
if (babelTypes__namespace.isIdentifier(callee) && callee.name === state["defaultImportName"]) {
|
|
65
|
+
const args = path.node.arguments;
|
|
66
|
+
if (!(args.length >= 1 && args.length <= 2)) {
|
|
67
|
+
throw new Error("Unexpected number of arguments");
|
|
68
|
+
}
|
|
69
|
+
if (!(babelTypes__namespace.isStringLiteral(args[0]) && (!args[1] || babelTypes__namespace.isStringLiteral(args[1])))) {
|
|
70
|
+
throw new Error("Unexpected argument types");
|
|
71
|
+
}
|
|
72
|
+
const firstArgValue = args[0].value;
|
|
73
|
+
const hash = generateMd5(firstArgValue);
|
|
74
|
+
const hashArg = babelTypes__namespace.stringLiteral(hash);
|
|
75
|
+
if (args.length > 1) {
|
|
76
|
+
args[1] = hashArg;
|
|
77
|
+
} else {
|
|
78
|
+
args.push(hashArg);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
exports.transformCssModule = transformCssModule;
|
|
86
|
+
//# sourceMappingURL=transform-css-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-css-module.js","sources":["../../../../src/utils/nextjs/ssr/transform-css-module.ts"],"sourcesContent":["import type { PluginObj } from \"@babel/core\";\nimport * as babelTypes from \"@babel/types\";\nimport crypto from \"node:crypto\";\n\nfunction generateMd5(input: string): string {\n return crypto.createHash(\"md5\").update(input).digest(\"hex\");\n}\n\ntype Plugin = PluginObj<{\n // Store the name of the default import identifier for \"style-inject.es.js\"\n defaultImportName: null | string;\n}>;\n\n/**\n * Currently this plugin won't:\n * - Handle existing source maps correctly and would strip from the output: \"//# sourceMappingURL=BubbleContainer.module.css.js.map\"\n */\nexport const transformCssModule = (): Plugin => {\n return {\n visitor: {\n // Step 0: Setup state\n Program(_path, state) {\n state[\"defaultImportName\"] = null;\n },\n\n // Step 1: Find the default import from \"style-inject.es.js\"\n ImportDeclaration(path, state) {\n // Skip, if the default import name is already found (assuming there is only one per-file)\n if (state[\"defaultImportName\"]) {\n return;\n }\n\n // Look for imports for \"style-inject.es.js\" file\n const importSource = path.node.source.value;\n if (!importSource.endsWith(\"style-inject.es.js\")) {\n return;\n }\n\n // Check for default import specifier\n const defaultSpecifier = path.node.specifiers.find((specifier) =>\n babelTypes.isImportDefaultSpecifier(specifier),\n ) as babelTypes.ImportDefaultSpecifier | undefined;\n\n // Store the default import name\n if (defaultSpecifier) {\n // Fail if two instances of file is found\n state[\"defaultImportName\"] = defaultSpecifier.local.name;\n } else {\n throw new Error(\n \"Import for `style-inject.es.js` file not found in file\",\n );\n }\n },\n\n // Step 2: Find all calls to the imported identifier\n CallExpression(path, state) {\n // Ignore if the default import name is not found\n if (!state[\"defaultImportName\"]) {\n return;\n }\n\n // Check if the callee is the default import identifier\n const callee = path.node.callee;\n if (\n babelTypes.isIdentifier(callee) &&\n callee.name === state[\"defaultImportName\"]\n ) {\n const args = path.node.arguments;\n\n // If arguments are not between 1 and 2, fail\n if (!(args.length >= 1 && args.length <= 2)) {\n throw new Error(\"Unexpected number of arguments\");\n }\n\n // Check if the arguments are string literals (2nd argument is optional)\n if (\n !(\n babelTypes.isStringLiteral(args[0]) &&\n (!args[1] || babelTypes.isStringLiteral(args[1]))\n )\n ) {\n throw new Error(\"Unexpected argument types\");\n }\n\n // CSS string\n const firstArgValue = args[0].value;\n\n // Generate MD5 hash of the first argument's value\n // TODO: Looked into that styled-components use murmurhash. Also it's possible to use sha1 for longer key\n // (less % of collision)\n const hash = generateMd5(firstArgValue);\n\n // Add the hash as the second argument\n const hashArg = babelTypes.stringLiteral(hash);\n if (args.length > 1) {\n // If a second argument exists, replace it\n args[1] = hashArg;\n } else {\n // Otherwise, add it as a new second argument\n args.push(hashArg);\n }\n }\n },\n },\n } satisfies Plugin;\n};\n"],"names":["generateMd5","input","crypto","createHash","update","digest","transformCssModule","visitor","Program","_path","state","ImportDeclaration","path","importSource","node","source","value","endsWith","defaultSpecifier","specifiers","find","specifier","babelTypes","isImportDefaultSpecifier","local","name","Error","CallExpression","callee","isIdentifier","args","arguments","length","isStringLiteral","firstArgValue","hash","hashArg","stringLiteral","push"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAASA,YAAYC,KAAuB,EAAA;EACnC,OAAAC,eAAA,CAAA,SAAA,CAAA,CAAOC,WAAW,KAAK,CAAA,CAAEC,OAAOH,KAAK,CAAA,CAAEI,OAAO,KAAK,CAAA;AAC5D;AAWO,MAAMC,qBAAqBA,CAAA,KAAc;EACvC,OAAA;IACLC,OAAS,EAAA;MAAA;MAEPC,OAAAA,CAAQC,OAAOC,KAAO,EAAA;QACpBA,KAAA,CAAM,mBAAmB,CAAI,GAAA,IAAA;MAC/B,CAAA;MAAA;MAGAC,iBAAAA,CAAkBC,MAAMF,KAAO,EAAA;QAEzB,IAAAA,KAAA,CAAM,mBAAmB,CAAG,EAAA;UAC9B;QACF;QAGM,MAAAG,YAAA,GAAeD,IAAK,CAAAE,IAAA,CAAKC,MAAO,CAAAC,KAAA;QACtC,IAAI,CAACH,YAAA,CAAaI,QAAS,CAAA,oBAAoB,CAAG,EAAA;UAChD;QACF;QAGM,MAAAC,gBAAA,GAAmBN,IAAK,CAAAE,IAAA,CAAKK,UAAW,CAAAC,IAAA,CAAMC,SAAA,IAClDC,qBAAW,CAAAC,wBAAA,CAAyBF,SAAS,CAAA,CAC/C;QAGA,IAAIH,gBAAkB,EAAA;UAEdR,KAAA,CAAA,mBAAmB,CAAI,GAAAQ,gBAAA,CAAiBM,KAAM,CAAAC,IAAA;QAAA,CAC/C,MAAA;UACL,MAAM,IAAIC,KAAA,CACR,wDAAA,CACF;QACF;MACF,CAAA;MAAA;MAGAC,cAAAA,CAAef,MAAMF,KAAO,EAAA;QAEtB,IAAA,CAACA,KAAM,CAAA,mBAAmB,CAAG,EAAA;UAC/B;QACF;QAGM,MAAAkB,MAAA,GAAShB,KAAKE,IAAK,CAAAc,MAAA;QAEvB,IAAAN,qBAAA,CAAWO,aAAaD,MAAM,CAAA,IAC9BA,OAAOH,IAAS,KAAAf,KAAA,CAAM,mBAAmB,CACzC,EAAA;UACM,MAAAoB,IAAA,GAAOlB,KAAKE,IAAK,CAAAiB,SAAA;UAGvB,IAAI,EAAED,IAAK,CAAAE,MAAA,IAAU,CAAK,IAAAF,IAAA,CAAKE,UAAU,CAAI,CAAA,EAAA;YACrC,MAAA,IAAIN,MAAM,gCAAgC,CAAA;UAClD;UAGA,IACE,EACEJ,qBAAW,CAAAW,eAAA,CAAgBH,IAAK,CAAA,CAAC,CAAC,CACjC,KAAA,CAACA,IAAK,CAAA,CAAC,KAAKR,qBAAW,CAAAW,eAAA,CAAgBH,IAAK,CAAA,CAAC,CAAC,CAEjD,CAAA,CAAA,EAAA;YACM,MAAA,IAAIJ,MAAM,2BAA2B,CAAA;UAC7C;UAGM,MAAAQ,aAAA,GAAgBJ,IAAK,CAAA,CAAC,CAAE,CAAAd,KAAA;UAKxB,MAAAmB,IAAA,GAAOnC,YAAYkC,aAAa,CAAA;UAGhC,MAAAE,OAAA,GAAUd,qBAAW,CAAAe,aAAA,CAAcF,IAAI,CAAA;UACzC,IAAAL,IAAA,CAAKE,SAAS,CAAG,EAAA;YAEnBF,IAAA,CAAK,CAAC,CAAI,GAAAM,OAAA;UAAA,CACL,MAAA;YAELN,IAAA,CAAKQ,KAAKF,OAAO,CAAA;UACnB;QACF;MACF;IACF;EAAA,CACF;AACF,CAAA;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as babelTypes from '@babel/types';
|
|
2
|
+
import crypto from 'node:crypto';
|
|
3
|
+
"use strict";
|
|
4
|
+
function generateMd5(input) {
|
|
5
|
+
return crypto.createHash("md5").update(input).digest("hex");
|
|
6
|
+
}
|
|
7
|
+
const transformCssModule = () => {
|
|
8
|
+
return {
|
|
9
|
+
visitor: {
|
|
10
|
+
// Step 0: Setup state
|
|
11
|
+
Program(_path, state) {
|
|
12
|
+
state["defaultImportName"] = null;
|
|
13
|
+
},
|
|
14
|
+
// Step 1: Find the default import from "style-inject.es.js"
|
|
15
|
+
ImportDeclaration(path, state) {
|
|
16
|
+
if (state["defaultImportName"]) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const importSource = path.node.source.value;
|
|
20
|
+
if (!importSource.endsWith("style-inject.es.js")) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const defaultSpecifier = path.node.specifiers.find(specifier => babelTypes.isImportDefaultSpecifier(specifier));
|
|
24
|
+
if (defaultSpecifier) {
|
|
25
|
+
state["defaultImportName"] = defaultSpecifier.local.name;
|
|
26
|
+
} else {
|
|
27
|
+
throw new Error("Import for `style-inject.es.js` file not found in file");
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
// Step 2: Find all calls to the imported identifier
|
|
31
|
+
CallExpression(path, state) {
|
|
32
|
+
if (!state["defaultImportName"]) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const callee = path.node.callee;
|
|
36
|
+
if (babelTypes.isIdentifier(callee) && callee.name === state["defaultImportName"]) {
|
|
37
|
+
const args = path.node.arguments;
|
|
38
|
+
if (!(args.length >= 1 && args.length <= 2)) {
|
|
39
|
+
throw new Error("Unexpected number of arguments");
|
|
40
|
+
}
|
|
41
|
+
if (!(babelTypes.isStringLiteral(args[0]) && (!args[1] || babelTypes.isStringLiteral(args[1])))) {
|
|
42
|
+
throw new Error("Unexpected argument types");
|
|
43
|
+
}
|
|
44
|
+
const firstArgValue = args[0].value;
|
|
45
|
+
const hash = generateMd5(firstArgValue);
|
|
46
|
+
const hashArg = babelTypes.stringLiteral(hash);
|
|
47
|
+
if (args.length > 1) {
|
|
48
|
+
args[1] = hashArg;
|
|
49
|
+
} else {
|
|
50
|
+
args.push(hashArg);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export { transformCssModule };
|
|
58
|
+
//# sourceMappingURL=transform-css-module.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-css-module.mjs","sources":["../../../../src/utils/nextjs/ssr/transform-css-module.ts"],"sourcesContent":["import type { PluginObj } from \"@babel/core\";\nimport * as babelTypes from \"@babel/types\";\nimport crypto from \"node:crypto\";\n\nfunction generateMd5(input: string): string {\n return crypto.createHash(\"md5\").update(input).digest(\"hex\");\n}\n\ntype Plugin = PluginObj<{\n // Store the name of the default import identifier for \"style-inject.es.js\"\n defaultImportName: null | string;\n}>;\n\n/**\n * Currently this plugin won't:\n * - Handle existing source maps correctly and would strip from the output: \"//# sourceMappingURL=BubbleContainer.module.css.js.map\"\n */\nexport const transformCssModule = (): Plugin => {\n return {\n visitor: {\n // Step 0: Setup state\n Program(_path, state) {\n state[\"defaultImportName\"] = null;\n },\n\n // Step 1: Find the default import from \"style-inject.es.js\"\n ImportDeclaration(path, state) {\n // Skip, if the default import name is already found (assuming there is only one per-file)\n if (state[\"defaultImportName\"]) {\n return;\n }\n\n // Look for imports for \"style-inject.es.js\" file\n const importSource = path.node.source.value;\n if (!importSource.endsWith(\"style-inject.es.js\")) {\n return;\n }\n\n // Check for default import specifier\n const defaultSpecifier = path.node.specifiers.find((specifier) =>\n babelTypes.isImportDefaultSpecifier(specifier),\n ) as babelTypes.ImportDefaultSpecifier | undefined;\n\n // Store the default import name\n if (defaultSpecifier) {\n // Fail if two instances of file is found\n state[\"defaultImportName\"] = defaultSpecifier.local.name;\n } else {\n throw new Error(\n \"Import for `style-inject.es.js` file not found in file\",\n );\n }\n },\n\n // Step 2: Find all calls to the imported identifier\n CallExpression(path, state) {\n // Ignore if the default import name is not found\n if (!state[\"defaultImportName\"]) {\n return;\n }\n\n // Check if the callee is the default import identifier\n const callee = path.node.callee;\n if (\n babelTypes.isIdentifier(callee) &&\n callee.name === state[\"defaultImportName\"]\n ) {\n const args = path.node.arguments;\n\n // If arguments are not between 1 and 2, fail\n if (!(args.length >= 1 && args.length <= 2)) {\n throw new Error(\"Unexpected number of arguments\");\n }\n\n // Check if the arguments are string literals (2nd argument is optional)\n if (\n !(\n babelTypes.isStringLiteral(args[0]) &&\n (!args[1] || babelTypes.isStringLiteral(args[1]))\n )\n ) {\n throw new Error(\"Unexpected argument types\");\n }\n\n // CSS string\n const firstArgValue = args[0].value;\n\n // Generate MD5 hash of the first argument's value\n // TODO: Looked into that styled-components use murmurhash. Also it's possible to use sha1 for longer key\n // (less % of collision)\n const hash = generateMd5(firstArgValue);\n\n // Add the hash as the second argument\n const hashArg = babelTypes.stringLiteral(hash);\n if (args.length > 1) {\n // If a second argument exists, replace it\n args[1] = hashArg;\n } else {\n // Otherwise, add it as a new second argument\n args.push(hashArg);\n }\n }\n },\n },\n } satisfies Plugin;\n};\n"],"names":["generateMd5","input","crypto","createHash","update","digest","transformCssModule","visitor","Program","_path","state","ImportDeclaration","path","importSource","node","source","value","endsWith","defaultSpecifier","specifiers","find","specifier","babelTypes","isImportDefaultSpecifier","local","name","Error","CallExpression","callee","isIdentifier","args","arguments","length","isStringLiteral","firstArgValue","hash","hashArg","stringLiteral","push"],"mappings":";;;AAIA,SAASA,YAAYC,KAAuB,EAAA;EACnC,OAAAC,MAAA,CAAOC,WAAW,KAAK,CAAA,CAAEC,OAAOH,KAAK,CAAA,CAAEI,OAAO,KAAK,CAAA;AAC5D;AAWO,MAAMC,qBAAqBA,CAAA,KAAc;EACvC,OAAA;IACLC,OAAS,EAAA;MAAA;MAEPC,OAAAA,CAAQC,OAAOC,KAAO,EAAA;QACpBA,KAAA,CAAM,mBAAmB,CAAI,GAAA,IAAA;MAC/B,CAAA;MAAA;MAGAC,iBAAAA,CAAkBC,MAAMF,KAAO,EAAA;QAEzB,IAAAA,KAAA,CAAM,mBAAmB,CAAG,EAAA;UAC9B;QACF;QAGM,MAAAG,YAAA,GAAeD,IAAK,CAAAE,IAAA,CAAKC,MAAO,CAAAC,KAAA;QACtC,IAAI,CAACH,YAAA,CAAaI,QAAS,CAAA,oBAAoB,CAAG,EAAA;UAChD;QACF;QAGM,MAAAC,gBAAA,GAAmBN,IAAK,CAAAE,IAAA,CAAKK,UAAW,CAAAC,IAAA,CAAMC,SAAA,IAClDC,UAAW,CAAAC,wBAAA,CAAyBF,SAAS,CAAA,CAC/C;QAGA,IAAIH,gBAAkB,EAAA;UAEdR,KAAA,CAAA,mBAAmB,CAAI,GAAAQ,gBAAA,CAAiBM,KAAM,CAAAC,IAAA;QAAA,CAC/C,MAAA;UACL,MAAM,IAAIC,KAAA,CACR,wDAAA,CACF;QACF;MACF,CAAA;MAAA;MAGAC,cAAAA,CAAef,MAAMF,KAAO,EAAA;QAEtB,IAAA,CAACA,KAAM,CAAA,mBAAmB,CAAG,EAAA;UAC/B;QACF;QAGM,MAAAkB,MAAA,GAAShB,KAAKE,IAAK,CAAAc,MAAA;QAEvB,IAAAN,UAAA,CAAWO,aAAaD,MAAM,CAAA,IAC9BA,OAAOH,IAAS,KAAAf,KAAA,CAAM,mBAAmB,CACzC,EAAA;UACM,MAAAoB,IAAA,GAAOlB,KAAKE,IAAK,CAAAiB,SAAA;UAGvB,IAAI,EAAED,IAAK,CAAAE,MAAA,IAAU,CAAK,IAAAF,IAAA,CAAKE,UAAU,CAAI,CAAA,EAAA;YACrC,MAAA,IAAIN,MAAM,gCAAgC,CAAA;UAClD;UAGA,IACE,EACEJ,UAAW,CAAAW,eAAA,CAAgBH,IAAK,CAAA,CAAC,CAAC,CACjC,KAAA,CAACA,IAAK,CAAA,CAAC,KAAKR,UAAW,CAAAW,eAAA,CAAgBH,IAAK,CAAA,CAAC,CAAC,CAEjD,CAAA,CAAA,EAAA;YACM,MAAA,IAAIJ,MAAM,2BAA2B,CAAA;UAC7C;UAGM,MAAAQ,aAAA,GAAgBJ,IAAK,CAAA,CAAC,CAAE,CAAAd,KAAA;UAKxB,MAAAmB,IAAA,GAAOnC,YAAYkC,aAAa,CAAA;UAGhC,MAAAE,OAAA,GAAUd,UAAW,CAAAe,aAAA,CAAcF,IAAI,CAAA;UACzC,IAAAL,IAAA,CAAKE,SAAS,CAAG,EAAA;YAEnBF,IAAA,CAAK,CAAC,CAAI,GAAAM,OAAA;UAAA,CACL,MAAA;YAELN,IAAA,CAAKQ,KAAKF,OAAO,CAAA;UACnB;QACF;MACF;IACF;EAAA,CACF;AACF,CAAA;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringifyForInject.js","sources":["../../../src/utils/nextjs/stringifyForInject.ts"],"sourcesContent":["/**\n * Utility to help escape variables for Webpack's DefinePlugin\n * @see https://webpack.js.org/plugins/define-plugin/#:~:text=The%20DefinePlugin%20replaces%20variables%20in,development%20builds%20and%20production%20builds.\n */\nexport const stringifyForInject = (val: unknown): unknown => {\n switch (typeof val) {\n case \"string\":\n return JSON.stringify(val);\n case \"bigint\":\n case \"boolean\":\n case \"function\":\n case \"number\":\n case \"undefined\":\n return val;\n case \"symbol\":\n throw new Error(`Can't inject Symbol`);\n case \"object\": {\n if (Array.isArray(val)) {\n return val.map((nestedVal) => stringifyForInject(nestedVal));\n }\n\n const stringifiedObject: { [key: string]: unknown } = {};\n for (const key in val) {\n // @ts-expect-error Expect to fail as we are working with unknowns\n const nestedVal = val[key];\n stringifiedObject[key] = stringifyForInject(nestedVal);\n }\n return stringifiedObject;\n }\n default: {\n throw new Error(\"Unsupported value type\");\n }\n }\n};\n"],"names":["stringifyForInject","val","JSON","stringify","Error","Array","isArray","map","nestedVal","stringifiedObject","key"],"mappings":";;;AAIa,MAAAA,kBAAA,GAAsBC,GAA0B,IAAA;EAC3D,QAAQ,OAAOA,GAAK;IAClB,KAAK,QAAA;MACI,OAAAC,IAAA,CAAKC,UAAUF,GAAG,CAAA;IAC3B,KAAK,QAAA;IACL,KAAK,SAAA;IACL,KAAK,UAAA;IACL,KAAK,QAAA;IACL,KAAK,WAAA;MACI,OAAAA,GAAA;IACT,KAAK,QAAA;MACG,MAAA,IAAIG,
|
|
1
|
+
{"version":3,"file":"stringifyForInject.js","sources":["../../../src/utils/nextjs/stringifyForInject.ts"],"sourcesContent":["/**\n * Utility to help escape variables for Webpack's DefinePlugin\n * @see https://webpack.js.org/plugins/define-plugin/#:~:text=The%20DefinePlugin%20replaces%20variables%20in,development%20builds%20and%20production%20builds.\n */\nexport const stringifyForInject = (val: unknown): unknown => {\n switch (typeof val) {\n case \"string\":\n return JSON.stringify(val);\n case \"bigint\":\n case \"boolean\":\n case \"function\":\n case \"number\":\n case \"undefined\":\n return val;\n case \"symbol\":\n throw new Error(`Can't inject Symbol`);\n case \"object\": {\n if (Array.isArray(val)) {\n return val.map((nestedVal) => stringifyForInject(nestedVal));\n }\n\n const stringifiedObject: { [key: string]: unknown } = {};\n for (const key in val) {\n // @ts-expect-error Expect to fail as we are working with unknowns\n const nestedVal = val[key];\n stringifiedObject[key] = stringifyForInject(nestedVal);\n }\n return stringifiedObject;\n }\n default: {\n throw new Error(\"Unsupported value type\");\n }\n }\n};\n"],"names":["stringifyForInject","val","JSON","stringify","Error","Array","isArray","map","nestedVal","stringifiedObject","key"],"mappings":";;;AAIa,MAAAA,kBAAA,GAAsBC,GAA0B,IAAA;EAC3D,QAAQ,OAAOA,GAAK;IAClB,KAAK,QAAA;MACI,OAAAC,IAAA,CAAKC,UAAUF,GAAG,CAAA;IAC3B,KAAK,QAAA;IACL,KAAK,SAAA;IACL,KAAK,UAAA;IACL,KAAK,QAAA;IACL,KAAK,WAAA;MACI,OAAAA,GAAA;IACT,KAAK,QAAA;MACG,MAAA,IAAIG,MAAM,qBAAqB,CAAA;IACvC,KAAK,QAAU;MAAA;QACT,IAAAC,KAAA,CAAMC,OAAQ,CAAAL,GAAG,CAAG,EAAA;UACtB,OAAOA,IAAIM,GAAI,CAACC,SAAc,IAAAR,kBAAA,CAAmBQ,SAAS,CAAC,CAAA;QAC7D;QAEA,MAAMC,oBAAgD,CAAA,CAAC;QACvD,KAAA,MAAWC,OAAOT,GAAK,EAAA;UAEf,MAAAO,SAAA,GAAYP,IAAIS,GAAG,CAAA;UACPD,iBAAA,CAAAC,GAAG,CAAI,GAAAV,kBAAA,CAAmBQ,SAAS,CAAA;QACvD;QACO,OAAAC,iBAAA;MACT;IACA;MAAS;QACD,MAAA,IAAIL,MAAM,wBAAwB,CAAA;MAC1C;EACF;AACF,CAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringifyForInject.mjs","sources":["../../../src/utils/nextjs/stringifyForInject.ts"],"sourcesContent":["/**\n * Utility to help escape variables for Webpack's DefinePlugin\n * @see https://webpack.js.org/plugins/define-plugin/#:~:text=The%20DefinePlugin%20replaces%20variables%20in,development%20builds%20and%20production%20builds.\n */\nexport const stringifyForInject = (val: unknown): unknown => {\n switch (typeof val) {\n case \"string\":\n return JSON.stringify(val);\n case \"bigint\":\n case \"boolean\":\n case \"function\":\n case \"number\":\n case \"undefined\":\n return val;\n case \"symbol\":\n throw new Error(`Can't inject Symbol`);\n case \"object\": {\n if (Array.isArray(val)) {\n return val.map((nestedVal) => stringifyForInject(nestedVal));\n }\n\n const stringifiedObject: { [key: string]: unknown } = {};\n for (const key in val) {\n // @ts-expect-error Expect to fail as we are working with unknowns\n const nestedVal = val[key];\n stringifiedObject[key] = stringifyForInject(nestedVal);\n }\n return stringifiedObject;\n }\n default: {\n throw new Error(\"Unsupported value type\");\n }\n }\n};\n"],"names":["stringifyForInject","val","JSON","stringify","Error","Array","isArray","map","nestedVal","stringifiedObject","key"],"mappings":";;AAIa,MAAAA,kBAAA,GAAsBC,GAA0B,IAAA;EAC3D,QAAQ,OAAOA,GAAK;IAClB,KAAK,QAAA;MACI,OAAAC,IAAA,CAAKC,UAAUF,GAAG,CAAA;IAC3B,KAAK,QAAA;IACL,KAAK,SAAA;IACL,KAAK,UAAA;IACL,KAAK,QAAA;IACL,KAAK,WAAA;MACI,OAAAA,GAAA;IACT,KAAK,QAAA;MACG,MAAA,IAAIG,
|
|
1
|
+
{"version":3,"file":"stringifyForInject.mjs","sources":["../../../src/utils/nextjs/stringifyForInject.ts"],"sourcesContent":["/**\n * Utility to help escape variables for Webpack's DefinePlugin\n * @see https://webpack.js.org/plugins/define-plugin/#:~:text=The%20DefinePlugin%20replaces%20variables%20in,development%20builds%20and%20production%20builds.\n */\nexport const stringifyForInject = (val: unknown): unknown => {\n switch (typeof val) {\n case \"string\":\n return JSON.stringify(val);\n case \"bigint\":\n case \"boolean\":\n case \"function\":\n case \"number\":\n case \"undefined\":\n return val;\n case \"symbol\":\n throw new Error(`Can't inject Symbol`);\n case \"object\": {\n if (Array.isArray(val)) {\n return val.map((nestedVal) => stringifyForInject(nestedVal));\n }\n\n const stringifiedObject: { [key: string]: unknown } = {};\n for (const key in val) {\n // @ts-expect-error Expect to fail as we are working with unknowns\n const nestedVal = val[key];\n stringifiedObject[key] = stringifyForInject(nestedVal);\n }\n return stringifiedObject;\n }\n default: {\n throw new Error(\"Unsupported value type\");\n }\n }\n};\n"],"names":["stringifyForInject","val","JSON","stringify","Error","Array","isArray","map","nestedVal","stringifiedObject","key"],"mappings":";;AAIa,MAAAA,kBAAA,GAAsBC,GAA0B,IAAA;EAC3D,QAAQ,OAAOA,GAAK;IAClB,KAAK,QAAA;MACI,OAAAC,IAAA,CAAKC,UAAUF,GAAG,CAAA;IAC3B,KAAK,QAAA;IACL,KAAK,SAAA;IACL,KAAK,UAAA;IACL,KAAK,QAAA;IACL,KAAK,WAAA;MACI,OAAAA,GAAA;IACT,KAAK,QAAA;MACG,MAAA,IAAIG,MAAM,qBAAqB,CAAA;IACvC,KAAK,QAAU;MAAA;QACT,IAAAC,KAAA,CAAMC,OAAQ,CAAAL,GAAG,CAAG,EAAA;UACtB,OAAOA,IAAIM,GAAI,CAACC,SAAc,IAAAR,kBAAA,CAAmBQ,SAAS,CAAC,CAAA;QAC7D;QAEA,MAAMC,oBAAgD,CAAA,CAAC;QACvD,KAAA,MAAWC,OAAOT,GAAK,EAAA;UAEf,MAAAO,SAAA,GAAYP,IAAIS,GAAG,CAAA;UACPD,iBAAA,CAAAC,GAAG,CAAI,GAAAV,kBAAA,CAAmBQ,SAAS,CAAA;QACvD;QACO,OAAAC,iBAAA;MACT;IACA;MAAS;QACD,MAAA,IAAIL,MAAM,wBAAwB,CAAA;MAC1C;EACF;AACF,CAAA;"}
|
package/lib/utils/number.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.js","sources":["../../src/utils/number.ts"],"sourcesContent":["/**\n * Util to easily parse that any given input is a finite number (not NaN, Infinity, -Infinity, etc.)\n * @throws If given input is not a finite number\n */\nexport function isFiniteNumber(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n if (typeof value !== \"number\" || Number.isNaN(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a number: ${value}`);\n }\n\n if (!Number.isFinite(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a finite number: ${value}`);\n }\n}\n\n/**\n * Custom isInt validation function that returns a more fine-grained error message otherwise for type safety alone a\n * Number.isSafeInteger would be sufficient.\n *\n * Code inspired from graphql-scalars library.\n * @see\n * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L20-L32\n * @throws If given input is not a valid integer\n */\nexport function isInt(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n isFiniteNumber(value, entity, ErrorClass);\n\n if (!Number.isInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not an integer: ${value}`);\n }\n\n if (!Number.isSafeInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a safe integer: ${value}`);\n }\n}\n\n/**\n * Custom isFloat validation function that returns a more fine-grained error message otherwise for type safety alone a\n * Number.parseFloat would be sufficient.\n *\n * Code inspired from graphql-scalars library.\n * @see\n * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L34-L38\n * @throws If given input is not a valid float\n */\nexport function isFloat(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n isFiniteNumber(value, entity, ErrorClass);\n}\n\n/**\n * Returns a string representing a number in fixed-point notation.\n * Overload: Returns the rate parsed as a number\n * @example\n * toFixed(1.2345, 2) // => \"1.23\"\n * toFixed(1.2345, 0) // => \"1\"\n * toFixed(1.23, 4) // => \"1.2300\"\n */\nexport function toFixedRate(\n rate: number,\n scale: number,\n asNumber?: boolean,\n): string;\nexport function toFixedRate(\n rate: number,\n scale: number,\n asNumber: true,\n): number;\nexport function toFixedRate(rate: number, scale: number, asNumber?: boolean) {\n // Verify rate\n isFloat(rate, \"Rate\");\n\n const fixedRate = rate.toFixed(scale);\n\n return asNumber ? +fixedRate : fixedRate;\n}\n\n/**\n * Util to convert a float number to a string. Using this rather than simple template string to have a consistent way of\n * doing it. Removes any redundant trailing zeros.\n * @example\n * numberToString(1.23) // => \"1.23\"\n * numberToString(10.00) // => \"10\"\n * @throws If given input is not a valid number\n */\nexport const numberToString = (num: number): string => {\n isFloat(num);\n return num.toString(10);\n};\n\n/**\n * @see https://stackoverflow.com/a/35000557\n */\nexport const findClosestNumber = <T extends number>(\n haystack: T[],\n needle: number,\n): T => {\n return haystack.reduce((prev, curr) =>\n Math.abs(curr - needle) < Math.abs(prev - needle) ? curr : prev,\n );\n};\n\n/**\n * Splits number into array by max value provided.\n * E.g. splitNumberBy(100, 30) => [30, 30, 30, 10]\n */\nexport const splitNumberBy = (value: number, by: number) => {\n const chunks = new Array(Math.floor(value / by)).fill(by);\n const remainder = value % by;\n\n if (remainder > 0) {\n chunks.push(remainder);\n }\n\n return chunks;\n};\n\n/**\n * Clamp value to a given range\n */\nexport const clamp = (val: number, min: number, max: number) => {\n const trueMin = Math.min(min, max);\n const trueMax = Math.max(min, max);\n\n return Math.min(trueMax, Math.max(trueMin, val));\n};\n\n/**\n * Interpolate a number to a new range\n *\n * @example\n * linearInterpolate(5, [0, 10], [0, 100]); // 50\n */\nexport const linearInterpolate = (\n inputY: number,\n [fromMin, fromMax]: [number, number],\n [toMin, toMax]: [number, number],\n clampResult = true,\n) => {\n const percent = (inputY - fromMin) / (fromMax - fromMin);\n const outputX = percent * (toMax - toMin) + toMin;\n\n return clampResult ? clamp(outputX, toMin, toMax) : outputX;\n};\n\n/**\n * Increase value and start over once the range is overflown\n */\nexport const incrementLoopValue = (\n value: number,\n [min, max]: [number, number],\n) => {\n if (value === max) {\n return min;\n }\n return value + 1;\n};\n"],"names":["isFiniteNumber","value","entity","ErrorClass","TypeError","Number","isNaN","isFinite","isInt","isInteger","isSafeInteger","isFloat","toFixedRate","rate","scale","asNumber","fixedRate","toFixed","numberToString","num","toString","findClosestNumber","haystack","needle","reduce","prev","curr","Math","abs","splitNumberBy","by","chunks","Array","floor","fill","remainder","push","clamp","val","min","max","trueMin","trueMax","linearInterpolate","inputY","fromMin","fromMax","toMin","toMax","clampResult","percent","outputX","incrementLoopValue"],"mappings":";;;AAIO,SAASA,cACdA,CAAAC,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACzB,IAAI,OAAOH,KAAU,KAAA,QAAA,IAAYI,MAAO,CAAAC,KAAA,CAAML,KAAK,CAAG,EAAA;IAEpD,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,qBAAqBD,
|
|
1
|
+
{"version":3,"file":"number.js","sources":["../../src/utils/number.ts"],"sourcesContent":["/**\n * Util to easily parse that any given input is a finite number (not NaN, Infinity, -Infinity, etc.)\n * @throws If given input is not a finite number\n */\nexport function isFiniteNumber(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n if (typeof value !== \"number\" || Number.isNaN(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a number: ${value}`);\n }\n\n if (!Number.isFinite(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a finite number: ${value}`);\n }\n}\n\n/**\n * Custom isInt validation function that returns a more fine-grained error message otherwise for type safety alone a\n * Number.isSafeInteger would be sufficient.\n *\n * Code inspired from graphql-scalars library.\n * @see\n * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L20-L32\n * @throws If given input is not a valid integer\n */\nexport function isInt(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n isFiniteNumber(value, entity, ErrorClass);\n\n if (!Number.isInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not an integer: ${value}`);\n }\n\n if (!Number.isSafeInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a safe integer: ${value}`);\n }\n}\n\n/**\n * Custom isFloat validation function that returns a more fine-grained error message otherwise for type safety alone a\n * Number.parseFloat would be sufficient.\n *\n * Code inspired from graphql-scalars library.\n * @see\n * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L34-L38\n * @throws If given input is not a valid float\n */\nexport function isFloat(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n isFiniteNumber(value, entity, ErrorClass);\n}\n\n/**\n * Returns a string representing a number in fixed-point notation.\n * Overload: Returns the rate parsed as a number\n * @example\n * toFixed(1.2345, 2) // => \"1.23\"\n * toFixed(1.2345, 0) // => \"1\"\n * toFixed(1.23, 4) // => \"1.2300\"\n */\nexport function toFixedRate(\n rate: number,\n scale: number,\n asNumber?: boolean,\n): string;\nexport function toFixedRate(\n rate: number,\n scale: number,\n asNumber: true,\n): number;\nexport function toFixedRate(rate: number, scale: number, asNumber?: boolean) {\n // Verify rate\n isFloat(rate, \"Rate\");\n\n const fixedRate = rate.toFixed(scale);\n\n return asNumber ? +fixedRate : fixedRate;\n}\n\n/**\n * Util to convert a float number to a string. Using this rather than simple template string to have a consistent way of\n * doing it. Removes any redundant trailing zeros.\n * @example\n * numberToString(1.23) // => \"1.23\"\n * numberToString(10.00) // => \"10\"\n * @throws If given input is not a valid number\n */\nexport const numberToString = (num: number): string => {\n isFloat(num);\n return num.toString(10);\n};\n\n/**\n * @see https://stackoverflow.com/a/35000557\n */\nexport const findClosestNumber = <T extends number>(\n haystack: T[],\n needle: number,\n): T => {\n return haystack.reduce((prev, curr) =>\n Math.abs(curr - needle) < Math.abs(prev - needle) ? curr : prev,\n );\n};\n\n/**\n * Splits number into array by max value provided.\n * E.g. splitNumberBy(100, 30) => [30, 30, 30, 10]\n */\nexport const splitNumberBy = (value: number, by: number) => {\n const chunks = new Array(Math.floor(value / by)).fill(by);\n const remainder = value % by;\n\n if (remainder > 0) {\n chunks.push(remainder);\n }\n\n return chunks;\n};\n\n/**\n * Clamp value to a given range\n */\nexport const clamp = (val: number, min: number, max: number) => {\n const trueMin = Math.min(min, max);\n const trueMax = Math.max(min, max);\n\n return Math.min(trueMax, Math.max(trueMin, val));\n};\n\n/**\n * Interpolate a number to a new range\n *\n * @example\n * linearInterpolate(5, [0, 10], [0, 100]); // 50\n */\nexport const linearInterpolate = (\n inputY: number,\n [fromMin, fromMax]: [number, number],\n [toMin, toMax]: [number, number],\n clampResult = true,\n) => {\n const percent = (inputY - fromMin) / (fromMax - fromMin);\n const outputX = percent * (toMax - toMin) + toMin;\n\n return clampResult ? clamp(outputX, toMin, toMax) : outputX;\n};\n\n/**\n * Increase value and start over once the range is overflown\n */\nexport const incrementLoopValue = (\n value: number,\n [min, max]: [number, number],\n) => {\n if (value === max) {\n return min;\n }\n return value + 1;\n};\n"],"names":["isFiniteNumber","value","entity","ErrorClass","TypeError","Number","isNaN","isFinite","isInt","isInteger","isSafeInteger","isFloat","toFixedRate","rate","scale","asNumber","fixedRate","toFixed","numberToString","num","toString","findClosestNumber","haystack","needle","reduce","prev","curr","Math","abs","splitNumberBy","by","chunks","Array","floor","fill","remainder","push","clamp","val","min","max","trueMin","trueMax","linearInterpolate","inputY","fromMin","fromMax","toMin","toMax","clampResult","percent","outputX","incrementLoopValue"],"mappings":";;;AAIO,SAASA,cACdA,CAAAC,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACzB,IAAI,OAAOH,KAAU,KAAA,QAAA,IAAYI,MAAO,CAAAC,KAAA,CAAML,KAAK,CAAG,EAAA;IAEpD,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,qBAAqBD,KAAK,EAAE,CAAA;EAC5D;EAEA,IAAI,CAACI,MAAA,CAAOE,QAAS,CAAAN,KAAK,CAAG,EAAA;IAE3B,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,4BAA4BD,KAAK,EAAE,CAAA;EACnE;AACF;AAWO,SAASO,KACdA,CAAAP,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACVJ,cAAA,CAAAC,KAAA,EAAOC,QAAQC,UAAU,CAAA;EAExC,IAAI,CAACE,MAAA,CAAOI,SAAU,CAAAR,KAAK,CAAG,EAAA;IAE5B,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,uBAAuBD,KAAK,EAAE,CAAA;EAC9D;EAEA,IAAI,CAACI,MAAA,CAAOK,aAAc,CAAAT,KAAK,CAAG,EAAA;IAEhC,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,2BAA2BD,KAAK,EAAE,CAAA;EAClE;AACF;AAWO,SAASU,OACdA,CAAAV,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACVJ,cAAA,CAAAC,KAAA,EAAOC,QAAQC,UAAU,CAAA;AAC1C;AAoBgB,SAAAS,WAAAA,CAAYC,IAAc,EAAAC,KAAA,EAAeC,QAAoB,EAAA;EAE3EJ,OAAA,CAAQE,MAAM,MAAM,CAAA;EAEd,MAAAG,SAAA,GAAYH,IAAK,CAAAI,OAAA,CAAQH,KAAK,CAAA;EAE7B,OAAAC,QAAA,GAAW,CAACC,SAAY,GAAAA,SAAA;AACjC;AAUa,MAAAE,cAAA,GAAkBC,GAAwB,IAAA;EACrDR,OAAA,CAAQQ,GAAG,CAAA;EACJ,OAAAA,GAAA,CAAIC,SAAS,EAAE,CAAA;AACxB,CAAA;AAKa,MAAAC,iBAAA,GAAoBA,CAC/BC,QAAA,EACAC,MACM,KAAA;EACN,OAAOD,QAAS,CAAAE,MAAA,CAAO,CAACC,IAAA,EAAMC,IAC5B,KAAAC,IAAA,CAAKC,GAAI,CAAAF,IAAA,GAAOH,MAAM,CAAA,GAAII,IAAK,CAAAC,GAAA,CAAIH,IAAO,GAAAF,MAAM,IAAIG,IAAO,GAAAD,IAAA,CAC7D;AACF,CAAA;AAMa,MAAAI,aAAA,GAAgBA,CAAC5B,KAAA,EAAe6B,EAAe,KAAA;EACpD,MAAAC,MAAA,GAAS,IAAIC,KAAA,CAAML,IAAK,CAAAM,KAAA,CAAMhC,QAAQ6B,EAAE,CAAC,CAAE,CAAAI,IAAA,CAAKJ,EAAE,CAAA;EACxD,MAAMK,YAAYlC,KAAQ,GAAA6B,EAAA;EAE1B,IAAIK,YAAY,CAAG,EAAA;IACjBJ,MAAA,CAAOK,KAAKD,SAAS,CAAA;EACvB;EAEO,OAAAJ,MAAA;AACT,CAAA;AAKO,MAAMM,KAAQ,GAAAA,CAACC,GAAa,EAAAC,GAAA,EAAaC,GAAgB,KAAA;EAC9D,MAAMC,OAAU,GAAAd,IAAA,CAAKY,GAAI,CAAAA,GAAA,EAAKC,GAAG,CAAA;EACjC,MAAME,OAAU,GAAAf,IAAA,CAAKa,GAAI,CAAAD,GAAA,EAAKC,GAAG,CAAA;EAEjC,OAAOb,KAAKY,GAAI,CAAAG,OAAA,EAASf,KAAKa,GAAI,CAAAC,OAAA,EAASH,GAAG,CAAC,CAAA;AACjD,CAAA;AAQO,MAAMK,iBAAoB,GAAAA,CAC/BC,MACA,EAAA,CAACC,OAAS,EAAAC,OAAO,CACjB,EAAA,CAACC,KAAO,EAAAC,KAAK,CACb,EAAAC,WAAA,GAAc,IACX,KAAA;EACG,MAAAC,OAAA,GAAA,CAAWN,MAAS,GAAAC,OAAA,KAAYC,OAAU,GAAAD,OAAA,CAAA;EAC1C,MAAAM,OAAA,GAAUD,OAAW,IAAAF,KAAA,GAAQD,KAAS,CAAA,GAAAA,KAAA;EAE5C,OAAOE,WAAc,GAAAZ,KAAA,CAAMc,OAAS,EAAAJ,KAAA,EAAOC,KAAK,CAAI,GAAAG,OAAA;AACtD,CAAA;AAKO,MAAMC,qBAAqBA,CAChCnD,KAAA,EACA,CAACsC,GAAA,EAAKC,GAAG,CACN,KAAA;EACH,IAAIvC,UAAUuC,GAAK,EAAA;IACV,OAAAD,GAAA;EACT;EACA,OAAOtC,KAAQ,GAAA,CAAA;AACjB,CAAA;;;;;;;;;;"}
|
package/lib/utils/number.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.mjs","sources":["../../src/utils/number.ts"],"sourcesContent":["/**\n * Util to easily parse that any given input is a finite number (not NaN, Infinity, -Infinity, etc.)\n * @throws If given input is not a finite number\n */\nexport function isFiniteNumber(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n if (typeof value !== \"number\" || Number.isNaN(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a number: ${value}`);\n }\n\n if (!Number.isFinite(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a finite number: ${value}`);\n }\n}\n\n/**\n * Custom isInt validation function that returns a more fine-grained error message otherwise for type safety alone a\n * Number.isSafeInteger would be sufficient.\n *\n * Code inspired from graphql-scalars library.\n * @see\n * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L20-L32\n * @throws If given input is not a valid integer\n */\nexport function isInt(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n isFiniteNumber(value, entity, ErrorClass);\n\n if (!Number.isInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not an integer: ${value}`);\n }\n\n if (!Number.isSafeInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a safe integer: ${value}`);\n }\n}\n\n/**\n * Custom isFloat validation function that returns a more fine-grained error message otherwise for type safety alone a\n * Number.parseFloat would be sufficient.\n *\n * Code inspired from graphql-scalars library.\n * @see\n * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L34-L38\n * @throws If given input is not a valid float\n */\nexport function isFloat(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n isFiniteNumber(value, entity, ErrorClass);\n}\n\n/**\n * Returns a string representing a number in fixed-point notation.\n * Overload: Returns the rate parsed as a number\n * @example\n * toFixed(1.2345, 2) // => \"1.23\"\n * toFixed(1.2345, 0) // => \"1\"\n * toFixed(1.23, 4) // => \"1.2300\"\n */\nexport function toFixedRate(\n rate: number,\n scale: number,\n asNumber?: boolean,\n): string;\nexport function toFixedRate(\n rate: number,\n scale: number,\n asNumber: true,\n): number;\nexport function toFixedRate(rate: number, scale: number, asNumber?: boolean) {\n // Verify rate\n isFloat(rate, \"Rate\");\n\n const fixedRate = rate.toFixed(scale);\n\n return asNumber ? +fixedRate : fixedRate;\n}\n\n/**\n * Util to convert a float number to a string. Using this rather than simple template string to have a consistent way of\n * doing it. Removes any redundant trailing zeros.\n * @example\n * numberToString(1.23) // => \"1.23\"\n * numberToString(10.00) // => \"10\"\n * @throws If given input is not a valid number\n */\nexport const numberToString = (num: number): string => {\n isFloat(num);\n return num.toString(10);\n};\n\n/**\n * @see https://stackoverflow.com/a/35000557\n */\nexport const findClosestNumber = <T extends number>(\n haystack: T[],\n needle: number,\n): T => {\n return haystack.reduce((prev, curr) =>\n Math.abs(curr - needle) < Math.abs(prev - needle) ? curr : prev,\n );\n};\n\n/**\n * Splits number into array by max value provided.\n * E.g. splitNumberBy(100, 30) => [30, 30, 30, 10]\n */\nexport const splitNumberBy = (value: number, by: number) => {\n const chunks = new Array(Math.floor(value / by)).fill(by);\n const remainder = value % by;\n\n if (remainder > 0) {\n chunks.push(remainder);\n }\n\n return chunks;\n};\n\n/**\n * Clamp value to a given range\n */\nexport const clamp = (val: number, min: number, max: number) => {\n const trueMin = Math.min(min, max);\n const trueMax = Math.max(min, max);\n\n return Math.min(trueMax, Math.max(trueMin, val));\n};\n\n/**\n * Interpolate a number to a new range\n *\n * @example\n * linearInterpolate(5, [0, 10], [0, 100]); // 50\n */\nexport const linearInterpolate = (\n inputY: number,\n [fromMin, fromMax]: [number, number],\n [toMin, toMax]: [number, number],\n clampResult = true,\n) => {\n const percent = (inputY - fromMin) / (fromMax - fromMin);\n const outputX = percent * (toMax - toMin) + toMin;\n\n return clampResult ? clamp(outputX, toMin, toMax) : outputX;\n};\n\n/**\n * Increase value and start over once the range is overflown\n */\nexport const incrementLoopValue = (\n value: number,\n [min, max]: [number, number],\n) => {\n if (value === max) {\n return min;\n }\n return value + 1;\n};\n"],"names":["isFiniteNumber","value","entity","ErrorClass","TypeError","Number","isNaN","isFinite","isInt","isInteger","isSafeInteger","isFloat","toFixedRate","rate","scale","asNumber","fixedRate","toFixed","numberToString","num","toString","findClosestNumber","haystack","needle","reduce","prev","curr","Math","abs","splitNumberBy","by","chunks","Array","floor","fill","remainder","push","clamp","val","min","max","trueMin","trueMax","linearInterpolate","inputY","fromMin","fromMax","toMin","toMax","clampResult","percent","outputX","incrementLoopValue"],"mappings":";;AAIO,SAASA,cACdA,CAAAC,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACzB,IAAI,OAAOH,KAAU,KAAA,QAAA,IAAYI,MAAO,CAAAC,KAAA,CAAML,KAAK,CAAG,EAAA;IAEpD,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,qBAAqBD,
|
|
1
|
+
{"version":3,"file":"number.mjs","sources":["../../src/utils/number.ts"],"sourcesContent":["/**\n * Util to easily parse that any given input is a finite number (not NaN, Infinity, -Infinity, etc.)\n * @throws If given input is not a finite number\n */\nexport function isFiniteNumber(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n if (typeof value !== \"number\" || Number.isNaN(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a number: ${value}`);\n }\n\n if (!Number.isFinite(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a finite number: ${value}`);\n }\n}\n\n/**\n * Custom isInt validation function that returns a more fine-grained error message otherwise for type safety alone a\n * Number.isSafeInteger would be sufficient.\n *\n * Code inspired from graphql-scalars library.\n * @see\n * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L20-L32\n * @throws If given input is not a valid integer\n */\nexport function isInt(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n isFiniteNumber(value, entity, ErrorClass);\n\n if (!Number.isInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not an integer: ${value}`);\n }\n\n if (!Number.isSafeInteger(value)) {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw new ErrorClass(`${entity} is not a safe integer: ${value}`);\n }\n}\n\n/**\n * Custom isFloat validation function that returns a more fine-grained error message otherwise for type safety alone a\n * Number.parseFloat would be sufficient.\n *\n * Code inspired from graphql-scalars library.\n * @see\n * https://github.com/Urigo/graphql-scalars/blob/c4fa3d27b965e39ceda6c33fc18041f112ecce49/src/scalars/utilities.ts#L34-L38\n * @throws If given input is not a valid float\n */\nexport function isFloat(\n value: unknown,\n entity = \"Value\",\n ErrorClass: new (message: string) => void = TypeError,\n): asserts value is number {\n isFiniteNumber(value, entity, ErrorClass);\n}\n\n/**\n * Returns a string representing a number in fixed-point notation.\n * Overload: Returns the rate parsed as a number\n * @example\n * toFixed(1.2345, 2) // => \"1.23\"\n * toFixed(1.2345, 0) // => \"1\"\n * toFixed(1.23, 4) // => \"1.2300\"\n */\nexport function toFixedRate(\n rate: number,\n scale: number,\n asNumber?: boolean,\n): string;\nexport function toFixedRate(\n rate: number,\n scale: number,\n asNumber: true,\n): number;\nexport function toFixedRate(rate: number, scale: number, asNumber?: boolean) {\n // Verify rate\n isFloat(rate, \"Rate\");\n\n const fixedRate = rate.toFixed(scale);\n\n return asNumber ? +fixedRate : fixedRate;\n}\n\n/**\n * Util to convert a float number to a string. Using this rather than simple template string to have a consistent way of\n * doing it. Removes any redundant trailing zeros.\n * @example\n * numberToString(1.23) // => \"1.23\"\n * numberToString(10.00) // => \"10\"\n * @throws If given input is not a valid number\n */\nexport const numberToString = (num: number): string => {\n isFloat(num);\n return num.toString(10);\n};\n\n/**\n * @see https://stackoverflow.com/a/35000557\n */\nexport const findClosestNumber = <T extends number>(\n haystack: T[],\n needle: number,\n): T => {\n return haystack.reduce((prev, curr) =>\n Math.abs(curr - needle) < Math.abs(prev - needle) ? curr : prev,\n );\n};\n\n/**\n * Splits number into array by max value provided.\n * E.g. splitNumberBy(100, 30) => [30, 30, 30, 10]\n */\nexport const splitNumberBy = (value: number, by: number) => {\n const chunks = new Array(Math.floor(value / by)).fill(by);\n const remainder = value % by;\n\n if (remainder > 0) {\n chunks.push(remainder);\n }\n\n return chunks;\n};\n\n/**\n * Clamp value to a given range\n */\nexport const clamp = (val: number, min: number, max: number) => {\n const trueMin = Math.min(min, max);\n const trueMax = Math.max(min, max);\n\n return Math.min(trueMax, Math.max(trueMin, val));\n};\n\n/**\n * Interpolate a number to a new range\n *\n * @example\n * linearInterpolate(5, [0, 10], [0, 100]); // 50\n */\nexport const linearInterpolate = (\n inputY: number,\n [fromMin, fromMax]: [number, number],\n [toMin, toMax]: [number, number],\n clampResult = true,\n) => {\n const percent = (inputY - fromMin) / (fromMax - fromMin);\n const outputX = percent * (toMax - toMin) + toMin;\n\n return clampResult ? clamp(outputX, toMin, toMax) : outputX;\n};\n\n/**\n * Increase value and start over once the range is overflown\n */\nexport const incrementLoopValue = (\n value: number,\n [min, max]: [number, number],\n) => {\n if (value === max) {\n return min;\n }\n return value + 1;\n};\n"],"names":["isFiniteNumber","value","entity","ErrorClass","TypeError","Number","isNaN","isFinite","isInt","isInteger","isSafeInteger","isFloat","toFixedRate","rate","scale","asNumber","fixedRate","toFixed","numberToString","num","toString","findClosestNumber","haystack","needle","reduce","prev","curr","Math","abs","splitNumberBy","by","chunks","Array","floor","fill","remainder","push","clamp","val","min","max","trueMin","trueMax","linearInterpolate","inputY","fromMin","fromMax","toMin","toMax","clampResult","percent","outputX","incrementLoopValue"],"mappings":";;AAIO,SAASA,cACdA,CAAAC,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACzB,IAAI,OAAOH,KAAU,KAAA,QAAA,IAAYI,MAAO,CAAAC,KAAA,CAAML,KAAK,CAAG,EAAA;IAEpD,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,qBAAqBD,KAAK,EAAE,CAAA;EAC5D;EAEA,IAAI,CAACI,MAAA,CAAOE,QAAS,CAAAN,KAAK,CAAG,EAAA;IAE3B,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,4BAA4BD,KAAK,EAAE,CAAA;EACnE;AACF;AAWO,SAASO,KACdA,CAAAP,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACVJ,cAAA,CAAAC,KAAA,EAAOC,QAAQC,UAAU,CAAA;EAExC,IAAI,CAACE,MAAA,CAAOI,SAAU,CAAAR,KAAK,CAAG,EAAA;IAE5B,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,uBAAuBD,KAAK,EAAE,CAAA;EAC9D;EAEA,IAAI,CAACI,MAAA,CAAOK,aAAc,CAAAT,KAAK,CAAG,EAAA;IAEhC,MAAM,IAAIE,UAAW,CAAA,GAAGD,MAAM,2BAA2BD,KAAK,EAAE,CAAA;EAClE;AACF;AAWO,SAASU,OACdA,CAAAV,KAAA,EACAC,MAAS,GAAA,OAAA,EACTC,aAA4CC,SACnB,EAAA;EACVJ,cAAA,CAAAC,KAAA,EAAOC,QAAQC,UAAU,CAAA;AAC1C;AAoBgB,SAAAS,WAAAA,CAAYC,IAAc,EAAAC,KAAA,EAAeC,QAAoB,EAAA;EAE3EJ,OAAA,CAAQE,MAAM,MAAM,CAAA;EAEd,MAAAG,SAAA,GAAYH,IAAK,CAAAI,OAAA,CAAQH,KAAK,CAAA;EAE7B,OAAAC,QAAA,GAAW,CAACC,SAAY,GAAAA,SAAA;AACjC;AAUa,MAAAE,cAAA,GAAkBC,GAAwB,IAAA;EACrDR,OAAA,CAAQQ,GAAG,CAAA;EACJ,OAAAA,GAAA,CAAIC,SAAS,EAAE,CAAA;AACxB,CAAA;AAKa,MAAAC,iBAAA,GAAoBA,CAC/BC,QAAA,EACAC,MACM,KAAA;EACN,OAAOD,QAAS,CAAAE,MAAA,CAAO,CAACC,IAAA,EAAMC,IAC5B,KAAAC,IAAA,CAAKC,GAAI,CAAAF,IAAA,GAAOH,MAAM,CAAA,GAAII,IAAK,CAAAC,GAAA,CAAIH,IAAO,GAAAF,MAAM,IAAIG,IAAO,GAAAD,IAAA,CAC7D;AACF,CAAA;AAMa,MAAAI,aAAA,GAAgBA,CAAC5B,KAAA,EAAe6B,EAAe,KAAA;EACpD,MAAAC,MAAA,GAAS,IAAIC,KAAA,CAAML,IAAK,CAAAM,KAAA,CAAMhC,QAAQ6B,EAAE,CAAC,CAAE,CAAAI,IAAA,CAAKJ,EAAE,CAAA;EACxD,MAAMK,YAAYlC,KAAQ,GAAA6B,EAAA;EAE1B,IAAIK,YAAY,CAAG,EAAA;IACjBJ,MAAA,CAAOK,KAAKD,SAAS,CAAA;EACvB;EAEO,OAAAJ,MAAA;AACT,CAAA;AAKO,MAAMM,KAAQ,GAAAA,CAACC,GAAa,EAAAC,GAAA,EAAaC,GAAgB,KAAA;EAC9D,MAAMC,OAAU,GAAAd,IAAA,CAAKY,GAAI,CAAAA,GAAA,EAAKC,GAAG,CAAA;EACjC,MAAME,OAAU,GAAAf,IAAA,CAAKa,GAAI,CAAAD,GAAA,EAAKC,GAAG,CAAA;EAEjC,OAAOb,KAAKY,GAAI,CAAAG,OAAA,EAASf,KAAKa,GAAI,CAAAC,OAAA,EAASH,GAAG,CAAC,CAAA;AACjD,CAAA;AAQO,MAAMK,iBAAoB,GAAAA,CAC/BC,MACA,EAAA,CAACC,OAAS,EAAAC,OAAO,CACjB,EAAA,CAACC,KAAO,EAAAC,KAAK,CACb,EAAAC,WAAA,GAAc,IACX,KAAA;EACG,MAAAC,OAAA,GAAA,CAAWN,MAAS,GAAAC,OAAA,KAAYC,OAAU,GAAAD,OAAA,CAAA;EAC1C,MAAAM,OAAA,GAAUD,OAAW,IAAAF,KAAA,GAAQD,KAAS,CAAA,GAAAA,KAAA;EAE5C,OAAOE,WAAc,GAAAZ,KAAA,CAAMc,OAAS,EAAAJ,KAAA,EAAOC,KAAK,CAAI,GAAAG,OAAA;AACtD,CAAA;AAKO,MAAMC,qBAAqBA,CAChCnD,KAAA,EACA,CAACsC,GAAA,EAAKC,GAAG,CACN,KAAA;EACH,IAAIvC,UAAUuC,GAAK,EAAA;IACV,OAAAD,GAAA;EACT;EACA,OAAOtC,KAAQ,GAAA,CAAA;AACjB,CAAA;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Nullish, StorefrontProduct, StoreId, UnionToAllPossibleTuples } from "../types";
|
|
2
|
+
import { DisplayProductStatus } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Narrow MinimalProProductFragment type even more to the union of fields that are needed to sort product
|
|
5
|
+
*/
|
|
6
|
+
type ProductMinFieldsForSorting = Pick<StorefrontProduct, "status" | "tags" | "minDisplayPrice"> & {
|
|
7
|
+
variants: {
|
|
8
|
+
availableInOtherStores: Array<{
|
|
9
|
+
__typename: string;
|
|
10
|
+
}>;
|
|
11
|
+
}[];
|
|
12
|
+
linkedProducts?: {
|
|
13
|
+
status: StorefrontProduct["status"];
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
16
|
+
export declare enum Sort {
|
|
17
|
+
HighestPrice = "highest-price",
|
|
18
|
+
LowestPrice = "lowest-price",
|
|
19
|
+
Availability = "availability"
|
|
20
|
+
}
|
|
21
|
+
export declare enum SortOrder {
|
|
22
|
+
Asc = "Asc",
|
|
23
|
+
Desc = "Desc"
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Variants statuses sorted in ascending order from least preferable to most, so if some new status comes in, then the
|
|
27
|
+
* lookup for `.indexOf()` would return `-1`, thus being "worse" then DisplayProductStatus.SoldOut and moved to the very
|
|
28
|
+
* back of list
|
|
29
|
+
*/
|
|
30
|
+
export declare const sortedStatusesByPriorityAsc: UnionToAllPossibleTuples<DisplayProductStatus>;
|
|
31
|
+
export declare const sortByAvailabilityDesc: (current: ProductMinFieldsForSorting, next: ProductMinFieldsForSorting) => number;
|
|
32
|
+
export declare const sortByPrice: (order: SortOrder) => (current: ProductMinFieldsForSorting, next: ProductMinFieldsForSorting) => number;
|
|
33
|
+
/**
|
|
34
|
+
* Sorts products based on the given sort type.
|
|
35
|
+
* @param currentSort - sort type
|
|
36
|
+
* @param sortByWeightTag - if false, then sort by weight tag is
|
|
37
|
+
* ignored (e.g. for `Related Add-ons` where
|
|
38
|
+
* we don't want to sort by weight tag)
|
|
39
|
+
*/
|
|
40
|
+
export declare const sortProducts: (currentSort: Nullish<string | Sort>, storeId?: StoreId, sortByWeightTag?: boolean) => (current: ProductMinFieldsForSorting, next: ProductMinFieldsForSorting) => number;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('../types/index.js');
|
|
4
|
+
var array = require('./array.js');
|
|
5
|
+
var product$1 = require('./product.js');
|
|
6
|
+
var product = require('../types/product.js');
|
|
7
|
+
"use strict";
|
|
8
|
+
var Sort = /* @__PURE__ */(Sort2 => {
|
|
9
|
+
Sort2["HighestPrice"] = "highest-price";
|
|
10
|
+
Sort2["LowestPrice"] = "lowest-price";
|
|
11
|
+
Sort2["Availability"] = "availability";
|
|
12
|
+
return Sort2;
|
|
13
|
+
})(Sort || {});
|
|
14
|
+
var SortOrder = /* @__PURE__ */(SortOrder2 => {
|
|
15
|
+
SortOrder2["Asc"] = "Asc";
|
|
16
|
+
SortOrder2["Desc"] = "Desc";
|
|
17
|
+
return SortOrder2;
|
|
18
|
+
})(SortOrder || {});
|
|
19
|
+
const sortedStatusesByPriorityAsc = [product.DisplayProductStatus.Unavailable, product.DisplayProductStatus.ComingSoon, product.DisplayProductStatus.SoldOut, product.DisplayProductStatus.RegionNotAvailable, product.DisplayProductStatus.Backorder, product.DisplayProductStatus.Available];
|
|
20
|
+
const getProductStatusPriority = product$1 => {
|
|
21
|
+
let sortStatus = product$1.status;
|
|
22
|
+
if (product$1.variants.some(variant => variant.availableInOtherStores.length) || product$1.linkedProducts && product$1.linkedProducts.some(linkedProduct => linkedProduct.status === product.DisplayProductStatus.Available)) {
|
|
23
|
+
sortStatus = product.DisplayProductStatus.Available;
|
|
24
|
+
}
|
|
25
|
+
return sortedStatusesByPriorityAsc.indexOf(sortStatus);
|
|
26
|
+
};
|
|
27
|
+
const sortByAvailabilityDesc = (current, next) => {
|
|
28
|
+
return array.normalizeSortResult(getProductStatusPriority(next) - getProductStatusPriority(current));
|
|
29
|
+
};
|
|
30
|
+
const sortByPrice = order => (current, next) => {
|
|
31
|
+
const currentProductPrice = current.minDisplayPrice.amount;
|
|
32
|
+
const nextProductPrice = next.minDisplayPrice.amount;
|
|
33
|
+
if (order === "Desc" /* Desc */) {
|
|
34
|
+
return nextProductPrice - currentProductPrice;
|
|
35
|
+
} else {
|
|
36
|
+
return currentProductPrice - nextProductPrice;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const sortProducts = (currentSort, storeId, sortByWeightTag = true) => (current, next) => {
|
|
40
|
+
switch (currentSort) {
|
|
41
|
+
// Sort by price
|
|
42
|
+
case "highest-price" /* HighestPrice */:
|
|
43
|
+
case "lowest-price" /* LowestPrice */:
|
|
44
|
+
{
|
|
45
|
+
return sortByPrice(currentSort === "highest-price" /* HighestPrice */ ? "Desc" /* Desc */ : "Asc" /* Asc */)(current, next);
|
|
46
|
+
}
|
|
47
|
+
case "availability" /* Availability */:
|
|
48
|
+
{
|
|
49
|
+
return sortByAvailabilityDesc(current, next);
|
|
50
|
+
}
|
|
51
|
+
default:
|
|
52
|
+
{
|
|
53
|
+
const sorts = [sortByAvailabilityDesc];
|
|
54
|
+
if (sortByWeightTag) {
|
|
55
|
+
sorts.push(product$1.sortByTagWeight(product$1.SortSiteId.Store, storeId));
|
|
56
|
+
}
|
|
57
|
+
return array.combineSorts(sorts)(current, next);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
exports.Sort = Sort;
|
|
62
|
+
exports.SortOrder = SortOrder;
|
|
63
|
+
exports.sortByAvailabilityDesc = sortByAvailabilityDesc;
|
|
64
|
+
exports.sortByPrice = sortByPrice;
|
|
65
|
+
exports.sortProducts = sortProducts;
|
|
66
|
+
exports.sortedStatusesByPriorityAsc = sortedStatusesByPriorityAsc;
|
|
67
|
+
//# sourceMappingURL=productSort.js.map
|