@swisspost/internet-header 1.12.1 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (329) hide show
  1. package/dist/cjs/{index-4bd0adf1.js → index-d8f6eb4c.js} +16 -6
  2. package/dist/cjs/index-d8f6eb4c.js.map +1 -0
  3. package/dist/cjs/index.cjs.js +36 -0
  4. package/dist/cjs/index.cjs.js.map +1 -1
  5. package/dist/cjs/{klp-widget.controller-59fd5d5e.js → klp-widget.controller-8baf3b8a.js} +12 -14
  6. package/dist/cjs/klp-widget.controller-8baf3b8a.js.map +1 -0
  7. package/dist/cjs/{language.service-dbe2a435.js → language.service-ba88f512.js} +2 -2
  8. package/dist/cjs/{language.service-dbe2a435.js.map → language.service-ba88f512.js.map} +1 -1
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/post-internet-breadcrumbs-35549ad2.js +3616 -0
  11. package/dist/cjs/post-internet-breadcrumbs-35549ad2.js.map +1 -0
  12. package/dist/cjs/post-internet-footer-6077e395.js +161 -0
  13. package/dist/cjs/post-internet-footer-6077e395.js.map +1 -0
  14. package/dist/cjs/post-internet-header-d0833b40.js +828 -0
  15. package/dist/cjs/post-internet-header-d0833b40.js.map +1 -0
  16. package/dist/cjs/post-klp-login-widget-720e454a.js +63 -0
  17. package/dist/cjs/post-klp-login-widget-720e454a.js.map +1 -0
  18. package/dist/cjs/post-klp-login-widget.cjs.entry.js +6 -56
  19. package/dist/cjs/post-klp-login-widget.cjs.entry.js.map +1 -1
  20. package/dist/cjs/post-language-switch-e429b5b3.js +106 -0
  21. package/dist/cjs/post-language-switch-e429b5b3.js.map +1 -0
  22. package/dist/cjs/post-language-switch.cjs.entry.js +8 -99
  23. package/dist/cjs/post-language-switch.cjs.entry.js.map +1 -1
  24. package/dist/cjs/post-logo-da02bfef.js +25 -0
  25. package/dist/cjs/post-logo-da02bfef.js.map +1 -0
  26. package/dist/cjs/post-logo.cjs.entry.js +4 -18
  27. package/dist/cjs/post-logo.cjs.entry.js.map +1 -1
  28. package/dist/cjs/post-main-navigation-364129b8.js +240 -0
  29. package/dist/cjs/post-main-navigation-364129b8.js.map +1 -0
  30. package/dist/cjs/post-main-navigation.cjs.entry.js +9 -233
  31. package/dist/cjs/post-main-navigation.cjs.entry.js.map +1 -1
  32. package/dist/cjs/post-meta-navigation-287f3f61.js +26 -0
  33. package/dist/cjs/post-meta-navigation-287f3f61.js.map +1 -0
  34. package/dist/cjs/post-meta-navigation.cjs.entry.js +4 -19
  35. package/dist/cjs/post-meta-navigation.cjs.entry.js.map +1 -1
  36. package/dist/cjs/post-search-947e91e0.js +597 -0
  37. package/dist/cjs/post-search-947e91e0.js.map +1 -0
  38. package/dist/cjs/post-search.cjs.entry.js +11 -590
  39. package/dist/cjs/post-search.cjs.entry.js.map +1 -1
  40. package/dist/cjs/post-skiplinks-65c64b0a.js +52 -0
  41. package/dist/cjs/post-skiplinks-65c64b0a.js.map +1 -0
  42. package/dist/cjs/post-skiplinks.cjs.entry.js +6 -45
  43. package/dist/cjs/post-skiplinks.cjs.entry.js.map +1 -1
  44. package/dist/cjs/{store-77668e50.js → store-59e53b54.js} +2 -2
  45. package/dist/cjs/{store-77668e50.js.map → store-59e53b54.js.map} +1 -1
  46. package/dist/cjs/{svg-icon.component-5965f301.js → svg-icon.component-60f1d3d5.js} +2 -2
  47. package/dist/cjs/{svg-icon.component-5965f301.js.map → svg-icon.component-60f1d3d5.js.map} +1 -1
  48. package/dist/cjs/{svg-sprite.component-4b5677ef.js → svg-sprite.component-af7a21db.js} +3 -3
  49. package/dist/cjs/{svg-sprite.component-4b5677ef.js.map → svg-sprite.component-af7a21db.js.map} +1 -1
  50. package/dist/cjs/swisspost-internet-breadcrumbs.cjs.entry.js +11 -3609
  51. package/dist/cjs/swisspost-internet-breadcrumbs.cjs.entry.js.map +1 -1
  52. package/dist/cjs/swisspost-internet-footer.cjs.entry.js +6 -154
  53. package/dist/cjs/swisspost-internet-footer.cjs.entry.js.map +1 -1
  54. package/dist/cjs/swisspost-internet-header.cjs.entry.js +10 -824
  55. package/dist/cjs/swisspost-internet-header.cjs.entry.js.map +1 -1
  56. package/dist/cjs/swisspost-internet-header.cjs.js +2 -2
  57. package/dist/cjs/swisspost-internet-header.cjs.js.map +1 -1
  58. package/dist/collection/assets/js/klp-login-widget.js +11 -13
  59. package/dist/collection/collection-manifest.json +5 -5
  60. package/dist/collection/components/post-search/post-search.css +5 -3
  61. package/dist/collection/index.js +11 -1
  62. package/dist/collection/index.js.map +1 -1
  63. package/dist/collection/utils/svg-sprite.component.js +1 -1
  64. package/dist/collection/utils/svg-sprite.component.js.map +1 -1
  65. package/dist/components/index.js +10 -0
  66. package/dist/components/index.js.map +1 -1
  67. package/dist/components/klp-widget.controller.js +11 -13
  68. package/dist/components/klp-widget.controller.js.map +1 -1
  69. package/dist/components/post-search2.js +1 -1
  70. package/dist/components/post-search2.js.map +1 -1
  71. package/dist/components/store.js.map +1 -1
  72. package/dist/components/svg-sprite.component.js +1 -1
  73. package/dist/components/svg-sprite.component.js.map +1 -1
  74. package/dist/components/swisspost-internet-breadcrumbs.js +1 -1
  75. package/dist/components/swisspost-internet-footer.js +1 -1
  76. package/dist/components/swisspost-internet-header.js +17 -20
  77. package/dist/components/swisspost-internet-header.js.map +1 -1
  78. package/dist/docs.json +12 -12
  79. package/dist/esm/{index-2b83f5e9.js → index-9c3ab2a5.js} +16 -6
  80. package/dist/esm/index-9c3ab2a5.js.map +1 -0
  81. package/dist/esm/index.js +21 -1
  82. package/dist/esm/index.js.map +1 -1
  83. package/dist/esm/{klp-widget.controller-2a0a5183.js → klp-widget.controller-668f7e8d.js} +12 -14
  84. package/dist/esm/klp-widget.controller-668f7e8d.js.map +1 -0
  85. package/dist/esm/{language.service-501b09a8.js → language.service-ce320a05.js} +2 -2
  86. package/dist/esm/{language.service-501b09a8.js.map → language.service-ce320a05.js.map} +1 -1
  87. package/dist/esm/loader.js +2 -2
  88. package/dist/esm/post-internet-breadcrumbs-d66f6403.js +3614 -0
  89. package/dist/esm/post-internet-breadcrumbs-d66f6403.js.map +1 -0
  90. package/dist/esm/post-internet-footer-1a85281b.js +159 -0
  91. package/dist/esm/post-internet-footer-1a85281b.js.map +1 -0
  92. package/dist/esm/post-internet-header-2e386826.js +826 -0
  93. package/dist/esm/post-internet-header-2e386826.js.map +1 -0
  94. package/dist/esm/post-klp-login-widget-83bce2f7.js +61 -0
  95. package/dist/esm/post-klp-login-widget-83bce2f7.js.map +1 -0
  96. package/dist/esm/post-klp-login-widget.entry.js +5 -59
  97. package/dist/esm/post-klp-login-widget.entry.js.map +1 -1
  98. package/dist/esm/post-language-switch-c5fb82a7.js +104 -0
  99. package/dist/esm/post-language-switch-c5fb82a7.js.map +1 -0
  100. package/dist/esm/post-language-switch.entry.js +7 -102
  101. package/dist/esm/post-language-switch.entry.js.map +1 -1
  102. package/dist/esm/post-logo-9c64e476.js +23 -0
  103. package/dist/esm/post-logo-9c64e476.js.map +1 -0
  104. package/dist/esm/post-logo.entry.js +3 -21
  105. package/dist/esm/post-logo.entry.js.map +1 -1
  106. package/dist/esm/post-main-navigation-f65c6ae6.js +238 -0
  107. package/dist/esm/post-main-navigation-f65c6ae6.js.map +1 -0
  108. package/dist/esm/post-main-navigation.entry.js +8 -236
  109. package/dist/esm/post-main-navigation.entry.js.map +1 -1
  110. package/dist/esm/post-meta-navigation-ee6a10e5.js +24 -0
  111. package/dist/esm/post-meta-navigation-ee6a10e5.js.map +1 -0
  112. package/dist/esm/post-meta-navigation.entry.js +3 -22
  113. package/dist/esm/post-meta-navigation.entry.js.map +1 -1
  114. package/dist/esm/post-search-2bcee8ff.js +595 -0
  115. package/dist/esm/post-search-2bcee8ff.js.map +1 -0
  116. package/dist/esm/post-search.entry.js +10 -593
  117. package/dist/esm/post-search.entry.js.map +1 -1
  118. package/dist/esm/post-skiplinks-a6288afa.js +50 -0
  119. package/dist/esm/post-skiplinks-a6288afa.js.map +1 -0
  120. package/dist/esm/post-skiplinks.entry.js +5 -48
  121. package/dist/esm/post-skiplinks.entry.js.map +1 -1
  122. package/dist/esm/{store-80b19c12.js → store-654647f4.js} +2 -2
  123. package/dist/esm/{store-80b19c12.js.map → store-654647f4.js.map} +1 -1
  124. package/dist/esm/{svg-icon.component-7295f7cc.js → svg-icon.component-dd8bec82.js} +2 -2
  125. package/dist/esm/{svg-icon.component-7295f7cc.js.map → svg-icon.component-dd8bec82.js.map} +1 -1
  126. package/dist/esm/{svg-sprite.component-29439a18.js → svg-sprite.component-883e6b13.js} +3 -3
  127. package/dist/esm/{svg-sprite.component-29439a18.js.map → svg-sprite.component-883e6b13.js.map} +1 -1
  128. package/dist/esm/swisspost-internet-breadcrumbs.entry.js +10 -3612
  129. package/dist/esm/swisspost-internet-breadcrumbs.entry.js.map +1 -1
  130. package/dist/esm/swisspost-internet-footer.entry.js +5 -157
  131. package/dist/esm/swisspost-internet-footer.entry.js.map +1 -1
  132. package/dist/esm/swisspost-internet-header.entry.js +9 -827
  133. package/dist/esm/swisspost-internet-header.entry.js.map +1 -1
  134. package/dist/esm/swisspost-internet-header.js +3 -3
  135. package/dist/esm/swisspost-internet-header.js.map +1 -1
  136. package/dist/esm-es5/index-9c3ab2a5.js +2 -0
  137. package/dist/esm-es5/index-9c3ab2a5.js.map +1 -0
  138. package/dist/esm-es5/index.js +1 -1
  139. package/dist/esm-es5/{klp-widget.controller-2a0a5183.js → klp-widget.controller-668f7e8d.js} +2 -2
  140. package/dist/esm-es5/{klp-widget.controller-2a0a5183.js.map → klp-widget.controller-668f7e8d.js.map} +1 -1
  141. package/dist/esm-es5/{language.service-501b09a8.js → language.service-ce320a05.js} +2 -2
  142. package/dist/esm-es5/loader.js +1 -1
  143. package/dist/esm-es5/post-internet-breadcrumbs-d66f6403.js +7 -0
  144. package/dist/esm-es5/post-internet-breadcrumbs-d66f6403.js.map +1 -0
  145. package/dist/esm-es5/post-internet-footer-1a85281b.js +2 -0
  146. package/dist/esm-es5/post-internet-footer-1a85281b.js.map +1 -0
  147. package/dist/esm-es5/post-internet-header-2e386826.js +2 -0
  148. package/dist/esm-es5/post-internet-header-2e386826.js.map +1 -0
  149. package/dist/esm-es5/post-klp-login-widget-83bce2f7.js +2 -0
  150. package/dist/esm-es5/post-klp-login-widget-83bce2f7.js.map +1 -0
  151. package/dist/esm-es5/post-klp-login-widget.entry.js +1 -1
  152. package/dist/esm-es5/post-klp-login-widget.entry.js.map +1 -1
  153. package/dist/esm-es5/post-language-switch-c5fb82a7.js +2 -0
  154. package/dist/esm-es5/post-language-switch-c5fb82a7.js.map +1 -0
  155. package/dist/esm-es5/post-language-switch.entry.js +1 -1
  156. package/dist/esm-es5/post-language-switch.entry.js.map +1 -1
  157. package/dist/esm-es5/post-logo-9c64e476.js +2 -0
  158. package/dist/esm-es5/post-logo-9c64e476.js.map +1 -0
  159. package/dist/esm-es5/post-logo.entry.js +1 -1
  160. package/dist/esm-es5/post-logo.entry.js.map +1 -1
  161. package/dist/esm-es5/post-main-navigation-f65c6ae6.js +2 -0
  162. package/dist/esm-es5/post-main-navigation-f65c6ae6.js.map +1 -0
  163. package/dist/esm-es5/post-main-navigation.entry.js +1 -1
  164. package/dist/esm-es5/post-main-navigation.entry.js.map +1 -1
  165. package/dist/esm-es5/post-meta-navigation-ee6a10e5.js +2 -0
  166. package/dist/esm-es5/post-meta-navigation-ee6a10e5.js.map +1 -0
  167. package/dist/esm-es5/post-meta-navigation.entry.js +1 -1
  168. package/dist/esm-es5/post-meta-navigation.entry.js.map +1 -1
  169. package/dist/esm-es5/post-search-2bcee8ff.js +2 -0
  170. package/dist/esm-es5/post-search-2bcee8ff.js.map +1 -0
  171. package/dist/esm-es5/post-search.entry.js +1 -1
  172. package/dist/esm-es5/post-search.entry.js.map +1 -1
  173. package/dist/esm-es5/post-skiplinks-a6288afa.js +2 -0
  174. package/dist/esm-es5/post-skiplinks-a6288afa.js.map +1 -0
  175. package/dist/esm-es5/post-skiplinks.entry.js +1 -1
  176. package/dist/esm-es5/post-skiplinks.entry.js.map +1 -1
  177. package/dist/esm-es5/{store-80b19c12.js → store-654647f4.js} +2 -2
  178. package/dist/esm-es5/{store-80b19c12.js.map → store-654647f4.js.map} +1 -1
  179. package/dist/esm-es5/svg-icon.component-dd8bec82.js +2 -0
  180. package/dist/esm-es5/svg-sprite.component-883e6b13.js +2 -0
  181. package/dist/esm-es5/svg-sprite.component-883e6b13.js.map +1 -0
  182. package/dist/esm-es5/swisspost-internet-breadcrumbs.entry.js +1 -6
  183. package/dist/esm-es5/swisspost-internet-breadcrumbs.entry.js.map +1 -1
  184. package/dist/esm-es5/swisspost-internet-footer.entry.js +1 -1
  185. package/dist/esm-es5/swisspost-internet-footer.entry.js.map +1 -1
  186. package/dist/esm-es5/swisspost-internet-header.entry.js +1 -1
  187. package/dist/esm-es5/swisspost-internet-header.entry.js.map +1 -1
  188. package/dist/esm-es5/swisspost-internet-header.js +1 -1
  189. package/dist/esm-es5/swisspost-internet-header.js.map +1 -1
  190. package/dist/swisspost-internet-header/index.esm.js +1 -1
  191. package/dist/swisspost-internet-header/p-03700f57.entry.js +2 -0
  192. package/dist/swisspost-internet-header/p-0cc75941.js +2 -0
  193. package/dist/swisspost-internet-header/p-0cc75941.js.map +1 -0
  194. package/dist/swisspost-internet-header/{p-b8368eca.entry.js → p-0f41f18b.js} +2 -2
  195. package/dist/swisspost-internet-header/{p-64b3fabe.system.entry.js → p-11130047.system.js} +2 -2
  196. package/dist/swisspost-internet-header/{p-64b3fabe.system.entry.js.map → p-11130047.system.js.map} +1 -1
  197. package/dist/swisspost-internet-header/{p-5ec6e2de.system.entry.js → p-11ed194f.system.js} +2 -2
  198. package/dist/swisspost-internet-header/{p-5ec6e2de.system.entry.js.map → p-11ed194f.system.js.map} +1 -1
  199. package/dist/swisspost-internet-header/p-136336f4.system.js +2 -0
  200. package/dist/swisspost-internet-header/{p-6b18b251.system.entry.js.map → p-136336f4.system.js.map} +1 -1
  201. package/dist/swisspost-internet-header/p-16448630.entry.js +2 -0
  202. package/dist/swisspost-internet-header/p-16448630.entry.js.map +1 -0
  203. package/dist/swisspost-internet-header/{p-50da051d.system.entry.js → p-18784d29.system.js} +3 -3
  204. package/dist/swisspost-internet-header/{p-50da051d.system.entry.js.map → p-18784d29.system.js.map} +1 -1
  205. package/dist/swisspost-internet-header/{p-5adcdd91.system.js → p-1ba81427.system.js} +2 -2
  206. package/dist/swisspost-internet-header/{p-5adcdd91.system.js.map → p-1ba81427.system.js.map} +1 -1
  207. package/dist/swisspost-internet-header/p-1c803066.system.entry.js +2 -0
  208. package/dist/swisspost-internet-header/p-1c803066.system.entry.js.map +1 -0
  209. package/dist/swisspost-internet-header/p-1deb7484.system.entry.js +2 -0
  210. package/dist/swisspost-internet-header/p-1deb7484.system.entry.js.map +1 -0
  211. package/dist/swisspost-internet-header/{p-a7de7323.system.js → p-221cac54.system.js} +2 -2
  212. package/dist/swisspost-internet-header/p-265ea943.system.entry.js +2 -0
  213. package/dist/swisspost-internet-header/p-265ea943.system.entry.js.map +1 -0
  214. package/dist/swisspost-internet-header/p-27b931f4.js +3 -0
  215. package/dist/swisspost-internet-header/p-27b931f4.js.map +1 -0
  216. package/dist/swisspost-internet-header/p-2b4536f7.entry.js +2 -0
  217. package/dist/swisspost-internet-header/p-2b4536f7.entry.js.map +1 -0
  218. package/dist/swisspost-internet-header/p-32292ac8.system.js +2 -0
  219. package/dist/swisspost-internet-header/{p-65cd41a6.system.entry.js.map → p-32292ac8.system.js.map} +1 -1
  220. package/dist/swisspost-internet-header/{p-61074cb4.entry.js → p-34c8dc2c.js} +2 -2
  221. package/dist/swisspost-internet-header/p-36422c11.system.entry.js +2 -0
  222. package/dist/swisspost-internet-header/p-36422c11.system.entry.js.map +1 -0
  223. package/dist/swisspost-internet-header/{p-624d732c.js → p-3875e06a.js} +2 -2
  224. package/dist/swisspost-internet-header/{p-624d732c.js.map → p-3875e06a.js.map} +1 -1
  225. package/dist/swisspost-internet-header/p-3d724e84.system.js +3 -0
  226. package/dist/swisspost-internet-header/p-3d724e84.system.js.map +1 -0
  227. package/dist/swisspost-internet-header/p-460d3542.system.js +2 -0
  228. package/dist/swisspost-internet-header/p-460d3542.system.js.map +1 -0
  229. package/dist/swisspost-internet-header/{p-f5a1e4a6.entry.js → p-4fa19e3b.js} +2 -2
  230. package/dist/swisspost-internet-header/{p-21d8e5bc.entry.js → p-53847bbe.js} +2 -2
  231. package/dist/swisspost-internet-header/{p-62ae68ad.system.entry.js → p-583cb740.system.js} +2 -2
  232. package/dist/swisspost-internet-header/{p-62ae68ad.system.entry.js.map → p-583cb740.system.js.map} +1 -1
  233. package/dist/swisspost-internet-header/{p-bcd01683.system.js → p-5f246e59.system.js} +2 -2
  234. package/dist/swisspost-internet-header/{p-bcd01683.system.js.map → p-5f246e59.system.js.map} +1 -1
  235. package/dist/swisspost-internet-header/{p-76e3cd9c.entry.js → p-606bbe0b.js} +3 -3
  236. package/dist/swisspost-internet-header/{p-9d827167.system.entry.js → p-7333dfb8.system.js} +2 -2
  237. package/dist/swisspost-internet-header/{p-9d827167.system.entry.js.map → p-7333dfb8.system.js.map} +1 -1
  238. package/dist/swisspost-internet-header/p-7d9a5ba9.system.js +2 -0
  239. package/dist/swisspost-internet-header/{p-c201f1b3.system.entry.js.map → p-7d9a5ba9.system.js.map} +1 -1
  240. package/dist/swisspost-internet-header/{p-5a897619.js → p-7eaa5689.js} +2 -2
  241. package/dist/swisspost-internet-header/{p-5a897619.js.map → p-7eaa5689.js.map} +1 -1
  242. package/dist/swisspost-internet-header/{p-a097e677.system.entry.js → p-7f25dd1a.system.js} +2 -2
  243. package/dist/swisspost-internet-header/{p-a097e677.system.entry.js.map → p-7f25dd1a.system.js.map} +1 -1
  244. package/dist/swisspost-internet-header/p-7f458307.js +2 -0
  245. package/dist/swisspost-internet-header/{p-04b1cab7.entry.js → p-81245339.js} +2 -2
  246. package/dist/swisspost-internet-header/p-8238173f.entry.js +2 -0
  247. package/dist/swisspost-internet-header/p-8238173f.entry.js.map +1 -0
  248. package/dist/swisspost-internet-header/{p-2e334cfc.entry.js → p-861ca9cc.js} +2 -2
  249. package/dist/swisspost-internet-header/p-8e8fdd91.js +2 -0
  250. package/dist/swisspost-internet-header/{p-069dbe32.entry.js.map → p-8e8fdd91.js.map} +1 -1
  251. package/dist/swisspost-internet-header/p-8f7878f8.system.entry.js +2 -0
  252. package/dist/swisspost-internet-header/p-8f7878f8.system.entry.js.map +1 -0
  253. package/dist/swisspost-internet-header/{p-9af33755.system.js → p-90495bab.system.js} +2 -2
  254. package/dist/swisspost-internet-header/{p-9af33755.system.js.map → p-90495bab.system.js.map} +1 -1
  255. package/dist/swisspost-internet-header/p-957c0b41.system.entry.js +2 -0
  256. package/dist/swisspost-internet-header/p-957c0b41.system.entry.js.map +1 -0
  257. package/dist/swisspost-internet-header/{p-ad9a417b.system.js → p-a27d0d9d.system.js} +2 -2
  258. package/dist/swisspost-internet-header/p-a27dde06.system.entry.js +2 -0
  259. package/dist/swisspost-internet-header/p-a27dde06.system.entry.js.map +1 -0
  260. package/dist/swisspost-internet-header/p-abd9c082.system.js +2 -0
  261. package/dist/swisspost-internet-header/p-abd9c082.system.js.map +1 -0
  262. package/dist/swisspost-internet-header/p-af910442.entry.js +2 -0
  263. package/dist/swisspost-internet-header/p-af910442.entry.js.map +1 -0
  264. package/dist/swisspost-internet-header/p-b62bbe38.js +2 -0
  265. package/dist/swisspost-internet-header/{p-b3ad4f8a.entry.js.map → p-b62bbe38.js.map} +1 -1
  266. package/dist/swisspost-internet-header/p-b924a94f.system.entry.js +2 -0
  267. package/dist/swisspost-internet-header/p-b924a94f.system.entry.js.map +1 -0
  268. package/dist/swisspost-internet-header/p-bc9e30be.entry.js +2 -0
  269. package/dist/swisspost-internet-header/p-bc9e30be.entry.js.map +1 -0
  270. package/dist/swisspost-internet-header/p-c0181582.system.entry.js +2 -0
  271. package/dist/swisspost-internet-header/p-c0181582.system.entry.js.map +1 -0
  272. package/dist/swisspost-internet-header/{p-9acc06ba.system.entry.js → p-c9baeae6.system.js} +2 -2
  273. package/dist/swisspost-internet-header/{p-9acc06ba.system.entry.js.map → p-c9baeae6.system.js.map} +1 -1
  274. package/dist/swisspost-internet-header/{p-dc8296bd.js → p-cf46d687.js} +2 -2
  275. package/dist/swisspost-internet-header/p-d26e34e9.entry.js +2 -0
  276. package/dist/swisspost-internet-header/p-d26e34e9.entry.js.map +1 -0
  277. package/dist/swisspost-internet-header/p-f19aad4d.entry.js +2 -0
  278. package/dist/swisspost-internet-header/p-f19aad4d.entry.js.map +1 -0
  279. package/dist/swisspost-internet-header/p-f1ce2d29.entry.js +2 -0
  280. package/dist/swisspost-internet-header/p-f1ce2d29.entry.js.map +1 -0
  281. package/dist/swisspost-internet-header/{p-d2fd2ff6.entry.js → p-f67f47fb.js} +2 -2
  282. package/dist/swisspost-internet-header/p-f7cf9f71.entry.js +2 -0
  283. package/dist/swisspost-internet-header/p-f7cf9f71.entry.js.map +1 -0
  284. package/dist/swisspost-internet-header/p-fdc2ba17.system.entry.js +2 -0
  285. package/dist/swisspost-internet-header/p-fdc2ba17.system.entry.js.map +1 -0
  286. package/dist/swisspost-internet-header/swisspost-internet-header.esm.js +1 -1
  287. package/dist/swisspost-internet-header/swisspost-internet-header.esm.js.map +1 -1
  288. package/dist/swisspost-internet-header/swisspost-internet-header.js +1 -1
  289. package/dist/types/index.d.ts +10 -0
  290. package/package.json +16 -18
  291. package/dist/cjs/index-4bd0adf1.js.map +0 -1
  292. package/dist/cjs/klp-widget.controller-59fd5d5e.js.map +0 -1
  293. package/dist/esm/index-2b83f5e9.js.map +0 -1
  294. package/dist/esm/klp-widget.controller-2a0a5183.js.map +0 -1
  295. package/dist/esm-es5/index-2b83f5e9.js +0 -2
  296. package/dist/esm-es5/index-2b83f5e9.js.map +0 -1
  297. package/dist/esm-es5/svg-icon.component-7295f7cc.js +0 -2
  298. package/dist/esm-es5/svg-sprite.component-29439a18.js +0 -2
  299. package/dist/esm-es5/svg-sprite.component-29439a18.js.map +0 -1
  300. package/dist/swisspost-internet-header/p-069dbe32.entry.js +0 -2
  301. package/dist/swisspost-internet-header/p-2470951e.js +0 -2
  302. package/dist/swisspost-internet-header/p-50ea2036.system.js +0 -2
  303. package/dist/swisspost-internet-header/p-60ea6000.js +0 -2
  304. package/dist/swisspost-internet-header/p-60ea6000.js.map +0 -1
  305. package/dist/swisspost-internet-header/p-65cd41a6.system.entry.js +0 -2
  306. package/dist/swisspost-internet-header/p-6b18b251.system.entry.js +0 -2
  307. package/dist/swisspost-internet-header/p-74fea9b8.system.js +0 -2
  308. package/dist/swisspost-internet-header/p-74fea9b8.system.js.map +0 -1
  309. package/dist/swisspost-internet-header/p-9c385f74.system.js +0 -3
  310. package/dist/swisspost-internet-header/p-9c385f74.system.js.map +0 -1
  311. package/dist/swisspost-internet-header/p-b3ad4f8a.entry.js +0 -2
  312. package/dist/swisspost-internet-header/p-c201f1b3.system.entry.js +0 -2
  313. package/dist/swisspost-internet-header/p-e2e1c5d4.js +0 -3
  314. package/dist/swisspost-internet-header/p-e2e1c5d4.js.map +0 -1
  315. /package/dist/esm-es5/{language.service-501b09a8.js.map → language.service-ce320a05.js.map} +0 -0
  316. /package/dist/esm-es5/{svg-icon.component-7295f7cc.js.map → svg-icon.component-dd8bec82.js.map} +0 -0
  317. /package/dist/swisspost-internet-header/{p-50ea2036.system.js.map → p-03700f57.entry.js.map} +0 -0
  318. /package/dist/swisspost-internet-header/{p-b8368eca.entry.js.map → p-0f41f18b.js.map} +0 -0
  319. /package/dist/swisspost-internet-header/{p-a7de7323.system.js.map → p-221cac54.system.js.map} +0 -0
  320. /package/dist/swisspost-internet-header/{p-61074cb4.entry.js.map → p-34c8dc2c.js.map} +0 -0
  321. /package/dist/swisspost-internet-header/{p-f5a1e4a6.entry.js.map → p-4fa19e3b.js.map} +0 -0
  322. /package/dist/swisspost-internet-header/{p-21d8e5bc.entry.js.map → p-53847bbe.js.map} +0 -0
  323. /package/dist/swisspost-internet-header/{p-76e3cd9c.entry.js.map → p-606bbe0b.js.map} +0 -0
  324. /package/dist/swisspost-internet-header/{p-2470951e.js.map → p-7f458307.js.map} +0 -0
  325. /package/dist/swisspost-internet-header/{p-04b1cab7.entry.js.map → p-81245339.js.map} +0 -0
  326. /package/dist/swisspost-internet-header/{p-2e334cfc.entry.js.map → p-861ca9cc.js.map} +0 -0
  327. /package/dist/swisspost-internet-header/{p-ad9a417b.system.js.map → p-a27d0d9d.system.js.map} +0 -0
  328. /package/dist/swisspost-internet-header/{p-dc8296bd.js.map → p-cf46d687.js.map} +0 -0
  329. /package/dist/swisspost-internet-header/{p-d2fd2ff6.entry.js.map → p-f67f47fb.js.map} +0 -0
