@ubnt/store.core 9.23.0-alpha.1 → 9.23.0-alpha.11
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 +51 -0
- package/lib/apis/smartcat.d.ts +10 -1
- package/lib/apis/smartcat.js +46 -3
- package/lib/apis/smartcat.js.map +1 -1
- package/lib/apis/smartcat.mjs +47 -5
- package/lib/apis/smartcat.mjs.map +1 -1
- package/lib/apis/smartcat.test.d.ts +1 -0
- package/lib/assets/building-bridge-xg.jpg +0 -0
- package/lib/assets/building-bridge.jpg +0 -0
- package/lib/assets/gateHub.jpg +0 -0
- package/lib/assets/logoUnifi.svg +10 -2
- package/lib/assets/minus4.svg +8 -8
- package/lib/assets/minus5.svg +8 -8
- package/lib/assets/plus5.svg +9 -9
- package/lib/assets/plus6.svg +9 -9
- package/lib/assets/udb-pro.jpg +0 -0
- package/lib/assets/udb.jpg +0 -0
- package/lib/assets/udmPro.jpg +0 -0
- package/lib/assets/udmPro2.jpg +0 -0
- package/lib/assets/udmProSpecial.jpg +0 -0
- package/lib/assets/udmProSpecial2.jpg +0 -0
- package/lib/assets/umr-ultra.jpg +0 -0
- package/lib/components/Explore/Explore.test.d.ts +1 -0
- package/lib/components/Header/Header.types.d.ts +2 -1
- package/lib/components/Header/Header.types.js.map +1 -1
- package/lib/components/Header/Header.types.mjs.map +1 -1
- package/lib/components/Header/LanguageFrame/utils/buildLanguageLink.test.d.ts +1 -0
- package/lib/components/Header/LogoIcon/LogoIcon.js +1 -1
- package/lib/components/Header/LogoIcon/LogoIcon.js.map +1 -1
- package/lib/components/Header/LogoIcon/LogoIcon.mjs +1 -1
- package/lib/components/Header/LogoIcon/LogoIcon.mjs.map +1 -1
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.d.ts +1 -1
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.js +11 -4
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.js.map +1 -1
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.mjs +12 -5
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.mjs.map +1 -1
- package/lib/components/Header/Navigation/ProMobileMenu/ProMobileMenu.types.d.ts +5 -5
- package/lib/components/Header/ProHeader/ProHeader.d.ts +1 -1
- package/lib/components/Header/ProHeader/ProHeader.js +59 -67
- package/lib/components/Header/ProHeader/ProHeader.js.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.mjs +61 -69
- package/lib/components/Header/ProHeader/ProHeader.mjs.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.styles.d.ts +16 -11
- package/lib/components/Header/ProHeader/ProHeader.styles.js +27 -30
- package/lib/components/Header/ProHeader/ProHeader.styles.js.map +1 -1
- package/lib/components/Header/ProHeader/ProHeader.styles.mjs +26 -30
- package/lib/components/Header/ProHeader/ProHeader.styles.mjs.map +1 -1
- package/lib/components/Header/translations/en.json.js +4 -1
- package/lib/components/Header/translations/en.json.js.map +1 -1
- package/lib/components/Header/translations/en.json.mjs +4 -2
- package/lib/components/Header/translations/en.json.mjs.map +1 -1
- package/lib/components/MicrositeHeader/components/Navigation/Navigation.js.map +1 -1
- package/lib/components/MicrositeHeader/components/Navigation/Navigation.mjs.map +1 -1
- package/lib/components/ModelCompareV3/ModelCompareV3.js +15 -2
- package/lib/components/ModelCompareV3/ModelCompareV3.js.map +1 -1
- package/lib/components/ModelCompareV3/ModelCompareV3.mjs +15 -2
- package/lib/components/ModelCompareV3/ModelCompareV3.mjs.map +1 -1
- package/lib/components/ModelCompareV3/ModelCompareV3.types.d.ts +6 -1
- package/lib/components/ModelCompareV3/assets/BuildingBridge/building-bridge-xg.jpg.js +27 -0
- package/lib/components/ModelCompareV3/assets/BuildingBridge/building-bridge-xg.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/BuildingBridge/building-bridge-xg.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/BuildingBridge/building-bridge-xg.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/BuildingBridge/{buildingBridgeXG.jpg.js → building-bridge.jpg.js} +2 -2
- package/lib/components/ModelCompareV3/assets/BuildingBridge/building-bridge.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/BuildingBridge/building-bridge.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/BuildingBridge/building-bridge.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/BuildingBridge/udb-pro.jpg.js +27 -0
- package/lib/components/ModelCompareV3/assets/BuildingBridge/udb-pro.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/BuildingBridge/udb-pro.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/BuildingBridge/udb-pro.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/BuildingBridge/udb.jpg.js +27 -0
- package/lib/components/ModelCompareV3/assets/BuildingBridge/udb.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/BuildingBridge/udb.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/BuildingBridge/udb.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmPro.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmPro.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProSpecial.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/udmProSpecial.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/udmPro.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/udmPro.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/udmProSpecial.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/udmProSpecial.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/DoorAccess/gateHub.jpg.js +27 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/gateHub.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/gateHub.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/DoorAccess/gateHub.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/assets/MobileRouters/umr-ultra.jpg.js +27 -0
- package/lib/components/ModelCompareV3/assets/MobileRouters/umr-ultra.jpg.js.map +1 -0
- package/lib/components/ModelCompareV3/assets/MobileRouters/umr-ultra.jpg.mjs +3 -0
- package/lib/components/ModelCompareV3/assets/MobileRouters/umr-ultra.jpg.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/AccessHubs.js +3 -2
- package/lib/components/ModelCompareV3/data/AccessHubs.js.map +1 -1
- package/lib/components/ModelCompareV3/data/AccessHubs.mjs +3 -2
- package/lib/components/ModelCompareV3/data/AccessHubs.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/BuildingBridge.js +11 -5
- package/lib/components/ModelCompareV3/data/BuildingBridge.js.map +1 -1
- package/lib/components/ModelCompareV3/data/BuildingBridge.mjs +11 -5
- package/lib/components/ModelCompareV3/data/BuildingBridge.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/CloudGateways.js +6 -6
- package/lib/components/ModelCompareV3/data/CloudGateways.mjs +4 -4
- package/lib/components/ModelCompareV3/data/MobileRouters.js +4 -3
- package/lib/components/ModelCompareV3/data/MobileRouters.js.map +1 -1
- package/lib/components/ModelCompareV3/data/MobileRouters.mjs +4 -3
- package/lib/components/ModelCompareV3/data/MobileRouters.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/VideoRecorders.js +2 -1
- package/lib/components/ModelCompareV3/data/VideoRecorders.js.map +1 -1
- package/lib/components/ModelCompareV3/data/VideoRecorders.mjs +2 -1
- package/lib/components/ModelCompareV3/data/VideoRecorders.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/buildingBridge.js +5 -5
- package/lib/components/ModelCompareV3/data/products/buildingBridge.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/buildingBridge.mjs +5 -5
- package/lib/components/ModelCompareV3/data/products/buildingBridge.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/buildingBridgeXG.js +2 -2
- package/lib/components/ModelCompareV3/data/products/buildingBridgeXG.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/buildingBridgeXG.mjs +2 -2
- package/lib/components/ModelCompareV3/data/products/buildingBridgeXG.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/elevatorHub.js +0 -1
- package/lib/components/ModelCompareV3/data/products/elevatorHub.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/elevatorHub.mjs +0 -1
- package/lib/components/ModelCompareV3/data/products/elevatorHub.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/envr.js +12 -2
- package/lib/components/ModelCompareV3/data/products/envr.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/envr.mjs +12 -2
- package/lib/components/ModelCompareV3/data/products/envr.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/gateHub.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/products/gateHub.js +73 -0
- package/lib/components/ModelCompareV3/data/products/gateHub.js.map +1 -0
- package/lib/components/ModelCompareV3/data/products/gateHub.mjs +65 -0
- package/lib/components/ModelCompareV3/data/products/gateHub.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/products/gatewayEnterprise.js +4 -3
- package/lib/components/ModelCompareV3/data/products/gatewayEnterprise.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/gatewayEnterprise.mjs +4 -3
- package/lib/components/ModelCompareV3/data/products/gatewayEnterprise.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/gatewayLite.js +7 -0
- package/lib/components/ModelCompareV3/data/products/gatewayLite.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/gatewayLite.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/gatewayLite.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/gatewayMax.js +7 -0
- package/lib/components/ModelCompareV3/data/products/gatewayMax.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/gatewayMax.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/gatewayMax.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/gatewayProfessional.js +7 -0
- package/lib/components/ModelCompareV3/data/products/gatewayProfessional.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/gatewayProfessional.mjs +7 -0
- package/lib/components/ModelCompareV3/data/products/gatewayProfessional.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/udb.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/products/udb.js +78 -0
- package/lib/components/ModelCompareV3/data/products/udb.js.map +1 -0
- package/lib/components/ModelCompareV3/data/products/udb.mjs +70 -0
- package/lib/components/ModelCompareV3/data/products/udb.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/products/udbPro.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/products/udbPro.js +79 -0
- package/lib/components/ModelCompareV3/data/products/udbPro.js.map +1 -0
- package/lib/components/ModelCompareV3/data/products/udbPro.mjs +71 -0
- package/lib/components/ModelCompareV3/data/products/udbPro.mjs.map +1 -0
- package/lib/components/ModelCompareV3/data/products/udmPro.js +1 -1
- package/lib/components/ModelCompareV3/data/products/udmPro.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProSpecial.js +1 -1
- package/lib/components/ModelCompareV3/data/products/udmProSpecial.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/umrIndustrial.js +0 -1
- package/lib/components/ModelCompareV3/data/products/umrIndustrial.js.map +1 -1
- package/lib/components/ModelCompareV3/data/products/umrIndustrial.mjs +0 -1
- package/lib/components/ModelCompareV3/data/products/umrIndustrial.mjs.map +1 -1
- package/lib/components/ModelCompareV3/data/products/umrUltra.d.ts +2 -0
- package/lib/components/ModelCompareV3/data/products/umrUltra.js +113 -0
- package/lib/components/ModelCompareV3/data/products/umrUltra.js.map +1 -0
- package/lib/components/ModelCompareV3/data/products/umrUltra.mjs +105 -0
- package/lib/components/ModelCompareV3/data/products/umrUltra.mjs.map +1 -0
- package/lib/components/ModelCompareV3/translations/ar.json.js +9 -4
- package/lib/components/ModelCompareV3/translations/ar.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/ar.json.mjs +9 -4
- package/lib/components/ModelCompareV3/translations/ar.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/de.json.js +9 -4
- package/lib/components/ModelCompareV3/translations/de.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/de.json.mjs +9 -4
- package/lib/components/ModelCompareV3/translations/de.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/el.json.js +9 -4
- package/lib/components/ModelCompareV3/translations/el.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/el.json.mjs +9 -4
- package/lib/components/ModelCompareV3/translations/el.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/en.json.js +34 -4
- package/lib/components/ModelCompareV3/translations/en.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/en.json.mjs +34 -4
- package/lib/components/ModelCompareV3/translations/en.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/es.json.js +9 -4
- package/lib/components/ModelCompareV3/translations/es.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/es.json.mjs +9 -4
- package/lib/components/ModelCompareV3/translations/es.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/fr.json.js +9 -4
- package/lib/components/ModelCompareV3/translations/fr.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/fr.json.mjs +9 -4
- package/lib/components/ModelCompareV3/translations/fr.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/it.json.js +9 -4
- package/lib/components/ModelCompareV3/translations/it.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/it.json.mjs +9 -4
- package/lib/components/ModelCompareV3/translations/it.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/ja.json.js +9 -4
- package/lib/components/ModelCompareV3/translations/ja.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/ja.json.mjs +9 -4
- package/lib/components/ModelCompareV3/translations/ja.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/pt-BR.json.js +9 -4
- package/lib/components/ModelCompareV3/translations/pt-BR.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/pt-BR.json.mjs +9 -4
- 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 +9 -4
- package/lib/components/ModelCompareV3/translations/zh-Hans.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/zh-Hans.json.mjs +9 -4
- package/lib/components/ModelCompareV3/translations/zh-Hans.json.mjs.map +1 -1
- package/lib/components/ModelCompareV3/translations/zh-Hant-TW.json.js +9 -4
- package/lib/components/ModelCompareV3/translations/zh-Hant-TW.json.js.map +1 -1
- package/lib/components/ModelCompareV3/translations/zh-Hant-TW.json.mjs +9 -4
- package/lib/components/ModelCompareV3/translations/zh-Hant-TW.json.mjs.map +1 -1
- package/lib/components/ProductCompare/mapping.test.d.ts +1 -0
- 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/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/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/Search/Input/Input.types.d.ts +2 -2
- package/lib/components/VariantSelector/Variant/BundleOffer/utils/getBundleOfferQuantity.test.d.ts +1 -0
- package/lib/constants/postalCode.test.d.ts +1 -0
- package/lib/contexts/MenuContext/mapping.js +1 -0
- package/lib/contexts/MenuContext/mapping.js.map +1 -1
- package/lib/contexts/MenuContext/mapping.mjs +1 -0
- package/lib/contexts/MenuContext/mapping.mjs.map +1 -1
- package/lib/contexts/MenuContext/mapping.test.d.ts +1 -0
- package/lib/contexts/MenuContext/utils.test.d.ts +1 -0
- package/lib/helpers/product.test.d.ts +1 -0
- package/lib/types/utils.d.ts +13 -0
- package/lib/types/utils.test.d.ts +1 -0
- package/lib/utils/address.test.d.ts +1 -0
- package/lib/utils/array.test.d.ts +1 -0
- package/lib/utils/collectionSlug.test.d.ts +1 -0
- package/lib/utils/countriesAndZones.test.d.ts +1 -0
- package/lib/utils/langauge.test.d.ts +1 -0
- package/lib/utils/measures.test.d.ts +1 -0
- package/lib/utils/money/allocators/fixedAmount.test.d.ts +1 -0
- package/lib/utils/money/allocators/productAmount.test.d.ts +1 -0
- package/lib/utils/money/constants.test.d.ts +1 -0
- package/lib/utils/money/exchangeRate.test.d.ts +1 -0
- package/lib/utils/money/format.test.d.ts +1 -0
- package/lib/utils/money/misc.test.d.ts +1 -0
- package/lib/utils/money/shipping.test.d.ts +1 -0
- package/lib/utils/money/tax.private.test.d.ts +1 -0
- package/lib/utils/money/tax.test.d.ts +1 -0
- package/lib/utils/nextjs/createInlineScript.test.d.ts +1 -0
- package/lib/utils/nextjs/mergeCspDirectives.test.d.ts +1 -0
- package/lib/utils/nextjs/sanitizeImageDomains.test.d.ts +1 -0
- package/lib/utils/nextjs/stringifyForInject.test.d.ts +1 -0
- package/lib/utils/number.test.d.ts +1 -0
- package/lib/utils/storeId.test.d.ts +1 -0
- package/lib/utils/string.test.d.ts +1 -0
- package/lib/utils/tags.test.d.ts +1 -0
- package/lib/utils/tax/index.test.d.ts +1 -0
- package/lib/utils/url.test.d.ts +1 -0
- package/lib/utils/validations/postalCodeSuperRefinement.test.d.ts +1 -0
- package/lib/utils/variant.test.d.ts +1 -0
- package/lib/utils/wattage.test.d.ts +1 -0
- package/lib/utils/zod.test.d.ts +1 -0
- package/package.json +14 -14
- package/lib/assets/buildingBridgeXG.jpg +0 -0
- package/lib/components/Header/Navigation/ProMenu/ProMenu.d.ts +0 -2
- package/lib/components/Header/Navigation/ProMenu/ProMenu.js +0 -103
- package/lib/components/Header/Navigation/ProMenu/ProMenu.js.map +0 -1
- package/lib/components/Header/Navigation/ProMenu/ProMenu.mjs +0 -81
- package/lib/components/Header/Navigation/ProMenu/ProMenu.mjs.map +0 -1
- package/lib/components/Header/Navigation/ProMenu/ProMenu.styles.d.ts +0 -23
- package/lib/components/Header/Navigation/ProMenu/ProMenu.styles.js +0 -121
- package/lib/components/Header/Navigation/ProMenu/ProMenu.styles.js.map +0 -1
- package/lib/components/Header/Navigation/ProMenu/ProMenu.styles.mjs +0 -106
- package/lib/components/Header/Navigation/ProMenu/ProMenu.styles.mjs.map +0 -1
- package/lib/components/Header/Navigation/ProMenu/ProMenu.types.d.ts +0 -12
- package/lib/components/Header/Navigation/ProMenu/index.d.ts +0 -1
- package/lib/components/Header/Navigation/ProMenu/index.js +0 -6
- package/lib/components/Header/Navigation/ProMenu/index.js.map +0 -1
- package/lib/components/Header/Navigation/ProMenu/index.mjs +0 -3
- package/lib/components/Header/Navigation/ProMenu/index.mjs.map +0 -1
- package/lib/components/ModelCompareV3/assets/BuildingBridge/buildingBridgeXG.jpg.js.map +0 -1
- package/lib/components/ModelCompareV3/assets/BuildingBridge/buildingBridgeXG.jpg.mjs +0 -3
- package/lib/components/ModelCompareV3/assets/BuildingBridge/buildingBridgeXG.jpg.mjs.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { NavigationProMobileMenuProps } from "./ProMobileMenu.types";
|
|
2
|
-
export declare const NavigationProMobileMenu: ({ translations, onClose,
|
|
2
|
+
export declare const NavigationProMobileMenu: ({ translations, onClose, logo, handleStorePickerClick, handleOrderHistoryClick, handlePurchaseHistoryClick, handleProductLineChange, productLineValue, productLineOptions, categories, hideExtraSection, }: NavigationProMobileMenuProps) => JSX.Element;
|
|
@@ -11,6 +11,7 @@ var typeGuards = require('../../../../utils/typeGuards.js');
|
|
|
11
11
|
var useFooterContent = require('../../../Footer/hooks/useFooterContent.js');
|
|
12
12
|
require('../../../StyleableSvgImage/index.js');
|
|
13
13
|
var mapping = require('../../LinksModal/mapping.js');
|
|
14
|
+
var ProHeader_styles = require('../../ProHeader/ProHeader.styles.js');
|
|
14
15
|
var MobileMenu_styles = require('../MobileMenu/MobileMenu.styles.js');
|
|
15
16
|
var ProMobileMenu_styles = require('./ProMobileMenu.styles.js');
|
|
16
17
|
var context = require('../../../../contexts/MenuContext/context.js');
|
|
@@ -31,7 +32,7 @@ const motif = "light";
|
|
|
31
32
|
const NavigationProMobileMenu = function NavigationProMobileMenu2({
|
|
32
33
|
translations,
|
|
33
34
|
onClose,
|
|
34
|
-
|
|
35
|
+
logo,
|
|
35
36
|
handleStorePickerClick,
|
|
36
37
|
// handleEarlyAccessClick,
|
|
37
38
|
handleOrderHistoryClick,
|
|
@@ -127,12 +128,18 @@ const NavigationProMobileMenu = function NavigationProMobileMenu2({
|
|
|
127
128
|
// Unless it has no sub-items
|
|
128
129
|
url: item.subItems.length ? null : item.url
|
|
129
130
|
}))
|
|
130
|
-
},
|
|
131
|
+
}, logo?.currentStore ? {
|
|
131
132
|
id: "country-selector",
|
|
132
133
|
items: [{
|
|
133
134
|
id: "current-country-name",
|
|
134
135
|
label: translations.region,
|
|
135
|
-
value:
|
|
136
|
+
value: /* @__PURE__ */jsxRuntime.jsxs(ProHeader_styles.CurrentStoreWrap, {
|
|
137
|
+
onClick: handleStorePickerClick,
|
|
138
|
+
$inheritFonts: true,
|
|
139
|
+
children: [/* @__PURE__ */jsxRuntime.jsx(ProHeader_styles.CurrentStoreFlag, {
|
|
140
|
+
children: logo.currentStore.flag
|
|
141
|
+
}), logo.currentStore.name]
|
|
142
|
+
}),
|
|
136
143
|
icon: {
|
|
137
144
|
src: asset.imageSrc(LocationPinIcon__default["default"]),
|
|
138
145
|
width: 17,
|
|
@@ -146,7 +153,7 @@ const NavigationProMobileMenu = function NavigationProMobileMenu2({
|
|
|
146
153
|
id: `extra-${item.id}`,
|
|
147
154
|
items: [item]
|
|
148
155
|
})) : [])].filter(typeGuards.isNonNullish);
|
|
149
|
-
}, [translations.support, translations.social, translations.company, translations.training, translations.tools, translations.orderHistory, translations.purchasedProductHistory, translations.region, context$1, socialContent.items, handleOrderHistoryClick, handlePurchaseHistoryClick, categories.items,
|
|
156
|
+
}, [translations.support, translations.social, translations.company, translations.training, translations.tools, translations.orderHistory, translations.purchasedProductHistory, translations.region, context$1, socialContent.items, handleOrderHistoryClick, handlePurchaseHistoryClick, categories.items, logo?.currentStore, handleStorePickerClick, hideExtraSection, footerContent]);
|
|
150
157
|
const renderSectionItemIcon = react.useCallback(item => {
|
|
151
158
|
return item.icon && /* @__PURE__ */jsxRuntime.jsx(ProMobileMenu_styles.SectionItemIcon, {
|
|
152
159
|
children: /* @__PURE__ */jsxRuntime.jsx(StyleableSvgImage.StyleableSvgImage, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProMobileMenu.js","sources":["../../../../../src/components/Header/Navigation/ProMobileMenu/ProMobileMenu.tsx"],"sourcesContent":["/* eslint-disable @next/next/no-img-element */\nimport type { Motif } from \"@ubnt/ui-components/utils\";\nimport { useCallback, useMemo, useState } from \"react\";\n\nimport HistoryIcon from \"../../../../assets/icons/menu/icon-history.svg\";\nimport LocationPinIcon from \"../../../../assets/icons/menu/icon-location-pin.svg\";\nimport * as icons from \"../../../../constants/icons\";\nimport { useMenu } from \"../../../../contexts/MenuContext\";\nimport { imageSrc } from \"../../../../utils/asset\";\nimport { isNonNullish } from \"../../../../utils/typeGuards\";\nimport { useFooterContent } from \"../../../Footer/hooks/useFooterContent\";\nimport { StyleableSvgImage } from \"../../../StyleableSvgImage\";\nimport { getSupportLinkMapping } from \"../../LinksModal/mapping\";\nimport * as S from \"../MobileMenu/MobileMenu.styles\";\nimport * as S2 from \"./ProMobileMenu.styles\";\nimport type {\n NavigationProMobileMenuProps,\n ProMobileMenuSection,\n ProMobileMenuSectionItem,\n ProMobileMenuSectionSubItem,\n} from \"./ProMobileMenu.types\";\n\nconst motif: Motif = \"light\";\n\nexport const NavigationProMobileMenu = function NavigationProMobileMenu({\n translations,\n onClose,\n currentCountryName,\n handleStorePickerClick,\n // handleEarlyAccessClick,\n handleOrderHistoryClick,\n handlePurchaseHistoryClick,\n handleProductLineChange,\n productLineValue,\n productLineOptions,\n categories,\n hideExtraSection,\n}: NavigationProMobileMenuProps) {\n const { footerContent, socialContent } = useFooterContent();\n const { context } = useMenu();\n\n // #############################################################################\n // Section toggling\n // #############################################################################\n const [expandedSectionItemId, setExpandedSectionItemId] = useState<\n string | null\n >(null);\n\n const toggleExpandedSectionItemId = useCallback(\n (itemId: string) => {\n setExpandedSectionItemId(\n expandedSectionItemId === itemId ? null : itemId,\n );\n },\n [expandedSectionItemId],\n );\n\n // #############################################################################\n // Menu sections\n // #############################################################################\n const sections = useMemo((): ProMobileMenuSection[] => {\n const extraSectionItems: ProMobileMenuSectionItem[] = [\n {\n id: \"support\",\n label: translations.support,\n url: null,\n subItems: getSupportLinkMapping(context).map((item) => ({\n id: item.id,\n label: item.name,\n url: item.url,\n })),\n },\n {\n id: \"social\",\n label: translations.social,\n url: null,\n subItems: socialContent.items.map((item) => ({\n id: item.id,\n label: item.label,\n url: item.src,\n })),\n },\n ...(\n [\n { key: \"company\", label: translations.company },\n { key: \"training\", label: translations.training },\n { key: \"tools\", label: translations.tools },\n ] as const\n ).map(({ key, label }) => ({\n id: key,\n label,\n url: null,\n subItems: footerContent[key].items.map((item) => ({\n id: item.id,\n label: item.label,\n url: item.src,\n })),\n })),\n ];\n\n return [\n {\n id: \"store-link-stuff\",\n items: [\n handleOrderHistoryClick\n ? ({\n id: \"order-history\",\n label: translations.orderHistory,\n icon: {\n src: imageSrc(HistoryIcon),\n width: 16,\n height: 16,\n },\n url: null,\n onClick: handleOrderHistoryClick,\n subItems: [],\n } satisfies ProMobileMenuSectionItem)\n : null,\n handlePurchaseHistoryClick\n ? ({\n id: \"purchased-product-history\",\n label: translations.purchasedProductHistory,\n icon: {\n src: imageSrc(HistoryIcon),\n width: 16,\n height: 16,\n },\n url: null,\n onClick: handlePurchaseHistoryClick,\n subItems: [],\n } satisfies ProMobileMenuSectionItem)\n : null,\n ].filter(isNonNullish),\n },\n\n {\n id: \"categories\",\n items: categories.items.map((item) => ({\n ...item,\n // Prevent top level items to be links - the whole item acts as a dropdown\n // Unless it has no sub-items\n url: item.subItems.length ? null : item.url,\n })),\n },\n\n currentCountryName\n ? {\n id: \"country-selector\",\n items: [\n {\n id: \"current-country-name\",\n label: translations.region,\n value: currentCountryName,\n icon: {\n src: imageSrc(LocationPinIcon),\n width: 17,\n height: 17,\n },\n url: null,\n onClick: handleStorePickerClick,\n subItems: [],\n },\n ],\n }\n : null,\n\n ...(!hideExtraSection\n ? extraSectionItems.map((item) => ({\n id: `extra-${item.id}`,\n items: [item],\n }))\n : []),\n ].filter(isNonNullish);\n }, [\n translations.support,\n translations.social,\n translations.company,\n translations.training,\n translations.tools,\n translations.orderHistory,\n translations.purchasedProductHistory,\n translations.region,\n context,\n socialContent.items,\n handleOrderHistoryClick,\n handlePurchaseHistoryClick,\n categories.items,\n currentCountryName,\n handleStorePickerClick,\n hideExtraSection,\n footerContent,\n ]);\n\n // #############################################################################\n // Render helpers\n // #############################################################################\n const renderSectionItemIcon = useCallback(\n (item: ProMobileMenuSection[\"items\"][number]): React.ReactNode => {\n return (\n item.icon && (\n <S2.SectionItemIcon>\n <StyleableSvgImage\n src={item.icon.src}\n width={item.icon.width}\n height={item.icon.height}\n />\n </S2.SectionItemIcon>\n )\n );\n },\n [],\n );\n\n const renderSectionItemButton = useCallback(\n (\n item: ProMobileMenuSectionItem | ProMobileMenuSectionSubItem,\n ): React.ReactNode => {\n const IconNode = \"subItems\" in item && renderSectionItemIcon(item);\n const NewLabelNode =\n \"isNew\" in item && item.isNew ? (\n <S.NewLabel>{translations.new}</S.NewLabel>\n ) : null;\n const ValueNode = !!item.value && <div>{item.value}</div>;\n\n const target =\n \"targetBlank\" in item && item.targetBlank ? \"_blank\" : undefined;\n const url = item.url;\n\n if (!url) {\n return (\n <S2.ProSectionItemButton\n motif={motif}\n onClick={(e) => {\n if (\"subItems\" in item && item.subItems.length) {\n toggleExpandedSectionItemId(item.id);\n } else {\n // On click callback only when not as a dropdown trigger\n item.onClick?.(e, url);\n onClose();\n }\n }}\n >\n <S2.ButtonContent>\n {IconNode}\n {item.label}\n {NewLabelNode}\n </S2.ButtonContent>\n {ValueNode}\n </S2.ProSectionItemButton>\n );\n }\n\n return (\n <S.SectionItemButton\n motif={motif}\n onClick={(e) => {\n item.onClick?.(e, url);\n onClose();\n }}\n {...(typeof url === \"string\"\n ? {\n as: \"a\",\n href: url,\n target,\n }\n : {})}\n >\n <S2.ButtonContent>\n {IconNode}\n {item.label}\n {NewLabelNode}\n </S2.ButtonContent>\n {ValueNode}\n </S.SectionItemButton>\n );\n },\n [\n onClose,\n renderSectionItemIcon,\n toggleExpandedSectionItemId,\n translations.new,\n ],\n );\n\n // #############################################################################\n // Render\n // #############################################################################\n return (\n <S2.Wrap motif={motif}>\n <S.Container size=\"mobile\" noVerticalMargin>\n <S.InnerWrap>\n {/* Product line */}\n {!!productLineOptions?.length && (\n <S2.ButtonGroup>\n {productLineOptions.map((option) => (\n <S2.CustomButton\n full\n key={option.value}\n variant=\"gray\"\n $active={option.value === productLineValue}\n onClick={() => {\n handleProductLineChange?.(option.value);\n onClose();\n }}\n >\n {option.label}\n </S2.CustomButton>\n ))}\n </S2.ButtonGroup>\n )}\n\n {/* Sections */}\n {sections.map((section) => (\n <S.Section motif={motif} key={section.id}>\n {section.items.map((item) => (\n <S.SectionItemsGroup\n motif={motif}\n key={item.id}\n $active={item.id === expandedSectionItemId}\n >\n <S.SectionItem motif={motif}>\n {renderSectionItemButton(item)}\n\n {item.subItems.length > 0 && (\n <S.SectionItemArrowButton\n motif={motif}\n onClick={() => toggleExpandedSectionItemId(item.id)}\n >\n <S.ButtonIcon>\n <StyleableSvgImage\n src={icons.generic.collapseArrow}\n width={13}\n height={8}\n />\n </S.ButtonIcon>\n </S.SectionItemArrowButton>\n )}\n </S.SectionItem>\n\n {item.id === expandedSectionItemId &&\n item.subItems.length > 0 &&\n item.subItems.map((subItem) => (\n <S.SectionItem key={subItem.id} motif={motif} $secondary>\n {renderSectionItemButton(subItem)}\n </S.SectionItem>\n ))}\n </S.SectionItemsGroup>\n ))}\n </S.Section>\n ))}\n </S.InnerWrap>\n </S.Container>\n </S2.Wrap>\n );\n};\n"],"names":["motif","NavigationProMobileMenu","NavigationProMobileMenu2","translations","onClose","currentCountryName","handleStorePickerClick","handleOrderHistoryClick","handlePurchaseHistoryClick","handleProductLineChange","productLineValue","productLineOptions","categories","hideExtraSection","footerContent","socialContent","useFooterContent","context","useMenu","expandedSectionItemId","setExpandedSectionItemId","useState","toggleExpandedSectionItemId","useCallback","itemId","sections","useMemo","extraSectionItems","id","label","support","url","subItems","getSupportLinkMapping","map","item","name","social","items","src","key","company","training","tools","orderHistory","icon","imageSrc","HistoryIcon","width","height","onClick","purchasedProductHistory","filter","isNonNullish","length","region","value","LocationPinIcon","renderSectionItemIcon","jsx","S2.SectionItemIcon","children","StyleableSvgImage","renderSectionItemButton","IconNode","NewLabelNode","isNew","S.NewLabel","NewLabel","new","ValueNode","target","targetBlank","jsxs","S2.ProSectionItemButton","ProSectionItemButton","e","S2.ButtonContent","S.SectionItemButton","SectionItemButton","as","href","S2.Wrap","S.Container","size","noVerticalMargin","S.InnerWrap","S2.ButtonGroup","option","S2.CustomButton","CustomButton","full","variant","$active","section","S.Section","S.SectionItemsGroup","SectionItemsGroup","S.SectionItem","SectionItem","S.SectionItemArrowButton","SectionItemArrowButton","S.ButtonIcon","icons.generic.collapseArrow","subItem","$secondary"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,KAAe,GAAA,OAAA;AAER,MAAAC,uBAAA,GAA0B,SAASA,wBAAwBC,CAAA;EACtEC,YAAA;EACAC,OAAA;EACAC,kBAAA;EACAC,sBAAA;EAAA;EAEAC,uBAAA;EACAC,0BAAA;EACAC,uBAAA;EACAC,gBAAA;EACAC,kBAAA;EACAC,UAAA;EACAC;AACF,CAAiC,EAAA;EAC/B,MAAM;IAAEC,aAAA;IAAeC;EAAc,CAAA,GAAIC,gBAAiB,CAAAA,gBAAA,CAAA,CAAA;EACpD,MAAA;IAAEC,OAAAA,EAAAA;GAAQ,GAAIC,OAAAA,CAAAA,OAAQ,EAAA;EAK5B,MAAM,CAACC,qBAAA,EAAuBC,wBAAwB,CAAA,GAAIC,eAExD,IAAI,CAAA;EAEN,MAAMC,2BAA8B,GAAAC,KAAA,CAAAA,WAAA,CACjCC,MAAmB,IAAA;IAClBJ,wBAAA,CACED,qBAAA,KAA0BK,SAAS,IAAO,GAAAA,MAAA,CAC5C;EACF,CAAA,EACA,CAACL,qBAAqB,CAAA,CACxB;EAKM,MAAAM,QAAA,GAAWC,KAA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AA,EADdA,OAAQ,CAAA5E,EAE5B,CACD,CAAA;UAAA,CAAA,EA5BEO,IAAK,CAAAP,EAAA,CA8Bb;QAAA,CAAA,EAlC2BkE,OAAQ,CAAAlE,EAmCtC,CACD,CAAA;OACH;KACF;EACF,CAAA,CAAA;AAEJ,CAAA;"}
|
|
1
|
+
{"version":3,"file":"ProMobileMenu.js","sources":["../../../../../src/components/Header/Navigation/ProMobileMenu/ProMobileMenu.tsx"],"sourcesContent":["/* eslint-disable @next/next/no-img-element */\nimport type { Motif } from \"@ubnt/ui-components/utils\";\nimport { useCallback, useMemo, useState } from \"react\";\n\nimport HistoryIcon from \"../../../../assets/icons/menu/icon-history.svg\";\nimport LocationPinIcon from \"../../../../assets/icons/menu/icon-location-pin.svg\";\nimport * as icons from \"../../../../constants/icons\";\nimport { useMenu } from \"../../../../contexts/MenuContext\";\nimport { imageSrc } from \"../../../../utils/asset\";\nimport { isNonNullish } from \"../../../../utils/typeGuards\";\nimport { useFooterContent } from \"../../../Footer/hooks/useFooterContent\";\nimport { StyleableSvgImage } from \"../../../StyleableSvgImage\";\nimport { getSupportLinkMapping } from \"../../LinksModal/mapping\";\nimport {\n CurrentStoreFlag,\n CurrentStoreWrap,\n} from \"../../ProHeader/ProHeader.styles\";\nimport * as S from \"../MobileMenu/MobileMenu.styles\";\nimport * as S2 from \"./ProMobileMenu.styles\";\nimport type {\n NavigationProMobileMenuProps,\n ProMobileMenuSection,\n ProMobileMenuSectionItem,\n ProMobileMenuSectionSubItem,\n} from \"./ProMobileMenu.types\";\n\nconst motif: Motif = \"light\";\n\nexport const NavigationProMobileMenu = function NavigationProMobileMenu({\n translations,\n onClose,\n logo,\n handleStorePickerClick,\n // handleEarlyAccessClick,\n handleOrderHistoryClick,\n handlePurchaseHistoryClick,\n handleProductLineChange,\n productLineValue,\n productLineOptions,\n categories,\n hideExtraSection,\n}: NavigationProMobileMenuProps) {\n const { footerContent, socialContent } = useFooterContent();\n const { context } = useMenu();\n\n // #############################################################################\n // Section toggling\n // #############################################################################\n const [expandedSectionItemId, setExpandedSectionItemId] = useState<\n string | null\n >(null);\n\n const toggleExpandedSectionItemId = useCallback(\n (itemId: string) => {\n setExpandedSectionItemId(\n expandedSectionItemId === itemId ? null : itemId,\n );\n },\n [expandedSectionItemId],\n );\n\n // #############################################################################\n // Menu sections\n // #############################################################################\n const sections = useMemo((): ProMobileMenuSection[] => {\n const extraSectionItems: ProMobileMenuSectionItem[] = [\n {\n id: \"support\",\n label: translations.support,\n url: null,\n subItems: getSupportLinkMapping(context).map((item) => ({\n id: item.id,\n label: item.name,\n url: item.url,\n })),\n },\n {\n id: \"social\",\n label: translations.social,\n url: null,\n subItems: socialContent.items.map((item) => ({\n id: item.id,\n label: item.label,\n url: item.src,\n })),\n },\n ...(\n [\n { key: \"company\", label: translations.company },\n { key: \"training\", label: translations.training },\n { key: \"tools\", label: translations.tools },\n ] as const\n ).map(({ key, label }) => ({\n id: key,\n label,\n url: null,\n subItems: footerContent[key].items.map((item) => ({\n id: item.id,\n label: item.label,\n url: item.src,\n })),\n })),\n ];\n\n return [\n {\n id: \"store-link-stuff\",\n items: [\n handleOrderHistoryClick\n ? ({\n id: \"order-history\",\n label: translations.orderHistory,\n icon: {\n src: imageSrc(HistoryIcon),\n width: 16,\n height: 16,\n },\n url: null,\n onClick: handleOrderHistoryClick,\n subItems: [],\n } satisfies ProMobileMenuSectionItem)\n : null,\n handlePurchaseHistoryClick\n ? ({\n id: \"purchased-product-history\",\n label: translations.purchasedProductHistory,\n icon: {\n src: imageSrc(HistoryIcon),\n width: 16,\n height: 16,\n },\n url: null,\n onClick: handlePurchaseHistoryClick,\n subItems: [],\n } satisfies ProMobileMenuSectionItem)\n : null,\n ].filter(isNonNullish),\n },\n\n {\n id: \"categories\",\n items: categories.items.map((item) => ({\n ...item,\n // Prevent top level items to be links - the whole item acts as a dropdown\n // Unless it has no sub-items\n url: item.subItems.length ? null : item.url,\n })),\n },\n\n logo?.currentStore\n ? {\n id: \"country-selector\",\n items: [\n {\n id: \"current-country-name\",\n label: translations.region,\n value: (\n <CurrentStoreWrap\n onClick={handleStorePickerClick}\n $inheritFonts\n >\n <CurrentStoreFlag>\n {logo.currentStore.flag}\n </CurrentStoreFlag>\n {logo.currentStore.name}\n </CurrentStoreWrap>\n ),\n icon: {\n src: imageSrc(LocationPinIcon),\n width: 17,\n height: 17,\n },\n url: null,\n onClick: handleStorePickerClick,\n subItems: [],\n },\n ],\n }\n : null,\n\n ...(!hideExtraSection\n ? extraSectionItems.map((item) => ({\n id: `extra-${item.id}`,\n items: [item],\n }))\n : []),\n ].filter(isNonNullish);\n }, [\n translations.support,\n translations.social,\n translations.company,\n translations.training,\n translations.tools,\n translations.orderHistory,\n translations.purchasedProductHistory,\n translations.region,\n context,\n socialContent.items,\n handleOrderHistoryClick,\n handlePurchaseHistoryClick,\n categories.items,\n logo?.currentStore,\n handleStorePickerClick,\n hideExtraSection,\n footerContent,\n ]);\n\n // #############################################################################\n // Render helpers\n // #############################################################################\n const renderSectionItemIcon = useCallback(\n (item: ProMobileMenuSection[\"items\"][number]): React.ReactNode => {\n return (\n item.icon && (\n <S2.SectionItemIcon>\n <StyleableSvgImage\n src={item.icon.src}\n width={item.icon.width}\n height={item.icon.height}\n />\n </S2.SectionItemIcon>\n )\n );\n },\n [],\n );\n\n const renderSectionItemButton = useCallback(\n (\n item: ProMobileMenuSectionItem | ProMobileMenuSectionSubItem,\n ): React.ReactNode => {\n const IconNode = \"subItems\" in item && renderSectionItemIcon(item);\n const NewLabelNode =\n \"isNew\" in item && item.isNew ? (\n <S.NewLabel>{translations.new}</S.NewLabel>\n ) : null;\n const ValueNode = !!item.value && <div>{item.value}</div>;\n\n const target =\n \"targetBlank\" in item && item.targetBlank ? \"_blank\" : undefined;\n const url = item.url;\n\n if (!url) {\n return (\n <S2.ProSectionItemButton\n motif={motif}\n onClick={(e) => {\n if (\"subItems\" in item && item.subItems.length) {\n toggleExpandedSectionItemId(item.id);\n } else {\n // On click callback only when not as a dropdown trigger\n item.onClick?.(e, url);\n onClose();\n }\n }}\n >\n <S2.ButtonContent>\n {IconNode}\n {item.label}\n {NewLabelNode}\n </S2.ButtonContent>\n {ValueNode}\n </S2.ProSectionItemButton>\n );\n }\n\n return (\n <S.SectionItemButton\n motif={motif}\n onClick={(e) => {\n item.onClick?.(e, url);\n onClose();\n }}\n {...(typeof url === \"string\"\n ? {\n as: \"a\",\n href: url,\n target,\n }\n : {})}\n >\n <S2.ButtonContent>\n {IconNode}\n {item.label}\n {NewLabelNode}\n </S2.ButtonContent>\n {ValueNode}\n </S.SectionItemButton>\n );\n },\n [\n onClose,\n renderSectionItemIcon,\n toggleExpandedSectionItemId,\n translations.new,\n ],\n );\n\n // #############################################################################\n // Render\n // #############################################################################\n return (\n <S2.Wrap motif={motif}>\n <S.Container size=\"mobile\" noVerticalMargin>\n <S.InnerWrap>\n {/* Product line */}\n {!!productLineOptions?.length && (\n <S2.ButtonGroup>\n {productLineOptions.map((option) => (\n <S2.CustomButton\n full\n key={option.value}\n variant=\"gray\"\n $active={option.value === productLineValue}\n onClick={() => {\n handleProductLineChange?.(option.value);\n onClose();\n }}\n >\n {option.label}\n </S2.CustomButton>\n ))}\n </S2.ButtonGroup>\n )}\n\n {/* Sections */}\n {sections.map((section) => (\n <S.Section motif={motif} key={section.id}>\n {section.items.map((item) => (\n <S.SectionItemsGroup\n motif={motif}\n key={item.id}\n $active={item.id === expandedSectionItemId}\n >\n <S.SectionItem motif={motif}>\n {renderSectionItemButton(item)}\n\n {item.subItems.length > 0 && (\n <S.SectionItemArrowButton\n motif={motif}\n onClick={() => toggleExpandedSectionItemId(item.id)}\n >\n <S.ButtonIcon>\n <StyleableSvgImage\n src={icons.generic.collapseArrow}\n width={13}\n height={8}\n />\n </S.ButtonIcon>\n </S.SectionItemArrowButton>\n )}\n </S.SectionItem>\n\n {item.id === expandedSectionItemId &&\n item.subItems.length > 0 &&\n item.subItems.map((subItem) => (\n <S.SectionItem key={subItem.id} motif={motif} $secondary>\n {renderSectionItemButton(subItem)}\n </S.SectionItem>\n ))}\n </S.SectionItemsGroup>\n ))}\n </S.Section>\n ))}\n </S.InnerWrap>\n </S.Container>\n </S2.Wrap>\n );\n};\n"],"names":["motif","NavigationProMobileMenu","NavigationProMobileMenu2","translations","onClose","logo","handleStorePickerClick","handleOrderHistoryClick","handlePurchaseHistoryClick","handleProductLineChange","productLineValue","productLineOptions","categories","hideExtraSection","footerContent","socialContent","useFooterContent","context","useMenu","expandedSectionItemId","setExpandedSectionItemId","useState","toggleExpandedSectionItemId","useCallback","itemId","sections","useMemo","extraSectionItems","id","label","support","url","subItems","getSupportLinkMapping","map","item","name","social","items","src","key","company","training","tools","orderHistory","icon","imageSrc","HistoryIcon","width","height","onClick","purchasedProductHistory","filter","isNonNullish","length","currentStore","region","value","jsxs","CurrentStoreWrap","$inheritFonts","children","jsx","CurrentStoreFlag","flag","LocationPinIcon","renderSectionItemIcon","S2.SectionItemIcon","StyleableSvgImage","renderSectionItemButton","IconNode","NewLabelNode","isNew","S.NewLabel","NewLabel","new","ValueNode","target","targetBlank","S2.ProSectionItemButton","ProSectionItemButton","e","S2.ButtonContent","S.SectionItemButton","SectionItemButton","as","href","S2.Wrap","S.Container","size","noVerticalMargin","S.InnerWrap","S2.ButtonGroup","option","S2.CustomButton","CustomButton","full","variant","$active","section","S.Section","S.SectionItemsGroup","SectionItemsGroup","S.SectionItem","SectionItem","S.SectionItemArrowButton","SectionItemArrowButton","S.ButtonIcon","icons.generic.collapseArrow","subItem","$secondary"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,KAAe,GAAA,OAAA;AAER,MAAAC,uBAAA,GAA0B,SAASA,wBAAwBC,CAAA;EACtEC,YAAA;EACAC,OAAA;EACAC,IAAA;EACAC,sBAAA;EAAA;EAEAC,uBAAA;EACAC,0BAAA;EACAC,uBAAA;EACAC,gBAAA;EACAC,kBAAA;EACAC,UAAA;EACAC;AACF,CAAiC,EAAA;EAC/B,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lC,IAAI,CAAA,EAE5BA,IAAA,CAAKH,QAAS,CAAAsB,MAAA,GAAS,CACtB,mBAAAQ,UAAA,CAAAA,GAAA,CAAC2C,iBAAE,CAAAC,sBAAA,EAAF;gBACC1G,KAAA;gBACAkD,OAAS,EAAAA,CAAA,KAAM5B,2BAA4B,CAAAa,IAAA,CAAKP,EAAE,CAAA;gBAElDiC,QAAA,iBAAAC,UAAA,CAAAA,GAAA,CAAC6C,4BAAE,EAAF;kBACC9C,QAAA,EAAA,eAAAC,UAAA,CAAAA,GAAA,CAACM,iBAAA,CAAAA,iBAAA,EAAA;oBACC7B,GAAA,EAAKqE,iCAAc,CAAA,SAAA,CAAA;oBACnB5D,KAAO,EAAA,EAAA;oBACPC,MAAQ,EAAA;kBAAA,CAAA;iBAEZ;cAAA,CACF,CAAA;aAEJ,CAAA,EAECd,IAAA,CAAKP,EAAO,KAAAT,qBAAA,IACXgB,IAAK,CAAAH,QAAA,CAASsB,SAAS,CACvB,IAAAnB,IAAA,CAAKH,QAAS,CAAAE,GAAA,CAAK2E,OAAA,IAAA,8BAChBN,iBAAAA,CAAAA,WAAE,EAAF;cAA+BvG,KAAA;cAAc8G,UAAU,EAAA,IAAA;cACrDjD,kCAAwBgD,OAAO;YAAA,CAAA,EADdA,OAAQ,CAAAjF,EAE5B,CACD,CAAA;UAAA,CAAA,EA5BEO,IAAK,CAAAP,EAAA,CA8Bb;QAAA,CAAA,EAlC2BuE,OAAQ,CAAAvE,EAmCtC,CACD,CAAA;OACH;KACF;EACF,CAAA,CAAA;AAEJ,CAAA;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useState, useCallback, useMemo } from 'react';
|
|
3
3
|
import '../../../../assets/icons/menu/icon-history.svg.mjs';
|
|
4
4
|
import '../../../../assets/icons/menu/icon-location-pin.svg.mjs';
|
|
@@ -9,6 +9,7 @@ import { isNonNullish } from '../../../../utils/typeGuards.mjs';
|
|
|
9
9
|
import { useFooterContent } from '../../../Footer/hooks/useFooterContent.mjs';
|
|
10
10
|
import '../../../StyleableSvgImage/index.mjs';
|
|
11
11
|
import { getSupportLinkMapping } from '../../LinksModal/mapping.mjs';
|
|
12
|
+
import { CurrentStoreWrap, CurrentStoreFlag } from '../../ProHeader/ProHeader.styles.mjs';
|
|
12
13
|
import { NewLabel, SectionItemButton, Container, InnerWrap, Section, SectionItemsGroup, SectionItem, SectionItemArrowButton, ButtonIcon } from '../MobileMenu/MobileMenu.styles.mjs';
|
|
13
14
|
import { SectionItemIcon, ProSectionItemButton, ButtonContent, Wrap, ButtonGroup, CustomButton } from './ProMobileMenu.styles.mjs';
|
|
14
15
|
import { useMenu } from '../../../../contexts/MenuContext/context.mjs';
|
|
@@ -21,7 +22,7 @@ const motif = "light";
|
|
|
21
22
|
const NavigationProMobileMenu = function NavigationProMobileMenu2({
|
|
22
23
|
translations,
|
|
23
24
|
onClose,
|
|
24
|
-
|
|
25
|
+
logo,
|
|
25
26
|
handleStorePickerClick,
|
|
26
27
|
// handleEarlyAccessClick,
|
|
27
28
|
handleOrderHistoryClick,
|
|
@@ -117,12 +118,18 @@ const NavigationProMobileMenu = function NavigationProMobileMenu2({
|
|
|
117
118
|
// Unless it has no sub-items
|
|
118
119
|
url: item.subItems.length ? null : item.url
|
|
119
120
|
}))
|
|
120
|
-
},
|
|
121
|
+
}, logo?.currentStore ? {
|
|
121
122
|
id: "country-selector",
|
|
122
123
|
items: [{
|
|
123
124
|
id: "current-country-name",
|
|
124
125
|
label: translations.region,
|
|
125
|
-
value:
|
|
126
|
+
value: /* @__PURE__ */jsxs(CurrentStoreWrap, {
|
|
127
|
+
onClick: handleStorePickerClick,
|
|
128
|
+
$inheritFonts: true,
|
|
129
|
+
children: [/* @__PURE__ */jsx(CurrentStoreFlag, {
|
|
130
|
+
children: logo.currentStore.flag
|
|
131
|
+
}), logo.currentStore.name]
|
|
132
|
+
}),
|
|
126
133
|
icon: {
|
|
127
134
|
src: imageSrc(LocationPinIcon__default),
|
|
128
135
|
width: 17,
|
|
@@ -136,7 +143,7 @@ const NavigationProMobileMenu = function NavigationProMobileMenu2({
|
|
|
136
143
|
id: `extra-${item.id}`,
|
|
137
144
|
items: [item]
|
|
138
145
|
})) : [])].filter(isNonNullish);
|
|
139
|
-
}, [translations.support, translations.social, translations.company, translations.training, translations.tools, translations.orderHistory, translations.purchasedProductHistory, translations.region, context, socialContent.items, handleOrderHistoryClick, handlePurchaseHistoryClick, categories.items,
|
|
146
|
+
}, [translations.support, translations.social, translations.company, translations.training, translations.tools, translations.orderHistory, translations.purchasedProductHistory, translations.region, context, socialContent.items, handleOrderHistoryClick, handlePurchaseHistoryClick, categories.items, logo?.currentStore, handleStorePickerClick, hideExtraSection, footerContent]);
|
|
140
147
|
const renderSectionItemIcon = useCallback(item => {
|
|
141
148
|
return item.icon && /* @__PURE__ */jsx(SectionItemIcon, {
|
|
142
149
|
children: /* @__PURE__ */jsx(StyleableSvgImage, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProMobileMenu.mjs","sources":["../../../../../src/components/Header/Navigation/ProMobileMenu/ProMobileMenu.tsx"],"sourcesContent":["/* eslint-disable @next/next/no-img-element */\nimport type { Motif } from \"@ubnt/ui-components/utils\";\nimport { useCallback, useMemo, useState } from \"react\";\n\nimport HistoryIcon from \"../../../../assets/icons/menu/icon-history.svg\";\nimport LocationPinIcon from \"../../../../assets/icons/menu/icon-location-pin.svg\";\nimport * as icons from \"../../../../constants/icons\";\nimport { useMenu } from \"../../../../contexts/MenuContext\";\nimport { imageSrc } from \"../../../../utils/asset\";\nimport { isNonNullish } from \"../../../../utils/typeGuards\";\nimport { useFooterContent } from \"../../../Footer/hooks/useFooterContent\";\nimport { StyleableSvgImage } from \"../../../StyleableSvgImage\";\nimport { getSupportLinkMapping } from \"../../LinksModal/mapping\";\nimport * as S from \"../MobileMenu/MobileMenu.styles\";\nimport * as S2 from \"./ProMobileMenu.styles\";\nimport type {\n NavigationProMobileMenuProps,\n ProMobileMenuSection,\n ProMobileMenuSectionItem,\n ProMobileMenuSectionSubItem,\n} from \"./ProMobileMenu.types\";\n\nconst motif: Motif = \"light\";\n\nexport const NavigationProMobileMenu = function NavigationProMobileMenu({\n translations,\n onClose,\n currentCountryName,\n handleStorePickerClick,\n // handleEarlyAccessClick,\n handleOrderHistoryClick,\n handlePurchaseHistoryClick,\n handleProductLineChange,\n productLineValue,\n productLineOptions,\n categories,\n hideExtraSection,\n}: NavigationProMobileMenuProps) {\n const { footerContent, socialContent } = useFooterContent();\n const { context } = useMenu();\n\n // #############################################################################\n // Section toggling\n // #############################################################################\n const [expandedSectionItemId, setExpandedSectionItemId] = useState<\n string | null\n >(null);\n\n const toggleExpandedSectionItemId = useCallback(\n (itemId: string) => {\n setExpandedSectionItemId(\n expandedSectionItemId === itemId ? null : itemId,\n );\n },\n [expandedSectionItemId],\n );\n\n // #############################################################################\n // Menu sections\n // #############################################################################\n const sections = useMemo((): ProMobileMenuSection[] => {\n const extraSectionItems: ProMobileMenuSectionItem[] = [\n {\n id: \"support\",\n label: translations.support,\n url: null,\n subItems: getSupportLinkMapping(context).map((item) => ({\n id: item.id,\n label: item.name,\n url: item.url,\n })),\n },\n {\n id: \"social\",\n label: translations.social,\n url: null,\n subItems: socialContent.items.map((item) => ({\n id: item.id,\n label: item.label,\n url: item.src,\n })),\n },\n ...(\n [\n { key: \"company\", label: translations.company },\n { key: \"training\", label: translations.training },\n { key: \"tools\", label: translations.tools },\n ] as const\n ).map(({ key, label }) => ({\n id: key,\n label,\n url: null,\n subItems: footerContent[key].items.map((item) => ({\n id: item.id,\n label: item.label,\n url: item.src,\n })),\n })),\n ];\n\n return [\n {\n id: \"store-link-stuff\",\n items: [\n handleOrderHistoryClick\n ? ({\n id: \"order-history\",\n label: translations.orderHistory,\n icon: {\n src: imageSrc(HistoryIcon),\n width: 16,\n height: 16,\n },\n url: null,\n onClick: handleOrderHistoryClick,\n subItems: [],\n } satisfies ProMobileMenuSectionItem)\n : null,\n handlePurchaseHistoryClick\n ? ({\n id: \"purchased-product-history\",\n label: translations.purchasedProductHistory,\n icon: {\n src: imageSrc(HistoryIcon),\n width: 16,\n height: 16,\n },\n url: null,\n onClick: handlePurchaseHistoryClick,\n subItems: [],\n } satisfies ProMobileMenuSectionItem)\n : null,\n ].filter(isNonNullish),\n },\n\n {\n id: \"categories\",\n items: categories.items.map((item) => ({\n ...item,\n // Prevent top level items to be links - the whole item acts as a dropdown\n // Unless it has no sub-items\n url: item.subItems.length ? null : item.url,\n })),\n },\n\n currentCountryName\n ? {\n id: \"country-selector\",\n items: [\n {\n id: \"current-country-name\",\n label: translations.region,\n value: currentCountryName,\n icon: {\n src: imageSrc(LocationPinIcon),\n width: 17,\n height: 17,\n },\n url: null,\n onClick: handleStorePickerClick,\n subItems: [],\n },\n ],\n }\n : null,\n\n ...(!hideExtraSection\n ? extraSectionItems.map((item) => ({\n id: `extra-${item.id}`,\n items: [item],\n }))\n : []),\n ].filter(isNonNullish);\n }, [\n translations.support,\n translations.social,\n translations.company,\n translations.training,\n translations.tools,\n translations.orderHistory,\n translations.purchasedProductHistory,\n translations.region,\n context,\n socialContent.items,\n handleOrderHistoryClick,\n handlePurchaseHistoryClick,\n categories.items,\n currentCountryName,\n handleStorePickerClick,\n hideExtraSection,\n footerContent,\n ]);\n\n // #############################################################################\n // Render helpers\n // #############################################################################\n const renderSectionItemIcon = useCallback(\n (item: ProMobileMenuSection[\"items\"][number]): React.ReactNode => {\n return (\n item.icon && (\n <S2.SectionItemIcon>\n <StyleableSvgImage\n src={item.icon.src}\n width={item.icon.width}\n height={item.icon.height}\n />\n </S2.SectionItemIcon>\n )\n );\n },\n [],\n );\n\n const renderSectionItemButton = useCallback(\n (\n item: ProMobileMenuSectionItem | ProMobileMenuSectionSubItem,\n ): React.ReactNode => {\n const IconNode = \"subItems\" in item && renderSectionItemIcon(item);\n const NewLabelNode =\n \"isNew\" in item && item.isNew ? (\n <S.NewLabel>{translations.new}</S.NewLabel>\n ) : null;\n const ValueNode = !!item.value && <div>{item.value}</div>;\n\n const target =\n \"targetBlank\" in item && item.targetBlank ? \"_blank\" : undefined;\n const url = item.url;\n\n if (!url) {\n return (\n <S2.ProSectionItemButton\n motif={motif}\n onClick={(e) => {\n if (\"subItems\" in item && item.subItems.length) {\n toggleExpandedSectionItemId(item.id);\n } else {\n // On click callback only when not as a dropdown trigger\n item.onClick?.(e, url);\n onClose();\n }\n }}\n >\n <S2.ButtonContent>\n {IconNode}\n {item.label}\n {NewLabelNode}\n </S2.ButtonContent>\n {ValueNode}\n </S2.ProSectionItemButton>\n );\n }\n\n return (\n <S.SectionItemButton\n motif={motif}\n onClick={(e) => {\n item.onClick?.(e, url);\n onClose();\n }}\n {...(typeof url === \"string\"\n ? {\n as: \"a\",\n href: url,\n target,\n }\n : {})}\n >\n <S2.ButtonContent>\n {IconNode}\n {item.label}\n {NewLabelNode}\n </S2.ButtonContent>\n {ValueNode}\n </S.SectionItemButton>\n );\n },\n [\n onClose,\n renderSectionItemIcon,\n toggleExpandedSectionItemId,\n translations.new,\n ],\n );\n\n // #############################################################################\n // Render\n // #############################################################################\n return (\n <S2.Wrap motif={motif}>\n <S.Container size=\"mobile\" noVerticalMargin>\n <S.InnerWrap>\n {/* Product line */}\n {!!productLineOptions?.length && (\n <S2.ButtonGroup>\n {productLineOptions.map((option) => (\n <S2.CustomButton\n full\n key={option.value}\n variant=\"gray\"\n $active={option.value === productLineValue}\n onClick={() => {\n handleProductLineChange?.(option.value);\n onClose();\n }}\n >\n {option.label}\n </S2.CustomButton>\n ))}\n </S2.ButtonGroup>\n )}\n\n {/* Sections */}\n {sections.map((section) => (\n <S.Section motif={motif} key={section.id}>\n {section.items.map((item) => (\n <S.SectionItemsGroup\n motif={motif}\n key={item.id}\n $active={item.id === expandedSectionItemId}\n >\n <S.SectionItem motif={motif}>\n {renderSectionItemButton(item)}\n\n {item.subItems.length > 0 && (\n <S.SectionItemArrowButton\n motif={motif}\n onClick={() => toggleExpandedSectionItemId(item.id)}\n >\n <S.ButtonIcon>\n <StyleableSvgImage\n src={icons.generic.collapseArrow}\n width={13}\n height={8}\n />\n </S.ButtonIcon>\n </S.SectionItemArrowButton>\n )}\n </S.SectionItem>\n\n {item.id === expandedSectionItemId &&\n item.subItems.length > 0 &&\n item.subItems.map((subItem) => (\n <S.SectionItem key={subItem.id} motif={motif} $secondary>\n {renderSectionItemButton(subItem)}\n </S.SectionItem>\n ))}\n </S.SectionItemsGroup>\n ))}\n </S.Section>\n ))}\n </S.InnerWrap>\n </S.Container>\n </S2.Wrap>\n );\n};\n"],"names":["motif","NavigationProMobileMenu","NavigationProMobileMenu2","translations","onClose","currentCountryName","handleStorePickerClick","handleOrderHistoryClick","handlePurchaseHistoryClick","handleProductLineChange","productLineValue","productLineOptions","categories","hideExtraSection","footerContent","socialContent","useFooterContent","context","useMenu","expandedSectionItemId","setExpandedSectionItemId","useState","toggleExpandedSectionItemId","useCallback","itemId","sections","useMemo","extraSectionItems","id","label","support","url","subItems","getSupportLinkMapping","map","item","name","social","items","src","key","company","training","tools","orderHistory","icon","imageSrc","HistoryIcon","width","height","onClick","purchasedProductHistory","filter","isNonNullish","length","region","value","LocationPinIcon","renderSectionItemIcon","jsx","S2.SectionItemIcon","children","StyleableSvgImage","renderSectionItemButton","IconNode","NewLabelNode","isNew","S.NewLabel","new","ValueNode","target","targetBlank","jsxs","S2.ProSectionItemButton","e","S2.ButtonContent","S.SectionItemButton","as","href","S2.Wrap","S.Container","size","noVerticalMargin","S.InnerWrap","S2.ButtonGroup","option","S2.CustomButton","full","variant","$active","section","S.Section","S.SectionItemsGroup","S.SectionItem","S.SectionItemArrowButton","S.ButtonIcon","icons.generic.collapseArrow","subItem","$secondary"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,KAAe,GAAA,OAAA;AAER,MAAAC,uBAAA,GAA0B,SAASA,wBAAwBC,CAAA;EACtEC,YAAA;EACAC,OAAA;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D,CAAA;UAAA,CAAA,EA5BEO,IAAK,CAAAP,EAAA,CA8Bb;QAAA,CAAA,EAlC2B8D,OAAQ,CAAA9D,EAmCtC,CACD,CAAA;OACH;KACF;EACF,CAAA,CAAA;AAEJ,CAAA;"}
|
|
1
|
+
{"version":3,"file":"ProMobileMenu.mjs","sources":["../../../../../src/components/Header/Navigation/ProMobileMenu/ProMobileMenu.tsx"],"sourcesContent":["/* eslint-disable @next/next/no-img-element */\nimport type { Motif } from \"@ubnt/ui-components/utils\";\nimport { useCallback, useMemo, useState } from \"react\";\n\nimport HistoryIcon from \"../../../../assets/icons/menu/icon-history.svg\";\nimport LocationPinIcon from \"../../../../assets/icons/menu/icon-location-pin.svg\";\nimport * as icons from \"../../../../constants/icons\";\nimport { useMenu } from \"../../../../contexts/MenuContext\";\nimport { imageSrc } from \"../../../../utils/asset\";\nimport { isNonNullish } from \"../../../../utils/typeGuards\";\nimport { useFooterContent } from \"../../../Footer/hooks/useFooterContent\";\nimport { StyleableSvgImage } from \"../../../StyleableSvgImage\";\nimport { getSupportLinkMapping } from \"../../LinksModal/mapping\";\nimport {\n CurrentStoreFlag,\n CurrentStoreWrap,\n} from \"../../ProHeader/ProHeader.styles\";\nimport * as S from \"../MobileMenu/MobileMenu.styles\";\nimport * as S2 from \"./ProMobileMenu.styles\";\nimport type {\n NavigationProMobileMenuProps,\n ProMobileMenuSection,\n ProMobileMenuSectionItem,\n ProMobileMenuSectionSubItem,\n} from \"./ProMobileMenu.types\";\n\nconst motif: Motif = \"light\";\n\nexport const NavigationProMobileMenu = function NavigationProMobileMenu({\n translations,\n onClose,\n logo,\n handleStorePickerClick,\n // handleEarlyAccessClick,\n handleOrderHistoryClick,\n handlePurchaseHistoryClick,\n handleProductLineChange,\n productLineValue,\n productLineOptions,\n categories,\n hideExtraSection,\n}: NavigationProMobileMenuProps) {\n const { footerContent, socialContent } = useFooterContent();\n const { context } = useMenu();\n\n // #############################################################################\n // Section toggling\n // #############################################################################\n const [expandedSectionItemId, setExpandedSectionItemId] = useState<\n string | null\n >(null);\n\n const toggleExpandedSectionItemId = useCallback(\n (itemId: string) => {\n setExpandedSectionItemId(\n expandedSectionItemId === itemId ? null : itemId,\n );\n },\n [expandedSectionItemId],\n );\n\n // #############################################################################\n // Menu sections\n // #############################################################################\n const sections = useMemo((): ProMobileMenuSection[] => {\n const extraSectionItems: ProMobileMenuSectionItem[] = [\n {\n id: \"support\",\n label: translations.support,\n url: null,\n subItems: getSupportLinkMapping(context).map((item) => ({\n id: item.id,\n label: item.name,\n url: item.url,\n })),\n },\n {\n id: \"social\",\n label: translations.social,\n url: null,\n subItems: socialContent.items.map((item) => ({\n id: item.id,\n label: item.label,\n url: item.src,\n })),\n },\n ...(\n [\n { key: \"company\", label: translations.company },\n { key: \"training\", label: translations.training },\n { key: \"tools\", label: translations.tools },\n ] as const\n ).map(({ key, label }) => ({\n id: key,\n label,\n url: null,\n subItems: footerContent[key].items.map((item) => ({\n id: item.id,\n label: item.label,\n url: item.src,\n })),\n })),\n ];\n\n return [\n {\n id: \"store-link-stuff\",\n items: [\n handleOrderHistoryClick\n ? ({\n id: \"order-history\",\n label: translations.orderHistory,\n icon: {\n src: imageSrc(HistoryIcon),\n width: 16,\n height: 16,\n },\n url: null,\n onClick: handleOrderHistoryClick,\n subItems: [],\n } satisfies ProMobileMenuSectionItem)\n : null,\n handlePurchaseHistoryClick\n ? ({\n id: \"purchased-product-history\",\n label: translations.purchasedProductHistory,\n icon: {\n src: imageSrc(HistoryIcon),\n width: 16,\n height: 16,\n },\n url: null,\n onClick: handlePurchaseHistoryClick,\n subItems: [],\n } satisfies ProMobileMenuSectionItem)\n : null,\n ].filter(isNonNullish),\n },\n\n {\n id: \"categories\",\n items: categories.items.map((item) => ({\n ...item,\n // Prevent top level items to be links - the whole item acts as a dropdown\n // Unless it has no sub-items\n url: item.subItems.length ? null : item.url,\n })),\n },\n\n logo?.currentStore\n ? {\n id: \"country-selector\",\n items: [\n {\n id: \"current-country-name\",\n label: translations.region,\n value: (\n <CurrentStoreWrap\n onClick={handleStorePickerClick}\n $inheritFonts\n >\n <CurrentStoreFlag>\n {logo.currentStore.flag}\n </CurrentStoreFlag>\n {logo.currentStore.name}\n </CurrentStoreWrap>\n ),\n icon: {\n src: imageSrc(LocationPinIcon),\n width: 17,\n height: 17,\n },\n url: null,\n onClick: handleStorePickerClick,\n subItems: [],\n },\n ],\n }\n : null,\n\n ...(!hideExtraSection\n ? extraSectionItems.map((item) => ({\n id: `extra-${item.id}`,\n items: [item],\n }))\n : []),\n ].filter(isNonNullish);\n }, [\n translations.support,\n translations.social,\n translations.company,\n translations.training,\n translations.tools,\n translations.orderHistory,\n translations.purchasedProductHistory,\n translations.region,\n context,\n socialContent.items,\n handleOrderHistoryClick,\n handlePurchaseHistoryClick,\n categories.items,\n logo?.currentStore,\n handleStorePickerClick,\n hideExtraSection,\n footerContent,\n ]);\n\n // #############################################################################\n // Render helpers\n // #############################################################################\n const renderSectionItemIcon = useCallback(\n (item: ProMobileMenuSection[\"items\"][number]): React.ReactNode => {\n return (\n item.icon && (\n <S2.SectionItemIcon>\n <StyleableSvgImage\n src={item.icon.src}\n width={item.icon.width}\n height={item.icon.height}\n />\n </S2.SectionItemIcon>\n )\n );\n },\n [],\n );\n\n const renderSectionItemButton = useCallback(\n (\n item: ProMobileMenuSectionItem | ProMobileMenuSectionSubItem,\n ): React.ReactNode => {\n const IconNode = \"subItems\" in item && renderSectionItemIcon(item);\n const NewLabelNode =\n \"isNew\" in item && item.isNew ? (\n <S.NewLabel>{translations.new}</S.NewLabel>\n ) : null;\n const ValueNode = !!item.value && <div>{item.value}</div>;\n\n const target =\n \"targetBlank\" in item && item.targetBlank ? \"_blank\" : undefined;\n const url = item.url;\n\n if (!url) {\n return (\n <S2.ProSectionItemButton\n motif={motif}\n onClick={(e) => {\n if (\"subItems\" in item && item.subItems.length) {\n toggleExpandedSectionItemId(item.id);\n } else {\n // On click callback only when not as a dropdown trigger\n item.onClick?.(e, url);\n onClose();\n }\n }}\n >\n <S2.ButtonContent>\n {IconNode}\n {item.label}\n {NewLabelNode}\n </S2.ButtonContent>\n {ValueNode}\n </S2.ProSectionItemButton>\n );\n }\n\n return (\n <S.SectionItemButton\n motif={motif}\n onClick={(e) => {\n item.onClick?.(e, url);\n onClose();\n }}\n {...(typeof url === \"string\"\n ? {\n as: \"a\",\n href: url,\n target,\n }\n : {})}\n >\n <S2.ButtonContent>\n {IconNode}\n {item.label}\n {NewLabelNode}\n </S2.ButtonContent>\n {ValueNode}\n </S.SectionItemButton>\n );\n },\n [\n onClose,\n renderSectionItemIcon,\n toggleExpandedSectionItemId,\n translations.new,\n ],\n );\n\n // #############################################################################\n // Render\n // #############################################################################\n return (\n <S2.Wrap motif={motif}>\n <S.Container size=\"mobile\" noVerticalMargin>\n <S.InnerWrap>\n {/* Product line */}\n {!!productLineOptions?.length && (\n <S2.ButtonGroup>\n {productLineOptions.map((option) => (\n <S2.CustomButton\n full\n key={option.value}\n variant=\"gray\"\n $active={option.value === productLineValue}\n onClick={() => {\n handleProductLineChange?.(option.value);\n onClose();\n }}\n >\n {option.label}\n </S2.CustomButton>\n ))}\n </S2.ButtonGroup>\n )}\n\n {/* Sections */}\n {sections.map((section) => (\n <S.Section motif={motif} key={section.id}>\n {section.items.map((item) => (\n <S.SectionItemsGroup\n motif={motif}\n key={item.id}\n $active={item.id === expandedSectionItemId}\n >\n <S.SectionItem motif={motif}>\n {renderSectionItemButton(item)}\n\n {item.subItems.length > 0 && (\n <S.SectionItemArrowButton\n motif={motif}\n onClick={() => toggleExpandedSectionItemId(item.id)}\n >\n <S.ButtonIcon>\n <StyleableSvgImage\n src={icons.generic.collapseArrow}\n width={13}\n height={8}\n />\n </S.ButtonIcon>\n </S.SectionItemArrowButton>\n )}\n </S.SectionItem>\n\n {item.id === expandedSectionItemId &&\n item.subItems.length > 0 &&\n item.subItems.map((subItem) => (\n <S.SectionItem key={subItem.id} motif={motif} $secondary>\n {renderSectionItemButton(subItem)}\n </S.SectionItem>\n ))}\n </S.SectionItemsGroup>\n ))}\n </S.Section>\n ))}\n </S.InnerWrap>\n </S.Container>\n </S2.Wrap>\n );\n};\n"],"names":["motif","NavigationProMobileMenu","NavigationProMobileMenu2","translations","onClose","logo","handleStorePickerClick","handleOrderHistoryClick","handlePurchaseHistoryClick","handleProductLineChange","productLineValue","productLineOptions","categories","hideExtraSection","footerContent","socialContent","useFooterContent","context","useMenu","expandedSectionItemId","setExpandedSectionItemId","useState","toggleExpandedSectionItemId","useCallback","itemId","sections","useMemo","extraSectionItems","id","label","support","url","subItems","getSupportLinkMapping","map","item","name","social","items","src","key","company","training","tools","orderHistory","icon","imageSrc","HistoryIcon","width","height","onClick","purchasedProductHistory","filter","isNonNullish","length","currentStore","region","value","jsxs","CurrentStoreWrap","$inheritFonts","children","jsx","CurrentStoreFlag","flag","LocationPinIcon","renderSectionItemIcon","S2.SectionItemIcon","StyleableSvgImage","renderSectionItemButton","IconNode","NewLabelNode","isNew","S.NewLabel","new","ValueNode","target","targetBlank","S2.ProSectionItemButton","e","S2.ButtonContent","S.SectionItemButton","as","href","S2.Wrap","S.Container","size","noVerticalMargin","S.InnerWrap","S2.ButtonGroup","option","S2.CustomButton","full","variant","$active","section","S.Section","S.SectionItemsGroup","S.SectionItem","S.SectionItemArrowButton","S.ButtonIcon","icons.generic.collapseArrow","subItem","$secondary"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,KAAe,GAAA,OAAA;AAER,MAAAC,uBAAA,GAA0B,SAASA,wBAAwBC,CAAA;EACtEC,YAAA;EACAC,OAAA;EACAC,IAAA;EACAC,sBAAA;EAAA;EAEAC,uBAAA;EACAC,0BAAA;EACAC,uBAAA;EACAC,gBAAA;EACAC,kBAAA;EACAC,UAAA;EACAC;AACF,CAAiC,EAAA;EAC/B,MAAM;IAAEC,aAAA;IAAeC;EAAc,CAAA,GAAIC,gBAAiB,CAAA,CAAA;EACpD,MAAA;IAAEC;GAAQ,GAAIC,OAAQ,EAAA;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dA,OAAQ,CAAA1E,EAE5B,CACD,CAAA;UAAA,CAAA,EA5BEO,IAAK,CAAAP,EAAA,CA8Bb;QAAA,CAAA,EAlC2BmE,OAAQ,CAAAnE,EAmCtC,CACD,CAAA;OACH;KACF;EACF,CAAA,CAAA;AAEJ,CAAA;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { MouseEvent } from "react";
|
|
1
|
+
import type { MouseEvent, ReactNode } from "react";
|
|
2
2
|
import type { ProductLine } from "../../../../types";
|
|
3
|
-
import type { HeaderTranslations, ProHeaderProps } from "../../Header.types";
|
|
3
|
+
import type { HeaderLogo, HeaderTranslations, ProHeaderProps } from "../../Header.types";
|
|
4
4
|
export type ProMobileMenuOnClickFn = (e: MouseEvent, url: string | null) => void;
|
|
5
5
|
export type ProMobileMenuSectionSubItem = {
|
|
6
6
|
id: string;
|
|
7
7
|
label: string;
|
|
8
|
-
value?:
|
|
8
|
+
value?: ReactNode;
|
|
9
9
|
url: string;
|
|
10
10
|
onClick?: ProMobileMenuOnClickFn;
|
|
11
11
|
isNew?: boolean;
|
|
@@ -14,7 +14,7 @@ export type ProMobileMenuSectionSubItem = {
|
|
|
14
14
|
export type ProMobileMenuSectionItem = {
|
|
15
15
|
id: string;
|
|
16
16
|
label: string;
|
|
17
|
-
value?:
|
|
17
|
+
value?: ReactNode;
|
|
18
18
|
icon?: {
|
|
19
19
|
src: string;
|
|
20
20
|
width: number;
|
|
@@ -31,7 +31,7 @@ export interface ProMobileMenuSection {
|
|
|
31
31
|
export interface NavigationProMobileMenuProps {
|
|
32
32
|
translations: HeaderTranslations;
|
|
33
33
|
onClose: () => void;
|
|
34
|
-
|
|
34
|
+
logo?: HeaderLogo;
|
|
35
35
|
handleStorePickerClick?: ProHeaderProps["handleStorePickerClick"];
|
|
36
36
|
handleOrderHistoryClick?: ProHeaderProps["handleOrderHistoryClick"];
|
|
37
37
|
handlePurchaseHistoryClick?: ProHeaderProps["handlePurchaseHistoryClick"];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Language, ProductLine } from "../../../types";
|
|
2
2
|
export declare const ProHeader: import("react").NamedExoticComponent<Pick<import("../Header.types").HeaderProps, "className" | "motif" | "cart" | "account" | "translations" | "onModalOpen" | "onCartClick" | "showLineLoader" | "accountMenu"> & {
|
|
3
3
|
embedConfig?: import("../Header.types").HeaderEmbedConfig;
|
|
4
|
-
currentCountryName?: string;
|
|
5
4
|
handleStorePickerClick?: () => void;
|
|
5
|
+
currentCountryName?: string;
|
|
6
6
|
earlyAccess?: import("../Header.types").ProHeaderEarlyAccess;
|
|
7
7
|
handlePurchaseHistoryClick?: () => void;
|
|
8
8
|
handleOrderHistoryClick?: () => void;
|
|
@@ -15,7 +15,6 @@ var mapping = require('../../../contexts/MenuContext/mapping.js');
|
|
|
15
15
|
var types = require('../../../contexts/MenuContext/types.js');
|
|
16
16
|
var ux = require('../../../helpers/ux.js');
|
|
17
17
|
require('../../../hooks/index.js');
|
|
18
|
-
var useHasTouch = require('../../../hooks/useHasTouch.js');
|
|
19
18
|
require('../../../types/index.js');
|
|
20
19
|
var asset = require('../../../utils/asset.js');
|
|
21
20
|
var errors = require('../../../utils/errors.js');
|
|
@@ -30,7 +29,6 @@ require('../LanguageFrame/index.js');
|
|
|
30
29
|
require('../LanguageFrame/Mobile/index.js');
|
|
31
30
|
require('../LogoIcon/index.js');
|
|
32
31
|
require('../MenuItem/index.js');
|
|
33
|
-
require('../Navigation/ProMenu/index.js');
|
|
34
32
|
require('../Navigation/ProMobileMenu/index.js');
|
|
35
33
|
require('../translations/index.js');
|
|
36
34
|
var ProHeader_styles = require('./ProHeader.styles.js');
|
|
@@ -57,7 +55,6 @@ var LanguageFrame = require('../LanguageFrame/LanguageFrame.js');
|
|
|
57
55
|
var Mobile$1 = require('../AccountFrame/Mobile/Mobile.js');
|
|
58
56
|
var AccountFrame = require('../AccountFrame/AccountFrame.js');
|
|
59
57
|
var ProMobileMenu = require('../Navigation/ProMobileMenu/ProMobileMenu.js');
|
|
60
|
-
var ProMenu = require('../Navigation/ProMenu/ProMenu.js');
|
|
61
58
|
function _interopDefault(e) {
|
|
62
59
|
return e && e.__esModule ? e : {
|
|
63
60
|
default: e
|
|
@@ -93,7 +90,6 @@ const ProHeader = react.memo(function ProHeader2({
|
|
|
93
90
|
showLineLoader,
|
|
94
91
|
searchValue,
|
|
95
92
|
onSearch,
|
|
96
|
-
currentCountryName,
|
|
97
93
|
handleStorePickerClick,
|
|
98
94
|
earlyAccess,
|
|
99
95
|
handlePurchaseHistoryClick,
|
|
@@ -116,8 +112,7 @@ const ProHeader = react.memo(function ProHeader2({
|
|
|
116
112
|
const rootRef = react.useRef(null);
|
|
117
113
|
const wrapRef = react.useRef(null);
|
|
118
114
|
const containerRef = react.useRef(null);
|
|
119
|
-
const [
|
|
120
|
-
const [desktopSearchInputRef, setDesktopSearchInputRef] = react.useState(null);
|
|
115
|
+
const [mobileSearchInputEl, setMobileSearchInputEl] = react.useState(null);
|
|
121
116
|
const translations = react.useMemo(() => {
|
|
122
117
|
return merge__default["default"](Header_types.defaultHeaderTranslations, initialTranslations);
|
|
123
118
|
}, [initialTranslations]);
|
|
@@ -199,12 +194,7 @@ const ProHeader = react.memo(function ProHeader2({
|
|
|
199
194
|
activeModal === types.ModalId.ProMobileMenu
|
|
200
195
|
);
|
|
201
196
|
}, [activeModal]);
|
|
202
|
-
const
|
|
203
|
-
const logoRef = react.useRef(null);
|
|
204
|
-
const logoHover = reactUse.useHoverDirty(logoRef);
|
|
205
|
-
const showProMenu = react.useMemo(() => {
|
|
206
|
-
return logoHover || showTouchProMenu;
|
|
207
|
-
}, [logoHover, showTouchProMenu]);
|
|
197
|
+
const isSearching = activeModal === types.ModalId.Search || !!searchValue;
|
|
208
198
|
const onClickAwayFromSearchModal = react.useCallback(() => {
|
|
209
199
|
if (!!searchValue && !isMobile) return;
|
|
210
200
|
if (activeModal === types.ModalId.Search) {
|
|
@@ -220,19 +210,32 @@ const ProHeader = react.memo(function ProHeader2({
|
|
|
220
210
|
}
|
|
221
211
|
}, [initialSearchValueHandled, searchValue, setActiveModal]);
|
|
222
212
|
const blurSearchInput = react.useCallback(() => {
|
|
223
|
-
if (!
|
|
213
|
+
if (!mobileSearchInputEl || activeModal !== types.ModalId.Search) {
|
|
224
214
|
return;
|
|
225
215
|
}
|
|
226
216
|
if (searchValue?.length) {
|
|
227
|
-
|
|
217
|
+
mobileSearchInputEl.blur();
|
|
228
218
|
} else {
|
|
229
219
|
onClickAwayFromSearchModal();
|
|
230
220
|
}
|
|
231
|
-
}, [activeModal, onClickAwayFromSearchModal,
|
|
221
|
+
}, [activeModal, onClickAwayFromSearchModal, mobileSearchInputEl, searchValue?.length]);
|
|
232
222
|
reactUse.useClickAway(rootRef, () => {
|
|
233
223
|
onClickAwayFromSearchModal();
|
|
234
224
|
}, ["click"]);
|
|
225
|
+
const onDesktopSearchReveal = react.useCallback(desktopSearchInputEl => {
|
|
226
|
+
if (!desktopSearchInputEl) return;
|
|
227
|
+
const interval = setInterval(() => {
|
|
228
|
+
if (document.activeElement === desktopSearchInputEl) {
|
|
229
|
+
clearInterval(interval);
|
|
230
|
+
}
|
|
231
|
+
desktopSearchInputEl.focus();
|
|
232
|
+
}, 0);
|
|
233
|
+
}, []);
|
|
235
234
|
const handleSearchCancel = react.useCallback(() => {
|
|
235
|
+
setActiveModal(null);
|
|
236
|
+
onSearch?.("");
|
|
237
|
+
}, [onSearch, setActiveModal]);
|
|
238
|
+
const handleSearchClear = react.useCallback(() => {
|
|
236
239
|
setActiveModal(types.ModalId.Search);
|
|
237
240
|
onSearch?.("");
|
|
238
241
|
}, [onSearch, setActiveModal]);
|
|
@@ -244,29 +247,18 @@ const ProHeader = react.memo(function ProHeader2({
|
|
|
244
247
|
setSearchFocused(false);
|
|
245
248
|
onSearchBlur?.();
|
|
246
249
|
}, [setSearchFocused, onSearchBlur]);
|
|
247
|
-
const
|
|
250
|
+
const handleOpenSearch = react.useCallback(e => {
|
|
248
251
|
handleModalOpen(e, types.ModalId.Search);
|
|
249
252
|
onSearchClick?.();
|
|
250
|
-
if (
|
|
253
|
+
if (isMobile && mobileSearchInputEl) {
|
|
251
254
|
const interval = setInterval(() => {
|
|
252
|
-
if (document.activeElement ===
|
|
255
|
+
if (document.activeElement === mobileSearchInputEl) {
|
|
253
256
|
clearInterval(interval);
|
|
254
257
|
}
|
|
255
|
-
|
|
258
|
+
mobileSearchInputEl.focus();
|
|
256
259
|
}, 0);
|
|
257
260
|
}
|
|
258
|
-
}, [handleModalOpen, onSearchClick,
|
|
259
|
-
react.useEffect(() => {
|
|
260
|
-
if (activeModal === types.ModalId.Search && !isMobile) return;
|
|
261
|
-
if (desktopSearchInputRef) {
|
|
262
|
-
const interval = setInterval(() => {
|
|
263
|
-
if (document.activeElement === desktopSearchInputRef) {
|
|
264
|
-
clearInterval(interval);
|
|
265
|
-
}
|
|
266
|
-
desktopSearchInputRef.focus();
|
|
267
|
-
}, 0);
|
|
268
|
-
}
|
|
269
|
-
}, [activeModal, desktopSearchInputRef, isMobile]);
|
|
261
|
+
}, [handleModalOpen, isMobile, onSearchClick, mobileSearchInputEl]);
|
|
270
262
|
const handleSearchValueChange = react.useCallback(e => {
|
|
271
263
|
onSearch?.(e.target.value);
|
|
272
264
|
}, [onSearch]);
|
|
@@ -307,7 +299,6 @@ const ProHeader = react.memo(function ProHeader2({
|
|
|
307
299
|
const cartQuantity = react.useMemo(() => {
|
|
308
300
|
return cart?.items.reduce((sum, item) => sum + item.quantity, 0) ?? 0;
|
|
309
301
|
}, [cart?.items]);
|
|
310
|
-
const hasTouch = useHasTouch.useHasTouch();
|
|
311
302
|
const homeLinkUrl = react.useMemo(() => {
|
|
312
303
|
return logo?.url ?? createSiteUrl([mapping.SiteId.Ui, ""]);
|
|
313
304
|
}, [createSiteUrl, logo?.url]);
|
|
@@ -317,13 +308,8 @@ const ProHeader = react.memo(function ProHeader2({
|
|
|
317
308
|
embedConfig.homeLinkClickHandler();
|
|
318
309
|
return;
|
|
319
310
|
}
|
|
320
|
-
if (!showProMenu && !hasTouch) {
|
|
321
|
-
e.preventDefault();
|
|
322
|
-
setShowTouchProMenu(true);
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
311
|
logo?.onClick?.(e, homeLinkUrl);
|
|
326
|
-
}, [embedConfig,
|
|
312
|
+
}, [embedConfig, homeLinkUrl, logo]);
|
|
327
313
|
react.useEffect(() => {
|
|
328
314
|
const containerEl = containerRef.current;
|
|
329
315
|
if (!containerEl) return;
|
|
@@ -379,8 +365,8 @@ const ProHeader = react.memo(function ProHeader2({
|
|
|
379
365
|
ref: rootRef,
|
|
380
366
|
$sticky: !!embedConfig,
|
|
381
367
|
$disableBlur: activeModal === types.ModalId.Language && isMobile,
|
|
382
|
-
children: [/* @__PURE__ */jsxRuntime.
|
|
383
|
-
children:
|
|
368
|
+
children: [/* @__PURE__ */jsxRuntime.jsx(Header_styles.HeaderWrap, {
|
|
369
|
+
children: /* @__PURE__ */jsxRuntime.jsxs(ProHeader_styles.ProHeader, {
|
|
384
370
|
sticky: sticky || !!embedConfig,
|
|
385
371
|
isStickyEmbed: !!embedConfig,
|
|
386
372
|
className,
|
|
@@ -402,7 +388,6 @@ const ProHeader = react.memo(function ProHeader2({
|
|
|
402
388
|
children: embedConfig.siteTitle
|
|
403
389
|
}) : /* @__PURE__ */jsxRuntime.jsx(Header_styles.LogoIconWrap, {
|
|
404
390
|
motif,
|
|
405
|
-
ref: logoRef,
|
|
406
391
|
children: /* @__PURE__ */jsxRuntime.jsx(LogoIcon.HeaderLogoIcon, {
|
|
407
392
|
productLine: logo?.productLine ?? productLineValue
|
|
408
393
|
})
|
|
@@ -417,18 +402,23 @@ const ProHeader = react.memo(function ProHeader2({
|
|
|
417
402
|
})
|
|
418
403
|
}), /* @__PURE__ */jsxRuntime.jsx(ProHeader_styles.CenterWrap, {
|
|
419
404
|
hideBreakpoint: MOBILE_BREAKPOINT_AND_DOWN,
|
|
420
|
-
children:
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
405
|
+
children: isSearching ? /* @__PURE__ */jsxRuntime.jsxs(ProHeader_styles.SearchWrap, {
|
|
406
|
+
children: [/* @__PURE__ */jsxRuntime.jsx(ProHeader_styles.Search, {
|
|
407
|
+
setInputRef: onDesktopSearchReveal,
|
|
408
|
+
onValueChange: handleSearchValueChange,
|
|
409
|
+
placeholder: searchPlaceholder,
|
|
410
|
+
isSearchFocused: !!searchValue || isSearchFocused,
|
|
411
|
+
value: searchValue ?? "",
|
|
412
|
+
showCancel: !!searchValue,
|
|
413
|
+
onCancelClick: handleSearchClear,
|
|
414
|
+
width: 420,
|
|
415
|
+
onFocus: handleSearchFocus,
|
|
416
|
+
onBlur: handleSearchBlur,
|
|
417
|
+
focusedWidth: searchFocusWidth
|
|
418
|
+
}), /* @__PURE__ */jsxRuntime.jsx(ProHeader_styles.SearchCancel, {
|
|
419
|
+
onClick: handleSearchCancel,
|
|
420
|
+
children: formatMessage("Cancel")
|
|
421
|
+
})]
|
|
432
422
|
}) : /* @__PURE__ */jsxRuntime.jsx(ProHeader_styles.InlineCategoryWrap, {
|
|
433
423
|
$hide: hideInlineCategories,
|
|
434
424
|
children: /* @__PURE__ */jsxRuntime.jsx(ScrollWrapper.ScrollWrapper, {
|
|
@@ -460,13 +450,22 @@ const ProHeader = react.memo(function ProHeader2({
|
|
|
460
450
|
})
|
|
461
451
|
}), /* @__PURE__ */jsxRuntime.jsxs(ProHeader_styles.RightWrap, {
|
|
462
452
|
$addSpaceOnDesktop: !!embedConfig?.fullWidthHeader,
|
|
463
|
-
children: [
|
|
453
|
+
children: [isSearching && /* @__PURE__ */jsxRuntime.jsx(ProHeader_styles.ProductLineSelectorWrap, {
|
|
454
|
+
hideBreakpoint: MOBILE_BREAKPOINT_AND_DOWN,
|
|
455
|
+
children: productLineOptions.filter(productLine => productLine.value !== productLineValue).map(productLine => /* @__PURE__ */jsxRuntime.jsx(MenuItem.MenuItem, {
|
|
456
|
+
motif,
|
|
457
|
+
onClick: () => handleProductLineChange?.(productLine.value),
|
|
458
|
+
children: /* @__PURE__ */jsxRuntime.jsx(Header_styles.MenuItemLabel, {
|
|
459
|
+
children: productLine.label
|
|
460
|
+
})
|
|
461
|
+
}, productLine.value))
|
|
462
|
+
}), activeModal !== types.ModalId.ProMobileMenu && !(isSearching && !isMobile) && /* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
464
463
|
children: [/* @__PURE__ */jsxRuntime.jsx(ProHeader_styles.ProIconWrap, {
|
|
465
464
|
"data-test-id": "search-btn",
|
|
466
465
|
motif,
|
|
467
|
-
onClick:
|
|
466
|
+
onClick: handleOpenSearch,
|
|
468
467
|
children: /* @__PURE__ */jsxRuntime.jsx(ProHeader_styles.ProIconInnerFillWrap, {
|
|
469
|
-
$active:
|
|
468
|
+
$active: isSearching,
|
|
470
469
|
$transparent: !!embedConfig || !isMobile,
|
|
471
470
|
children: /* @__PURE__ */jsxRuntime.jsx(Header_styles.SvgIcon, {
|
|
472
471
|
src: _externalAssets_g50k1DIN__default["default"],
|
|
@@ -604,7 +603,7 @@ const ProHeader = react.memo(function ProHeader2({
|
|
|
604
603
|
}), !isSsr && activeModal === types.ModalId.ProMobileMenu && /* @__PURE__ */jsxRuntime.jsx(ProMobileMenu.NavigationProMobileMenu, {
|
|
605
604
|
translations,
|
|
606
605
|
onClose: handleModalClose,
|
|
607
|
-
|
|
606
|
+
logo,
|
|
608
607
|
handleStorePickerClick,
|
|
609
608
|
handleOrderHistoryClick,
|
|
610
609
|
handlePurchaseHistoryClick,
|
|
@@ -614,26 +613,19 @@ const ProHeader = react.memo(function ProHeader2({
|
|
|
614
613
|
categories,
|
|
615
614
|
hideExtraSection: !!embedConfig
|
|
616
615
|
})]
|
|
617
|
-
})
|
|
618
|
-
show: showProMenu,
|
|
619
|
-
currentCountryName,
|
|
620
|
-
handleStorePickerClick,
|
|
621
|
-
productLineValue,
|
|
622
|
-
productLineOptions,
|
|
623
|
-
onProductLineChange: handleProductLineChange
|
|
624
|
-
})]
|
|
616
|
+
})
|
|
625
617
|
}), /* @__PURE__ */jsxRuntime.jsx(ProHeader_styles.SearchTabWrap, {
|
|
626
618
|
$show: activeModal === types.ModalId.Search,
|
|
627
619
|
$isStickyEmbed: !!embedConfig,
|
|
628
620
|
hideBreakpoint: MOBILE_BREAKPOINT_UP,
|
|
629
621
|
children: /* @__PURE__ */jsxRuntime.jsx(ProHeader_styles.Search, {
|
|
630
|
-
setInputRef:
|
|
622
|
+
setInputRef: setMobileSearchInputEl,
|
|
631
623
|
onValueChange: handleSearchValueChange,
|
|
632
624
|
placeholder: searchPlaceholder,
|
|
633
625
|
isSearchFocused: !!searchValue || isSearchFocused,
|
|
634
626
|
value: searchValue || "",
|
|
635
627
|
showCancel: !!searchValue,
|
|
636
|
-
onCancelClick:
|
|
628
|
+
onCancelClick: handleSearchClear,
|
|
637
629
|
onFocus: handleSearchFocus,
|
|
638
630
|
onBlur: handleSearchBlur,
|
|
639
631
|
focusedWidth: searchFocusWidth
|