@coras-io/embed 0.5.1 → 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 +28 -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 +8 -145
  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
@@ -4,6 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ import { getLoyaltyAmount } from "../../core/utils/loyalty.js";
7
8
  import { LitElement, html, nothing, } from "lit";
8
9
  import { state, property } from "lit/decorators.js";
9
10
  import { Task, TaskStatus } from "@lit/task";
@@ -12,11 +13,9 @@ import { classMap } from "lit/directives/class-map.js";
12
13
  import { fireEvent } from "../../core/events.js";
13
14
  import { map } from "lit/directives/map.js";
14
15
  import { consume } from "@lit/context";
15
- import { SignalWatcher } from "@lit-labs/signals";
16
- import { isBasketDropdownOpen, isBasketMobileOpen, } from "../../core/signals.js";
17
- import { formatISO, getDate, isAfter, isBefore, parseISO } from "date-fns";
16
+ import { formatISO, getDate, parseISO } from "date-fns";
18
17
  import { capitalize } from "../../core/utils/text.js";
19
- import { apiGet, apiPost, withErrorHandling } from "../../core/api/queries.js";
18
+ import { apiGet, apiPost } from "../../core/api/queries.js";
20
19
  import "../../components/button/button.js";
21
20
  import "../../components/attraction-header/attraction-header.js";
22
21
  import "../../components/image-chip/image-chip.js";
@@ -49,14 +48,17 @@ import "../../components/breadcrumbs/breadcrumbs.js";
49
48
  import "../../components/breadcrumbs/breadcrumb-item/breadcrumb-item.js";
50
49
  import "./partials/theater-description/theater-description.js";
51
50
  import "./partials/tour-description/tour-description.js";
51
+ import "./partials/location-highlights/location-highlights.js";
52
+ import "./partials/location-categories/location-categories.js";
52
53
  import { PointsMixin } from "../../mixins/points/points.js";
53
54
  import styles from "./details-page.styles.js";
54
55
  import { BaseMixin } from "../../mixins/base.mixin.js";
55
56
  import { ErrorModalMixin } from "../../mixins/error-modal.mixin.js";
56
57
  import { currentPageContext } from "../../contexts/current-page.context.js";
57
58
  import { convertToLocaleCurrency } from "../../core/currency/index.js";
58
- import { calculateTotalPrice, formatDateWithTimezone, formatTicketDetails, getAvailabilityDays, getAvailabilitySummary, getCurrentMonth, getTicketsAmount, getTicketSelectorLabel, getTotalTicketsCount, groupAvailabilityByTime, isSingleDayAvailability, scrollToTop, sortTimes, sumPricesAndFormat, } from "./details-page.utilts.js";
59
- import { formatDateTimeForDisplay, formatTimeForDisplay, } from "../../core/utils/datetime.js";
59
+ import { calculateTotalPrice, formatDateWithTimezone, formatTicketDetails, getAvailabilityDays, getAvailabilityRequestKey, getAvailabilitySummary, getBookingSessionExpiry, getCurrentMonth, getTicketsAmount, getTicketSelectorLabel, getTotalTicketsCount, groupAvailabilityByTime, isSingleDayAvailability, resolveAttractionLocation, scrollToTop, sumPricesAndFormat, } from "./details-page.utilts.js";
60
+ import { formatDateTimeForDisplay } from "../../core/utils/datetime.js";
61
+ import { APIError } from "../../core/api/api-error.js";
60
62
  import { getBookingSession, storeBookingSession, } from "../../core/api/middlewares/booking-session/booking-session.utils.js";
61
63
  import { BOOKING_SESSION_EXPIRES_HEADER } from "../../core/api/middlewares/booking-session/booking-session.constants.js";
62
64
  import { formatDate } from "../../core/i18n/date.js";
@@ -66,6 +68,7 @@ import { addRecentlySelectedSearches } from "../../containers/navbar/navbar.util
66
68
  import { filterMediaForGallery } from "../../core/images/filters.js";
67
69
  import { readSeatsIoConfig } from "../../core/types/seats-config.js";
68
70
  import { getApiLanguageCode } from "../../core/utils/locale.js";
71
+ import { safeUrl } from "@coras-io/brand-tokens";
69
72
  const IMAGE_CAROUSEL_WIDTH = 480;
70
73
  const IMAGE_CAROUSEL_HEIGHT = 320;
71
74
  /**
@@ -73,7 +76,7 @@ const IMAGE_CAROUSEL_HEIGHT = 320;
73
76
  * @fires coras:state-change
74
77
  * @fires coras:reservation-created
75
78
  */