@@ -0,0 +1,826 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-9c3ab2a5.js';
2
+ import { d as debounce, t as throttle } from './index-d2256e06.js';
3
+ import { g as getUserLang, p as persistLanguageChoice, t as translate } from './language.service-ce320a05.js';
4
+ import { u as uniqueId } from './utils-3a8ff48f.js';
5
+ import { s as state, d as dispose } from './store-654647f4.js';
6
+ import { S as SvgSprite } from './svg-sprite.component-883e6b13.js';
7
+ import { S as SvgIcon } from './svg-icon.component-dd8bec82.js';
8
+ import { I as If } from './if.component-3a779aca.js';
9
+
10
+ /**
11
+ * Activate the current route based on the config and the match mode
12
+ * @param config Main Navigation Config
13
+ * @param activeRouteProp Match mode
14
+ * @returns Modified Main Navigation Config
15
+ */
16
+ const markActiveRoute = (config, activeRouteProp) => {
17
+ // Don't highlight any route
18
+ if (activeRouteProp === false) {
19
+ return config;
20
+ }
21
+ // Set compare URL and check if activeRouteProp is valid
22
+ let compareUrl;
23
+ config = resetOverrideConfig(config);
24
+ if (activeRouteProp === 'auto' || activeRouteProp === 'exact') {
25
+ // Check if an active route is already configured, set override to that and return
26
+ if (hasActivePortalRoute(config)) {
27
+ return resetActiveStateToPortalConfig(config);
28
+ }
29
+ compareUrl = new URL(window.location.href);
30
+ }
31
+ else {
32
+ try {
33
+ compareUrl = new URL(activeRouteProp, document.location.origin);
34
+ }
35
+ catch (error) {
36
+ console.warn(`Active Route: ${activeRouteProp} is not a valid URL. Navigation highlighting has been disabled.`);
37
+ return config;
38
+ }
39
+ }
40
+ const scoreList = compileScoreList(config, compareUrl, activeRouteProp);
41
+ if (scoreList.length === 0) {
42
+ // No match found or already active links defined
43
+ return config;
44
+ }
45
+ const winnerPair = scoreList[0];
46
+ winnerPair.main.isActiveOverride = true;
47
+ if (winnerPair.sub)
48
+ winnerPair.sub.isActiveOverride = true;
49
+ return config;
50
+ };
51
+ /**
52
+ * Check if the portal config set any active route
53
+ * @param config Main navigation config
54
+ * @returns True if portal set any route as active
55
+ */
56
+ const hasActivePortalRoute = (config) => {
57
+ return config.filter(nav => nav.isActive).length > 0;
58
+ };
59
+ const resetActiveStateToPortalConfig = (config) => {
60
+ 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 }))) }))) })));
61
+ };
62
+ const resetOverrideConfig = (config) => {
63
+ 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 }))) }))) })));
64
+ };
65
+ /**
66
+ * Compile a list of scores based on the map mode, sorted in descending order
67
+ * @param config Main Nav Config
68
+ * @param compareUrl Current Browser URL or a custom URL
69
+ * @param activeRouteProp Match mode
70
+ * @returns A list of scored URLs if any matched
71
+ */
72
+ const compileScoreList = (config, compareUrl, activeRouteProp) => {
73
+ // Flag to check if the Portal set any active links or if there are any exact matches
74
+ let hadAnyActiveLink = false;
75
+ const scoreList = [];
76
+ config
77
+ .filter(mainNav => !hadAnyActiveLink && mainNav)
78
+ .forEach(mainNav => {
79
+ try {
80
+ const score = compareRoutes(compareUrl, new URL(mainNav.url), activeRouteProp);
81
+ hadAnyActiveLink = updateScoreList(scoreList, score, { main: mainNav, score }, hadAnyActiveLink);
82
+ }
83
+ catch (_a) {
84
+ // Not a valid url, continue
85
+ }
86
+ // Loop through flyout links 2nd level
87
+ mainNav.flyout.forEach(flyout => {
88
+ var _a;
89
+ (_a = flyout.linkList) === null || _a === void 0 ? void 0 : _a.forEach(linklist => {
90
+ // Don't override if any link is already active
91
+ if (linklist.isActive && (activeRouteProp === 'auto' || activeRouteProp === 'exact')) {
92
+ hadAnyActiveLink = true;
93
+ return;
94
+ }
95
+ try {
96
+ const url = new URL(linklist.url);
97
+ const score = compareRoutes(compareUrl, url, activeRouteProp);
98
+ hadAnyActiveLink = updateScoreList(scoreList, score, { main: mainNav, sub: linklist, score }, hadAnyActiveLink);
99
+ }
100
+ catch (_a) {
101
+ // Not a valid URL, continue
102
+ }
103
+ });
104
+ });
105
+ });
106
+ return scoreList.sort((a, b) => b.score - a.score);
107
+ };
108
+ /**
109
+ * Update score list
110
+ */
111
+ function updateScoreList(scoreList, score, scoreListItem, hadAnyActiveLink) {
112
+ let hadActiveLink = hadAnyActiveLink;
113
+ if (score > 0) {
114
+ if (score === Infinity)
115
+ hadActiveLink = true;
116
+ // Push score
117
+ scoreList.push(scoreListItem);
118
+ }
119
+ return hadActiveLink;
120
+ }
121
+ /**
122
+ * Compare two URLs for similarity based on a match mode
123
+ * @param baseUrl Browser URL
124
+ * @param compareUrl Navigatgion URL
125
+ * @param matchMode exact or auto matching
126
+ * @returns Score
127
+ */
128
+ const compareRoutes = (baseUrl, compareUrl, matchMode) => {
129
+ // One url is not defined or they don't share the same orign
130
+ if (baseUrl === null || compareUrl === null || baseUrl.origin !== compareUrl.origin) {
131
+ return 0;
132
+ }
133
+ const baseUrlPath = baseUrl.pathname.toLocaleLowerCase();
134
+ const compareUrlPath = compareUrl.pathname.toLocaleLowerCase();
135
+ // Exact match, origin and pathname are the same
136
+ if (baseUrlPath === compareUrlPath) {
137
+ return Infinity;
138
+ }
139
+ // The basepath is longer than the comparison, a match is impossible
140
+ if (baseUrl.pathname.length < compareUrl.pathname.length) {
141
+ return 0;
142
+ }
143
+ if (matchMode === 'auto') {
144
+ const baseSegments = [
145
+ baseUrl.origin.toLocaleLowerCase(),
146
+ ...baseUrlPath.split('/').filter(x => x !== null && x !== ''),
147
+ ];
148
+ const compareSegments = [
149
+ compareUrl.origin.toLocaleLowerCase(),
150
+ ...compareUrlPath.split('/').filter(x => x !== null && x !== ''),
151
+ ];
152
+ const score = getSimilarityScore(baseSegments, compareSegments);
153
+ // If only some segments match, but not the whole smaller array, it's not a match
154
+ return Math.min(baseSegments.length, compareSegments.length) === score ? score : 0;
155
+ }
156
+ return 0;
157
+ };
158
+ /**
159
+ * Check how many items in an array match
160
+ * @param a Base array
161
+ * @param b Compare array
162
+ * @returns Score
163
+ */
164
+ const getSimilarityScore = (a, b) => {
165
+ if (a == null || b == null || a.length === 0 || b.length === 0) {
166
+ return 0;
167
+ }
168
+ let i = 0;
169
+ for (; i < Math.min(a.length, b.length); i++) {
170
+ if (a[i] !== b[i]) {
171
+ return 0;
172
+ }
173
+ }
174
+ return i;
175
+ };
176
+
177
+ // Prevent double requests
178
+ let request = null;
179
+ // Cache the original os flyout to use it for updates
180
+ let osFlyoutCache = null;
181
+ const getPPMConfig = () => {
182
+ const ppmConfigScript = document.querySelector('#PPM_HEADER_DATA');
183
+ if ((ppmConfigScript === null || ppmConfigScript === void 0 ? void 0 : ppmConfigScript.textContent) != null) {
184
+ return JSON.parse(ppmConfigScript.textContent);
185
+ }
186
+ return null;
187
+ };
188
+ /**
189
+ * Get a localized config object
190
+ *
191
+ * @param projectId String identifying the project
192
+ * @param language [optional] Preferred language
193
+ * @returns Localized config object
194
+ */
195
+ const getLocalizedConfig = async ({ projectId, environment, language, cookieKey, localStorageKey, activeRouteProp, localizedCustomConfig, osFlyoutOverrides, }) => {
196
+ var _a, _b;
197
+ const ppmConfig = getPPMConfig();
198
+ let localizedConfig;
199
+ let config = null;
200
+ let lang;
201
+ if (ppmConfig) {
202
+ localizedConfig = ppmConfig;
203
+ lang = document.documentElement.lang;
204
+ }
205
+ else {
206
+ if (request == null) {
207
+ request = fetchConfig(projectId, environment);
208
+ }
209
+ config = await request;
210
+ lang = getUserLang(Object.keys(config), language, localStorageKey, cookieKey);
211
+ if (lang === undefined) {
212
+ throw new Error('Internet Header: unable to determine current language');
213
+ }
214
+ // Clone config for more predictable state updates
215
+ localizedConfig = Object.assign({}, config[lang]);
216
+ }
217
+ // Merge custom config with portal config
218
+ if (localizedCustomConfig) {
219
+ const header = ((_a = localizedCustomConfig === null || localizedCustomConfig === void 0 ? void 0 : localizedCustomConfig.header) === null || _a === void 0 ? void 0 : _a.navMain)
220
+ ? Object.assign(Object.assign({}, localizedConfig.header), { navMain: [...localizedConfig.header.navMain, ...localizedCustomConfig.header.navMain] }) : localizedConfig.header;
221
+ localizedConfig = Object.assign(Object.assign({}, localizedConfig), { header });
222
+ }
223
+ // Add entries to flyout_os
224
+ if (osFlyoutOverrides)
225
+ localizedConfig.header.navMain = mergeOsFlyoutOverrides(localizedConfig, osFlyoutOverrides);
226
+ // Mark active route
227
+ if (activeRouteProp != null)
228
+ localizedConfig.header.navMain = markActiveRoute(localizedConfig.header.navMain, activeRouteProp);
229
+ setMainNavigationIds((_b = localizedConfig === null || localizedConfig === void 0 ? void 0 : localizedConfig.header) === null || _b === void 0 ? void 0 : _b.navMain);
230
+ // Set the new language choice
231
+ persistLanguageChoice(lang, cookieKey, localStorageKey);
232
+ return localizedConfig;
233
+ };
234
+ /**
235
+ * Merge portal config with custom os flyout overrides
236
+ * @param config Localized config
237
+ * @param osFlyoutOverrides Overrides for the flyout
238
+ * @returns Merged localized config
239
+ */
240
+ const mergeOsFlyoutOverrides = (config, osFlyoutOverrides) => {
241
+ if (osFlyoutOverrides == null)
242
+ return config.header.navMain;
243
+ return config.header.navMain.map(mainNav => {
244
+ var _a, _b;
245
+ if (mainNav.id !== 'flyout_os')
246
+ return mainNav;
247
+ if (osFlyoutCache === null) {
248
+ osFlyoutCache = JSON.parse(JSON.stringify(mainNav));
249
+ }
250
+ const mainNavText = (_a = osFlyoutOverrides.text) !== null && _a !== void 0 ? _a : osFlyoutCache.text;
251
+ const mainNavTitle = (_b = osFlyoutOverrides.title) !== null && _b !== void 0 ? _b : osFlyoutCache.title;
252
+ if (osFlyoutCache.flyout == null ||
253
+ osFlyoutCache.flyout.length === 0 ||
254
+ osFlyoutOverrides.flyout == null ||
255
+ osFlyoutOverrides.flyout.length === 0)
256
+ return Object.assign(Object.assign({}, mainNav), { title: mainNavTitle, text: mainNavText });
257
+ // Add entries for os flyout columns without overriding existing config
258
+ const mainNavFlyout = [
259
+ ...osFlyoutCache.flyout.map((col, index) => {
260
+ var _a;
261
+ const overrides = osFlyoutOverrides.flyout[index];
262
+ const title = (_a = overrides.title) !== null && _a !== void 0 ? _a : col.title;
263
+ const linkList = overrides.linkList != null ? osFlyoutOverrides.flyout[index].linkList : [];
264
+ return {
265
+ title,
266
+ linkList: [...col.linkList, ...linkList],
267
+ };
268
+ }),
269
+ ...osFlyoutOverrides.flyout.slice(osFlyoutCache.flyout.length),
270
+ ];
271
+ return Object.assign(Object.assign({}, mainNav), { text: mainNavText, title: mainNavTitle, flyout: mainNavFlyout });
272
+ });
273
+ };
274
+ /**
275
+ * Fetch the general config based on project id
276
+ *
277
+ * @returns Promise for Post Portal general config
278
+ */
279
+ const fetchConfig = async (projectId, environment) => {
280
+ // Check if project id is sanitized
281
+ if (!isValidProjectId(projectId)) {
282
+ throw new Error(`Internet Header: invalid project id "${projectId}"`);
283
+ }
284
+ if (projectId === 'test') {
285
+ environment = 'int01';
286
+ }
287
+ let url = generateConfigUrl(projectId, environment);
288
+ // Get the config if cache is invalid
289
+ try {
290
+ const res = await fetch(url);
291
+ return (await res.json());
292
+ }
293
+ catch (error) {
294
+ throw new Error(`Internet Header: fetching config failed. ${error.message}`);
295
+ }
296
+ };
297
+ /**
298
+ * Generate an URL with all necessary query params to get the configuration.
299
+ * Project id "test" will return a test configuration
300
+ * @param projectId string
301
+ * @param environment int01, int02 or prod
302
+ * @returns URL pointing to the project config
303
+ */
304
+ const generateConfigUrl = (projectId, environment) => {
305
+ if (projectId === 'test')
306
+ return 'assets/config/test-configuration.json';
307
+ const parsedEnvironment = environment.toLowerCase();
308
+ const isProd = parsedEnvironment === 'prod';
309
+ const host = `https://${isProd ? 'www' : 'int'}.post.ch`;
310
+ try {
311
+ // Use URL to validate the generated URL
312
+ return new URL(`${host}/api/headerjs/Json?serviceid=${encodeURIComponent(projectId)}${!isProd ? '&environment=' + parsedEnvironment : ''}`).toString();
313
+ }
314
+ catch (error) {
315
+ throw new Error(`Internet Header: Config URL is invalid.`);
316
+ }
317
+ };
318
+ /**
319
+ * Check if project id contains only URL safe characters
320
+ *
321
+ * @param projectId Project Id string
322
+ * @returns The valid project id
323
+ */
324
+ const isValidProjectId = (projectId) => {
325
+ return projectId !== '' && projectId.length > 0 && /^[a-zA-Z][\w-]*[a-zA-Z0-9]$/.test(projectId);
326
+ };
327
+ /**
328
+ * Get the localized config object from a custom config
329
+ *
330
+ * @param config String or json object of the custom config
331
+ * @param language Specific language
332
+ * @returns Localized custom config object
333
+ */
334
+ const getLocalizedCustomConfig = (config, language) => {
335
+ var _a;
336
+ let customConfig;
337
+ try {
338
+ customConfig = typeof config === 'string' ? JSON.parse(config) : config;
339
+ }
340
+ catch (error) {
341
+ throw new Error(`Internet Header: Custom config is invalid. Make sure your custom config contains valid JSON syntax and matches the definition. `);
342
+ }
343
+ let localizedCustomConfig = customConfig[language];
344
+ if ((_a = localizedCustomConfig === null || localizedCustomConfig === void 0 ? void 0 : localizedCustomConfig.header) === null || _a === void 0 ? void 0 : _a.navMain)
345
+ setMainNavigationIds(localizedCustomConfig.header.navMain);
346
+ return localizedCustomConfig;
347
+ };
348
+ /**
349
+ * Set unique ID's on main navigation entities but conserve flyout_os to be able to
350
+ * identify the online-service flyout, which can be configured by osFlyoutOverrides
351
+ */
352
+ const setMainNavigationIds = (navMainEntities) => {
353
+ navMainEntities.forEach(navMainEntity => {
354
+ navMainEntity.id = navMainEntity.id === 'flyout_os' ? navMainEntity.id : uniqueId('main-nav-');
355
+ });
356
+ };
357
+
358
+ const name = "@swisspost/internet-header";
359
+ const version = "1.13.0";
360
+ const description = "The header for client facing applications.";
361
+ const author = "Swiss Post <oss@post.ch>";
362
+ const license = "Apache-2.0";
363
+ const repository = {
364
+ type: "git",
365
+ url: "https://github.com/swisspost/design-system.git"
366
+ };
367
+ const homepage = "https://next.design-system.post.ch";
368
+ const bugs = {
369
+ url: "https://github.com/swisspost/design-system/issues"
370
+ };
371
+ const main = "loader/index.cjs.js";
372
+ const module = "loader/index.js";
373
+ const es2017 = "loader/index.es2017.js";
374
+ const types = "loader/index.d.ts";
375
+ const collection = "dist/collection/collection-manifest.json";
376
+ const unpkg = "dist/swisspost-internet-header/swisspost-internet-header.esm.js";
377
+ const publishConfig = {
378
+ access: "public"
379
+ };
380
+ const files = [
381
+ "dist/",
382
+ "loader/"
383
+ ];
384
+ const scripts = {
385
+ dev: "stencil build --serve --port 9310 --watch --docs-readme",
386
+ start: "stencil build --watch --docs-readme",
387
+ build: "stencil build --docs-readme",
388
+ clean: "rimraf www dist loader",
389
+ test: "npm run unit",
390
+ unit: "jest",
391
+ "unit:watch": "jest --watch",
392
+ e2e: "cypress run",
393
+ "e2e:watch": "cypress open",
394
+ lint: "eslint src/**/*{.ts,.tsx}",
395
+ "lint:fix": "eslint src/**/*{.ts,.tsx} --fix",
396
+ generate: "stencil generate"
397
+ };
398
+ const dependencies = {
399
+ "@stencil/core": "4.7.0",
400
+ "@stencil/store": "2.0.11",
401
+ "@swisspost/design-system-styles": "workspace:6.4.4",
402
+ "body-scroll-lock": "4.0.0-beta.0",
403
+ "iframe-resizer": "4.3.7",
404
+ jquery: "3.7.1",
405
+ tabbable: "6.2.0",
406
+ "throttle-debounce": "5.0.0",
407
+ "url-polyfill": "1.1.12"
408
+ };
409
+ const devDependencies = {
410
+ "@babel/core": "7.23.2",
411
+ "@percy/cli": "1.27.4",
412
+ "@percy/cypress": "3.1.2",
413
+ "@stencil-community/eslint-plugin": "0.6.0",
414
+ "@stencil/sass": "3.0.7",
415
+ "@types/body-scroll-lock": "3.1.1",
416
+ "@types/iframe-resizer": "3.5.11",
417
+ "@types/jest": "27.5.2",
418
+ "@types/jquery": "3.5.25",
419
+ "@types/node": "18.18.8",
420
+ "@types/throttle-debounce": "5.0.1",
421
+ "babel-loader": "9.1.3",
422
+ bootstrap: "5.3.2",
423
+ cypress: "13.4.0",
424
+ "cypress-each": "1.13.3",
425
+ "cypress-storybook": "0.5.1",
426
+ "eslint-plugin-react": "7.33.2",
427
+ globby: "13.2.2",
428
+ jest: "27.5.1",
429
+ rimraf: "5.0.5",
430
+ "rollup-plugin-node-polyfills": "0.2.1",
431
+ "rollup-plugin-scss": "4.0.0",
432
+ "rollup-plugin-visualizer": "5.9.2",
433
+ sass: "1.69.5",
434
+ "start-server-and-test": "2.0.2",
435
+ "ts-jest": "27.1.5",
436
+ typescript: "4.9.5"
437
+ };
438
+ const packageJson = {
439
+ name: name,
440
+ version: version,
441
+ description: description,
442
+ author: author,
443
+ license: license,
444
+ repository: repository,
445
+ homepage: homepage,
446
+ bugs: bugs,
447
+ main: main,
448
+ module: module,
449
+ es2017: es2017,
450
+ types: types,
451
+ collection: collection,
452
+ "collection:main": "dist/collection/index.js",
453
+ unpkg: unpkg,
454
+ publishConfig: publishConfig,
455
+ files: files,
456
+ scripts: scripts,
457
+ dependencies: dependencies,
458
+ devDependencies: devDependencies
459
+ };
460
+
461
+ const isScrollable = (node) => {
462
+ if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
463
+ return false;
464
+ }
465
+ const style = getComputedStyle(node);
466
+ return ['overflow', 'overflow-x', 'overflow-y'].some(propertyName => {
467
+ const value = style.getPropertyValue(propertyName);
468
+ return value === 'auto' || value === 'scroll';
469
+ });
470
+ };
471
+ const getScrollParent = (node) => {
472
+ let currentParent = node.parentElement;
473
+ while (currentParent) {
474
+ if (isScrollable(currentParent)) {
475
+ return currentParent;
476
+ }
477
+ currentParent = currentParent.parentElement;
478
+ }
479
+ return document;
480
+ };
481
+
482
+ const registerLogoAnimationObserver = (target, headerRef) => {
483
+ const scrollParent = getScrollParent(headerRef);
484
+ /**
485
+ * Set intersection ratio as CSS custom property
486
+ */
487
+ const handleScroll = () => {
488
+ const fullStickyness = state.stickyness === 'full';
489
+ let scale = 1;
490
+ // Minus 1px border at the bottom that the logo is not covering
491
+ const adjustedHeaderHeight = headerRef.clientHeight - 1;
492
+ const scrollDistance = scrollParent instanceof Element ? scrollParent.scrollTop : scrollParent.documentElement.scrollTop;
493
+ const scrollY = fullStickyness ? 0 : scrollDistance;
494
+ // If meta navigation is not visible (mobile, not configured), scale should just be 1
495
+ if (target.clientHeight > 0) {
496
+ scale = Math.max((adjustedHeaderHeight - Math.max(scrollY, 0)) /
497
+ (adjustedHeaderHeight - target.clientHeight), 1);
498
+ }
499
+ headerRef.style.setProperty('--logo-scale', scale.toString());
500
+ };
501
+ const debounced = debounce(150, handleScroll);
502
+ /**
503
+ * Observe the meta navigation in order to not track scroll events throughout the whole page.
504
+ * This ensures that the scroll listener is only active while the meta navigation is visible.
505
+ */
506
+ const observer = new IntersectionObserver(entries => {
507
+ entries.forEach(entry => {
508
+ if (entry.isIntersecting && entry.intersectionRatio > 0) {
509
+ scrollParent.addEventListener('scroll', handleScroll, { passive: true });
510
+ window.addEventListener('resize', debounced);
511
+ // Ensure callback is called at least once in case main thread is too busy while scrolling up
512
+ window.requestAnimationFrame(handleScroll);
513
+ }
514
+ else {
515
+ scrollParent.removeEventListener('scroll', handleScroll);
516
+ window.removeEventListener('resize', debounced);
517
+ window.requestAnimationFrame(handleScroll);
518
+ }
519
+ });
520
+ }, {
521
+ // Fires when element leaves viewport (0) and when it just about enters it (0.001)
522
+ threshold: [0, 0.001],
523
+ });
524
+ observer.observe(target);
525
+ return handleScroll;
526
+ };
527
+
528
+ 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 0 auto;flex:0 0 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}.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}";
529
+
530
+ const PostInternetHeader = class {
531
+ /**
532
+ * Get the currently set language as a two letter string ("de", "fr" "it" or "en")
533
+ * @returns string
534
+ */
535
+ async getCurrentLanguage() {
536
+ var _a;
537
+ return (_a = state.currentLanguage) !== null && _a !== void 0 ? _a : 'de';
538
+ }
539
+ constructor(hostRef) {
540
+ registerInstance(this, hostRef);
541
+ this.headerLoaded = createEvent(this, "headerLoaded", 7);
542
+ this.lastScrollTop = window.scrollY || document.documentElement.scrollTop;
543
+ this.lastWindowWidth = window.innerWidth;
544
+ this.handleClickOutsideBound = this.handleClickOutside.bind(this);
545
+ this.project = undefined;
546
+ this.stickyness = 'minimal';
547
+ this.language = undefined;
548
+ this.meta = true;
549
+ this.login = true;
550
+ this.search = true;
551
+ this.skiplinks = true;
552
+ this.configProxy = undefined;
553
+ this.environment = 'prod';
554
+ this.languageSwitchOverrides = undefined;
555
+ this.customConfig = undefined;
556
+ this.languageCookieKey = undefined;
557
+ this.languageLocalStorageKey = 'swisspost-internet-header-language';
558
+ this.logoutUrl = undefined;
559
+ this.activeRoute = 'auto';
560
+ this.osFlyoutOverrides = undefined;
561
+ this.fullWidth = false;
562
+ this.activeFlyout = null;
563
+ this.activeDropdownElement = null;
564
+ if (this.project === undefined || this.project === '' || !isValidProjectId(this.project)) {
565
+ throw new Error(`Internet Header project key is "${this.project}". Please provide a valid project key.`);
566
+ }
567
+ }
568
+ connectedCallback() {
569
+ this.throttledScroll = throttle(300, () => this.handleScrollEvent());
570
+ this.debouncedResize = debounce(200, () => this.handleResize());
571
+ }
572
+ disconnectedCallback() {
573
+ this.scrollParent.removeEventListener('scroll', this.throttledScroll);
574
+ this.scrollParent.removeEventListener('resize', this.debouncedResize);
575
+ // Reset the store to its original state
576
+ dispose();
577
+ }
578
+ async componentWillLoad() {
579
+ this.scrollParent = getScrollParent(this.host);
580
+ this.scrollParent.addEventListener('scroll', this.throttledScroll, { passive: true });
581
+ this.scrollParent.addEventListener('resize', this.debouncedResize, { passive: true });
582
+ // Wait for the config to arrive, then render the header
583
+ try {
584
+ state.projectId = this.project;
585
+ state.stickyness = this.stickyness;
586
+ state.environment = this.environment.toLocaleLowerCase();
587
+ if (this.language !== undefined)
588
+ state.currentLanguage = this.language;
589
+ state.languageSwitchOverrides =
590
+ typeof this.languageSwitchOverrides === 'string'
591
+ ? JSON.parse(this.languageSwitchOverrides)
592
+ : this.languageSwitchOverrides;
593
+ state.osFlyoutOverrides =
594
+ typeof this.osFlyoutOverrides === 'string'
595
+ ? JSON.parse(this.osFlyoutOverrides)
596
+ : this.osFlyoutOverrides;
597
+ if (this.customConfig !== undefined) {
598
+ const langs = Object.keys(typeof this.customConfig === 'string' ? JSON.parse(this.customConfig) : this.customConfig);
599
+ const lang = state.currentLanguage || getUserLang(langs, this.language);
600
+ state.localizedCustomConfig = getLocalizedCustomConfig(this.customConfig, lang);
601
+ }
602
+ state.localizedConfig = await getLocalizedConfig({
603
+ projectId: this.project,
604
+ environment: state.environment,
605
+ language: this.language,
606
+ cookieKey: this.languageCookieKey,
607
+ localStorageKey: this.languageLocalStorageKey,
608
+ activeRouteProp: this.activeRoute,
609
+ localizedCustomConfig: state.localizedCustomConfig,
610
+ osFlyoutOverrides: state.osFlyoutOverrides,
611
+ });
612
+ }
613
+ catch (error) {
614
+ console.error(error);
615
+ }
616
+ }
617
+ componentDidLoad() {
618
+ window.requestAnimationFrame(() => {
619
+ this.handleResize();
620
+ this.headerLoaded.emit();
621
+ this.host.classList.add('header-loaded');
622
+ if (this.meta && this.metaNav) {
623
+ this.updateLogoAnimation = registerLogoAnimationObserver(this.metaNav, this.host);
624
+ }
625
+ });
626
+ if (this.stickyness === 'full')
627
+ console.warn('Internet Header: The stickyness="full" option is deprecated.');
628
+ }
629
+ async handleLanguageChange(newValue) {
630
+ state.currentLanguage = newValue;
631
+ state.localizedConfig = await getLocalizedConfig({
632
+ projectId: this.project,
633
+ environment: this.environment,
634
+ language: newValue,
635
+ cookieKey: this.languageCookieKey,
636
+ localStorageKey: this.languageLocalStorageKey,
637
+ activeRouteProp: this.activeRoute,
638
+ localizedCustomConfig: state.localizedCustomConfig,
639
+ osFlyoutOverrides: state.osFlyoutOverrides,
640
+ });
641
+ if (this.customConfig)
642
+ state.localizedCustomConfig = getLocalizedCustomConfig(this.customConfig, newValue);
643
+ }
644
+ handleAvailableLanguagesChange(newValue) {
645
+ state.languageSwitchOverrides = typeof newValue === 'string' ? JSON.parse(newValue) : newValue;
646
+ }
647
+ async handleOsFlyoutOverrides(newValue) {
648
+ state.osFlyoutOverrides = typeof newValue === 'string' ? JSON.parse(newValue) : newValue;
649
+ state.localizedConfig = await getLocalizedConfig({
650
+ projectId: this.project,
651
+ environment: this.environment,
652
+ language: this.language,
653
+ cookieKey: this.languageCookieKey,
654
+ localStorageKey: this.languageLocalStorageKey,
655
+ activeRouteProp: this.activeRoute,
656
+ localizedCustomConfig: state.localizedCustomConfig,
657
+ osFlyoutOverrides: state.osFlyoutOverrides,
658
+ });
659
+ }
660
+ async handleActiveRouteChange(newValue) {
661
+ state.localizedConfig = await getLocalizedConfig({
662
+ projectId: this.project,
663
+ environment: this.environment,
664
+ language: this.language,
665
+ cookieKey: this.languageCookieKey,
666
+ localStorageKey: this.languageLocalStorageKey,
667
+ activeRouteProp: newValue,
668
+ localizedCustomConfig: state.localizedCustomConfig,
669
+ osFlyoutOverrides: state.osFlyoutOverrides,
670
+ });
671
+ }
672
+ async handleCustomConfigChange(newValue) {
673
+ if (this.language === undefined)
674
+ return;
675
+ const localizedCustomConfig = getLocalizedCustomConfig(newValue, this.language);
676
+ state.localizedCustomConfig = localizedCustomConfig;
677
+ state.localizedConfig = await getLocalizedConfig({
678
+ projectId: this.project,
679
+ environment: this.environment,
680
+ language: this.language,
681
+ cookieKey: this.languageCookieKey,
682
+ localStorageKey: this.languageLocalStorageKey,
683
+ activeRouteProp: this.activeRoute,
684
+ localizedCustomConfig: localizedCustomConfig,
685
+ osFlyoutOverrides: state.osFlyoutOverrides,
686
+ });
687
+ }
688
+ handleSearchChange(newValue) {
689
+ state.search = newValue;
690
+ }
691
+ handleLoginChange(newValue) {
692
+ state.login = newValue;
693
+ }
694
+ handleMetaChange(newValue) {
695
+ state.meta = newValue;
696
+ }
697
+ handleLanguageChangeEvent(event) {
698
+ void this.handleLanguageChange(event.detail);
699
+ }
700
+ handleStickynessChange(newValue) {
701
+ state.stickyness = newValue;
702
+ if (typeof this.updateLogoAnimation === 'function')
703
+ this.updateLogoAnimation();
704
+ }
705
+ handleClickOutside(event) {
706
+ // Close active dropdown element on click outside of it
707
+ if (this.activeDropdownElement && !event.composedPath().includes(this.activeDropdownElement)) {
708
+ void this.activeDropdownElement.toggleDropdown(false);
709
+ }
710
+ }
711
+ handleKeyUp(event) {
712
+ if (event.key === 'Escape') {
713
+ if (this.activeDropdownElement) {
714
+ void this.activeDropdownElement.toggleDropdown(false);
715
+ }
716
+ if (this.activeFlyout !== null && this.mainNav) {
717
+ void this.mainNav.toggleDropdown(false);
718
+ }
719
+ }
720
+ }
721
+ handleScrollEvent() {
722
+ // Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
723
+ const st = this.scrollParent instanceof Document
724
+ ? this.scrollParent.documentElement.scrollTop
725
+ : this.scrollParent.scrollTop;
726
+ // Toggle class without re-rendering the component if stickyness is minimal
727
+ // the other stickyness modes do not need the class
728
+ if (this.stickyness === 'minimal') {
729
+ this.host.classList.toggle('scrolling-up', st <= this.lastScrollTop);
730
+ }
731
+ // For Mobile or negative scrolling
732
+ this.lastScrollTop = st <= 0 ? 0 : st;
733
+ }
734
+ handleResize() {
735
+ var _a;
736
+ // Close main navigation dropdown if size changed to bigger than 1024px (search dropdown will be kept open)
737
+ if (this.isMainNavOpen() && this.lastWindowWidth < 1024 && window.innerWidth >= 1024) {
738
+ (_a = this.activeDropdownElement) === null || _a === void 0 ? void 0 : _a.toggleDropdown(false);
739
+ }
740
+ this.lastWindowWidth = window.innerWidth;
741
+ }
742
+ /**
743
+ * Close open dropdown menus if another is being opened
744
+ *
745
+ * @param event Dropdown toggled event
746
+ * @returns void
747
+ */
748
+ handleDropdownToggled(event) {
749
+ if (!event.detail.open && this.activeDropdownElement !== event.detail.element) {
750
+ // Some dropdown got closed programmatically (possibly by this function). To prevent
751
+ // a circle or an outdated state, we'll not handle this event
752
+ return;
753
+ }
754
+ if (event.detail.open) {
755
+ if (this.activeDropdownElement) {
756
+ void this.activeDropdownElement.toggleDropdown(false);
757
+ }
758
+ this.activeDropdownElement = event.detail.element;
759
+ if (window.innerWidth >= 1024) {
760
+ // Add event listener to close active dropdown element on click outside of it
761
+ // Also adds 10ms delay in case of an external interaction:
762
+ // Some button on the page calls toggleDropdown() -> dropdown opens
763
+ // Click event bubbles to the window, this.handleClickOutsideBound closes dropdown again
764
+ window.setTimeout(() => {
765
+ window.addEventListener('click', this.handleClickOutsideBound);
766
+ }, 10);
767
+ }
768
+ if (this.activeFlyout !== null && this.mainNav) {
769
+ void this.mainNav.setActiveFlyout(null);
770
+ }
771
+ }
772
+ else {
773
+ this.activeDropdownElement = null;
774
+ // Remove event listener as it is not needed if no dropdown element is active
775
+ window.removeEventListener('click', this.handleClickOutsideBound);
776
+ }
777
+ }
778
+ /**
779
+ * Close open dropdowns if the flyout is being opened
780
+ * @param event Flyout toggle event
781
+ */
782
+ handleFlyoutToggled(event) {
783
+ this.activeFlyout = event.detail;
784
+ if (this.activeDropdownElement && event.detail && !this.isMainNavOpen()) {
785
+ void this.activeDropdownElement.toggleDropdown(false);
786
+ }
787
+ }
788
+ toggleMobileDropdown() {
789
+ var _a;
790
+ (_a = this.mainNav) === null || _a === void 0 ? void 0 : _a.toggleDropdown();
791
+ }
792
+ isMainNavOpen() {
793
+ return (this.activeDropdownElement && this.activeDropdownElement.tagName === 'POST-MAIN-NAVIGATION');
794
+ }
795
+ render() {
796
+ var _a, _b, _c;
797
+ if (!((_a = state.localizedConfig) === null || _a === void 0 ? void 0 : _a.header)) {
798
+ console.error(new Error('Internet Header: Config cannot be loaded'));
799
+ return;
800
+ }
801
+ const config = state.localizedConfig;
802
+ const renderMetaNavigation = this.meta &&
803
+ config.header.navMeta !== undefined &&
804
+ ((_b = config.header.navMeta) === null || _b === void 0 ? void 0 : _b.filter(meta => !meta.isHomeLink).length) > 0;
805
+ const renderLogin = ((_c = this.login) !== null && _c !== void 0 ? _c : !config.header.isLoginWidgetHidden) && config.header.loginWidgetOptions;
806
+ const renderLanguageSwitch = config.header.navLang.length > 1;
807
+ 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(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" })), h("slot", { name: "main" }))))));
808
+ }
809
+ get host() { return getElement(this); }
810
+ static get watchers() { return {
811
+ "language": ["handleLanguageChange"],
812
+ "languageSwitchOverrides": ["handleAvailableLanguagesChange"],
813
+ "osFlyoutOverrides": ["handleOsFlyoutOverrides"],
814
+ "activeRoute": ["handleActiveRouteChange"],
815
+ "customConfig": ["handleCustomConfigChange"],
816
+ "search": ["handleSearchChange"],
817
+ "login": ["handleLoginChange"],
818
+ "meta": ["handleMetaChange"],
819
+ "stickyness": ["handleStickynessChange"]
820
+ }; }
821
+ };
822
+ PostInternetHeader.style = postInternetHeaderCss;
823
+
824
+ export { PostInternetHeader as P };
825
+
826
+ //# sourceMappingURL=post-internet-header-2e386826.js.map