@swisspost/internet-header 1.5.1 → 1.5.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.
Files changed (241) hide show
  1. package/dist/cjs/index-3216e4c8.js +176 -0
  2. package/dist/cjs/index-3216e4c8.js.map +1 -0
  3. package/dist/cjs/{index-5751975e.js → index-aff25ac1.js} +8 -1
  4. package/dist/cjs/index-aff25ac1.js.map +1 -0
  5. package/dist/cjs/{language.service-7dbf739d.js → language.service-167d5a9c.js} +7 -2
  6. package/dist/cjs/language.service-167d5a9c.js.map +1 -0
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/cjs/loader.cjs.js.map +1 -1
  9. package/dist/cjs/post-klp-login-widget.cjs.entry.js +3 -3
  10. package/dist/cjs/post-language-switch.cjs.entry.js +5 -5
  11. package/dist/cjs/post-logo.cjs.entry.js +3 -3
  12. package/dist/cjs/post-main-navigation.cjs.entry.js +6 -6
  13. package/dist/cjs/post-main-navigation.cjs.entry.js.map +1 -1
  14. package/dist/cjs/post-meta-navigation.cjs.entry.js +2 -2
  15. package/dist/cjs/post-search.cjs.entry.js +20 -2219
  16. package/dist/cjs/post-search.cjs.entry.js.map +1 -1
  17. package/dist/cjs/post-skiplinks.cjs.entry.js +5 -5
  18. package/dist/cjs/post-skiplinks.cjs.entry.js.map +1 -1
  19. package/dist/cjs/{store-d0d514fc.js → store-b0284e36.js} +2 -2
  20. package/dist/cjs/{store-d0d514fc.js.map → store-b0284e36.js.map} +1 -1
  21. package/dist/cjs/{svg-icon.component-be93f876.js → svg-icon.component-715db679.js} +2 -2
  22. package/dist/cjs/{svg-icon.component-be93f876.js.map → svg-icon.component-715db679.js.map} +1 -1
  23. package/dist/cjs/{svg-sprite.component-1bd7a058.js → svg-sprite.component-22680222.js} +2 -2
  24. package/dist/cjs/{svg-sprite.component-1bd7a058.js.map → svg-sprite.component-22680222.js.map} +1 -1
  25. package/dist/cjs/swisspost-internet-breadcrumbs.cjs.entry.js +116 -96
  26. package/dist/cjs/swisspost-internet-breadcrumbs.cjs.entry.js.map +1 -1
  27. package/dist/cjs/swisspost-internet-footer.cjs.entry.js +3 -3
  28. package/dist/cjs/swisspost-internet-header.cjs.entry.js +23 -22
  29. package/dist/cjs/swisspost-internet-header.cjs.entry.js.map +1 -1
  30. package/dist/cjs/swisspost-internet-header.cjs.js +2 -2
  31. package/dist/cjs/swisspost-internet-header.cjs.js.map +1 -1
  32. package/dist/collection/assets/i18n/translations.js +5 -0
  33. package/dist/collection/assets/i18n/translations.js.map +1 -1
  34. package/dist/collection/collection-manifest.json +2 -2
  35. package/dist/collection/components/post-internet-breadcrumbs/post-internet-breadcrumbs.css +0 -4
  36. package/dist/collection/components/post-internet-header/post-internet-header.js +1 -1
  37. package/dist/collection/components/post-main-navigation/post-main-navigation.js +1 -1
  38. package/dist/collection/components/post-main-navigation/post-main-navigation.js.map +1 -1
  39. package/dist/collection/components/post-skiplinks/post-skiplinks.js +1 -1
  40. package/dist/collection/components/post-skiplinks/post-skiplinks.js.map +1 -1
  41. package/dist/collection/models/general.model.js.map +1 -1
  42. package/dist/collection/services/config.service.js +6 -4
  43. package/dist/collection/services/config.service.js.map +1 -1
  44. package/dist/collection/services/search/coveo.settings.js +12 -0
  45. package/dist/collection/services/search/coveo.settings.js.map +1 -1
  46. package/dist/collection/services/search/places.service.js +4 -4
  47. package/dist/collection/services/search/places.service.js.map +1 -1
  48. package/dist/collection/services/search/search-utilities.js +0 -13
  49. package/dist/collection/services/search/search-utilities.js.map +1 -1
  50. package/dist/components/index2.js +67 -35
  51. package/dist/components/index2.js.map +1 -1
  52. package/dist/components/language.service.js +5 -0
  53. package/dist/components/language.service.js.map +1 -1
  54. package/dist/components/post-main-navigation2.js +1 -1
  55. package/dist/components/post-main-navigation2.js.map +1 -1
  56. package/dist/components/post-search2.js +15 -2214
  57. package/dist/components/post-search2.js.map +1 -1
  58. package/dist/components/post-skiplinks2.js +1 -1
  59. package/dist/components/post-skiplinks2.js.map +1 -1
  60. package/dist/components/store.js.map +1 -1
  61. package/dist/components/swisspost-internet-breadcrumbs.js +110 -90
  62. package/dist/components/swisspost-internet-breadcrumbs.js.map +1 -1
  63. package/dist/components/swisspost-internet-header.js +17 -16
  64. package/dist/components/swisspost-internet-header.js.map +1 -1
  65. package/dist/esm/{index-066666f4.js → index-9351b1b6.js} +8 -1
  66. package/dist/esm/index-9351b1b6.js.map +1 -0
  67. package/dist/esm/index-d2256e06.js +173 -0
  68. package/dist/esm/index-d2256e06.js.map +1 -0
  69. package/dist/esm/{language.service-023d2711.js → language.service-7aefe1c5.js} +7 -2
  70. package/dist/esm/language.service-7aefe1c5.js.map +1 -0
  71. package/dist/esm/loader.js +3 -3
  72. package/dist/esm/loader.js.map +1 -1
  73. package/dist/esm/post-klp-login-widget.entry.js +3 -3
  74. package/dist/esm/post-language-switch.entry.js +5 -5
  75. package/dist/esm/post-logo.entry.js +3 -3
  76. package/dist/esm/post-main-navigation.entry.js +6 -6
  77. package/dist/esm/post-main-navigation.entry.js.map +1 -1
  78. package/dist/esm/post-meta-navigation.entry.js +2 -2
  79. package/dist/esm/post-search.entry.js +20 -2219
  80. package/dist/esm/post-search.entry.js.map +1 -1
  81. package/dist/esm/post-skiplinks.entry.js +5 -5
  82. package/dist/esm/post-skiplinks.entry.js.map +1 -1
  83. package/dist/esm/{store-837c3490.js → store-f9ce3c4f.js} +2 -2
  84. package/dist/esm/{store-837c3490.js.map → store-f9ce3c4f.js.map} +1 -1
  85. package/dist/esm/{svg-icon.component-e09b4bf9.js → svg-icon.component-cd0942cc.js} +2 -2
  86. package/dist/esm/{svg-icon.component-e09b4bf9.js.map → svg-icon.component-cd0942cc.js.map} +1 -1
  87. package/dist/esm/{svg-sprite.component-cf60303f.js → svg-sprite.component-5ed9c3b8.js} +2 -2
  88. package/dist/esm/{svg-sprite.component-cf60303f.js.map → svg-sprite.component-5ed9c3b8.js.map} +1 -1
  89. package/dist/esm/swisspost-internet-breadcrumbs.entry.js +116 -96
  90. package/dist/esm/swisspost-internet-breadcrumbs.entry.js.map +1 -1
  91. package/dist/esm/swisspost-internet-footer.entry.js +3 -3
  92. package/dist/esm/swisspost-internet-header.entry.js +23 -22
  93. package/dist/esm/swisspost-internet-header.entry.js.map +1 -1
  94. package/dist/esm/swisspost-internet-header.js +3 -3
  95. package/dist/esm/swisspost-internet-header.js.map +1 -1
  96. package/dist/esm-es5/{index-066666f4.js → index-9351b1b6.js} +1 -1
  97. package/dist/esm-es5/index-9351b1b6.js.map +1 -0
  98. package/dist/esm-es5/index-d2256e06.js +2 -0
  99. package/dist/esm-es5/index-d2256e06.js.map +1 -0
  100. package/dist/esm-es5/language.service-7aefe1c5.js +2 -0
  101. package/dist/esm-es5/language.service-7aefe1c5.js.map +1 -0
  102. package/dist/esm-es5/loader.js +1 -1
  103. package/dist/esm-es5/loader.js.map +1 -1
  104. package/dist/esm-es5/post-klp-login-widget.entry.js +1 -1
  105. package/dist/esm-es5/post-language-switch.entry.js +1 -1
  106. package/dist/esm-es5/post-logo.entry.js +1 -1
  107. package/dist/esm-es5/post-main-navigation.entry.js +1 -1
  108. package/dist/esm-es5/post-main-navigation.entry.js.map +1 -1
  109. package/dist/esm-es5/post-meta-navigation.entry.js +1 -1
  110. package/dist/esm-es5/post-search.entry.js +1 -1
  111. package/dist/esm-es5/post-search.entry.js.map +1 -1
  112. package/dist/esm-es5/post-skiplinks.entry.js +1 -1
  113. package/dist/esm-es5/post-skiplinks.entry.js.map +1 -1
  114. package/dist/esm-es5/{store-837c3490.js → store-f9ce3c4f.js} +2 -2
  115. package/dist/esm-es5/{store-837c3490.js.map → store-f9ce3c4f.js.map} +1 -1
  116. package/dist/esm-es5/{svg-icon.component-e09b4bf9.js → svg-icon.component-cd0942cc.js} +2 -2
  117. package/dist/esm-es5/{svg-icon.component-e09b4bf9.js.map → svg-icon.component-cd0942cc.js.map} +0 -0
  118. package/dist/esm-es5/{svg-sprite.component-cf60303f.js → svg-sprite.component-5ed9c3b8.js} +2 -2
  119. package/dist/esm-es5/{svg-sprite.component-cf60303f.js.map → svg-sprite.component-5ed9c3b8.js.map} +0 -0
  120. package/dist/esm-es5/swisspost-internet-breadcrumbs.entry.js +2 -2
  121. package/dist/esm-es5/swisspost-internet-breadcrumbs.entry.js.map +1 -1
  122. package/dist/esm-es5/swisspost-internet-footer.entry.js +1 -1
  123. package/dist/esm-es5/swisspost-internet-header.entry.js +1 -1
  124. package/dist/esm-es5/swisspost-internet-header.entry.js.map +1 -1
  125. package/dist/esm-es5/swisspost-internet-header.js +1 -1
  126. package/dist/esm-es5/swisspost-internet-header.js.map +1 -1
  127. package/dist/swisspost-internet-header/{p-38d645ba.system.entry.js → p-01b80755.system.entry.js} +2 -2
  128. package/dist/swisspost-internet-header/{p-38d645ba.system.entry.js.map → p-01b80755.system.entry.js.map} +0 -0
  129. package/dist/swisspost-internet-header/{p-7fcba2e7.system.js → p-0342245a.system.js} +2 -2
  130. package/dist/swisspost-internet-header/{p-7fcba2e7.system.js.map → p-0342245a.system.js.map} +1 -1
  131. package/dist/swisspost-internet-header/p-0739e499.system.js +2 -0
  132. package/dist/swisspost-internet-header/p-0739e499.system.js.map +1 -0
  133. package/dist/swisspost-internet-header/p-3563d113.js +2 -0
  134. package/dist/swisspost-internet-header/{p-ab1dd269.js.map → p-3563d113.js.map} +0 -0
  135. package/dist/swisspost-internet-header/p-3a94f838.entry.js +6 -0
  136. package/dist/swisspost-internet-header/p-3a94f838.entry.js.map +1 -0
  137. package/dist/swisspost-internet-header/{p-28e6362f.system.entry.js → p-3b6966e6.system.entry.js} +2 -2
  138. package/dist/swisspost-internet-header/{p-28e6362f.system.entry.js.map → p-3b6966e6.system.entry.js.map} +0 -0
  139. package/dist/swisspost-internet-header/{p-66144e99.system.entry.js → p-4fe4ae48.system.entry.js} +2 -2
  140. package/dist/swisspost-internet-header/{p-66144e99.system.entry.js.map → p-4fe4ae48.system.entry.js.map} +0 -0
  141. package/dist/swisspost-internet-header/p-58008c81.system.entry.js +2 -0
  142. package/dist/swisspost-internet-header/p-58008c81.system.entry.js.map +1 -0
  143. package/dist/swisspost-internet-header/p-5c0b352c.system.entry.js +2 -0
  144. package/dist/swisspost-internet-header/p-5c0b352c.system.entry.js.map +1 -0
  145. package/dist/swisspost-internet-header/{p-5032057e.js → p-61b09b9b.js} +1 -1
  146. package/dist/swisspost-internet-header/p-61b09b9b.js.map +1 -0
  147. package/dist/swisspost-internet-header/{p-322526ef.entry.js → p-633cde46.entry.js} +2 -2
  148. package/dist/swisspost-internet-header/{p-322526ef.entry.js.map → p-633cde46.entry.js.map} +0 -0
  149. package/dist/swisspost-internet-header/{p-06649b46.js → p-698793da.js} +2 -2
  150. package/dist/swisspost-internet-header/{p-06649b46.js.map → p-698793da.js.map} +1 -1
  151. package/dist/swisspost-internet-header/{p-5d2fac3b.system.entry.js → p-8927c282.system.entry.js} +2 -2
  152. package/dist/swisspost-internet-header/{p-5d2fac3b.system.entry.js.map → p-8927c282.system.entry.js.map} +0 -0
  153. package/dist/swisspost-internet-header/{p-ffc59851.system.js → p-89618eab.system.js} +2 -2
  154. package/dist/swisspost-internet-header/{p-ffc59851.system.js.map → p-89618eab.system.js.map} +0 -0
  155. package/dist/swisspost-internet-header/{p-0cba8ab4.entry.js → p-91195287.entry.js} +2 -2
  156. package/dist/swisspost-internet-header/{p-0cba8ab4.entry.js.map → p-91195287.entry.js.map} +0 -0
  157. package/dist/swisspost-internet-header/{p-26879023.entry.js → p-99f181e3.entry.js} +2 -2
  158. package/dist/swisspost-internet-header/{p-26879023.entry.js.map → p-99f181e3.entry.js.map} +0 -0
  159. package/dist/swisspost-internet-header/p-9b4d5e90.system.js +2 -0
  160. package/dist/swisspost-internet-header/p-9b4d5e90.system.js.map +1 -0
  161. package/dist/swisspost-internet-header/{p-77d5e07f.entry.js → p-9c1c05bb.entry.js} +2 -2
  162. package/dist/swisspost-internet-header/{p-77d5e07f.entry.js.map → p-9c1c05bb.entry.js.map} +0 -0
  163. package/dist/swisspost-internet-header/{p-f7c0cf7b.js → p-9cf200bd.js} +2 -2
  164. package/dist/swisspost-internet-header/{p-f7c0cf7b.js.map → p-9cf200bd.js.map} +0 -0
  165. package/dist/swisspost-internet-header/p-a74b380d.js +2 -0
  166. package/dist/swisspost-internet-header/p-a74b380d.js.map +1 -0
  167. package/dist/swisspost-internet-header/p-ab97ab9d.entry.js +2 -0
  168. package/dist/swisspost-internet-header/p-ab97ab9d.entry.js.map +1 -0
  169. package/dist/swisspost-internet-header/{p-ee119d2e.system.js → p-af58c52f.system.js} +2 -2
  170. package/dist/swisspost-internet-header/{p-ee119d2e.system.js.map → p-af58c52f.system.js.map} +0 -0
  171. package/dist/swisspost-internet-header/{p-d33734b5.entry.js → p-b52015b1.entry.js} +2 -2
  172. package/dist/swisspost-internet-header/{p-d33734b5.entry.js.map → p-b52015b1.entry.js.map} +1 -1
  173. package/dist/swisspost-internet-header/{p-17a47667.system.js → p-b9569693.system.js} +2 -2
  174. package/dist/swisspost-internet-header/{p-17a47667.system.js.map → p-b9569693.system.js.map} +1 -1
  175. package/dist/swisspost-internet-header/{p-1b8f9bc8.system.js → p-bd9d660b.system.js} +1 -1
  176. package/dist/swisspost-internet-header/p-bd9d660b.system.js.map +1 -0
  177. package/dist/swisspost-internet-header/p-be9c6d49.entry.js +2 -0
  178. package/dist/swisspost-internet-header/p-be9c6d49.entry.js.map +1 -0
  179. package/dist/swisspost-internet-header/{p-db87f3e3.system.entry.js → p-c08318d1.system.entry.js} +2 -2
  180. package/dist/swisspost-internet-header/{p-db87f3e3.system.entry.js.map → p-c08318d1.system.entry.js.map} +1 -1
  181. package/dist/swisspost-internet-header/p-c3c4638a.system.entry.js +7 -0
  182. package/dist/swisspost-internet-header/p-c3c4638a.system.entry.js.map +1 -0
  183. package/dist/swisspost-internet-header/p-c90a1412.js +2 -0
  184. package/dist/swisspost-internet-header/p-c90a1412.js.map +1 -0
  185. package/dist/swisspost-internet-header/{p-e2990968.system.entry.js → p-de22cbfa.system.entry.js} +2 -2
  186. package/dist/swisspost-internet-header/{p-e2990968.system.entry.js.map → p-de22cbfa.system.entry.js.map} +0 -0
  187. package/dist/swisspost-internet-header/{p-64cb215a.entry.js → p-e10dce9d.entry.js} +2 -2
  188. package/dist/swisspost-internet-header/{p-64cb215a.entry.js.map → p-e10dce9d.entry.js.map} +0 -0
  189. package/dist/swisspost-internet-header/p-e37f959e.system.entry.js +2 -0
  190. package/dist/swisspost-internet-header/p-e37f959e.system.entry.js.map +1 -0
  191. package/dist/swisspost-internet-header/p-ebf02fa7.entry.js +2 -0
  192. package/dist/swisspost-internet-header/p-ebf02fa7.entry.js.map +1 -0
  193. package/dist/swisspost-internet-header/swisspost-internet-header.css +1 -1
  194. package/dist/swisspost-internet-header/swisspost-internet-header.esm.js +1 -1
  195. package/dist/swisspost-internet-header/swisspost-internet-header.esm.js.map +1 -1
  196. package/dist/swisspost-internet-header/swisspost-internet-header.js +1 -1
  197. package/dist/types/assets/i18n/translations.d.ts +5 -0
  198. package/dist/types/models/general.model.d.ts +2 -2
  199. package/dist/types/services/language.service.d.ts +5 -0
  200. package/dist/types/services/search/search-utilities.d.ts +0 -6
  201. package/package.json +11 -12
  202. package/dist/cjs/index-5751975e.js.map +0 -1
  203. package/dist/cjs/index-e7245d60.js +0 -144
  204. package/dist/cjs/index-e7245d60.js.map +0 -1
  205. package/dist/cjs/language.service-7dbf739d.js.map +0 -1
  206. package/dist/esm/index-066666f4.js.map +0 -1
  207. package/dist/esm/index-a75df186.js +0 -141
  208. package/dist/esm/index-a75df186.js.map +0 -1
  209. package/dist/esm/language.service-023d2711.js.map +0 -1
  210. package/dist/esm-es5/index-066666f4.js.map +0 -1
  211. package/dist/esm-es5/index-a75df186.js +0 -2
  212. package/dist/esm-es5/index-a75df186.js.map +0 -1
  213. package/dist/esm-es5/language.service-023d2711.js +0 -2
  214. package/dist/esm-es5/language.service-023d2711.js.map +0 -1
  215. package/dist/swisspost-internet-header/p-0942595f.js +0 -2
  216. package/dist/swisspost-internet-header/p-0942595f.js.map +0 -1
  217. package/dist/swisspost-internet-header/p-1b8f9bc8.system.js.map +0 -1
  218. package/dist/swisspost-internet-header/p-3753a678.system.js +0 -2
  219. package/dist/swisspost-internet-header/p-3753a678.system.js.map +0 -1
  220. package/dist/swisspost-internet-header/p-3df823de.system.entry.js +0 -2
  221. package/dist/swisspost-internet-header/p-3df823de.system.entry.js.map +0 -1
  222. package/dist/swisspost-internet-header/p-493337e1.system.entry.js +0 -2
  223. package/dist/swisspost-internet-header/p-493337e1.system.entry.js.map +0 -1
  224. package/dist/swisspost-internet-header/p-5032057e.js.map +0 -1
  225. package/dist/swisspost-internet-header/p-62c5cf26.entry.js +0 -2
  226. package/dist/swisspost-internet-header/p-62c5cf26.entry.js.map +0 -1
  227. package/dist/swisspost-internet-header/p-69c64c29.js +0 -2
  228. package/dist/swisspost-internet-header/p-69c64c29.js.map +0 -1
  229. package/dist/swisspost-internet-header/p-715ebef7.system.entry.js +0 -7
  230. package/dist/swisspost-internet-header/p-715ebef7.system.entry.js.map +0 -1
  231. package/dist/swisspost-internet-header/p-7709ed5c.entry.js +0 -2
  232. package/dist/swisspost-internet-header/p-7709ed5c.entry.js.map +0 -1
  233. package/dist/swisspost-internet-header/p-ab1dd269.js +0 -2
  234. package/dist/swisspost-internet-header/p-c8296f63.system.js +0 -2
  235. package/dist/swisspost-internet-header/p-c8296f63.system.js.map +0 -1
  236. package/dist/swisspost-internet-header/p-ccb522ba.entry.js +0 -2
  237. package/dist/swisspost-internet-header/p-ccb522ba.entry.js.map +0 -1
  238. package/dist/swisspost-internet-header/p-cfa787d7.entry.js +0 -6
  239. package/dist/swisspost-internet-header/p-cfa787d7.entry.js.map +0 -1
  240. package/dist/swisspost-internet-header/p-f38f38f4.system.entry.js +0 -2
  241. package/dist/swisspost-internet-header/p-f38f38f4.system.entry.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"post-main-navigation.js","sourceRoot":"","sources":["../../../../src/components/post-main-navigation/post-main-navigation.tsx"],"names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IAAI,CACL,CACN,CAAC,CACC;QACL,eAAa,CACT,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, State, Method, Event, Element, EventEmitter } from '@stencil/core';\nimport { throttle } from 'throttle-debounce';\nimport { disableBodyScroll, enableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock';\nimport { state } from '../../data/store';\nimport {\n DropdownElement,\n DropdownEvent,\n HasDropdown,\n IsFocusable,\n NavMainEntity,\n} from '../../models/header.model';\nimport { userPrefersReducedMotion } from '../../services/ui.service';\nimport { SvgSprite } from '../../utils/svg-sprite.component';\nimport { SvgIcon } from '../../utils/svg-icon.component';\nimport { LevelOneAction } from './components/level-one-action.component';\n\n@Component({\n tag: 'post-main-navigation',\n styleUrl: 'post-main-navigation.scss',\n shadow: true,\n})\nexport class PostMainNavigation implements HasDropdown, IsFocusable {\n @State() activeFlyout: string | null;\n @State() mobileMenuOpen: boolean;\n @Event() dropdownToggled: EventEmitter<DropdownEvent>;\n @Event() flyoutToggled: EventEmitter<string | null>;\n @Element() host: DropdownElement;\n private throttledResize: throttle<() => void>;\n private resizeTimer: number | null = null;\n private mouseLeaveTimer: number | null = null;\n private mouseEnterTimer: number | null = null;\n private flyoutElement: HTMLElement | undefined;\n\n connectedCallback() {\n this.throttledResize = throttle(300, () => this.handleResize());\n window.addEventListener('resize', this.throttledResize, { passive: true });\n this.setWindowHeight();\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.throttledResize);\n clearAllBodyScrollLocks();\n if (this.mouseEnterTimer !== null) window.clearTimeout(this.mouseEnterTimer);\n if (this.mouseLeaveTimer !== null) window.clearTimeout(this.mouseLeaveTimer);\n }\n\n handleResize() {\n // Suspend all animations and transitions on window resize\n this.host.classList.add('no-animation');\n if (this.resizeTimer !== null) window.clearTimeout(this.resizeTimer);\n this.resizeTimer = window.setTimeout(() => {\n this.host.classList.remove('no-animation');\n }, 300);\n\n this.setWindowHeight();\n }\n\n // Update window height var\n setWindowHeight() {\n if (!this.host) {\n return;\n }\n this.host.style.setProperty('--window-height', `${window.innerHeight}px`);\n\n // Safari might or might not show a blank bar at the bottom where the browser\n // controls should be. This timeout waits for this bar to appear before resetting the available height\n window.setTimeout(() => {\n this.host.style.setProperty('--window-height', `${window.innerHeight}px`);\n }, 100);\n }\n\n openFlyout(id: string) {\n const flyout = this.host.shadowRoot?.getElementById(id);\n\n if (flyout && this.activeFlyout !== '') {\n // Add flyout animation if there's no flyout open\n this.addFlyoutAnimation(flyout);\n }\n\n this.activeFlyout = id;\n this.flyoutToggled.emit(id);\n this.setWindowHeight();\n\n if (this.mouseLeaveTimer !== null) {\n window.clearTimeout(this.mouseLeaveTimer);\n this.mouseLeaveTimer = null;\n }\n }\n\n closeFlyout(id?: string) {\n if (id === undefined) return;\n const flyout = this.host.shadowRoot?.getElementById(id);\n\n if (flyout) {\n // Add flyout animation for close action\n this.addFlyoutAnimation(flyout);\n }\n\n this.activeFlyout = null;\n this.flyoutToggled.emit();\n }\n\n addFlyoutAnimation(flyout: HTMLElement) {\n // Check if user prefers to see animations or not\n if (!userPrefersReducedMotion()) {\n flyout.classList.add('animate');\n\n // Remove flyout animation after transition ended\n flyout.addEventListener('transitionend', () => this.removeFlyoutAnimation(flyout), {\n once: true,\n });\n }\n }\n\n removeFlyoutAnimation(flyout: HTMLElement) {\n flyout.classList.remove('animate');\n }\n\n isActiveFlyout(id?: string) {\n return id === this.activeFlyout;\n }\n\n handleMouseEnter(level: NavMainEntity) {\n // Cancel opening the flyout if there already is one scheduled to open\n if (this.mouseEnterTimer !== null) {\n window.clearTimeout(this.mouseEnterTimer);\n this.mouseEnterTimer = null;\n }\n\n // Cancel closing if we enter again\n if (this.mouseLeaveTimer && this.activeFlyout === level.id) {\n window.clearTimeout(this.mouseLeaveTimer);\n this.mouseLeaveTimer = null;\n }\n\n if (window.innerWidth >= 1024 && level.flyout.length > 0 && this.activeFlyout !== level.id) {\n // Delay opening the flyout for a moment to give users a chance to move the mouse over the navigation without triggering the flyout\n this.mouseEnterTimer = window.setTimeout(() => {\n this.mouseEnterTimer = null;\n if (level.id !== undefined) this.openFlyout(level.id);\n }, 200);\n }\n }\n\n handleMouseLeave(level: NavMainEntity) {\n // Cancel opening the flyout if a mouseleave event happens before the flyout opened\n if (this.mouseEnterTimer !== null) {\n window.clearTimeout(this.mouseEnterTimer);\n }\n\n // Don't close an open flyout if the mouseleave is from another mainnav entry\n if (this.activeFlyout && this.activeFlyout !== level.id) {\n return;\n }\n\n if (window.innerWidth >= 1024 && level.flyout.length > 0) {\n // Allow the pointer to shortly leave the flyout without closing it. This\n // allows for user mistakes and makes the experience less nervous\n this.mouseLeaveTimer = window.setTimeout(() => {\n this.closeFlyout(level.id);\n }, 300);\n }\n }\n\n handleTouchEnd(event: TouchEvent, level: NavMainEntity) {\n if (!this.isActiveFlyout(level.id) && !level.noFlyout) {\n // It's the first touchstart and has a flyout, prevent link activation and open the flyout\n if (event.cancelable) event.preventDefault();\n if (level.id) this.openFlyout(level.id);\n }\n }\n\n handleKeyPress(event: KeyboardEvent, level: NavMainEntity) {\n if (event.key === 'Enter' && !this.isActiveFlyout(level.id) && !level.noFlyout) {\n // It's the first enter keypress and has a flyout, prevent link activation and open the flyout\n event.preventDefault();\n if (level.id) this.openFlyout(level.id);\n }\n }\n\n handleClick(event: MouseEvent, level: NavMainEntity) {\n if (!this.isActiveFlyout(level.id) && !level.noFlyout) {\n // It's the first click, always open the flyout, never the link\n // This is relevant for desktop with active screenreader which\n // translates an enter keypress to a click\n event.preventDefault();\n if (level.id) this.openFlyout(level.id);\n }\n }\n\n /**\n * Disable or re-enable body scrolling, depending on whether mobile menu is open or closed\n */\n setBodyScroll() {\n if (this.mobileMenuOpen) {\n disableBodyScroll(this.flyoutElement);\n } else {\n enableBodyScroll(this.flyoutElement);\n }\n }\n\n /**\n * Toggle the main navigation (only visible on mobile)\n * @param force Force a state\n * @returns Boolean indicating new state\n */\n @Method()\n async toggleDropdown(force?: boolean) {\n this.mobileMenuOpen = force === undefined ? !this.mobileMenuOpen : force;\n this.dropdownToggled.emit({ open: this.mobileMenuOpen, element: this.host });\n\n if (force === false) {\n this.closeFlyout();\n }\n\n this.setBodyScroll();\n this.setWindowHeight();\n\n return this.mobileMenuOpen;\n }\n\n /**\n * Focus the main navigation toggle button\n */\n @Method()\n async setFocus() {\n const firstLink = this.host.shadowRoot?.querySelector<HTMLElement>('.main-link');\n if (firstLink) {\n firstLink.focus();\n }\n }\n\n /**\n * Open a specific flyout\n * @param id Flyout ID\n */\n @Method()\n async setActiveFlyout(id: string | null) {\n this.activeFlyout = id;\n this.flyoutToggled.emit(this.activeFlyout);\n }\n\n render() {\n if (state.localizedConfig?.header === undefined) return;\n const headerConfig = state.localizedConfig.header;\n\n return (\n <Host>\n <SvgSprite />\n <nav\n id=\"post-internet-header-main-navigation\"\n class={{ 'main-navigation': true, 'open': this.mobileMenuOpen }}\n ref={el => (this.flyoutElement = el)}\n >\n <h2 class=\"visually-hidden\">{headerConfig.translations.navMainAriaLabel}</h2>\n <ul class=\"main-container container\">\n {headerConfig.navMain.map(levelOne => (\n <li\n key={levelOne.text}\n onMouseLeave={() => this.handleMouseLeave(levelOne)}\n onMouseEnter={() => this.handleMouseEnter(levelOne)}\n >\n <LevelOneAction\n level={levelOne}\n isOpen={this.isActiveFlyout(levelOne.id)}\n onTouchEnd={e => this.handleTouchEnd(e, levelOne)}\n onKeyDown={e => this.handleKeyPress(e, levelOne)}\n onClick={e => this.handleClick(e, levelOne)}\n />\n {!levelOne.noFlyout ? (\n <div\n id={levelOne.id}\n class={{ flyout: true, open: this.isActiveFlyout(levelOne.id) }}\n >\n <div class=\"wide-container\">\n <div class=\"flyout-nav\">\n <button\n class=\"nav-link flyout-back-button\"\n onClick={() => this.closeFlyout(levelOne.id)}\n >\n <SvgIcon name=\"pi-pointy-arrow-right\" classNames=\"mirrored\" />\n <span>{headerConfig.translations.backButtonText}</span>\n </button>\n <button\n class=\"flyout-close-button\"\n onClick={() => this.closeFlyout(levelOne.id)}\n >\n <span class=\"visually-hidden\">\n {headerConfig.translations.mobileNavToggleClose}\n </span>\n <SvgIcon name=\"pi-close\" />\n </button>\n </div>\n <h2 class=\"flyout-title container\">\n <a href={levelOne.url} class=\"nav-link\">\n {levelOne.text}\n </a>\n </h2>\n <div class=\"flyout-row container\">\n {levelOne.flyout.map(flyout => (\n <div key={flyout.title} class=\"flyout-column\">\n {flyout.title ? <h3>{flyout.title}</h3> : null}\n <ul class=\"flyout-linklist\">\n {flyout.linkList.map(link => (\n <li key={link.url}>\n <a\n class={{\n 'flyout-link': true,\n 'active': !!link?.isActiveOverride,\n }}\n href={link.url}\n target={link.target}\n >\n {link.title}\n </a>\n </li>\n ))}\n </ul>\n </div>\n ))}\n </div>\n </div>\n </div>\n ) : null}\n </li>\n ))}\n </ul>\n <slot></slot>\n </nav>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"post-main-navigation.js","sourceRoot":"","sources":["../../../../src/components/post-main-navigation/post-main-navigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAgB,MAAM,eAAe,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAQzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM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,UAAU,IACpC,QAAQ,CAAC,IAAI,CACZ,CACD;cACL,WAAK,KAAK,EAAC,sBAAsB,IAC9B,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAC7B,WAAK,GAAG,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAC,eAAe;gBAC1C,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,cAAK,MAAM,CAAC,KAAK,CAAM,CAAC,CAAC,CAAC,IAAI;gBAC9C,UAAI,KAAK,EAAC,iBAAiB,IACxB,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAC3B,UAAI,GAAG,EAAE,IAAI,CAAC,GAAG;kBACf,SACE,KAAK,EAAE;sBACL,aAAa,EAAE,IAAI;sBACnB,QAAQ,EAAE,CAAC,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,CAAA;qBACnC,EACD,IAAI,EAAE,IAAI,CAAC,GAAG,EACd,MAAM,EAAE,IAAI,CAAC,MAAM,IAElB,IAAI,CAAC,KAAK,CACT,CACD,CACN,CAAC,CACC,CACD,CACP,CAAC,CACE,CACF,CACF,CACP,CAAC,CAAC,CAAC,IAAI,CACL,CACN,CAAC,CACC;QACL,eAAa,CACT,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, State, Method, Event, Element, EventEmitter } from '@stencil/core';\nimport { throttle } from 'throttle-debounce';\nimport { disableBodyScroll, enableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock';\nimport { state } from '../../data/store';\nimport {\n DropdownElement,\n DropdownEvent,\n HasDropdown,\n IsFocusable,\n NavMainEntity,\n} from '../../models/header.model';\nimport { userPrefersReducedMotion } from '../../services/ui.service';\nimport { SvgSprite } from '../../utils/svg-sprite.component';\nimport { SvgIcon } from '../../utils/svg-icon.component';\nimport { LevelOneAction } from './components/level-one-action.component';\n\n@Component({\n tag: 'post-main-navigation',\n styleUrl: 'post-main-navigation.scss',\n shadow: true,\n})\nexport class PostMainNavigation implements HasDropdown, IsFocusable {\n @State() activeFlyout: string | null;\n @State() mobileMenuOpen: boolean;\n @Event() dropdownToggled: EventEmitter<DropdownEvent>;\n @Event() flyoutToggled: EventEmitter<string | null>;\n @Element() host: DropdownElement;\n private throttledResize: throttle<() => void>;\n private resizeTimer: number | null = null;\n private mouseLeaveTimer: number | null = null;\n private mouseEnterTimer: number | null = null;\n private flyoutElement: HTMLElement | undefined;\n\n connectedCallback() {\n this.throttledResize = throttle(300, () => this.handleResize());\n window.addEventListener('resize', this.throttledResize, { passive: true });\n this.setWindowHeight();\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.throttledResize);\n clearAllBodyScrollLocks();\n if (this.mouseEnterTimer !== null) window.clearTimeout(this.mouseEnterTimer);\n if (this.mouseLeaveTimer !== null) window.clearTimeout(this.mouseLeaveTimer);\n }\n\n handleResize() {\n // Suspend all animations and transitions on window resize\n this.host.classList.add('no-animation');\n if (this.resizeTimer !== null) window.clearTimeout(this.resizeTimer);\n this.resizeTimer = window.setTimeout(() => {\n this.host.classList.remove('no-animation');\n }, 300);\n\n this.setWindowHeight();\n }\n\n // Update window height var\n setWindowHeight() {\n if (!this.host) {\n return;\n }\n this.host.style.setProperty('--window-height', `${window.innerHeight}px`);\n\n // Safari might or might not show a blank bar at the bottom where the browser\n // controls should be. This timeout waits for this bar to appear before resetting the available height\n window.setTimeout(() => {\n this.host.style.setProperty('--window-height', `${window.innerHeight}px`);\n }, 100);\n }\n\n openFlyout(id: string) {\n const flyout = this.host.shadowRoot?.getElementById(id);\n\n if (flyout && this.activeFlyout !== '') {\n // Add flyout animation if there's no flyout open\n this.addFlyoutAnimation(flyout);\n }\n\n this.activeFlyout = id;\n this.flyoutToggled.emit(id);\n this.setWindowHeight();\n\n if (this.mouseLeaveTimer !== null) {\n window.clearTimeout(this.mouseLeaveTimer);\n this.mouseLeaveTimer = null;\n }\n }\n\n closeFlyout(id?: string) {\n if (id === undefined) return;\n const flyout = this.host.shadowRoot?.getElementById(id);\n\n if (flyout) {\n // Add flyout animation for close action\n this.addFlyoutAnimation(flyout);\n }\n\n this.activeFlyout = null;\n this.flyoutToggled.emit();\n }\n\n addFlyoutAnimation(flyout: HTMLElement) {\n // Check if user prefers to see animations or not\n if (!userPrefersReducedMotion()) {\n flyout.classList.add('animate');\n\n // Remove flyout animation after transition ended\n flyout.addEventListener('transitionend', () => this.removeFlyoutAnimation(flyout), {\n once: true,\n });\n }\n }\n\n removeFlyoutAnimation(flyout: HTMLElement) {\n flyout.classList.remove('animate');\n }\n\n isActiveFlyout(id?: string) {\n return id === this.activeFlyout;\n }\n\n handleMouseEnter(level: NavMainEntity) {\n // Cancel opening the flyout if there already is one scheduled to open\n if (this.mouseEnterTimer !== null) {\n window.clearTimeout(this.mouseEnterTimer);\n this.mouseEnterTimer = null;\n }\n\n // Cancel closing if we enter again\n if (this.mouseLeaveTimer && this.activeFlyout === level.id) {\n window.clearTimeout(this.mouseLeaveTimer);\n this.mouseLeaveTimer = null;\n }\n\n if (window.innerWidth >= 1024 && level.flyout.length > 0 && this.activeFlyout !== level.id) {\n // Delay opening the flyout for a moment to give users a chance to move the mouse over the navigation without triggering the flyout\n this.mouseEnterTimer = window.setTimeout(() => {\n this.mouseEnterTimer = null;\n if (level.id !== undefined) this.openFlyout(level.id);\n }, 200);\n }\n }\n\n handleMouseLeave(level: NavMainEntity) {\n // Cancel opening the flyout if a mouseleave event happens before the flyout opened\n if (this.mouseEnterTimer !== null) {\n window.clearTimeout(this.mouseEnterTimer);\n }\n\n // Don't close an open flyout if the mouseleave is from another mainnav entry\n if (this.activeFlyout && this.activeFlyout !== level.id) {\n return;\n }\n\n if (window.innerWidth >= 1024 && level.flyout.length > 0) {\n // Allow the pointer to shortly leave the flyout without closing it. This\n // allows for user mistakes and makes the experience less nervous\n this.mouseLeaveTimer = window.setTimeout(() => {\n this.closeFlyout(level.id);\n }, 300);\n }\n }\n\n handleTouchEnd(event: TouchEvent, level: NavMainEntity) {\n if (!this.isActiveFlyout(level.id) && !level.noFlyout) {\n // It's the first touchstart and has a flyout, prevent link activation and open the flyout\n if (event.cancelable) event.preventDefault();\n if (level.id) this.openFlyout(level.id);\n }\n }\n\n handleKeyPress(event: KeyboardEvent, level: NavMainEntity) {\n if (event.key === 'Enter' && !this.isActiveFlyout(level.id) && !level.noFlyout) {\n // It's the first enter keypress and has a flyout, prevent link activation and open the flyout\n event.preventDefault();\n if (level.id) this.openFlyout(level.id);\n }\n }\n\n handleClick(event: MouseEvent, level: NavMainEntity) {\n if (!this.isActiveFlyout(level.id) && !level.noFlyout) {\n // It's the first click, always open the flyout, never the link\n // This is relevant for desktop with active screenreader which\n // translates an enter keypress to a click\n event.preventDefault();\n if (level.id) this.openFlyout(level.id);\n }\n }\n\n /**\n * Disable or re-enable body scrolling, depending on whether mobile menu is open or closed\n */\n setBodyScroll() {\n if (this.mobileMenuOpen) {\n disableBodyScroll(this.flyoutElement);\n } else {\n enableBodyScroll(this.flyoutElement);\n }\n }\n\n /**\n * Toggle the main navigation (only visible on mobile)\n * @param force Force a state\n * @returns Boolean indicating new state\n */\n @Method()\n async toggleDropdown(force?: boolean) {\n this.mobileMenuOpen = force === undefined ? !this.mobileMenuOpen : force;\n this.dropdownToggled.emit({ open: this.mobileMenuOpen, element: this.host });\n\n if (force === false) {\n this.closeFlyout();\n }\n\n this.setBodyScroll();\n this.setWindowHeight();\n\n return this.mobileMenuOpen;\n }\n\n /**\n * Focus the main navigation toggle button\n */\n @Method()\n async setFocus() {\n const firstLink = this.host.shadowRoot?.querySelector<HTMLElement>('.main-link');\n if (firstLink) {\n firstLink.focus();\n }\n }\n\n /**\n * Open a specific flyout\n * @param id Flyout ID\n */\n @Method()\n async setActiveFlyout(id: string | null) {\n this.activeFlyout = id;\n this.flyoutToggled.emit(this.activeFlyout);\n }\n\n render() {\n if (state.localizedConfig?.header === undefined) return;\n const headerConfig = state.localizedConfig.header;\n\n return (\n <Host>\n <SvgSprite />\n <nav\n id=\"post-internet-header-main-navigation\"\n class={{ 'main-navigation': true, 'open': this.mobileMenuOpen }}\n ref={el => (this.flyoutElement = el)}\n >\n <h1 class=\"visually-hidden\">{headerConfig.translations.navMainAriaLabel}</h1>\n <ul class=\"main-container container\">\n {headerConfig.navMain.map(levelOne => (\n <li\n key={levelOne.text}\n onMouseLeave={() => this.handleMouseLeave(levelOne)}\n onMouseEnter={() => this.handleMouseEnter(levelOne)}\n >\n <LevelOneAction\n level={levelOne}\n isOpen={this.isActiveFlyout(levelOne.id)}\n onTouchEnd={e => this.handleTouchEnd(e, levelOne)}\n onKeyDown={e => this.handleKeyPress(e, levelOne)}\n onClick={e => this.handleClick(e, levelOne)}\n />\n {!levelOne.noFlyout ? (\n <div\n id={levelOne.id}\n class={{ flyout: true, open: this.isActiveFlyout(levelOne.id) }}\n >\n <div class=\"wide-container\">\n <div class=\"flyout-nav\">\n <button\n class=\"nav-link flyout-back-button\"\n onClick={() => this.closeFlyout(levelOne.id)}\n >\n <SvgIcon name=\"pi-pointy-arrow-right\" classNames=\"mirrored\" />\n <span>{headerConfig.translations.backButtonText}</span>\n </button>\n <button\n class=\"flyout-close-button\"\n onClick={() => this.closeFlyout(levelOne.id)}\n >\n <span class=\"visually-hidden\">\n {headerConfig.translations.mobileNavToggleClose}\n </span>\n <SvgIcon name=\"pi-close\" />\n </button>\n </div>\n <h2 class=\"flyout-title container\">\n <a href={levelOne.url} class=\"nav-link\">\n {levelOne.text}\n </a>\n </h2>\n <div class=\"flyout-row container\">\n {levelOne.flyout.map(flyout => (\n <div key={flyout.title} class=\"flyout-column\">\n {flyout.title ? <h3>{flyout.title}</h3> : null}\n <ul class=\"flyout-linklist\">\n {flyout.linkList.map(link => (\n <li key={link.url}>\n <a\n class={{\n 'flyout-link': true,\n 'active': !!link?.isActiveOverride,\n }}\n href={link.url}\n target={link.target}\n >\n {link.title}\n </a>\n </li>\n ))}\n </ul>\n </div>\n ))}\n </div>\n </div>\n </div>\n ) : null}\n </li>\n ))}\n </ul>\n <slot></slot>\n </nav>\n </Host>\n );\n }\n}\n"]}
@@ -33,7 +33,7 @@ export class PostSkiplinks {
33
33
  if (config === undefined) {
34
34
  return;
35
35
  }
36
- return (h(Host, null, h("nav", { class: "skiplinks" }, h("ul", { class: "no-list" }, h("li", null, h("a", { class: "nav-link", href: config.logo.logoLink, accessKey: "0", title: "[ALT + 0]" }, h("span", null, config.logo.logoLinkTitle), h(SvgIcon, { name: "pi-pointy-arrow-right" }))), h("li", null, h("a", { class: "nav-link", href: "#post-internet-header-main-navigation", accessKey: "1", title: "[ALT + 1]", onClick: () => this.focusMain() }, h("span", null, config.translations.navMainAriaLabel), h(SvgIcon, { name: "pi-pointy-arrow-right" }))), mainId ? (h("li", null, h("a", { class: "nav-link", href: `#${mainId}`, accessKey: "2", title: "[ALT + 2]" }, h("span", null, translate('Go to main content')), h(SvgIcon, { name: "pi-pointy-arrow-right" })))) : null, state.search ? (h("li", null, h("a", { class: "nav-link", href: "#post-internet-header-search-button", accessKey: "3", title: "[ALT + 3]", onClick: () => this.focusSearch() }, h("span", null, translate('Go to search')), h(SvgIcon, { name: "pi-pointy-arrow-right" })))) : null, state.login ? (h("li", null, h("a", { class: "nav-link", href: "#post-klp-login-widget", accessKey: "4", title: "[ALT + 4]", onClick: () => this.focusLogin() }, h("span", null, translate('Go to login')), h(SvgIcon, { name: "pi-pointy-arrow-right" })))) : null))));
36
+ return (h(Host, null, h("div", { class: "skiplinks" }, h("h1", { class: "visually-hidden" }, translate('Navigate on post.ch')), h("ul", { class: "no-list" }, h("li", null, h("a", { class: "nav-link", href: config.logo.logoLink, accessKey: "0", title: "[ALT + 0]" }, h("span", null, config.logo.logoLinkTitle), h(SvgIcon, { name: "pi-pointy-arrow-right" }))), h("li", null, h("a", { class: "nav-link", href: "#post-internet-header-main-navigation", accessKey: "1", title: "[ALT + 1]", onClick: () => this.focusMain() }, h("span", null, config.translations.navMainAriaLabel), h(SvgIcon, { name: "pi-pointy-arrow-right" }))), mainId ? (h("li", null, h("a", { class: "nav-link", href: `#${mainId}`, accessKey: "2", title: "[ALT + 2]" }, h("span", null, translate('Go to main content')), h(SvgIcon, { name: "pi-pointy-arrow-right" })))) : null, state.search ? (h("li", null, h("a", { class: "nav-link", href: "#post-internet-header-search-button", accessKey: "3", title: "[ALT + 3]", onClick: () => this.focusSearch() }, h("span", null, translate('Go to search')), h(SvgIcon, { name: "pi-pointy-arrow-right" })))) : null, state.login ? (h("li", null, h("a", { class: "nav-link", href: "#post-klp-login-widget", accessKey: "4", title: "[ALT + 4]", onClick: () => this.focusLogin() }, h("span", null, translate('Go to login')), h(SvgIcon, { name: "pi-pointy-arrow-right" })))) : null))));
37
37
  }
38
38
  static get is() { return "post-skiplinks"; }
39
39
  static get originalStyleUrls() {
@@ -1 +1 @@
1
- {"version":3,"file":"post-skiplinks.js","sourceRoot":"","sources":["../../../../src/components/post-skiplinks/post-skiplinks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAOzD,MAAM,OAAO,aAAa;EAGhB,SAAS;;IACf,OAAO,MAAA,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,0CAAE,YAAY,CAAC,IAAI,CAAC,CAAC;EAChE,CAAC;EAEO,QAAQ,CAAC,OAAe;IAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CA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G,CACtC,CACD;UACJ,MAAM,CAAC,CAAC,CAAC,CACR;YACE,SAAG,KAAK,EAAC,UAAU,EAAC,IAAI,EAAE,IAAI,MAAM,EAAE,EAAE,SAAS,EAAC,GAAG,EAAC,KAAK,EAAC,WAAW;cACrE,gBAAO,SAAS,CAAC,oBAAoB,CAAC,CAAQ;cAC9C,EAAC,OAAO,IAAC,IAAI,EAAC,uBAAuB,GAAG,CACtC,CACD,CACN,CAAC,CAAC,CAAC,IAAI;UACP,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CACd;YACE,SACE,KAAK,EAAC,UAAU,EAChB,IAAI,EAAC,qCAAqC,EAC1C,SAAS,EAAC,GAAG,EACb,KAAK,EAAC,WAAW,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE;cAEjC,gBAAO,SAAS,CAAC,cAAc,CAAC,CAAQ;cACxC,EAAC,OAAO,IAAC,IAAI,EAAC,uBAAuB,GAAG,CACtC,CACD,CACN,CAAC,CAAC,CAAC,IAAI;UACP,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CACb;YACE,SACE,KAAK,EAAC,UAAU,EAChB,IAAI,EAAC,wBAAwB,EAC7B,SAAS,EAAC,GAAG,EACb,KAAK,EAAC,WAAW,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE;cAEhC,gBAAO,SAAS,CAAC,aAAa,CAAC,CAAQ;cACvC,EAAC,OAAO,IAAC,IAAI,EAAC,uBAAuB,GAAG,CACtC,CACD,CACN,CAAC,CAAC,CAAC,IAAI,CACL,CACD,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Element } from '@stencil/core';\nimport { state } from '../../data/store';\nimport { FocusableElement } from '../../models/header.model';\nimport { translate } from '../../services/language.service';\nimport { SvgIcon } from '../../utils/svg-icon.component';\n\n@Component({\n tag: 'post-skiplinks',\n styleUrl: 'post-skiplinks.scss',\n shadow: false,\n})\nexport class PostSkiplinks {\n @Element() host: HTMLElement;\n\n private getMainId() {\n return document.querySelector('main[id]')?.getAttribute('id');\n }\n\n private setFocus(tagname: string) {\n const rootHost = this.host.closest('.post-internet-header');\n if (!rootHost) {\n return;\n }\n\n const focusable = rootHost.querySelector<FocusableElement>(tagname);\n if (focusable) {\n focusable.setFocus();\n }\n }\n\n private focusMain() {\n this.setFocus('post-main-navigation');\n }\n\n private focusSearch() {\n this.setFocus('post-search');\n }\n\n private focusLogin() {\n this.setFocus('post-klp-login-widget');\n }\n\n render() {\n const config = state.localizedConfig?.header;\n const mainId = this.getMainId();\n\n if (config === undefined) {\n return;\n }\n\n return (\n <Host>\n <nav class=\"skiplinks\">\n <ul class=\"no-list\">\n <li>\n <a class=\"nav-link\" href={config.logo.logoLink} accessKey=\"0\" title=\"[ALT + 0]\">\n <span>{config.logo.logoLinkTitle}</span>\n <SvgIcon name=\"pi-pointy-arrow-right\" />\n </a>\n </li>\n <li>\n <a\n class=\"nav-link\"\n href=\"#post-internet-header-main-navigation\"\n accessKey=\"1\"\n title=\"[ALT + 1]\"\n onClick={() => this.focusMain()}\n >\n <span>{config.translations.navMainAriaLabel}</span>\n <SvgIcon name=\"pi-pointy-arrow-right\" />\n </a>\n </li>\n {mainId ? (\n <li>\n <a class=\"nav-link\" href={`#${mainId}`} accessKey=\"2\" title=\"[ALT + 2]\">\n <span>{translate('Go to main content')}</span>\n <SvgIcon name=\"pi-pointy-arrow-right\" />\n </a>\n </li>\n ) : null}\n {state.search ? (\n <li>\n <a\n class=\"nav-link\"\n href=\"#post-internet-header-search-button\"\n accessKey=\"3\"\n title=\"[ALT + 3]\"\n onClick={() => this.focusSearch()}\n >\n <span>{translate('Go to search')}</span>\n <SvgIcon name=\"pi-pointy-arrow-right\" />\n </a>\n </li>\n ) : null}\n {state.login ? (\n <li>\n <a\n class=\"nav-link\"\n href=\"#post-klp-login-widget\"\n accessKey=\"4\"\n title=\"[ALT + 4]\"\n onClick={() => this.focusLogin()}\n >\n <span>{translate('Go to login')}</span>\n <SvgIcon name=\"pi-pointy-arrow-right\" />\n </a>\n </li>\n ) : null}\n </ul>\n </nav>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"post-skiplinks.js","sourceRoot":"","sources":["../../../../src/components/post-skiplinks/post-skiplinks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAOzD,MAAM,OAAO,aAAa;EAGhB,SAAS;;IACf,OAAO,MAAA,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,0CAAE,YAAY,CAAC,IAAI,CAAC,CAAC;EAChE,CAAC;EAEO,QAAQ,CAAC,OAAe;IAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC5D,IAAI,CAAC,QAAQ,EAAE;MACb,OAAO;KACR;IAED,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAmB,OAAO,CAAC,CAAC;IACpE,IAAI,SAAS,EAAE;MACb,SAAS,CAAC,QAAQ,EAAE,CAAC;KACtB;EACH,CAAC;EAEO,SAAS;IACf,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;EACxC,CAAC;EAEO,WAAW;IACjB,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;EAC/B,CAAC;EAEO,UAAU;IAChB,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;EACzC,CAAC;EAED,MAAM;;IACJ,MAAM,MAAM,GAAG,MAAA,KAAK,CAAC,eAAe,0CAAE,MAAM,CAAC;IAC7C,MAAM,MAAM,GAAG,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E,CAAC,IAAI,CAAC,WAAW,EAAE;cAEjC,gBAAO,SAAS,CAAC,cAAc,CAAC,CAAQ;cACxC,EAAC,OAAO,IAAC,IAAI,EAAC,uBAAuB,GAAG,CACtC,CACD,CACN,CAAC,CAAC,CAAC,IAAI;UACP,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CACb;YACE,SACE,KAAK,EAAC,UAAU,EAChB,IAAI,EAAC,wBAAwB,EAC7B,SAAS,EAAC,GAAG,EACb,KAAK,EAAC,WAAW,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE;cAEhC,gBAAO,SAAS,CAAC,aAAa,CAAC,CAAQ;cACvC,EAAC,OAAO,IAAC,IAAI,EAAC,uBAAuB,GAAG,CACtC,CACD,CACN,CAAC,CAAC,CAAC,IAAI,CACL,CACD,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Element } from '@stencil/core';\nimport { state } from '../../data/store';\nimport { FocusableElement } from '../../models/header.model';\nimport { translate } from '../../services/language.service';\nimport { SvgIcon } from '../../utils/svg-icon.component';\n\n@Component({\n tag: 'post-skiplinks',\n styleUrl: 'post-skiplinks.scss',\n shadow: false,\n})\nexport class PostSkiplinks {\n @Element() host: HTMLElement;\n\n private getMainId() {\n return document.querySelector('main[id]')?.getAttribute('id');\n }\n\n private setFocus(tagname: string) {\n const rootHost = this.host.closest('.post-internet-header');\n if (!rootHost) {\n return;\n }\n\n const focusable = rootHost.querySelector<FocusableElement>(tagname);\n if (focusable) {\n focusable.setFocus();\n }\n }\n\n private focusMain() {\n this.setFocus('post-main-navigation');\n }\n\n private focusSearch() {\n this.setFocus('post-search');\n }\n\n private focusLogin() {\n this.setFocus('post-klp-login-widget');\n }\n\n render() {\n const config = state.localizedConfig?.header;\n const mainId = this.getMainId();\n\n if (config === undefined) {\n return;\n }\n\n return (\n <Host>\n <div class=\"skiplinks\">\n <h1 class=\"visually-hidden\">{translate('Navigate on post.ch')}</h1>\n <ul class=\"no-list\">\n <li>\n <a class=\"nav-link\" href={config.logo.logoLink} accessKey=\"0\" title=\"[ALT + 0]\">\n <span>{config.logo.logoLinkTitle}</span>\n <SvgIcon name=\"pi-pointy-arrow-right\" />\n </a>\n </li>\n <li>\n <a\n class=\"nav-link\"\n href=\"#post-internet-header-main-navigation\"\n accessKey=\"1\"\n title=\"[ALT + 1]\"\n onClick={() => this.focusMain()}\n >\n <span>{config.translations.navMainAriaLabel}</span>\n <SvgIcon name=\"pi-pointy-arrow-right\" />\n </a>\n </li>\n {mainId ? (\n <li>\n <a class=\"nav-link\" href={`#${mainId}`} accessKey=\"2\" title=\"[ALT + 2]\">\n <span>{translate('Go to main content')}</span>\n <SvgIcon name=\"pi-pointy-arrow-right\" />\n </a>\n </li>\n ) : null}\n {state.search ? (\n <li>\n <a\n class=\"nav-link\"\n href=\"#post-internet-header-search-button\"\n accessKey=\"3\"\n title=\"[ALT + 3]\"\n onClick={() => this.focusSearch()}\n >\n <span>{translate('Go to search')}</span>\n <SvgIcon name=\"pi-pointy-arrow-right\" />\n </a>\n </li>\n ) : null}\n {state.login ? (\n <li>\n <a\n class=\"nav-link\"\n href=\"#post-klp-login-widget\"\n accessKey=\"4\"\n title=\"[ALT + 4]\"\n onClick={() => this.focusLogin()}\n >\n <span>{translate('Go to login')}</span>\n <SvgIcon name=\"pi-pointy-arrow-right\" />\n </a>\n </li>\n ) : null}\n </ul>\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"general.model.js","sourceRoot":"","sources":["../../../src/models/general.model.ts"],"names":[],"mappings":"","sourcesContent":["import { IHeaderConfig, ICustomHeaderConfig, NavMainEntity } from './header.model';\nimport { IBreadcrumbConfig } from './breadcrumbs.model';\nimport { IFooterConfig, ICustomFooterConfig } from './footer.model';\n\ndeclare global {\n interface Window {\n OPPklpWidget: any;\n klpWidgetDev: any;\n jQuery: any;\n $: any;\n SockJS: any;\n }\n}\nexport interface IPortalConfig {\n de?: ILocalizedConfig;\n fr?: ILocalizedConfig;\n it?: ILocalizedConfig;\n en?: ILocalizedConfig;\n}\n\nexport interface ILocalizedConfig {\n header: IHeaderConfig;\n breadcrumb: IBreadcrumbConfig;\n footer?: IFooterConfig;\n}\n\nexport interface ICustomConfig {\n de?: ILocalizedCustomConfig;\n fr?: ILocalizedCustomConfig;\n it?: ILocalizedCustomConfig;\n en?: ILocalizedCustomConfig;\n}\n\nexport interface ILocalizedCustomConfig {\n header: ICustomHeaderConfig;\n footer?: ICustomFooterConfig;\n}\n\nexport type Environment = 'int01' | 'int02' | 'prod';\n\nexport type ActiveRouteProp = 'auto' | 'exact' | false | string;\n\nexport type LocalizedConfigParameters = {\n projectId: string;\n environment: Environment;\n language?: string;\n mapMyPost?: boolean;\n cookieKey?: string;\n localStorageKey?: string;\n activeRouteProp?: ActiveRouteProp;\n localizedCustomConfig?: ILocalizedCustomConfig;\n osFlyoutOverrides?: NavMainEntity;\n};\n"]}
1
+ {"version":3,"file":"general.model.js","sourceRoot":"","sources":["../../../src/models/general.model.ts"],"names":[],"mappings":"","sourcesContent":["import { IHeaderConfig, ICustomHeaderConfig, NavMainEntity } from './header.model';\nimport { IBreadcrumbConfig } from './breadcrumbs.model';\nimport { IFooterConfig, ICustomFooterConfig } from './footer.model';\n\ndeclare global {\n interface Window {\n OPPklpWidget: any;\n klpWidgetDev: any;\n jQuery: any;\n $: any;\n SockJS: any;\n }\n}\nexport interface IPortalConfig {\n de?: ILocalizedConfig;\n fr?: ILocalizedConfig;\n it?: ILocalizedConfig;\n en?: ILocalizedConfig;\n}\n\nexport interface ILocalizedConfig {\n header: IHeaderConfig;\n breadcrumb: IBreadcrumbConfig;\n footer?: IFooterConfig;\n}\n\nexport interface ICustomConfig {\n de?: ILocalizedCustomConfig;\n fr?: ILocalizedCustomConfig;\n it?: ILocalizedCustomConfig;\n en?: ILocalizedCustomConfig;\n}\n\nexport interface ILocalizedCustomConfig {\n header?: ICustomHeaderConfig;\n footer?: ICustomFooterConfig;\n}\n\nexport type Environment = 'dev01' | 'dev02' | 'test' | 'int01' | 'int02' | 'prod';\n\nexport type ActiveRouteProp = 'auto' | 'exact' | false | string;\n\nexport type LocalizedConfigParameters = {\n projectId: string;\n environment: Environment;\n language?: string;\n mapMyPost?: boolean;\n cookieKey?: string;\n localStorageKey?: string;\n activeRouteProp?: ActiveRouteProp;\n localizedCustomConfig?: ILocalizedCustomConfig;\n osFlyoutOverrides?: NavMainEntity;\n};\n"]}
@@ -114,11 +114,12 @@ export const fetchConfig = async (projectId, environment) => {
114
114
  export const generateConfigUrl = (projectId, environment) => {
115
115
  if (projectId === 'test')
116
116
  return 'assets/config/test-configuration.json';
117
- const isInt = environment.startsWith('int');
118
- const host = `https://${isInt ? 'int' : 'www'}.post.ch`;
117
+ const parsedEnvironment = environment.toLowerCase();
118
+ const isProd = parsedEnvironment === 'prod';
119
+ const host = `https://${isProd ? 'www' : 'int'}.post.ch`;
119
120
  try {
120
121
  // Use URL to validate the generated URL
121
- return new URL(`${host}/api/headerjs/Json?serviceid=${encodeURIComponent(projectId)}${isInt ? '&environment=' + environment : ''}`).toString();
122
+ return new URL(`${host}/api/headerjs/Json?serviceid=${encodeURIComponent(projectId)}${!isProd ? '&environment=' + parsedEnvironment : ''}`).toString();
122
123
  }
123
124
  catch (error) {
124
125
  throw new Error(`Internet Header: Config URL is invalid.`);
@@ -141,6 +142,7 @@ export const isValidProjectId = (projectId) => {
141
142
  * @returns Localized custom config object
142
143
  */
143
144
  export const getLocalizedCustomConfig = (config, language) => {
145
+ var _a;
144
146
  let customConfig;
145
147
  try {
146
148
  customConfig = typeof config === 'string' ? JSON.parse(config) : config;
@@ -149,7 +151,7 @@ export const getLocalizedCustomConfig = (config, language) => {
149
151
  throw new Error(`Internet Header: Custom config is invalid. Make sure your custom config contains valid JSON syntax and matches the definition. `);
150
152
  }
151
153
  let localizedCustomConfig = customConfig[language];
152
- if (localizedCustomConfig !== undefined)
154
+ if ((_a = localizedCustomConfig === null || localizedCustomConfig === void 0 ? void 0 : localizedCustomConfig.header) === null || _a === void 0 ? void 0 : _a.navMain)
153
155
  setMainNavigationIds(localizedCustomConfig.header.navMain);
154
156
  return localizedCustomConfig;
155
157
  };
@@ -1 +1 @@
1
- {"version":3,"file":"config.service.js","sourceRoot":"","sources":["../../../src/services/config.service.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,0BAA0B;AAC1B,IAAI,OAAO,GAAkC,IAAI,CAAC;AAElD,qDAAqD;AACrD,IAAI,aAAa,GAAyB,IAAI,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,EACvC,SAAS,EACT,WAAW,EACX,QAAQ,EACR,SAAS,EACT,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,iBAAiB,GACS,EAA6B,EAAE;;EACzD,IAAI,CAAC,OAAO,EAAE;IACZ,OAAO,GAAG,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;GAC/C;EAED,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC;EAC7B,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC;EAEpF,IAAI,IAAI,KAAK,SAAS,EAAE;IACtB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;GAC1E;EAED,kDAAkD;EAClD,IAAI,eAAe,qBAA0B,MAAM,CAAC,IAAI,CAAC,CAAE,CAAC;EAE5D,yCAAyC;EACzC,IAAI,qBAAqB,EAAE;IACzB,MAAM,MAAM,GAAG,CAAA,MAAA,qBAAqB,aAArB,qBAAqB,uBAArB,qBA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fig,\n LocalizedConfigParameters,\n} from '../models/general.model';\nimport { NavMainEntity } from '../models/header.model';\nimport { getUserLang, persistLanguageChoice } from './language.service';\nimport { uniqueId } from '../utils/utils';\nimport { markActiveRoute } from './route.service';\n\n// Prevent double requests\nlet request: Promise<IPortalConfig> | null = null;\n\n// Cache the original os flyout to use it for updates\nlet osFlyoutCache: NavMainEntity | null = null;\n\n/**\n * Get a localized config object\n *\n * @param projectId String identifying the project\n * @param language [optional] Preferred language\n * @returns Localized config object\n */\nexport const getLocalizedConfig = async ({\n projectId,\n environment,\n language,\n cookieKey,\n localStorageKey,\n activeRouteProp,\n localizedCustomConfig,\n osFlyoutOverrides,\n}: LocalizedConfigParameters): Promise<ILocalizedConfig> => {\n if (!request) {\n request = fetchConfig(projectId, environment);\n }\n\n const config = await request;\n const lang = getUserLang(Object.keys(config), language, localStorageKey, cookieKey);\n\n if (lang === undefined) {\n throw new Error('Internet Header: unable to determine current language');\n }\n\n // Clone config for more predictable state updates\n let localizedConfig: ILocalizedConfig = { ...config[lang] };\n\n // Merge custom config with portal config\n if (localizedCustomConfig) {\n const header = localizedCustomConfig?.header?.navMain\n ? {\n ...localizedConfig.header,\n navMain: [...localizedConfig.header.navMain, ...localizedCustomConfig.header.navMain],\n }\n : localizedConfig.header;\n localizedConfig = {\n ...localizedConfig,\n header,\n };\n }\n\n // Add entries to flyout_os\n if (osFlyoutOverrides)\n localizedConfig.header.navMain = mergeOsFlyoutOverrides(localizedConfig, osFlyoutOverrides);\n\n // Mark active route\n if (activeRouteProp)\n localizedConfig.header.navMain = markActiveRoute(\n localizedConfig.header.navMain,\n activeRouteProp,\n );\n\n setMainNavigationIds(localizedConfig?.header?.navMain);\n\n // Set the new language choice\n persistLanguageChoice(lang, cookieKey, localStorageKey);\n\n return localizedConfig;\n};\n\n/**\n * Merge portal config with custom os flyout overrides\n * @param config Localized config\n * @param osFlyoutOverrides Overrides for the flyout\n * @returns Merged localized config\n */\nexport const mergeOsFlyoutOverrides = (\n config: ILocalizedConfig,\n osFlyoutOverrides: NavMainEntity,\n): NavMainEntity[] => {\n if (!osFlyoutOverrides) return config.header.navMain;\n\n return config.header.navMain.map(mainNav => {\n if (mainNav.id !== 'flyout_os') return mainNav;\n\n if (osFlyoutCache === null) {\n osFlyoutCache = JSON.parse(JSON.stringify(mainNav)) as NavMainEntity;\n }\n\n const mainNavText = osFlyoutOverrides.text ?? osFlyoutCache.text;\n const mainNavTitle = osFlyoutOverrides.title ?? osFlyoutCache.title;\n\n if (\n !osFlyoutCache.flyout ||\n osFlyoutCache.flyout.length === 0 ||\n !osFlyoutOverrides.flyout ||\n osFlyoutOverrides.flyout.length === 0\n )\n return {\n ...mainNav,\n title: mainNavTitle,\n text: mainNavText,\n };\n\n // Add entries for os flyout columns without overriding existing config\n const mainNavFlyout = [\n ...osFlyoutCache.flyout.map((col, index) => {\n const overrides = osFlyoutOverrides.flyout[index];\n const title = overrides.title ?? col.title;\n\n const linkList = overrides.linkList ? osFlyoutOverrides.flyout[index].linkList : [];\n\n return {\n title,\n linkList: [...col.linkList, ...linkList],\n };\n }),\n ...osFlyoutOverrides.flyout.slice(osFlyoutCache.flyout.length),\n ];\n\n return {\n ...mainNav,\n text: mainNavText,\n title: mainNavTitle,\n flyout: mainNavFlyout,\n } as NavMainEntity;\n });\n};\n\n/**\n * Fetch the general config based on project id\n *\n * @returns Promise for Post Portal general config\n */\nexport const fetchConfig = async (\n projectId: string,\n environment: Environment,\n): Promise<IPortalConfig> => {\n // Check if project id is sanitized\n if (!isValidProjectId(projectId)) {\n throw new Error(`Internet Header: invalid project id \"${projectId}\"`);\n }\n\n if (projectId === 'test') {\n environment = 'int01';\n }\n\n let url = generateConfigUrl(projectId, environment);\n\n // Get the config if cache is invalid\n try {\n const res = await fetch(url);\n return (await res.json()) as IPortalConfig;\n } catch (error) {\n throw new Error(`Internet Header: fetching config failed. ${error.message}`);\n }\n};\n\n/**\n * Generate an URL with all necessary query params to get the configuration.\n * Project id \"test\" will return a test configuration\n * @param projectId string\n * @param environment int01, int02 or prod\n * @returns URL pointing to the project config\n */\nexport const generateConfigUrl = (projectId: string, environment: Environment): string => {\n if (projectId === 'test') return 'assets/config/test-configuration.json';\n\n const isInt = environment.startsWith('int');\n const host = `https://${isInt ? 'int' : 'www'}.post.ch`;\n try {\n // Use URL to validate the generated URL\n return new URL(\n `${host}/api/headerjs/Json?serviceid=${encodeURIComponent(projectId)}${\n isInt ? '&environment=' + environment : ''\n }`,\n ).toString();\n } catch (error) {\n throw new Error(`Internet Header: Config URL is invalid.`);\n }\n};\n\n/**\n * Check if project id contains only URL safe characters\n *\n * @param projectId Project Id string\n * @returns The valid project id\n */\nexport const isValidProjectId = (projectId: string): boolean => {\n return projectId !== '' && projectId.length > 0 && /^[a-zA-Z][\\w-]*[a-zA-Z0-9]$/.test(projectId);\n};\n\n/**\n * Get the localized config object from a custom config\n *\n * @param config String or json object of the custom config\n * @param language Specific language\n * @returns Localized custom config object\n */\nexport const getLocalizedCustomConfig = (\n config: string | ICustomConfig,\n language: string,\n): ILocalizedCustomConfig | undefined => {\n let customConfig: ICustomConfig;\n try {\n customConfig = typeof config === 'string' ? JSON.parse(config) : config;\n } catch (error) {\n throw new Error(\n `Internet Header: Custom config is invalid. Make sure your custom config contains valid JSON syntax and matches the definition. `,\n );\n }\n let localizedCustomConfig: ILocalizedCustomConfig | undefined = customConfig[language];\n if (localizedCustomConfig !== undefined)\n setMainNavigationIds(localizedCustomConfig.header.navMain);\n return localizedCustomConfig;\n};\n\n/**\n * Check if mobile header styles are applied or not\n * @returns True if browser is smaller than 1024px\n */\nexport const isMobile = () => window.innerWidth < 1024;\n\n/**\n * Set unique ID's on main navigation entities but conserve flyout_os to be able to\n * identify the online-service flyout, which can be configured by osFlyoutOverrides\n */\nexport const setMainNavigationIds = (navMainEntities: NavMainEntity[]): void => {\n navMainEntities.forEach(navMainEntity => {\n navMainEntity.id = navMainEntity.id === 'flyout_os' ? navMainEntity.id : uniqueId('main-nav-');\n });\n};\n"]}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M,GAAG,CAAC,IAAI,6BAA6B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACnG,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,MAA8B,EAC9B,QAAgB,EACoB,EAAE;;EACtC,IAAI,YAA2B,CAAC;EAChC,IAAI;IACF,YAAY,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;GACzE;EAAC,OAAO,KAAK,EAAE;IACd,MAAM,IAAI,KAAK,CACb,iIAAiI,CAClI,CAAC;GACH;EACD,IAAI,qBAAqB,GAAuC,YAAY,CAAC,QAAQ,CAAC,CAAC;EACvF,IAAI,MAAA,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,MAAM,0CAAE,OAAO;IACxC,oBAAoB,CAAC,qBAAqB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;EAC7D,OAAO,qBAAqB,CAAC;AAC/B,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC;AAEvD;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,eAAgC,EAAQ,EAAE;EAC7E,eAAe,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;IACtC,aAAa,CAAC,EAAE,GAAG,aAAa,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;EACjG,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import {\n Environment,\n IPortalConfig,\n ILocalizedConfig,\n ICustomConfig,\n ILocalizedCustomConfig,\n LocalizedConfigParameters,\n} from '../models/general.model';\nimport { NavMainEntity } from '../models/header.model';\nimport { getUserLang, persistLanguageChoice } from './language.service';\nimport { uniqueId } from '../utils/utils';\nimport { markActiveRoute } from './route.service';\n\n// Prevent double requests\nlet request: Promise<IPortalConfig> | null = null;\n\n// Cache the original os flyout to use it for updates\nlet osFlyoutCache: NavMainEntity | null = null;\n\n/**\n * Get a localized config object\n *\n * @param projectId String identifying the project\n * @param language [optional] Preferred language\n * @returns Localized config object\n */\nexport const getLocalizedConfig = async ({\n projectId,\n environment,\n language,\n cookieKey,\n localStorageKey,\n activeRouteProp,\n localizedCustomConfig,\n osFlyoutOverrides,\n}: LocalizedConfigParameters): Promise<ILocalizedConfig> => {\n if (!request) {\n request = fetchConfig(projectId, environment);\n }\n\n const config = await request;\n const lang = getUserLang(Object.keys(config), language, localStorageKey, cookieKey);\n\n if (lang === undefined) {\n throw new Error('Internet Header: unable to determine current language');\n }\n\n // Clone config for more predictable state updates\n let localizedConfig: ILocalizedConfig = { ...config[lang] };\n\n // Merge custom config with portal config\n if (localizedCustomConfig) {\n const header = localizedCustomConfig?.header?.navMain\n ? {\n ...localizedConfig.header,\n navMain: [...localizedConfig.header.navMain, ...localizedCustomConfig.header.navMain],\n }\n : localizedConfig.header;\n localizedConfig = {\n ...localizedConfig,\n header,\n };\n }\n\n // Add entries to flyout_os\n if (osFlyoutOverrides)\n localizedConfig.header.navMain = mergeOsFlyoutOverrides(localizedConfig, osFlyoutOverrides);\n\n // Mark active route\n if (activeRouteProp)\n localizedConfig.header.navMain = markActiveRoute(\n localizedConfig.header.navMain,\n activeRouteProp,\n );\n\n setMainNavigationIds(localizedConfig?.header?.navMain);\n\n // Set the new language choice\n persistLanguageChoice(lang, cookieKey, localStorageKey);\n\n return localizedConfig;\n};\n\n/**\n * Merge portal config with custom os flyout overrides\n * @param config Localized config\n * @param osFlyoutOverrides Overrides for the flyout\n * @returns Merged localized config\n */\nexport const mergeOsFlyoutOverrides = (\n config: ILocalizedConfig,\n osFlyoutOverrides: NavMainEntity,\n): NavMainEntity[] => {\n if (!osFlyoutOverrides) return config.header.navMain;\n\n return config.header.navMain.map(mainNav => {\n if (mainNav.id !== 'flyout_os') return mainNav;\n\n if (osFlyoutCache === null) {\n osFlyoutCache = JSON.parse(JSON.stringify(mainNav)) as NavMainEntity;\n }\n\n const mainNavText = osFlyoutOverrides.text ?? osFlyoutCache.text;\n const mainNavTitle = osFlyoutOverrides.title ?? osFlyoutCache.title;\n\n if (\n !osFlyoutCache.flyout ||\n osFlyoutCache.flyout.length === 0 ||\n !osFlyoutOverrides.flyout ||\n osFlyoutOverrides.flyout.length === 0\n )\n return {\n ...mainNav,\n title: mainNavTitle,\n text: mainNavText,\n };\n\n // Add entries for os flyout columns without overriding existing config\n const mainNavFlyout = [\n ...osFlyoutCache.flyout.map((col, index) => {\n const overrides = osFlyoutOverrides.flyout[index];\n const title = overrides.title ?? col.title;\n\n const linkList = overrides.linkList ? osFlyoutOverrides.flyout[index].linkList : [];\n\n return {\n title,\n linkList: [...col.linkList, ...linkList],\n };\n }),\n ...osFlyoutOverrides.flyout.slice(osFlyoutCache.flyout.length),\n ];\n\n return {\n ...mainNav,\n text: mainNavText,\n title: mainNavTitle,\n flyout: mainNavFlyout,\n } as NavMainEntity;\n });\n};\n\n/**\n * Fetch the general config based on project id\n *\n * @returns Promise for Post Portal general config\n */\nexport const fetchConfig = async (\n projectId: string,\n environment: Environment,\n): Promise<IPortalConfig> => {\n // Check if project id is sanitized\n if (!isValidProjectId(projectId)) {\n throw new Error(`Internet Header: invalid project id \"${projectId}\"`);\n }\n\n if (projectId === 'test') {\n environment = 'int01';\n }\n\n let url = generateConfigUrl(projectId, environment);\n\n // Get the config if cache is invalid\n try {\n const res = await fetch(url);\n return (await res.json()) as IPortalConfig;\n } catch (error) {\n throw new Error(`Internet Header: fetching config failed. ${error.message}`);\n }\n};\n\n/**\n * Generate an URL with all necessary query params to get the configuration.\n * Project id \"test\" will return a test configuration\n * @param projectId string\n * @param environment int01, int02 or prod\n * @returns URL pointing to the project config\n */\nexport const generateConfigUrl = (projectId: string, environment: Environment): string => {\n if (projectId === 'test') return 'assets/config/test-configuration.json';\n\n const parsedEnvironment = environment.toLowerCase();\n const isProd = parsedEnvironment === 'prod';\n const host = `https://${isProd ? 'www' : 'int'}.post.ch`;\n try {\n // Use URL to validate the generated URL\n return new URL(\n `${host}/api/headerjs/Json?serviceid=${encodeURIComponent(projectId)}${\n !isProd ? '&environment=' + parsedEnvironment : ''\n }`,\n ).toString();\n } catch (error) {\n throw new Error(`Internet Header: Config URL is invalid.`);\n }\n};\n\n/**\n * Check if project id contains only URL safe characters\n *\n * @param projectId Project Id string\n * @returns The valid project id\n */\nexport const isValidProjectId = (projectId: string): boolean => {\n return projectId !== '' && projectId.length > 0 && /^[a-zA-Z][\\w-]*[a-zA-Z0-9]$/.test(projectId);\n};\n\n/**\n * Get the localized config object from a custom config\n *\n * @param config String or json object of the custom config\n * @param language Specific language\n * @returns Localized custom config object\n */\nexport const getLocalizedCustomConfig = (\n config: string | ICustomConfig,\n language: string,\n): ILocalizedCustomConfig | undefined => {\n let customConfig: ICustomConfig;\n try {\n customConfig = typeof config === 'string' ? JSON.parse(config) : config;\n } catch (error) {\n throw new Error(\n `Internet Header: Custom config is invalid. Make sure your custom config contains valid JSON syntax and matches the definition. `,\n );\n }\n let localizedCustomConfig: ILocalizedCustomConfig | undefined = customConfig[language];\n if (localizedCustomConfig?.header?.navMain)\n setMainNavigationIds(localizedCustomConfig.header.navMain);\n return localizedCustomConfig;\n};\n\n/**\n * Check if mobile header styles are applied or not\n * @returns True if browser is smaller than 1024px\n */\nexport const isMobile = () => window.innerWidth < 1024;\n\n/**\n * Set unique ID's on main navigation entities but conserve flyout_os to be able to\n * identify the online-service flyout, which can be configured by osFlyoutOverrides\n */\nexport const setMainNavigationIds = (navMainEntities: NavMainEntity[]): void => {\n navMainEntities.forEach(navMainEntity => {\n navMainEntity.id = navMainEntity.id === 'flyout_os' ? navMainEntity.id : uniqueId('main-nav-');\n });\n};\n"]}
@@ -14,6 +14,18 @@ export const coveo = {
14
14
  organisation: 'postchagnonprods5sq57qt',
15
15
  token: 'xx7c0e52ab-3de2-4fbd-b9a7-6ca6abd532b4',
16
16
  },
17
+ dev01: {
18
+ organisation: 'postchagnonprods5sq57qt',
19
+ token: 'xx7c0e52ab-3de2-4fbd-b9a7-6ca6abd532b4',
20
+ },
21
+ dev02: {
22
+ organisation: 'postchagnonprods5sq57qt',
23
+ token: 'xx7c0e52ab-3de2-4fbd-b9a7-6ca6abd532b4',
24
+ },
25
+ test: {
26
+ organisation: 'postchagnonprods5sq57qt',
27
+ token: 'xx7c0e52ab-3de2-4fbd-b9a7-6ca6abd532b4',
28
+ },
17
29
  },
18
30
  };
19
31
  //# sourceMappingURL=coveo.settings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"coveo.settings.js","sourceRoot":"","sources":["../../../../src/services/search/coveo.settings.ts"],"names":[],"mappings":"AAEA,kBAAkB;AAClB,MAAM,CAAC,MAAM,KAAK,GAAiB;EACjC,GAAG,EAAE,iEAAiE;EACtE,WAAW,EAAE;IACX,IAAI,EAAE;MACJ,YAAY,EAAE,sBAAsB;MACpC,KAAK,EAAE,wCAAwC;KAChD;IACD,KAAK,EAAE;MACL,YAAY,EAAE,yBAAyB;MACvC,KAAK,EAAE,wCAAwC;KAChD;IACD,KAAK,EAAE;MACL,YAAY,EAAE,yBAAyB;MACvC,KAAK,EAAE,wCAAwC;KAChD;GACF;CACF,CAAC","sourcesContent":["import { CoveoOptions } from '../../models/coveo.model';\n\n// Coveo constants\nexport const coveo: CoveoOptions = {\n url: 'https://platform-eu.cloud.coveo.com/rest/search/v2/querySuggest',\n environment: {\n prod: {\n organisation: 'postchagprod6ef4sbet',\n token: 'xx5b629890-23b9-4fbe-b601-0e8719186969',\n },\n int01: {\n organisation: 'postchagnonprods5sq57qt',\n token: 'xx7c0e52ab-3de2-4fbd-b9a7-6ca6abd532b4',\n },\n int02: {\n organisation: 'postchagnonprods5sq57qt',\n token: 'xx7c0e52ab-3de2-4fbd-b9a7-6ca6abd532b4',\n },\n },\n};\n"]}
1
+ {"version":3,"file":"coveo.settings.js","sourceRoot":"","sources":["../../../../src/services/search/coveo.settings.ts"],"names":[],"mappings":"AAEA,kBAAkB;AAClB,MAAM,CAAC,MAAM,KAAK,GAAiB;EACjC,GAAG,EAAE,iEAAiE;EACtE,WAAW,EAAE;IACX,IAAI,EAAE;MACJ,YAAY,EAAE,sBAAsB;MACpC,KAAK,EAAE,wCAAwC;KAChD;IACD,KAAK,EAAE;MACL,YAAY,EAAE,yBAAyB;MACvC,KAAK,EAAE,wCAAwC;KAChD;IACD,KAAK,EAAE;MACL,YAAY,EAAE,yBAAyB;MACvC,KAAK,EAAE,wCAAwC;KAChD;IACD,KAAK,EAAE;MACL,YAAY,EAAE,yBAAyB;MACvC,KAAK,EAAE,wCAAwC;KAChD;IACD,KAAK,EAAE;MACL,YAAY,EAAE,yBAAyB;MACvC,KAAK,EAAE,wCAAwC;KAChD;IACD,IAAI,EAAE;MACJ,YAAY,EAAE,yBAAyB;MACvC,KAAK,EAAE,wCAAwC;KAChD;GACF;CACF,CAAC","sourcesContent":["import { CoveoOptions } from '../../models/coveo.model';\n\n// Coveo constants\nexport const coveo: CoveoOptions = {\n url: 'https://platform-eu.cloud.coveo.com/rest/search/v2/querySuggest',\n environment: {\n prod: {\n organisation: 'postchagprod6ef4sbet',\n token: 'xx5b629890-23b9-4fbe-b601-0e8719186969',\n },\n int01: {\n organisation: 'postchagnonprods5sq57qt',\n token: 'xx7c0e52ab-3de2-4fbd-b9a7-6ca6abd532b4',\n },\n int02: {\n organisation: 'postchagnonprods5sq57qt',\n token: 'xx7c0e52ab-3de2-4fbd-b9a7-6ca6abd532b4',\n },\n dev01: {\n organisation: 'postchagnonprods5sq57qt',\n token: 'xx7c0e52ab-3de2-4fbd-b9a7-6ca6abd532b4',\n },\n dev02: {\n organisation: 'postchagnonprods5sq57qt',\n token: 'xx7c0e52ab-3de2-4fbd-b9a7-6ca6abd532b4',\n },\n test: {\n organisation: 'postchagnonprods5sq57qt',\n token: 'xx7c0e52ab-3de2-4fbd-b9a7-6ca6abd532b4',\n },\n },\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  import { state } from '../../data/store';
2
2
  import { gisAPIUrl, pois, placesUrl } from './places.settings';
3
- import { hardNormalize, createSlug } from './search-utilities';
3
+ import { hardNormalize } from './search-utilities';
4
4
  // Never load types twice
5
5
  let typesCache = null;
6
6
  /**
@@ -40,7 +40,7 @@ export const queryPlaces = async (query) => {
40
40
  const limit = 8;
41
41
  const excludeTypes = ['address', 'locality', 'region'];
42
42
  const types = await convertTypes();
43
- const geocoderUrl = `${gisAPIUrl}/Geocode?query=${encodeURIComponent(query)}&lang=${state.currentLanguage}&pois=${types}&limit=100`;
43
+ const geocoderUrl = `${gisAPIUrl}/Geocode?query=${encodeURIComponent(query)}&lang=${state.currentLanguage}&pois=${types}&limit=33`;
44
44
  try {
45
45
  const geocodeResponse = await fetch(geocoderUrl);
46
46
  const geocodeJSON = (await geocodeResponse.json());
@@ -84,8 +84,8 @@ export const highlightPlacesString = (query, place) => {
84
84
  */
85
85
  export const getPlacesUrl = (location) => {
86
86
  let url;
87
- if (location.id !== '') {
88
- url = `${placesUrl}/${state.currentLanguage}/${location.id}/${createSlug(location.name)}`;
87
+ if (location.id) {
88
+ url = `${placesUrl}/${state.currentLanguage}/${location.id}/detail`;
89
89
  }
90
90
  else {
91
91
  url = `${placesUrl}?preselecttext=${encodeURIComponent(location.name)}`;
@@ -1 +1 @@
1
- {"version":3,"file":"places.service.js","sourceRoot":"","sources":["../../../../src/services/search/places.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE/D,yBAAyB;AACzB,IAAI,UAAU,GAAkB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CAAC;AACpE,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAAyB,EAAU,EAAE;EAChE,IAAI,GAAW,CAAC;EAEhB,IAAI,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE;IACtB,GAAG,GAAG,GAAG,SAAS,IAAI,KAAK,CAAC,eAAe,IAAI,QAAQ,CAAC,EAAE,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;GAC3F;OAAM;IACL,GAAG,GAAG,GAAG,SAAS,kBAAkB,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;GACzE;EAED,OAAO,GAAG,CAAC;AACb,CAAC,CAAC","sourcesContent":["import { state } from '../../data/store';\nimport { GeocodeLocation, GeocodeResponse, ServiceTypesResponse } from '../../models/geocode.model';\nimport { gisAPIUrl, pois, placesUrl } from './places.settings';\nimport { hardNormalize, createSlug } from './search-utilities';\n\n// Never load types twice\nlet typesCache: string | null = null;\n\n/**\n * Convert Post POI ids to stao cache ids\n * @returns\n */\nconst convertTypes = async () => {\n if (typesCache === null) {\n try {\n const typesResponse = await fetch(`${gisAPIUrl}/Types?lang=${state.currentLanguage}`);\n const typesJSON = (await typesResponse.json()) as ServiceTypesResponse;\n typesCache = encodeURIComponent(\n pois\n .map(poi => {\n const foundType = typesJSON.types.find(type => type.id === poi);\n return foundType?.tag;\n })\n .filter(poi => poi !== undefined)\n .join(','),\n );\n } catch (error) {\n console.error(\n 'Fetching places failed. Did you add \"places.post.ch\" to your connect-src content security policy?',\n );\n throw error;\n }\n }\n\n return typesCache;\n};\n\n/**\n * Query the Gis API for locations and localities (pois)\n *\n * @param query User input string\n * @returns\n */\nexport const queryPlaces = async (query: string): Promise<GeocodeLocation[]> => {\n if (query.length === 0) {\n return [];\n }\n\n const limit = 8;\n const excludeTypes = ['address', 'locality', 'region'];\n const types = await convertTypes();\n const geocoderUrl = `${gisAPIUrl}/Geocode?query=${encodeURIComponent(query)}&lang=${\n state.currentLanguage\n }&pois=${types}&limit=100`;\n\n try {\n const geocodeResponse = await fetch(geocoderUrl);\n const geocodeJSON = (await geocodeResponse.json()) as GeocodeResponse;\n if (!geocodeJSON.ok) {\n throw new Error(geocodeJSON.info);\n }\n return geocodeJSON.locations\n .filter(location => !excludeTypes.includes(location.type))\n .slice(0, limit);\n } catch (error) {\n console.error(\n 'Fetching places failed. Did you add \"places.post.ch\" to your connect-src content security policy?',\n );\n throw error;\n }\n};\n\n/**\n * Try to highlight place suggestions\n * Limitation: accented chars are not handled by this basic function\n *\n * @param query Search term\n * @param place Name of the suggested place\n * @returns\n */\nexport const highlightPlacesString = (query: string | undefined, place: string) => {\n if (query === undefined) return place;\n\n // Strip accents from the string\n const reference = hardNormalize(place);\n const q = hardNormalize(query);\n const indexOfQuery = reference.indexOf(q);\n\n if (indexOfQuery < 0) {\n return place;\n }\n\n return `${place.substring(0, indexOfQuery)}{${place.substring(\n indexOfQuery,\n indexOfQuery + query.length,\n )}}${place.substring(indexOfQuery + query.length, place.length)}`;\n};\n\n/**\n * Get the deeplink to any location found via geocoder\n *\n * @param location A location from the Gis API Geocode endpoint\n * @returns\n */\nexport const getPlacesUrl = (location: GeocodeLocation): string => {\n let url: string;\n\n if (location.id !== '') {\n url = `${placesUrl}/${state.currentLanguage}/${location.id}/${createSlug(location.name)}`;\n } else {\n url = `${placesUrl}?preselecttext=${encodeURIComponent(location.name)}`;\n }\n\n return url;\n};\n"]}
1
+ {"version":3,"file":"places.service.js","sourceRoot":"","sources":["../../../../src/services/search/places.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,yBAAyB;AACzB,IAAI,UAAU,GAAkB,IAAI,CAAC;AA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C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAAyB,EAAU,EAAE;EAChE,IAAI,GAAW,CAAC;EAEhB,IAAI,QAAQ,CAAC,EAAE,EAAE;IACf,GAAG,GAAG,GAAG,SAAS,IAAI,KAAK,CAAC,eAAe,IAAI,QAAQ,CAAC,EAAE,SAAS,CAAC;GACrE;OAAM;IACL,GAAG,GAAG,GAAG,SAAS,kBAAkB,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;GACzE;EAED,OAAO,GAAG,CAAC;AACb,CAAC,CAAC","sourcesContent":["import { state } from '../../data/store';\nimport { GeocodeLocation, GeocodeResponse, ServiceTypesResponse } from '../../models/geocode.model';\nimport { gisAPIUrl, pois, placesUrl } from './places.settings';\nimport { hardNormalize } from './search-utilities';\n\n// Never load types twice\nlet typesCache: string | null = null;\n\n/**\n * Convert Post POI ids to stao cache ids\n * @returns\n */\nconst convertTypes = async () => {\n if (typesCache === null) {\n try {\n const typesResponse = await fetch(`${gisAPIUrl}/Types?lang=${state.currentLanguage}`);\n const typesJSON = (await typesResponse.json()) as ServiceTypesResponse;\n typesCache = encodeURIComponent(\n pois\n .map(poi => {\n const foundType = typesJSON.types.find(type => type.id === poi);\n return foundType?.tag;\n })\n .filter(poi => poi !== undefined)\n .join(','),\n );\n } catch (error) {\n console.error(\n 'Fetching places failed. Did you add \"places.post.ch\" to your connect-src content security policy?',\n );\n throw error;\n }\n }\n\n return typesCache;\n};\n\n/**\n * Query the Gis API for locations and localities (pois)\n *\n * @param query User input string\n * @returns\n */\nexport const queryPlaces = async (query: string): Promise<GeocodeLocation[]> => {\n if (query.length === 0) {\n return [];\n }\n\n const limit = 8;\n const excludeTypes = ['address', 'locality', 'region'];\n const types = await convertTypes();\n const geocoderUrl = `${gisAPIUrl}/Geocode?query=${encodeURIComponent(query)}&lang=${\n state.currentLanguage\n }&pois=${types}&limit=33`;\n\n try {\n const geocodeResponse = await fetch(geocoderUrl);\n const geocodeJSON = (await geocodeResponse.json()) as GeocodeResponse;\n if (!geocodeJSON.ok) {\n throw new Error(geocodeJSON.info);\n }\n return geocodeJSON.locations\n .filter(location => !excludeTypes.includes(location.type))\n .slice(0, limit);\n } catch (error) {\n console.error(\n 'Fetching places failed. Did you add \"places.post.ch\" to your connect-src content security policy?',\n );\n throw error;\n }\n};\n\n/**\n * Try to highlight place suggestions\n * Limitation: accented chars are not handled by this basic function\n *\n * @param query Search term\n * @param place Name of the suggested place\n * @returns\n */\nexport const highlightPlacesString = (query: string | undefined, place: string) => {\n if (query === undefined) return place;\n\n // Strip accents from the string\n const reference = hardNormalize(place);\n const q = hardNormalize(query);\n const indexOfQuery = reference.indexOf(q);\n\n if (indexOfQuery < 0) {\n return place;\n }\n\n return `${place.substring(0, indexOfQuery)}{${place.substring(\n indexOfQuery,\n indexOfQuery + query.length,\n )}}${place.substring(indexOfQuery + query.length, place.length)}`;\n};\n\n/**\n * Get the deeplink to any location found via geocoder\n *\n * @param location A location from the Gis API Geocode endpoint\n * @returns\n */\nexport const getPlacesUrl = (location: GeocodeLocation): string => {\n let url: string;\n\n if (location.id) {\n url = `${placesUrl}/${state.currentLanguage}/${location.id}/detail`;\n } else {\n url = `${placesUrl}?preselecttext=${encodeURIComponent(location.name)}`;\n }\n\n return url;\n};\n"]}
@@ -1,4 +1,3 @@
1
- import slugify from '@sindresorhus/slugify';
2
1
  /**
3
2
  * Transform to lowercase, extract accents to separate unicode chars,
4
3
  * replace all accent unicode chars so only standard latin chars remain
@@ -11,16 +10,4 @@ export const hardNormalize = (str) => str
11
10
  .toLowerCase()
12
11
  .normalize('NFD')
13
12
  .replace(/[\u0300-\u036f]/g, '');
14
- /**
15
- * Convert a poi name to a URL compatible slug, logic copied from TOPOS
16
- * @param fragment A poi name
17
- * @returns
18
- */
19
- export const createSlug = (fragment) => slugify(fragment
20
- .replace(/ \/ /g, '-')
21
- .replace(/ /g, '-')
22
- .replace(/\//g, '')
23
- .replace(/\./g, '')
24
- .replace(/\,/g, '')
25
- .replace(/\'/g, ''));
26
13
  //# sourceMappingURL=search-utilities.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"search-utilities.js","sourceRoot":"","sources":["../../../../src/services/search/search-utilities.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAW,EAAU,EAAE,CACnD,GAAG;GACA,WAAW,EAAE;GACb,SAAS,CAAC,KAAK,CAAC;GAChB,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;AAErC;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAU,EAAE,CACrD,OAAO,CACL,QAAQ;GACL,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;GACrB,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;GAClB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;GAClB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;GAClB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;GAClB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CACtB,CAAC","sourcesContent":["import slugify from '@sindresorhus/slugify';\n\n/**\n * Transform to lowercase, extract accents to separate unicode chars,\n * replace all accent unicode chars so only standard latin chars remain\n * https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript/37511463#37511463\n *\n * @param str Input string\n * @returns\n */\nexport const hardNormalize = (str: string): string =>\n str\n .toLowerCase()\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '');\n\n/**\n * Convert a poi name to a URL compatible slug, logic copied from TOPOS\n * @param fragment A poi name\n * @returns\n */\nexport const createSlug = (fragment: string): string =>\n slugify(\n fragment\n .replace(/ \\/ /g, '-')\n .replace(/ /g, '-')\n .replace(/\\//g, '')\n .replace(/\\./g, '')\n .replace(/\\,/g, '')\n .replace(/\\'/g, ''),\n );\n"]}
1
+ {"version":3,"file":"search-utilities.js","sourceRoot":"","sources":["../../../../src/services/search/search-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAW,EAAU,EAAE,CACnD,GAAG;GACA,WAAW,EAAE;GACb,SAAS,CAAC,KAAK,CAAC;GAChB,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC","sourcesContent":["/**\n * Transform to lowercase, extract accents to separate unicode chars,\n * replace all accent unicode chars so only standard latin chars remain\n * https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript/37511463#37511463\n *\n * @param str Input string\n * @returns\n */\nexport const hardNormalize = (str: string): string =>\n str\n .toLowerCase()\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '');\n"]}
@@ -4,24 +4,38 @@
4
4
  * Throttle execution of a function. Especially useful for rate limiting
5
5
  * execution of handlers on events like resize and scroll.
6
6
  *
7
- * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
8
- * @param {boolean} [noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the
9
- * throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time
10
- * after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,
11
- * the internal counter is reset).
12
- * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
13
- * to `callback` when the throttled-function is executed.
14
- * @param {boolean} [debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),
15
- * schedule `callback` to execute after `delay` ms.
7
+ * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
8
+ * are most useful.
9
+ * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
10
+ * as-is, to `callback` when the throttled-function is executed.
11
+ * @param {object} [options] - An object to configure options.
12
+ * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
13
+ * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
14
+ * one final time after the last throttled-function call. (After the throttled-function has not been called for
15
+ * `delay` milliseconds, the internal counter is reset).
16
+ * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
17
+ * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
18
+ * callback will never executed if both noLeading = true and noTrailing = true.
19
+ * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
20
+ * false (at end), schedule `callback` to execute after `delay` ms.
16
21
  *
17
- * @returns {Function} A new, throttled, function.
22
+ * @returns {Function} A new, throttled, function.
18
23
  */
19
- function throttle (delay, noTrailing, callback, debounceMode) {
24
+ function throttle (delay, callback, options) {
25
+ var _ref = options || {},
26
+ _ref$noTrailing = _ref.noTrailing,
27
+ noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
28
+ _ref$noLeading = _ref.noLeading,
29
+ noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
30
+ _ref$debounceMode = _ref.debounceMode,
31
+ debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
20
32
  /*
21
33
  * After wrapper has stopped being called, this timeout ensures that
22
34
  * `callback` is executed at the proper times in `throttle` and `end`
23
35
  * debounce modes.
24
36
  */
37
+
38
+
25
39
  var timeoutID;
26
40
  var cancelled = false; // Keep track of the last time `callback` was executed.
27
41
 
@@ -34,16 +48,13 @@ function throttle (delay, noTrailing, callback, debounceMode) {
34
48
  } // Function to cancel next exec
35
49
 
36
50
 
37
- function cancel() {
38
- clearExistingTimeout();
39
- cancelled = true;
40
- } // `noTrailing` defaults to falsy.
51
+ function cancel(options) {
52
+ var _ref2 = options || {},
53
+ _ref2$upcomingOnly = _ref2.upcomingOnly,
54
+ upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
41
55
 
42
-
43
- if (typeof noTrailing !== 'boolean') {
44
- debounceMode = callback;
45
- callback = noTrailing;
46
- noTrailing = undefined;
56
+ clearExistingTimeout();
57
+ cancelled = !upcomingOnly;
47
58
  }
48
59
  /*
49
60
  * The `wrapper` function encapsulates all of the throttling / debouncing
@@ -79,10 +90,11 @@ function throttle (delay, noTrailing, callback, debounceMode) {
79
90
  timeoutID = undefined;
80
91
  }
81
92
 
82
- if (debounceMode && !timeoutID) {
93
+ if (!noLeading && debounceMode && !timeoutID) {
83
94
  /*
84
95
  * Since `wrapper` is being called for the first time and
85
- * `debounceMode` is true (at begin), execute `callback`.
96
+ * `debounceMode` is true (at begin), execute `callback`
97
+ * and noLeading != true.
86
98
  */
87
99
  exec();
88
100
  }
@@ -90,11 +102,24 @@ function throttle (delay, noTrailing, callback, debounceMode) {
90
102
  clearExistingTimeout();
91
103
 
92
104
  if (debounceMode === undefined && elapsed > delay) {
93
- /*
94
- * In throttle mode, if `delay` time has been exceeded, execute
95
- * `callback`.
96
- */
97
- exec();
105
+ if (noLeading) {
106
+ /*
107
+ * In throttle mode with noLeading, if `delay` time has
108
+ * been exceeded, update `lastExec` and schedule `callback`
109
+ * to execute after `delay` ms.
110
+ */
111
+ lastExec = Date.now();
112
+
113
+ if (!noTrailing) {
114
+ timeoutID = setTimeout(debounceMode ? clear : exec, delay);
115
+ }
116
+ } else {
117
+ /*
118
+ * In throttle mode without noLeading, if `delay` time has been exceeded, execute
119
+ * `callback`.
120
+ */
121
+ exec();
122
+ }
98
123
  } else if (noTrailing !== true) {
99
124
  /*
100
125
  * In trailing throttle mode, since `delay` time has not been
@@ -122,18 +147,25 @@ function throttle (delay, noTrailing, callback, debounceMode) {
122
147
  * guarantees that a function is only executed a single time, either at the
123
148
  * very beginning of a series of calls, or at the very end.
124
149
  *
125
- * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
126
- * @param {boolean} [atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds
127
- * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.
128
- * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).
129
- * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
130
- * to `callback` when the debounced-function is executed.
150
+ * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
151
+ * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
152
+ * to `callback` when the debounced-function is executed.
153
+ * @param {object} [options] - An object to configure options.
154
+ * @param {boolean} [options.atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds
155
+ * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.
156
+ * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).
131
157
  *
132
158
  * @returns {Function} A new, debounced function.
133
159
  */
134
160
 
135
- function debounce (delay, atBegin, callback) {
136
- return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);
161
+ function debounce (delay, callback, options) {
162
+ var _ref = options || {},
163
+ _ref$atBegin = _ref.atBegin,
164
+ atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;
165
+
166
+ return throttle(delay, callback, {
167
+ debounceMode: atBegin !== false
168
+ });
137
169
  }
138
170
 
139
171
  export { debounce as d, throttle as t };
@@ -1 +1 @@
1
- {"file":"index2.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE;AAC9D;AACA;AACA;AACA;AACA;AACA,EAAE,IAAI,SAAS,CAAC;AAChB,EAAE,IAAI,SAAS,GAAG,KAAK,CAAC;AACx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AS,GAAG,SAAS,CAAC;AAC5B,KAAK;AACL;AACA,IAAI,IAAI,YAAY,IAAI,CAAC,SAAS,EAAE;AACpC;AACA;AACA;AACA;AACA,MAAM,IAAI,EAAE,CAAC;AACb,KAAK;AACL;AACA,IAAI,oBAAoB,EAAE,CAAC;AAC3B;AACA,IAAI,IAAI,YAAY,KAAK,SAAS,IAAI,OAAO,GAAG,KAAK,EAAE;AACvD;AACA;AACA;AACA;AACA,MAAM,IAAI,EAAE,CAAC;AACb,KAAK,MAAM,IAAI,UAAU,KAAK,IAAI,EAAE;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,SAAS,GAAG,UAAU,CAAC,YAAY,GAAG,KAAK,GAAG,IAAI,EAAE,YAAY,KAAK,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC,CAAC;AAChH,KAAK;AACL,GAAG;AACH;AACA,EAAE,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;AAC1B;AACA,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE;AAC7C,EAAE,OAAO,QAAQ,KAAK,SAAS,GAAG,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,KAAK,KAAK,CAAC,CAAC;AACjH;;;;","names":[],"sources":["../../node_modules/.pnpm/throttle-debounce@3.0.1/node_modules/throttle-debounce/esm/index.js"],"sourcesContent":["/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n/**\n * Throttle execution of a function. Especially useful for rate limiting\n * execution of handlers on events like resize and scroll.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {boolean} [noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the\n * throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time\n * after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,\n * the internal counter is reset).\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the throttled-function is executed.\n * @param {boolean} [debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),\n * schedule `callback` to execute after `delay` ms.\n *\n * @returns {Function} A new, throttled, function.\n */\nfunction throttle (delay, noTrailing, callback, debounceMode) {\n /*\n * After wrapper has stopped being called, this timeout ensures that\n * `callback` is executed at the proper times in `throttle` and `end`\n * debounce modes.\n */\n var timeoutID;\n var cancelled = false; // Keep track of the last time `callback` was executed.\n\n var lastExec = 0; // Function to clear existing timeout\n\n function clearExistingTimeout() {\n if (timeoutID) {\n clearTimeout(timeoutID);\n }\n } // Function to cancel next exec\n\n\n function cancel() {\n clearExistingTimeout();\n cancelled = true;\n } // `noTrailing` defaults to falsy.\n\n\n if (typeof noTrailing !== 'boolean') {\n debounceMode = callback;\n callback = noTrailing;\n noTrailing = undefined;\n }\n /*\n * The `wrapper` function encapsulates all of the throttling / debouncing\n * functionality and when executed will limit the rate at which `callback`\n * is executed.\n */\n\n\n function wrapper() {\n for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {\n arguments_[_key] = arguments[_key];\n }\n\n var self = this;\n var elapsed = Date.now() - lastExec;\n\n if (cancelled) {\n return;\n } // Execute `callback` and update the `lastExec` timestamp.\n\n\n function exec() {\n lastExec = Date.now();\n callback.apply(self, arguments_);\n }\n /*\n * If `debounceMode` is true (at begin) this is used to clear the flag\n * to allow future `callback` executions.\n */\n\n\n function clear() {\n timeoutID = undefined;\n }\n\n if (debounceMode && !timeoutID) {\n /*\n * Since `wrapper` is being called for the first time and\n * `debounceMode` is true (at begin), execute `callback`.\n */\n exec();\n }\n\n clearExistingTimeout();\n\n if (debounceMode === undefined && elapsed > delay) {\n /*\n * In throttle mode, if `delay` time has been exceeded, execute\n * `callback`.\n */\n exec();\n } else if (noTrailing !== true) {\n /*\n * In trailing throttle mode, since `delay` time has not been\n * exceeded, schedule `callback` to execute `delay` ms after most\n * recent execution.\n *\n * If `debounceMode` is true (at begin), schedule `clear` to execute\n * after `delay` ms.\n *\n * If `debounceMode` is false (at end), schedule `callback` to\n * execute after `delay` ms.\n */\n timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);\n }\n }\n\n wrapper.cancel = cancel; // Return the wrapper function.\n\n return wrapper;\n}\n\n/* eslint-disable no-undefined */\n/**\n * Debounce execution of a function. Debouncing, unlike throttling,\n * guarantees that a function is only executed a single time, either at the\n * very beginning of a series of calls, or at the very end.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {boolean} [atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the debounced-function is executed.\n *\n * @returns {Function} A new, debounced function.\n */\n\nfunction debounce (delay, atBegin, callback) {\n return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);\n}\n\nexport { debounce, throttle };\n//# sourceMappingURL=index.js.map\n"],"version":3}
1
+ {"file":"index2.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE;AAC7C,EAAE,IAAI,IAAI,GAAG,O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AAS,GAAG,UAAU,CAAC,YAAY,GAAG,KAAK,GAAG,IAAI,EAAE,YAAY,KAAK,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC,CAAC;AAChH,KAAK;AACL,GAAG;AACH;AACA,EAAE,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;AAC1B;AACA,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE;AAC7C,EAAE,IAAI,IAAI,GAAG,OAAO,IAAI,EAAE;AAC1B,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO;AACjC,MAAM,OAAO,GAAG,YAAY,KAAK,KAAK,CAAC,GAAG,KAAK,GAAG,YAAY,CAAC;AAC/D;AACA,EAAE,OAAO,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE;AACnC,IAAI,YAAY,EAAE,OAAO,KAAK,KAAK;AACnC,GAAG,CAAC,CAAC;AACL;;;;","names":[],"sources":["../../node_modules/.pnpm/throttle-debounce@5.0.0/node_modules/throttle-debounce/esm/index.js"],"sourcesContent":["/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n/**\n * Throttle execution of a function. Especially useful for rate limiting\n * execution of handlers on events like resize and scroll.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)\n * are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,\n * as-is, to `callback` when the throttled-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds\n * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed\n * one final time after the last throttled-function call. (After the throttled-function has not been called for\n * `delay` milliseconds, the internal counter is reset).\n * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback\n * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that\n * callback will never executed if both noLeading = true and noTrailing = true.\n * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is\n * false (at end), schedule `callback` to execute after `delay` ms.\n *\n * @returns {Function} A new, throttled, function.\n */\nfunction throttle (delay, callback, options) {\n var _ref = options || {},\n _ref$noTrailing = _ref.noTrailing,\n noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,\n _ref$noLeading = _ref.noLeading,\n noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,\n _ref$debounceMode = _ref.debounceMode,\n debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;\n /*\n * After wrapper has stopped being called, this timeout ensures that\n * `callback` is executed at the proper times in `throttle` and `end`\n * debounce modes.\n */\n\n\n var timeoutID;\n var cancelled = false; // Keep track of the last time `callback` was executed.\n\n var lastExec = 0; // Function to clear existing timeout\n\n function clearExistingTimeout() {\n if (timeoutID) {\n clearTimeout(timeoutID);\n }\n } // Function to cancel next exec\n\n\n function cancel(options) {\n var _ref2 = options || {},\n _ref2$upcomingOnly = _ref2.upcomingOnly,\n upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;\n\n clearExistingTimeout();\n cancelled = !upcomingOnly;\n }\n /*\n * The `wrapper` function encapsulates all of the throttling / debouncing\n * functionality and when executed will limit the rate at which `callback`\n * is executed.\n */\n\n\n function wrapper() {\n for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {\n arguments_[_key] = arguments[_key];\n }\n\n var self = this;\n var elapsed = Date.now() - lastExec;\n\n if (cancelled) {\n return;\n } // Execute `callback` and update the `lastExec` timestamp.\n\n\n function exec() {\n lastExec = Date.now();\n callback.apply(self, arguments_);\n }\n /*\n * If `debounceMode` is true (at begin) this is used to clear the flag\n * to allow future `callback` executions.\n */\n\n\n function clear() {\n timeoutID = undefined;\n }\n\n if (!noLeading && debounceMode && !timeoutID) {\n /*\n * Since `wrapper` is being called for the first time and\n * `debounceMode` is true (at begin), execute `callback`\n * and noLeading != true.\n */\n exec();\n }\n\n clearExistingTimeout();\n\n if (debounceMode === undefined && elapsed > delay) {\n if (noLeading) {\n /*\n * In throttle mode with noLeading, if `delay` time has\n * been exceeded, update `lastExec` and schedule `callback`\n * to execute after `delay` ms.\n */\n lastExec = Date.now();\n\n if (!noTrailing) {\n timeoutID = setTimeout(debounceMode ? clear : exec, delay);\n }\n } else {\n /*\n * In throttle mode without noLeading, if `delay` time has been exceeded, execute\n * `callback`.\n */\n exec();\n }\n } else if (noTrailing !== true) {\n /*\n * In trailing throttle mode, since `delay` time has not been\n * exceeded, schedule `callback` to execute `delay` ms after most\n * recent execution.\n *\n * If `debounceMode` is true (at begin), schedule `clear` to execute\n * after `delay` ms.\n *\n * If `debounceMode` is false (at end), schedule `callback` to\n * execute after `delay` ms.\n */\n timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);\n }\n }\n\n wrapper.cancel = cancel; // Return the wrapper function.\n\n return wrapper;\n}\n\n/* eslint-disable no-undefined */\n/**\n * Debounce execution of a function. Debouncing, unlike throttling,\n * guarantees that a function is only executed a single time, either at the\n * very beginning of a series of calls, or at the very end.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the debounced-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n *\n * @returns {Function} A new, debounced function.\n */\n\nfunction debounce (delay, callback, options) {\n var _ref = options || {},\n _ref$atBegin = _ref.atBegin,\n atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;\n\n return throttle(delay, callback, {\n debounceMode: atBegin !== false\n });\n}\n\nexport { debounce, throttle };\n//# sourceMappingURL=index.js.map\n"],"version":3}