76
- let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixin(BaseMixin(SignalWatcher(LitElement)))) {
79
+ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixin(BaseMixin(LitElement))) {
77
80
  constructor() {
78
81
  super(...arguments);
79
82
  this.attractionId = "";
@@ -87,12 +90,18 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
87
90
  this.shouldRenderOptions = false;
88
91
  this.isBasketModalOpened = false;
89
92
  this.selectedTimeOptions = {};
93
+ // Both derived from the attraction in willUpdate.
90
94
  this.isSingleDayAvailability = false;
91
95
  this.availabilityDays = [];
92
96
  this.isReservationPreviewModalOpened = false;
93
97
  this.selectedSectionId = undefined;
94
98
  this.selectedTime = null;
95
99
  this.hasAvailabilityError = false;
100
+ // The date and ticket mix the last availability run asked for. Options are
101
+ // rendered only while the current selection still matches it, so a date or
102
+ // ticket change made by the host, or while a check is in flight, cannot
103
+ // reserve against the previous response.
104
+ this.availabilityRequestKey = null;
96
105
  this.loadingSelectionIds = new Set();
97
106
  this.seatsFallback = false;
98
107
  this.configTask = new Task(this, {
@@ -100,39 +109,58 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
100
109
  if (!client) {
101
110
  return null;
102
111
  }
103
- const { data } = await withErrorHandling(apiGet({
112
+ const { data } = await apiGet({
104
113
  client,
105
114
  distributorID,
106
115
  locale,
107
116
  endpoint: "/{api_version}/config",
108
- }));
117
+ });
109
118
  return readSeatsIoConfig(data);
110
119
  },
111
120
  args: () => [this.client, this.locale, this.distributorID],
112
121
  });
113
- this.verifyDate = (firstInstanceDay, lastInstanceDay, timezone) => {
122
+ this.verifyDate = (firstInstanceDate, lastInstanceDate, timezone) => {
114
123
  if (!this.date) {
115
- this.updateDateParam({ date: firstInstanceDay, timezone });
124
+ this.updateDateParam({ date: firstInstanceDate, timezone });
125
+ return;
116
126
  }
117
- if (this.date &&
118
- (isBefore(parseISO(this.date), parseISO(firstInstanceDay)) ||
119
- isAfter(parseISO(this.date), parseISO(lastInstanceDay)))) {
120
- this.updateDateParam({ date: firstInstanceDay, timezone });
127
+ // `date` is a calendar day while the instance dates are instants, so both
128
+ // are compared as the venue's calendar day. Comparing the day with the
129
+ // instant re-dispatched the same date on every load and could move a
130
+ // valid date when the first instance starts near midnight.
131
+ const toVenueDay = (dateString) => formatDateWithTimezone({
132
+ dateString,
133
+ timezone,
134
+ locale: this.locale,
135
+ formatString: "yyyy-MM-dd",
136
+ });
137
+ if (this.date < toVenueDay(firstInstanceDate) ||
138
+ this.date > toVenueDay(lastInstanceDate)) {
139
+ this.updateDateParam({ date: firstInstanceDate, timezone });
121
140
  }
122
141
  };
123
- this.checkDateAvailability = (firstInstanceDay, timezone) => {
142
+ this.checkDateAvailability = (data) => {
143
+ const firstInstanceDay = data.first_instance_date;
144
+ const timezone = data.attraction.timezone;
124
145
  if (!this.date) {
125
146
  this.updateDateParam({ date: firstInstanceDay, timezone });
126
147
  return;
127
148
  }
149
+ // Validate against the month the date is in, not the month the visitor
150
+ // has paged the calendar to.
151
+ const availabilityDays = getAvailabilityDays({
152
+ timezone,
153
+ salePeriods: data.attraction.sale_periods ?? null,
154
+ targetMonth: getCurrentMonth(this.date),
155
+ });
128
156
  const dayOfMonth = String(getDate(parseISO(this.date)));
129
- if (!this.availabilityDays.includes(dayOfMonth)) {
157
+ if (!availabilityDays.includes(dayOfMonth)) {
130
158
  this.updateDateParam({ date: firstInstanceDay, timezone });
131
159
  }
132
160
  };
133
161
  this.attractionTask = new Task(this, {
134
- task: async ([locale, currency, attractionId]) => {
135
- const result = await withErrorHandling(apiGet({
162
+ task: async ([locale, currency, attractionId], { signal }) => {
163
+ const { data } = await apiGet({
136
164
  client: this.client,
137
165
  distributorID: this.distributorID,
138
166
  locale: locale,
@@ -144,36 +172,31 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
144
172
  currency: currency,
145
173
  size: 0,
146
174
  },
147
- }));
148
- // A failed or empty response has no attraction to render. Returning an
149
- // empty object here would complete the task, so every render branch below
150
- // would dereference `attraction` on it and throw. Fail the task instead so
151
- // the error modal is shown.
152
- if (!result.data) {
175
+ });
176
+ // An empty response has no attraction to render. Returning an empty
177
+ // object here would complete the task, so every render branch below
178
+ // would dereference `attraction` on it and throw. Fail the task instead
179
+ // so the error modal is shown.
180
+ if (!data) {
153
181
  throw new Error("Attraction data not available");
154
182
  }
155
- this.verifyDate(result.data.first_instance_date, result.data.last_instance_date, result.data.attraction.timezone);
156
- this.isSingleDayAvailability = isSingleDayAvailability(result.data.attraction.sale_periods ?? null);
157
- this.availabilityDays = getAvailabilityDays({
158
- timezone: result.data.attraction.timezone,
159
- salePeriods: result.data.attraction.sale_periods ?? null,
160
- targetMonth: getCurrentMonth(this.date ||
161
- formatDateWithTimezone({
162
- dateString: result.data.first_instance_date,
163
- timezone: result.data.attraction.timezone,
164
- formatString: "yyyy-MM-dd",
165
- }), this.currentMonth),
166
- });
167
- this.checkDateAvailability(result.data.first_instance_date, result.data.attraction.timezone);
183
+ // A superseded run (the visitor moved to another attraction while this
184
+ // one was in flight) must not correct the page date or record a recent
185
+ // search for the attraction that is no longer shown.
186
+ if (signal.aborted) {
187
+ return data;
188
+ }
189
+ this.verifyDate(data.first_instance_date, data.last_instance_date, data.attraction.timezone);
190
+ this.checkDateAvailability(data);
168
191
  try {
169
192
  addRecentlySelectedSearches({
170
193
  type: "attraction",
171
194
  value: attractionId,
172
- name: result.data.attraction.attraction_name,
195
+ name: data.attraction.attraction_name,
173
196
  });
174
197
  }
175
198
  catch { }
176
- return result.data;
199
+ return data;
177
200
  },
178
201
  args: () => [this.locale, this.currency, this.attractionId],
179
202
  });
@@ -184,7 +207,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
184
207
  if (bookingSession) {
185
208
  return bookingSession;
186
209
  }
187
- const { data, response } = await withErrorHandling(apiPost({
210
+ const { data, response } = await apiPost({
188
211
  client: this.client,
189
212
  distributorID: this.distributorID,
190
213
  locale: this.locale,
@@ -195,31 +218,10 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
195
218
  analytics_id: null,
196
219
  distributor_session_id: null,
197
220
  },
198
- }));
221
+ });
199
222
  if (data && data["booking-session"]) {
200
223
  const newBookingSession = data["booking-session"];
201
- const expiresHeader = response?.headers.get(BOOKING_SESSION_EXPIRES_HEADER);
202
- if (expiresHeader) {
203
- try {
204
- const expirationDate = new Date(expiresHeader);
205
- if (!isNaN(expirationDate.getTime())) {
206
- storeBookingSession(this.distributorID, newBookingSession, expirationDate);
207
- }
208
- else {
209
- const defaultExpiration = new Date(Date.now() + 20 * 60 * 1000);
210
- storeBookingSession(this.distributorID, newBookingSession, defaultExpiration);
211
- }
212
- }
213
- catch (error) {
214
- console.warn("Failed to parse booking session expiration date:", error);
215
- const defaultExpiration = new Date(Date.now() + 20 * 60 * 1000);
216
- storeBookingSession(this.distributorID, newBookingSession, defaultExpiration);
217
- }
218
- }
219
- else {
220
- const defaultExpiration = new Date(Date.now() + 20 * 60 * 1000);
221
- storeBookingSession(this.distributorID, newBookingSession, defaultExpiration);
222
- }
224
+ storeBookingSession(this.distributorID, newBookingSession, getBookingSessionExpiry(response.headers.get(BOOKING_SESSION_EXPIRES_HEADER)));
223
225
  return newBookingSession;
224
226
  }
225
227
  return undefined;
@@ -230,44 +232,54 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
230
232
  task: async () => {
231
233
  const bookingSession = this.bookingSessionTask.value;
232
234
  if (!bookingSession) {
235
+ this.hasAvailabilityError = true;
233
236
  throw new Error("Booking session not available");
234
237
  }
235
238
  const apiResponse = this.attractionTask.value;
236
239
  if (!apiResponse) {
240
+ this.hasAvailabilityError = true;
237
241
  throw new Error("Attraction data not available");
238
242
  }
239
- const result = await withErrorHandling(apiPost({
240
- client: this.client,
241
- distributorID: this.distributorID,
242
- locale: this.locale,
243
- endpoint: "/{api_version}/availability/check",
244
- bookingSession,
245
- body: {
246
- currency: this.currency,
247
- language_code: getApiLanguageCode(this.locale),
248
- attraction_id: this.attractionId,
249
- date: this.resolvedDate,
250
- tickets: Object.entries(this.selectedPriceTypes).map(([key, value]) => ({
251
- price_type_id: key,
252
- number_of_tickets: value,
253
- })),
254
- },
255
- }));
256
- if (result.error) {
243
+ const date = this.resolvedDate;
244
+ const selectedPriceTypes = this.selectedPriceTypes;
245
+ this.availabilityRequestKey = getAvailabilityRequestKey(date, selectedPriceTypes);
246
+ let data;
247
+ try {
248
+ ({ data } = await apiPost({
249
+ client: this.client,
250
+ distributorID: this.distributorID,
251
+ locale: this.locale,
252
+ endpoint: "/{api_version}/availability/check",
253
+ bookingSession,
254
+ body: {
255
+ currency: this.currency,
256
+ language_code: getApiLanguageCode(this.locale),
257
+ attraction_id: this.attractionId,
258
+ date,
259
+ tickets: Object.entries(selectedPriceTypes).map(([key, value]) => ({
260
+ price_type_id: key,
261
+ number_of_tickets: value,
262
+ })),
263
+ },
264
+ }));
265
+ }
266
+ catch (error) {
267
+ // The availability alert is the error UI; the failed task only
268
+ // carries the API error code for the options area.
257
269
  this.hasAvailabilityError = true;
270
+ throw error;
258
271
  }
259
- if (!result.data) {
272
+ if (!data) {
260
273
  this.hasAvailabilityError = true;
261
274
  return [];
262
275
  }
263
- if (result.data.length === 0 ||
264
- result.data.filter((availability) => availability.available).length ===
265
- 0) {
276
+ if (data.length === 0 ||
277
+ data.filter((availability) => availability.available).length === 0) {
266
278
  this.hasAvailabilityError = true;
267
279
  }
268
- const availableItems = result.data.filter((item) => item.available) || [];
269
- const sortedTimes = sortTimes(Array.from(groupAvailabilityByTime(availableItems, this.locale).keys()));
270
- this.selectedTime = sortedTimes[0] ?? null;
280
+ const availableItems = data.filter((item) => item.available) || [];
281
+ const [firstTime] = groupAvailabilityByTime(availableItems, this.locale).keys();
282
+ this.selectedTime = firstTime ?? null;
271
283
  availableItems.forEach((item) => {
272
284
  if (item.selection_id) {
273
285
  const languageEntries = Object.entries(item.languages_spoken || {});
@@ -277,13 +289,9 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
277
289
  const defaultLanguage = matchingLanguage
278
290
  ? matchingLanguage[0]
279
291
  : languageEntries[0]?.[0];
280
- const defaultTime = item.start_datetime;
281
292
  this.selectedTimeOptions = {
282
293
  ...this.selectedTimeOptions,
283
- [item.selection_id]: {
284
- language: defaultLanguage,
285
- time: defaultTime,
286
- },
294
+ [item.selection_id]: { language: defaultLanguage },
287
295
  };
288
296
  }
289
297
  }
@@ -315,31 +323,34 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
315
323
  instance_id: null,
316
324
  tickets: this.buildSectionTickets(selection_id),
317
325
  };
318
- const result = await withErrorHandling(apiPost({
319
- client: this.client,
320
- distributorID: this.distributorID,
321
- locale: this.locale,
322
- endpoint: "/{api_version}/reservations",
323
- bookingSession,
324
- body: {
325
- attraction_id: this.attractionId,
326
- currency: this.currency,
327
- date: this.resolvedDate,
328
- language_code: getApiLanguageCode(this.locale),
329
- tour_language: language,
330
- to_basket: true,
331
- pickup_id: null,
332
- pickup_entry: null,
333
- content_indexed_at: null,
334
- ...reservationFields,
335
- },
336
- }));
337
- if (result.error) {
326
+ let data;
327
+ try {
328
+ ({ data } = await apiPost({
329
+ client: this.client,
330
+ distributorID: this.distributorID,
331
+ locale: this.locale,
332
+ endpoint: "/{api_version}/reservations",
333
+ bookingSession,
334
+ body: {
335
+ attraction_id: this.attractionId,
336
+ currency: this.currency,
337
+ date: this.resolvedDate,
338
+ language_code: getApiLanguageCode(this.locale),
339
+ tour_language: language,
340
+ to_basket: true,
341
+ pickup_id: null,
342
+ pickup_entry: null,
343
+ content_indexed_at: null,
344
+ ...reservationFields,
345
+ },
346
+ }));
347
+ }
348
+ catch (error) {
338
349
  this.hasAvailabilityError = true;
339
- return {};
350
+ throw error;
340
351
  }
341
- if (result.data) {
342
- const reservation = result.data;
352
+ if (data) {
353
+ const reservation = data;
343
354
  fireEvent(this, "coras:reservation-created", {
344
355
  ...(reservation.reservation_id != null
345
356
  ? { reservationId: reservation.reservation_id }
@@ -352,21 +363,13 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
352
363
  : {}),
353
364
  });
354
365
  }
355
- return result.data || {};
366
+ return data || {};
356
367
  },
357
368
  args: (language = "", selection_id = "", seated = null) => [language, selection_id, seated],
358
369
  });
359
370
  this.setCurrentMonth = (event) => {
360
371
  event.stopPropagation();
361
372
  this.currentMonth = event.detail.date;
362
- const apiResponse = this.attractionTask.value;
363
- if (apiResponse) {
364
- this.availabilityDays = getAvailabilityDays({
365
- timezone: apiResponse.attraction.timezone,
366
- salePeriods: apiResponse.attraction.sale_periods ?? null,
367
- targetMonth: this.currentMonth,
368
- });
369
- }
370
373
  };
371
374
  this.changeTicketNumberBy = (id, count, maxAmount) => {
372
375
  const currentValue = getTicketsAmount(id, this.selectedPriceTypes, maxAmount);
@@ -379,11 +382,11 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
379
382
  ...this.selectedPriceTypes,
380
383
  [id]: newValue,
381
384
  }).filter(([_key, value]) => value !== 0));
382
- this.hasAvailabilityError = false;
385
+ this.clearAvailabilitySelection();
383
386
  };
384
387
  this.handleDateSelected = (event) => {
385
388
  event.stopPropagation();
386
- this.hasAvailabilityError = false;
389
+ this.clearAvailabilitySelection();
387
390
  this.updateDateParam({ date: event.detail.date });
388
391
  this.toggleCalendarDropdown();
389
392
  };
@@ -463,9 +466,9 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
463
466
  if (!loyalty) {
464
467
  return nothing;
465
468
  }
466
- const earnAmount = Object.values(loyalty.earn)[0];
467
- const payAmount = Object.values(loyalty.pay)[0];
468
- if (!earnAmount || !payAmount) {
469
+ const earnAmount = getLoyaltyAmount(loyalty, "earn");
470
+ const payAmount = getLoyaltyAmount(loyalty, "pay");
471
+ if (earnAmount <= 0 || payAmount <= 0) {
469
472
  return nothing;
470
473
  }
471
474
  return html `
@@ -556,13 +559,6 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
556
559
  }
557
560
  if (apiResponse.attraction_type === "TOUR") {
558
561
  const response = apiResponse;
559
- const priceTypes = response.price_types ?? [];
560
- if (priceTypes.length > 0 &&
561
- Object.keys(this.selectedPriceTypes).length === 0) {
562
- const firstPriceTypeId = priceTypes[0].price_type_id;
563
- const maxBookingSize = response.attraction.max_booking_size;
564
- this.changeTicketNumberBy(firstPriceTypeId, 1, maxBookingSize);
565
- }
566
562
  return html `
567
563
  <coras-tour-ticket-type-selector
568
564
  assets-url="${this.assetsURL}"
@@ -575,13 +571,6 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
575
571
  }
576
572
  if (apiResponse.attraction_type === "THEATER") {
577
573
  const response = apiResponse;
578
- const priceTypes = response.price_types ?? [];
579
- if (priceTypes.length > 0 &&
580
- Object.keys(this.selectedPriceTypes).length === 0) {
581
- const firstPriceTypeId = priceTypes[0].price_type_id;
582
- const maxBookingSize = response.attraction.max_tickets_per_order;
583
- this.changeTicketNumberBy(firstPriceTypeId, 1, maxBookingSize);
584
- }
585
574
  return html `
586
575
  <coras-tour-ticket-type-selector
587
576
  assets-url="${this.assetsURL}"
@@ -615,7 +604,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
615
604
  assets-url="${this.assetsURL}"
616
605
  slot="prefix"
617
606
  icon="calendar"
618
- label="calendar"
607
+ label=${msg("Calendar")}
619
608
  ></coras-icon>
620
609
  <span>${formatDate(date, this.locale, true)}</span>
621
610
  </coras-button>
@@ -642,7 +631,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
642
631
  assets-url="${this.assetsURL}"
643
632
  slot="prefix"
644
633
  icon="calendar"
645
- label="calendar"
634
+ label=${msg("Calendar")}
646
635
  ></coras-icon>
647
636
  <coras-icon
648
637
  assets-url="${this.assetsURL}"
@@ -661,11 +650,13 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
661
650
  min-date=${formatDateWithTimezone({
662
651
  dateString: apiResponse.first_instance_date,
663
652
  timezone: apiResponse.attraction.timezone,
653
+ locale: this.locale,
664
654
  formatString: "yyyy-MM",
665
655
  })}
666
656
  max-date=${formatDateWithTimezone({
667
657
  dateString: apiResponse.last_instance_date,
668
658
  timezone: apiResponse.attraction.timezone,
659
+ locale: this.locale,
669
660
  formatString: "yyyy-MM",
670
661
  })}
671
662
  .selectedDates=${[date]}
@@ -742,14 +733,10 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
742
733
  </coras-dialog>
743
734
  `;
744
735
  };
745
- this.handleTimeOptionChipClicked = (id, value, type) => {
746
- const currentOptions = this.selectedTimeOptions[id] || {};
736
+ this.handleLanguageChipClicked = (id, language) => {
747
737
  this.selectedTimeOptions = {
748
738
  ...this.selectedTimeOptions,
749
- [id]: {
750
- ...currentOptions,
751
- [type]: value,
752
- },
739
+ [id]: { language },
753
740
  };
754
741
  };
755
742
  this.renderTourOptionChips = ({ selectionId, languagesSpoken, }) => {
@@ -759,35 +746,15 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
759
746
  return html `
760
747
  <coras-option-chip
761
748
  ?selected=${isSelected}
762
- @click=${() => this.handleTimeOptionChipClicked(selectionId, key, "language")}
749
+ @click=${() => this.handleLanguageChipClicked(selectionId, key)}
763
750
  >
764
751
  ${label}
765
752
  </coras-option-chip>
766
753
  `;
767
754
  })}`;
768
755
  };
769
- this.renderTimeOptionChips = ({ selectionId, startDatetime, timezone, }) => {
770
- if (!startDatetime) {
771
- return nothing;
772
- }
773
- const formattedTime = formatTimeForDisplay({
774
- dateTime: startDatetime,
775
- timezone,
776
- locale: this.locale,
777
- });
778
- const isSelected = this.selectedTimeOptions[selectionId]?.time === startDatetime;
779
- return html `
780
- <coras-option-chip
781
- ?selected=${isSelected}
782
- @click=${() => this.handleTimeOptionChipClicked(selectionId, startDatetime, "time")}
783
- >
784
- ${formattedTime}
785
- </coras-option-chip>
786
- `;
787
- };
788
756
  this.renderTourOptions = (items) => {
789
757
  return html `${map(items, ({ name, languages_spoken, selection_id, prices, start_datetime, timezone, max_full_price, }) => {
790
- const hasOnlyOneTimeOption = true;
791
758
  const hasMultipleLanguages = Object.keys(languages_spoken || {}).length > 1;
792
759
  return html `
793
760
  <coras-attraction-option
@@ -802,27 +769,15 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
802
769
  locale: this.locale,
803
770
  currency: this.currency,
804
771
  })}
805
- ?show-time-options=${!hasOnlyOneTimeOption}
806
772
  ?show-language-options=${hasMultipleLanguages}
807
773
  >
808
- ${hasOnlyOneTimeOption
809
- ? html `<coras-time-tag
810
- slot="badge"
811
- assets-url="${this.assetsURL}"
812
- datetime=${start_datetime}
813
- timezone=${timezone}
814
- locale=${this.locale}
815
- ></coras-time-tag>`
816
- : nothing}
817
- ${!hasOnlyOneTimeOption
818
- ? html `<coras-option-group slot="time-options">
819
- ${this.renderTimeOptionChips({
820
- selectionId: selection_id,
821
- startDatetime: start_datetime,
822
- timezone,
823
- })}
824
- </coras-option-group>`
825
- : nothing}
774
+ <coras-time-tag
775
+ slot="badge"
776
+ assets-url="${this.assetsURL}"
777
+ datetime=${start_datetime}
778
+ timezone=${timezone}
779
+ locale=${this.locale}
780
+ ></coras-time-tag>
826
781
  ${hasMultipleLanguages
827
782
  ? html `<coras-option-group slot="language-options">
828
783
  ${this.renderTourOptionChips({
@@ -867,7 +822,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
867
822
  scrollToTop();
868
823
  }
869
824
  else {
870
- isBasketDropdownOpen.set(true);
825
+ this.openNavbarBasket();
871
826
  scrollToTop();
872
827
  }
873
828
  this.shouldRenderOptions = false;
@@ -878,7 +833,9 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
878
833
  }
879
834
  };
880
835
  this.renderAvailabilityOptions = () => {
881
- if (!this.shouldRenderOptions) {
836
+ if (!this.shouldRenderOptions ||
837
+ this.availabilityRequestKey !==
838
+ getAvailabilityRequestKey(this.resolvedDate, this.selectedPriceTypes)) {
882
839
  return nothing;
883
840
  }
884
841
  return this.availabilityTask.render({
@@ -902,12 +859,11 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
902
859
  }
903
860
  else {
904
861
  const timeGroups = groupAvailabilityByTime([...value], this.locale);
905
- const sortedTimes = sortTimes(Array.from(timeGroups.keys()));
906
- const filteredOptions = this.selectedTime
907
- ? Array.from(timeGroups.get(this.selectedTime) || [])
862
+ const filteredOptions = this.selectedTime !== null
863
+ ? [...(timeGroups.get(this.selectedTime)?.items ?? [])]
908
864
  : [];
909
865
  const seatedPerformance = this.findSeatedPerformance(filteredOptions);
910
- const showTimePicker = sortedTimes.length > 1;
866
+ const showTimePicker = timeGroups.size > 1;
911
867
  return html `
912
868
  <div class="options">
913
869
  ${showTimePicker
@@ -916,10 +872,10 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
916
872
  ${msg("Please select a performance time")}
917
873
  </div>
918
874
  <div class="performance-times">
919
- ${map(sortedTimes, (time) => html `
875
+ ${map(timeGroups, ([time, { label }]) => html `
920
876
  <coras-performance-time
921
877
  assets-url="${this.assetsURL}"
922
- text="${time}"
878
+ text="${label}"
923
879
  ?selected=${time === this.selectedTime}
924
880
  @click=${() => {
925
881
  this.selectedTime = time;
@@ -938,11 +894,14 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
938
894
  }
939
895
  },
940
896
  error: (error) => {
941
- const apiError = error;
942
- if (apiError.code === 37) {
897
+ const body = error instanceof APIError
898
+ ? error.response
899
+ : undefined;
900
+ if (body?.code === 37) {
943
901
  return html `${msg("Please select the number of tickets.")}`;
944
902
  }
945
- return html `${msg("Error!")}`;
903
+ // The availability alert already explains the failure.
904
+ return nothing;
946
905
  },
947
906
  });
948
907
  };
@@ -1003,7 +962,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1003
962
  currency: this.currency,
1004
963
  });
1005
964
  return {
1006
- label: `${count} Tickets (${formattedUnitPrice} each)`,
965
+ label: msg(str `${count} Tickets (${formattedUnitPrice} each)`),
1007
966
  price: formattedTotalTicketPrice,
1008
967
  };
1009
968
  })
@@ -1024,6 +983,11 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1024
983
  currency: this.currency,
1025
984
  });
1026
985
  const attractionName = apiResponse.attraction.attraction_name;
986
+ // The seat map URL comes from the API; gate its scheme before it becomes
987
+ // an img source so a javascript: value cannot reach the DOM.
988
+ const seatMap = "seat_map" in apiResponse.attraction
989
+ ? safeUrl(apiResponse.attraction.seat_map)
990
+ : "";
1027
991
  return html `
1028
992
  <coras-dialog
1029
993
  ?open=${this.isReservationPreviewModalOpened}
@@ -1063,14 +1027,9 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1063
1027
  ${msg("Add to basket")}
1064
1028
  </coras-button>
1065
1029
 
1066
- ${"seat_map" in apiResponse.attraction &&
1067
- apiResponse.attraction.seat_map
1030
+ ${seatMap
1068
1031
  ? html `
1069
- <img
1070
- slot="image"
1071
- src="${apiResponse.attraction.seat_map}"
1072
- alt="${msg("Seat Map")}"
1073
- />
1032
+ <img slot="image" src="${seatMap}" alt="${msg("Seat Map")}" />
1074
1033
  `
1075
1034
  : nothing}
1076
1035
  </coras-reservation-preview>
@@ -1192,7 +1151,11 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1192
1151
  const title = msg("We're sorry, there are not enough tickets available for this event");
1193
1152
  const description = msg("Please try a different date or number of tickets");
1194
1153
  return html `
1195
- <coras-alert assets-url=${this.assetsURL} variant="error" title=${title}>
1154
+ <coras-alert
1155
+ assets-url=${this.assetsURL}
1156
+ variant="error"
1157
+ heading=${title}
1158
+ >
1196
1159
  ${description}
1197
1160
  </coras-alert>
1198
1161
  `;
@@ -1211,15 +1174,46 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1211
1174
  date: this.date,
1212
1175
  };
1213
1176
  }
1177
+ willUpdate(changedProperties) {
1178
+ super.willUpdate(changedProperties);
1179
+ const attraction = this.attractionTask.value;
1180
+ this.isSingleDayAvailability = attraction
1181
+ ? isSingleDayAvailability(attraction.attraction.sale_periods ?? null)
1182
+ : false;
1183
+ this.availabilityDays = attraction
1184
+ ? getAvailabilityDays({
1185
+ timezone: attraction.attraction.timezone,
1186
+ salePeriods: attraction.attraction.sale_periods ?? null,
1187
+ targetMonth: getCurrentMonth(this.resolvedDate, this.currentMonth),
1188
+ })
1189
+ : [];
1190
+ this.selectDefaultTicket(attraction);
1191
+ }
1192
+ // One ticket of the first price type is preselected whenever nothing is
1193
+ // selected, so the availability check can run straight away.
1194
+ selectDefaultTicket(attraction) {
1195
+ const firstPriceType = attraction?.price_types?.[0];
1196
+ if (!firstPriceType || Object.keys(this.selectedPriceTypes).length > 0) {
1197
+ return;
1198
+ }
1199
+ const maxAmount = attraction.attraction_type === "TOUR"
1200
+ ? attraction.attraction
1201
+ .max_booking_size
1202
+ : attraction.attraction
1203
+ .max_tickets_per_order;
1204
+ this.changeTicketNumberBy(firstPriceType.price_type_id, 1, maxAmount);
1205
+ }
1214
1206
  updated(changedProperties) {
1215
1207
  super.updated(changedProperties);
1216
1208
  if (getLocale() !== this.locale) {
1217
- setLocale(this.locale);
1209
+ // `loadLocale` falls back on its own (see core/i18n/localization.ts), so
1210
+ // the returned promise does not reject; an unknown code throws synchronously.
1211
+ void setLocale(this.locale);
1218
1212
  }
1219
1213
  if (changedProperties.has("currency") || changedProperties.has("locale")) {
1220
1214
  if (this.availabilityTask.status === TaskStatus.COMPLETE ||
1221
1215
  this.availabilityTask.status === TaskStatus.ERROR) {
1222
- this.availabilityTask.run();
1216
+ void this.availabilityTask.run();
1223
1217
  }
1224
1218
  }
1225
1219
  if (changedProperties.has("attractionId")) {
@@ -1227,6 +1221,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1227
1221
  }
1228
1222
  }
1229
1223
  resetAvailabilityState() {
1224
+ this.currentMonth = undefined;
1230
1225
  this.shouldRenderOptions = false;
1231
1226
  this.hasAvailabilityError = false;
1232
1227
  this.selectedTime = null;
@@ -1241,6 +1236,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1241
1236
  ? formatDateWithTimezone({
1242
1237
  dateString: date,
1243
1238
  timezone,
1239
+ locale: this.locale,
1244
1240
  formatString: "yyyy-MM-dd",
1245
1241
  })
1246
1242
  : formatISO(parseISO(date), {
@@ -1269,7 +1265,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1269
1265
  scrollToTop();
1270
1266
  }
1271
1267
  else {
1272
- isBasketDropdownOpen.set(true);
1268
+ this.openNavbarBasket();
1273
1269
  scrollToTop();
1274
1270
  }
1275
1271
  return true;
@@ -1296,6 +1292,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1296
1292
  return formatDateWithTimezone({
1297
1293
  dateString: apiResponse.first_instance_date,
1298
1294
  timezone: apiResponse.attraction.timezone,
1295
+ locale: this.locale,
1299
1296
  formatString: "yyyy-MM-dd",
1300
1297
  });
1301
1298
  }
@@ -1321,6 +1318,12 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1321
1318
  toggleImageViewerModal() {
1322
1319
  this.isImageViewerModalOpen = !this.isImageViewerModalOpen;
1323
1320
  }
1321
+ clearAvailabilitySelection() {
1322
+ this.hasAvailabilityError = false;
1323
+ this.shouldRenderOptions = false;
1324
+ this.selectedTime = null;
1325
+ this.selectedSectionId = undefined;
1326
+ }
1324
1327
  get isCheckingAvailability() {
1325
1328
  return (this.bookingSessionTask.status === TaskStatus.PENDING ||
1326
1329
  this.availabilityTask.status === TaskStatus.PENDING);
@@ -1336,18 +1339,10 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1336
1339
  if (!apiResponse)
1337
1340
  return nothing;
1338
1341
  const { attraction } = apiResponse;
1339
- const location = attraction.location;
1340
- if (!location)
1342
+ const summary = resolveAttractionLocation(attraction.location);
1343
+ if (!summary)
1341
1344
  return nothing;
1342
- const cityName = location.location_type === "city" ? location.name : null;
1343
- const citySlug = location.location_type === "city" ? location.slug : null;
1344
- const country = location.location_type === "city"
1345
- ? location.parent_location
1346
- : location.location_type === "country"
1347
- ? location
1348
- : null;
1349
- const countryName = country?.name;
1350
- const countrySlug = country?.slug;
1345
+ const { cityName, citySlug, countryName, countrySlug } = summary;
1351
1346
  const handleCountryClick = () => {
1352
1347
  if (!countrySlug)
1353
1348
  return;
@@ -1399,6 +1394,32 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1399
1394
  </coras-breadcrumbs>
1400
1395
  `;
1401
1396
  }
1397
+ renderRelatedSections() {
1398
+ const apiResponse = this.attractionTask.value;
1399
+ if (!apiResponse)
1400
+ return nothing;
1401
+ const summary = resolveAttractionLocation(apiResponse.attraction.location);
1402
+ if (!summary)
1403
+ return nothing;
1404
+ const { cityName, citySlug, countryName, countrySlug, countryCode } = summary;
1405
+ const locationName = cityName || countryName;
1406
+ // Each section hides itself, and gives up its own spacing, when its
1407
+ // location has too little to show.
1408
+ return html `
1409
+ <coras-location-highlights
1410
+ country=${countrySlug}
1411
+ city=${citySlug}
1412
+ location-name=${locationName}
1413
+ exclude-id=${this.attractionId}
1414
+ ></coras-location-highlights>
1415
+ <coras-location-categories
1416
+ country=${countrySlug}
1417
+ city=${citySlug}
1418
+ country-code=${countryCode}
1419
+ location-name=${locationName}
1420
+ ></coras-location-categories>
1421
+ `;
1422
+ }
1402
1423
  findSeatedPerformance(options) {
1403
1424
  const apiResponse = this.attractionTask.value;
1404
1425
  if (this.seatsFallback ||
@@ -1462,15 +1483,20 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1462
1483
  </div>
1463
1484
  `;
1464
1485
  }
1486
+ // The navbar is a light-DOM child the SDK slots into the page (sdk/chrome.ts)
1487
+ // and picks the modal or dropdown for its own layout.
1488
+ openNavbarBasket() {
1489
+ this.querySelector("coras-navbar")?.openBasket();
1490
+ }
1465
1491
  handleGoToBasketButtonClicked() {
1466
- this.handleBasketModalToggle();
1492
+ void this.handleBasketModalToggle();
1467
1493
  const isMobile = window.matchMedia("(max-width: 800px)").matches;
1468
1494
  if (isMobile) {
1469
- isBasketMobileOpen.set(true);
1495
+ this.openNavbarBasket();
1470
1496
  scrollToTop();
1471
1497
  }
1472
1498
  else {
1473
- isBasketDropdownOpen.set(true);
1499
+ this.openNavbarBasket();
1474
1500
  scrollToTop();
1475
1501
  }
1476
1502
  }
@@ -1513,6 +1539,7 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1513
1539
  </div>
1514
1540
  ${this.renderAvailabilityOptions()}
1515
1541
  <div class="description">${this.renderDescription()}</div>
1542
+ ${this.renderRelatedSections()}
1516
1543
  ${this.isReservationPreviewModalOpened
1517
1544
  ? this.renderReservationPreviewModal()
1518
1545
  : nothing}
@@ -1526,7 +1553,9 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(PointsMixi
1526
1553
  ${this.renderErrorModal({
1527
1554
  assetsURL: this.assetsURL,
1528
1555
  buttonLabel: msg("Refresh the page"),
1529
- onRetry: () => this.attractionTask.run(),
1556
+ onRetry: () => {
1557
+ void this.attractionTask.run();
1558
+ },
1530
1559
  onHelp: () => this.dispatchPageUpdate({ page: "help" }),
1531
1560
  })}
1532
1561
  <slot name="footer" slot="footer"></slot>
@@ -1567,12 +1596,6 @@ __decorate([
1567
1596
  __decorate([
1568
1597
  state()
1569
1598
  ], CorasDetailsPage.prototype, "selectedTimeOptions", void 0);
1570
- __decorate([
1571
- state()
1572
- ], CorasDetailsPage.prototype, "isSingleDayAvailability", void 0);
1573
- __decorate([
1574
- state()
1575
- ], CorasDetailsPage.prototype, "availabilityDays", void 0);
1576
1599
  __decorate([
1577
1600
  state()
1578
1601
  ], CorasDetailsPage.prototype, "isReservationPreviewModalOpened", void 0);
@@ -1585,6 +1608,9 @@ __decorate([
1585
1608
  __decorate([
1586
1609
  state()
1587
1610
  ], CorasDetailsPage.prototype, "hasAvailabilityError", void 0);
1611
+ __decorate([
1612
+ state()
1613
+ ], CorasDetailsPage.prototype, "availabilityRequestKey", void 0);
1588
1614
  __decorate([
1589
1615
  state()
1590
1616
  ], CorasDetailsPage.prototype, "loadingSelectionIds", void 0);