@coras-io/embed 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (373) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +15 -2
  3. package/dist/components/accordion/accordion-item/accordion-item.component.js +9 -3
  4. package/dist/components/accordion/accordion-item/accordion-item.styles.js +4 -0
  5. package/dist/components/accordion/accordion.component.js +8 -0
  6. package/dist/components/alert/alert.component.d.ts +1 -1
  7. package/dist/components/alert/alert.component.js +4 -3
  8. package/dist/components/attraction-card/base/attraction-card.mixin.d.ts +0 -2
  9. package/dist/components/attraction-card/base/attraction-card.mixin.js +0 -6
  10. package/dist/components/attraction-card/base/attraction-card.types.d.ts +0 -1
  11. package/dist/components/basket-mobile/basket-mobile.component.d.ts +14 -3
  12. package/dist/components/basket-mobile/basket-mobile.component.js +71 -15
  13. package/dist/components/better-carousel/better-carousel.component.d.ts +3 -5
  14. package/dist/components/better-carousel/better-carousel.component.js +13 -34
  15. package/dist/components/breadcrumbs/breadcrumb-item/breadcrumb-item.component.js +5 -12
  16. package/dist/components/breadcrumbs/breadcrumb-item/breadcrumb-item.styles.js +13 -5
  17. package/dist/components/breadcrumbs/breadcrumbs.component.d.ts +0 -1
  18. package/dist/components/breadcrumbs/breadcrumbs.component.js +5 -8
  19. package/dist/components/breadcrumbs/breadcrumbs.styles.js +8 -2
  20. package/dist/components/button/button.constants.d.ts +1 -2
  21. package/dist/components/button/button.constants.js +0 -1
  22. package/dist/components/calendar/base/calendar.mixin.js +5 -1
  23. package/dist/components/calendar/multi/multi.component.d.ts +2 -2
  24. package/dist/components/calendar/multi/multi.component.js +12 -19
  25. package/dist/components/carousel/carousel.component.js +9 -2
  26. package/dist/components/categories-tree/categories-tree.component.d.ts +5 -3
  27. package/dist/components/categories-tree/categories-tree.component.js +22 -21
  28. package/dist/components/checkbox/checkbox.component.js +5 -1
  29. package/dist/components/checkbox-group/checkbox-group.component.js +1 -1
  30. package/dist/components/checkbox-group/checkbox-group.styles.js +1 -1
  31. package/dist/components/chip/chip.component.js +8 -3
  32. package/dist/components/crypto-auth-modal/crypto-auth-modal.component.d.ts +6 -0
  33. package/dist/components/crypto-auth-modal/crypto-auth-modal.component.js +15 -1
  34. package/dist/components/currencies-list/currencies-list.component.js +0 -1
  35. package/dist/components/dialog/dialog.component.js +52 -21
  36. package/dist/components/drawer/drawer.component.d.ts +3 -2
  37. package/dist/components/drawer/drawer.component.js +13 -18
  38. package/dist/components/drawer/drawer.styles.js +5 -2
  39. package/dist/components/dropdown/dropdown.component.js +6 -9
  40. package/dist/components/expiration-timer/expiration-timer.component.d.ts +2 -3
  41. package/dist/components/expiration-timer/expiration-timer.component.js +10 -8
  42. package/dist/components/explore-card/explore-card.component.js +3 -1
  43. package/dist/components/explore-card/explore-card.styles.js +31 -0
  44. package/dist/components/filters-drawer/filters-drawer.component.js +1 -1
  45. package/dist/components/flag-icon/flag-icon.component.d.ts +4 -2
  46. package/dist/components/flag-icon/flag-icon.component.js +16 -4
  47. package/dist/components/icon/icon.component.js +15 -2
  48. package/dist/components/image/image.component.js +4 -3
  49. package/dist/components/image-viewer/image-viewer.component.js +6 -4
  50. package/dist/components/input-field/input-field.component.js +10 -6
  51. package/dist/components/layout/layout.styles.js +1 -1
  52. package/dist/components/locales-list/locales-list.component.js +0 -1
  53. package/dist/components/location-image/location-image.component.js +0 -1
  54. package/dist/components/locations-results/locations-results.component.d.ts +10 -0
  55. package/dist/components/locations-results/locations-results.component.js +22 -15
  56. package/dist/components/locations-results/locations-results.styles.js +4 -1
  57. package/dist/components/message-card/message-card.component.d.ts +1 -1
  58. package/dist/components/message-card/message-card.component.js +4 -3
  59. package/dist/components/mobile-menu-item/mobile-menu-item.component.d.ts +0 -1
  60. package/dist/components/mobile-menu-item/mobile-menu-item.component.js +14 -16
  61. package/dist/components/mobile-menu-item/mobile-menu-item.styles.js +9 -5
  62. package/dist/components/option-group/option-chip/option-chip.component.d.ts +4 -1
  63. package/dist/components/option-group/option-chip/option-chip.component.js +23 -10
  64. package/dist/components/option-group/option-group.component.d.ts +3 -1
  65. package/dist/components/option-group/option-group.component.js +10 -3
  66. package/dist/components/overlay/overlay.component.d.ts +0 -5
  67. package/dist/components/overlay/overlay.component.js +3 -15
  68. package/dist/components/phone-country-code/phone-country-code.component.d.ts +4 -0
  69. package/dist/components/phone-country-code/phone-country-code.component.js +37 -0
  70. package/dist/components/phone-country-codes/phone-country-codes.component.js +1 -1
  71. package/dist/components/phone-field/phone-field.component.js +2 -2
  72. package/dist/components/search-button/search-button.component.d.ts +1 -1
  73. package/dist/components/search-button/search-button.component.js +13 -7
  74. package/dist/components/seated-selector/seated-selector.component.js +3 -3
  75. package/dist/components/seats-io/seats-io.component.d.ts +3 -2
  76. package/dist/components/seats-io/seats-io.component.js +31 -13
  77. package/dist/components/seats-io/seats-io.constants.d.ts +0 -2
  78. package/dist/components/seats-io/seats-io.constants.js +0 -3
  79. package/dist/components/seats-io/seats-io.transform.d.ts +1 -6
  80. package/dist/components/seats-io/seats-io.transform.js +1 -20
  81. package/dist/components/select-list/select-list.component.js +7 -2
  82. package/dist/components/select-list/select-option/select-option.component.d.ts +3 -1
  83. package/dist/components/select-list/select-option/select-option.component.js +10 -3
  84. package/dist/components/tabs/tabs.component.d.ts +2 -0
  85. package/dist/components/tabs/tabs.component.js +59 -5
  86. package/dist/components/time-tag/time-tag.component.js +1 -1
  87. package/dist/containers/basket/basket.component.d.ts +1 -1
  88. package/dist/containers/basket/basket.component.js +21 -20
  89. package/dist/containers/navbar/navbar.component.d.ts +12 -8
  90. package/dist/containers/navbar/navbar.component.js +108 -62
  91. package/dist/containers/navbar/navbar.styles.js +23 -5
  92. package/dist/containers/navbar/navbar.utils.js +4 -4
  93. package/dist/contexts/basket/basket.provider.d.ts +3 -4
  94. package/dist/contexts/basket/basket.provider.js +46 -61
  95. package/dist/contexts/basket/basket.types.d.ts +0 -2
  96. package/dist/controllers/time-expiration.d.ts +15 -2
  97. package/dist/controllers/time-expiration.js +47 -17
  98. package/dist/core/api/client.d.ts +9 -0
  99. package/dist/core/api/client.js +26 -0
  100. package/dist/core/api/middlewares/booking-session/booking-session.constants.d.ts +0 -2
  101. package/dist/core/api/middlewares/booking-session/booking-session.constants.js +0 -2
  102. package/dist/core/api/middlewares/booking-session/booking-session.js +3 -12
  103. package/dist/core/api/middlewares/booking-session/booking-session.utils.d.ts +0 -1
  104. package/dist/core/api/middlewares/booking-session/booking-session.utils.js +6 -28
  105. package/dist/core/api/middlewares/error-handler/error-handler.js +5 -1
  106. package/dist/core/api/middlewares/retry/retry.constants.d.ts +3 -0
  107. package/dist/core/api/middlewares/retry/retry.constants.js +7 -0
  108. package/dist/core/api/middlewares/retry/retry.d.ts +2 -0
  109. package/dist/core/api/middlewares/retry/retry.js +48 -0
  110. package/dist/core/api/queries.d.ts +13 -38
  111. package/dist/core/api/queries.js +16 -99
  112. package/dist/core/events.d.ts +2 -4
  113. package/dist/core/i18n/date.d.ts +14 -5
  114. package/dist/core/i18n/date.js +47 -20
  115. package/dist/core/i18n/localization.js +10 -3
  116. package/dist/core/images/helpers.js +6 -5
  117. package/dist/core/logger.d.ts +17 -0
  118. package/dist/core/logger.js +13 -0
  119. package/dist/core/types/api-schema.d.ts +7872 -0
  120. package/dist/core/types/seats-config.d.ts +5 -4
  121. package/dist/core/types/seats-config.js +10 -3
  122. package/dist/core/utils/crypto-address.d.ts +12 -0
  123. package/dist/core/utils/crypto-address.js +17 -0
  124. package/dist/core/utils/datetime.d.ts +13 -11
  125. package/dist/core/utils/datetime.js +41 -51
  126. package/dist/core/utils/loyalty.d.ts +8 -0
  127. package/dist/core/utils/loyalty.js +10 -0
  128. package/dist/core/utils/redaction.d.ts +9 -0
  129. package/dist/core/utils/redaction.js +58 -0
  130. package/dist/core/utils/time.js +2 -3
  131. package/dist/helpers/helpers.d.ts +6 -0
  132. package/dist/helpers/helpers.js +33 -16
  133. package/dist/locales/ar-SA.d.ts +38 -21
  134. package/dist/locales/ar-SA.js +38 -21
  135. package/dist/locales/da-DK.d.ts +38 -21
  136. package/dist/locales/da-DK.js +38 -21
  137. package/dist/locales/de-DE.d.ts +38 -21
  138. package/dist/locales/de-DE.js +38 -21
  139. package/dist/locales/en-IE.d.ts +38 -21
  140. package/dist/locales/en-IE.js +38 -21
  141. package/dist/locales/en-US.d.ts +38 -21
  142. package/dist/locales/en-US.js +38 -21
  143. package/dist/locales/es-ES.d.ts +38 -21
  144. package/dist/locales/es-ES.js +38 -21
  145. package/dist/locales/fr-FR.d.ts +38 -21
  146. package/dist/locales/fr-FR.js +38 -21
  147. package/dist/locales/fr-MA.d.ts +38 -21
  148. package/dist/locales/fr-MA.js +38 -21
  149. package/dist/locales/is-IS.d.ts +38 -21
  150. package/dist/locales/is-IS.js +38 -21
  151. package/dist/locales/it-IT.d.ts +38 -21
  152. package/dist/locales/it-IT.js +38 -21
  153. package/dist/locales/ms-MY.d.ts +38 -21
  154. package/dist/locales/ms-MY.js +38 -21
  155. package/dist/locales/nb-NO.d.ts +38 -21
  156. package/dist/locales/nb-NO.js +38 -21
  157. package/dist/locales/pl-PL.d.ts +38 -21
  158. package/dist/locales/pl-PL.js +38 -21
  159. package/dist/locales/pt-PT.d.ts +38 -21
  160. package/dist/locales/pt-PT.js +38 -21
  161. package/dist/locales/sv-SE.d.ts +38 -21
  162. package/dist/locales/sv-SE.js +38 -21
  163. package/dist/locales/th-TH.d.ts +38 -21
  164. package/dist/locales/th-TH.js +38 -21
  165. package/dist/locales/tr-TR.d.ts +38 -21
  166. package/dist/locales/tr-TR.js +38 -21
  167. package/dist/locales/zh-CN.d.ts +38 -21
  168. package/dist/locales/zh-CN.js +38 -21
  169. package/dist/locales/zh-HK.d.ts +38 -21
  170. package/dist/locales/zh-HK.js +38 -21
  171. package/dist/mixins/base.mixin.d.ts +3 -1
  172. package/dist/mixins/base.mixin.js +10 -7
  173. package/dist/mixins/coinbase.mixin.d.ts +13 -17
  174. package/dist/mixins/coinbase.mixin.js +251 -288
  175. package/dist/mixins/error-modal.mixin.js +8 -4
  176. package/dist/mixins/location-search/location-search.d.ts +13 -1
  177. package/dist/mixins/location-search/location-search.js +35 -27
  178. package/dist/mixins/overlay/overlay-mixin.js +39 -3
  179. package/dist/mixins/overlay/types.d.ts +1 -0
  180. package/dist/mixins/search-mixin/search-mixin.js +8 -5
  181. package/dist/sdk/diagnostics.js +2 -0
  182. package/dist/sdk/mount.d.ts +10 -0
  183. package/dist/sdk/mount.js +20 -1
  184. package/dist/sdk/page-registry.js +5 -0
  185. package/dist/sdk/params.d.ts +53 -0
  186. package/dist/sdk/params.js +180 -0
  187. package/dist/sdk/redaction.d.ts +1 -4
  188. package/dist/sdk/redaction.js +2 -41
  189. package/dist/sdk/types.d.ts +21 -7
  190. package/dist/sdk/url.d.ts +1 -1
  191. package/dist/sdk/url.js +12 -5
  192. package/dist/sdk/validation.d.ts +1 -26
  193. package/dist/sdk/validation.js +14 -152
  194. package/dist/styles/tokens.d.ts +1 -1
  195. package/dist/styles/tokens.generated.d.ts +1 -1
  196. package/dist/styles/tokens.generated.js +1 -1
  197. package/dist/views/chrome-only-page/chrome-only-page.component.d.ts +30 -0
  198. package/dist/views/chrome-only-page/chrome-only-page.component.js +24 -0
  199. package/dist/views/chrome-only-page/chrome-only-page.d.ts +8 -0
  200. package/dist/views/chrome-only-page/chrome-only-page.js +6 -0
  201. package/dist/views/chrome-only-page/chrome-only-page.styles.js +13 -0
  202. package/dist/views/details-page/details-page.component.d.ts +11 -4
  203. package/dist/views/details-page/details-page.component.js +263 -237
  204. package/dist/views/details-page/details-page.utilts.d.ts +63 -3
  205. package/dist/views/details-page/details-page.utilts.js +53 -5
  206. package/dist/views/details-page/partials/location-categories/location-categories.component.d.ts +29 -0
  207. package/dist/views/details-page/partials/location-categories/location-categories.component.js +149 -0
  208. package/dist/views/details-page/partials/location-categories/location-categories.d.ts +8 -0
  209. package/dist/views/details-page/partials/location-categories/location-categories.js +6 -0
  210. package/dist/views/details-page/partials/location-categories/location-categories.styles.js +35 -0
  211. package/dist/views/details-page/partials/location-highlights/location-highlights.component.d.ts +26 -0
  212. package/dist/views/details-page/partials/location-highlights/location-highlights.component.js +158 -0
  213. package/dist/views/details-page/partials/location-highlights/location-highlights.d.ts +8 -0
  214. package/dist/views/details-page/partials/location-highlights/location-highlights.js +6 -0
  215. package/dist/views/details-page/partials/location-highlights/location-highlights.styles.js +42 -0
  216. package/dist/views/details-page/partials/tour-description/tour-description.component.js +1 -4
  217. package/dist/views/help-page/help-page.component.d.ts +2 -0
  218. package/dist/views/help-page/help-page.component.js +37 -18
  219. package/dist/views/help-page/help-page.utils.js +6 -5
  220. package/dist/views/landing-page/landing-page.component.d.ts +5 -8
  221. package/dist/views/landing-page/landing-page.component.js +82 -97
  222. package/dist/views/payment-page/controllers/crypto-auth.controller.d.ts +10 -4
  223. package/dist/views/payment-page/controllers/crypto-auth.controller.js +53 -31
  224. package/dist/views/payment-page/controllers/crypto-transfer.controller.d.ts +9 -5
  225. package/dist/views/payment-page/controllers/crypto-transfer.controller.js +26 -39
  226. package/dist/views/payment-page/controllers/payment-flow.controller.d.ts +6 -1
  227. package/dist/views/payment-page/controllers/payment-flow.controller.js +1 -0
  228. package/dist/views/payment-page/controllers/stripe-payment.controller.d.ts +20 -2
  229. package/dist/views/payment-page/controllers/stripe-payment.controller.js +42 -19
  230. package/dist/views/payment-page/partials/activity-details/activity-details.component.d.ts +2 -0
  231. package/dist/views/payment-page/partials/activity-details/activity-details.component.js +6 -3
  232. package/dist/views/payment-page/partials/billing-address/billing-address.component.d.ts +2 -0
  233. package/dist/views/payment-page/partials/billing-address/billing-address.component.js +5 -1
  234. package/dist/views/payment-page/partials/confirmation/confirmation.component.js +2 -3
  235. package/dist/views/payment-page/partials/country-field/country-field.component.js +1 -1
  236. package/dist/views/payment-page/partials/payment-type-selector/payment-type-selector.component.js +3 -3
  237. package/dist/views/payment-page/partials/stripe/stripe.component.d.ts +2 -0
  238. package/dist/views/payment-page/partials/stripe/stripe.component.js +36 -7
  239. package/dist/views/payment-page/partials/stripe/stripe.utils.js +0 -3
  240. package/dist/views/payment-page/payment-page.component.d.ts +39 -6
  241. package/dist/views/payment-page/payment-page.component.js +302 -178
  242. package/dist/views/payment-page/payment-page.constants.d.ts +1 -27
  243. package/dist/views/payment-page/payment-page.constants.js +3 -30
  244. package/dist/views/payment-page/payment-page.types.d.ts +1 -19
  245. package/dist/views/payment-page/payment-page.utils.d.ts +22 -13
  246. package/dist/views/payment-page/payment-page.utils.js +57 -75
  247. package/dist/views/payment-page/services/payment-api.service.d.ts +16 -34
  248. package/dist/views/payment-page/services/payment-api.service.js +19 -27
  249. package/dist/views/search-page/search-page.component.d.ts +2 -0
  250. package/dist/views/search-page/search-page.component.js +39 -20
  251. package/dist/views/suggestion-widget/suggestion-widget.component.d.ts +1 -0
  252. package/dist/views/suggestion-widget/suggestion-widget.component.js +6 -5
  253. package/package.json +24 -20
  254. package/dist/components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.component.d.ts +0 -10
  255. package/dist/components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.component.js +0 -43
  256. package/dist/components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.d.ts +0 -8
  257. package/dist/components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.js +0 -6
  258. package/dist/components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.styles.js +0 -23
  259. package/dist/components/attraction-discovery/attraction-discovery.component.d.ts +0 -10
  260. package/dist/components/attraction-discovery/attraction-discovery.component.js +0 -52
  261. package/dist/components/attraction-discovery/attraction-discovery.constants.d.ts +0 -4
  262. package/dist/components/attraction-discovery/attraction-discovery.constants.js +0 -5
  263. package/dist/components/attraction-discovery/attraction-discovery.d.ts +0 -8
  264. package/dist/components/attraction-discovery/attraction-discovery.js +0 -6
  265. package/dist/components/attraction-discovery/attraction-discovery.styles.js +0 -193
  266. package/dist/components/basket-rewards/basket-rewards.component.d.ts +0 -10
  267. package/dist/components/basket-rewards/basket-rewards.component.js +0 -52
  268. package/dist/components/basket-rewards/basket-rewards.d.ts +0 -8
  269. package/dist/components/basket-rewards/basket-rewards.js +0 -6
  270. package/dist/components/basket-rewards/basket-rewards.styles.js +0 -18
  271. package/dist/components/filter-chip/filter-chip.component.d.ts +0 -12
  272. package/dist/components/filter-chip/filter-chip.component.js +0 -68
  273. package/dist/components/filter-chip/filter-chip.constants.d.ts +0 -2
  274. package/dist/components/filter-chip/filter-chip.constants.js +0 -2
  275. package/dist/components/filter-chip/filter-chip.d.ts +0 -8
  276. package/dist/components/filter-chip/filter-chip.js +0 -6
  277. package/dist/components/filter-chip/filter-chip.styles.d.ts +0 -2
  278. package/dist/components/filter-chip/filter-chip.styles.js +0 -162
  279. package/dist/components/image-carousel/image-carousel-item/image-carousel-item.component.d.ts +0 -10
  280. package/dist/components/image-carousel/image-carousel-item/image-carousel-item.component.js +0 -43
  281. package/dist/components/image-carousel/image-carousel-item/image-carousel-item.d.ts +0 -8
  282. package/dist/components/image-carousel/image-carousel-item/image-carousel-item.js +0 -6
  283. package/dist/components/image-carousel/image-carousel-item/image-carousel-item.styles.d.ts +0 -2
  284. package/dist/components/image-carousel/image-carousel-item/image-carousel-item.styles.js +0 -28
  285. package/dist/components/image-carousel/image-carousel.component.d.ts +0 -8
  286. package/dist/components/image-carousel/image-carousel.component.js +0 -36
  287. package/dist/components/image-carousel/image-carousel.d.ts +0 -8
  288. package/dist/components/image-carousel/image-carousel.js +0 -6
  289. package/dist/components/image-carousel/image-carousel.styles.d.ts +0 -2
  290. package/dist/components/image-carousel/image-carousel.styles.js +0 -72
  291. package/dist/components/itinerary/itinerary-item/itinerary-item.component.d.ts +0 -9
  292. package/dist/components/itinerary/itinerary-item/itinerary-item.component.js +0 -45
  293. package/dist/components/itinerary/itinerary-item/itinerary-item.d.ts +0 -8
  294. package/dist/components/itinerary/itinerary-item/itinerary-item.js +0 -6
  295. package/dist/components/itinerary/itinerary-item/itinerary-item.styles.d.ts +0 -2
  296. package/dist/components/itinerary/itinerary-item/itinerary-item.styles.js +0 -70
  297. package/dist/components/itinerary/itinerary.component.d.ts +0 -7
  298. package/dist/components/itinerary/itinerary.component.js +0 -23
  299. package/dist/components/itinerary/itinerary.d.ts +0 -8
  300. package/dist/components/itinerary/itinerary.js +0 -6
  301. package/dist/components/itinerary/itinerary.styles.d.ts +0 -2
  302. package/dist/components/itinerary/itinerary.styles.js +0 -15
  303. package/dist/components/marketing-tag/marketing-tag.component.d.ts +0 -5
  304. package/dist/components/marketing-tag/marketing-tag.component.js +0 -8
  305. package/dist/components/marketing-tag/marketing-tag.d.ts +0 -8
  306. package/dist/components/marketing-tag/marketing-tag.js +0 -6
  307. package/dist/components/marketing-tag/marketing-tag.styles.d.ts +0 -2
  308. package/dist/components/marketing-tag/marketing-tag.styles.js +0 -36
  309. package/dist/components/price/price.component.d.ts +0 -12
  310. package/dist/components/price/price.component.js +0 -38
  311. package/dist/components/price/price.d.ts +0 -8
  312. package/dist/components/price/price.js +0 -6
  313. package/dist/components/reviews/review/review.component.d.ts +0 -9
  314. package/dist/components/reviews/review/review.component.js +0 -41
  315. package/dist/components/reviews/review/review.d.ts +0 -8
  316. package/dist/components/reviews/review/review.js +0 -6
  317. package/dist/components/reviews/review/review.styles.d.ts +0 -2
  318. package/dist/components/reviews/review/review.styles.js +0 -45
  319. package/dist/components/reviews/reviews.component.d.ts +0 -9
  320. package/dist/components/reviews/reviews.component.js +0 -56
  321. package/dist/components/reviews/reviews.d.ts +0 -8
  322. package/dist/components/reviews/reviews.js +0 -6
  323. package/dist/components/reviews/reviews.styles.d.ts +0 -2
  324. package/dist/components/reviews/reviews.styles.js +0 -73
  325. package/dist/components/selected-tickets-preview/selected-tickets-preview.component.d.ts +0 -10
  326. package/dist/components/selected-tickets-preview/selected-tickets-preview.component.js +0 -51
  327. package/dist/components/selected-tickets-preview/selected-tickets-preview.d.ts +0 -8
  328. package/dist/components/selected-tickets-preview/selected-tickets-preview.js +0 -6
  329. package/dist/components/selected-tickets-preview/selected-tickets-preview.styles.d.ts +0 -2
  330. package/dist/components/selected-tickets-preview/selected-tickets-preview.styles.js +0 -89
  331. package/dist/components/tag/tag.component.d.ts +0 -8
  332. package/dist/components/tag/tag.component.js +0 -33
  333. package/dist/components/tag/tag.constants.d.ts +0 -1
  334. package/dist/components/tag/tag.constants.js +0 -1
  335. package/dist/components/tag/tag.d.ts +0 -8
  336. package/dist/components/tag/tag.js +0 -6
  337. package/dist/components/tag/tag.styles.d.ts +0 -2
  338. package/dist/components/tag/tag.styles.js +0 -56
  339. package/dist/components/tooltip/tooltip.component.d.ts +0 -19
  340. package/dist/components/tooltip/tooltip.component.js +0 -124
  341. package/dist/components/tooltip/tooltip.d.ts +0 -8
  342. package/dist/components/tooltip/tooltip.js +0 -6
  343. package/dist/components/tooltip/tooltip.styles.d.ts +0 -2
  344. package/dist/components/tooltip/tooltip.styles.js +0 -79
  345. package/dist/core/signals.d.ts +0 -2
  346. package/dist/core/signals.js +0 -3
  347. package/dist/core/storybook/argTypes.d.ts +0 -1
  348. package/dist/core/storybook/argTypes.js +0 -46
  349. package/dist/core/storybook/cssprops.d.ts +0 -30
  350. package/dist/core/storybook/cssprops.js +0 -46
  351. package/dist/core/storybook/demo.d.ts +0 -4
  352. package/dist/core/storybook/demo.js +0 -17
  353. package/dist/core/types/api-errors.d.ts +0 -8
  354. package/dist/core/types/api-errors.js +0 -1
  355. package/dist/styles/contrast-fixtures.d.ts +0 -5
  356. package/dist/styles/contrast-fixtures.js +0 -131
  357. package/dist/views/payment-page/domain/payment-mappers.d.ts +0 -7
  358. package/dist/views/payment-page/domain/payment-mappers.js +0 -7
  359. package/dist/views/payment-page/domain/payment-validators.d.ts +0 -6
  360. package/dist/views/payment-page/domain/payment-validators.js +0 -6
  361. package/dist/views/payment-page/domain/recovery-payload.d.ts +0 -8
  362. package/dist/views/payment-page/domain/recovery-payload.js +0 -7
  363. package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.component.d.ts +0 -22
  364. package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.component.js +0 -65
  365. package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.d.ts +0 -8
  366. package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.js +0 -6
  367. package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.styles.d.ts +0 -2
  368. package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.styles.js +0 -12
  369. package/dist/views/payment-page/payment-page.validation-schema.d.ts +0 -28
  370. package/dist/views/payment-page/payment-page.validation-schema.js +0 -42
  371. /package/dist/{components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.styles.d.ts → views/chrome-only-page/chrome-only-page.styles.d.ts} +0 -0
  372. /package/dist/{components/attraction-discovery/attraction-discovery.styles.d.ts → views/details-page/partials/location-categories/location-categories.styles.d.ts} +0 -0
  373. /package/dist/{components/basket-rewards/basket-rewards.styles.d.ts → views/details-page/partials/location-highlights/location-highlights.styles.d.ts} +0 -0
