@swisspost/internet-header 1.13.1 → 1.13.3
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/dist/cjs/if.component-31542061.js +12 -0
- package/dist/cjs/{if.component-2cd3c1ff.js.map → if.component-31542061.js.map} +1 -1
- package/dist/cjs/{index-4bd0adf1.js → index-8cbf8194.js} +141 -81
- package/dist/cjs/index-8cbf8194.js.map +1 -0
- package/dist/cjs/index.cjs.js +18 -18
- package/dist/cjs/{klp-widget.controller-8baf3b8a.js → klp-widget.controller-7fbe23c3.js} +11 -11
- package/dist/cjs/{klp-widget.controller-8baf3b8a.js.map → klp-widget.controller-7fbe23c3.js.map} +1 -1
- package/dist/cjs/language.service-11e7d8c1.js +182 -0
- package/dist/cjs/language.service-11e7d8c1.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/{esm/post-internet-breadcrumbs-f268030c.js → cjs/post-internet-breadcrumbs-f5e20904.js} +278 -276
- package/dist/cjs/post-internet-breadcrumbs-f5e20904.js.map +1 -0
- package/dist/cjs/post-internet-footer-d222e56d.js +161 -0
- package/dist/cjs/post-internet-footer-d222e56d.js.map +1 -0
- package/dist/cjs/post-internet-header-befc7a3f.js +847 -0
- package/dist/cjs/post-internet-header-befc7a3f.js.map +1 -0
- package/dist/cjs/post-klp-login-widget-01eee964.js +63 -0
- package/dist/cjs/{post-klp-login-widget-5380708a.js.map → post-klp-login-widget-01eee964.js.map} +1 -1
- package/dist/cjs/post-klp-login-widget.cjs.entry.js +5 -5
- package/dist/cjs/{post-language-switch-422af4d0.js → post-language-switch-59e1e832.js} +88 -88
- package/dist/cjs/post-language-switch-59e1e832.js.map +1 -0
- package/dist/cjs/post-language-switch.cjs.entry.js +7 -7
- package/dist/cjs/{post-logo-5867ad55.js → post-logo-6d127981.js} +14 -14
- package/dist/cjs/{post-logo-5867ad55.js.map → post-logo-6d127981.js.map} +1 -1
- package/dist/cjs/post-logo.cjs.entry.js +3 -3
- package/dist/cjs/post-main-navigation-d34e9799.js +240 -0
- package/dist/cjs/post-main-navigation-d34e9799.js.map +1 -0
- package/dist/cjs/post-main-navigation.cjs.entry.js +7 -7
- package/dist/cjs/{post-meta-navigation-0b73779f.js → post-meta-navigation-ac31cee4.js} +15 -15
- package/dist/cjs/{post-meta-navigation-0b73779f.js.map → post-meta-navigation-ac31cee4.js.map} +1 -1
- package/dist/cjs/post-meta-navigation.cjs.entry.js +3 -3
- package/dist/cjs/{post-search-7eb0a7a2.js → post-search-ac307fd7.js} +438 -438
- package/dist/cjs/post-search-ac307fd7.js.map +1 -0
- package/dist/cjs/post-search.cjs.entry.js +8 -8
- package/dist/cjs/post-skiplinks-74f15d34.js +52 -0
- package/dist/cjs/{post-skiplinks-3db1d214.js.map → post-skiplinks-74f15d34.js.map} +1 -1
- package/dist/cjs/post-skiplinks.cjs.entry.js +5 -5
- package/dist/cjs/{store-77668e50.js → store-dffccc44.js} +10 -10
- package/dist/cjs/store-dffccc44.js.map +1 -0
- package/dist/cjs/{svg-icon.component-5965f301.js → svg-icon.component-65508d78.js} +3 -3
- package/dist/cjs/{svg-icon.component-5965f301.js.map → svg-icon.component-65508d78.js.map} +1 -1
- package/dist/cjs/svg-sprite.component-dc109568.js +51 -0
- package/dist/cjs/{svg-sprite.component-68369645.js.map → svg-sprite.component-dc109568.js.map} +1 -1
- package/dist/cjs/swisspost-internet-breadcrumbs.cjs.entry.js +7 -7
- package/dist/cjs/swisspost-internet-footer.cjs.entry.js +5 -5
- package/dist/cjs/swisspost-internet-header.cjs.entry.js +8 -8
- package/dist/cjs/swisspost-internet-header.cjs.js +3 -3
- package/dist/cjs/swisspost-internet-header.cjs.js.map +1 -1
- package/dist/cjs/{ui.service-488151be.js → ui.service-7334148b.js} +5 -5
- package/dist/cjs/{ui.service-488151be.js.map → ui.service-7334148b.js.map} +1 -1
- package/dist/cjs/{utils-717975e0.js → utils-0a793763.js} +7 -7
- package/dist/cjs/{utils-717975e0.js.map → utils-0a793763.js.map} +1 -1
- package/dist/collection/assets/i18n/translations.js +65 -65
- package/dist/collection/assets/i18n/translations.js.map +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/post-internet-breadcrumbs/components/breadcrumb-list.component.js +4 -4
- package/dist/collection/components/post-internet-breadcrumbs/components/breadcrumb-list.component.js.map +1 -1
- package/dist/collection/components/post-internet-breadcrumbs/components/focus-trap.component.js +28 -28
- package/dist/collection/components/post-internet-breadcrumbs/components/focus-trap.component.js.map +1 -1
- package/dist/collection/components/post-internet-breadcrumbs/components/middle-dropdown.component.js +1 -1
- package/dist/collection/components/post-internet-breadcrumbs/components/middle-dropdown.component.js.map +1 -1
- package/dist/collection/components/post-internet-breadcrumbs/components/middle-links.component.js +1 -1
- package/dist/collection/components/post-internet-breadcrumbs/components/middle-links.component.js.map +1 -1
- package/dist/collection/components/post-internet-breadcrumbs/components/overlay.component.js.map +1 -1
- package/dist/collection/components/post-internet-breadcrumbs/post-internet-breadcrumbs.css +1 -1
- package/dist/collection/components/post-internet-breadcrumbs/post-internet-breadcrumbs.js +288 -290
- package/dist/collection/components/post-internet-breadcrumbs/post-internet-breadcrumbs.js.map +1 -1
- package/dist/collection/components/post-internet-footer/components/post-footer-block-address.component.js +7 -7
- package/dist/collection/components/post-internet-footer/components/post-footer-block-address.component.js.map +1 -1
- package/dist/collection/components/post-internet-footer/components/post-footer-block-contact.component.js +16 -16
- package/dist/collection/components/post-internet-footer/components/post-footer-block-contact.component.js.map +1 -1
- package/dist/collection/components/post-internet-footer/components/post-footer-block-custom.component.js +2 -2
- package/dist/collection/components/post-internet-footer/components/post-footer-block-custom.component.js.map +1 -1
- package/dist/collection/components/post-internet-footer/components/post-footer-block-list.component.js +2 -2
- package/dist/collection/components/post-internet-footer/components/post-footer-block-list.component.js.map +1 -1
- package/dist/collection/components/post-internet-footer/components/post-footer-block-socials.component.js +1 -1
- package/dist/collection/components/post-internet-footer/components/post-footer-block-socials.component.js.map +1 -1
- package/dist/collection/components/post-internet-footer/post-internet-footer.css +1 -1
- package/dist/collection/components/post-internet-footer/post-internet-footer.js +82 -82
- package/dist/collection/components/post-internet-footer/post-internet-footer.js.map +1 -1
- package/dist/collection/components/post-internet-header/logo-animation/logo-animation.js +42 -42
- package/dist/collection/components/post-internet-header/logo-animation/logo-animation.js.map +1 -1
- package/dist/collection/components/post-internet-header/post-internet-header.css +1 -1
- package/dist/collection/components/post-internet-header/post-internet-header.js +707 -701
- package/dist/collection/components/post-internet-header/post-internet-header.js.map +1 -1
- package/dist/collection/components/post-klp-login-widget/klp-widget.controller.js +10 -10
- package/dist/collection/components/post-klp-login-widget/klp-widget.controller.js.map +1 -1
- package/dist/collection/components/post-klp-login-widget/post-klp-login-widget.css +1 -1
- package/dist/collection/components/post-klp-login-widget/post-klp-login-widget.js +99 -99
- package/dist/collection/components/post-klp-login-widget/post-klp-login-widget.js.map +1 -1
- package/dist/collection/components/post-language-switch/components/post-language-switch-list.js +10 -10
- package/dist/collection/components/post-language-switch/components/post-language-switch-list.js.map +1 -1
- package/dist/collection/components/post-language-switch/post-language-switch.js +169 -171
- package/dist/collection/components/post-language-switch/post-language-switch.js.map +1 -1
- package/dist/collection/components/post-logo/post-logo.js +20 -20
- package/dist/collection/components/post-logo/post-logo.js.map +1 -1
- package/dist/collection/components/post-main-navigation/components/level-one-action.component.js +9 -9
- package/dist/collection/components/post-main-navigation/components/level-one-action.component.js.map +1 -1
- package/dist/collection/components/post-main-navigation/post-main-navigation.css +1 -1
- package/dist/collection/components/post-main-navigation/post-main-navigation.js +313 -317
- package/dist/collection/components/post-main-navigation/post-main-navigation.js.map +1 -1
- package/dist/collection/components/post-meta-navigation/post-meta-navigation.js +62 -62
- package/dist/collection/components/post-meta-navigation/post-meta-navigation.js.map +1 -1
- package/dist/collection/components/post-search/post-search.js +367 -369
- package/dist/collection/components/post-search/post-search.js.map +1 -1
- package/dist/collection/components/post-skiplinks/post-skiplinks.js +44 -44
- package/dist/collection/components/post-skiplinks/post-skiplinks.js.map +1 -1
- package/dist/collection/data/store.js +8 -8
- package/dist/collection/data/store.js.map +1 -1
- package/dist/collection/models/geocode.model.js +6 -6
- package/dist/collection/models/geocode.model.js.map +1 -1
- package/dist/collection/services/config.service.js +116 -116
- package/dist/collection/services/config.service.js.map +1 -1
- package/dist/collection/services/language.service.js +66 -66
- package/dist/collection/services/language.service.js.map +1 -1
- package/dist/collection/services/route.service.js +105 -105
- package/dist/collection/services/route.service.js.map +1 -1
- package/dist/collection/services/search/coveo.service.js +28 -28
- package/dist/collection/services/search/coveo.service.js.map +1 -1
- package/dist/collection/services/search/coveo.settings.js +30 -30
- package/dist/collection/services/search/coveo.settings.js.map +1 -1
- package/dist/collection/services/search/parcel.service.js +29 -29
- package/dist/collection/services/search/parcel.service.js.map +1 -1
- package/dist/collection/services/search/places.service.js +44 -44
- package/dist/collection/services/search/places.service.js.map +1 -1
- package/dist/collection/services/search/places.settings.js +10 -10
- package/dist/collection/services/search/places.settings.js.map +1 -1
- package/dist/collection/services/search/search-utilities.js +3 -3
- package/dist/collection/services/search/search-utilities.js.map +1 -1
- package/dist/collection/services/search/search.service.js +13 -13
- package/dist/collection/services/search/search.service.js.map +1 -1
- package/dist/collection/services/ui.service.js +4 -4
- package/dist/collection/services/ui.service.js.map +1 -1
- package/dist/collection/utils/highlighted.component.js +7 -7
- package/dist/collection/utils/highlighted.component.js.map +1 -1
- package/dist/collection/utils/if.component.js +4 -4
- package/dist/collection/utils/if.component.js.map +1 -1
- package/dist/collection/utils/scrollparent.js +18 -15
- package/dist/collection/utils/scrollparent.js.map +1 -1
- package/dist/collection/utils/svg-icon.component.js.map +1 -1
- package/dist/collection/utils/svg-sprite.component.js.map +1 -1
- package/dist/collection/utils/utils.js +6 -6
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/index.js +18 -18
- package/dist/components/klp-widget.controller.js +10 -10
- package/dist/components/klp-widget.controller.js.map +1 -1
- package/dist/components/language.service.js +131 -131
- package/dist/components/language.service.js.map +1 -1
- package/dist/components/post-klp-login-widget.d.ts +2 -2
- package/dist/components/post-klp-login-widget2.js +61 -61
- package/dist/components/post-klp-login-widget2.js.map +1 -1
- package/dist/components/post-language-switch.d.ts +2 -2
- package/dist/components/post-language-switch2.js +99 -99
- package/dist/components/post-language-switch2.js.map +1 -1
- package/dist/components/post-logo.d.ts +2 -2
- package/dist/components/post-logo2.js +25 -25
- package/dist/components/post-logo2.js.map +1 -1
- package/dist/components/post-main-navigation.d.ts +2 -2
- package/dist/components/post-main-navigation2.js +221 -221
- package/dist/components/post-main-navigation2.js.map +1 -1
- package/dist/components/post-meta-navigation.d.ts +2 -2
- package/dist/components/post-meta-navigation2.js +29 -29
- package/dist/components/post-meta-navigation2.js.map +1 -1
- package/dist/components/post-search.d.ts +2 -2
- package/dist/components/post-search2.js +455 -455
- package/dist/components/post-search2.js.map +1 -1
- package/dist/components/post-skiplinks.d.ts +2 -2
- package/dist/components/post-skiplinks2.js +46 -46
- package/dist/components/post-skiplinks2.js.map +1 -1
- package/dist/components/store.js +8 -8
- package/dist/components/store.js.map +1 -1
- package/dist/components/svg-icon.component.js +1 -1
- package/dist/components/svg-icon.component.js.map +1 -1
- package/dist/components/svg-sprite.component.js +42 -42
- package/dist/components/svg-sprite.component.js.map +1 -1
- package/dist/components/swisspost-internet-breadcrumbs.d.ts +2 -2
- package/dist/components/swisspost-internet-breadcrumbs.js +286 -286
- package/dist/components/swisspost-internet-breadcrumbs.js.map +1 -1
- package/dist/components/swisspost-internet-footer.d.ts +2 -2
- package/dist/components/swisspost-internet-footer.js +138 -138
- package/dist/components/swisspost-internet-footer.js.map +1 -1
- package/dist/components/swisspost-internet-header.d.ts +2 -2
- package/dist/components/swisspost-internet-header.js +687 -667
- package/dist/components/swisspost-internet-header.js.map +1 -1
- package/dist/components/ui.service.js +4 -4
- package/dist/components/ui.service.js.map +1 -1
- package/dist/components/utils.js +6 -6
- package/dist/components/utils.js.map +1 -1
- package/dist/docs.d.ts +1 -21
- package/dist/docs.json +53 -43
- package/dist/esm/if.component-d88d9e48.js +10 -0
- package/dist/esm/{if.component-3a779aca.js.map → if.component-d88d9e48.js.map} +1 -1
- package/dist/esm/{index-2b83f5e9.js → index-54145c02.js} +141 -81
- package/dist/esm/index-54145c02.js.map +1 -0
- package/dist/esm/index.js +18 -18
- package/dist/esm/{klp-widget.controller-668f7e8d.js → klp-widget.controller-549d5132.js} +11 -11
- package/dist/esm/{klp-widget.controller-668f7e8d.js.map → klp-widget.controller-549d5132.js.map} +1 -1
- package/dist/esm/language.service-1bd090a7.js +178 -0
- package/dist/esm/language.service-1bd090a7.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/{cjs/post-internet-breadcrumbs-e3ee842c.js → esm/post-internet-breadcrumbs-16b4d1eb.js} +276 -278
- package/dist/esm/post-internet-breadcrumbs-16b4d1eb.js.map +1 -0
- package/dist/esm/post-internet-footer-211748e4.js +159 -0
- package/dist/esm/post-internet-footer-211748e4.js.map +1 -0
- package/dist/esm/post-internet-header-91c9a423.js +845 -0
- package/dist/esm/post-internet-header-91c9a423.js.map +1 -0
- package/dist/esm/post-klp-login-widget-cac28bb1.js +61 -0
- package/dist/esm/{post-klp-login-widget-57a4fdb5.js.map → post-klp-login-widget-cac28bb1.js.map} +1 -1
- package/dist/esm/post-klp-login-widget.entry.js +5 -5
- package/dist/esm/{post-language-switch-997ee4f9.js → post-language-switch-7df96469.js} +88 -88
- package/dist/esm/post-language-switch-7df96469.js.map +1 -0
- package/dist/esm/post-language-switch.entry.js +7 -7
- package/dist/esm/{post-logo-cde3c44d.js → post-logo-050acfc4.js} +14 -14
- package/dist/esm/{post-logo-cde3c44d.js.map → post-logo-050acfc4.js.map} +1 -1
- package/dist/esm/post-logo.entry.js +3 -3
- package/dist/esm/post-main-navigation-1735be3c.js +238 -0
- package/dist/esm/post-main-navigation-1735be3c.js.map +1 -0
- package/dist/esm/post-main-navigation.entry.js +7 -7
- package/dist/esm/{post-meta-navigation-09e9bdc8.js → post-meta-navigation-ece1e9de.js} +15 -15
- package/dist/esm/{post-meta-navigation-09e9bdc8.js.map → post-meta-navigation-ece1e9de.js.map} +1 -1
- package/dist/esm/post-meta-navigation.entry.js +3 -3
- package/dist/esm/{post-search-a7f2e856.js → post-search-efd16c09.js} +438 -438
- package/dist/esm/post-search-efd16c09.js.map +1 -0
- package/dist/esm/post-search.entry.js +8 -8
- package/dist/esm/post-skiplinks-c6b5addd.js +50 -0
- package/dist/esm/{post-skiplinks-b3c32a77.js.map → post-skiplinks-c6b5addd.js.map} +1 -1
- package/dist/esm/post-skiplinks.entry.js +5 -5
- package/dist/esm/{store-80b19c12.js → store-c0bc1c5b.js} +10 -10
- package/dist/esm/store-c0bc1c5b.js.map +1 -0
- package/dist/esm/svg-icon.component-fe96fac6.js +8 -0
- package/dist/esm/{svg-icon.component-7295f7cc.js.map → svg-icon.component-fe96fac6.js.map} +1 -1
- package/dist/esm/svg-sprite.component-4874b2fb.js +49 -0
- package/dist/esm/{svg-sprite.component-cfc05f90.js.map → svg-sprite.component-4874b2fb.js.map} +1 -1
- package/dist/esm/swisspost-internet-breadcrumbs.entry.js +7 -7
- package/dist/esm/swisspost-internet-footer.entry.js +5 -5
- package/dist/esm/swisspost-internet-header.entry.js +8 -8
- package/dist/esm/swisspost-internet-header.js +4 -4
- package/dist/esm/swisspost-internet-header.js.map +1 -1
- package/dist/esm/{ui.service-a71cf490.js → ui.service-22f2c593.js} +5 -5
- package/dist/esm/{ui.service-a71cf490.js.map → ui.service-22f2c593.js.map} +1 -1
- package/dist/esm/{utils-3a8ff48f.js → utils-c8805f81.js} +7 -7
- package/dist/esm/{utils-3a8ff48f.js.map → utils-c8805f81.js.map} +1 -1
- package/dist/esm-es5/bodyScrollLock.esm-afcc00e3.js.map +1 -1
- package/dist/esm-es5/{if.component-3a779aca.js → if.component-d88d9e48.js} +1 -1
- package/dist/esm-es5/index-54145c02.js +2 -0
- package/dist/esm-es5/index-54145c02.js.map +1 -0
- package/dist/esm-es5/index-d2256e06.js.map +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{klp-widget.controller-668f7e8d.js → klp-widget.controller-549d5132.js} +10 -10
- package/dist/{swisspost-internet-header/p-5f246e59.system.js.map → esm-es5/klp-widget.controller-549d5132.js.map} +1 -1
- package/dist/esm-es5/{language.service-501b09a8.js → language.service-1bd090a7.js} +2 -2
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/post-internet-breadcrumbs-16b4d1eb.js +7 -0
- package/dist/{swisspost-internet-header/p-bd893111.system.js.map → esm-es5/post-internet-breadcrumbs-16b4d1eb.js.map} +1 -1
- package/dist/esm-es5/{post-internet-footer-3a501420.js → post-internet-footer-211748e4.js} +2 -2
- package/dist/esm-es5/{post-internet-footer-3a501420.js.map → post-internet-footer-211748e4.js.map} +1 -1
- package/dist/esm-es5/post-internet-header-91c9a423.js +2 -0
- package/dist/esm-es5/post-internet-header-91c9a423.js.map +1 -0
- package/dist/esm-es5/post-klp-login-widget-cac28bb1.js +2 -0
- package/dist/esm-es5/{post-klp-login-widget-57a4fdb5.js.map → post-klp-login-widget-cac28bb1.js.map} +1 -1
- package/dist/esm-es5/post-klp-login-widget.entry.js +1 -1
- package/dist/esm-es5/{post-language-switch-997ee4f9.js → post-language-switch-7df96469.js} +2 -2
- package/dist/esm-es5/post-language-switch.entry.js +1 -1
- package/dist/esm-es5/{post-logo-cde3c44d.js → post-logo-050acfc4.js} +2 -2
- package/dist/esm-es5/post-logo.entry.js +1 -1
- package/dist/esm-es5/post-main-navigation-1735be3c.js +2 -0
- package/dist/esm-es5/post-main-navigation-1735be3c.js.map +1 -0
- package/dist/esm-es5/post-main-navigation.entry.js +1 -1
- package/dist/esm-es5/{post-meta-navigation-09e9bdc8.js → post-meta-navigation-ece1e9de.js} +2 -2
- package/dist/esm-es5/post-meta-navigation.entry.js +1 -1
- package/dist/esm-es5/{post-search-a7f2e856.js → post-search-efd16c09.js} +2 -2
- package/dist/esm-es5/post-search.entry.js +1 -1
- package/dist/esm-es5/{post-skiplinks-b3c32a77.js → post-skiplinks-c6b5addd.js} +2 -2
- package/dist/esm-es5/post-skiplinks.entry.js +1 -1
- package/dist/esm-es5/{store-80b19c12.js → store-c0bc1c5b.js} +2 -2
- package/dist/esm-es5/store-c0bc1c5b.js.map +1 -0
- package/dist/esm-es5/svg-icon.component-fe96fac6.js +2 -0
- package/dist/esm-es5/{svg-sprite.component-cfc05f90.js → svg-sprite.component-4874b2fb.js} +2 -2
- package/dist/esm-es5/swisspost-internet-breadcrumbs.entry.js +1 -1
- package/dist/esm-es5/swisspost-internet-footer.entry.js +1 -1
- package/dist/esm-es5/swisspost-internet-header.entry.js +1 -1
- package/dist/esm-es5/swisspost-internet-header.js +1 -1
- package/dist/esm-es5/swisspost-internet-header.js.map +1 -1
- package/dist/esm-es5/{ui.service-a71cf490.js → ui.service-22f2c593.js} +1 -1
- package/dist/esm-es5/{utils-3a8ff48f.js → utils-c8805f81.js} +1 -1
- package/dist/swisspost-internet-header/index.esm.js +1 -1
- package/dist/swisspost-internet-header/{p-96618f42.system.js → p-0338115d.system.js} +2 -2
- package/dist/swisspost-internet-header/{p-7ab3cbcb.js → p-0589b170.js} +2 -2
- package/dist/swisspost-internet-header/{p-788cf356.js → p-0606dca1.js} +2 -2
- package/dist/swisspost-internet-header/{p-788cf356.js.map → p-0606dca1.js.map} +1 -1
- package/dist/swisspost-internet-header/{p-986a52bc.system.js → p-06f51515.system.js} +1 -1
- package/dist/swisspost-internet-header/p-07313f1b.system.entry.js +2 -0
- package/dist/swisspost-internet-header/{p-16676174.system.js → p-11d02764.system.js} +2 -2
- package/dist/swisspost-internet-header/p-1244a33a.entry.js +2 -0
- package/dist/swisspost-internet-header/p-14b0f654.js +3 -0
- package/dist/swisspost-internet-header/p-14b0f654.js.map +1 -0
- package/dist/swisspost-internet-header/p-1c722d02.system.entry.js +2 -0
- package/dist/swisspost-internet-header/p-1cb8fe46.entry.js +2 -0
- package/dist/swisspost-internet-header/{p-f2a43ce2.system.js → p-1fd8561a.system.js} +1 -1
- package/dist/swisspost-internet-header/{p-7eaa5689.js → p-2a8d5787.js} +1 -1
- package/dist/swisspost-internet-header/p-2eb28b7c.js +2 -0
- package/dist/swisspost-internet-header/p-2eb28b7c.js.map +1 -0
- package/dist/swisspost-internet-header/p-2f221bb5.system.js +2 -0
- package/dist/swisspost-internet-header/p-2f221bb5.system.js.map +1 -0
- package/dist/swisspost-internet-header/p-3759e0aa.entry.js +2 -0
- package/dist/swisspost-internet-header/p-3985d762.js +7 -0
- package/dist/swisspost-internet-header/{p-f6a2a74f.js.map → p-3985d762.js.map} +1 -1
- package/dist/swisspost-internet-header/p-3bcc322e.system.js +2 -0
- package/dist/swisspost-internet-header/p-3bcc322e.system.js.map +1 -0
- package/dist/swisspost-internet-header/p-3e62c7a9.js +2 -0
- package/dist/swisspost-internet-header/p-3e62c7a9.js.map +1 -0
- package/dist/swisspost-internet-header/p-434dbf16.system.js +7 -0
- package/dist/{esm-es5/post-internet-breadcrumbs-f268030c.js.map → swisspost-internet-header/p-434dbf16.system.js.map} +1 -1
- package/dist/swisspost-internet-header/p-4380032a.entry.js +2 -0
- package/dist/swisspost-internet-header/{p-78e8a405.js → p-4bc05e68.js} +2 -2
- package/dist/swisspost-internet-header/p-5498ca7c.entry.js +2 -0
- package/dist/swisspost-internet-header/{p-a7de7323.system.js → p-5a69c918.system.js} +2 -2
- package/dist/swisspost-internet-header/p-5ac16bdd.system.entry.js +2 -0
- package/dist/swisspost-internet-header/{p-624d732c.js → p-5c2bb553.js} +2 -2
- package/dist/swisspost-internet-header/p-5c2bb553.js.map +1 -0
- package/dist/swisspost-internet-header/p-6d60866a.system.entry.js +2 -0
- package/dist/swisspost-internet-header/p-7505c3e1.system.entry.js +2 -0
- package/dist/swisspost-internet-header/{p-3a7f9457.js → p-7d188581.js} +2 -2
- package/dist/swisspost-internet-header/{p-cf06f703.js → p-840aa5c6.js} +1 -1
- package/dist/swisspost-internet-header/p-87756f7c.system.js +2 -0
- package/dist/swisspost-internet-header/{p-d294420b.system.js.map → p-87756f7c.system.js.map} +1 -1
- package/dist/swisspost-internet-header/{p-dc8296bd.js → p-8a65e8d6.js} +2 -2
- package/dist/swisspost-internet-header/{p-40806042.system.js → p-8b9d7320.system.js} +2 -2
- package/dist/swisspost-internet-header/p-8df32cb8.system.js +2 -0
- package/dist/swisspost-internet-header/p-943d2956.system.entry.js +2 -0
- package/dist/swisspost-internet-header/p-948d3e8f.entry.js +2 -0
- package/dist/swisspost-internet-header/p-979ae0e8.js +2 -0
- package/dist/swisspost-internet-header/{p-236420dc.js.map → p-979ae0e8.js.map} +1 -1
- package/dist/swisspost-internet-header/{p-69d380ec.system.js → p-9b1e0d60.system.js} +2 -2
- package/dist/swisspost-internet-header/{p-69d380ec.system.js.map → p-9b1e0d60.system.js.map} +1 -1
- package/dist/swisspost-internet-header/p-9b4d5e90.system.js.map +1 -1
- package/dist/swisspost-internet-header/p-a08ee9d3.entry.js +2 -0
- package/dist/swisspost-internet-header/{p-3339310e.js → p-a39139a9.js} +1 -1
- package/dist/swisspost-internet-header/p-a4d04c0b.system.entry.js +2 -0
- package/dist/swisspost-internet-header/{p-5f246e59.system.js → p-a7bc91ca.system.js} +10 -10
- package/dist/{esm-es5/klp-widget.controller-668f7e8d.js.map → swisspost-internet-header/p-a7bc91ca.system.js.map} +1 -1
- package/dist/swisspost-internet-header/{p-9af33755.system.js → p-a9f840df.system.js} +2 -2
- package/dist/swisspost-internet-header/p-a9f840df.system.js.map +1 -0
- package/dist/swisspost-internet-header/p-b3014611.system.js.map +1 -1
- package/dist/swisspost-internet-header/p-b8c6f6a6.system.entry.js +2 -0
- package/dist/swisspost-internet-header/{p-46f2c38c.js → p-bc60a641.js} +2 -2
- package/dist/swisspost-internet-header/{p-0096509c.js → p-bfbb5fc7.js} +2 -2
- package/dist/swisspost-internet-header/p-c466f253.entry.js +2 -0
- package/dist/swisspost-internet-header/{p-70df9137.js → p-c7f451bd.js} +2 -2
- package/dist/swisspost-internet-header/p-c7fba36e.system.entry.js +2 -0
- package/dist/swisspost-internet-header/p-c8153649.js +2 -0
- package/dist/swisspost-internet-header/{p-ad9a417b.system.js → p-c895eccc.system.js} +2 -2
- package/dist/swisspost-internet-header/p-d6ab4ef3.entry.js +2 -0
- package/dist/swisspost-internet-header/{p-0e776d6e.system.js → p-d7e221af.system.js} +1 -1
- package/dist/swisspost-internet-header/p-da7b8486.system.entry.js +2 -0
- package/dist/swisspost-internet-header/{p-bbfd407b.js → p-dc2f1d20.js} +1 -1
- package/dist/swisspost-internet-header/{p-ee5e0cc6.system.js → p-dd800ff2.system.js} +2 -2
- package/dist/swisspost-internet-header/{p-34fe9d92.system.js → p-e2985a86.system.js} +2 -2
- package/dist/swisspost-internet-header/{p-18e9ce89.system.js → p-e5acc124.system.js} +2 -2
- package/dist/swisspost-internet-header/p-e7bd7ab7.system.js +2 -0
- package/dist/swisspost-internet-header/p-e7bd7ab7.system.js.map +1 -0
- package/dist/swisspost-internet-header/p-fe4736f9.system.js +3 -0
- package/dist/swisspost-internet-header/p-fe4736f9.system.js.map +1 -0
- package/dist/swisspost-internet-header/p-ff36437b.entry.js +2 -0
- package/dist/swisspost-internet-header/swisspost-internet-header.css +1 -1
- package/dist/swisspost-internet-header/swisspost-internet-header.esm.js +1 -1
- package/dist/swisspost-internet-header/swisspost-internet-header.esm.js.map +1 -1
- package/dist/swisspost-internet-header/swisspost-internet-header.js +15 -15
- package/dist/types/assets/i18n/translations.d.ts +65 -65
- package/dist/types/components/post-internet-breadcrumbs/components/breadcrumb-list.component.d.ts +6 -6
- package/dist/types/components/post-internet-breadcrumbs/components/focus-trap.component.d.ts +1 -1
- package/dist/types/components/post-internet-breadcrumbs/components/middle-dropdown.component.d.ts +4 -4
- package/dist/types/components/post-internet-breadcrumbs/components/middle-links.component.d.ts +3 -3
- package/dist/types/components/post-internet-breadcrumbs/components/overlay.component.d.ts +6 -6
- package/dist/types/components/post-internet-breadcrumbs/post-internet-breadcrumbs.d.ts +51 -51
- package/dist/types/components/post-internet-footer/components/post-footer-block-address.component.d.ts +2 -2
- package/dist/types/components/post-internet-footer/components/post-footer-block-contact.component.d.ts +3 -3
- package/dist/types/components/post-internet-footer/components/post-footer-block-custom.component.d.ts +1 -1
- package/dist/types/components/post-internet-footer/components/post-footer-block-list.component.d.ts +2 -2
- package/dist/types/components/post-internet-footer/components/post-footer-block-socials.component.d.ts +2 -2
- package/dist/types/components/post-internet-footer/post-internet-footer.d.ts +11 -11
- package/dist/types/components/post-internet-header/post-internet-header.d.ts +127 -125
- package/dist/types/components/post-klp-login-widget/post-klp-login-widget.d.ts +11 -11
- package/dist/types/components/post-language-switch/components/post-language-switch-list.d.ts +3 -3
- package/dist/types/components/post-language-switch/post-language-switch.d.ts +23 -23
- package/dist/types/components/post-logo/post-logo.d.ts +2 -2
- package/dist/types/components/post-main-navigation/components/level-one-action.component.d.ts +5 -5
- package/dist/types/components/post-main-navigation/post-main-navigation.d.ts +38 -38
- package/dist/types/components/post-meta-navigation/post-meta-navigation.d.ts +3 -3
- package/dist/types/components/post-search/post-search.d.ts +65 -65
- package/dist/types/components/post-skiplinks/post-skiplinks.d.ts +7 -7
- package/dist/types/data/store.d.ts +11 -11
- package/dist/types/models/breadcrumbs.model.d.ts +25 -25
- package/dist/types/models/coveo.model.d.ts +14 -14
- package/dist/types/models/footer.model.d.ts +35 -35
- package/dist/types/models/general.model.d.ts +36 -36
- package/dist/types/models/geocode.model.d.ts +42 -42
- package/dist/types/models/header.model.d.ts +123 -123
- package/dist/types/models/implementor.model.d.ts +5 -5
- package/dist/types/models/language.model.d.ts +4 -4
- package/dist/types/models/track-and-trace.model.d.ts +22 -22
- package/dist/types/services/language.service.d.ts +65 -65
- package/dist/types/services/search/parcel.service.d.ts +1 -1
- package/dist/types/stencil-public-runtime.d.ts +8 -0
- package/dist/types/utils/highlighted.component.d.ts +2 -2
- package/dist/types/utils/if.component.d.ts +1 -1
- package/dist/types/utils/svg-icon.component.d.ts +2 -2
- package/package.json +24 -14
- package/readme.md +1 -1
- package/dist/cjs/if.component-2cd3c1ff.js +0 -12
- package/dist/cjs/index-4bd0adf1.js.map +0 -1
- package/dist/cjs/language.service-dbe2a435.js +0 -182
- package/dist/cjs/language.service-dbe2a435.js.map +0 -1
- package/dist/cjs/post-internet-breadcrumbs-e3ee842c.js.map +0 -1
- package/dist/cjs/post-internet-footer-16117586.js +0 -161
- package/dist/cjs/post-internet-footer-16117586.js.map +0 -1
- package/dist/cjs/post-internet-header-08840fbe.js +0 -828
- package/dist/cjs/post-internet-header-08840fbe.js.map +0 -1
- package/dist/cjs/post-klp-login-widget-5380708a.js +0 -63
- package/dist/cjs/post-language-switch-422af4d0.js.map +0 -1
- package/dist/cjs/post-main-navigation-2c9e953e.js +0 -240
- package/dist/cjs/post-main-navigation-2c9e953e.js.map +0 -1
- package/dist/cjs/post-search-7eb0a7a2.js.map +0 -1
- package/dist/cjs/post-skiplinks-3db1d214.js +0 -52
- package/dist/cjs/store-77668e50.js.map +0 -1
- package/dist/cjs/svg-sprite.component-68369645.js +0 -51
- package/dist/esm/if.component-3a779aca.js +0 -10
- package/dist/esm/index-2b83f5e9.js.map +0 -1
- package/dist/esm/language.service-501b09a8.js +0 -178
- package/dist/esm/language.service-501b09a8.js.map +0 -1
- package/dist/esm/post-internet-breadcrumbs-f268030c.js.map +0 -1
- package/dist/esm/post-internet-footer-3a501420.js +0 -159
- package/dist/esm/post-internet-footer-3a501420.js.map +0 -1
- package/dist/esm/post-internet-header-36aaba35.js +0 -826
- package/dist/esm/post-internet-header-36aaba35.js.map +0 -1
- package/dist/esm/post-klp-login-widget-57a4fdb5.js +0 -61
- package/dist/esm/post-language-switch-997ee4f9.js.map +0 -1
- package/dist/esm/post-main-navigation-77520c14.js +0 -238
- package/dist/esm/post-main-navigation-77520c14.js.map +0 -1
- package/dist/esm/post-search-a7f2e856.js.map +0 -1
- package/dist/esm/post-skiplinks-b3c32a77.js +0 -50
- package/dist/esm/store-80b19c12.js.map +0 -1
- package/dist/esm/svg-icon.component-7295f7cc.js +0 -8
- package/dist/esm/svg-sprite.component-cfc05f90.js +0 -49
- package/dist/esm-es5/index-2b83f5e9.js +0 -2
- package/dist/esm-es5/index-2b83f5e9.js.map +0 -1
- package/dist/esm-es5/post-internet-breadcrumbs-f268030c.js +0 -7
- package/dist/esm-es5/post-internet-header-36aaba35.js +0 -2
- package/dist/esm-es5/post-internet-header-36aaba35.js.map +0 -1
- package/dist/esm-es5/post-klp-login-widget-57a4fdb5.js +0 -2
- package/dist/esm-es5/post-main-navigation-77520c14.js +0 -2
- package/dist/esm-es5/post-main-navigation-77520c14.js.map +0 -1
- package/dist/esm-es5/store-80b19c12.js.map +0 -1
- package/dist/esm-es5/svg-icon.component-7295f7cc.js +0 -2
- package/dist/swisspost-internet-header/p-094eab7e.system.entry.js +0 -2
- package/dist/swisspost-internet-header/p-0f1f2469.system.js +0 -2
- package/dist/swisspost-internet-header/p-0f1f2469.system.js.map +0 -1
- package/dist/swisspost-internet-header/p-1a6d00a4.system.entry.js +0 -2
- package/dist/swisspost-internet-header/p-1bdc4b7b.js +0 -2
- package/dist/swisspost-internet-header/p-1bdc4b7b.js.map +0 -1
- package/dist/swisspost-internet-header/p-2340f9f1.entry.js +0 -2
- package/dist/swisspost-internet-header/p-236420dc.js +0 -2
- package/dist/swisspost-internet-header/p-2470951e.js +0 -2
- package/dist/swisspost-internet-header/p-2c612086.entry.js +0 -2
- package/dist/swisspost-internet-header/p-2eb179a7.entry.js +0 -2
- package/dist/swisspost-internet-header/p-3672587a.entry.js +0 -2
- package/dist/swisspost-internet-header/p-3bdf4efd.entry.js +0 -2
- package/dist/swisspost-internet-header/p-4248f499.system.entry.js +0 -2
- package/dist/swisspost-internet-header/p-5adcdd91.system.js +0 -2
- package/dist/swisspost-internet-header/p-5adcdd91.system.js.map +0 -1
- package/dist/swisspost-internet-header/p-606bd3f1.entry.js +0 -2
- package/dist/swisspost-internet-header/p-619bb76e.system.entry.js +0 -2
- package/dist/swisspost-internet-header/p-624d732c.js.map +0 -1
- package/dist/swisspost-internet-header/p-65ce36ba.entry.js +0 -2
- package/dist/swisspost-internet-header/p-669ed0d2.entry.js +0 -2
- package/dist/swisspost-internet-header/p-6e3b3c7a.system.js +0 -2
- package/dist/swisspost-internet-header/p-837fe525.system.entry.js +0 -2
- package/dist/swisspost-internet-header/p-83de3104.system.entry.js +0 -2
- package/dist/swisspost-internet-header/p-8ceafc83.js +0 -2
- package/dist/swisspost-internet-header/p-8ceafc83.js.map +0 -1
- package/dist/swisspost-internet-header/p-9af33755.system.js.map +0 -1
- package/dist/swisspost-internet-header/p-9c385f74.system.js +0 -3
- package/dist/swisspost-internet-header/p-9c385f74.system.js.map +0 -1
- package/dist/swisspost-internet-header/p-a0f5c014.system.entry.js +0 -2
- package/dist/swisspost-internet-header/p-a290e3e2.system.entry.js +0 -2
- package/dist/swisspost-internet-header/p-a5eda6dc.entry.js +0 -2
- package/dist/swisspost-internet-header/p-bd893111.system.js +0 -7
- package/dist/swisspost-internet-header/p-c0705313.system.entry.js +0 -2
- package/dist/swisspost-internet-header/p-c6bf4781.system.entry.js +0 -2
- package/dist/swisspost-internet-header/p-d294420b.system.js +0 -2
- package/dist/swisspost-internet-header/p-e2e1c5d4.js +0 -3
- package/dist/swisspost-internet-header/p-e2e1c5d4.js.map +0 -1
- package/dist/swisspost-internet-header/p-e81673c2.entry.js +0 -2
- package/dist/swisspost-internet-header/p-ea99866e.system.js +0 -2
- package/dist/swisspost-internet-header/p-ea99866e.system.js.map +0 -1
- package/dist/swisspost-internet-header/p-f6a2a74f.js +0 -7
- /package/dist/esm-es5/{if.component-3a779aca.js.map → if.component-d88d9e48.js.map} +0 -0
- /package/dist/esm-es5/{language.service-501b09a8.js.map → language.service-1bd090a7.js.map} +0 -0
- /package/dist/esm-es5/{post-language-switch-997ee4f9.js.map → post-language-switch-7df96469.js.map} +0 -0
- /package/dist/esm-es5/{post-logo-cde3c44d.js.map → post-logo-050acfc4.js.map} +0 -0
- /package/dist/esm-es5/{post-meta-navigation-09e9bdc8.js.map → post-meta-navigation-ece1e9de.js.map} +0 -0
- /package/dist/esm-es5/{post-search-a7f2e856.js.map → post-search-efd16c09.js.map} +0 -0
- /package/dist/esm-es5/{post-skiplinks-b3c32a77.js.map → post-skiplinks-c6b5addd.js.map} +0 -0
- /package/dist/esm-es5/{svg-icon.component-7295f7cc.js.map → svg-icon.component-fe96fac6.js.map} +0 -0
- /package/dist/esm-es5/{svg-sprite.component-cfc05f90.js.map → svg-sprite.component-4874b2fb.js.map} +0 -0
- /package/dist/esm-es5/{ui.service-a71cf490.js.map → ui.service-22f2c593.js.map} +0 -0
- /package/dist/esm-es5/{utils-3a8ff48f.js.map → utils-c8805f81.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-96618f42.system.js.map → p-0338115d.system.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-7ab3cbcb.js.map → p-0589b170.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-986a52bc.system.js.map → p-06f51515.system.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-094eab7e.system.entry.js.map → p-07313f1b.system.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-16676174.system.js.map → p-11d02764.system.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-1a6d00a4.system.entry.js.map → p-1244a33a.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-2340f9f1.entry.js.map → p-1c722d02.system.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-2c612086.entry.js.map → p-1cb8fe46.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-f2a43ce2.system.js.map → p-1fd8561a.system.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-7eaa5689.js.map → p-2a8d5787.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-2eb179a7.entry.js.map → p-3759e0aa.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-3672587a.entry.js.map → p-4380032a.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-78e8a405.js.map → p-4bc05e68.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-3bdf4efd.entry.js.map → p-5498ca7c.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-a7de7323.system.js.map → p-5a69c918.system.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-4248f499.system.entry.js.map → p-5ac16bdd.system.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-606bd3f1.entry.js.map → p-6d60866a.system.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-619bb76e.system.entry.js.map → p-7505c3e1.system.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-3a7f9457.js.map → p-7d188581.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-cf06f703.js.map → p-840aa5c6.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-dc8296bd.js.map → p-8a65e8d6.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-40806042.system.js.map → p-8b9d7320.system.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-65ce36ba.entry.js.map → p-8df32cb8.system.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-669ed0d2.entry.js.map → p-943d2956.system.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-6e3b3c7a.system.js.map → p-948d3e8f.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-837fe525.system.entry.js.map → p-a08ee9d3.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-3339310e.js.map → p-a39139a9.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-83de3104.system.entry.js.map → p-a4d04c0b.system.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-a0f5c014.system.entry.js.map → p-b8c6f6a6.system.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-46f2c38c.js.map → p-bc60a641.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-0096509c.js.map → p-bfbb5fc7.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-a290e3e2.system.entry.js.map → p-c466f253.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-70df9137.js.map → p-c7f451bd.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-a5eda6dc.entry.js.map → p-c7fba36e.system.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-2470951e.js.map → p-c8153649.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-ad9a417b.system.js.map → p-c895eccc.system.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-c0705313.system.entry.js.map → p-d6ab4ef3.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-0e776d6e.system.js.map → p-d7e221af.system.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-c6bf4781.system.entry.js.map → p-da7b8486.system.entry.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-bbfd407b.js.map → p-dc2f1d20.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-ee5e0cc6.system.js.map → p-dd800ff2.system.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-34fe9d92.system.js.map → p-e2985a86.system.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-18e9ce89.system.js.map → p-e5acc124.system.js.map} +0 -0
- /package/dist/swisspost-internet-header/{p-e81673c2.entry.js.map → p-ff36437b.entry.js.map} +0 -0
|
@@ -20,39 +20,39 @@ import { d as defineCustomElement$2 } from './post-skiplinks2.js';
|
|
|
20
20
|
* @returns Modified Main Navigation Config
|
|
21
21
|
*/
|
|
22
22
|
const markActiveRoute = (config, activeRouteProp) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
// Set compare URL and check if activeRouteProp is valid
|
|
28
|
-
let compareUrl;
|
|
29
|
-
config = resetOverrideConfig(config);
|
|
30
|
-
if (activeRouteProp === 'auto' || activeRouteProp === 'exact') {
|
|
31
|
-
// Check if an active route is already configured, set override to that and return
|
|
32
|
-
if (hasActivePortalRoute(config)) {
|
|
33
|
-
return resetActiveStateToPortalConfig(config);
|
|
34
|
-
}
|
|
35
|
-
compareUrl = new URL(window.location.href);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
try {
|
|
39
|
-
compareUrl = new URL(activeRouteProp, document.location.origin);
|
|
23
|
+
// Don't highlight any route
|
|
24
|
+
if (activeRouteProp === false) {
|
|
25
|
+
return config;
|
|
40
26
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
27
|
+
// Set compare URL and check if activeRouteProp is valid
|
|
28
|
+
let compareUrl;
|
|
29
|
+
config = resetOverrideConfig(config);
|
|
30
|
+
if (activeRouteProp === 'auto' || activeRouteProp === 'exact') {
|
|
31
|
+
// Check if an active route is already configured, set override to that and return
|
|
32
|
+
if (hasActivePortalRoute(config)) {
|
|
33
|
+
return resetActiveStateToPortalConfig(config);
|
|
34
|
+
}
|
|
35
|
+
compareUrl = new URL(window.location.href);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
try {
|
|
39
|
+
compareUrl = new URL(activeRouteProp, document.location.origin);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
console.warn(`Active Route: ${activeRouteProp} is not a valid URL. Navigation highlighting has been disabled.`);
|
|
43
|
+
return config;
|
|
44
|
+
}
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
const scoreList = compileScoreList(config, compareUrl, activeRouteProp);
|
|
47
|
+
if (scoreList.length === 0) {
|
|
48
|
+
// No match found or already active links defined
|
|
49
|
+
return config;
|
|
50
|
+
}
|
|
51
|
+
const winnerPair = scoreList[0];
|
|
52
|
+
winnerPair.main.isActiveOverride = true;
|
|
53
|
+
if (winnerPair.sub)
|
|
54
|
+
winnerPair.sub.isActiveOverride = true;
|
|
49
55
|
return config;
|
|
50
|
-
}
|
|
51
|
-
const winnerPair = scoreList[0];
|
|
52
|
-
winnerPair.main.isActiveOverride = true;
|
|
53
|
-
if (winnerPair.sub)
|
|
54
|
-
winnerPair.sub.isActiveOverride = true;
|
|
55
|
-
return config;
|
|
56
56
|
};
|
|
57
57
|
/**
|
|
58
58
|
* Check if the portal config set any active route
|
|
@@ -60,13 +60,13 @@ const markActiveRoute = (config, activeRouteProp) => {
|
|
|
60
60
|
* @returns True if portal set any route as active
|
|
61
61
|
*/
|
|
62
62
|
const hasActivePortalRoute = (config) => {
|
|
63
|
-
|
|
63
|
+
return config.filter(nav => nav.isActive).length > 0;
|
|
64
64
|
};
|
|
65
65
|
const resetActiveStateToPortalConfig = (config) => {
|
|
66
|
-
|
|
66
|
+
return config.map(nav => (Object.assign(Object.assign({}, nav), { isActiveOverride: nav.isActive, flyout: nav.flyout.map(flyout => (Object.assign(Object.assign({}, flyout), { linkList: flyout.linkList.map(link => (Object.assign(Object.assign({}, link), { isActiveOverride: link.isActive }))) }))) })));
|
|
67
67
|
};
|
|
68
68
|
const resetOverrideConfig = (config) => {
|
|
69
|
-
|
|
69
|
+
return config.map(nav => (Object.assign(Object.assign({}, nav), { isActiveOverride: false, flyout: nav.flyout.map(flyout => (Object.assign(Object.assign({}, flyout), { linkList: flyout.linkList.map(link => (Object.assign(Object.assign({}, link), { isActiveOverride: false }))) }))) })));
|
|
70
70
|
};
|
|
71
71
|
/**
|
|
72
72
|
* Compile a list of scores based on the map mode, sorted in descending order
|
|
@@ -76,53 +76,53 @@ const resetOverrideConfig = (config) => {
|
|
|
76
76
|
* @returns A list of scored URLs if any matched
|
|
77
77
|
*/
|
|
78
78
|
const compileScoreList = (config, compareUrl, activeRouteProp) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
try {
|
|
86
|
-
const score = compareRoutes(compareUrl, new URL(mainNav.url), activeRouteProp);
|
|
87
|
-
hadAnyActiveLink = updateScoreList(scoreList, score, { main: mainNav, score }, hadAnyActiveLink);
|
|
88
|
-
}
|
|
89
|
-
catch (_a) {
|
|
90
|
-
// Not a valid url, continue
|
|
91
|
-
}
|
|
92
|
-
// Loop through flyout links 2nd level
|
|
93
|
-
mainNav.flyout.forEach(flyout => {
|
|
94
|
-
var _a;
|
|
95
|
-
(_a = flyout.linkList) === null || _a === void 0 ? void 0 : _a.forEach(linklist => {
|
|
96
|
-
// Don't override if any link is already active
|
|
97
|
-
if (linklist.isActive && (activeRouteProp === 'auto' || activeRouteProp === 'exact')) {
|
|
98
|
-
hadAnyActiveLink = true;
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
79
|
+
// Flag to check if the Portal set any active links or if there are any exact matches
|
|
80
|
+
let hadAnyActiveLink = false;
|
|
81
|
+
const scoreList = [];
|
|
82
|
+
config
|
|
83
|
+
.filter(mainNav => !hadAnyActiveLink && mainNav)
|
|
84
|
+
.forEach(mainNav => {
|
|
101
85
|
try {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
hadAnyActiveLink = updateScoreList(scoreList, score, { main: mainNav, sub: linklist, score }, hadAnyActiveLink);
|
|
86
|
+
const score = compareRoutes(compareUrl, new URL(mainNav.url), activeRouteProp);
|
|
87
|
+
hadAnyActiveLink = updateScoreList(scoreList, score, { main: mainNav, score }, hadAnyActiveLink);
|
|
105
88
|
}
|
|
106
89
|
catch (_a) {
|
|
107
|
-
|
|
90
|
+
// Not a valid url, continue
|
|
108
91
|
}
|
|
109
|
-
|
|
92
|
+
// Loop through flyout links 2nd level
|
|
93
|
+
mainNav.flyout.forEach(flyout => {
|
|
94
|
+
var _a;
|
|
95
|
+
(_a = flyout.linkList) === null || _a === void 0 ? void 0 : _a.forEach(linklist => {
|
|
96
|
+
// Don't override if any link is already active
|
|
97
|
+
if (linklist.isActive && (activeRouteProp === 'auto' || activeRouteProp === 'exact')) {
|
|
98
|
+
hadAnyActiveLink = true;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
const url = new URL(linklist.url);
|
|
103
|
+
const score = compareRoutes(compareUrl, url, activeRouteProp);
|
|
104
|
+
hadAnyActiveLink = updateScoreList(scoreList, score, { main: mainNav, sub: linklist, score }, hadAnyActiveLink);
|
|
105
|
+
}
|
|
106
|
+
catch (_a) {
|
|
107
|
+
// Not a valid URL, continue
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
110
111
|
});
|
|
111
|
-
|
|
112
|
-
return scoreList.sort((a, b) => b.score - a.score);
|
|
112
|
+
return scoreList.sort((a, b) => b.score - a.score);
|
|
113
113
|
};
|
|
114
114
|
/**
|
|
115
115
|
* Update score list
|
|
116
116
|
*/
|
|
117
117
|
function updateScoreList(scoreList, score, scoreListItem, hadAnyActiveLink) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
let hadActiveLink = hadAnyActiveLink;
|
|
119
|
+
if (score > 0) {
|
|
120
|
+
if (score === Infinity)
|
|
121
|
+
hadActiveLink = true;
|
|
122
|
+
// Push score
|
|
123
|
+
scoreList.push(scoreListItem);
|
|
124
|
+
}
|
|
125
|
+
return hadActiveLink;
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
128
|
* Compare two URLs for similarity based on a match mode
|
|
@@ -132,34 +132,34 @@ function updateScoreList(scoreList, score, scoreListItem, hadAnyActiveLink) {
|
|
|
132
132
|
* @returns Score
|
|
133
133
|
*/
|
|
134
134
|
const compareRoutes = (baseUrl, compareUrl, matchMode) => {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
135
|
+
// One url is not defined or they don't share the same orign
|
|
136
|
+
if (baseUrl === null || compareUrl === null || baseUrl.origin !== compareUrl.origin) {
|
|
137
|
+
return 0;
|
|
138
|
+
}
|
|
139
|
+
const baseUrlPath = baseUrl.pathname.toLocaleLowerCase();
|
|
140
|
+
const compareUrlPath = compareUrl.pathname.toLocaleLowerCase();
|
|
141
|
+
// Exact match, origin and pathname are the same
|
|
142
|
+
if (baseUrlPath === compareUrlPath) {
|
|
143
|
+
return Infinity;
|
|
144
|
+
}
|
|
145
|
+
// The basepath is longer than the comparison, a match is impossible
|
|
146
|
+
if (baseUrl.pathname.length < compareUrl.pathname.length) {
|
|
147
|
+
return 0;
|
|
148
|
+
}
|
|
149
|
+
if (matchMode === 'auto') {
|
|
150
|
+
const baseSegments = [
|
|
151
|
+
baseUrl.origin.toLocaleLowerCase(),
|
|
152
|
+
...baseUrlPath.split('/').filter(x => x !== null && x !== ''),
|
|
153
|
+
];
|
|
154
|
+
const compareSegments = [
|
|
155
|
+
compareUrl.origin.toLocaleLowerCase(),
|
|
156
|
+
...compareUrlPath.split('/').filter(x => x !== null && x !== ''),
|
|
157
|
+
];
|
|
158
|
+
const score = getSimilarityScore(baseSegments, compareSegments);
|
|
159
|
+
// If only some segments match, but not the whole smaller array, it's not a match
|
|
160
|
+
return Math.min(baseSegments.length, compareSegments.length) === score ? score : 0;
|
|
161
|
+
}
|
|
147
162
|
return 0;
|
|
148
|
-
}
|
|
149
|
-
if (matchMode === 'auto') {
|
|
150
|
-
const baseSegments = [
|
|
151
|
-
baseUrl.origin.toLocaleLowerCase(),
|
|
152
|
-
...baseUrlPath.split('/').filter(x => x !== null && x !== ''),
|
|
153
|
-
];
|
|
154
|
-
const compareSegments = [
|
|
155
|
-
compareUrl.origin.toLocaleLowerCase(),
|
|
156
|
-
...compareUrlPath.split('/').filter(x => x !== null && x !== ''),
|
|
157
|
-
];
|
|
158
|
-
const score = getSimilarityScore(baseSegments, compareSegments);
|
|
159
|
-
// If only some segments match, but not the whole smaller array, it's not a match
|
|
160
|
-
return Math.min(baseSegments.length, compareSegments.length) === score ? score : 0;
|
|
161
|
-
}
|
|
162
|
-
return 0;
|
|
163
163
|
};
|
|
164
164
|
/**
|
|
165
165
|
* Check how many items in an array match
|
|
@@ -168,16 +168,16 @@ const compareRoutes = (baseUrl, compareUrl, matchMode) => {
|
|
|
168
168
|
* @returns Score
|
|
169
169
|
*/
|
|
170
170
|
const getSimilarityScore = (a, b) => {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
171
|
+
if (a == null || b == null || a.length === 0 || b.length === 0) {
|
|
172
|
+
return 0;
|
|
173
|
+
}
|
|
174
|
+
let i = 0;
|
|
175
|
+
for (; i < Math.min(a.length, b.length); i++) {
|
|
176
|
+
if (a[i] !== b[i]) {
|
|
177
|
+
return 0;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return i;
|
|
181
181
|
};
|
|
182
182
|
|
|
183
183
|
// Prevent double requests
|
|
@@ -185,11 +185,11 @@ let request = null;
|
|
|
185
185
|
// Cache the original os flyout to use it for updates
|
|
186
186
|
let osFlyoutCache = null;
|
|
187
187
|
const getPPMConfig = () => {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
188
|
+
const ppmConfigScript = document.querySelector('#PPM_HEADER_DATA');
|
|
189
|
+
if ((ppmConfigScript === null || ppmConfigScript === void 0 ? void 0 : ppmConfigScript.textContent) != null) {
|
|
190
|
+
return JSON.parse(ppmConfigScript.textContent);
|
|
191
|
+
}
|
|
192
|
+
return null;
|
|
193
193
|
};
|
|
194
194
|
/**
|
|
195
195
|
* Get a localized config object
|
|
@@ -199,43 +199,43 @@ const getPPMConfig = () => {
|
|
|
199
199
|
* @returns Localized config object
|
|
200
200
|
*/
|
|
201
201
|
const getLocalizedConfig = async ({ projectId, environment, language, cookieKey, localStorageKey, activeRouteProp, localizedCustomConfig, osFlyoutOverrides, }) => {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
202
|
+
var _a, _b;
|
|
203
|
+
const ppmConfig = getPPMConfig();
|
|
204
|
+
let localizedConfig;
|
|
205
|
+
let config = null;
|
|
206
|
+
let lang;
|
|
207
|
+
if (ppmConfig) {
|
|
208
|
+
localizedConfig = ppmConfig;
|
|
209
|
+
lang = document.documentElement.lang;
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
if (request == null) {
|
|
213
|
+
request = fetchConfig(projectId, environment);
|
|
214
|
+
}
|
|
215
|
+
config = await request;
|
|
216
|
+
lang = getUserLang(Object.keys(config), language, localStorageKey, cookieKey);
|
|
217
|
+
if (lang === undefined) {
|
|
218
|
+
throw new Error('Internet Header: unable to determine current language');
|
|
219
|
+
}
|
|
220
|
+
// Clone config for more predictable state updates
|
|
221
|
+
localizedConfig = Object.assign({}, config[lang]);
|
|
222
|
+
}
|
|
223
|
+
// Merge custom config with portal config
|
|
224
|
+
if (localizedCustomConfig) {
|
|
225
|
+
const header = ((_a = localizedCustomConfig === null || localizedCustomConfig === void 0 ? void 0 : localizedCustomConfig.header) === null || _a === void 0 ? void 0 : _a.navMain)
|
|
226
|
+
? Object.assign(Object.assign({}, localizedConfig.header), { navMain: [...localizedConfig.header.navMain, ...localizedCustomConfig.header.navMain] }) : localizedConfig.header;
|
|
227
|
+
localizedConfig = Object.assign(Object.assign({}, localizedConfig), { header });
|
|
228
|
+
}
|
|
229
|
+
// Add entries to flyout_os
|
|
230
|
+
if (osFlyoutOverrides)
|
|
231
|
+
localizedConfig.header.navMain = mergeOsFlyoutOverrides(localizedConfig, osFlyoutOverrides);
|
|
232
|
+
// Mark active route
|
|
233
|
+
if (activeRouteProp != null)
|
|
234
|
+
localizedConfig.header.navMain = markActiveRoute(localizedConfig.header.navMain, activeRouteProp);
|
|
235
|
+
setMainNavigationIds((_b = localizedConfig === null || localizedConfig === void 0 ? void 0 : localizedConfig.header) === null || _b === void 0 ? void 0 : _b.navMain);
|
|
236
|
+
// Set the new language choice
|
|
237
|
+
persistLanguageChoice(lang, cookieKey, localStorageKey);
|
|
238
|
+
return localizedConfig;
|
|
239
239
|
};
|
|
240
240
|
/**
|
|
241
241
|
* Merge portal config with custom os flyout overrides
|
|
@@ -244,38 +244,38 @@ const getLocalizedConfig = async ({ projectId, environment, language, cookieKey,
|
|
|
244
244
|
* @returns Merged localized config
|
|
245
245
|
*/
|
|
246
246
|
const mergeOsFlyoutOverrides = (config, osFlyoutOverrides) => {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
247
|
+
if (osFlyoutOverrides == null)
|
|
248
|
+
return config.header.navMain;
|
|
249
|
+
return config.header.navMain.map(mainNav => {
|
|
250
|
+
var _a, _b;
|
|
251
|
+
if (mainNav.id !== 'flyout_os')
|
|
252
|
+
return mainNav;
|
|
253
|
+
if (osFlyoutCache === null) {
|
|
254
|
+
osFlyoutCache = JSON.parse(JSON.stringify(mainNav));
|
|
255
|
+
}
|
|
256
|
+
const mainNavText = (_a = osFlyoutOverrides.text) !== null && _a !== void 0 ? _a : osFlyoutCache.text;
|
|
257
|
+
const mainNavTitle = (_b = osFlyoutOverrides.title) !== null && _b !== void 0 ? _b : osFlyoutCache.title;
|
|
258
|
+
if (osFlyoutCache.flyout == null ||
|
|
259
|
+
osFlyoutCache.flyout.length === 0 ||
|
|
260
|
+
osFlyoutOverrides.flyout == null ||
|
|
261
|
+
osFlyoutOverrides.flyout.length === 0)
|
|
262
|
+
return Object.assign(Object.assign({}, mainNav), { title: mainNavTitle, text: mainNavText });
|
|
263
|
+
// Add entries for os flyout columns without overriding existing config
|
|
264
|
+
const mainNavFlyout = [
|
|
265
|
+
...osFlyoutCache.flyout.map((col, index) => {
|
|
266
|
+
var _a;
|
|
267
|
+
const overrides = osFlyoutOverrides.flyout[index];
|
|
268
|
+
const title = (_a = overrides.title) !== null && _a !== void 0 ? _a : col.title;
|
|
269
|
+
const linkList = overrides.linkList != null ? osFlyoutOverrides.flyout[index].linkList : [];
|
|
270
|
+
return {
|
|
271
|
+
title,
|
|
272
|
+
linkList: [...col.linkList, ...linkList],
|
|
273
|
+
};
|
|
274
|
+
}),
|
|
275
|
+
...osFlyoutOverrides.flyout.slice(osFlyoutCache.flyout.length),
|
|
276
|
+
];
|
|
277
|
+
return Object.assign(Object.assign({}, mainNav), { text: mainNavText, title: mainNavTitle, flyout: mainNavFlyout });
|
|
278
|
+
});
|
|
279
279
|
};
|
|
280
280
|
/**
|
|
281
281
|
* Fetch the general config based on project id
|
|
@@ -283,22 +283,22 @@ const mergeOsFlyoutOverrides = (config, osFlyoutOverrides) => {
|
|
|
283
283
|
* @returns Promise for Post Portal general config
|
|
284
284
|
*/
|
|
285
285
|
const fetchConfig = async (projectId, environment) => {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
286
|
+
// Check if project id is sanitized
|
|
287
|
+
if (!isValidProjectId(projectId)) {
|
|
288
|
+
throw new Error(`Internet Header: invalid project id "${projectId}"`);
|
|
289
|
+
}
|
|
290
|
+
if (projectId === 'test') {
|
|
291
|
+
environment = 'int01';
|
|
292
|
+
}
|
|
293
|
+
let url = generateConfigUrl(projectId, environment);
|
|
294
|
+
// Get the config if cache is invalid
|
|
295
|
+
try {
|
|
296
|
+
const res = await fetch(url);
|
|
297
|
+
return (await res.json());
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
throw new Error(`Internet Header: fetching config failed. ${error.message}`);
|
|
301
|
+
}
|
|
302
302
|
};
|
|
303
303
|
/**
|
|
304
304
|
* Generate an URL with all necessary query params to get the configuration.
|
|
@@ -308,18 +308,18 @@ const fetchConfig = async (projectId, environment) => {
|
|
|
308
308
|
* @returns URL pointing to the project config
|
|
309
309
|
*/
|
|
310
310
|
const generateConfigUrl = (projectId, environment) => {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
311
|
+
if (projectId === 'test')
|
|
312
|
+
return 'assets/config/test-configuration.json';
|
|
313
|
+
const parsedEnvironment = environment.toLowerCase();
|
|
314
|
+
const isProd = parsedEnvironment === 'prod';
|
|
315
|
+
const host = `https://${isProd ? 'www' : 'int'}.post.ch`;
|
|
316
|
+
try {
|
|
317
|
+
// Use URL to validate the generated URL
|
|
318
|
+
return new URL(`${host}/api/headerjs/Json?serviceid=${encodeURIComponent(projectId)}${!isProd ? '&environment=' + parsedEnvironment : ''}`).toString();
|
|
319
|
+
}
|
|
320
|
+
catch (error) {
|
|
321
|
+
throw new Error(`Internet Header: Config URL is invalid.`);
|
|
322
|
+
}
|
|
323
323
|
};
|
|
324
324
|
/**
|
|
325
325
|
* Check if project id contains only URL safe characters
|
|
@@ -328,7 +328,7 @@ const generateConfigUrl = (projectId, environment) => {
|
|
|
328
328
|
* @returns The valid project id
|
|
329
329
|
*/
|
|
330
330
|
const isValidProjectId = (projectId) => {
|
|
331
|
-
|
|
331
|
+
return projectId !== '' && projectId.length > 0 && /^[a-zA-Z][\w-]*[a-zA-Z0-9]$/.test(projectId);
|
|
332
332
|
};
|
|
333
333
|
/**
|
|
334
334
|
* Get the localized config object from a custom config
|
|
@@ -338,31 +338,31 @@ const isValidProjectId = (projectId) => {
|
|
|
338
338
|
* @returns Localized custom config object
|
|
339
339
|
*/
|
|
340
340
|
const getLocalizedCustomConfig = (config, language) => {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
341
|
+
var _a;
|
|
342
|
+
let customConfig;
|
|
343
|
+
try {
|
|
344
|
+
customConfig = typeof config === 'string' ? JSON.parse(config) : config;
|
|
345
|
+
}
|
|
346
|
+
catch (error) {
|
|
347
|
+
throw new Error(`Internet Header: Custom config is invalid. Make sure your custom config contains valid JSON syntax and matches the definition. `);
|
|
348
|
+
}
|
|
349
|
+
let localizedCustomConfig = customConfig[language];
|
|
350
|
+
if ((_a = localizedCustomConfig === null || localizedCustomConfig === void 0 ? void 0 : localizedCustomConfig.header) === null || _a === void 0 ? void 0 : _a.navMain)
|
|
351
|
+
setMainNavigationIds(localizedCustomConfig.header.navMain);
|
|
352
|
+
return localizedCustomConfig;
|
|
353
353
|
};
|
|
354
354
|
/**
|
|
355
355
|
* Set unique ID's on main navigation entities but conserve flyout_os to be able to
|
|
356
356
|
* identify the online-service flyout, which can be configured by osFlyoutOverrides
|
|
357
357
|
*/
|
|
358
358
|
const setMainNavigationIds = (navMainEntities) => {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
359
|
+
navMainEntities.forEach(navMainEntity => {
|
|
360
|
+
navMainEntity.id = navMainEntity.id === 'flyout_os' ? navMainEntity.id : uniqueId('main-nav-');
|
|
361
|
+
});
|
|
362
362
|
};
|
|
363
363
|
|
|
364
364
|
const name = "@swisspost/internet-header";
|
|
365
|
-
const version = "1.13.
|
|
365
|
+
const version = "1.13.3";
|
|
366
366
|
const description = "The header for client facing applications.";
|
|
367
367
|
const author = "Swiss Post <oss@post.ch>";
|
|
368
368
|
const license = "Apache-2.0";
|
|
@@ -402,7 +402,7 @@ const scripts = {
|
|
|
402
402
|
generate: "stencil generate"
|
|
403
403
|
};
|
|
404
404
|
const dependencies = {
|
|
405
|
-
"@swisspost/design-system-styles": "workspace:6.
|
|
405
|
+
"@swisspost/design-system-styles": "workspace:6.6.0",
|
|
406
406
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
407
407
|
"iframe-resizer": "4.3.9",
|
|
408
408
|
jquery: "3.7.1",
|
|
@@ -411,36 +411,46 @@ const dependencies = {
|
|
|
411
411
|
"url-polyfill": "1.1.12"
|
|
412
412
|
};
|
|
413
413
|
const devDependencies = {
|
|
414
|
-
"@babel/core": "7.23.
|
|
415
|
-
"@percy/cli": "1.27.
|
|
414
|
+
"@babel/core": "7.23.7",
|
|
415
|
+
"@percy/cli": "1.27.7",
|
|
416
416
|
"@percy/cypress": "3.1.2",
|
|
417
417
|
"@stencil-community/eslint-plugin": "0.7.1",
|
|
418
|
-
"@stencil/core": "4.
|
|
419
|
-
"@stencil/sass": "3.0.
|
|
420
|
-
"@stencil/store": "2.0.
|
|
418
|
+
"@stencil/core": "4.10.0",
|
|
419
|
+
"@stencil/sass": "3.0.8",
|
|
420
|
+
"@stencil/store": "2.0.12",
|
|
421
421
|
"@types/body-scroll-lock": "3.1.2",
|
|
422
422
|
"@types/iframe-resizer": "3.5.13",
|
|
423
|
-
"@types/jest": "
|
|
423
|
+
"@types/jest": "29.5.11",
|
|
424
424
|
"@types/jquery": "3.5.29",
|
|
425
|
-
"@types/node": "18.19.
|
|
425
|
+
"@types/node": "18.19.7",
|
|
426
426
|
"@types/throttle-debounce": "5.0.2",
|
|
427
427
|
"babel-loader": "9.1.3",
|
|
428
428
|
bootstrap: "5.3.2",
|
|
429
|
-
cypress: "13.6.
|
|
429
|
+
cypress: "13.6.2",
|
|
430
430
|
"cypress-each": "1.13.3",
|
|
431
431
|
"cypress-storybook": "0.5.1",
|
|
432
432
|
"eslint-plugin-react": "7.33.2",
|
|
433
433
|
globby: "14.0.0",
|
|
434
|
-
jest: "
|
|
434
|
+
jest: "29.7.0",
|
|
435
|
+
"jest-environment-jsdom": "29.7.0",
|
|
435
436
|
rimraf: "5.0.5",
|
|
436
437
|
"rollup-plugin-node-polyfills": "0.2.1",
|
|
437
438
|
"rollup-plugin-scss": "4.0.0",
|
|
438
|
-
"rollup-plugin-visualizer": "5.
|
|
439
|
-
sass: "1.69.
|
|
439
|
+
"rollup-plugin-visualizer": "5.12.0",
|
|
440
|
+
sass: "1.69.7",
|
|
440
441
|
"start-server-and-test": "2.0.3",
|
|
441
|
-
"ts-jest": "
|
|
442
|
+
"ts-jest": "29.1.1",
|
|
442
443
|
typescript: "4.9.5"
|
|
443
444
|
};
|
|
445
|
+
const keywords = [
|
|
446
|
+
"components",
|
|
447
|
+
"web-components",
|
|
448
|
+
"header",
|
|
449
|
+
"stencil",
|
|
450
|
+
"design-system",
|
|
451
|
+
"ui",
|
|
452
|
+
"frontend"
|
|
453
|
+
];
|
|
444
454
|
const packageJson = {
|
|
445
455
|
name: name,
|
|
446
456
|
version: version,
|
|
@@ -461,451 +471,461 @@ const packageJson = {
|
|
|
461
471
|
files: files,
|
|
462
472
|
scripts: scripts,
|
|
463
473
|
dependencies: dependencies,
|
|
464
|
-
devDependencies: devDependencies
|
|
474
|
+
devDependencies: devDependencies,
|
|
475
|
+
keywords: keywords
|
|
465
476
|
};
|
|
466
477
|
|
|
467
478
|
const isScrollable = (node) => {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
479
|
+
if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
482
|
+
const style = getComputedStyle(node);
|
|
483
|
+
return ['overflow', 'overflow-x', 'overflow-y'].some(propertyName => {
|
|
484
|
+
const value = style.getPropertyValue(propertyName);
|
|
485
|
+
return value === 'auto' || value === 'scroll';
|
|
486
|
+
});
|
|
476
487
|
};
|
|
477
488
|
const getScrollParent = (node) => {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
489
|
+
let currentParent = node.parentElement;
|
|
490
|
+
while (currentParent) {
|
|
491
|
+
if (currentParent.nodeName === 'BODY') {
|
|
492
|
+
return document;
|
|
493
|
+
}
|
|
494
|
+
if (isScrollable(currentParent)) {
|
|
495
|
+
return currentParent;
|
|
496
|
+
}
|
|
497
|
+
currentParent = currentParent.parentElement;
|
|
498
|
+
}
|
|
499
|
+
return document;
|
|
486
500
|
};
|
|
487
501
|
|
|
488
502
|
const registerLogoAnimationObserver = (target, headerRef) => {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
503
|
+
const scrollParent = getScrollParent(headerRef);
|
|
504
|
+
/**
|
|
505
|
+
* Set intersection ratio as CSS custom property
|
|
506
|
+
*/
|
|
507
|
+
const handleScroll = () => {
|
|
508
|
+
const fullStickyness = state.stickyness === 'full';
|
|
509
|
+
let scale = 1;
|
|
510
|
+
// Minus 1px border at the bottom that the logo is not covering
|
|
511
|
+
const adjustedHeaderHeight = headerRef.clientHeight - 1;
|
|
512
|
+
const scrollDistance = scrollParent instanceof Element ? scrollParent.scrollTop : scrollParent.documentElement.scrollTop;
|
|
513
|
+
const scrollY = fullStickyness ? 0 : scrollDistance;
|
|
514
|
+
// If meta navigation is not visible (mobile, not configured), scale should just be 1
|
|
515
|
+
if (target.clientHeight > 0) {
|
|
516
|
+
scale = Math.max((adjustedHeaderHeight - Math.max(scrollY, 0)) /
|
|
517
|
+
(adjustedHeaderHeight - target.clientHeight), 1);
|
|
518
|
+
}
|
|
519
|
+
headerRef.style.setProperty('--logo-scale', scale.toString());
|
|
520
|
+
};
|
|
521
|
+
const debounced = debounce(150, handleScroll);
|
|
522
|
+
/**
|
|
523
|
+
* Observe the meta navigation in order to not track scroll events throughout the whole page.
|
|
524
|
+
* This ensures that the scroll listener is only active while the meta navigation is visible.
|
|
525
|
+
*/
|
|
526
|
+
const observer = new IntersectionObserver(entries => {
|
|
527
|
+
entries.forEach(entry => {
|
|
528
|
+
if (entry.isIntersecting && entry.intersectionRatio > 0) {
|
|
529
|
+
scrollParent.addEventListener('scroll', handleScroll, { passive: true });
|
|
530
|
+
window.addEventListener('resize', debounced);
|
|
531
|
+
// Ensure callback is called at least once in case main thread is too busy while scrolling up
|
|
532
|
+
window.requestAnimationFrame(handleScroll);
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
scrollParent.removeEventListener('scroll', handleScroll);
|
|
536
|
+
window.removeEventListener('resize', debounced);
|
|
537
|
+
window.requestAnimationFrame(handleScroll);
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
}, {
|
|
541
|
+
// Fires when element leaves viewport (0) and when it just about enters it (0.001)
|
|
542
|
+
threshold: [0, 0.001],
|
|
525
543
|
});
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
threshold: [0, 0.001],
|
|
529
|
-
});
|
|
530
|
-
observer.observe(target);
|
|
531
|
-
return handleScroll;
|
|
544
|
+
observer.observe(target);
|
|
545
|
+
return handleScroll;
|
|
532
546
|
};
|
|
533
547
|
|
|
534
|
-
const postInternetHeaderCss = "@font-face{font-display:swap;font-family:\"Frutiger Neue For Post\";font-weight:700;src:url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Bold.woff2\") format(\"woff2\"),url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Bold.woff\") format(\"woff\")}@font-face{font-display:swap;font-family:\"Frutiger Neue For Post\";font-weight:700;font-style:italic;src:url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-BdIt.woff2\") format(\"woff2\"),url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-BdIt.woff\") format(\"woff\")}@font-face{font-display:swap;font-family:\"Frutiger Neue For Post\";font-weight:400;src:url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Rg.woff2\") format(\"woff2\"),url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Rg.woff\") format(\"woff\")}@font-face{font-display:swap;font-family:\"Frutiger Neue For Post\";font-weight:400;font-style:italic;src:url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-It.woff2\") format(\"woff2\"),url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-It.woff\") format(\"woff\")}@font-face{font-display:swap;font-family:\"Frutiger Neue For Post\";font-weight:300;src:url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Lt.woff2\") format(\"woff2\"),url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Lt.woff\") format(\"woff\")}@font-face{font-display:swap;font-family:\"Frutiger Neue For Post\";font-weight:300;font-style:italic;src:url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-LtIt.woff2\") format(\"woff2\"),url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-LtIt.woff\") format(\"woff\")}.visually-hidden{position:absolute;width:1px;height:1px;border:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0)}.btn-blank{background-color:rgba(0,0,0,0);border:none;border-radius:0;padding:0}.nav-link{outline:none;outline-offset:2px;text-decoration:none;color:rgba(0,0,0,.8);-webkit-transition:color 200ms;transition:color 200ms;background-color:rgba(0,0,0,0);-webkit-box-shadow:none;box-shadow:none;border:0;margin:0;cursor:pointer;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:.5rem}.nav-link:is(:focus-visible,:focus-within,.pretend-focus){outline:2px solid var(--post-contrast-color)}.nav-link:hover,.nav-link:focus{color:#000}.nav-link:is(:focus-visible,:focus-within,.pretend-focus){z-index:1;position:relative}.nav-link>svg{width:1.4em;height:1.4em;-ms-flex-negative:0;flex-shrink:0}.nav-link>span{-ms-flex-negative:1;flex-shrink:1}.no-list{list-style:none;padding-left:0;margin-top:0;margin-bottom:0}*,:host,*::before,*::after{-webkit-box-sizing:border-box;box-sizing:border-box}:host{font-family:\"Frutiger Neue For Post\",system-ui,sans-serif}button{font:inherit;padding:0}a,button{border-radius:4px;outline:none;outline-offset:2px}a:is(:focus-visible,:focus-within,.pretend-focus),button:is(:focus-visible,:focus-within,.pretend-focus){outline:2px solid var(--post-contrast-color);border-radius:4px}img,svg{max-width:100%;max-height:100%}@media (forced-colors: active){svg{color:#fff}}.box>*:first-child{margin-top:0}.box>*:last-child{margin-bottom:0}.mirrored{-webkit-transform:scaleX(-1);transform:scaleX(-1)}.rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.bold{font-weight:700}.light{font-weight:300}.d-flex{display:-ms-flexbox;display:flex}.d-inline-flex{display:-ms-inline-flexbox;display:inline-flex}.align-items-center{-ms-flex-align:center;align-items:center}@media (min-width: 1441px){.wide-container{margin:0 auto;max-width:1440px}}@media (max-width: 599.98px){.container{padding-right:16px;padding-left:16px}}@media (min-width: 600px)and (max-width: 1023.98px){.container{padding-right:32px;padding-left:32px}}@media (min-width: 1024px){.container{padding-right:40px;padding-left:40px}}@media (max-width: -0.02px){.hidden-xs{display:none}}@media (max-width: 399.98px){.hidden-sm{display:none}}@media (max-width: 599.98px){.hidden-rg{display:none}}@media (max-width: 779.98px){.hidden-md{display:none}}@media (max-width: 1023.98px){.hidden-lg{display:none}}@media (max-width: 1279.98px){.hidden-xl{display:none}}@media (max-width: 1440.98px){.hidden-xxl{display:none}}:host{--logo-scale:1}@media (max-width: 1023.98px){:host{--logo-scale:1 !important}}post-logo{height:var(--header-height);-webkit-transform-origin:bottom left;transform-origin:bottom left;-webkit-transform:scale(var(--logo-scale));transform:scale(var(--logo-scale))}post-main-navigation{margin-left:calc(var(--header-height)*var(--logo-scale) - var(--header-height))}:host{display:block;position:relative;font-size:1rem;font-weight:300;z-index:var(--header-z-index, 10);--header-height:3.5rem;--meta-header-height:0px;--language-dropdown-margin-top:0px}@media (min-width: 1024px){:host{--meta-header-height:3rem;--header-height:4rem}}@media (min-width: 1280px){:host{--header-height:4.5rem}}:host([meta=false]){--meta-header-height:0px;--language-dropdown-margin-top:1px}@supports ((position: -webkit-sticky) or (position: sticky)){:host(:not(.stickyness-none)){position:-webkit-sticky;position:sticky}:host(.stickyness-full){top:0}:host(.stickyness-main){top:calc(var(--meta-header-height, 0px)*-1)}:host(.stickyness-minimal){top:calc((var(--header-height, 0px) + var(--meta-header-height, 0px) + 1px)*-1);-webkit-transition:top 200ms ease-in;transition:top 200ms ease-in}:host(.stickyness-minimal.scrolling-up),:host(.stickyness-minimal.dropdown-open){top:calc(var(--meta-header-height, 0px)*-1);-webkit-transition:top 200ms ease-out;transition:top 200ms ease-out}}.post-internet-header{border-bottom:1px solid #e6e6e6;background-color:#fff}.main-navigation-container{display:-ms-flexbox;display:flex}.main-navigation-container>.main-navigation-controls{-ms-flex:0
|
|
548
|
+
const postInternetHeaderCss = "@font-face{font-display:swap;font-family:\"Frutiger Neue For Post\";font-weight:700;src:url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Bold.woff2\") format(\"woff2\"),url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Bold.woff\") format(\"woff\")}@font-face{font-display:swap;font-family:\"Frutiger Neue For Post\";font-weight:700;font-style:italic;src:url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-BdIt.woff2\") format(\"woff2\"),url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-BdIt.woff\") format(\"woff\")}@font-face{font-display:swap;font-family:\"Frutiger Neue For Post\";font-weight:400;src:url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Rg.woff2\") format(\"woff2\"),url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Rg.woff\") format(\"woff\")}@font-face{font-display:swap;font-family:\"Frutiger Neue For Post\";font-weight:400;font-style:italic;src:url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-It.woff2\") format(\"woff2\"),url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-It.woff\") format(\"woff\")}@font-face{font-display:swap;font-family:\"Frutiger Neue For Post\";font-weight:300;src:url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Lt.woff2\") format(\"woff2\"),url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-Lt.woff\") format(\"woff\")}@font-face{font-display:swap;font-family:\"Frutiger Neue For Post\";font-weight:300;font-style:italic;src:url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-LtIt.woff2\") format(\"woff2\"),url(\"https://fonts.post.ch/frutigerneueforpost/v2/FrutigerNeueforPostW05-LtIt.woff\") format(\"woff\")}.visually-hidden{position:absolute;width:1px;height:1px;border:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0)}.btn-blank{background-color:rgba(0,0,0,0);border:none;border-radius:0;padding:0}.nav-link{outline:none;outline-offset:2px;text-decoration:none;color:rgba(0,0,0,.8);-webkit-transition:color 200ms;transition:color 200ms;background-color:rgba(0,0,0,0);-webkit-box-shadow:none;box-shadow:none;border:0;margin:0;cursor:pointer;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:.5rem}.nav-link:is(:focus-visible,:focus-within,.pretend-focus){outline:2px solid var(--post-contrast-color)}.nav-link:hover,.nav-link:focus{color:#000}.nav-link:is(:focus-visible,:focus-within,.pretend-focus){z-index:1;position:relative}.nav-link>svg{width:1.4em;height:1.4em;-ms-flex-negative:0;flex-shrink:0}.nav-link>span{-ms-flex-negative:1;flex-shrink:1}.no-list{list-style:none;padding-left:0;margin-top:0;margin-bottom:0}*,:host,*::before,*::after{-webkit-box-sizing:border-box;box-sizing:border-box}:host{font-family:\"Frutiger Neue For Post\",system-ui,sans-serif}button{font:inherit;padding:0}a,button{border-radius:4px;outline:none;outline-offset:2px}a:is(:focus-visible,:focus-within,.pretend-focus),button:is(:focus-visible,:focus-within,.pretend-focus){outline:2px solid var(--post-contrast-color);border-radius:4px}img,svg{max-width:100%;max-height:100%}@media (forced-colors: active){svg{color:#fff}}.box>*:first-child{margin-top:0}.box>*:last-child{margin-bottom:0}.mirrored{-webkit-transform:scaleX(-1);transform:scaleX(-1)}.rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.bold{font-weight:700}.light{font-weight:300}.d-flex{display:-ms-flexbox;display:flex}.d-inline-flex{display:-ms-inline-flexbox;display:inline-flex}.align-items-center{-ms-flex-align:center;align-items:center}@media (min-width: 1441px){.wide-container{margin:0 auto;max-width:1440px}}@media (max-width: 599.98px){.container{padding-right:16px;padding-left:16px}}@media (min-width: 600px)and (max-width: 1023.98px){.container{padding-right:32px;padding-left:32px}}@media (min-width: 1024px){.container{padding-right:40px;padding-left:40px}}@media (max-width: -0.02px){.hidden-xs{display:none}}@media (max-width: 399.98px){.hidden-sm{display:none}}@media (max-width: 599.98px){.hidden-rg{display:none}}@media (max-width: 779.98px){.hidden-md{display:none}}@media (max-width: 1023.98px){.hidden-lg{display:none}}@media (max-width: 1279.98px){.hidden-xl{display:none}}@media (max-width: 1440.98px){.hidden-xxl{display:none}}:host{--logo-scale:1}@media (max-width: 1023.98px){:host{--logo-scale:1 !important}}post-logo{height:var(--header-height);-webkit-transform-origin:bottom left;transform-origin:bottom left;-webkit-transform:scale(var(--logo-scale));transform:scale(var(--logo-scale))}post-main-navigation{margin-left:calc(var(--header-height)*var(--logo-scale) - var(--header-height))}:host{display:block;position:relative;font-size:1rem;font-weight:300;z-index:var(--header-z-index, 10);--header-height:3.5rem;--meta-header-height:0px;--language-dropdown-margin-top:0px}@media (min-width: 1024px){:host{--meta-header-height:3rem;--header-height:4rem}}@media (min-width: 1280px){:host{--header-height:4.5rem}}:host([meta=false]){--meta-header-height:0px;--language-dropdown-margin-top:1px}@supports ((position: -webkit-sticky) or (position: sticky)){:host(:not(.stickyness-none)){position:-webkit-sticky;position:sticky}:host(.stickyness-full){top:0}:host(.stickyness-main){top:calc(var(--meta-header-height, 0px)*-1)}:host(.stickyness-minimal){top:calc((var(--header-height, 0px) + var(--meta-header-height, 0px) + 1px)*-1);-webkit-transition:top 200ms ease-in;transition:top 200ms ease-in}:host(.stickyness-minimal.scrolling-up),:host(.stickyness-minimal.dropdown-open){top:calc(var(--meta-header-height, 0px)*-1);-webkit-transition:top 200ms ease-out;transition:top 200ms ease-out}}.post-internet-header{border-bottom:1px solid #e6e6e6;background-color:#fff}.main-navigation-container{display:-ms-flexbox;display:flex}.main-navigation-container>.main-navigation-controls{-ms-flex:0 1 auto;flex:0 1 auto}.main-navigation{display:-ms-flexbox;display:flex}.sub-navigation-container{position:absolute;top:100%;left:0;width:100%;display:-ms-flexbox;display:flex;background:#fff;visibility:hidden}.main-navigation-item:hover .sub-navigation-container{visibility:visible}.main-navigation-controls{display:-ms-flexbox;display:flex;margin-left:auto}@media (max-width: 1023.98px){.main-navigation-controls{font-weight:400}}@media (min-width: 1024px){.main-navigation-controls{font-size:1.0625rem}}.main-navigation-controls>*{border-left:1px solid #e6e6e6;-ms-flex:0 0 auto;flex:0 0 auto}.main-navigation-custom-content{max-height:var(--header-height);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-negative:1;flex-shrink:1}.menu-button{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:0 calc(1rem - 1px);font-weight:300;cursor:pointer;border-left:1px solid #e6e6e6;-ms-flex-order:1;order:1}@media (min-width: 1024px){.menu-button{display:none}}@media (min-width: 600px)and (max-width: 1023.98px){.menu-button .visually-hidden{position:static;width:auto;height:auto;margin:auto;overflow:visible;clip:auto;visibility:visible;margin-right:.5rem}}.menu-button svg{width:1.5rem;height:1.5rem}.full-width .wide-container{max-width:none}";
|
|
535
549
|
|
|
536
550
|
const PostInternetHeader = /*@__PURE__*/ proxyCustomElement(class PostInternetHeader extends HTMLElement$1 {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}
|
|
545
|
-
constructor() {
|
|
546
|
-
super();
|
|
547
|
-
this.__registerHost();
|
|
548
|
-
this.__attachShadow();
|
|
549
|
-
this.headerLoaded = createEvent(this, "headerLoaded", 7);
|
|
550
|
-
this.lastScrollTop = window.scrollY || document.documentElement.scrollTop;
|
|
551
|
-
this.lastWindowWidth = window.innerWidth;
|
|
552
|
-
this.handleClickOutsideBound = this.handleClickOutside.bind(this);
|
|
553
|
-
this.project = undefined;
|
|
554
|
-
this.stickyness = 'minimal';
|
|
555
|
-
this.language = undefined;
|
|
556
|
-
this.meta = true;
|
|
557
|
-
this.login = true;
|
|
558
|
-
this.search = true;
|
|
559
|
-
this.skiplinks = true;
|
|
560
|
-
this.configProxy = undefined;
|
|
561
|
-
this.environment = 'prod';
|
|
562
|
-
this.languageSwitchOverrides = undefined;
|
|
563
|
-
this.customConfig = undefined;
|
|
564
|
-
this.languageCookieKey = undefined;
|
|
565
|
-
this.languageLocalStorageKey = 'swisspost-internet-header-language';
|
|
566
|
-
this.logoutUrl = undefined;
|
|
567
|
-
this.activeRoute = 'auto';
|
|
568
|
-
this.osFlyoutOverrides = undefined;
|
|
569
|
-
this.fullWidth = false;
|
|
570
|
-
this.activeFlyout = null;
|
|
571
|
-
this.activeDropdownElement = null;
|
|
572
|
-
if (this.project === undefined || this.project === '' || !isValidProjectId(this.project)) {
|
|
573
|
-
throw new Error(`Internet Header project key is "${this.project}". Please provide a valid project key.`);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
connectedCallback() {
|
|
577
|
-
this.throttledScroll = throttle(300, () => this.handleScrollEvent());
|
|
578
|
-
this.debouncedResize = debounce(200, () => this.handleResize());
|
|
579
|
-
}
|
|
580
|
-
disconnectedCallback() {
|
|
581
|
-
this.scrollParent.removeEventListener('scroll', this.throttledScroll);
|
|
582
|
-
this.scrollParent.removeEventListener('resize', this.debouncedResize);
|
|
583
|
-
// Reset the store to its original state
|
|
584
|
-
dispose();
|
|
585
|
-
}
|
|
586
|
-
async componentWillLoad() {
|
|
587
|
-
this.scrollParent = getScrollParent(this.host);
|
|
588
|
-
this.scrollParent.addEventListener('scroll', this.throttledScroll, { passive: true });
|
|
589
|
-
this.scrollParent.addEventListener('resize', this.debouncedResize, { passive: true });
|
|
590
|
-
// Wait for the config to arrive, then render the header
|
|
591
|
-
try {
|
|
592
|
-
state.projectId = this.project;
|
|
593
|
-
state.stickyness = this.stickyness;
|
|
594
|
-
state.environment = this.environment.toLocaleLowerCase();
|
|
595
|
-
if (this.language !== undefined)
|
|
596
|
-
state.currentLanguage = this.language;
|
|
597
|
-
state.languageSwitchOverrides =
|
|
598
|
-
typeof this.languageSwitchOverrides === 'string'
|
|
599
|
-
? JSON.parse(this.languageSwitchOverrides)
|
|
600
|
-
: this.languageSwitchOverrides;
|
|
601
|
-
state.osFlyoutOverrides =
|
|
602
|
-
typeof this.osFlyoutOverrides === 'string'
|
|
603
|
-
? JSON.parse(this.osFlyoutOverrides)
|
|
604
|
-
: this.osFlyoutOverrides;
|
|
605
|
-
if (this.customConfig !== undefined) {
|
|
606
|
-
const langs = Object.keys(typeof this.customConfig === 'string' ? JSON.parse(this.customConfig) : this.customConfig);
|
|
607
|
-
const lang = state.currentLanguage || getUserLang(langs, this.language);
|
|
608
|
-
state.localizedCustomConfig = getLocalizedCustomConfig(this.customConfig, lang);
|
|
609
|
-
}
|
|
610
|
-
state.localizedConfig = await getLocalizedConfig({
|
|
611
|
-
projectId: this.project,
|
|
612
|
-
environment: state.environment,
|
|
613
|
-
language: this.language,
|
|
614
|
-
cookieKey: this.languageCookieKey,
|
|
615
|
-
localStorageKey: this.languageLocalStorageKey,
|
|
616
|
-
activeRouteProp: this.activeRoute,
|
|
617
|
-
localizedCustomConfig: state.localizedCustomConfig,
|
|
618
|
-
osFlyoutOverrides: state.osFlyoutOverrides,
|
|
619
|
-
});
|
|
551
|
+
/**
|
|
552
|
+
* Get the currently set language as a two letter string ("de", "fr" "it" or "en")
|
|
553
|
+
* @returns string
|
|
554
|
+
*/
|
|
555
|
+
async getCurrentLanguage() {
|
|
556
|
+
var _a;
|
|
557
|
+
return (_a = state.currentLanguage) !== null && _a !== void 0 ? _a : 'de';
|
|
620
558
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
this.
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
handleAvailableLanguagesChange(newValue) {
|
|
653
|
-
state.languageSwitchOverrides = typeof newValue === 'string' ? JSON.parse(newValue) : newValue;
|
|
654
|
-
}
|
|
655
|
-
async handleOsFlyoutOverrides(newValue) {
|
|
656
|
-
state.osFlyoutOverrides = typeof newValue === 'string' ? JSON.parse(newValue) : newValue;
|
|
657
|
-
state.localizedConfig = await getLocalizedConfig({
|
|
658
|
-
projectId: this.project,
|
|
659
|
-
environment: this.environment,
|
|
660
|
-
language: this.language,
|
|
661
|
-
cookieKey: this.languageCookieKey,
|
|
662
|
-
localStorageKey: this.languageLocalStorageKey,
|
|
663
|
-
activeRouteProp: this.activeRoute,
|
|
664
|
-
localizedCustomConfig: state.localizedCustomConfig,
|
|
665
|
-
osFlyoutOverrides: state.osFlyoutOverrides,
|
|
666
|
-
});
|
|
667
|
-
}
|
|
668
|
-
async handleActiveRouteChange(newValue) {
|
|
669
|
-
state.localizedConfig = await getLocalizedConfig({
|
|
670
|
-
projectId: this.project,
|
|
671
|
-
environment: this.environment,
|
|
672
|
-
language: this.language,
|
|
673
|
-
cookieKey: this.languageCookieKey,
|
|
674
|
-
localStorageKey: this.languageLocalStorageKey,
|
|
675
|
-
activeRouteProp: newValue,
|
|
676
|
-
localizedCustomConfig: state.localizedCustomConfig,
|
|
677
|
-
osFlyoutOverrides: state.osFlyoutOverrides,
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
async handleCustomConfigChange(newValue) {
|
|
681
|
-
if (this.language === undefined)
|
|
682
|
-
return;
|
|
683
|
-
const localizedCustomConfig = getLocalizedCustomConfig(newValue, this.language);
|
|
684
|
-
state.localizedCustomConfig = localizedCustomConfig;
|
|
685
|
-
state.localizedConfig = await getLocalizedConfig({
|
|
686
|
-
projectId: this.project,
|
|
687
|
-
environment: this.environment,
|
|
688
|
-
language: this.language,
|
|
689
|
-
cookieKey: this.languageCookieKey,
|
|
690
|
-
localStorageKey: this.languageLocalStorageKey,
|
|
691
|
-
activeRouteProp: this.activeRoute,
|
|
692
|
-
localizedCustomConfig: localizedCustomConfig,
|
|
693
|
-
osFlyoutOverrides: state.osFlyoutOverrides,
|
|
694
|
-
});
|
|
695
|
-
}
|
|
696
|
-
handleSearchChange(newValue) {
|
|
697
|
-
state.search = newValue;
|
|
698
|
-
}
|
|
699
|
-
handleLoginChange(newValue) {
|
|
700
|
-
state.login = newValue;
|
|
701
|
-
}
|
|
702
|
-
handleMetaChange(newValue) {
|
|
703
|
-
state.meta = newValue;
|
|
704
|
-
}
|
|
705
|
-
handleLanguageChangeEvent(event) {
|
|
706
|
-
void this.handleLanguageChange(event.detail);
|
|
707
|
-
}
|
|
708
|
-
handleStickynessChange(newValue) {
|
|
709
|
-
state.stickyness = newValue;
|
|
710
|
-
if (typeof this.updateLogoAnimation === 'function')
|
|
711
|
-
this.updateLogoAnimation();
|
|
712
|
-
}
|
|
713
|
-
handleClickOutside(event) {
|
|
714
|
-
// Close active dropdown element on click outside of it
|
|
715
|
-
if (this.activeDropdownElement && !event.composedPath().includes(this.activeDropdownElement)) {
|
|
716
|
-
void this.activeDropdownElement.toggleDropdown(false);
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
handleKeyUp(event) {
|
|
720
|
-
if (event.key === 'Escape') {
|
|
721
|
-
if (this.activeDropdownElement) {
|
|
722
|
-
void this.activeDropdownElement.toggleDropdown(false);
|
|
723
|
-
}
|
|
724
|
-
if (this.activeFlyout !== null && this.mainNav) {
|
|
725
|
-
void this.mainNav.toggleDropdown(false);
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
handleScrollEvent() {
|
|
730
|
-
// Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
|
|
731
|
-
const st = this.scrollParent instanceof Document
|
|
732
|
-
? this.scrollParent.documentElement.scrollTop
|
|
733
|
-
: this.scrollParent.scrollTop;
|
|
734
|
-
// Toggle class without re-rendering the component if stickyness is minimal
|
|
735
|
-
// the other stickyness modes do not need the class
|
|
736
|
-
if (this.stickyness === 'minimal') {
|
|
737
|
-
this.host.classList.toggle('scrolling-up', st <= this.lastScrollTop);
|
|
738
|
-
}
|
|
739
|
-
// For Mobile or negative scrolling
|
|
740
|
-
this.lastScrollTop = st <= 0 ? 0 : st;
|
|
741
|
-
}
|
|
742
|
-
handleResize() {
|
|
743
|
-
var _a;
|
|
744
|
-
// Close main navigation dropdown if size changed to bigger than 1024px (search dropdown will be kept open)
|
|
745
|
-
if (this.isMainNavOpen() && this.lastWindowWidth < 1024 && window.innerWidth >= 1024) {
|
|
746
|
-
(_a = this.activeDropdownElement) === null || _a === void 0 ? void 0 : _a.toggleDropdown(false);
|
|
747
|
-
}
|
|
748
|
-
this.lastWindowWidth = window.innerWidth;
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* Close open dropdown menus if another is being opened
|
|
752
|
-
*
|
|
753
|
-
* @param event Dropdown toggled event
|
|
754
|
-
* @returns void
|
|
755
|
-
*/
|
|
756
|
-
handleDropdownToggled(event) {
|
|
757
|
-
if (!event.detail.open && this.activeDropdownElement !== event.detail.element) {
|
|
758
|
-
// Some dropdown got closed programmatically (possibly by this function). To prevent
|
|
759
|
-
// a circle or an outdated state, we'll not handle this event
|
|
760
|
-
return;
|
|
761
|
-
}
|
|
762
|
-
if (event.detail.open) {
|
|
763
|
-
if (this.activeDropdownElement) {
|
|
764
|
-
void this.activeDropdownElement.toggleDropdown(false);
|
|
765
|
-
}
|
|
766
|
-
this.activeDropdownElement = event.detail.element;
|
|
767
|
-
if (window.innerWidth >= 1024) {
|
|
768
|
-
// Add event listener to close active dropdown element on click outside of it
|
|
769
|
-
// Also adds 10ms delay in case of an external interaction:
|
|
770
|
-
// Some button on the page calls toggleDropdown() -> dropdown opens
|
|
771
|
-
// Click event bubbles to the window, this.handleClickOutsideBound closes dropdown again
|
|
772
|
-
window.setTimeout(() => {
|
|
773
|
-
window.addEventListener('click', this.handleClickOutsideBound);
|
|
774
|
-
}, 10);
|
|
775
|
-
}
|
|
776
|
-
if (this.activeFlyout !== null && this.mainNav) {
|
|
777
|
-
void this.mainNav.setActiveFlyout(null);
|
|
778
|
-
}
|
|
559
|
+
constructor() {
|
|
560
|
+
super();
|
|
561
|
+
this.__registerHost();
|
|
562
|
+
this.__attachShadow();
|
|
563
|
+
this.headerLoaded = createEvent(this, "headerLoaded", 7);
|
|
564
|
+
this.lastScrollTop = window.scrollY || document.documentElement.scrollTop;
|
|
565
|
+
this.lastWindowWidth = window.innerWidth;
|
|
566
|
+
this.handleClickOutsideBound = this.handleClickOutside.bind(this);
|
|
567
|
+
this.project = undefined;
|
|
568
|
+
this.stickyness = 'minimal';
|
|
569
|
+
this.language = undefined;
|
|
570
|
+
this.meta = true;
|
|
571
|
+
this.login = true;
|
|
572
|
+
this.search = true;
|
|
573
|
+
this.skiplinks = true;
|
|
574
|
+
this.configProxy = undefined;
|
|
575
|
+
this.environment = 'prod';
|
|
576
|
+
this.languageSwitchOverrides = undefined;
|
|
577
|
+
this.customConfig = undefined;
|
|
578
|
+
this.languageCookieKey = undefined;
|
|
579
|
+
this.languageLocalStorageKey = 'swisspost-internet-header-language';
|
|
580
|
+
this.logoutUrl = undefined;
|
|
581
|
+
this.activeRoute = 'auto';
|
|
582
|
+
this.osFlyoutOverrides = undefined;
|
|
583
|
+
this.fullWidth = false;
|
|
584
|
+
this.activeFlyout = null;
|
|
585
|
+
this.activeDropdownElement = null;
|
|
586
|
+
this.isMainSlotEmpty = true;
|
|
587
|
+
if (this.project === undefined || this.project === '' || !isValidProjectId(this.project)) {
|
|
588
|
+
throw new Error(`Internet Header project key is "${this.project}". Please provide a valid project key.`);
|
|
589
|
+
}
|
|
779
590
|
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
591
|
+
connectedCallback() {
|
|
592
|
+
this.throttledScroll = throttle(300, () => this.handleScrollEvent());
|
|
593
|
+
this.debouncedResize = debounce(200, () => this.handleResize());
|
|
594
|
+
}
|
|
595
|
+
disconnectedCallback() {
|
|
596
|
+
this.scrollParent.removeEventListener('scroll', this.throttledScroll);
|
|
597
|
+
this.scrollParent.removeEventListener('resize', this.debouncedResize);
|
|
598
|
+
// Reset the store to its original state
|
|
599
|
+
dispose();
|
|
600
|
+
}
|
|
601
|
+
async componentWillLoad() {
|
|
602
|
+
this.scrollParent = getScrollParent(this.host);
|
|
603
|
+
this.scrollParent.addEventListener('scroll', this.throttledScroll, { passive: true });
|
|
604
|
+
this.scrollParent.addEventListener('resize', this.debouncedResize, { passive: true });
|
|
605
|
+
// Wait for the config to arrive, then render the header
|
|
606
|
+
try {
|
|
607
|
+
state.projectId = this.project;
|
|
608
|
+
state.stickyness = this.stickyness;
|
|
609
|
+
state.environment = this.environment.toLocaleLowerCase();
|
|
610
|
+
if (this.language !== undefined)
|
|
611
|
+
state.currentLanguage = this.language;
|
|
612
|
+
state.languageSwitchOverrides =
|
|
613
|
+
typeof this.languageSwitchOverrides === 'string'
|
|
614
|
+
? JSON.parse(this.languageSwitchOverrides)
|
|
615
|
+
: this.languageSwitchOverrides;
|
|
616
|
+
state.osFlyoutOverrides =
|
|
617
|
+
typeof this.osFlyoutOverrides === 'string'
|
|
618
|
+
? JSON.parse(this.osFlyoutOverrides)
|
|
619
|
+
: this.osFlyoutOverrides;
|
|
620
|
+
if (this.customConfig !== undefined) {
|
|
621
|
+
const langs = Object.keys(typeof this.customConfig === 'string' ? JSON.parse(this.customConfig) : this.customConfig);
|
|
622
|
+
const lang = state.currentLanguage || getUserLang(langs, this.language);
|
|
623
|
+
state.localizedCustomConfig = getLocalizedCustomConfig(this.customConfig, lang);
|
|
624
|
+
}
|
|
625
|
+
state.localizedConfig = await getLocalizedConfig({
|
|
626
|
+
projectId: this.project,
|
|
627
|
+
environment: state.environment,
|
|
628
|
+
language: this.language,
|
|
629
|
+
cookieKey: this.languageCookieKey,
|
|
630
|
+
localStorageKey: this.languageLocalStorageKey,
|
|
631
|
+
activeRouteProp: this.activeRoute,
|
|
632
|
+
localizedCustomConfig: state.localizedCustomConfig,
|
|
633
|
+
osFlyoutOverrides: state.osFlyoutOverrides,
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
catch (error) {
|
|
637
|
+
console.error(error);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
componentDidLoad() {
|
|
641
|
+
window.requestAnimationFrame(() => {
|
|
642
|
+
this.handleResize();
|
|
643
|
+
this.headerLoaded.emit();
|
|
644
|
+
this.host.classList.add('header-loaded');
|
|
645
|
+
if (this.meta && this.metaNav) {
|
|
646
|
+
this.updateLogoAnimation = registerLogoAnimationObserver(this.metaNav, this.host);
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
if (this.stickyness === 'full')
|
|
650
|
+
console.warn('Internet Header: The stickyness="full" option is deprecated.');
|
|
651
|
+
}
|
|
652
|
+
async handleLanguageChange(newValue) {
|
|
653
|
+
state.currentLanguage = newValue;
|
|
654
|
+
state.localizedConfig = await getLocalizedConfig({
|
|
655
|
+
projectId: this.project,
|
|
656
|
+
environment: this.environment,
|
|
657
|
+
language: newValue,
|
|
658
|
+
cookieKey: this.languageCookieKey,
|
|
659
|
+
localStorageKey: this.languageLocalStorageKey,
|
|
660
|
+
activeRouteProp: this.activeRoute,
|
|
661
|
+
localizedCustomConfig: state.localizedCustomConfig,
|
|
662
|
+
osFlyoutOverrides: state.osFlyoutOverrides,
|
|
663
|
+
});
|
|
664
|
+
if (this.customConfig)
|
|
665
|
+
state.localizedCustomConfig = getLocalizedCustomConfig(this.customConfig, newValue);
|
|
666
|
+
}
|
|
667
|
+
handleAvailableLanguagesChange(newValue) {
|
|
668
|
+
state.languageSwitchOverrides = typeof newValue === 'string' ? JSON.parse(newValue) : newValue;
|
|
669
|
+
}
|
|
670
|
+
async handleOsFlyoutOverrides(newValue) {
|
|
671
|
+
state.osFlyoutOverrides = typeof newValue === 'string' ? JSON.parse(newValue) : newValue;
|
|
672
|
+
state.localizedConfig = await getLocalizedConfig({
|
|
673
|
+
projectId: this.project,
|
|
674
|
+
environment: this.environment,
|
|
675
|
+
language: this.language,
|
|
676
|
+
cookieKey: this.languageCookieKey,
|
|
677
|
+
localStorageKey: this.languageLocalStorageKey,
|
|
678
|
+
activeRouteProp: this.activeRoute,
|
|
679
|
+
localizedCustomConfig: state.localizedCustomConfig,
|
|
680
|
+
osFlyoutOverrides: state.osFlyoutOverrides,
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
async handleActiveRouteChange(newValue) {
|
|
684
|
+
state.localizedConfig = await getLocalizedConfig({
|
|
685
|
+
projectId: this.project,
|
|
686
|
+
environment: this.environment,
|
|
687
|
+
language: this.language,
|
|
688
|
+
cookieKey: this.languageCookieKey,
|
|
689
|
+
localStorageKey: this.languageLocalStorageKey,
|
|
690
|
+
activeRouteProp: newValue,
|
|
691
|
+
localizedCustomConfig: state.localizedCustomConfig,
|
|
692
|
+
osFlyoutOverrides: state.osFlyoutOverrides,
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
async handleCustomConfigChange(newValue) {
|
|
696
|
+
if (this.language === undefined)
|
|
697
|
+
return;
|
|
698
|
+
const localizedCustomConfig = getLocalizedCustomConfig(newValue, this.language);
|
|
699
|
+
state.localizedCustomConfig = localizedCustomConfig;
|
|
700
|
+
state.localizedConfig = await getLocalizedConfig({
|
|
701
|
+
projectId: this.project,
|
|
702
|
+
environment: this.environment,
|
|
703
|
+
language: this.language,
|
|
704
|
+
cookieKey: this.languageCookieKey,
|
|
705
|
+
localStorageKey: this.languageLocalStorageKey,
|
|
706
|
+
activeRouteProp: this.activeRoute,
|
|
707
|
+
localizedCustomConfig: localizedCustomConfig,
|
|
708
|
+
osFlyoutOverrides: state.osFlyoutOverrides,
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
handleSearchChange(newValue) {
|
|
712
|
+
state.search = newValue;
|
|
713
|
+
}
|
|
714
|
+
handleLoginChange(newValue) {
|
|
715
|
+
state.login = newValue;
|
|
716
|
+
}
|
|
717
|
+
handleMetaChange(newValue) {
|
|
718
|
+
state.meta = newValue;
|
|
719
|
+
}
|
|
720
|
+
handleLanguageChangeEvent(event) {
|
|
721
|
+
void this.handleLanguageChange(event.detail);
|
|
722
|
+
}
|
|
723
|
+
handleStickynessChange(newValue) {
|
|
724
|
+
state.stickyness = newValue;
|
|
725
|
+
if (typeof this.updateLogoAnimation === 'function')
|
|
726
|
+
this.updateLogoAnimation();
|
|
727
|
+
}
|
|
728
|
+
handleClickOutside(event) {
|
|
729
|
+
// Close active dropdown element on click outside of it
|
|
730
|
+
if (this.activeDropdownElement && !event.composedPath().includes(this.activeDropdownElement)) {
|
|
731
|
+
void this.activeDropdownElement.toggleDropdown(false);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
handleKeyUp(event) {
|
|
735
|
+
if (event.key === 'Escape') {
|
|
736
|
+
if (this.activeDropdownElement) {
|
|
737
|
+
void this.activeDropdownElement.toggleDropdown(false);
|
|
738
|
+
}
|
|
739
|
+
if (this.activeFlyout !== null && this.mainNav) {
|
|
740
|
+
void this.mainNav.toggleDropdown(false);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
handleScrollEvent() {
|
|
745
|
+
// Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
|
|
746
|
+
const st = this.scrollParent instanceof Document
|
|
747
|
+
? this.scrollParent.documentElement.scrollTop
|
|
748
|
+
: this.scrollParent.scrollTop;
|
|
749
|
+
// Toggle class without re-rendering the component if stickyness is minimal
|
|
750
|
+
// the other stickyness modes do not need the class
|
|
751
|
+
if (this.stickyness === 'minimal') {
|
|
752
|
+
this.host.classList.toggle('scrolling-up', st <= this.lastScrollTop);
|
|
753
|
+
}
|
|
754
|
+
// For Mobile or negative scrolling
|
|
755
|
+
this.lastScrollTop = st <= 0 ? 0 : st;
|
|
756
|
+
}
|
|
757
|
+
handleResize() {
|
|
758
|
+
var _a;
|
|
759
|
+
// Close main navigation dropdown if size changed to bigger than 1024px (search dropdown will be kept open)
|
|
760
|
+
if (this.isMainNavOpen() && this.lastWindowWidth < 1024 && window.innerWidth >= 1024) {
|
|
761
|
+
(_a = this.activeDropdownElement) === null || _a === void 0 ? void 0 : _a.toggleDropdown(false);
|
|
762
|
+
}
|
|
763
|
+
this.lastWindowWidth = window.innerWidth;
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Close open dropdown menus if another is being opened
|
|
767
|
+
*
|
|
768
|
+
* @param event Dropdown toggled event
|
|
769
|
+
* @returns void
|
|
770
|
+
*/
|
|
771
|
+
handleDropdownToggled(event) {
|
|
772
|
+
if (!event.detail.open && this.activeDropdownElement !== event.detail.element) {
|
|
773
|
+
// Some dropdown got closed programmatically (possibly by this function). To prevent
|
|
774
|
+
// a circle or an outdated state, we'll not handle this event
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
if (event.detail.open) {
|
|
778
|
+
if (this.activeDropdownElement) {
|
|
779
|
+
void this.activeDropdownElement.toggleDropdown(false);
|
|
780
|
+
}
|
|
781
|
+
this.activeDropdownElement = event.detail.element;
|
|
782
|
+
if (window.innerWidth >= 1024) {
|
|
783
|
+
// Add event listener to close active dropdown element on click outside of it
|
|
784
|
+
// Also adds 10ms delay in case of an external interaction:
|
|
785
|
+
// Some button on the page calls toggleDropdown() -> dropdown opens
|
|
786
|
+
// Click event bubbles to the window, this.handleClickOutsideBound closes dropdown again
|
|
787
|
+
window.setTimeout(() => {
|
|
788
|
+
window.addEventListener('click', this.handleClickOutsideBound);
|
|
789
|
+
}, 10);
|
|
790
|
+
}
|
|
791
|
+
if (this.activeFlyout !== null && this.mainNav) {
|
|
792
|
+
void this.mainNav.setActiveFlyout(null);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
this.activeDropdownElement = null;
|
|
797
|
+
// Remove event listener as it is not needed if no dropdown element is active
|
|
798
|
+
window.removeEventListener('click', this.handleClickOutsideBound);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Close open dropdowns if the flyout is being opened
|
|
803
|
+
* @param event Flyout toggle event
|
|
804
|
+
*/
|
|
805
|
+
handleFlyoutToggled(event) {
|
|
806
|
+
this.activeFlyout = event.detail;
|
|
807
|
+
if (this.activeDropdownElement && event.detail && !this.isMainNavOpen()) {
|
|
808
|
+
void this.activeDropdownElement.toggleDropdown(false);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
toggleMobileDropdown() {
|
|
812
|
+
var _a;
|
|
813
|
+
(_a = this.mainNav) === null || _a === void 0 ? void 0 : _a.toggleDropdown();
|
|
814
|
+
}
|
|
815
|
+
isMainNavOpen() {
|
|
816
|
+
return (this.activeDropdownElement && this.activeDropdownElement.tagName === 'POST-MAIN-NAVIGATION');
|
|
817
|
+
}
|
|
818
|
+
handleMainSlotChange(e) {
|
|
819
|
+
const mainSlot = e.target;
|
|
820
|
+
this.isMainSlotEmpty = mainSlot.assignedElements().length === 0;
|
|
821
|
+
}
|
|
822
|
+
render() {
|
|
823
|
+
var _a, _b, _c;
|
|
824
|
+
if (!((_a = state.localizedConfig) === null || _a === void 0 ? void 0 : _a.header)) {
|
|
825
|
+
console.error(new Error('Internet Header: Config cannot be loaded'));
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
828
|
+
const config = state.localizedConfig;
|
|
829
|
+
const renderMetaNavigation = this.meta &&
|
|
830
|
+
config.header.navMeta !== undefined &&
|
|
831
|
+
((_b = config.header.navMeta) === null || _b === void 0 ? void 0 : _b.filter(meta => !meta.isHomeLink).length) > 0;
|
|
832
|
+
const renderLogin = ((_c = this.login) !== null && _c !== void 0 ? _c : !config.header.isLoginWidgetHidden) && config.header.loginWidgetOptions;
|
|
833
|
+
const renderLanguageSwitch = config.header.navLang.length > 1;
|
|
834
|
+
return (h(Host, { class: `stickyness-${this.stickyness} ${Boolean(this.activeDropdownElement) || Boolean(this.activeFlyout) ? 'dropdown-open' : ''}`, "data-version": packageJson.version, onKeyup: (e) => this.handleKeyUp(e) }, h("header", { class: `post-internet-header${this.fullWidth ? ' full-width' : ''}` }, h(SvgSprite, null), h("h1", { class: "visually-hidden" }, translate('Navigate on post.ch')), h(If, { condition: this.skiplinks }, h("post-skiplinks", null)), h(If, { condition: renderMetaNavigation }, h("post-meta-navigation", { orientation: "horizontal", class: "hidden-lg", "full-width": this.fullWidth, ref: el => (this.metaNav = el) }, h(If, { condition: renderLanguageSwitch }, h("post-language-switch", { id: "post-language-switch-desktop", mode: "dropdown", onDropdownToggled: e => this.handleDropdownToggled(e) })))), h("div", { class: "main-navigation-container wide-container" }, h("post-logo", null), h("button", { class: "menu-button nav-link", onClick: () => this.toggleMobileDropdown(), "aria-haspopup": "menu", "aria-controls": "post-internet-header-main-navigation", "aria-expanded": this.activeDropdownElement ? 'true' : 'false' }, h("span", { class: "menu-button-text visually-hidden" }, config.header.mobileMenu.text), h(SvgIcon, { name: this.isMainNavOpen() ? 'pi-close' : 'pi-menu' })), h("post-main-navigation", { onDropdownToggled: e => this.handleDropdownToggled(e), onFlyoutToggled: e => this.handleFlyoutToggled(e), ref: el => (this.mainNav = el) }, h(If, { condition: renderMetaNavigation }, h("post-meta-navigation", { orientation: "vertical" }, h(If, { condition: renderLanguageSwitch }, h("post-language-switch", { id: "post-language-switch-mobile", mode: "list" }))))), h("div", { class: "main-navigation-controls" }, h("div", { class: "main-navigation-custom-content", hidden: this.isMainSlotEmpty }, h("slot", { name: "main", onSlotchange: e => this.handleMainSlotChange(e) })), h(If, { condition: this.search }, h("post-search", { onDropdownToggled: e => this.handleDropdownToggled(e) })), h(If, { condition: !!renderLogin }, h("post-klp-login-widget", { "logout-url": this.logoutUrl }, h("slot", { name: "login-widget" }))), h(If, { condition: !renderMetaNavigation && renderLanguageSwitch }, h("post-language-switch", { id: "post-language-switch-no-meta", onDropdownToggled: e => this.handleDropdownToggled(e), mode: "dropdown" })))))));
|
|
835
|
+
}
|
|
836
|
+
get host() { return this; }
|
|
837
|
+
static get watchers() { return {
|
|
838
|
+
"language": ["handleLanguageChange"],
|
|
839
|
+
"languageSwitchOverrides": ["handleAvailableLanguagesChange"],
|
|
840
|
+
"osFlyoutOverrides": ["handleOsFlyoutOverrides"],
|
|
841
|
+
"activeRoute": ["handleActiveRouteChange"],
|
|
842
|
+
"customConfig": ["handleCustomConfigChange"],
|
|
843
|
+
"search": ["handleSearchChange"],
|
|
844
|
+
"login": ["handleLoginChange"],
|
|
845
|
+
"meta": ["handleMetaChange"],
|
|
846
|
+
"stickyness": ["handleStickynessChange"]
|
|
847
|
+
}; }
|
|
848
|
+
static get style() { return postInternetHeaderCss; }
|
|
830
849
|
}, [1, "swisspost-internet-header", {
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
"
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
850
|
+
"project": [1],
|
|
851
|
+
"stickyness": [1],
|
|
852
|
+
"language": [1],
|
|
853
|
+
"meta": [4],
|
|
854
|
+
"login": [4],
|
|
855
|
+
"search": [4],
|
|
856
|
+
"skiplinks": [4],
|
|
857
|
+
"configProxy": [1, "config-proxy"],
|
|
858
|
+
"environment": [1],
|
|
859
|
+
"languageSwitchOverrides": [1, "language-switch-overrides"],
|
|
860
|
+
"customConfig": [1, "custom-config"],
|
|
861
|
+
"languageCookieKey": [1, "language-cookie-key"],
|
|
862
|
+
"languageLocalStorageKey": [1, "language-local-storage-key"],
|
|
863
|
+
"logoutUrl": [1, "logout-url"],
|
|
864
|
+
"activeRoute": [8, "active-route"],
|
|
865
|
+
"osFlyoutOverrides": [1, "os-flyout-overrides"],
|
|
866
|
+
"fullWidth": [4, "full-width"],
|
|
867
|
+
"activeFlyout": [32],
|
|
868
|
+
"activeDropdownElement": [32],
|
|
869
|
+
"isMainSlotEmpty": [32],
|
|
870
|
+
"getCurrentLanguage": [64]
|
|
871
|
+
}, [[0, "languageChanged", "handleLanguageChangeEvent"]], {
|
|
872
|
+
"language": ["handleLanguageChange"],
|
|
873
|
+
"languageSwitchOverrides": ["handleAvailableLanguagesChange"],
|
|
874
|
+
"osFlyoutOverrides": ["handleOsFlyoutOverrides"],
|
|
875
|
+
"activeRoute": ["handleActiveRouteChange"],
|
|
876
|
+
"customConfig": ["handleCustomConfigChange"],
|
|
877
|
+
"search": ["handleSearchChange"],
|
|
878
|
+
"login": ["handleLoginChange"],
|
|
879
|
+
"meta": ["handleMetaChange"],
|
|
880
|
+
"stickyness": ["handleStickynessChange"]
|
|
881
|
+
}]);
|
|
862
882
|
function defineCustomElement$1() {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
883
|
+
if (typeof customElements === "undefined") {
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
const components = ["swisspost-internet-header", "post-klp-login-widget", "post-language-switch", "post-logo", "post-main-navigation", "post-meta-navigation", "post-search", "post-skiplinks"];
|
|
887
|
+
components.forEach(tagName => { switch (tagName) {
|
|
888
|
+
case "swisspost-internet-header":
|
|
889
|
+
if (!customElements.get(tagName)) {
|
|
890
|
+
customElements.define(tagName, PostInternetHeader);
|
|
891
|
+
}
|
|
892
|
+
break;
|
|
893
|
+
case "post-klp-login-widget":
|
|
894
|
+
if (!customElements.get(tagName)) {
|
|
895
|
+
defineCustomElement$8();
|
|
896
|
+
}
|
|
897
|
+
break;
|
|
898
|
+
case "post-language-switch":
|
|
899
|
+
if (!customElements.get(tagName)) {
|
|
900
|
+
defineCustomElement$7();
|
|
901
|
+
}
|
|
902
|
+
break;
|
|
903
|
+
case "post-logo":
|
|
904
|
+
if (!customElements.get(tagName)) {
|
|
905
|
+
defineCustomElement$6();
|
|
906
|
+
}
|
|
907
|
+
break;
|
|
908
|
+
case "post-main-navigation":
|
|
909
|
+
if (!customElements.get(tagName)) {
|
|
910
|
+
defineCustomElement$5();
|
|
911
|
+
}
|
|
912
|
+
break;
|
|
913
|
+
case "post-meta-navigation":
|
|
914
|
+
if (!customElements.get(tagName)) {
|
|
915
|
+
defineCustomElement$4();
|
|
916
|
+
}
|
|
917
|
+
break;
|
|
918
|
+
case "post-search":
|
|
919
|
+
if (!customElements.get(tagName)) {
|
|
920
|
+
defineCustomElement$3();
|
|
921
|
+
}
|
|
922
|
+
break;
|
|
923
|
+
case "post-skiplinks":
|
|
924
|
+
if (!customElements.get(tagName)) {
|
|
925
|
+
defineCustomElement$2();
|
|
926
|
+
}
|
|
927
|
+
break;
|
|
928
|
+
} });
|
|
909
929
|
}
|
|
910
930
|
|
|
911
931
|
const SwisspostInternetHeader = PostInternetHeader;
|