@ubnt/store.core 9.12.0 → 9.13.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +107 -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/assets/ai360.jpg +0 -0
- package/lib/assets/attention.svg +5 -5
- package/lib/assets/attention2.svg +5 -5
- package/lib/assets/close2.svg +2 -3
- package/lib/assets/close3.svg +3 -2
- package/lib/assets/efg.png +0 -0
- package/lib/assets/g5-ptz.jpg +0 -0
- package/lib/assets/g5Ptz.jpg +0 -0
- package/lib/assets/group.svg +6 -0
- package/lib/assets/keyFeatures/group.svg +6 -0
- package/lib/{components/Explore/assets/ProAV.jpg.js → assets/keyFeatures/group.svg.js} +6 -6
- package/lib/assets/keyFeatures/group.svg.js.map +1 -0
- package/lib/assets/keyFeatures/group.svg.mjs +3 -0
- package/lib/assets/keyFeatures/group.svg.mjs.map +1 -0
- package/lib/assets/keyFeatures/music.svg +3 -0
- package/lib/{components/Explore/LensCompare/assets/ai360.jpg.js → assets/keyFeatures/music.svg.js} +6 -6
- package/lib/assets/keyFeatures/music.svg.js.map +1 -0
- package/lib/assets/keyFeatures/music.svg.mjs +3 -0
- package/lib/assets/keyFeatures/music.svg.mjs.map +1 -0
- package/lib/assets/minus4.svg +8 -8
- package/lib/assets/minus5.svg +8 -8
- package/lib/assets/music.svg +3 -0
- package/lib/assets/pause.svg +3 -3
- package/lib/assets/pause2.svg +3 -3
- package/lib/assets/plus5.svg +9 -9
- package/lib/assets/plus6.svg +9 -9
- package/lib/assets/powerAmp.jpg +0 -0
- package/lib/assets/powerAmp.svg +3 -0
- package/lib/assets/ucg-max.png +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/udr.jpg +0 -0
- package/lib/assets/udr2.jpg +0 -0
- package/lib/assets/udw.jpg +0 -0
- package/lib/assets/udw2.jpg +0 -0
- package/lib/assets/umr.jpg +0 -0
- package/lib/assets/umr2.jpg +0 -0
- package/lib/assets/volume-on2.svg +3 -0
- package/lib/assets/wideAngle.jpg +0 -0
- package/lib/components/Explore/Explore.js +2 -9
- package/lib/components/Explore/Explore.js.map +1 -1
- package/lib/components/Explore/Explore.mjs +2 -9
- package/lib/components/Explore/Explore.mjs.map +1 -1
- package/lib/components/Explore/ExploreData.d.ts +4 -7
- package/lib/components/Explore/ExploreData.js +88 -138
- package/lib/components/Explore/ExploreData.js.map +1 -1
- package/lib/components/Explore/ExploreData.mjs +80 -128
- package/lib/components/Explore/ExploreData.mjs.map +1 -1
- package/lib/components/Explore/assets/UISPConsole.jpg.js +5 -5
- package/lib/components/Explore/assets/{baseStation-mobile.jpg.js → baseStation--mobile.jpg.js} +6 -6
- package/lib/components/Explore/assets/baseStation--mobile.jpg.js.map +1 -0
- package/lib/components/Explore/assets/baseStation--mobile.jpg.mjs +3 -0
- package/lib/components/Explore/assets/baseStation--mobile.jpg.mjs.map +1 -0
- package/lib/components/Explore/assets/baseStation.jpg.js +5 -5
- package/lib/components/Explore/assets/{g4-ptz.jpg.js → g4Ptz.jpg.js} +2 -2
- package/lib/components/Explore/assets/g4Ptz.jpg.js.map +1 -0
- package/lib/components/Explore/assets/g4Ptz.jpg.mjs +3 -0
- package/lib/components/Explore/assets/g4Ptz.jpg.mjs.map +1 -0
- package/lib/components/Explore/assets/{g5-ptz.jpg.js → g5Ptz.jpg.js} +2 -2
- package/lib/components/Explore/assets/g5Ptz.jpg.js.map +1 -0
- package/lib/components/Explore/assets/g5Ptz.jpg.mjs +3 -0
- package/lib/components/Explore/assets/g5Ptz.jpg.mjs.map +1 -0
- package/lib/components/Explore/assets/{AITheta.jpg.js → powerAmp.jpg.js} +6 -6
- package/lib/components/Explore/assets/powerAmp.jpg.js.map +1 -0
- package/lib/components/Explore/assets/powerAmp.jpg.mjs +3 -0
- package/lib/components/Explore/assets/powerAmp.jpg.mjs.map +1 -0
- package/lib/components/Explore/assets/udr.jpg.js +27 -0
- package/lib/components/Explore/assets/udr.jpg.js.map +1 -0
- package/lib/components/Explore/assets/udr.jpg.mjs +3 -0
- package/lib/components/Explore/assets/udr.jpg.mjs.map +1 -0
- package/lib/components/Explore/assets/udw.jpg.js +27 -0
- package/lib/components/Explore/assets/udw.jpg.js.map +1 -0
- package/lib/components/Explore/assets/udw.jpg.mjs +3 -0
- package/lib/components/Explore/assets/udw.jpg.mjs.map +1 -0
- package/lib/components/Explore/assets/umr.jpg.js +27 -0
- package/lib/components/Explore/assets/umr.jpg.js.map +1 -0
- package/lib/components/Explore/assets/umr.jpg.mjs +3 -0
- package/lib/components/Explore/assets/umr.jpg.mjs.map +1 -0
- package/lib/components/Explore/assets/ux.jpg.js +27 -0
- package/lib/components/Explore/assets/ux.jpg.js.map +1 -0
- package/lib/components/Explore/assets/ux.jpg.mjs +3 -0
- package/lib/components/Explore/assets/ux.jpg.mjs.map +1 -0
- package/lib/components/Explore/translations/ar.json.js +19 -0
- package/lib/components/Explore/translations/ar.json.js.map +1 -1
- package/lib/components/Explore/translations/ar.json.mjs +19 -0
- package/lib/components/Explore/translations/ar.json.mjs.map +1 -1
- package/lib/components/Explore/translations/de.json.js +19 -0
- package/lib/components/Explore/translations/de.json.js.map +1 -1
- package/lib/components/Explore/translations/de.json.mjs +19 -0
- package/lib/components/Explore/translations/de.json.mjs.map +1 -1
- package/lib/components/Explore/translations/el.json.js +19 -0
- package/lib/components/Explore/translations/el.json.js.map +1 -1
- package/lib/components/Explore/translations/el.json.mjs +19 -0
- package/lib/components/Explore/translations/el.json.mjs.map +1 -1
- package/lib/components/Explore/translations/en.json.js +11 -30
- package/lib/components/Explore/translations/en.json.js.map +1 -1
- package/lib/components/Explore/translations/en.json.mjs +12 -30
- package/lib/components/Explore/translations/en.json.mjs.map +1 -1
- package/lib/components/Explore/translations/es.json.js +101 -82
- package/lib/components/Explore/translations/es.json.js.map +1 -1
- package/lib/components/Explore/translations/es.json.mjs +101 -82
- package/lib/components/Explore/translations/es.json.mjs.map +1 -1
- package/lib/components/Explore/translations/fr.json.js +19 -0
- package/lib/components/Explore/translations/fr.json.js.map +1 -1
- package/lib/components/Explore/translations/fr.json.mjs +19 -0
- package/lib/components/Explore/translations/fr.json.mjs.map +1 -1
- package/lib/components/Explore/translations/it.json.js +19 -0
- package/lib/components/Explore/translations/it.json.js.map +1 -1
- package/lib/components/Explore/translations/it.json.mjs +19 -0
- package/lib/components/Explore/translations/it.json.mjs.map +1 -1
- package/lib/components/Explore/translations/ja.json.js +19 -0
- package/lib/components/Explore/translations/ja.json.js.map +1 -1
- package/lib/components/Explore/translations/ja.json.mjs +19 -0
- package/lib/components/Explore/translations/ja.json.mjs.map +1 -1
- package/lib/components/Explore/translations/pt-BR.json.js +19 -0
- package/lib/components/Explore/translations/pt-BR.json.js.map +1 -1
- package/lib/components/Explore/translations/pt-BR.json.mjs +19 -0
- package/lib/components/Explore/translations/pt-BR.json.mjs.map +1 -1
- package/lib/components/Explore/translations/zh-Hans.json.js +19 -0
- package/lib/components/Explore/translations/zh-Hans.json.js.map +1 -1
- package/lib/components/Explore/translations/zh-Hans.json.mjs +19 -0
- package/lib/components/Explore/translations/zh-Hans.json.mjs.map +1 -1
- package/lib/components/Explore/translations/zh-Hant-TW.json.js +19 -0
- package/lib/components/Explore/translations/zh-Hant-TW.json.js.map +1 -1
- package/lib/components/Explore/translations/zh-Hant-TW.json.mjs +19 -0
- package/lib/components/Explore/translations/zh-Hant-TW.json.mjs.map +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.js +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.mjs +1 -1
- package/lib/components/FeaturesSection_deprecated/assets/close.svg.js +1 -1
- package/lib/components/FeaturesSection_deprecated/assets/close.svg.mjs +2 -2
- package/lib/components/Header/Header.js +1 -0
- package/lib/components/Header/Header.js.map +1 -1
- package/lib/components/Header/Header.mjs +1 -0
- package/lib/components/Header/Header.mjs.map +1 -1
- package/lib/components/LandingPagePro/LandingPagePro.d.ts +3 -0
- package/lib/components/LandingPagePro/LandingPagePro.js +3 -3
- package/lib/components/LandingPagePro/LandingPagePro.js.map +1 -1
- package/lib/components/LandingPagePro/LandingPagePro.mjs +2 -2
- package/lib/components/LandingPagePro/LandingPagePro.mjs.map +1 -1
- package/lib/components/MicrositeVideoSlideshow/MicrositeVideoSlideshow.js +1 -1
- package/lib/components/MicrositeVideoSlideshow/MicrositeVideoSlideshow.mjs +1 -1
- package/lib/components/MicrositeVideoSlideshow/assets/pause.svg.js +1 -1
- package/lib/components/MicrositeVideoSlideshow/assets/pause.svg.mjs +2 -2
- package/lib/components/ModelCompareV3/ModelCompareV3.types.d.ts +1 -0
- 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/bigCompare/udr.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udr.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udw.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udw.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/Interior/ai360.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Interior/ai360.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Interior/wideAngle.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Interior/wideAngle.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/MobileRouters/umr.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/MobileRouters/umr.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/PTZ/g5-ptz.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/PTZ/g5-ptz.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/volume-on.svg.js +27 -0
- package/lib/components/ModelCompareV3/assets/volume-on.svg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/volume-on.svg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/volume-on.svg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/CloudGateways.js +8 -8
- package/lib/components/ModelCompareV3/data/CloudGateways.mjs +6 -6
- package/lib/components/ModelCompareV3/data/Switching.js +3 -1
- package/lib/components/ModelCompareV3/data/Switching.js.map +1 -1
- package/lib/components/ModelCompareV3/data/Switching.mjs +3 -1
- package/lib/components/ModelCompareV3/data/Switching.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/aggregation.js +16 -8
- package/lib/components/ModelCompareV3/data/products/aggregation.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/aggregation.mjs +16 -8
- package/lib/components/ModelCompareV3/data/products/aggregation.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/connectDisplay.js +1 -1
- package/lib/components/ModelCompareV3/data/products/connectDisplay.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/connectDisplay.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/connectDisplay.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/enterprise24PoE.js +16 -8
- package/lib/components/ModelCompareV3/data/products/enterprise24PoE.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/enterprise24PoE.mjs +16 -8
- package/lib/components/ModelCompareV3/data/products/enterprise24PoE.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/enterprise48PoE.js +16 -8
- package/lib/components/ModelCompareV3/data/products/enterprise48PoE.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/enterprise48PoE.mjs +16 -8
- package/lib/components/ModelCompareV3/data/products/enterprise48PoE.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/enterpriseXG24.js +16 -8
- package/lib/components/ModelCompareV3/data/products/enterpriseXG24.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/enterpriseXG24.mjs +16 -8
- package/lib/components/ModelCompareV3/data/products/enterpriseXG24.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/g5Ptz.js +1 -1
- package/lib/components/ModelCompareV3/data/products/g5Ptz.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/highCapacityAggregation.js +16 -8
- package/lib/components/ModelCompareV3/data/products/highCapacityAggregation.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/highCapacityAggregation.mjs +16 -8
- package/lib/components/ModelCompareV3/data/products/highCapacityAggregation.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/missionCritical.js +8 -0
- package/lib/components/ModelCompareV3/data/products/missionCritical.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/missionCritical.mjs +8 -0
- package/lib/components/ModelCompareV3/data/products/missionCritical.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/phoneTouch.js +5 -3
- package/lib/components/ModelCompareV3/data/products/phoneTouch.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/phoneTouch.mjs +5 -3
- package/lib/components/ModelCompareV3/data/products/phoneTouch.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/phoneTouchMax.js +4 -2
- package/lib/components/ModelCompareV3/data/products/phoneTouchMax.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/phoneTouchMax.mjs +4 -2
- package/lib/components/ModelCompareV3/data/products/phoneTouchMax.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professional24.js +8 -0
- package/lib/components/ModelCompareV3/data/products/professional24.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professional24.mjs +8 -0
- package/lib/components/ModelCompareV3/data/products/professional24.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professional24PoE.js +8 -0
- package/lib/components/ModelCompareV3/data/products/professional24PoE.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professional24PoE.mjs +8 -0
- package/lib/components/ModelCompareV3/data/products/professional24PoE.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professional48.js +8 -0
- package/lib/components/ModelCompareV3/data/products/professional48.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professional48.mjs +8 -0
- package/lib/components/ModelCompareV3/data/products/professional48.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professional48PoE.js +8 -0
- package/lib/components/ModelCompareV3/data/products/professional48PoE.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/professional48PoE.mjs +8 -0
- package/lib/components/ModelCompareV3/data/products/professional48PoE.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 +11 -1
- package/lib/components/ModelCompareV3/data/products/switchesEnterprise.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/switchesEnterprise.mjs +11 -1
- package/lib/components/ModelCompareV3/data/products/switchesEnterprise.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/switchesProfessional.js +8 -0
- package/lib/components/ModelCompareV3/data/products/switchesProfessional.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/switchesProfessional.mjs +8 -0
- package/lib/components/ModelCompareV3/data/products/switchesProfessional.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/switchesProfessionalMax.js +8 -0
- package/lib/components/ModelCompareV3/data/products/switchesProfessionalMax.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/switchesProfessionalMax.mjs +8 -0
- package/lib/components/ModelCompareV3/data/products/switchesProfessionalMax.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/switchesStandard.js +8 -0
- package/lib/components/ModelCompareV3/data/products/switchesStandard.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/switchesStandard.mjs +8 -0
- package/lib/components/ModelCompareV3/data/products/switchesStandard.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/theta360.js +1 -1
- package/lib/components/ModelCompareV3/data/products/theta360.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/thetaWideAngle.js +1 -1
- package/lib/components/ModelCompareV3/data/products/thetaWideAngle.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/ucCast.js +1 -1
- package/lib/components/ModelCompareV3/data/products/ucCast.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/ucCast.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/ucCast.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/ucCastPro.js +1 -1
- package/lib/components/ModelCompareV3/data/products/ucCastPro.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/ucCastPro.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/ucCastPro.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProMax.js +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProMax.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProSpecial.js +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProSpecial.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/udr.js +1 -1
- package/lib/components/ModelCompareV3/data/products/udr.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/udw.js +1 -1
- package/lib/components/ModelCompareV3/data/products/udw.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/umr.js +1 -1
- package/lib/components/ModelCompareV3/data/products/umr.mjs +1 -1
- package/lib/components/ModelCompareV3/data/properties/index.d.ts +1 -0
- package/lib/components/ModelCompareV3/data/properties/index.js +2 -0
- package/lib/components/ModelCompareV3/data/properties/index.js.map +1 -1
- package/lib/components/ModelCompareV3/data/properties/index.mjs +1 -0
- package/lib/components/ModelCompareV3/data/properties/index.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/properties/proAvSupport.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/properties/proAvSupport.js +19 -0
- package/lib/components/ModelCompareV3/data/properties/proAvSupport.js.map +1 -0
- package/lib/components/ModelCompareV3/data/properties/proAvSupport.mjs +11 -0
- package/lib/components/ModelCompareV3/data/properties/proAvSupport.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/property-sets/switching.js +6 -4
- package/lib/components/ModelCompareV3/data/property-sets/switching.js.map +1 -1
- package/lib/components/ModelCompareV3/data/property-sets/switching.mjs +6 -4
- package/lib/components/ModelCompareV3/data/property-sets/switching.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/ar.json.js +3 -0
- package/lib/components/ModelCompareV3/translations/ar.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/ar.json.mjs +3 -0
- package/lib/components/ModelCompareV3/translations/ar.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/de.json.js +3 -0
- package/lib/components/ModelCompareV3/translations/de.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/de.json.mjs +3 -0
- package/lib/components/ModelCompareV3/translations/de.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/el.json.js +3 -0
- package/lib/components/ModelCompareV3/translations/el.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/el.json.mjs +3 -0
- package/lib/components/ModelCompareV3/translations/el.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/en.json.js +3 -0
- package/lib/components/ModelCompareV3/translations/en.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/en.json.mjs +3 -0
- package/lib/components/ModelCompareV3/translations/en.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/es.json.js +3 -0
- package/lib/components/ModelCompareV3/translations/es.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/es.json.mjs +3 -0
- package/lib/components/ModelCompareV3/translations/es.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/fr.json.js +3 -0
- package/lib/components/ModelCompareV3/translations/fr.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/fr.json.mjs +3 -0
- package/lib/components/ModelCompareV3/translations/fr.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/it.json.js +3 -0
- package/lib/components/ModelCompareV3/translations/it.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/it.json.mjs +3 -0
- package/lib/components/ModelCompareV3/translations/it.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/ja.json.js +5 -2
- package/lib/components/ModelCompareV3/translations/ja.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/ja.json.mjs +5 -2
- package/lib/components/ModelCompareV3/translations/ja.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/pt-BR.json.js +3 -0
- package/lib/components/ModelCompareV3/translations/pt-BR.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/pt-BR.json.mjs +3 -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 +3 -0
- package/lib/components/ModelCompareV3/translations/zh-Hans.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/zh-Hans.json.mjs +3 -0
- package/lib/components/ModelCompareV3/translations/zh-Hans.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/zh-Hant-TW.json.js +3 -0
- package/lib/components/ModelCompareV3/translations/zh-Hant-TW.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/zh-Hant-TW.json.mjs +3 -0
- package/lib/components/ModelCompareV3/translations/zh-Hant-TW.json.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.js +311 -15
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.mjs +309 -15
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.constants.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.js +38 -22
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.mjs +38 -22
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.d.ts +10 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.js +2 -0
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.mjs +2 -0
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/ComputeResourceCalculator.types.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/HddSlots/HddSlots.d.ts +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/HddSlots/HddSlots.js +5 -4
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/HddSlots/HddSlots.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/HddSlots/HddSlots.mjs +5 -4
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/HddSlots/HddSlots.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.js +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.js +2 -0
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.mjs +2 -0
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.styles.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputSections/CounterSection.js +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputSections/CounterSection.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/minus.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/minus.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/plus.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/plus.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/useComputeResourceCalculator.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/useComputeResourceCalculator.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/useComputeResourceCalculator.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/useComputeResourceCalculator.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.js +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/PoeConsumerSelectModal/PoeConsumerSelectModal.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/minus.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/minus.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/plus.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/PoeCalculator/components/PoeConsumerConfigurator/assets/plus.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/assets/consoles/efg.png.js +27 -0
- package/lib/components/ResourceCalculatorV1/assets/consoles/efg.png.js.map +1 -0
- package/lib/components/ResourceCalculatorV1/assets/consoles/efg.png.mjs +3 -0
- package/lib/components/ResourceCalculatorV1/assets/consoles/efg.png.mjs.map +1 -0
- package/lib/components/ResourceCalculatorV1/assets/consoles/ucg-max.png.js +27 -0
- package/lib/components/ResourceCalculatorV1/assets/consoles/ucg-max.png.js.map +1 -0
- package/lib/components/ResourceCalculatorV1/assets/consoles/ucg-max.png.mjs +3 -0
- package/lib/components/ResourceCalculatorV1/assets/consoles/ucg-max.png.mjs.map +1 -0
- package/lib/components/ResourceCalculatorV1/translations/en.json.js +4 -1
- package/lib/components/ResourceCalculatorV1/translations/en.json.js.map +1 -1
- package/lib/components/ResourceCalculatorV1/translations/en.json.mjs +4 -1
- package/lib/components/ResourceCalculatorV1/translations/en.json.mjs.map +1 -1
- package/lib/components/ResourceCalculatorV1/translations/useResourceCalculatorTranslation.d.ts +2 -2
- package/lib/components/VideoPlayerNew/VideoPlayer.js +2 -2
- package/lib/components/VideoPlayerNew/VideoPlayer.mjs +2 -2
- package/lib/components/VideoPlayerNew/assets/close.svg.js +1 -1
- package/lib/components/VideoPlayerNew/assets/close.svg.mjs +2 -2
- package/lib/components/VideoPlayerNew/assets/pause.svg.js +1 -1
- package/lib/components/VideoPlayerNew/assets/pause.svg.mjs +2 -2
- package/lib/constants/icons/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/{components/Explore/assets/MobileR.jpg.js → constants/icons/menu/powerAmp.svg.js} +6 -6
- package/lib/constants/icons/menu/powerAmp.svg.js.map +1 -0
- package/lib/constants/icons/menu/powerAmp.svg.mjs +3 -0
- package/lib/constants/icons/menu/powerAmp.svg.mjs.map +1 -0
- package/lib/constants/keyFeatureIcons.d.ts +2 -0
- package/lib/constants/keyFeatureIcons.js +6 -0
- package/lib/constants/keyFeatureIcons.js.map +1 -1
- package/lib/constants/keyFeatureIcons.mjs +6 -0
- package/lib/constants/keyFeatureIcons.mjs.map +1 -1
- package/lib/constants/proStoreCategories/mapping/index.d.ts +3 -1
- package/lib/constants/proStoreCategories/mapping/index.js +18 -8
- package/lib/constants/proStoreCategories/mapping/index.js.map +1 -1
- package/lib/constants/proStoreCategories/mapping/index.mjs +18 -8
- package/lib/constants/proStoreCategories/mapping/index.mjs.map +1 -1
- package/lib/constants/proStoreCategories/mapping/redirects.js +8 -1
- package/lib/constants/proStoreCategories/mapping/redirects.js.map +1 -1
- package/lib/constants/proStoreCategories/mapping/redirects.mjs +8 -1
- package/lib/constants/proStoreCategories/mapping/redirects.mjs.map +1 -1
- package/lib/constants/proStoreCategories/mapping/unifi.d.ts +4 -2
- package/lib/constants/proStoreCategories/mapping/unifi.js +3 -1
- package/lib/constants/proStoreCategories/mapping/unifi.js.map +1 -1
- package/lib/constants/proStoreCategories/mapping/unifi.mjs +3 -1
- package/lib/constants/proStoreCategories/mapping/unifi.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/ar.json.js +3 -2
- package/lib/constants/proStoreCategories/translations/ar.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/ar.json.mjs +3 -2
- package/lib/constants/proStoreCategories/translations/ar.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/de.json.js +3 -2
- package/lib/constants/proStoreCategories/translations/de.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/de.json.mjs +3 -2
- package/lib/constants/proStoreCategories/translations/de.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/el.json.js +3 -2
- package/lib/constants/proStoreCategories/translations/el.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/el.json.mjs +3 -2
- package/lib/constants/proStoreCategories/translations/el.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/en.json.js +5 -1
- package/lib/constants/proStoreCategories/translations/en.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/en.json.mjs +5 -2
- package/lib/constants/proStoreCategories/translations/en.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/es.json.js +3 -2
- package/lib/constants/proStoreCategories/translations/es.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/es.json.mjs +3 -2
- package/lib/constants/proStoreCategories/translations/es.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/fr.json.js +4 -3
- package/lib/constants/proStoreCategories/translations/fr.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/fr.json.mjs +4 -3
- package/lib/constants/proStoreCategories/translations/fr.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/it.json.js +3 -2
- package/lib/constants/proStoreCategories/translations/it.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/it.json.mjs +3 -2
- package/lib/constants/proStoreCategories/translations/it.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/ja.json.js +3 -2
- package/lib/constants/proStoreCategories/translations/ja.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/ja.json.mjs +3 -2
- package/lib/constants/proStoreCategories/translations/ja.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/pt-BR.json.js +3 -2
- package/lib/constants/proStoreCategories/translations/pt-BR.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/pt-BR.json.mjs +3 -2
- package/lib/constants/proStoreCategories/translations/pt-BR.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/zh-Hans.json.js +4 -3
- package/lib/constants/proStoreCategories/translations/zh-Hans.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/zh-Hans.json.mjs +4 -3
- package/lib/constants/proStoreCategories/translations/zh-Hans.json.mjs.map +1 -1
- package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.js +4 -3
- package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.js.map +1 -1
- package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.mjs +4 -3
- package/lib/constants/proStoreCategories/translations/zh-Hant-TW.json.mjs.map +1 -1
- package/lib/constants/shopify/keyFeatureIcons.js +8 -0
- package/lib/constants/shopify/keyFeatureIcons.js.map +1 -1
- package/lib/constants/shopify/keyFeatureIcons.mjs +6 -0
- package/lib/constants/shopify/keyFeatureIcons.mjs.map +1 -1
- package/lib/contexts/MenuContext/context.js +1 -1
- package/lib/contexts/MenuContext/context.js.map +1 -1
- package/lib/contexts/MenuContext/context.mjs +1 -1
- package/lib/contexts/MenuContext/context.mjs.map +1 -1
- package/lib/contexts/MenuContext/mapping.d.ts +3 -3
- package/lib/contexts/MenuContext/mapping.js +21 -7
- package/lib/contexts/MenuContext/mapping.js.map +1 -1
- package/lib/contexts/MenuContext/mapping.mjs +20 -7
- package/lib/contexts/MenuContext/mapping.mjs.map +1 -1
- package/lib/contexts/MenuContext/presets.d.ts +11 -4
- package/lib/contexts/MenuContext/presets.js +16 -12
- package/lib/contexts/MenuContext/presets.js.map +1 -1
- package/lib/contexts/MenuContext/presets.mjs +13 -13
- package/lib/contexts/MenuContext/presets.mjs.map +1 -1
- package/lib/contexts/MenuContext/types.d.ts +1 -1
- package/lib/contexts/MenuContext/types.js.map +1 -1
- package/lib/contexts/MenuContext/types.mjs.map +1 -1
- package/lib/contexts/MenuContext/utils.js +5 -1
- package/lib/contexts/MenuContext/utils.js.map +1 -1
- package/lib/contexts/MenuContext/utils.mjs +5 -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/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/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.d.ts +26 -0
- package/lib/utils/money/allocators/fixedAmount.js +55 -0
- package/lib/utils/money/allocators/fixedAmount.js.map +1 -0
- package/lib/utils/money/allocators/fixedAmount.mjs +53 -0
- package/lib/utils/money/allocators/fixedAmount.mjs.map +1 -0
- package/lib/utils/money/allocators/index.d.ts +2 -0
- package/lib/utils/money/allocators/index.js +8 -0
- package/lib/utils/money/allocators/index.js.map +1 -0
- package/lib/utils/money/allocators/index.mjs +4 -0
- package/lib/utils/money/allocators/index.mjs.map +1 -0
- package/lib/utils/money/allocators/productAmount.d.ts +13 -0
- package/lib/utils/money/allocators/productAmount.js +110 -0
- package/lib/utils/money/allocators/productAmount.js.map +1 -0
- package/lib/utils/money/allocators/productAmount.mjs +108 -0
- package/lib/utils/money/allocators/productAmount.mjs.map +1 -0
- package/lib/utils/money/constants.d.ts +56 -25
- package/lib/utils/money/constants.js +72 -7
- package/lib/utils/money/constants.js.map +1 -1
- package/lib/utils/money/constants.mjs +70 -7
- package/lib/utils/money/constants.mjs.map +1 -1
- package/lib/utils/money/exchangeRate.d.ts +31 -0
- package/lib/utils/money/exchangeRate.js +27 -0
- package/lib/utils/money/exchangeRate.js.map +1 -0
- package/lib/utils/money/exchangeRate.mjs +23 -0
- package/lib/utils/money/exchangeRate.mjs.map +1 -0
- package/lib/utils/money/format.d.ts +10 -5
- package/lib/utils/money/format.js +22 -14
- package/lib/utils/money/format.js.map +1 -1
- package/lib/utils/money/format.mjs +23 -16
- package/lib/utils/money/format.mjs.map +1 -1
- package/lib/utils/money/index.d.ts +4 -1
- package/lib/utils/money/index.js +26 -8
- package/lib/utils/money/index.js.map +1 -1
- package/lib/utils/money/index.mjs +8 -4
- package/lib/utils/money/index.mjs.map +1 -1
- package/lib/utils/money/misc.d.ts +68 -28
- package/lib/utils/money/misc.js +35 -64
- package/lib/utils/money/misc.js.map +1 -1
- package/lib/utils/money/misc.mjs +32 -43
- package/lib/utils/money/misc.mjs.map +1 -1
- package/lib/utils/money/misc.private.d.ts +23 -0
- package/lib/utils/money/misc.private.js +46 -0
- package/lib/utils/money/misc.private.js.map +1 -0
- package/lib/utils/money/misc.private.mjs +21 -0
- package/lib/utils/money/misc.private.mjs.map +1 -0
- package/lib/utils/money/shipping.d.ts +5 -0
- package/lib/utils/money/shipping.js +8 -0
- package/lib/utils/money/shipping.js.map +1 -0
- package/lib/utils/money/shipping.mjs +6 -0
- package/lib/utils/money/shipping.mjs.map +1 -0
- package/lib/utils/money/tax.d.ts +38 -2
- package/lib/utils/money/tax.js +46 -10
- package/lib/utils/money/tax.js.map +1 -1
- package/lib/utils/money/tax.mjs +42 -11
- package/lib/utils/money/tax.mjs.map +1 -1
- package/lib/utils/money/tax.private.d.ts +17 -0
- package/lib/utils/money/tax.private.js +65 -0
- package/lib/utils/money/tax.private.js.map +1 -0
- package/lib/utils/money/tax.private.mjs +60 -0
- package/lib/utils/money/tax.private.mjs.map +1 -0
- package/lib/utils/money/types.d.ts +78 -3
- package/lib/utils/nextjs/navigationPresets.d.ts +5 -3
- package/lib/utils/nextjs/navigationPresets.js +13 -7
- package/lib/utils/nextjs/navigationPresets.js.map +1 -1
- package/lib/utils/nextjs/navigationPresets.mjs +14 -8
- package/lib/utils/nextjs/navigationPresets.mjs.map +1 -1
- package/lib/utils/number.d.ts +1 -1
- package/lib/utils/number.js +1 -1
- package/lib/utils/number.js.map +1 -1
- package/lib/utils/number.mjs +1 -1
- package/lib/utils/number.mjs.map +1 -1
- package/lib/utils/productSort.d.ts +41 -0
- package/lib/utils/productSort.js +66 -0
- package/lib/utils/productSort.js.map +1 -0
- package/lib/utils/productSort.mjs +59 -0
- package/lib/utils/productSort.mjs.map +1 -0
- package/package.json +1 -1
- package/lib/assets/AITheta.jpg +0 -0
- package/lib/assets/MobileR.jpg +0 -0
- package/lib/assets/ProAV.jpg +0 -0
- package/lib/assets/ai3602.jpg +0 -0
- package/lib/assets/cloudgatewayultra.jpg +0 -0
- package/lib/assets/dreamRouter.jpg +0 -0
- package/lib/assets/dreamWall.jpg +0 -0
- package/lib/assets/g5-ptz2.jpg +0 -0
- package/lib/assets/wideAngle2.jpg +0 -0
- package/lib/components/Explore/LensCompare/LensCompare.d.ts +0 -2
- package/lib/components/Explore/LensCompare/LensCompare.js +0 -111
- package/lib/components/Explore/LensCompare/LensCompare.js.map +0 -1
- package/lib/components/Explore/LensCompare/LensCompare.mjs +0 -109
- package/lib/components/Explore/LensCompare/LensCompare.mjs.map +0 -1
- package/lib/components/Explore/LensCompare/LensCompare.styles.d.ts +0 -16
- package/lib/components/Explore/LensCompare/LensCompare.styles.js +0 -153
- package/lib/components/Explore/LensCompare/LensCompare.styles.js.map +0 -1
- package/lib/components/Explore/LensCompare/LensCompare.styles.mjs +0 -132
- package/lib/components/Explore/LensCompare/LensCompare.styles.mjs.map +0 -1
- package/lib/components/Explore/LensCompare/LensCompare.types.d.ts +0 -9
- package/lib/components/Explore/LensCompare/LensCompare.utils.d.ts +0 -2
- package/lib/components/Explore/LensCompare/LensCompare.utils.js +0 -23
- package/lib/components/Explore/LensCompare/LensCompare.utils.js.map +0 -1
- package/lib/components/Explore/LensCompare/LensCompare.utils.mjs +0 -21
- package/lib/components/Explore/LensCompare/LensCompare.utils.mjs.map +0 -1
- package/lib/components/Explore/LensCompare/LensCompareData.d.ts +0 -29
- package/lib/components/Explore/LensCompare/LensCompareData.js +0 -68
- package/lib/components/Explore/LensCompare/LensCompareData.js.map +0 -1
- package/lib/components/Explore/LensCompare/LensCompareData.mjs +0 -58
- package/lib/components/Explore/LensCompare/LensCompareData.mjs.map +0 -1
- package/lib/components/Explore/LensCompare/assets/ai360.jpg.js.map +0 -1
- package/lib/components/Explore/LensCompare/assets/ai360.jpg.mjs +0 -3
- package/lib/components/Explore/LensCompare/assets/ai360.jpg.mjs.map +0 -1
- package/lib/components/Explore/LensCompare/assets/wideAngle.jpg.js +0 -27
- package/lib/components/Explore/LensCompare/assets/wideAngle.jpg.js.map +0 -1
- package/lib/components/Explore/LensCompare/assets/wideAngle.jpg.mjs +0 -3
- package/lib/components/Explore/LensCompare/assets/wideAngle.jpg.mjs.map +0 -1
- package/lib/components/Explore/assets/AITheta.jpg.js.map +0 -1
- package/lib/components/Explore/assets/AITheta.jpg.mjs +0 -3
- package/lib/components/Explore/assets/AITheta.jpg.mjs.map +0 -1
- package/lib/components/Explore/assets/MobileR.jpg.js.map +0 -1
- package/lib/components/Explore/assets/MobileR.jpg.mjs +0 -3
- package/lib/components/Explore/assets/MobileR.jpg.mjs.map +0 -1
- package/lib/components/Explore/assets/ProAV.jpg.js.map +0 -1
- package/lib/components/Explore/assets/ProAV.jpg.mjs +0 -3
- package/lib/components/Explore/assets/ProAV.jpg.mjs.map +0 -1
- package/lib/components/Explore/assets/baseStation-mobile.jpg.js.map +0 -1
- package/lib/components/Explore/assets/baseStation-mobile.jpg.mjs +0 -3
- package/lib/components/Explore/assets/baseStation-mobile.jpg.mjs.map +0 -1
- package/lib/components/Explore/assets/cloudgatewayultra.jpg.js +0 -27
- package/lib/components/Explore/assets/cloudgatewayultra.jpg.js.map +0 -1
- package/lib/components/Explore/assets/cloudgatewayultra.jpg.mjs +0 -3
- package/lib/components/Explore/assets/cloudgatewayultra.jpg.mjs.map +0 -1
- package/lib/components/Explore/assets/dreamRouter.jpg.js +0 -27
- package/lib/components/Explore/assets/dreamRouter.jpg.js.map +0 -1
- package/lib/components/Explore/assets/dreamRouter.jpg.mjs +0 -3
- package/lib/components/Explore/assets/dreamRouter.jpg.mjs.map +0 -1
- package/lib/components/Explore/assets/dreamWall.jpg.js +0 -27
- package/lib/components/Explore/assets/dreamWall.jpg.js.map +0 -1
- package/lib/components/Explore/assets/dreamWall.jpg.mjs +0 -3
- package/lib/components/Explore/assets/dreamWall.jpg.mjs.map +0 -1
- package/lib/components/Explore/assets/g4-ptz.jpg.js.map +0 -1
- package/lib/components/Explore/assets/g4-ptz.jpg.mjs +0 -3
- package/lib/components/Explore/assets/g4-ptz.jpg.mjs.map +0 -1
- package/lib/components/Explore/assets/g5-ptz.jpg.js.map +0 -1
- package/lib/components/Explore/assets/g5-ptz.jpg.mjs +0 -3
- package/lib/components/Explore/assets/g5-ptz.jpg.mjs.map +0 -1
- package/lib/components/Explore/assets/unifiExpress.jpg.js +0 -27
- package/lib/components/Explore/assets/unifiExpress.jpg.js.map +0 -1
- package/lib/components/Explore/assets/unifiExpress.jpg.mjs +0 -3
- package/lib/components/Explore/assets/unifiExpress.jpg.mjs.map +0 -1
- package/lib/utils/validations.d.ts +0 -15
- package/lib/utils/validations.js +0 -23
- package/lib/utils/validations.js.map +0 -1
- package/lib/utils/validations.mjs +0 -21
- package/lib/utils/validations.mjs.map +0 -1
- /package/lib/assets/{baseStation-mobile.jpg → baseStation--mobile.jpg} +0 -0
- /package/lib/assets/{g4-ptz.jpg → g4Ptz.jpg} +0 -0
- /package/lib/assets/{unifiExpress.jpg → ux.jpg} +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dinero_js = require('dinero.js');
|
|
4
|
+
var errors = require('../errors.js');
|
|
5
|
+
var fixedAmount = require('./allocators/fixedAmount.js');
|
|
6
|
+
var misc = require('./misc.js');
|
|
7
|
+
"use strict";
|
|
8
|
+
const taxRateToDineroAllocation = taxRate => {
|
|
9
|
+
if (taxRate <= 0 || taxRate >= 1) {
|
|
10
|
+
throw new RangeError("Unsupported rate, expected in range of 0>rate<1");
|
|
11
|
+
}
|
|
12
|
+
const rateScale = String(taxRate).split(".")[1]?.length;
|
|
13
|
+
errors.assert(rateScale !== void 0, "rateScale is undefined");
|
|
14
|
+
const rateInt = Math.round(taxRate * Math.pow(10, rateScale));
|
|
15
|
+
return [rateInt, Math.pow(10, rateScale) - rateInt];
|
|
16
|
+
};
|
|
17
|
+
const allocatePerItemTaxableAmount = itemSummary => {
|
|
18
|
+
if (itemSummary.quantity === 1) {
|
|
19
|
+
return [itemSummary];
|
|
20
|
+
}
|
|
21
|
+
const preDiscountAmount = dinero_js.add(misc.getDinero(itemSummary.taxableAmount, itemSummary.currency), misc.getDinero(itemSummary.discountAmount, itemSummary.currency));
|
|
22
|
+
const allocator = new fixedAmount.FixedAmountAllocator({
|
|
23
|
+
initialAllocateAmount: itemSummary.discountAmount,
|
|
24
|
+
initialTotalAmount: misc.amount(preDiscountAmount),
|
|
25
|
+
currency: itemSummary.currency
|
|
26
|
+
});
|
|
27
|
+
return Array.from({
|
|
28
|
+
length: itemSummary.quantity
|
|
29
|
+
}, () => {
|
|
30
|
+
const discountAllocatedAmount = allocator.allocate(itemSummary.itemPrice, itemSummary.currency);
|
|
31
|
+
const taxableAmount = dinero_js.subtract(misc.getDinero(itemSummary.itemPrice, itemSummary.currency), discountAllocatedAmount);
|
|
32
|
+
return {
|
|
33
|
+
itemPrice: itemSummary.itemPrice,
|
|
34
|
+
taxableAmount: misc.amount(taxableAmount),
|
|
35
|
+
discountAmount: misc.amount(discountAllocatedAmount),
|
|
36
|
+
currency: itemSummary.currency,
|
|
37
|
+
quantity: 1
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const calculateWholeQtyLineItemTax = (itemSummary, taxRate) => {
|
|
42
|
+
if (taxRate === 0) {
|
|
43
|
+
return misc.getDinero(0, itemSummary.currency);
|
|
44
|
+
}
|
|
45
|
+
const [taxAmount] = dinero_js.allocate(misc.getDinero(itemSummary.taxableAmount, itemSummary.currency), taxRateToDineroAllocation(taxRate));
|
|
46
|
+
errors.assert(taxAmount !== void 0, "taxAmount is undefined");
|
|
47
|
+
return taxAmount;
|
|
48
|
+
};
|
|
49
|
+
const calculatePerQtyLineItemTax = (itemSummary, taxRate) => {
|
|
50
|
+
if (taxRate === 0) {
|
|
51
|
+
return misc.getDinero(0, itemSummary.currency);
|
|
52
|
+
}
|
|
53
|
+
const singleItemSummaries = allocatePerItemTaxableAmount(itemSummary);
|
|
54
|
+
let totalTaxAmount = misc.getDinero(0, itemSummary.currency);
|
|
55
|
+
singleItemSummaries.forEach(itemSummary2 => {
|
|
56
|
+
const taxAmount = calculateWholeQtyLineItemTax(itemSummary2, taxRate);
|
|
57
|
+
totalTaxAmount = dinero_js.add(totalTaxAmount, taxAmount);
|
|
58
|
+
});
|
|
59
|
+
return totalTaxAmount;
|
|
60
|
+
};
|
|
61
|
+
exports.allocatePerItemTaxableAmount = allocatePerItemTaxableAmount;
|
|
62
|
+
exports.calculatePerQtyLineItemTax = calculatePerQtyLineItemTax;
|
|
63
|
+
exports.calculateWholeQtyLineItemTax = calculateWholeQtyLineItemTax;
|
|
64
|
+
exports.taxRateToDineroAllocation = taxRateToDineroAllocation;
|
|
65
|
+
//# sourceMappingURL=tax.private.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tax.private.js","sources":["../../../src/utils/money/tax.private.ts"],"sourcesContent":["// #############################################################################\n// Internal helper functions not for consumption outside of store.core!\n// Wrote as separate files so that they can be easily unit tested without exposing them\n// #############################################################################\nimport type { Dinero } from \"dinero.js\";\nimport { add, allocate, subtract } from \"dinero.js\";\n\nimport { assert } from \"../errors\";\nimport { FixedAmountAllocator } from \"./allocators/fixedAmount\";\nimport { amount, getDinero } from \"./misc\";\nimport type {\n Cents,\n LineItemSummary,\n SingleLineItemSummary,\n TaxRate,\n} from \"./types\";\n\n/**\n * Private helper to convert a floating number to a dinero friendly allocation integer pair\n * @see https://v2.dinerojs.com/docs/api/mutations/allocate\n * @example\n * taxRateToDineroAllocation(0.1) // [1, 9]\n * taxRateToDineroAllocation(0.5) // [5, 5]\n */\nexport const taxRateToDineroAllocation = (\n taxRate: TaxRate,\n): [number, number] => {\n if (taxRate <= 0 || taxRate >= 1) {\n throw new RangeError(\"Unsupported rate, expected in range of 0>rate<1\");\n }\n\n // Get the scale of the rate\n const rateScale = String(taxRate).split(\".\")[1]?.length;\n assert(rateScale !== undefined, \"rateScale is undefined\");\n\n // Convert to integers\n const rateInt = Math.round(taxRate * Math.pow(10, rateScale));\n return [rateInt, Math.pow(10, rateScale) - rateInt];\n};\n\n/**\n * Reverse engineer the taxable amount from \"whole item\" taxable amount into \"per item\" taxable amount for custom tax\n * rate calculations\n */\nexport const allocatePerItemTaxableAmount = (\n itemSummary: LineItemSummary,\n): SingleLineItemSummary[] => {\n /**\n * If the item quantity is 1, we can just return the item summary as is\n */\n if (itemSummary.quantity === 1) {\n return [itemSummary as SingleLineItemSummary];\n }\n\n // Reverse engineer price before discount\n const preDiscountAmount = add(\n getDinero(itemSummary.taxableAmount, itemSummary.currency),\n getDinero(itemSummary.discountAmount, itemSummary.currency),\n );\n\n const allocator = new FixedAmountAllocator({\n initialAllocateAmount: itemSummary.discountAmount,\n initialTotalAmount: amount(preDiscountAmount),\n currency: itemSummary.currency,\n });\n\n // Iterate over the amount of qty to reverse engineer the discount price\n return Array.from({ length: itemSummary.quantity }, () => {\n const discountAllocatedAmount = allocator.allocate(\n itemSummary.itemPrice,\n itemSummary.currency,\n );\n\n const taxableAmount = subtract(\n getDinero(itemSummary.itemPrice, itemSummary.currency),\n discountAllocatedAmount,\n );\n\n return {\n itemPrice: itemSummary.itemPrice,\n taxableAmount: amount(taxableAmount),\n discountAmount: amount(discountAllocatedAmount),\n currency: itemSummary.currency,\n quantity: 1,\n } as SingleLineItemSummary;\n });\n};\n\nexport const calculateWholeQtyLineItemTax = (\n itemSummary: LineItemSummary,\n taxRate: TaxRate,\n): Dinero<Cents> => {\n // Nothing to calculate\n if (taxRate === 0) {\n return getDinero(0, itemSummary.currency);\n }\n\n /**\n * FIXME: look into approach with multiply and different scale for control over rounding, currently we just inherit\n * what dinero gives us which cause unexpected rounding issue\n */\n const [taxAmount] = allocate(\n getDinero(itemSummary.taxableAmount, itemSummary.currency),\n taxRateToDineroAllocation(taxRate),\n );\n\n assert(taxAmount !== undefined, \"taxAmount is undefined\");\n return taxAmount;\n};\n\nexport const calculatePerQtyLineItemTax = (\n itemSummary: LineItemSummary,\n taxRate: TaxRate,\n): Dinero<Cents> => {\n // Nothing to calculate\n if (taxRate === 0) {\n return getDinero(0, itemSummary.currency);\n }\n\n // Split the item summary into per individual item qty summaries\n const singleItemSummaries = allocatePerItemTaxableAmount(itemSummary);\n\n // Calculate individual item qty tax and sum them up\n let totalTaxAmount = getDinero(0, itemSummary.currency);\n\n singleItemSummaries.forEach((itemSummary) => {\n // Probably a bit confusing at first, but calling the whole qty tax calculation function here as we can safely use\n // it as item summary is always a single item summary here\n const taxAmount = calculateWholeQtyLineItemTax(itemSummary, taxRate);\n totalTaxAmount = add(totalTaxAmount, taxAmount);\n });\n\n return totalTaxAmount;\n};\n"],"names":["taxRateToDineroAllocation","taxRate","RangeError","rateScale","String","split","length","assert","rateInt","Math","round","pow","allocatePerItemTaxableAmount","itemSummary","quantity","preDiscountAmount","add","getDinero","taxableAmount","currency","discountAmount","allocator","FixedAmountAllocator","initialAllocateAmount","initialTotalAmount","amount","Array","from","discountAllocatedAmount","allocate","itemPrice","subtract","calculateWholeQtyLineItemTax","taxAmount","calculatePerQtyLineItemTax","singleItemSummaries","totalTaxAmount","forEach"],"mappings":";;;;;;;AAwBa,MAAAA,yBAAA,GACXC,OACqB,IAAA;EACjB,IAAAA,OAAA,IAAW,CAAK,IAAAA,OAAA,IAAW,CAAG,EAAA;IAC1B,MAAA,IAAIC,WAAW,iDAAiD,CAAA;EACxE;EAGM,MAAAC,SAAA,GAAYC,OAAOH,OAAO,CAAA,CAAEI,MAAM,GAAG,CAAA,CAAE,CAAC,CAAG,EAAAC,MAAA;EAC1CC,MAAAA,CAAAA,MAAA,CAAAJ,SAAA,KAAc,QAAW,wBAAwB,CAAA;EAGlD,MAAAK,OAAA,GAAUC,KAAKC,KAAM,CAAAT,OAAA,GAAUQ,KAAKE,GAAI,CAAA,EAAA,EAAIR,SAAS,CAAC,CAAA;EAC5D,OAAO,CAACK,OAAS,EAAAC,IAAA,CAAKE,IAAI,EAAI,EAAAR,SAAS,IAAIK,OAAO,CAAA;AACpD,CAAA;AAMa,MAAAI,4BAAA,GACXC,WAC4B,IAAA;EAIxB,IAAAA,WAAA,CAAYC,aAAa,CAAG,EAAA;IAC9B,OAAO,CAACD,WAAoC,CAAA;EAC9C;EAGA,MAAME,iBAAoB,GAAAC,SAAA,CAAAA,GAAA,CAC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,CAAA,EACzDnB,0BAA0BC,OAAO,CAAA,CACnC;EAEOM,MAAAA,CAAAA,MAAA,CAAA0B,SAAA,KAAc,QAAW,wBAAwB,CAAA;EACjD,OAAAA,SAAA;AACT,CAAA;AAEa,MAAAC,0BAAA,GAA6BA,CACxCrB,WAAA,EACAZ,OACkB,KAAA;EAElB,IAAIA,YAAY,CAAG,EAAA;IACV,OAAAgB,cAAA,CAAU,CAAG,EAAAJ,WAAA,CAAYM,QAAQ,CAAA;EAC1C;EAGM,MAAAgB,mBAAA,GAAsBvB,6BAA6BC,WAAW,CAAA;EAGpE,IAAIuB,cAAiB,GAAAnB,IAAA,CAAAA,SAAA,CAAU,CAAG,EAAAJ,WAAA,CAAYM,QAAQ,CAAA;EAElCgB,mBAAA,CAAAE,OAAA,CAASxB,YAAgB,IAAA;IAGrC,MAAAoB,SAAA,GAAYD,4BAA6BnB,CAAAA,YAAAA,EAAaZ,OAAO,CAAA;IAClDmC,cAAA,GAAApB,SAAA,CAAAA,GAAA,CAAIoB,gBAAgBH,SAAS,CAAA;EAAA,CAC/C,CAAA;EAEM,OAAAG,cAAA;AACT,CAAA;;;;"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { add, subtract, allocate } from 'dinero.js';
|
|
2
|
+
import { assert } from '../errors.mjs';
|
|
3
|
+
import { FixedAmountAllocator } from './allocators/fixedAmount.mjs';
|
|
4
|
+
import { getDinero, amount } from './misc.mjs';
|
|
5
|
+
"use strict";
|
|
6
|
+
const taxRateToDineroAllocation = taxRate => {
|
|
7
|
+
if (taxRate <= 0 || taxRate >= 1) {
|
|
8
|
+
throw new RangeError("Unsupported rate, expected in range of 0>rate<1");
|
|
9
|
+
}
|
|
10
|
+
const rateScale = String(taxRate).split(".")[1]?.length;
|
|
11
|
+
assert(rateScale !== void 0, "rateScale is undefined");
|
|
12
|
+
const rateInt = Math.round(taxRate * Math.pow(10, rateScale));
|
|
13
|
+
return [rateInt, Math.pow(10, rateScale) - rateInt];
|
|
14
|
+
};
|
|
15
|
+
const allocatePerItemTaxableAmount = itemSummary => {
|
|
16
|
+
if (itemSummary.quantity === 1) {
|
|
17
|
+
return [itemSummary];
|
|
18
|
+
}
|
|
19
|
+
const preDiscountAmount = add(getDinero(itemSummary.taxableAmount, itemSummary.currency), getDinero(itemSummary.discountAmount, itemSummary.currency));
|
|
20
|
+
const allocator = new FixedAmountAllocator({
|
|
21
|
+
initialAllocateAmount: itemSummary.discountAmount,
|
|
22
|
+
initialTotalAmount: amount(preDiscountAmount),
|
|
23
|
+
currency: itemSummary.currency
|
|
24
|
+
});
|
|
25
|
+
return Array.from({
|
|
26
|
+
length: itemSummary.quantity
|
|
27
|
+
}, () => {
|
|
28
|
+
const discountAllocatedAmount = allocator.allocate(itemSummary.itemPrice, itemSummary.currency);
|
|
29
|
+
const taxableAmount = subtract(getDinero(itemSummary.itemPrice, itemSummary.currency), discountAllocatedAmount);
|
|
30
|
+
return {
|
|
31
|
+
itemPrice: itemSummary.itemPrice,
|
|
32
|
+
taxableAmount: amount(taxableAmount),
|
|
33
|
+
discountAmount: amount(discountAllocatedAmount),
|
|
34
|
+
currency: itemSummary.currency,
|
|
35
|
+
quantity: 1
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const calculateWholeQtyLineItemTax = (itemSummary, taxRate) => {
|
|
40
|
+
if (taxRate === 0) {
|
|
41
|
+
return getDinero(0, itemSummary.currency);
|
|
42
|
+
}
|
|
43
|
+
const [taxAmount] = allocate(getDinero(itemSummary.taxableAmount, itemSummary.currency), taxRateToDineroAllocation(taxRate));
|
|
44
|
+
assert(taxAmount !== void 0, "taxAmount is undefined");
|
|
45
|
+
return taxAmount;
|
|
46
|
+
};
|
|
47
|
+
const calculatePerQtyLineItemTax = (itemSummary, taxRate) => {
|
|
48
|
+
if (taxRate === 0) {
|
|
49
|
+
return getDinero(0, itemSummary.currency);
|
|
50
|
+
}
|
|
51
|
+
const singleItemSummaries = allocatePerItemTaxableAmount(itemSummary);
|
|
52
|
+
let totalTaxAmount = getDinero(0, itemSummary.currency);
|
|
53
|
+
singleItemSummaries.forEach(itemSummary2 => {
|
|
54
|
+
const taxAmount = calculateWholeQtyLineItemTax(itemSummary2, taxRate);
|
|
55
|
+
totalTaxAmount = add(totalTaxAmount, taxAmount);
|
|
56
|
+
});
|
|
57
|
+
return totalTaxAmount;
|
|
58
|
+
};
|
|
59
|
+
export { allocatePerItemTaxableAmount, calculatePerQtyLineItemTax, calculateWholeQtyLineItemTax, taxRateToDineroAllocation };
|
|
60
|
+
//# sourceMappingURL=tax.private.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tax.private.mjs","sources":["../../../src/utils/money/tax.private.ts"],"sourcesContent":["// #############################################################################\n// Internal helper functions not for consumption outside of store.core!\n// Wrote as separate files so that they can be easily unit tested without exposing them\n// #############################################################################\nimport type { Dinero } from \"dinero.js\";\nimport { add, allocate, subtract } from \"dinero.js\";\n\nimport { assert } from \"../errors\";\nimport { FixedAmountAllocator } from \"./allocators/fixedAmount\";\nimport { amount, getDinero } from \"./misc\";\nimport type {\n Cents,\n LineItemSummary,\n SingleLineItemSummary,\n TaxRate,\n} from \"./types\";\n\n/**\n * Private helper to convert a floating number to a dinero friendly allocation integer pair\n * @see https://v2.dinerojs.com/docs/api/mutations/allocate\n * @example\n * taxRateToDineroAllocation(0.1) // [1, 9]\n * taxRateToDineroAllocation(0.5) // [5, 5]\n */\nexport const taxRateToDineroAllocation = (\n taxRate: TaxRate,\n): [number, number] => {\n if (taxRate <= 0 || taxRate >= 1) {\n throw new RangeError(\"Unsupported rate, expected in range of 0>rate<1\");\n }\n\n // Get the scale of the rate\n const rateScale = String(taxRate).split(\".\")[1]?.length;\n assert(rateScale !== undefined, \"rateScale is undefined\");\n\n // Convert to integers\n const rateInt = Math.round(taxRate * Math.pow(10, rateScale));\n return [rateInt, Math.pow(10, rateScale) - rateInt];\n};\n\n/**\n * Reverse engineer the taxable amount from \"whole item\" taxable amount into \"per item\" taxable amount for custom tax\n * rate calculations\n */\nexport const allocatePerItemTaxableAmount = (\n itemSummary: LineItemSummary,\n): SingleLineItemSummary[] => {\n /**\n * If the item quantity is 1, we can just return the item summary as is\n */\n if (itemSummary.quantity === 1) {\n return [itemSummary as SingleLineItemSummary];\n }\n\n // Reverse engineer price before discount\n const preDiscountAmount = add(\n getDinero(itemSummary.taxableAmount, itemSummary.currency),\n getDinero(itemSummary.discountAmount, itemSummary.currency),\n );\n\n const allocator = new FixedAmountAllocator({\n initialAllocateAmount: itemSummary.discountAmount,\n initialTotalAmount: amount(preDiscountAmount),\n currency: itemSummary.currency,\n });\n\n // Iterate over the amount of qty to reverse engineer the discount price\n return Array.from({ length: itemSummary.quantity }, () => {\n const discountAllocatedAmount = allocator.allocate(\n itemSummary.itemPrice,\n itemSummary.currency,\n );\n\n const taxableAmount = subtract(\n getDinero(itemSummary.itemPrice, itemSummary.currency),\n discountAllocatedAmount,\n );\n\n return {\n itemPrice: itemSummary.itemPrice,\n taxableAmount: amount(taxableAmount),\n discountAmount: amount(discountAllocatedAmount),\n currency: itemSummary.currency,\n quantity: 1,\n } as SingleLineItemSummary;\n });\n};\n\nexport const calculateWholeQtyLineItemTax = (\n itemSummary: LineItemSummary,\n taxRate: TaxRate,\n): Dinero<Cents> => {\n // Nothing to calculate\n if (taxRate === 0) {\n return getDinero(0, itemSummary.currency);\n }\n\n /**\n * FIXME: look into approach with multiply and different scale for control over rounding, currently we just inherit\n * what dinero gives us which cause unexpected rounding issue\n */\n const [taxAmount] = allocate(\n getDinero(itemSummary.taxableAmount, itemSummary.currency),\n taxRateToDineroAllocation(taxRate),\n );\n\n assert(taxAmount !== undefined, \"taxAmount is undefined\");\n return taxAmount;\n};\n\nexport const calculatePerQtyLineItemTax = (\n itemSummary: LineItemSummary,\n taxRate: TaxRate,\n): Dinero<Cents> => {\n // Nothing to calculate\n if (taxRate === 0) {\n return getDinero(0, itemSummary.currency);\n }\n\n // Split the item summary into per individual item qty summaries\n const singleItemSummaries = allocatePerItemTaxableAmount(itemSummary);\n\n // Calculate individual item qty tax and sum them up\n let totalTaxAmount = getDinero(0, itemSummary.currency);\n\n singleItemSummaries.forEach((itemSummary) => {\n // Probably a bit confusing at first, but calling the whole qty tax calculation function here as we can safely use\n // it as item summary is always a single item summary here\n const taxAmount = calculateWholeQtyLineItemTax(itemSummary, taxRate);\n totalTaxAmount = add(totalTaxAmount, taxAmount);\n });\n\n return totalTaxAmount;\n};\n"],"names":["taxRateToDineroAllocation","taxRate","RangeError","rateScale","String","split","length","assert","rateInt","Math","round","pow","allocatePerItemTaxableAmount","itemSummary","quantity","preDiscountAmount","add","getDinero","taxableAmount","currency","discountAmount","allocator","FixedAmountAllocator","initialAllocateAmount","initialTotalAmount","amount","Array","from","discountAllocatedAmount","allocate","itemPrice","subtract","calculateWholeQtyLineItemTax","taxAmount","calculatePerQtyLineItemTax","singleItemSummaries","totalTaxAmount","forEach"],"mappings":";;;;;AAwBa,MAAAA,yBAAA,GACXC,OACqB,IAAA;EACjB,IAAAA,OAAA,IAAW,CAAK,IAAAA,OAAA,IAAW,CAAG,EAAA;IAC1B,MAAA,IAAIC,WAAW,iDAAiD,CAAA;EACxE;EAGM,MAAAC,SAAA,GAAYC,OAAOH,OAAO,CAAA,CAAEI,MAAM,GAAG,CAAA,CAAE,CAAC,CAAG,EAAAC,MAAA;EAC1CC,MAAA,CAAAJ,SAAA,KAAc,QAAW,wBAAwB,CAAA;EAGlD,MAAAK,OAAA,GAAUC,KAAKC,KAAM,CAAAT,OAAA,GAAUQ,KAAKE,GAAI,CAAA,EAAA,EAAIR,SAAS,CAAC,CAAA;EAC5D,OAAO,CAACK,OAAS,EAAAC,IAAA,CAAKE,IAAI,EAAI,EAAAR,SAAS,IAAIK,OAAO,CAAA;AACpD,CAAA;AAMa,MAAAI,4BAAA,GACXC,WAC4B,IAAA;EAIxB,IAAAA,WAAA,CAAYC,aAAa,CAAG,EAAA;IAC9B,OAAO,CAACD,W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O,CAAA,CACnC;EAEOM,MAAA,CAAA0B,SAAA,KAAc,QAAW,wBAAwB,CAAA;EACjD,OAAAA,SAAA;AACT,CAAA;AAEa,MAAAC,0BAAA,GAA6BA,CACxCrB,WAAA,EACAZ,OACkB,KAAA;EAElB,IAAIA,YAAY,CAAG,EAAA;IACV,OAAAgB,SAAA,CAAU,CAAG,EAAAJ,WAAA,CAAYM,QAAQ,CAAA;EAC1C;EAGM,MAAAgB,mBAAA,GAAsBvB,6BAA6BC,WAAW,CAAA;EAGpE,IAAIuB,cAAiB,GAAAnB,SAAA,CAAU,CAAG,EAAAJ,WAAA,CAAYM,QAAQ,CAAA;EAElCgB,mBAAA,CAAAE,OAAA,CAASxB,YAAgB,IAAA;IAGrC,MAAAoB,SAAA,GAAYD,4BAA6BnB,CAAAA,YAAAA,EAAaZ,OAAO,CAAA;IAClDmC,cAAA,GAAApB,GAAA,CAAIoB,gBAAgBH,SAAS,CAAA;EAAA,CAC/C,CAAA;EAEM,OAAAG,cAAA;AACT,CAAA;"}
|
|
@@ -1,10 +1,85 @@
|
|
|
1
|
-
import type { Currency as DineroCurrency } from "dinero.js";
|
|
1
|
+
import type { Dinero, Currency as DineroCurrency } from "dinero.js";
|
|
2
|
+
import type { Currency } from "../../types";
|
|
3
|
+
/**
|
|
4
|
+
* Floating point number of item tax rate
|
|
5
|
+
* Number in range of 0>rate<1 (non-inclusive boundaries)
|
|
6
|
+
* @example
|
|
7
|
+
* 0.09 // 9%
|
|
8
|
+
*/
|
|
9
|
+
export type TaxRate = number;
|
|
10
|
+
/**
|
|
11
|
+
* Shorthand for Dinero.js instance with number as the amount
|
|
12
|
+
*/
|
|
13
|
+
export type Dino = Dinero<number>;
|
|
14
|
+
/**
|
|
15
|
+
* Shorthand for Dinero.js currency instance representing either a currency or custom currency such as tax-rate or shipping
|
|
16
|
+
*/
|
|
17
|
+
export type DinoCurrency = DineroCurrency<number>;
|
|
18
|
+
/**
|
|
19
|
+
* Cents representation of specific currency
|
|
20
|
+
* As a helper to easily understand the code, we use `Cents` as a type alias for `number` as historically we have had
|
|
21
|
+
* mistakes by the team where we have used as dollar instead of `Cents` and vice versa.
|
|
22
|
+
* @example
|
|
23
|
+
* 100 // in USD this is $1.00
|
|
24
|
+
* 100 // in YEN this is ¥100
|
|
25
|
+
*/
|
|
26
|
+
export type Cents = number;
|
|
27
|
+
/**
|
|
28
|
+
* Type definition for a rounding function that can be used to round fractions
|
|
29
|
+
*/
|
|
30
|
+
export type RoundingFn = (float: number) => Cents;
|
|
31
|
+
/**
|
|
32
|
+
* Convenient way to represent a money on the API level
|
|
33
|
+
* When working with dinero you typically will convert this to a Dinero instance
|
|
34
|
+
*/
|
|
35
|
+
export interface Money {
|
|
36
|
+
amount: Cents;
|
|
37
|
+
currency: Currency;
|
|
38
|
+
}
|
|
2
39
|
/**
|
|
3
40
|
* Attempt to type out some locales `language-TERRITORY` which "we" as store care about
|
|
4
41
|
* @see https://unicode-org.github.io/cldr-staging/charts/38/supplemental/territory_language_information.html
|
|
5
42
|
*/
|
|
6
43
|
export type Locale = "ar-AE" | "ar-SA" | "bg-BG" | "bn-BD" | "bn-IN" | "cs-CZ" | "da-DK" | "de-AT" | "de-CH" | "de-DE" | "el-GR" | "en-AU" | "en-BR" | "en-CA" | "en-GB" | "en-IE" | "en-IN" | "en-JP" | "en-NZ" | "en-SG" | "en-US" | "en-ZA" | "es-AR" | "es-CL" | "es-CO" | "es-ES" | "es-MX" | "es-US" | "fi-FI" | "fr-BE" | "fr-CA" | "fr-CH" | "fr-FR" | "he-IL" | "hi-IN" | "hr-HR" | "hu-HU" | "id-ID" | "it-CH" | "it-IT" | "ja-JP" | "ko-KR" | "nl-BE" | "nl-NL" | "no-NO" | "pl-PL" | "pt-BR" | "pt-PT" | "ro-RO" | "ru-RU" | "sk-SK" | "sv-SE" | "ta-IN" | "ta-LK" | "th-TH" | "tr-TR" | "zh-CN" | "zh-HK" | "zh-TW" | string;
|
|
7
|
-
export type
|
|
8
|
-
currency:
|
|
44
|
+
export type LocalizedCurrency = {
|
|
45
|
+
currency: DinoCurrency;
|
|
9
46
|
locale: Locale;
|
|
10
47
|
};
|
|
48
|
+
export interface LineItemSummary {
|
|
49
|
+
itemPrice: Cents;
|
|
50
|
+
/**
|
|
51
|
+
* Item quantity that is always bigger than zero!
|
|
52
|
+
*/
|
|
53
|
+
quantity: number;
|
|
54
|
+
currency: Currency;
|
|
55
|
+
/**
|
|
56
|
+
* Total discount amount (only) applied for the given item quantity.
|
|
57
|
+
* No taxes are included. Calculated by `total_raw_price * <discount-allocation-percentage>`
|
|
58
|
+
*/
|
|
59
|
+
discountAmount: Cents;
|
|
60
|
+
/**
|
|
61
|
+
* subtotal - discountAmount
|
|
62
|
+
*/
|
|
63
|
+
taxableAmount: Cents;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Pretty much the same as PreTaxItemSummary but with quantity always set to 1 (for clearer type hinting and reasoning
|
|
67
|
+
* around the topic)
|
|
68
|
+
*/
|
|
69
|
+
export interface SingleLineItemSummary extends LineItemSummary {
|
|
70
|
+
quantity: 1;
|
|
71
|
+
}
|
|
72
|
+
export interface FullLineItemSummary extends LineItemSummary {
|
|
73
|
+
/**
|
|
74
|
+
* Total price for the given item quantity. Calculated by `(itemPrice * quantity)`
|
|
75
|
+
*/
|
|
76
|
+
subtotal: Cents;
|
|
77
|
+
/**
|
|
78
|
+
* Total tax amount for the given item quantity.
|
|
79
|
+
*/
|
|
80
|
+
tax: Cents;
|
|
81
|
+
/**
|
|
82
|
+
* Total price for the given item quantity. Calculated by `subtotal - discountAmount + tax`
|
|
83
|
+
*/
|
|
84
|
+
total: Cents;
|
|
85
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DeployedLanguages } from "../../contexts/MenuContext/mapping";
|
|
1
2
|
import type { BasicSiteConfig } from "../../contexts/MenuContext/types";
|
|
2
3
|
import { SiteConfigType } from "../../contexts/MenuContext/types";
|
|
3
4
|
import { GlobalStoreId } from "../../types";
|
|
@@ -33,7 +34,7 @@ export declare const getGlobalSiteConfigByEnv: (buildEnv: BuildEnv) => {
|
|
|
33
34
|
store: {
|
|
34
35
|
type: SiteConfigType.Regional;
|
|
35
36
|
defaultRegion: {
|
|
36
|
-
languages?:
|
|
37
|
+
languages?: DeployedLanguages | undefined;
|
|
37
38
|
defaultLanguage?: import("../../types").Language | undefined;
|
|
38
39
|
type: SiteConfigType.Basic;
|
|
39
40
|
baseUrl: string;
|
|
@@ -46,7 +47,7 @@ export declare const getGlobalSiteConfigByEnv: (buildEnv: BuildEnv) => {
|
|
|
46
47
|
ui: {
|
|
47
48
|
type: SiteConfigType.Regional;
|
|
48
49
|
defaultRegion: {
|
|
49
|
-
languages?:
|
|
50
|
+
languages?: DeployedLanguages | undefined;
|
|
50
51
|
defaultLanguage?: import("../../types").Language | undefined;
|
|
51
52
|
type: SiteConfigType.Basic;
|
|
52
53
|
baseUrl: string;
|
|
@@ -82,9 +83,10 @@ export declare const getGlobalSiteConfigByEnv: (buildEnv: BuildEnv) => {
|
|
|
82
83
|
* "experts.ui.com" site config
|
|
83
84
|
* NOTE: will be deprecated
|
|
84
85
|
*/
|
|
85
|
-
|
|
86
|
+
uwc: {
|
|
86
87
|
type: SiteConfigType.Basic;
|
|
87
88
|
baseUrl: string;
|
|
89
|
+
languages: DeployedLanguages;
|
|
88
90
|
};
|
|
89
91
|
/**
|
|
90
92
|
* "experts.uisp.com" site config
|
|
@@ -73,21 +73,24 @@ const getDeployedLanguagesBySiteByEnv = buildEnv => {
|
|
|
73
73
|
{
|
|
74
74
|
return {
|
|
75
75
|
store: presets.STORE_DEPLOYED_LANGUAGES_LOCAL,
|
|
76
|
-
ui: presets.UI_COM_DEPLOYED_LANGUAGES_LOCAL
|
|
76
|
+
ui: presets.UI_COM_DEPLOYED_LANGUAGES_LOCAL,
|
|
77
|
+
uwc: presets.UWC_UI_COM_DEPLOYED_LANGUAGES_LOCAL
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
80
|
case "proto":
|
|
80
81
|
{
|
|
81
82
|
return {
|
|
82
83
|
store: presets.STORE_DEPLOYED_LANGUAGES_PROTO,
|
|
83
|
-
ui: presets.UI_COM_DEPLOYED_LANGUAGES_PROTO
|
|
84
|
+
ui: presets.UI_COM_DEPLOYED_LANGUAGES_PROTO,
|
|
85
|
+
uwc: presets.UWC_UI_COM_DEPLOYED_LANGUAGES_PROTO
|
|
84
86
|
};
|
|
85
87
|
}
|
|
86
88
|
case "qa":
|
|
87
89
|
{
|
|
88
90
|
return {
|
|
89
91
|
store: presets.STORE_DEPLOYED_LANGUAGES_QA,
|
|
90
|
-
ui: presets.UI_COM_DEPLOYED_LANGUAGES_QA
|
|
92
|
+
ui: presets.UI_COM_DEPLOYED_LANGUAGES_QA,
|
|
93
|
+
uwc: presets.UWC_UI_COM_DEPLOYED_LANGUAGES_QA
|
|
91
94
|
};
|
|
92
95
|
}
|
|
93
96
|
case void 0:
|
|
@@ -96,7 +99,8 @@ const getDeployedLanguagesBySiteByEnv = buildEnv => {
|
|
|
96
99
|
{
|
|
97
100
|
return {
|
|
98
101
|
store: presets.STORE_DEPLOYED_LANGUAGES_PROD,
|
|
99
|
-
ui: presets.UI_COM_DEPLOYED_LANGUAGES_PROD
|
|
102
|
+
ui: presets.UI_COM_DEPLOYED_LANGUAGES_PROD,
|
|
103
|
+
uwc: presets.UWC_UI_COM_DEPLOYED_LANGUAGES_PROD
|
|
100
104
|
};
|
|
101
105
|
}
|
|
102
106
|
default:
|
|
@@ -104,7 +108,8 @@ const getDeployedLanguagesBySiteByEnv = buildEnv => {
|
|
|
104
108
|
errors.checkUnreachable(buildEnv);
|
|
105
109
|
return {
|
|
106
110
|
store: presets.STORE_DEPLOYED_LANGUAGES_PROD,
|
|
107
|
-
ui: presets.UI_COM_DEPLOYED_LANGUAGES_PROD
|
|
111
|
+
ui: presets.UI_COM_DEPLOYED_LANGUAGES_PROD,
|
|
112
|
+
uwc: presets.UWC_UI_COM_DEPLOYED_LANGUAGES_PROD
|
|
108
113
|
};
|
|
109
114
|
}
|
|
110
115
|
}
|
|
@@ -228,9 +233,10 @@ const getGlobalSiteConfigByEnv = buildEnv => {
|
|
|
228
233
|
* "experts.ui.com" site config
|
|
229
234
|
* NOTE: will be deprecated
|
|
230
235
|
*/
|
|
231
|
-
|
|
236
|
+
uwc: {
|
|
232
237
|
type: types.SiteConfigType.Basic,
|
|
233
|
-
baseUrl: micrositeRootUrls.
|
|
238
|
+
baseUrl: micrositeRootUrls.uwc,
|
|
239
|
+
languages: deployedLanguages.uwc
|
|
234
240
|
},
|
|
235
241
|
/**
|
|
236
242
|
* "experts.uisp.com" site config
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigationPresets.js","sources":["../../../src/utils/nextjs/navigationPresets.ts"],"sourcesContent":["import type { DeployedLanguagesMapping } from \"../../contexts/MenuContext/mapping\";\nimport {\n MICROSITE_ROOT_URLS_LOCAL,\n MICROSITE_ROOT_URLS_PROD,\n MICROSITE_ROOT_URLS_PROTO,\n MICROSITE_ROOT_URLS_QA,\n STORE_DEPLOYED_LANGUAGES_LOCAL,\n STORE_DEPLOYED_LANGUAGES_PROD,\n STORE_DEPLOYED_LANGUAGES_PROTO,\n STORE_DEPLOYED_LANGUAGES_QA,\n STORE_ROOT_URLS_HONEYPOT,\n STORE_ROOT_URLS_LOCAL,\n STORE_ROOT_URLS_PROD,\n STORE_ROOT_URLS_PROTO,\n STORE_ROOT_URLS_QA,\n UI_COM_DEPLOYED_LANGUAGES_LOCAL,\n UI_COM_DEPLOYED_LANGUAGES_PROD,\n UI_COM_DEPLOYED_LANGUAGES_PROTO,\n UI_COM_DEPLOYED_LANGUAGES_QA,\n} from \"../../contexts/MenuContext/presets\";\nimport type {\n BasicSiteConfig,\n RegionalSite,\n StaticGlobalSiteConfig,\n} from \"../../contexts/MenuContext/types\";\nimport { SiteConfigType } from \"../../contexts/MenuContext/types\";\nimport type { StoreId } from \"../../types\";\nimport { GlobalStoreId } from \"../../types\";\nimport { checkUnreachable } from \"../errors\";\nimport { isStoreId } from \"../storeId\";\n\n/**\n * Values that indicate what kind of target build environment it is\n */\nexport type BuildEnv = \"local\" | \"e2e\" | \"proto\" | \"qa\" | \"prod\" | \"honeypot\";\n\n/**\n * Get the root URLs for each store by build environment\n * @param buildEnv The build environment\n * @returns The root URLs for each store\n */\nexport const getStoreRootUrlsByEnv = (buildEnv: BuildEnv) => {\n switch (buildEnv) {\n case \"e2e\":\n case \"local\": {\n return STORE_ROOT_URLS_LOCAL;\n }\n case \"proto\": {\n return STORE_ROOT_URLS_PROTO;\n }\n case \"honeypot\": {\n return STORE_ROOT_URLS_HONEYPOT;\n }\n case \"qa\": {\n return STORE_ROOT_URLS_QA;\n }\n case undefined:\n case \"prod\": {\n return STORE_ROOT_URLS_PROD;\n }\n default: {\n checkUnreachable(buildEnv);\n return STORE_ROOT_URLS_PROD;\n }\n }\n};\n\n/**\n * Get the root URLs for each microsite by build environment\n * @param buildEnv The build environment\n * @returns The root URLs for each microsite\n */\nconst getMicrositeRootUrlsByEnv = (buildEnv: BuildEnv) => {\n switch (buildEnv) {\n case \"e2e\":\n case \"local\": {\n return MICROSITE_ROOT_URLS_LOCAL;\n }\n case \"proto\": {\n return MICROSITE_ROOT_URLS_PROTO;\n }\n case \"qa\": {\n return MICROSITE_ROOT_URLS_QA;\n }\n case undefined:\n case \"honeypot\":\n case \"prod\": {\n return MICROSITE_ROOT_URLS_PROD;\n }\n default: {\n checkUnreachable(buildEnv);\n return MICROSITE_ROOT_URLS_PROD;\n }\n }\n};\n\n/**\n * Get the deployed languages for each site by build environment\n * @param buildEnv The build environment\n * @returns The deployed languages for each site\n */\nconst getDeployedLanguagesBySiteByEnv = (\n buildEnv: BuildEnv,\n): {\n store: DeployedLanguagesMapping;\n ui: DeployedLanguagesMapping;\n} => {\n switch (buildEnv) {\n case \"e2e\":\n case \"local\": {\n return {\n store: STORE_DEPLOYED_LANGUAGES_LOCAL,\n ui: UI_COM_DEPLOYED_LANGUAGES_LOCAL,\n };\n }\n case \"proto\": {\n return {\n store: STORE_DEPLOYED_LANGUAGES_PROTO,\n ui: UI_COM_DEPLOYED_LANGUAGES_PROTO,\n };\n }\n case \"qa\": {\n return {\n store: STORE_DEPLOYED_LANGUAGES_QA,\n ui: UI_COM_DEPLOYED_LANGUAGES_QA,\n };\n }\n case undefined:\n case \"honeypot\":\n case \"prod\": {\n return {\n store: STORE_DEPLOYED_LANGUAGES_PROD,\n ui: UI_COM_DEPLOYED_LANGUAGES_PROD,\n };\n }\n default: {\n checkUnreachable(buildEnv);\n return {\n store: STORE_DEPLOYED_LANGUAGES_PROD,\n ui: UI_COM_DEPLOYED_LANGUAGES_PROD,\n };\n }\n }\n};\n\n// #############################################################################\n// Global site config - ✨ the NEW way to handle global site config\n// #############################################################################\nconst REGION_PRESET: Record<GlobalStoreId, null> = {\n [GlobalStoreId.Us]: null,\n [GlobalStoreId.Ca]: null,\n [GlobalStoreId.Eu]: null,\n [GlobalStoreId.Uk]: null,\n [GlobalStoreId.Jp]: null,\n [GlobalStoreId.Br]: null,\n [GlobalStoreId.In]: null,\n [GlobalStoreId.Me]: null,\n [GlobalStoreId.Za]: null,\n [GlobalStoreId.Tw]: null,\n [GlobalStoreId.Sg]: null,\n [GlobalStoreId.Cn]: null,\n [GlobalStoreId.Mx]: null,\n [GlobalStoreId.Ph]: null,\n};\n\nexport const getGlobalSiteConfigByEnv = (buildEnv: BuildEnv) => {\n const storeRootUrls = getStoreRootUrlsByEnv(buildEnv);\n const micrositeRootUrls = getMicrositeRootUrlsByEnv(buildEnv);\n const deployedLanguages = getDeployedLanguagesBySiteByEnv(buildEnv);\n\n const getLanguageConfig = (\n siteId: \"store\" | \"ui\",\n storeId: GlobalStoreId | StoreId,\n ): Pick<BasicSiteConfig, \"defaultLanguage\" | \"languages\"> => {\n if (!isStoreId(storeId)) {\n return {\n defaultLanguage: undefined,\n languages: undefined,\n };\n }\n\n const languages = deployedLanguages[siteId][storeId];\n\n // If region does not have languages, return undefined\n if (!languages?.length) {\n return {\n defaultLanguage: undefined,\n languages: undefined,\n };\n }\n\n return {\n defaultLanguage: languages[0],\n languages: languages,\n };\n };\n\n return {\n /**\n * \"store.ui.com\" site config\n */\n store: {\n type: SiteConfigType.Regional,\n defaultRegion: {\n type: SiteConfigType.Basic,\n baseUrl: storeRootUrls[GlobalStoreId.Us],\n ...getLanguageConfig(\"store\", GlobalStoreId.Us),\n } satisfies BasicSiteConfig,\n regions: (() =>\n Object.values(GlobalStoreId).reduce<\n Record<GlobalStoreId, BasicSiteConfig | null>\n >(\n (acc, storeId) => {\n acc[storeId] = {\n type: SiteConfigType.Basic,\n baseUrl: storeRootUrls[storeId],\n ...getLanguageConfig(\"store\", storeId),\n };\n return acc;\n },\n { ...REGION_PRESET },\n ))(),\n } satisfies RegionalSite,\n\n /**\n * \"ui.com\" site config\n */\n ui: {\n type: SiteConfigType.Regional,\n defaultRegion: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.ui,\n ...getLanguageConfig(\"ui\", GlobalStoreId.Us),\n } satisfies BasicSiteConfig,\n regions: (() =>\n Object.values(GlobalStoreId).reduce<\n Record<GlobalStoreId, BasicSiteConfig | null>\n >(\n (acc, storeId) => {\n acc[storeId] = {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.ui,\n ...getLanguageConfig(\"ui\", storeId),\n };\n return acc;\n },\n { ...REGION_PRESET },\n ))(),\n } satisfies RegionalSite,\n\n /**\n * \"uisp.ui.com\" site config\n */\n uisp: {\n type: SiteConfigType.Regional,\n defaultRegion: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.uisp,\n } satisfies BasicSiteConfig,\n regions: (() =>\n Object.values(GlobalStoreId).reduce<\n Record<GlobalStoreId, BasicSiteConfig | null>\n >(\n (acc, storeId) => {\n acc[storeId] = {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.uisp,\n };\n return acc;\n },\n { ...REGION_PRESET },\n ))(),\n } satisfies RegionalSite,\n\n /**\n * \"amplifi.com\" site config\n */\n amplifi: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.amplifi,\n } satisfies BasicSiteConfig,\n\n /**\n * \"techspecs.ui.com\" site config\n */\n techSpecs: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.techSpecs,\n } satisfies BasicSiteConfig,\n\n /**\n * \"experts.ui.com\" site config\n * NOTE: will be deprecated\n */\n experts: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.experts,\n } satisfies BasicSiteConfig,\n\n /**\n * \"experts.uisp.com\" site config\n */\n expertsUisp: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.expertsUisp,\n } satisfies BasicSiteConfig,\n\n /**\n * \"experts.ui.com\" site config\n */\n expertsUi: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.expertsUi,\n } satisfies BasicSiteConfig,\n } satisfies StaticGlobalSiteConfig;\n};\n"],"names":["getStoreRootUrlsByEnv","buildEnv","STORE_ROOT_URLS_LOCAL","STORE_ROOT_URLS_PROTO","STORE_ROOT_URLS_HONEYPOT","STORE_ROOT_URLS_QA","STORE_ROOT_URLS_PROD","checkUnreachable","getMicrositeRootUrlsByEnv","MICROSITE_ROOT_URLS_LOCAL","MICROSITE_ROOT_URLS_PROTO","MICROSITE_ROOT_URLS_QA","MICROSITE_ROOT_URLS_PROD","getDeployedLanguagesBySiteByEnv","store","STORE_DEPLOYED_LANGUAGES_LOCAL","ui","UI_COM_DEPLOYED_LANGUAGES_LOCAL","STORE_DEPLOYED_LANGUAGES_PROTO","UI_COM_DEPLOYED_LANGUAGES_PROTO","STORE_DEPLOYED_LANGUAGES_QA","UI_COM_DEPLOYED_LANGUAGES_QA","STORE_DEPLOYED_LANGUAGES_PROD","UI_COM_DEPLOYED_LANGUAGES_PROD","REGION_PRESET","GlobalStoreId","Us","Ca","Eu","Uk","Jp","Br","In","Me","Za","Tw","Sg","Cn","Mx","Ph","getGlobalSiteConfigByEnv","storeRootUrls","micrositeRootUrls","deployedLanguages","getLanguageConfig","siteId","storeId","isStoreId","defaultLanguage","languages","length","type","SiteConfigType","Regional","defaultRegion","Basic","baseUrl","regions","Object","values","reduce","acc","uisp","amplifi","techSpecs","experts","expertsUisp","expertsUi"],"mappings":";;;;;;;;;AAyCa,MAAAA,qBAAA,GAAyBC,QAAuB,IAAA;EAC3D,QAAQA,QAAU;IAChB,KAAK,KAAA;IACL,KAAK,OAAS;MAAA;QACL,OAAAC,6BAAA;MACT;IACA,KAAK,OAAS;MAAA;QACL,OAAAC,6BAAA;MACT;IACA,KAAK,UAAY;MAAA;QACR,OAAAC,gCAAA;MACT;IACA,KAAK,IAAM;MAAA;QACF,OAAAC,0BAAA;MACT;IACA,KAAK,KAAA,CAAA;IACL,KAAK,MAAQ;MAAA;QACJ,OAAAC,4BAAA;MACT;IACA;MAAS;QACPC,MAAA,CAAAA,gBAAA,CAAiBN,QAAQ,CAAA;QAClB,OAAAK,4BAAA;MACT;EACF;AACF,CAAA;AAOA,MAAME,yBAAA,GAA6BP,QAAuB,IAAA;EACxD,QAAQA,QAAU;IAChB,KAAK,KAAA;IACL,KAAK,OAAS;MAAA;QACL,OAAAQ,iCAAA;MACT;IACA,KAAK,OAAS;MAAA;QACL,OAAAC,iCAAA;MACT;IACA,KAAK,IAAM;MAAA;QACF,OAAAC,8BAAA;MACT;IACA,KAAK,KAAA,CAAA;IACL,KAAK,UAAA;IACL,KAAK,MAAQ;MAAA;QACJ,OAAAC,gCAAA;MACT;IACA;MAAS;QACPL,MAAA,CAAAA,gBAAA,CAAiBN,QAAQ,CAAA;QAClB,OAAAW,gCAAA;MACT;EACF;AACF,CAAA;AAOA,MAAMC,+BAAA,GACJZ,QAIG,IAAA;EACH,QAAQA,QAAU;IAChB,KAAK,KAAA;IACL,KAAK,OAAS;MAAA;QACL,OAAA;UACLa,KAAO,EAAAC,OAAA,CAAAA,8BAAA;UACPC,EAAI,EAAAC,OAAA,CAAAA;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AAkB,CAAAoB;MAC7B,CAAA;MACAL,OAAU,EAAA,CAAA,MACRC,MAAO,CAAAC,MAAA,CAAOlC,SAAAA,CAAAA,aAAa,CAAE,CAAAmC,MAAA,CAG3B,CAACC,KAAKf,OAAY,KAAA;QAChBe,GAAA,CAAIf,OAAO,CAAI,GAAA;UACbK,MAAMC,KAAe,CAAAA,cAAA,CAAAG,KAAA;UACrBC,SAASd,iBAAkB,CAAAoB;QAAA,CAC7B;QACO,OAAAD,GAAA;MACT,CAAA,EACA;QAAE,GAAGrC;MAAc,CAAA,CAClB,EAAA;IACP,CAAA;IAAA;AAAA;AAAA;IAKAuC,OAAS,EAAA;MACPZ,MAAMC,KAAe,CAAAA,cAAA,CAAAG,KAAA;MACrBC,SAASd,iBAAkB,CAAAqB;IAC7B,CAAA;IAAA;AAAA;AAAA;IAKAC,SAAW,EAAA;MACTb,MAAMC,KAAe,CAAAA,cAAA,CAAAG,KAAA;MACrBC,SAASd,iBAAkB,CAAAsB;IAC7B,CAAA;IAAA;AAAA;AAAA;AAAA;IAMAC,OAAS,EAAA;MACPd,MAAMC,KAAe,CAAAA,cAAA,CAAAG,KAAA;MACrBC,SAASd,iBAAkB,CAAAuB;IAC7B,CAAA;IAAA;AAAA;AAAA;IAKAC,WAAa,EAAA;MACXf,MAAMC,KAAe,CAAAA,cAAA,CAAAG,KAAA;MACrBC,SAASd,iBAAkB,CAAAwB;IAC7B,CAAA;IAAA;AAAA;AAAA;IAKAC,SAAW,EAAA;MACThB,MAAMC,KAAe,CAAAA,cAAA,CAAAG,KAAA;MACrBC,SAASd,iBAAkB,CAAAyB;IAC7B;EAAA,CACF;AACF,CAAA;;"}
|
|
1
|
+
{"version":3,"file":"navigationPresets.js","sources":["../../../src/utils/nextjs/navigationPresets.ts"],"sourcesContent":["import type {\n DeployedLanguages,\n DeployedLanguagesMapping,\n} from \"../../contexts/MenuContext/mapping\";\nimport {\n MICROSITE_ROOT_URLS_LOCAL,\n MICROSITE_ROOT_URLS_PROD,\n MICROSITE_ROOT_URLS_PROTO,\n MICROSITE_ROOT_URLS_QA,\n STORE_DEPLOYED_LANGUAGES_LOCAL,\n STORE_DEPLOYED_LANGUAGES_PROD,\n STORE_DEPLOYED_LANGUAGES_PROTO,\n STORE_DEPLOYED_LANGUAGES_QA,\n STORE_ROOT_URLS_HONEYPOT,\n STORE_ROOT_URLS_LOCAL,\n STORE_ROOT_URLS_PROD,\n STORE_ROOT_URLS_PROTO,\n STORE_ROOT_URLS_QA,\n UI_COM_DEPLOYED_LANGUAGES_LOCAL,\n UI_COM_DEPLOYED_LANGUAGES_PROD,\n UI_COM_DEPLOYED_LANGUAGES_PROTO,\n UI_COM_DEPLOYED_LANGUAGES_QA,\n UWC_UI_COM_DEPLOYED_LANGUAGES_LOCAL,\n UWC_UI_COM_DEPLOYED_LANGUAGES_PROD,\n UWC_UI_COM_DEPLOYED_LANGUAGES_PROTO,\n UWC_UI_COM_DEPLOYED_LANGUAGES_QA,\n} from \"../../contexts/MenuContext/presets\";\nimport type {\n BasicSiteConfig,\n RegionalSite,\n StaticGlobalSiteConfig,\n} from \"../../contexts/MenuContext/types\";\nimport { SiteConfigType } from \"../../contexts/MenuContext/types\";\nimport type { StoreId } from \"../../types\";\nimport { GlobalStoreId } from \"../../types\";\nimport { checkUnreachable } from \"../errors\";\nimport { isStoreId } from \"../storeId\";\n\n/**\n * Values that indicate what kind of target build environment it is\n */\nexport type BuildEnv = \"local\" | \"e2e\" | \"proto\" | \"qa\" | \"prod\" | \"honeypot\";\n\n/**\n * Get the root URLs for each store by build environment\n * @param buildEnv The build environment\n * @returns The root URLs for each store\n */\nexport const getStoreRootUrlsByEnv = (buildEnv: BuildEnv) => {\n switch (buildEnv) {\n case \"e2e\":\n case \"local\": {\n return STORE_ROOT_URLS_LOCAL;\n }\n case \"proto\": {\n return STORE_ROOT_URLS_PROTO;\n }\n case \"honeypot\": {\n return STORE_ROOT_URLS_HONEYPOT;\n }\n case \"qa\": {\n return STORE_ROOT_URLS_QA;\n }\n case undefined:\n case \"prod\": {\n return STORE_ROOT_URLS_PROD;\n }\n default: {\n checkUnreachable(buildEnv);\n return STORE_ROOT_URLS_PROD;\n }\n }\n};\n\n/**\n * Get the root URLs for each microsite by build environment\n * @param buildEnv The build environment\n * @returns The root URLs for each microsite\n */\nconst getMicrositeRootUrlsByEnv = (buildEnv: BuildEnv) => {\n switch (buildEnv) {\n case \"e2e\":\n case \"local\": {\n return MICROSITE_ROOT_URLS_LOCAL;\n }\n case \"proto\": {\n return MICROSITE_ROOT_URLS_PROTO;\n }\n case \"qa\": {\n return MICROSITE_ROOT_URLS_QA;\n }\n case undefined:\n case \"honeypot\":\n case \"prod\": {\n return MICROSITE_ROOT_URLS_PROD;\n }\n default: {\n checkUnreachable(buildEnv);\n return MICROSITE_ROOT_URLS_PROD;\n }\n }\n};\n\n/**\n * Get the deployed languages for each site by build environment\n * @param buildEnv The build environment\n * @returns The deployed languages for each site\n */\nconst getDeployedLanguagesBySiteByEnv = (\n buildEnv: BuildEnv,\n): {\n store: DeployedLanguagesMapping;\n ui: DeployedLanguagesMapping;\n uwc: DeployedLanguages;\n} => {\n switch (buildEnv) {\n case \"e2e\":\n case \"local\": {\n return {\n store: STORE_DEPLOYED_LANGUAGES_LOCAL,\n ui: UI_COM_DEPLOYED_LANGUAGES_LOCAL,\n uwc: UWC_UI_COM_DEPLOYED_LANGUAGES_LOCAL,\n };\n }\n case \"proto\": {\n return {\n store: STORE_DEPLOYED_LANGUAGES_PROTO,\n ui: UI_COM_DEPLOYED_LANGUAGES_PROTO,\n uwc: UWC_UI_COM_DEPLOYED_LANGUAGES_PROTO,\n };\n }\n case \"qa\": {\n return {\n store: STORE_DEPLOYED_LANGUAGES_QA,\n ui: UI_COM_DEPLOYED_LANGUAGES_QA,\n uwc: UWC_UI_COM_DEPLOYED_LANGUAGES_QA,\n };\n }\n case undefined:\n case \"honeypot\":\n case \"prod\": {\n return {\n store: STORE_DEPLOYED_LANGUAGES_PROD,\n ui: UI_COM_DEPLOYED_LANGUAGES_PROD,\n uwc: UWC_UI_COM_DEPLOYED_LANGUAGES_PROD,\n };\n }\n default: {\n checkUnreachable(buildEnv);\n return {\n store: STORE_DEPLOYED_LANGUAGES_PROD,\n ui: UI_COM_DEPLOYED_LANGUAGES_PROD,\n uwc: UWC_UI_COM_DEPLOYED_LANGUAGES_PROD,\n };\n }\n }\n};\n\n// #############################################################################\n// Global site config - ✨ the NEW way to handle global site config\n// #############################################################################\nconst REGION_PRESET: Record<GlobalStoreId, null> = {\n [GlobalStoreId.Us]: null,\n [GlobalStoreId.Ca]: null,\n [GlobalStoreId.Eu]: null,\n [GlobalStoreId.Uk]: null,\n [GlobalStoreId.Jp]: null,\n [GlobalStoreId.Br]: null,\n [GlobalStoreId.In]: null,\n [GlobalStoreId.Me]: null,\n [GlobalStoreId.Za]: null,\n [GlobalStoreId.Tw]: null,\n [GlobalStoreId.Sg]: null,\n [GlobalStoreId.Cn]: null,\n [GlobalStoreId.Mx]: null,\n [GlobalStoreId.Ph]: null,\n};\n\nexport const getGlobalSiteConfigByEnv = (buildEnv: BuildEnv) => {\n const storeRootUrls = getStoreRootUrlsByEnv(buildEnv);\n const micrositeRootUrls = getMicrositeRootUrlsByEnv(buildEnv);\n const deployedLanguages = getDeployedLanguagesBySiteByEnv(buildEnv);\n\n const getLanguageConfig = (\n siteId: \"store\" | \"ui\",\n storeId: GlobalStoreId | StoreId,\n ): Pick<BasicSiteConfig, \"defaultLanguage\" | \"languages\"> => {\n if (!isStoreId(storeId)) {\n return {\n defaultLanguage: undefined,\n languages: undefined,\n };\n }\n\n const languages = deployedLanguages[siteId][storeId];\n\n // If region does not have languages, return undefined\n if (!languages?.length) {\n return {\n defaultLanguage: undefined,\n languages: undefined,\n };\n }\n\n return {\n defaultLanguage: languages[0],\n languages: languages,\n };\n };\n\n return {\n /**\n * \"store.ui.com\" site config\n */\n store: {\n type: SiteConfigType.Regional,\n defaultRegion: {\n type: SiteConfigType.Basic,\n baseUrl: storeRootUrls[GlobalStoreId.Us],\n ...getLanguageConfig(\"store\", GlobalStoreId.Us),\n } satisfies BasicSiteConfig,\n regions: (() =>\n Object.values(GlobalStoreId).reduce<\n Record<GlobalStoreId, BasicSiteConfig | null>\n >(\n (acc, storeId) => {\n acc[storeId] = {\n type: SiteConfigType.Basic,\n baseUrl: storeRootUrls[storeId],\n ...getLanguageConfig(\"store\", storeId),\n };\n return acc;\n },\n { ...REGION_PRESET },\n ))(),\n } satisfies RegionalSite,\n\n /**\n * \"ui.com\" site config\n */\n ui: {\n type: SiteConfigType.Regional,\n defaultRegion: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.ui,\n ...getLanguageConfig(\"ui\", GlobalStoreId.Us),\n } satisfies BasicSiteConfig,\n regions: (() =>\n Object.values(GlobalStoreId).reduce<\n Record<GlobalStoreId, BasicSiteConfig | null>\n >(\n (acc, storeId) => {\n acc[storeId] = {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.ui,\n ...getLanguageConfig(\"ui\", storeId),\n };\n return acc;\n },\n { ...REGION_PRESET },\n ))(),\n } satisfies RegionalSite,\n\n /**\n * \"uisp.ui.com\" site config\n */\n uisp: {\n type: SiteConfigType.Regional,\n defaultRegion: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.uisp,\n } satisfies BasicSiteConfig,\n regions: (() =>\n Object.values(GlobalStoreId).reduce<\n Record<GlobalStoreId, BasicSiteConfig | null>\n >(\n (acc, storeId) => {\n acc[storeId] = {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.uisp,\n };\n return acc;\n },\n { ...REGION_PRESET },\n ))(),\n } satisfies RegionalSite,\n\n /**\n * \"amplifi.com\" site config\n */\n amplifi: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.amplifi,\n } satisfies BasicSiteConfig,\n\n /**\n * \"techspecs.ui.com\" site config\n */\n techSpecs: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.techSpecs,\n } satisfies BasicSiteConfig,\n\n /**\n * \"experts.ui.com\" site config\n * NOTE: will be deprecated\n */\n uwc: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.uwc,\n languages: deployedLanguages.uwc,\n } satisfies BasicSiteConfig,\n\n /**\n * \"experts.uisp.com\" site config\n */\n expertsUisp: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.expertsUisp,\n } satisfies BasicSiteConfig,\n\n /**\n * \"experts.ui.com\" site config\n */\n expertsUi: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.expertsUi,\n } satisfies BasicSiteConfig,\n } satisfies StaticGlobalSiteConfig;\n};\n"],"names":["getStoreRootUrlsByEnv","buildEnv","STORE_ROOT_URLS_LOCAL","STORE_ROOT_URLS_PROTO","STORE_ROOT_URLS_HONEYPOT","STORE_ROOT_URLS_QA","STORE_ROOT_URLS_PROD","checkUnreachable","getMicrositeRootUrlsByEnv","MICROSITE_ROOT_URLS_LOCAL","MICROSITE_ROOT_URLS_PROTO","MICROSITE_ROOT_URLS_QA","MICROSITE_ROOT_URLS_PROD","getDeployedLanguagesBySiteByEnv","store","STORE_DEPLOYED_LANGUAGES_LOCAL","ui","UI_COM_DEPLOYED_LANGUAGES_LOCAL","uwc","UWC_UI_COM_DEPLOYED_LANGUAGES_LOCAL","STORE_DEPLOYED_LANGUAGES_PROTO","UI_COM_DEPLOYED_LANGUAGES_PROTO","UWC_UI_COM_DEPLOYED_LANGUAGES_PROTO","STORE_DEPLOYED_LANGUAGES_QA","UI_COM_DEPLOYED_LANGUAGES_QA","UWC_UI_COM_DEPLOYED_LANGUAGES_QA","STORE_DEPLOYED_LANGUAGES_PROD","UI_COM_DEPLOYED_LANGUAGES_PROD","UWC_UI_COM_DEPLOYED_LANGUAGES_PROD","REGION_PRESET","GlobalStoreId","Us","Ca","Eu","Uk","Jp","Br","In","Me","Za","Tw","Sg","Cn","Mx","Ph","getGlobalSiteConfigByEnv","storeRootUrls","micrositeRootUrls","deployedLanguages","getLanguageConfig","siteId","storeId","isStoreId","defaultLanguage","languages","length","type","SiteConfigType","Regional","defaultRegion","Basic","baseUrl","regions","Object","values","reduce","acc","uisp","amplifi","techSpecs","expertsUisp","expertsUi"],"mappings":";;;;;;;;;AAgDa,MAAAA,qBAAA,GAAyBC,QAAuB,IAAA;EAC3D,QAAQA,QAAU;IAChB,KAAK,KAAA;IACL,KAAK,OAAS;MAAA;QACL,OAAAC,6BAAA;MACT;IACA,KAAK,OAAS;MAAA;QACL,OAAAC,6BAAA;MACT;IACA,KAAK,UAAY;MAAA;QACR,OAAAC,gCAAA;MACT;IACA,KAAK,IAAM;MAAA;QACF,OAAAC,0BAAA;MACT;IACA,KAAK,KAAA,CAAA;IACL,KAAK,MAAQ;MAAA;QACJ,OAAAC,4BAAA;MACT;IACA;MAAS;QACPC,MAAA,CAAAA,gBAAA,CAAiBN,QAAQ,CAAA;QAClB,OAAAK,4BAAA;MACT;EACF;AACF,CAAA;AAOA,MAAME,yBAAA,GAA6BP,QAAuB,IAAA;EACxD,QAAQA,QAAU;IAChB,KAAK,KAAA;IACL,KAAK,OAAS;MAAA;QACL,OAAAQ,iCAAA;MACT;IACA,KAAK,OAAS;MAAA;QACL,OAAAC,iCAAA;MACT;IACA,KAAK,IAAM;MAAA;QACF,OAAAC,8BAAA;MACT;IACA,KAAK,KAAA,CAAA;IACL,KAAK,UAAA;IACL,KAAK,MAAQ;MAAA;QACJ,OAAAC,gCAAA;MACT;IACA;MAAS;QACPL,MAAA,CAAAA,gBAAA,CAAiBN,QAAQ,CAAA;QAClB,OAAAW,gCAAA;MACT;EACF;AACF,CAAA;AAOA,MAAMC,+BAAA,GACJZ,QAKG,IAAA;EACH,QAAQA,QAAU;IAChB,KAAK,KAAA;IACL,KAAK,OAAS;MAAA;QACL,OAAA;UACLa,KAAO,EAAAC,OAAA,CAAAA,8BAAA;UACPC,EAAI,EAAAC,OAAA,CAAAA,+BAAA;UACJC,GAAK,EAAAC,OAAA,CAAAA;QA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
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { STORE_ROOT_URLS_PROD, STORE_ROOT_URLS_QA, STORE_ROOT_URLS_HONEYPOT, STORE_ROOT_URLS_PROTO, STORE_ROOT_URLS_LOCAL, MICROSITE_ROOT_URLS_PROD, MICROSITE_ROOT_URLS_QA, MICROSITE_ROOT_URLS_PROTO, MICROSITE_ROOT_URLS_LOCAL, STORE_DEPLOYED_LANGUAGES_PROD, UI_COM_DEPLOYED_LANGUAGES_PROD, STORE_DEPLOYED_LANGUAGES_QA, UI_COM_DEPLOYED_LANGUAGES_QA, STORE_DEPLOYED_LANGUAGES_PROTO, UI_COM_DEPLOYED_LANGUAGES_PROTO, STORE_DEPLOYED_LANGUAGES_LOCAL, UI_COM_DEPLOYED_LANGUAGES_LOCAL } from '../../contexts/MenuContext/presets.mjs';
|
|
1
|
+
import { STORE_ROOT_URLS_PROD, STORE_ROOT_URLS_QA, STORE_ROOT_URLS_HONEYPOT, STORE_ROOT_URLS_PROTO, STORE_ROOT_URLS_LOCAL, MICROSITE_ROOT_URLS_PROD, MICROSITE_ROOT_URLS_QA, MICROSITE_ROOT_URLS_PROTO, MICROSITE_ROOT_URLS_LOCAL, STORE_DEPLOYED_LANGUAGES_PROD, UI_COM_DEPLOYED_LANGUAGES_PROD, UWC_UI_COM_DEPLOYED_LANGUAGES_PROD, STORE_DEPLOYED_LANGUAGES_QA, UI_COM_DEPLOYED_LANGUAGES_QA, UWC_UI_COM_DEPLOYED_LANGUAGES_QA, STORE_DEPLOYED_LANGUAGES_PROTO, UI_COM_DEPLOYED_LANGUAGES_PROTO, UWC_UI_COM_DEPLOYED_LANGUAGES_PROTO, STORE_DEPLOYED_LANGUAGES_LOCAL, UI_COM_DEPLOYED_LANGUAGES_LOCAL, UWC_UI_COM_DEPLOYED_LANGUAGES_LOCAL } from '../../contexts/MenuContext/presets.mjs';
|
|
2
2
|
import { SiteConfigType } from '../../contexts/MenuContext/types.mjs';
|
|
3
3
|
import '../../types/index.mjs';
|
|
4
4
|
import { checkUnreachable } from '../errors.mjs';
|
|
@@ -71,21 +71,24 @@ const getDeployedLanguagesBySiteByEnv = buildEnv => {
|
|
|
71
71
|
{
|
|
72
72
|
return {
|
|
73
73
|
store: STORE_DEPLOYED_LANGUAGES_LOCAL,
|
|
74
|
-
ui: UI_COM_DEPLOYED_LANGUAGES_LOCAL
|
|
74
|
+
ui: UI_COM_DEPLOYED_LANGUAGES_LOCAL,
|
|
75
|
+
uwc: UWC_UI_COM_DEPLOYED_LANGUAGES_LOCAL
|
|
75
76
|
};
|
|
76
77
|
}
|
|
77
78
|
case "proto":
|
|
78
79
|
{
|
|
79
80
|
return {
|
|
80
81
|
store: STORE_DEPLOYED_LANGUAGES_PROTO,
|
|
81
|
-
ui: UI_COM_DEPLOYED_LANGUAGES_PROTO
|
|
82
|
+
ui: UI_COM_DEPLOYED_LANGUAGES_PROTO,
|
|
83
|
+
uwc: UWC_UI_COM_DEPLOYED_LANGUAGES_PROTO
|
|
82
84
|
};
|
|
83
85
|
}
|
|
84
86
|
case "qa":
|
|
85
87
|
{
|
|
86
88
|
return {
|
|
87
89
|
store: STORE_DEPLOYED_LANGUAGES_QA,
|
|
88
|
-
ui: UI_COM_DEPLOYED_LANGUAGES_QA
|
|
90
|
+
ui: UI_COM_DEPLOYED_LANGUAGES_QA,
|
|
91
|
+
uwc: UWC_UI_COM_DEPLOYED_LANGUAGES_QA
|
|
89
92
|
};
|
|
90
93
|
}
|
|
91
94
|
case void 0:
|
|
@@ -94,7 +97,8 @@ const getDeployedLanguagesBySiteByEnv = buildEnv => {
|
|
|
94
97
|
{
|
|
95
98
|
return {
|
|
96
99
|
store: STORE_DEPLOYED_LANGUAGES_PROD,
|
|
97
|
-
ui: UI_COM_DEPLOYED_LANGUAGES_PROD
|
|
100
|
+
ui: UI_COM_DEPLOYED_LANGUAGES_PROD,
|
|
101
|
+
uwc: UWC_UI_COM_DEPLOYED_LANGUAGES_PROD
|
|
98
102
|
};
|
|
99
103
|
}
|
|
100
104
|
default:
|
|
@@ -102,7 +106,8 @@ const getDeployedLanguagesBySiteByEnv = buildEnv => {
|
|
|
102
106
|
checkUnreachable(buildEnv);
|
|
103
107
|
return {
|
|
104
108
|
store: STORE_DEPLOYED_LANGUAGES_PROD,
|
|
105
|
-
ui: UI_COM_DEPLOYED_LANGUAGES_PROD
|
|
109
|
+
ui: UI_COM_DEPLOYED_LANGUAGES_PROD,
|
|
110
|
+
uwc: UWC_UI_COM_DEPLOYED_LANGUAGES_PROD
|
|
106
111
|
};
|
|
107
112
|
}
|
|
108
113
|
}
|
|
@@ -226,9 +231,10 @@ const getGlobalSiteConfigByEnv = buildEnv => {
|
|
|
226
231
|
* "experts.ui.com" site config
|
|
227
232
|
* NOTE: will be deprecated
|
|
228
233
|
*/
|
|
229
|
-
|
|
234
|
+
uwc: {
|
|
230
235
|
type: SiteConfigType.Basic,
|
|
231
|
-
baseUrl: micrositeRootUrls.
|
|
236
|
+
baseUrl: micrositeRootUrls.uwc,
|
|
237
|
+
languages: deployedLanguages.uwc
|
|
232
238
|
},
|
|
233
239
|
/**
|
|
234
240
|
* "experts.uisp.com" site config
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigationPresets.mjs","sources":["../../../src/utils/nextjs/navigationPresets.ts"],"sourcesContent":["import type { DeployedLanguagesMapping } from \"../../contexts/MenuContext/mapping\";\nimport {\n MICROSITE_ROOT_URLS_LOCAL,\n MICROSITE_ROOT_URLS_PROD,\n MICROSITE_ROOT_URLS_PROTO,\n MICROSITE_ROOT_URLS_QA,\n STORE_DEPLOYED_LANGUAGES_LOCAL,\n STORE_DEPLOYED_LANGUAGES_PROD,\n STORE_DEPLOYED_LANGUAGES_PROTO,\n STORE_DEPLOYED_LANGUAGES_QA,\n STORE_ROOT_URLS_HONEYPOT,\n STORE_ROOT_URLS_LOCAL,\n STORE_ROOT_URLS_PROD,\n STORE_ROOT_URLS_PROTO,\n STORE_ROOT_URLS_QA,\n UI_COM_DEPLOYED_LANGUAGES_LOCAL,\n UI_COM_DEPLOYED_LANGUAGES_PROD,\n UI_COM_DEPLOYED_LANGUAGES_PROTO,\n UI_COM_DEPLOYED_LANGUAGES_QA,\n} from \"../../contexts/MenuContext/presets\";\nimport type {\n BasicSiteConfig,\n RegionalSite,\n StaticGlobalSiteConfig,\n} from \"../../contexts/MenuContext/types\";\nimport { SiteConfigType } from \"../../contexts/MenuContext/types\";\nimport type { StoreId } from \"../../types\";\nimport { GlobalStoreId } from \"../../types\";\nimport { checkUnreachable } from \"../errors\";\nimport { isStoreId } from \"../storeId\";\n\n/**\n * Values that indicate what kind of target build environment it is\n */\nexport type BuildEnv = \"local\" | \"e2e\" | \"proto\" | \"qa\" | \"prod\" | \"honeypot\";\n\n/**\n * Get the root URLs for each store by build environment\n * @param buildEnv The build environment\n * @returns The root URLs for each store\n */\nexport const getStoreRootUrlsByEnv = (buildEnv: BuildEnv) => {\n switch (buildEnv) {\n case \"e2e\":\n case \"local\": {\n return STORE_ROOT_URLS_LOCAL;\n }\n case \"proto\": {\n return STORE_ROOT_URLS_PROTO;\n }\n case \"honeypot\": {\n return STORE_ROOT_URLS_HONEYPOT;\n }\n case \"qa\": {\n return STORE_ROOT_URLS_QA;\n }\n case undefined:\n case \"prod\": {\n return STORE_ROOT_URLS_PROD;\n }\n default: {\n checkUnreachable(buildEnv);\n return STORE_ROOT_URLS_PROD;\n }\n }\n};\n\n/**\n * Get the root URLs for each microsite by build environment\n * @param buildEnv The build environment\n * @returns The root URLs for each microsite\n */\nconst getMicrositeRootUrlsByEnv = (buildEnv: BuildEnv) => {\n switch (buildEnv) {\n case \"e2e\":\n case \"local\": {\n return MICROSITE_ROOT_URLS_LOCAL;\n }\n case \"proto\": {\n return MICROSITE_ROOT_URLS_PROTO;\n }\n case \"qa\": {\n return MICROSITE_ROOT_URLS_QA;\n }\n case undefined:\n case \"honeypot\":\n case \"prod\": {\n return MICROSITE_ROOT_URLS_PROD;\n }\n default: {\n checkUnreachable(buildEnv);\n return MICROSITE_ROOT_URLS_PROD;\n }\n }\n};\n\n/**\n * Get the deployed languages for each site by build environment\n * @param buildEnv The build environment\n * @returns The deployed languages for each site\n */\nconst getDeployedLanguagesBySiteByEnv = (\n buildEnv: BuildEnv,\n): {\n store: DeployedLanguagesMapping;\n ui: DeployedLanguagesMapping;\n} => {\n switch (buildEnv) {\n case \"e2e\":\n case \"local\": {\n return {\n store: STORE_DEPLOYED_LANGUAGES_LOCAL,\n ui: UI_COM_DEPLOYED_LANGUAGES_LOCAL,\n };\n }\n case \"proto\": {\n return {\n store: STORE_DEPLOYED_LANGUAGES_PROTO,\n ui: UI_COM_DEPLOYED_LANGUAGES_PROTO,\n };\n }\n case \"qa\": {\n return {\n store: STORE_DEPLOYED_LANGUAGES_QA,\n ui: UI_COM_DEPLOYED_LANGUAGES_QA,\n };\n }\n case undefined:\n case \"honeypot\":\n case \"prod\": {\n return {\n store: STORE_DEPLOYED_LANGUAGES_PROD,\n ui: UI_COM_DEPLOYED_LANGUAGES_PROD,\n };\n }\n default: {\n checkUnreachable(buildEnv);\n return {\n store: STORE_DEPLOYED_LANGUAGES_PROD,\n ui: UI_COM_DEPLOYED_LANGUAGES_PROD,\n };\n }\n }\n};\n\n// #############################################################################\n// Global site config - ✨ the NEW way to handle global site config\n// #############################################################################\nconst REGION_PRESET: Record<GlobalStoreId, null> = {\n [GlobalStoreId.Us]: null,\n [GlobalStoreId.Ca]: null,\n [GlobalStoreId.Eu]: null,\n [GlobalStoreId.Uk]: null,\n [GlobalStoreId.Jp]: null,\n [GlobalStoreId.Br]: null,\n [GlobalStoreId.In]: null,\n [GlobalStoreId.Me]: null,\n [GlobalStoreId.Za]: null,\n [GlobalStoreId.Tw]: null,\n [GlobalStoreId.Sg]: null,\n [GlobalStoreId.Cn]: null,\n [GlobalStoreId.Mx]: null,\n [GlobalStoreId.Ph]: null,\n};\n\nexport const getGlobalSiteConfigByEnv = (buildEnv: BuildEnv) => {\n const storeRootUrls = getStoreRootUrlsByEnv(buildEnv);\n const micrositeRootUrls = getMicrositeRootUrlsByEnv(buildEnv);\n const deployedLanguages = getDeployedLanguagesBySiteByEnv(buildEnv);\n\n const getLanguageConfig = (\n siteId: \"store\" | \"ui\",\n storeId: GlobalStoreId | StoreId,\n ): Pick<BasicSiteConfig, \"defaultLanguage\" | \"languages\"> => {\n if (!isStoreId(storeId)) {\n return {\n defaultLanguage: undefined,\n languages: undefined,\n };\n }\n\n const languages = deployedLanguages[siteId][storeId];\n\n // If region does not have languages, return undefined\n if (!languages?.length) {\n return {\n defaultLanguage: undefined,\n languages: undefined,\n };\n }\n\n return {\n defaultLanguage: languages[0],\n languages: languages,\n };\n };\n\n return {\n /**\n * \"store.ui.com\" site config\n */\n store: {\n type: SiteConfigType.Regional,\n defaultRegion: {\n type: SiteConfigType.Basic,\n baseUrl: storeRootUrls[GlobalStoreId.Us],\n ...getLanguageConfig(\"store\", GlobalStoreId.Us),\n } satisfies BasicSiteConfig,\n regions: (() =>\n Object.values(GlobalStoreId).reduce<\n Record<GlobalStoreId, BasicSiteConfig | null>\n >(\n (acc, storeId) => {\n acc[storeId] = {\n type: SiteConfigType.Basic,\n baseUrl: storeRootUrls[storeId],\n ...getLanguageConfig(\"store\", storeId),\n };\n return acc;\n },\n { ...REGION_PRESET },\n ))(),\n } satisfies RegionalSite,\n\n /**\n * \"ui.com\" site config\n */\n ui: {\n type: SiteConfigType.Regional,\n defaultRegion: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.ui,\n ...getLanguageConfig(\"ui\", GlobalStoreId.Us),\n } satisfies BasicSiteConfig,\n regions: (() =>\n Object.values(GlobalStoreId).reduce<\n Record<GlobalStoreId, BasicSiteConfig | null>\n >(\n (acc, storeId) => {\n acc[storeId] = {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.ui,\n ...getLanguageConfig(\"ui\", storeId),\n };\n return acc;\n },\n { ...REGION_PRESET },\n ))(),\n } satisfies RegionalSite,\n\n /**\n * \"uisp.ui.com\" site config\n */\n uisp: {\n type: SiteConfigType.Regional,\n defaultRegion: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.uisp,\n } satisfies BasicSiteConfig,\n regions: (() =>\n Object.values(GlobalStoreId).reduce<\n Record<GlobalStoreId, BasicSiteConfig | null>\n >(\n (acc, storeId) => {\n acc[storeId] = {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.uisp,\n };\n return acc;\n },\n { ...REGION_PRESET },\n ))(),\n } satisfies RegionalSite,\n\n /**\n * \"amplifi.com\" site config\n */\n amplifi: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.amplifi,\n } satisfies BasicSiteConfig,\n\n /**\n * \"techspecs.ui.com\" site config\n */\n techSpecs: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.techSpecs,\n } satisfies BasicSiteConfig,\n\n /**\n * \"experts.ui.com\" site config\n * NOTE: will be deprecated\n */\n experts: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.experts,\n } satisfies BasicSiteConfig,\n\n /**\n * \"experts.uisp.com\" site config\n */\n expertsUisp: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.expertsUisp,\n } satisfies BasicSiteConfig,\n\n /**\n * \"experts.ui.com\" site config\n */\n expertsUi: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.expertsUi,\n } satisfies BasicSiteConfig,\n } satisfies StaticGlobalSiteConfig;\n};\n"],"names":["getStoreRootUrlsByEnv","buildEnv","STORE_ROOT_URLS_LOCAL","STORE_ROOT_URLS_PROTO","STORE_ROOT_URLS_HONEYPOT","STORE_ROOT_URLS_QA","STORE_ROOT_URLS_PROD","checkUnreachable","getMicrositeRootUrlsByEnv","MICROSITE_ROOT_URLS_LOCAL","MICROSITE_ROOT_URLS_PROTO","MICROSITE_ROOT_URLS_QA","MICROSITE_ROOT_URLS_PROD","getDeployedLanguagesBySiteByEnv","store","STORE_DEPLOYED_LANGUAGES_LOCAL","ui","UI_COM_DEPLOYED_LANGUAGES_LOCAL","STORE_DEPLOYED_LANGUAGES_PROTO","UI_COM_DEPLOYED_LANGUAGES_PROTO","STORE_DEPLOYED_LANGUAGES_QA","UI_COM_DEPLOYED_LANGUAGES_QA","STORE_DEPLOYED_LANGUAGES_PROD","UI_COM_DEPLOYED_LANGUAGES_PROD","REGION_PRESET","GlobalStoreId","Us","Ca","Eu","Uk","Jp","Br","In","Me","Za","Tw","Sg","Cn","Mx","Ph","getGlobalSiteConfigByEnv","storeRootUrls","micrositeRootUrls","deployedLanguages","getLanguageConfig","siteId","storeId","isStoreId","defaultLanguage","languages","length","type","SiteConfigType","Regional","defaultRegion","Basic","baseUrl","regions","Object","values","reduce","acc","uisp","amplifi","techSpecs","experts","expertsUisp","expertsUi"],"mappings":";;;;;;;AAyCa,MAAAA,qBAAA,GAAyBC,QAAuB,IAAA;EAC3D,QAAQA,QAAU;IAChB,KAAK,KAAA;IACL,KAAK,OAAS;MAAA;QACL,OAAAC,qBAAA;MACT;IACA,KAAK,OAAS;MAAA;QACL,OAAAC,qBAAA;MACT;IACA,KAAK,UAAY;MAAA;QACR,OAAAC,wBAAA;MACT;IACA,KAAK,IAAM;MAAA;QACF,OAAAC,kBAAA;MACT;IACA,KAAK,KAAA,CAAA;IACL,KAAK,MAAQ;MAAA;QACJ,OAAAC,oBAAA;MACT;IACA;MAAS;QACPC,gBAAA,CAAiBN,QAAQ,CAAA;QAClB,OAAAK,oBAAA;MACT;EACF;AACF,CAAA;AAOA,MAAME,yBAAA,GAA6BP,QAAuB,IAAA;EACxD,QAAQA,QAAU;IAChB,KAAK,KAAA;IACL,KAAK,OAAS;MAAA;QACL,OAAAQ,yBAAA;MACT;IACA,KAAK,OAAS;MAAA;QACL,OAAAC,yBAAA;MACT;IACA,KAAK,IAAM;MAAA;QACF,OAAAC,sBAAA;MACT;IACA,KAAK,KAAA,CAAA;IACL,KAAK,UAAA;IACL,KAAK,MAAQ;MAAA;QACJ,OAAAC,w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;QACO,OAAAD,GAAA;MACT,CAAA,EACA;QAAE,GAAGrC;MAAc,CAAA,CAClB,EAAA;IACP,CAAA;IAAA;AAAA;AAAA;IAKAuC,OAAS,EAAA;MACPZ,MAAMC,cAAe,CAAAG,KAAA;MACrBC,SAASd,iBAAkB,CAAAqB;IAC7B,CAAA;IAAA;AAAA;AAAA;IAKAC,SAAW,EAAA;MACTb,MAAMC,cAAe,CAAAG,KAAA;MACrBC,SAASd,iBAAkB,CAAAsB;IAC7B,CAAA;IAAA;AAAA;AAAA;AAAA;IAMAC,OAAS,EAAA;MACPd,MAAMC,cAAe,CAAAG,KAAA;MACrBC,SAASd,iBAAkB,CAAAuB;IAC7B,CAAA;IAAA;AAAA;AAAA;IAKAC,WAAa,EAAA;MACXf,MAAMC,cAAe,CAAAG,KAAA;MACrBC,SAASd,iBAAkB,CAAAwB;IAC7B,CAAA;IAAA;AAAA;AAAA;IAKAC,SAAW,EAAA;MACThB,MAAMC,cAAe,CAAAG,KAAA;MACrBC,SAASd,iBAAkB,CAAAyB;IAC7B;EAAA,CACF;AACF,CAAA;"}
|
|
1
|
+
{"version":3,"file":"navigationPresets.mjs","sources":["../../../src/utils/nextjs/navigationPresets.ts"],"sourcesContent":["import type {\n DeployedLanguages,\n DeployedLanguagesMapping,\n} from \"../../contexts/MenuContext/mapping\";\nimport {\n MICROSITE_ROOT_URLS_LOCAL,\n MICROSITE_ROOT_URLS_PROD,\n MICROSITE_ROOT_URLS_PROTO,\n MICROSITE_ROOT_URLS_QA,\n STORE_DEPLOYED_LANGUAGES_LOCAL,\n STORE_DEPLOYED_LANGUAGES_PROD,\n STORE_DEPLOYED_LANGUAGES_PROTO,\n STORE_DEPLOYED_LANGUAGES_QA,\n STORE_ROOT_URLS_HONEYPOT,\n STORE_ROOT_URLS_LOCAL,\n STORE_ROOT_URLS_PROD,\n STORE_ROOT_URLS_PROTO,\n STORE_ROOT_URLS_QA,\n UI_COM_DEPLOYED_LANGUAGES_LOCAL,\n UI_COM_DEPLOYED_LANGUAGES_PROD,\n UI_COM_DEPLOYED_LANGUAGES_PROTO,\n UI_COM_DEPLOYED_LANGUAGES_QA,\n UWC_UI_COM_DEPLOYED_LANGUAGES_LOCAL,\n UWC_UI_COM_DEPLOYED_LANGUAGES_PROD,\n UWC_UI_COM_DEPLOYED_LANGUAGES_PROTO,\n UWC_UI_COM_DEPLOYED_LANGUAGES_QA,\n} from \"../../contexts/MenuContext/presets\";\nimport type {\n BasicSiteConfig,\n RegionalSite,\n StaticGlobalSiteConfig,\n} from \"../../contexts/MenuContext/types\";\nimport { SiteConfigType } from \"../../contexts/MenuContext/types\";\nimport type { StoreId } from \"../../types\";\nimport { GlobalStoreId } from \"../../types\";\nimport { checkUnreachable } from \"../errors\";\nimport { isStoreId } from \"../storeId\";\n\n/**\n * Values that indicate what kind of target build environment it is\n */\nexport type BuildEnv = \"local\" | \"e2e\" | \"proto\" | \"qa\" | \"prod\" | \"honeypot\";\n\n/**\n * Get the root URLs for each store by build environment\n * @param buildEnv The build environment\n * @returns The root URLs for each store\n */\nexport const getStoreRootUrlsByEnv = (buildEnv: BuildEnv) => {\n switch (buildEnv) {\n case \"e2e\":\n case \"local\": {\n return STORE_ROOT_URLS_LOCAL;\n }\n case \"proto\": {\n return STORE_ROOT_URLS_PROTO;\n }\n case \"honeypot\": {\n return STORE_ROOT_URLS_HONEYPOT;\n }\n case \"qa\": {\n return STORE_ROOT_URLS_QA;\n }\n case undefined:\n case \"prod\": {\n return STORE_ROOT_URLS_PROD;\n }\n default: {\n checkUnreachable(buildEnv);\n return STORE_ROOT_URLS_PROD;\n }\n }\n};\n\n/**\n * Get the root URLs for each microsite by build environment\n * @param buildEnv The build environment\n * @returns The root URLs for each microsite\n */\nconst getMicrositeRootUrlsByEnv = (buildEnv: BuildEnv) => {\n switch (buildEnv) {\n case \"e2e\":\n case \"local\": {\n return MICROSITE_ROOT_URLS_LOCAL;\n }\n case \"proto\": {\n return MICROSITE_ROOT_URLS_PROTO;\n }\n case \"qa\": {\n return MICROSITE_ROOT_URLS_QA;\n }\n case undefined:\n case \"honeypot\":\n case \"prod\": {\n return MICROSITE_ROOT_URLS_PROD;\n }\n default: {\n checkUnreachable(buildEnv);\n return MICROSITE_ROOT_URLS_PROD;\n }\n }\n};\n\n/**\n * Get the deployed languages for each site by build environment\n * @param buildEnv The build environment\n * @returns The deployed languages for each site\n */\nconst getDeployedLanguagesBySiteByEnv = (\n buildEnv: BuildEnv,\n): {\n store: DeployedLanguagesMapping;\n ui: DeployedLanguagesMapping;\n uwc: DeployedLanguages;\n} => {\n switch (buildEnv) {\n case \"e2e\":\n case \"local\": {\n return {\n store: STORE_DEPLOYED_LANGUAGES_LOCAL,\n ui: UI_COM_DEPLOYED_LANGUAGES_LOCAL,\n uwc: UWC_UI_COM_DEPLOYED_LANGUAGES_LOCAL,\n };\n }\n case \"proto\": {\n return {\n store: STORE_DEPLOYED_LANGUAGES_PROTO,\n ui: UI_COM_DEPLOYED_LANGUAGES_PROTO,\n uwc: UWC_UI_COM_DEPLOYED_LANGUAGES_PROTO,\n };\n }\n case \"qa\": {\n return {\n store: STORE_DEPLOYED_LANGUAGES_QA,\n ui: UI_COM_DEPLOYED_LANGUAGES_QA,\n uwc: UWC_UI_COM_DEPLOYED_LANGUAGES_QA,\n };\n }\n case undefined:\n case \"honeypot\":\n case \"prod\": {\n return {\n store: STORE_DEPLOYED_LANGUAGES_PROD,\n ui: UI_COM_DEPLOYED_LANGUAGES_PROD,\n uwc: UWC_UI_COM_DEPLOYED_LANGUAGES_PROD,\n };\n }\n default: {\n checkUnreachable(buildEnv);\n return {\n store: STORE_DEPLOYED_LANGUAGES_PROD,\n ui: UI_COM_DEPLOYED_LANGUAGES_PROD,\n uwc: UWC_UI_COM_DEPLOYED_LANGUAGES_PROD,\n };\n }\n }\n};\n\n// #############################################################################\n// Global site config - ✨ the NEW way to handle global site config\n// #############################################################################\nconst REGION_PRESET: Record<GlobalStoreId, null> = {\n [GlobalStoreId.Us]: null,\n [GlobalStoreId.Ca]: null,\n [GlobalStoreId.Eu]: null,\n [GlobalStoreId.Uk]: null,\n [GlobalStoreId.Jp]: null,\n [GlobalStoreId.Br]: null,\n [GlobalStoreId.In]: null,\n [GlobalStoreId.Me]: null,\n [GlobalStoreId.Za]: null,\n [GlobalStoreId.Tw]: null,\n [GlobalStoreId.Sg]: null,\n [GlobalStoreId.Cn]: null,\n [GlobalStoreId.Mx]: null,\n [GlobalStoreId.Ph]: null,\n};\n\nexport const getGlobalSiteConfigByEnv = (buildEnv: BuildEnv) => {\n const storeRootUrls = getStoreRootUrlsByEnv(buildEnv);\n const micrositeRootUrls = getMicrositeRootUrlsByEnv(buildEnv);\n const deployedLanguages = getDeployedLanguagesBySiteByEnv(buildEnv);\n\n const getLanguageConfig = (\n siteId: \"store\" | \"ui\",\n storeId: GlobalStoreId | StoreId,\n ): Pick<BasicSiteConfig, \"defaultLanguage\" | \"languages\"> => {\n if (!isStoreId(storeId)) {\n return {\n defaultLanguage: undefined,\n languages: undefined,\n };\n }\n\n const languages = deployedLanguages[siteId][storeId];\n\n // If region does not have languages, return undefined\n if (!languages?.length) {\n return {\n defaultLanguage: undefined,\n languages: undefined,\n };\n }\n\n return {\n defaultLanguage: languages[0],\n languages: languages,\n };\n };\n\n return {\n /**\n * \"store.ui.com\" site config\n */\n store: {\n type: SiteConfigType.Regional,\n defaultRegion: {\n type: SiteConfigType.Basic,\n baseUrl: storeRootUrls[GlobalStoreId.Us],\n ...getLanguageConfig(\"store\", GlobalStoreId.Us),\n } satisfies BasicSiteConfig,\n regions: (() =>\n Object.values(GlobalStoreId).reduce<\n Record<GlobalStoreId, BasicSiteConfig | null>\n >(\n (acc, storeId) => {\n acc[storeId] = {\n type: SiteConfigType.Basic,\n baseUrl: storeRootUrls[storeId],\n ...getLanguageConfig(\"store\", storeId),\n };\n return acc;\n },\n { ...REGION_PRESET },\n ))(),\n } satisfies RegionalSite,\n\n /**\n * \"ui.com\" site config\n */\n ui: {\n type: SiteConfigType.Regional,\n defaultRegion: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.ui,\n ...getLanguageConfig(\"ui\", GlobalStoreId.Us),\n } satisfies BasicSiteConfig,\n regions: (() =>\n Object.values(GlobalStoreId).reduce<\n Record<GlobalStoreId, BasicSiteConfig | null>\n >(\n (acc, storeId) => {\n acc[storeId] = {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.ui,\n ...getLanguageConfig(\"ui\", storeId),\n };\n return acc;\n },\n { ...REGION_PRESET },\n ))(),\n } satisfies RegionalSite,\n\n /**\n * \"uisp.ui.com\" site config\n */\n uisp: {\n type: SiteConfigType.Regional,\n defaultRegion: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.uisp,\n } satisfies BasicSiteConfig,\n regions: (() =>\n Object.values(GlobalStoreId).reduce<\n Record<GlobalStoreId, BasicSiteConfig | null>\n >(\n (acc, storeId) => {\n acc[storeId] = {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.uisp,\n };\n return acc;\n },\n { ...REGION_PRESET },\n ))(),\n } satisfies RegionalSite,\n\n /**\n * \"amplifi.com\" site config\n */\n amplifi: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.amplifi,\n } satisfies BasicSiteConfig,\n\n /**\n * \"techspecs.ui.com\" site config\n */\n techSpecs: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.techSpecs,\n } satisfies BasicSiteConfig,\n\n /**\n * \"experts.ui.com\" site config\n * NOTE: will be deprecated\n */\n uwc: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.uwc,\n languages: deployedLanguages.uwc,\n } satisfies BasicSiteConfig,\n\n /**\n * \"experts.uisp.com\" site config\n */\n expertsUisp: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.expertsUisp,\n } satisfies BasicSiteConfig,\n\n /**\n * \"experts.ui.com\" site config\n */\n expertsUi: {\n type: SiteConfigType.Basic,\n baseUrl: micrositeRootUrls.expertsUi,\n } satisfies BasicSiteConfig,\n } satisfies StaticGlobalSiteConfig;\n};\n"],"names":["getStoreRootUrlsByEnv","buildEnv","STORE_ROOT_URLS_LOCAL","STORE_ROOT_URLS_PROTO","STORE_ROOT_URLS_HONEYPOT","STORE_ROOT_URLS_QA","STORE_ROOT_URLS_PROD","checkUnreachable","getMicrositeRootUrlsByEnv","MICROSITE_ROOT_URLS_LOCAL","MICROSITE_ROOT_URLS_PROTO","MICROSITE_ROOT_URLS_QA","MICROSITE_ROOT_URLS_PROD","getDeployedLanguagesBySiteByEnv","store","STORE_DEPLOYED_LANGUAGES_LOCAL","ui","UI_COM_DEPLOYED_LANGUAGES_LOCAL","uwc","UWC_UI_COM_DEPLOYED_LANGUAGES_LOCAL","STORE_DEPLOYED_LANGUAGES_PROTO","UI_COM_DEPLOYED_LANGUAGES_PROTO","UWC_UI_COM_DEPLOYED_LANGUAGES_PROTO","STORE_DEPLOYED_LANGUAGES_QA","UI_COM_DEPLOYED_LANGUAGES_QA","UWC_UI_COM_DEPLOYED_LANGUAGES_QA","STORE_DEPLOYED_LANGUAGES_PROD","UI_COM_DEPLOYED_LANGUAGES_PROD","UWC_UI_COM_DEPLOYED_LANGUAGES_PROD","REGION_PRESET","GlobalStoreId","Us","Ca","Eu","Uk","Jp","Br","In","Me","Za","Tw","Sg","Cn","Mx","Ph","getGlobalSiteConfigByEnv","storeRootUrls","micrositeRootUrls","deployedLanguages","getLanguageConfig","siteId","storeId","isStoreId","defaultLanguage","languages","length","type","SiteConfigType","Regional","defaultRegion","Basic","baseUrl","regions","Object","values","reduce","acc","uisp","amplifi","techSpecs","expertsUisp","expertsUi"],"mappings":";;;;;;;AAgDa,MAAAA,qBAAA,GAAyBC,QAAuB,IAAA;EAC3D,QAAQA,QAAU;IAChB,KAAK,KAAA;IACL,KAAK,OAAS;MAAA;QACL,OAAAC,qBAAA;MACT;IACA,KAAK,OAAS;MAAA;QACL,OAAAC,qBAAA;MACT;IACA,KAAK,UAAY;MA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AAuB;IAC7B,CAAA;IAAA;AAAA;AAAA;IAKAC,SAAW,EAAA;MACTf,MAAMC,cAAe,CAAAG,KAAA;MACrBC,SAASd,iBAAkB,CAAAwB;IAC7B;EAAA,CACF;AACF,CAAA;"}
|
package/lib/utils/number.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare function isFloat(value: unknown, entity?: string, ErrorClass?: ne
|
|
|
31
31
|
* toFixed(1.2345, 0) // => "1"
|
|
32
32
|
* toFixed(1.23, 4) // => "1.2300"
|
|
33
33
|
*/
|
|
34
|
-
export declare function toFixedRate(rate: number, scale: number): string;
|
|
34
|
+
export declare function toFixedRate(rate: number, scale: number, asNumber?: boolean): string;
|
|
35
35
|
export declare function toFixedRate(rate: number, scale: number, asNumber: true): number;
|
|
36
36
|
/**
|
|
37
37
|
* Util to convert a float number to a string. Using this rather than simple template string to have a consistent way of
|
package/lib/utils/number.js
CHANGED
|
@@ -21,7 +21,7 @@ function isInt(value, entity = "Value", ErrorClass = TypeError) {
|
|
|
21
21
|
function isFloat(value, entity = "Value", ErrorClass = TypeError) {
|
|
22
22
|
isFiniteNumber(value, entity, ErrorClass);
|
|
23
23
|
}
|
|
24
|
-
function toFixedRate(rate, scale
|
|
24
|
+
function toFixedRate(rate, scale, asNumber) {
|
|
25
25
|
isFloat(rate, "Rate");
|
|
26
26
|
const fixedRate = rate.toFixed(scale);
|
|
27
27
|
return asNumber ? +fixedRate : fixedRate;
|