@@ -34,6 +34,12 @@ export const ErrorModalMixin = (Base) => {
34
34
  resetErrorModalGuard() {
35
35
  this.hasShownErrorModal = false;
36
36
  }
37
+ // The guard only stops a burst of failures from stacking modals while one
38
+ // is open; once it is dismissed a later failure must be able to show again.
39
+ closeErrorModal() {
40
+ this.isErrorModalOpen = false;
41
+ this.resetErrorModalGuard();
42
+ }
37
43
  renderErrorModal({ assetsURL = "", buttonLabel = "Refresh the page", onRetry, onHelp, }) {
38
44
  if (!this.isErrorModalOpen)
39
45
  return nothing;
@@ -45,9 +51,7 @@ export const ErrorModalMixin = (Base) => {
45
51
  .showCloseButton=${false}
46
52
  .closeOnBackdrop=${false}
47
53
  .closeOnEscape=${false}
48
- @dialog-closed=${() => {
49
- this.isErrorModalOpen = false;
50
- }}
54
+ @dialog-closed=${() => this.closeErrorModal()}
51
55
  >
52
56
  <coras-icon
53
57
  slot="icon"
@@ -87,7 +91,7 @@ export const ErrorModalMixin = (Base) => {
87
91
  <coras-button
88
92
  variant="primary"
89
93
  @click=${() => {
90
- this.isErrorModalOpen = false;
94
+ this.closeErrorModal();
91
95
  onRetry();
92
96
  }}
93
97
  >
@@ -1,7 +1,19 @@
1
1
  import { type LitElement } from "lit";
2
+ import type { SupportedLocales } from "../../core/types/index.js";
2
3
  import type { LocationSearchMixinInterface } from "./types.js";
4
+ import type { PageDispatchInput } from "../../contexts/events.context.js";
3
5
  import "../../components/dropdown/dropdown.js";
4
6
  import "../../components/locations-results/locations-results.js";
5
7
  import "../../components/input-field/input-field.js";
6
8
  import type { Constructor } from "../../contexts/utils.js";
7
- export declare const LocationSearchMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<LocationSearchMixinInterface> & T;
9
+ import type { Client } from "openapi-fetch";
10
+ import type { paths } from "../../core/types/api-schema.js";
11
+ type LocationSearchHost = LitElement & {
12
+ client: Client<paths>;
13
+ locale: SupportedLocales;
14
+ distributorID: string;
15
+ assetsURL: string;
16
+ dispatchPageUpdate(params: PageDispatchInput): void;
17
+ };
18
+ export declare const LocationSearchMixin: <T extends Constructor<LocationSearchHost>>(superClass: T) => Constructor<LocationSearchMixinInterface> & T;
19
+ export {};
@@ -6,20 +6,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { html, } from "lit";
8
8
  import { property, state } from "lit/decorators.js";
9
- import { consume } from "@lit/context";
10
9
  import { classMap } from "lit/directives/class-map.js";
10
+ import { ifDefined } from "lit/directives/if-defined.js";
11
11
  import { Task } from "@lit/task";
12
12
  import { msg } from "@lit/localize";
13
13
  import { debounce } from "../../core/utils/function.js";
14
14
  import { renderLocationResultOption } from "../../components/locations-results/locations-results.component.js";
15
- import { apiHostContext, assetsURLContext, distributorIdContext, localeContext, } from "../../contexts/properties.context.js";
16
- import { pageDispatchContext, } from "../../contexts/events.context.js";
17
15
  import styles from "./location-search.styles.js";
18
16
  import "../../components/dropdown/dropdown.js";
19
17
  import "../../components/locations-results/locations-results.js";
20
18
  import "../../components/input-field/input-field.js";
21
- import { clientContext } from "../../contexts/client.context.js";
22
19
  import { apiGet } from "../../core/api/queries.js";
20
+ import { APIError } from "../../core/api/api-error.js";
23
21
  import { getApiLanguageCode } from "../../core/utils/locale.js";
24
22
  export const LocationSearchMixin = (superClass) => {
25
23
  class LocationSearchMixinElement extends superClass {
@@ -29,6 +27,8 @@ export const LocationSearchMixin = (superClass) => {
29
27
  this.city = "";
30
28
  this.locationSearchTerm = "";
31
29
  this.isLocationsDropdownOpen = false;
30
+ // Set when "Near me" is denied or unavailable, cleared by the next input.
31
+ this.geolocationFailed = false;
32
32
  this.geolocationLatitude = undefined;
33
33
  this.geolocationLongitude = undefined;
34
34
  this.locationNamePlaceholder = "";
@@ -98,6 +98,9 @@ export const LocationSearchMixin = (superClass) => {
98
98
  this.geolocationLongitude = undefined;
99
99
  this.locationNamePlaceholder = "";
100
100
  };
101
+ this.handleGeolocationFailed = () => {
102
+ this.geolocationFailed = true;
103
+ };
101
104
  this.handleGeolocationSelected = (event) => {
102
105
  this.geolocationLatitude = event.detail.latitude;
103
106
  this.geolocationLongitude = event.detail.longitude;
@@ -109,7 +112,7 @@ export const LocationSearchMixin = (superClass) => {
109
112
  this.selectedLocation = item;
110
113
  this.locationSearchTerm = "";
111
114
  this.locationNamePlaceholder = item.name || "";
112
- this._pageDispatch({
115
+ this.dispatchPageUpdate({
113
116
  city: item.location_type === "city" ? (item.slug ?? "") : "",
114
117
  country: item.location_type === "country"
115
118
  ? (item.slug ?? "")
@@ -146,7 +149,7 @@ export const LocationSearchMixin = (superClass) => {
146
149
  this.isFieldFocused = true;
147
150
  this.locationSearchTerm = "";
148
151
  if (!this.cachedPopularLocations) {
149
- this.locationSearchTask.run();
152
+ void this.locationSearchTask.run();
150
153
  }
151
154
  }
152
155
  }
@@ -201,7 +204,19 @@ export const LocationSearchMixin = (superClass) => {
201
204
  return data;
202
205
  }
203
206
  async fetchLocationNameAndSetPlaceholder() {
204
- const response = await this.getLocationData();
207
+ let response;
208
+ try {
209
+ response = await this.getLocationData();
210
+ }
211
+ catch (error) {
212
+ // Called from updated(), where nothing awaits it: an unknown slug is
213
+ // a 404 that must not become an unhandled rejection on the host page.
214
+ // The placeholder simply stays empty.
215
+ if (error instanceof APIError) {
216
+ return;
217
+ }
218
+ throw error;
219
+ }
205
220
  if (!response) {
206
221
  return;
207
222
  }
@@ -224,7 +239,7 @@ export const LocationSearchMixin = (superClass) => {
224
239
  super.updated(changedProperties);
225
240
  if (changedProperties.has("country") || changedProperties.has("city")) {
226
241
  if (this.country || this.city) {
227
- this.fetchLocationNameAndSetPlaceholder();
242
+ void this.fetchLocationNameAndSetPlaceholder();
228
243
  }
229
244
  else if (this.country === "" &&
230
245
  this.city === "" &&
@@ -253,7 +268,14 @@ export const LocationSearchMixin = (superClass) => {
253
268
  @click=${this.toggleLocationsDropdown}
254
269
  @focus=${this.handleFieldFocus}
255
270
  @blur=${this.handleFieldBlur}
256
- @value-changed=${(event) => this.throttledLocationSearch(event)}
271
+ @value-changed=${(event) => {
272
+ this.geolocationFailed = false;
273
+ this.throttledLocationSearch(event);
274
+ }}
275
+ ?error=${this.geolocationFailed}
276
+ help-text=${ifDefined(this.geolocationFailed
277
+ ? msg("We could not use your location. Search for a place instead.")
278
+ : undefined)}
257
279
  @keydown=${this.handleKeyDown}
258
280
  rounded
259
281
  class=${classMap({
@@ -270,6 +292,7 @@ export const LocationSearchMixin = (superClass) => {
270
292
  </coras-field>
271
293
  <coras-locations-results
272
294
  @geolocation-selected=${this.handleGeolocationSelected}
295
+ @geolocation-failed=${this.handleGeolocationFailed}
273
296
  >
274
297
  ${this.renderLocationSearchResults()}
275
298
  </coras-locations-results>
@@ -279,24 +302,6 @@ export const LocationSearchMixin = (superClass) => {
279
302
  `;
280
303
  }
281
304
  }
282
- __decorate([
283
- consume({ context: clientContext, subscribe: true })
284
- ], LocationSearchMixinElement.prototype, "client", void 0);
285
- __decorate([
286
- consume({ context: localeContext, subscribe: true })
287
- ], LocationSearchMixinElement.prototype, "locale", void 0);
288
- __decorate([
289
- consume({ context: distributorIdContext, subscribe: true })
290
- ], LocationSearchMixinElement.prototype, "distributorID", void 0);
291
- __decorate([
292
- consume({ context: apiHostContext, subscribe: true })
293
- ], LocationSearchMixinElement.prototype, "apiHost", void 0);
294
- __decorate([
295
- consume({ context: assetsURLContext, subscribe: true })
296
- ], LocationSearchMixinElement.prototype, "assetsURL", void 0);
297
- __decorate([
298
- consume({ context: pageDispatchContext })
299
- ], LocationSearchMixinElement.prototype, "_pageDispatch", void 0);
300
305
  __decorate([
301
306
  property({ type: String })
302
307
  ], LocationSearchMixinElement.prototype, "country", void 0);
@@ -309,6 +314,9 @@ export const LocationSearchMixin = (superClass) => {
309
314
  __decorate([
310
315
  state()
311
316
  ], LocationSearchMixinElement.prototype, "isLocationsDropdownOpen", void 0);
317
+ __decorate([
318
+ state()
319
+ ], LocationSearchMixinElement.prototype, "geolocationFailed", void 0);
312
320
  __decorate([
313
321
  state()
314
322
  ], LocationSearchMixinElement.prototype, "geolocationLatitude", void 0);
@@ -17,6 +17,13 @@ export const OverlayMixin = (superClass) => {
17
17
  this.open = false;
18
18
  this.isVisible = false;
19
19
  this._ownsScrollLock = false;
20
+ this._previouslyFocused = null;
21
+ this.handleKeyDown = (event) => {
22
+ if (event.key === "Escape" && this.open) {
23
+ event.stopPropagation();
24
+ this.handleModalClosed();
25
+ }
26
+ };
20
27
  this.isVisible = this.open;
21
28
  if (this.open) {
22
29
  scrollLock.lock();
@@ -39,6 +46,17 @@ export const OverlayMixin = (superClass) => {
39
46
  }
40
47
  }
41
48
  }
49
+ connectedCallback() {
50
+ super.connectedCallback();
51
+ this.addEventListener("keydown", this.handleKeyDown);
52
+ }
53
+ willUpdate(changedProperties) {
54
+ super.willUpdate?.(changedProperties);
55
+ if (changedProperties.has("open") && this.open) {
56
+ this._previouslyFocused = (this.getRootNode()
57
+ .activeElement ?? document.activeElement);
58
+ }
59
+ }
42
60
  updated(changedProperties) {
43
61
  if (changedProperties.has("open")) {
44
62
  if (this.open) {
@@ -46,14 +64,30 @@ export const OverlayMixin = (superClass) => {
46
64
  scrollLock.lock();
47
65
  this._ownsScrollLock = true;
48
66
  }
67
+ this.focusPanel();
49
68
  }
50
- else if (!this.isVisible && this._ownsScrollLock) {
51
- scrollLock.unlock();
52
- this._ownsScrollLock = false;
69
+ else {
70
+ if (!this.isVisible && this._ownsScrollLock) {
71
+ scrollLock.unlock();
72
+ this._ownsScrollLock = false;
73
+ }
74
+ this.restoreFocus();
53
75
  }
54
76
  }
55
77
  super.updated?.(changedProperties);
56
78
  }
79
+ /** Moves focus into the overlay panel; the host decides which element. */
80
+ focusPanel() { }
81
+ restoreFocus() {
82
+ const el = this._previouslyFocused;
83
+ this._previouslyFocused = null;
84
+ try {
85
+ el?.focus({ preventScroll: true });
86
+ }
87
+ catch {
88
+ // Element may have been removed from the DOM
89
+ }
90
+ }
57
91
  handleModalClosed() {
58
92
  if (!this.open) {
59
93
  return;
@@ -61,10 +95,12 @@ export const OverlayMixin = (superClass) => {
61
95
  fireInternalEvent(this, "modal-closed", {});
62
96
  }
63
97
  disconnectedCallback() {
98
+ this.removeEventListener("keydown", this.handleKeyDown);
64
99
  if (this._ownsScrollLock) {
65
100
  scrollLock.unlock();
66
101
  this._ownsScrollLock = false;
67
102
  }
103
+ this.restoreFocus();
68
104
  super.disconnectedCallback?.();
69
105
  }
70
106
  renderOverlay() {
@@ -5,4 +5,5 @@ export declare class OverlayMixinInterface {
5
5
  isVisible: boolean;
6
6
  renderOverlay: () => TemplateResult;
7
7
  handleModalClosed: () => void;
8
+ focusPanel(): void;
8
9
  }
@@ -15,14 +15,17 @@ export const SearchMixin = (superClass) => {
15
15
  class SearchMixinElement extends superClass {
16
16
  constructor() {
17
17
  super(...arguments);
18
- this.lastSearchTerm = "";
18
+ // Results are localised, so the same term in another locale is a new
19
+ // request, not a cache hit.
20
+ this.lastSearchKey = "";
19
21
  this.searchTask = new Task(this, {
20
22
  autoRun: false,
21
23
  task: async ([searchTerm, locale]) => {
22
- if (this.searchTask.value && this.lastSearchTerm === searchTerm) {
24
+ const searchKey = `${locale ?? ""}|${searchTerm}`;
25
+ if (this.searchTask.value && this.lastSearchKey === searchKey) {
23
26
  return this.searchTask.value;
24
27
  }
25
- this.lastSearchTerm = searchTerm;
28
+ this.lastSearchKey = searchKey;
26
29
  const { data } = await apiGet({
27
30
  client: this.client,
28
31
  distributorID: this.distributorID,
@@ -39,7 +42,7 @@ export const SearchMixin = (superClass) => {
39
42
  this.throttledSearch = debounce({ delay: 500 }, (event) => {
40
43
  const searchTerm = event.detail.value;
41
44
  if (searchTerm && searchTerm.length >= 3) {
42
- this.searchTask.run();
45
+ void this.searchTask.run();
43
46
  }
44
47
  });
45
48
  }
@@ -48,7 +51,7 @@ export const SearchMixin = (superClass) => {
48
51
  }
49
52
  }
50
53
  __decorate([
51
- consume({ context: localeContext })
54
+ consume({ context: localeContext, subscribe: true })
52
55
  ], SearchMixinElement.prototype, "locale", void 0);
53
56
  __decorate([
54
57
  consume({ context: pageDispatchContext })
@@ -10,8 +10,10 @@ export function createDiagnostics(logger, strict) {
10
10
  seen.add(code);
11
11
  logger?.warn?.(message, data);
12
12
  if (strict) {
13
+ // eslint-disable-next-line no-console -- strict mode is the one place the SDK writes to the console by design
13
14
  if (data !== undefined)
14
15
  console.warn(`[coras] ${message}`, data);
16
+ // eslint-disable-next-line no-console -- see above
15
17
  else
16
18
  console.warn(`[coras] ${message}`);
17
19
  }
@@ -1,5 +1,15 @@
1
1
  import { type PageRegistry } from "./page-registry.js";
2
2
  import type { CorasApp, CorasMountOptions, CorasPageName } from "./types.js";
3
+ /**
4
+ * Rejection reason of `ready` when `unmount()` runs before the first render
5
+ * completes (React StrictMode does this on every dev mount). It is not a
6
+ * configuration problem, so it carries its own code rather than a
7
+ * `CorasValidationError`.
8
+ */
9
+ export declare class CorasUnmountedError extends Error {
10
+ readonly code = "unmounted";
11
+ constructor();
12
+ }
3
13
  /**
4
14
  * Create a `mount` function bound to a page registry. The public `mount` uses
5
15
  * the real registry; tests inject a lightweight registry so lifecycle behavior
package/dist/sdk/mount.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { fireEvent } from "../core/events.js";
2
+ import { toLogger } from "../core/logger.js";
2
3
  import { DEFAULT_CURRENCY, DEFAULT_LOCALE } from "../views/constants.js";
3
4
  import { createDiagnostics, themeHasNoColours } from "./diagnostics.js";
4
5
  import { attachCallbackBridge, } from "./element-adapter.js";
@@ -9,6 +10,19 @@ import { safeUrl, migrateBrandConfig, } from "@coras-io/brand-tokens";
9
10
  import { ensureTokensInjected } from "../styles/tokens.js";
10
11
  import { redactValue, toPublicErrorDetail } from "./redaction.js";
11
12
  import { assertValidPage, CorasValidationError, validateConfig, validateMountOptions, validatePageParams, } from "./validation.js";
13
+ /**
14
+ * Rejection reason of `ready` when `unmount()` runs before the first render
15
+ * completes (React StrictMode does this on every dev mount). It is not a
16
+ * configuration problem, so it carries its own code rather than a
17
+ * `CorasValidationError`.
18
+ */
19
+ export class CorasUnmountedError extends Error {
20
+ constructor() {
21
+ super("The Coras embed was unmounted before it became ready.");
22
+ this.code = "unmounted";
23
+ this.name = "CorasUnmountedError";
24
+ }
25
+ }
12
26
  function isThenable(value) {
13
27
  return (typeof value === "object" &&
14
28
  value !== null &&
@@ -163,6 +177,7 @@ export function createMountWith(registry) {
163
177
  // Preview is a mount-time rendering mode, not config or a param, so it is
164
178
  // set directly on the element; pages that honor it read their own property.
165
179
  element.preview = preview;
180
+ element.logger = toLogger(options.logger);
166
181
  const paramDefaults = captureParamDefaults(element, entry);
167
182
  applyParams(element, entry, currentParams, paramDefaults);
168
183
  // Chrome is rebuilt per page rather than moved: the navbar/footer consume
@@ -174,6 +189,10 @@ export function createMountWith(registry) {
174
189
  for (const chromeElement of chrome) {
175
190
  element.appendChild(chromeElement);
176
191
  }
192
+ // Unnamed, so the layout's default slot places it where a page would go.
193
+ if (options.content && targetPage === "chrome-only") {
194
+ element.appendChild(options.content);
195
+ }
177
196
  if (pageElement && pageElement.parentNode === root) {
178
197
  root.removeChild(pageElement);
179
198
  }
@@ -416,7 +435,7 @@ export function createMountWith(registry) {
416
435
  pageElement = null;
417
436
  if (!readySettled) {
418
437
  readySettled = true;
419
- rejectReady(new CorasValidationError("invalid_config", "The Coras embed was unmounted before it became ready."));
438
+ rejectReady(new CorasUnmountedError());
420
439
  }
421
440
  },
422
441
  };
@@ -39,6 +39,11 @@ export const defaultPageRegistry = {
39
39
  load: once(() => import("../views/suggestion-widget/suggestion-widget.js")),
40
40
  paramToProperty: identity("limit", "showExploreCard", "country", "city"),
41
41
  },
42
+ "chrome-only": {
43
+ tagName: "coras-chrome-only-page",
44
+ load: once(() => import("../views/chrome-only-page/chrome-only-page.js")),
45
+ paramToProperty: {},
46
+ },
42
47
  };
43
48
  /** Element properties driven by an optional config field, in config -> property form. */
44
49
  const OPTIONAL_CONFIG_PROPERTIES = [
@@ -0,0 +1,53 @@
1
+ import type { SupportedCurrencies } from "../core/types/core/currency.js";
2
+ import type { SupportedLocales } from "../core/types/core/locale.js";
3
+ import type { CorasPageName } from "./types.js";
4
+ /**
5
+ * Page names, param rules and locale/currency normalisation shared by
6
+ * `validation.ts` and `url.ts`. This module must stay free of brand-tokens (and
7
+ * any other heavy dependency): the `./url` entry runs in host routers on every
8
+ * navigation and ships only what it imports.
9
+ */
10
+ export type CorasValidationErrorCode = "missing_container" | "invalid_page" | "invalid_config" | "invalid_url" | "invalid_locale" | "invalid_currency" | "invalid_color_scheme" | "invalid_theme" | "invalid_page_params" | "unknown_key";
11
+ /**
12
+ * A typed, redacted validation error thrown for invalid host input before any
13
+ * element is rendered or updated. Messages are safe to surface to the host.
14
+ */
15
+ export declare class CorasValidationError extends Error {
16
+ readonly code: CorasValidationErrorCode;
17
+ readonly field?: string;
18
+ constructor(code: CorasValidationErrorCode, message: string, field?: string);
19
+ }
20
+ export declare const PUBLIC_PAGES: readonly CorasPageName[];
21
+ /**
22
+ * Reject a page name outside the public set with a typed error. Shared by mount,
23
+ * update, navigate and prefetch so every entry point fails the same way - and
24
+ * before any state is mutated - instead of indexing the registry with an unknown
25
+ * page and throwing a bare TypeError.
26
+ */
27
+ export declare function assertValidPage(page: unknown): asserts page is CorasPageName;
28
+ /** Allowed param keys per page (public names). */
29
+ export declare const PAGE_PARAM_KEYS: Record<CorasPageName, readonly string[]>;
30
+ type ParamKind = "string" | "date" | "number" | "boolean" | "metadata";
31
+ /**
32
+ * The value type of every public page param. Param names mean the same thing on
33
+ * every page that accepts them, so one flat table drives both `mount()`
34
+ * validation and the URL helpers' decoding.
35
+ */
36
+ export declare const PAGE_PARAM_KINDS: Readonly<Record<string, ParamKind>>;
37
+ /** Normalize locale casing/separators (e.g. `en_ie`, `EN-IE` -> `en-IE`). */
38
+ export declare function normalizeLocale(value: string): SupportedLocales | undefined;
39
+ /** Normalize currency casing (e.g. `eur` -> `EUR`). */
40
+ export declare function normalizeCurrency(value: string): SupportedCurrencies | undefined;
41
+ /**
42
+ * Type-check one page param. Shared by `validatePageParams` and the URL parser
43
+ * so a value that leaves the parser is always one `mount()` accepts.
44
+ */
45
+ export declare function assertParamKind(page: CorasPageName, key: string, value: unknown): void;
46
+ /**
47
+ * Coerce a raw query-string value to the type `mount()` expects for `key`, or
48
+ * return `undefined` when no valid value can be made of it. The URL parser
49
+ * drops such values so a hand-edited or stale link degrades to the page's
50
+ * default instead of rejecting the whole mount.
51
+ */
52
+ export declare function coerceParamValue(key: string, raw: string): unknown;
53
+ export {};
@@ -0,0 +1,180 @@
1
+ import { supportedCurrencies } from "../core/currency/constants.js";
2
+ import { allLocales } from "../core/i18n/locale-codes.js";
3
+ /**
4
+ * A typed, redacted validation error thrown for invalid host input before any
5
+ * element is rendered or updated. Messages are safe to surface to the host.
6
+ */
7
+ export class CorasValidationError extends Error {
8
+ constructor(code, message, field) {
9
+ super(message);
10
+ this.name = "CorasValidationError";
11
+ this.code = code;
12
+ this.field = field;
13
+ }
14
+ }
15
+ export const PUBLIC_PAGES = [
16
+ "landing",
17
+ "search",
18
+ "details",
19
+ "payment",
20
+ "help",
21
+ "suggestion-widget",
22
+ "chrome-only",
23
+ ];
24
+ /**
25
+ * Reject a page name outside the public set with a typed error. Shared by mount,
26
+ * update, navigate and prefetch so every entry point fails the same way - and
27
+ * before any state is mutated - instead of indexing the registry with an unknown
28
+ * page and throwing a bare TypeError.
29
+ */
30
+ export function assertValidPage(page) {
31
+ if (!PUBLIC_PAGES.includes(page)) {
32
+ throw new CorasValidationError("invalid_page", `Unknown page "${String(page)}". Valid pages: ${PUBLIC_PAGES.join(", ")}.`, "page");
33
+ }
34
+ }
35
+ /** Allowed param keys per page (public names). */
36
+ export const PAGE_PARAM_KEYS = {
37
+ landing: [
38
+ "country",
39
+ "city",
40
+ "startDate",
41
+ "endDate",
42
+ "sort",
43
+ "duration",
44
+ "price",
45
+ "categories",
46
+ ],
47
+ search: ["search", "startDate"],
48
+ details: ["id", "date"],
49
+ payment: ["metadata"],
50
+ help: ["content"],
51
+ "suggestion-widget": ["limit", "showExploreCard", "country", "city"],
52
+ "chrome-only": [],
53
+ };
54
+ /**
55
+ * The value type of every public page param. Param names mean the same thing on
56
+ * every page that accepts them, so one flat table drives both `mount()`
57
+ * validation and the URL helpers' decoding.
58
+ */
59
+ export const PAGE_PARAM_KINDS = {
60
+ country: "string",
61
+ city: "string",
62
+ startDate: "date",
63
+ endDate: "date",
64
+ date: "date",
65
+ sort: "string",
66
+ duration: "string",
67
+ price: "string",
68
+ categories: "string",
69
+ search: "string",
70
+ id: "string",
71
+ content: "string",
72
+ metadata: "metadata",
73
+ limit: "number",
74
+ showExploreCard: "boolean",
75
+ };
76
+ /** Dates cross the API as plain `yyyy-MM-dd` calendar days. */
77
+ const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
78
+ /** Upper bound for the suggestion widget's `limit`, guarding absurd requests. */
79
+ const MAX_WIDGET_LIMIT = 50;
80
+ const localeSet = new Set(allLocales);
81
+ const currencySet = new Set(supportedCurrencies);
82
+ /** Normalize locale casing/separators (e.g. `en_ie`, `EN-IE` -> `en-IE`). */
83
+ export function normalizeLocale(value) {
84
+ // Guard the type here rather than at each call site: JavaScript hosts reach
85
+ // this with arbitrary values, and an unsupported one is `undefined` (which
86
+ // callers turn into a typed error) rather than a raw TypeError from `.trim`.
87
+ if (typeof value !== "string")
88
+ return undefined;
89
+ const parts = value.trim().replace(/_/g, "-").split("-");
90
+ if (parts.length === 0 || !parts[0])
91
+ return undefined;
92
+ const language = parts[0].toLowerCase();
93
+ const region = parts[1]?.toUpperCase();
94
+ const canonical = region ? `${language}-${region}` : language;
95
+ return localeSet.has(canonical) ? canonical : undefined;
96
+ }
97
+ /** Normalize currency casing (e.g. `eur` -> `EUR`). */
98
+ export function normalizeCurrency(value) {
99
+ if (typeof value !== "string")
100
+ return undefined;
101
+ const canonical = value.trim().toUpperCase();
102
+ return currencySet.has(canonical)
103
+ ? canonical
104
+ : undefined;
105
+ }
106
+ /**
107
+ * Type-check one page param. Shared by `validatePageParams` and the URL parser
108
+ * so a value that leaves the parser is always one `mount()` accepts.
109
+ */
110
+ export function assertParamKind(page, key, value) {
111
+ const expected = describeInvalidParam(key, value);
112
+ if (expected) {
113
+ throw new CorasValidationError("invalid_page_params", `params.${key} for page "${page}" must be ${expected}.`, `params.${key}`);
114
+ }
115
+ }
116
+ /**
117
+ * Coerce a raw query-string value to the type `mount()` expects for `key`, or
118
+ * return `undefined` when no valid value can be made of it. The URL parser
119
+ * drops such values so a hand-edited or stale link degrades to the page's
120
+ * default instead of rejecting the whole mount.
121
+ */
122
+ export function coerceParamValue(key, raw) {
123
+ let value = raw;
124
+ switch (PAGE_PARAM_KINDS[key] ?? "string") {
125
+ case "number":
126
+ value = raw.trim() === "" ? Number.NaN : Number(raw);
127
+ break;
128
+ case "boolean":
129
+ if (raw === "true")
130
+ value = true;
131
+ else if (raw === "false")
132
+ value = false;
133
+ break;
134
+ case "metadata":
135
+ // Host context, never URL state: nothing to coerce from a string.
136
+ return undefined;
137
+ }
138
+ return describeInvalidParam(key, value) ? undefined : value;
139
+ }
140
+ /** The expected shape of `key` when `value` does not satisfy it, else `undefined`. */
141
+ function describeInvalidParam(key, value) {
142
+ switch (PAGE_PARAM_KINDS[key] ?? "string") {
143
+ case "number":
144
+ if (typeof value !== "number" || !Number.isFinite(value))
145
+ return "a number";
146
+ break;
147
+ case "boolean":
148
+ if (typeof value !== "boolean")
149
+ return "a boolean";
150
+ break;
151
+ case "date":
152
+ // Pages clear a date by emitting `""` (see the landing page's date reset),
153
+ // which means the same as omitting the param: reset it to its default.
154
+ if (typeof value !== "string" || (value !== "" && !ISO_DATE.test(value)))
155
+ return "a yyyy-MM-dd date";
156
+ break;
157
+ case "metadata": {
158
+ // A free-form bag of client data; its keys are arbitrary, but every value
159
+ // must be a string so it can be serialized for the API forward.
160
+ const isPlainObject = typeof value === "object" && !Array.isArray(value);
161
+ if (!isPlainObject ||
162
+ !Object.values(value).every((v) => typeof v === "string"))
163
+ return "an object of string values";
164
+ break;
165
+ }
166
+ default:
167
+ if (typeof value !== "string")
168
+ return "a string";
169
+ break;
170
+ }
171
+ // `id` is the public identifier and additionally carries the details route.
172
+ if (key === "id" && value.length === 0)
173
+ return "a non-empty string";
174
+ if (key === "limit" &&
175
+ (!Number.isInteger(value) ||
176
+ value <= 0 ||
177
+ value > MAX_WIDGET_LIMIT))
178
+ return `a whole number between 1 and ${MAX_WIDGET_LIMIT}`;
179
+ return undefined;
180
+ }
@@ -1,8 +1,5 @@
1
1
  import type { CorasPageName, CorasErrorDetail } from "./types.js";
2
- /** Mask sensitive substrings inside a string. */
3
- export declare function redactString(value: string): string;
4
- /** Recursively redact string values inside a JSON-ish structure. */
5
- export declare function redactValue(value: unknown): unknown;
2
+ export { redactString, redactValue } from "../core/utils/redaction.js";
6
3
  /**
7
4
  * Convert any thrown value into a safe, redacted public error. Validation
8
5
  * errors keep their stable code and (redacted) message; everything else is