@coras-io/embed 0.5.1 → 0.6.1

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 (375) hide show
  1. package/CHANGELOG.md +34 -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.d.ts +4 -4
  54. package/dist/components/location-image/location-image.component.js +6 -7
  55. package/dist/components/locations-results/locations-results.component.d.ts +10 -0
  56. package/dist/components/locations-results/locations-results.component.js +22 -15
  57. package/dist/components/locations-results/locations-results.styles.js +4 -1
  58. package/dist/components/message-card/message-card.component.d.ts +1 -1
  59. package/dist/components/message-card/message-card.component.js +4 -3
  60. package/dist/components/mobile-menu-item/mobile-menu-item.component.d.ts +0 -1
  61. package/dist/components/mobile-menu-item/mobile-menu-item.component.js +14 -16
  62. package/dist/components/mobile-menu-item/mobile-menu-item.styles.js +9 -5
  63. package/dist/components/option-group/option-chip/option-chip.component.d.ts +4 -1
  64. package/dist/components/option-group/option-chip/option-chip.component.js +23 -10
  65. package/dist/components/option-group/option-group.component.d.ts +3 -1
  66. package/dist/components/option-group/option-group.component.js +10 -3
  67. package/dist/components/overlay/overlay.component.d.ts +0 -5
  68. package/dist/components/overlay/overlay.component.js +3 -15
  69. package/dist/components/phone-country-code/phone-country-code.component.d.ts +4 -0
  70. package/dist/components/phone-country-code/phone-country-code.component.js +37 -0
  71. package/dist/components/phone-country-codes/phone-country-codes.component.js +1 -1
  72. package/dist/components/phone-field/phone-field.component.js +2 -2
  73. package/dist/components/search-button/search-button.component.d.ts +1 -1
  74. package/dist/components/search-button/search-button.component.js +13 -7
  75. package/dist/components/seated-selector/seated-selector.component.js +3 -3
  76. package/dist/components/seats-io/seats-io.component.d.ts +3 -2
  77. package/dist/components/seats-io/seats-io.component.js +31 -13
  78. package/dist/components/seats-io/seats-io.constants.d.ts +0 -2
  79. package/dist/components/seats-io/seats-io.constants.js +0 -3
  80. package/dist/components/seats-io/seats-io.transform.d.ts +1 -6
  81. package/dist/components/seats-io/seats-io.transform.js +1 -20
  82. package/dist/components/select-list/select-list.component.js +7 -2
  83. package/dist/components/select-list/select-option/select-option.component.d.ts +3 -1
  84. package/dist/components/select-list/select-option/select-option.component.js +10 -3
  85. package/dist/components/tabs/tabs.component.d.ts +2 -0
  86. package/dist/components/tabs/tabs.component.js +59 -5
  87. package/dist/components/time-tag/time-tag.component.js +1 -1
  88. package/dist/containers/basket/basket.component.d.ts +1 -1
  89. package/dist/containers/basket/basket.component.js +21 -20
  90. package/dist/containers/navbar/navbar.component.d.ts +12 -8
  91. package/dist/containers/navbar/navbar.component.js +108 -62
  92. package/dist/containers/navbar/navbar.styles.js +23 -5
  93. package/dist/containers/navbar/navbar.utils.js +4 -4
  94. package/dist/contexts/basket/basket.provider.d.ts +3 -4
  95. package/dist/contexts/basket/basket.provider.js +46 -61
  96. package/dist/contexts/basket/basket.types.d.ts +0 -2
  97. package/dist/controllers/time-expiration.d.ts +15 -2
  98. package/dist/controllers/time-expiration.js +47 -17
  99. package/dist/core/api/client.d.ts +9 -0
  100. package/dist/core/api/client.js +26 -0
  101. package/dist/core/api/middlewares/booking-session/booking-session.constants.d.ts +0 -2
  102. package/dist/core/api/middlewares/booking-session/booking-session.constants.js +0 -2
  103. package/dist/core/api/middlewares/booking-session/booking-session.js +3 -12
  104. package/dist/core/api/middlewares/booking-session/booking-session.utils.d.ts +0 -1
  105. package/dist/core/api/middlewares/booking-session/booking-session.utils.js +6 -28
  106. package/dist/core/api/middlewares/error-handler/error-handler.js +5 -1
  107. package/dist/core/api/middlewares/retry/retry.constants.d.ts +3 -0
  108. package/dist/core/api/middlewares/retry/retry.constants.js +7 -0
  109. package/dist/core/api/middlewares/retry/retry.d.ts +2 -0
  110. package/dist/core/api/middlewares/retry/retry.js +48 -0
  111. package/dist/core/api/queries.d.ts +13 -38
  112. package/dist/core/api/queries.js +16 -99
  113. package/dist/core/events.d.ts +2 -4
  114. package/dist/core/i18n/date.d.ts +14 -5
  115. package/dist/core/i18n/date.js +47 -20
  116. package/dist/core/i18n/localization.js +10 -3
  117. package/dist/core/images/helpers.js +6 -5
  118. package/dist/core/images/srcset.js +2 -2
  119. package/dist/core/logger.d.ts +17 -0
  120. package/dist/core/logger.js +13 -0
  121. package/dist/core/types/api-schema.d.ts +7872 -0
  122. package/dist/core/types/seats-config.d.ts +5 -4
  123. package/dist/core/types/seats-config.js +10 -3
  124. package/dist/core/utils/crypto-address.d.ts +12 -0
  125. package/dist/core/utils/crypto-address.js +17 -0
  126. package/dist/core/utils/datetime.d.ts +13 -11
  127. package/dist/core/utils/datetime.js +41 -51
  128. package/dist/core/utils/loyalty.d.ts +8 -0
  129. package/dist/core/utils/loyalty.js +10 -0
  130. package/dist/core/utils/redaction.d.ts +9 -0
  131. package/dist/core/utils/redaction.js +58 -0
  132. package/dist/core/utils/time.js +2 -3
  133. package/dist/helpers/helpers.d.ts +6 -0
  134. package/dist/helpers/helpers.js +33 -16
  135. package/dist/locales/ar-SA.d.ts +38 -21
  136. package/dist/locales/ar-SA.js +38 -21
  137. package/dist/locales/da-DK.d.ts +38 -21
  138. package/dist/locales/da-DK.js +38 -21
  139. package/dist/locales/de-DE.d.ts +38 -21
  140. package/dist/locales/de-DE.js +38 -21
  141. package/dist/locales/en-IE.d.ts +38 -21
  142. package/dist/locales/en-IE.js +38 -21
  143. package/dist/locales/en-US.d.ts +38 -21
  144. package/dist/locales/en-US.js +38 -21
  145. package/dist/locales/es-ES.d.ts +38 -21
  146. package/dist/locales/es-ES.js +38 -21
  147. package/dist/locales/fr-FR.d.ts +38 -21
  148. package/dist/locales/fr-FR.js +38 -21
  149. package/dist/locales/fr-MA.d.ts +38 -21
  150. package/dist/locales/fr-MA.js +38 -21
  151. package/dist/locales/is-IS.d.ts +38 -21
  152. package/dist/locales/is-IS.js +38 -21
  153. package/dist/locales/it-IT.d.ts +38 -21
  154. package/dist/locales/it-IT.js +38 -21
  155. package/dist/locales/ms-MY.d.ts +38 -21
  156. package/dist/locales/ms-MY.js +38 -21
  157. package/dist/locales/nb-NO.d.ts +38 -21
  158. package/dist/locales/nb-NO.js +38 -21
  159. package/dist/locales/pl-PL.d.ts +38 -21
  160. package/dist/locales/pl-PL.js +38 -21
  161. package/dist/locales/pt-PT.d.ts +38 -21
  162. package/dist/locales/pt-PT.js +38 -21
  163. package/dist/locales/sv-SE.d.ts +38 -21
  164. package/dist/locales/sv-SE.js +38 -21
  165. package/dist/locales/th-TH.d.ts +38 -21
  166. package/dist/locales/th-TH.js +38 -21
  167. package/dist/locales/tr-TR.d.ts +38 -21
  168. package/dist/locales/tr-TR.js +38 -21
  169. package/dist/locales/zh-CN.d.ts +38 -21
  170. package/dist/locales/zh-CN.js +38 -21
  171. package/dist/locales/zh-HK.d.ts +38 -21
  172. package/dist/locales/zh-HK.js +38 -21
  173. package/dist/mixins/base.mixin.d.ts +3 -1
  174. package/dist/mixins/base.mixin.js +10 -7
  175. package/dist/mixins/coinbase.mixin.d.ts +13 -17
  176. package/dist/mixins/coinbase.mixin.js +251 -288
  177. package/dist/mixins/error-modal.mixin.js +8 -4
  178. package/dist/mixins/location-search/location-search.d.ts +13 -1
  179. package/dist/mixins/location-search/location-search.js +35 -27
  180. package/dist/mixins/overlay/overlay-mixin.js +39 -3
  181. package/dist/mixins/overlay/types.d.ts +1 -0
  182. package/dist/mixins/search-mixin/search-mixin.js +8 -5
  183. package/dist/sdk/diagnostics.js +2 -0
  184. package/dist/sdk/mount.d.ts +10 -0
  185. package/dist/sdk/mount.js +20 -1
  186. package/dist/sdk/page-registry.js +5 -0
  187. package/dist/sdk/params.d.ts +53 -0
  188. package/dist/sdk/params.js +180 -0
  189. package/dist/sdk/redaction.d.ts +1 -4
  190. package/dist/sdk/redaction.js +2 -41
  191. package/dist/sdk/types.d.ts +21 -7
  192. package/dist/sdk/url.d.ts +1 -1
  193. package/dist/sdk/url.js +12 -5
  194. package/dist/sdk/validation.d.ts +1 -26
  195. package/dist/sdk/validation.js +8 -145
  196. package/dist/styles/tokens.d.ts +1 -1
  197. package/dist/styles/tokens.generated.d.ts +1 -1
  198. package/dist/styles/tokens.generated.js +1 -1
  199. package/dist/views/chrome-only-page/chrome-only-page.component.d.ts +30 -0
  200. package/dist/views/chrome-only-page/chrome-only-page.component.js +24 -0
  201. package/dist/views/chrome-only-page/chrome-only-page.d.ts +8 -0
  202. package/dist/views/chrome-only-page/chrome-only-page.js +6 -0
  203. package/dist/views/chrome-only-page/chrome-only-page.styles.js +13 -0
  204. package/dist/views/details-page/details-page.component.d.ts +11 -4
  205. package/dist/views/details-page/details-page.component.js +263 -237
  206. package/dist/views/details-page/details-page.utilts.d.ts +63 -3
  207. package/dist/views/details-page/details-page.utilts.js +53 -5
  208. package/dist/views/details-page/partials/location-categories/location-categories.component.d.ts +29 -0
  209. package/dist/views/details-page/partials/location-categories/location-categories.component.js +149 -0
  210. package/dist/views/details-page/partials/location-categories/location-categories.d.ts +8 -0
  211. package/dist/views/details-page/partials/location-categories/location-categories.js +6 -0
  212. package/dist/views/details-page/partials/location-categories/location-categories.styles.js +35 -0
  213. package/dist/views/details-page/partials/location-highlights/location-highlights.component.d.ts +26 -0
  214. package/dist/views/details-page/partials/location-highlights/location-highlights.component.js +158 -0
  215. package/dist/views/details-page/partials/location-highlights/location-highlights.d.ts +8 -0
  216. package/dist/views/details-page/partials/location-highlights/location-highlights.js +6 -0
  217. package/dist/views/details-page/partials/location-highlights/location-highlights.styles.js +42 -0
  218. package/dist/views/details-page/partials/tour-description/tour-description.component.js +1 -4
  219. package/dist/views/help-page/help-page.component.d.ts +2 -0
  220. package/dist/views/help-page/help-page.component.js +37 -18
  221. package/dist/views/help-page/help-page.utils.js +6 -5
  222. package/dist/views/landing-page/landing-page.component.d.ts +5 -8
  223. package/dist/views/landing-page/landing-page.component.js +82 -97
  224. package/dist/views/payment-page/controllers/crypto-auth.controller.d.ts +10 -4
  225. package/dist/views/payment-page/controllers/crypto-auth.controller.js +53 -31
  226. package/dist/views/payment-page/controllers/crypto-transfer.controller.d.ts +9 -5
  227. package/dist/views/payment-page/controllers/crypto-transfer.controller.js +26 -39
  228. package/dist/views/payment-page/controllers/payment-flow.controller.d.ts +6 -1
  229. package/dist/views/payment-page/controllers/payment-flow.controller.js +1 -0
  230. package/dist/views/payment-page/controllers/stripe-payment.controller.d.ts +20 -2
  231. package/dist/views/payment-page/controllers/stripe-payment.controller.js +42 -19
  232. package/dist/views/payment-page/partials/activity-details/activity-details.component.d.ts +2 -0
  233. package/dist/views/payment-page/partials/activity-details/activity-details.component.js +6 -3
  234. package/dist/views/payment-page/partials/billing-address/billing-address.component.d.ts +2 -0
  235. package/dist/views/payment-page/partials/billing-address/billing-address.component.js +5 -1
  236. package/dist/views/payment-page/partials/confirmation/confirmation.component.js +2 -3
  237. package/dist/views/payment-page/partials/country-field/country-field.component.js +1 -1
  238. package/dist/views/payment-page/partials/payment-type-selector/payment-type-selector.component.js +3 -3
  239. package/dist/views/payment-page/partials/stripe/stripe.component.d.ts +2 -0
  240. package/dist/views/payment-page/partials/stripe/stripe.component.js +36 -7
  241. package/dist/views/payment-page/partials/stripe/stripe.utils.js +0 -3
  242. package/dist/views/payment-page/payment-page.component.d.ts +39 -6
  243. package/dist/views/payment-page/payment-page.component.js +302 -178
  244. package/dist/views/payment-page/payment-page.constants.d.ts +1 -27
  245. package/dist/views/payment-page/payment-page.constants.js +3 -30
  246. package/dist/views/payment-page/payment-page.types.d.ts +1 -19
  247. package/dist/views/payment-page/payment-page.utils.d.ts +22 -13
  248. package/dist/views/payment-page/payment-page.utils.js +57 -75
  249. package/dist/views/payment-page/services/payment-api.service.d.ts +16 -34
  250. package/dist/views/payment-page/services/payment-api.service.js +19 -27
  251. package/dist/views/search-page/search-page.component.d.ts +2 -0
  252. package/dist/views/search-page/search-page.component.js +39 -20
  253. package/dist/views/suggestion-widget/suggestion-widget.component.d.ts +1 -0
  254. package/dist/views/suggestion-widget/suggestion-widget.component.js +6 -5
  255. package/package.json +24 -20
  256. package/dist/components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.component.d.ts +0 -10
  257. package/dist/components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.component.js +0 -43
  258. package/dist/components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.d.ts +0 -8
  259. package/dist/components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.js +0 -6
  260. package/dist/components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.styles.js +0 -23
  261. package/dist/components/attraction-discovery/attraction-discovery.component.d.ts +0 -10
  262. package/dist/components/attraction-discovery/attraction-discovery.component.js +0 -52
  263. package/dist/components/attraction-discovery/attraction-discovery.constants.d.ts +0 -4
  264. package/dist/components/attraction-discovery/attraction-discovery.constants.js +0 -5
  265. package/dist/components/attraction-discovery/attraction-discovery.d.ts +0 -8
  266. package/dist/components/attraction-discovery/attraction-discovery.js +0 -6
  267. package/dist/components/attraction-discovery/attraction-discovery.styles.js +0 -193
  268. package/dist/components/basket-rewards/basket-rewards.component.d.ts +0 -10
  269. package/dist/components/basket-rewards/basket-rewards.component.js +0 -52
  270. package/dist/components/basket-rewards/basket-rewards.d.ts +0 -8
  271. package/dist/components/basket-rewards/basket-rewards.js +0 -6
  272. package/dist/components/basket-rewards/basket-rewards.styles.js +0 -18
  273. package/dist/components/filter-chip/filter-chip.component.d.ts +0 -12
  274. package/dist/components/filter-chip/filter-chip.component.js +0 -68
  275. package/dist/components/filter-chip/filter-chip.constants.d.ts +0 -2
  276. package/dist/components/filter-chip/filter-chip.constants.js +0 -2
  277. package/dist/components/filter-chip/filter-chip.d.ts +0 -8
  278. package/dist/components/filter-chip/filter-chip.js +0 -6
  279. package/dist/components/filter-chip/filter-chip.styles.d.ts +0 -2
  280. package/dist/components/filter-chip/filter-chip.styles.js +0 -162
  281. package/dist/components/image-carousel/image-carousel-item/image-carousel-item.component.d.ts +0 -10
  282. package/dist/components/image-carousel/image-carousel-item/image-carousel-item.component.js +0 -43
  283. package/dist/components/image-carousel/image-carousel-item/image-carousel-item.d.ts +0 -8
  284. package/dist/components/image-carousel/image-carousel-item/image-carousel-item.js +0 -6
  285. package/dist/components/image-carousel/image-carousel-item/image-carousel-item.styles.d.ts +0 -2
  286. package/dist/components/image-carousel/image-carousel-item/image-carousel-item.styles.js +0 -28
  287. package/dist/components/image-carousel/image-carousel.component.d.ts +0 -8
  288. package/dist/components/image-carousel/image-carousel.component.js +0 -36
  289. package/dist/components/image-carousel/image-carousel.d.ts +0 -8
  290. package/dist/components/image-carousel/image-carousel.js +0 -6
  291. package/dist/components/image-carousel/image-carousel.styles.d.ts +0 -2
  292. package/dist/components/image-carousel/image-carousel.styles.js +0 -72
  293. package/dist/components/itinerary/itinerary-item/itinerary-item.component.d.ts +0 -9
  294. package/dist/components/itinerary/itinerary-item/itinerary-item.component.js +0 -45
  295. package/dist/components/itinerary/itinerary-item/itinerary-item.d.ts +0 -8
  296. package/dist/components/itinerary/itinerary-item/itinerary-item.js +0 -6
  297. package/dist/components/itinerary/itinerary-item/itinerary-item.styles.d.ts +0 -2
  298. package/dist/components/itinerary/itinerary-item/itinerary-item.styles.js +0 -70
  299. package/dist/components/itinerary/itinerary.component.d.ts +0 -7
  300. package/dist/components/itinerary/itinerary.component.js +0 -23
  301. package/dist/components/itinerary/itinerary.d.ts +0 -8
  302. package/dist/components/itinerary/itinerary.js +0 -6
  303. package/dist/components/itinerary/itinerary.styles.d.ts +0 -2
  304. package/dist/components/itinerary/itinerary.styles.js +0 -15
  305. package/dist/components/marketing-tag/marketing-tag.component.d.ts +0 -5
  306. package/dist/components/marketing-tag/marketing-tag.component.js +0 -8
  307. package/dist/components/marketing-tag/marketing-tag.d.ts +0 -8
  308. package/dist/components/marketing-tag/marketing-tag.js +0 -6
  309. package/dist/components/marketing-tag/marketing-tag.styles.d.ts +0 -2
  310. package/dist/components/marketing-tag/marketing-tag.styles.js +0 -36
  311. package/dist/components/price/price.component.d.ts +0 -12
  312. package/dist/components/price/price.component.js +0 -38
  313. package/dist/components/price/price.d.ts +0 -8
  314. package/dist/components/price/price.js +0 -6
  315. package/dist/components/reviews/review/review.component.d.ts +0 -9
  316. package/dist/components/reviews/review/review.component.js +0 -41
  317. package/dist/components/reviews/review/review.d.ts +0 -8
  318. package/dist/components/reviews/review/review.js +0 -6
  319. package/dist/components/reviews/review/review.styles.d.ts +0 -2
  320. package/dist/components/reviews/review/review.styles.js +0 -45
  321. package/dist/components/reviews/reviews.component.d.ts +0 -9
  322. package/dist/components/reviews/reviews.component.js +0 -56
  323. package/dist/components/reviews/reviews.d.ts +0 -8
  324. package/dist/components/reviews/reviews.js +0 -6
  325. package/dist/components/reviews/reviews.styles.d.ts +0 -2
  326. package/dist/components/reviews/reviews.styles.js +0 -73
  327. package/dist/components/selected-tickets-preview/selected-tickets-preview.component.d.ts +0 -10
  328. package/dist/components/selected-tickets-preview/selected-tickets-preview.component.js +0 -51
  329. package/dist/components/selected-tickets-preview/selected-tickets-preview.d.ts +0 -8
  330. package/dist/components/selected-tickets-preview/selected-tickets-preview.js +0 -6
  331. package/dist/components/selected-tickets-preview/selected-tickets-preview.styles.d.ts +0 -2
  332. package/dist/components/selected-tickets-preview/selected-tickets-preview.styles.js +0 -89
  333. package/dist/components/tag/tag.component.d.ts +0 -8
  334. package/dist/components/tag/tag.component.js +0 -33
  335. package/dist/components/tag/tag.constants.d.ts +0 -1
  336. package/dist/components/tag/tag.constants.js +0 -1
  337. package/dist/components/tag/tag.d.ts +0 -8
  338. package/dist/components/tag/tag.js +0 -6
  339. package/dist/components/tag/tag.styles.d.ts +0 -2
  340. package/dist/components/tag/tag.styles.js +0 -56
  341. package/dist/components/tooltip/tooltip.component.d.ts +0 -19
  342. package/dist/components/tooltip/tooltip.component.js +0 -124
  343. package/dist/components/tooltip/tooltip.d.ts +0 -8
  344. package/dist/components/tooltip/tooltip.js +0 -6
  345. package/dist/components/tooltip/tooltip.styles.d.ts +0 -2
  346. package/dist/components/tooltip/tooltip.styles.js +0 -79
  347. package/dist/core/signals.d.ts +0 -2
  348. package/dist/core/signals.js +0 -3
  349. package/dist/core/storybook/argTypes.d.ts +0 -1
  350. package/dist/core/storybook/argTypes.js +0 -46
  351. package/dist/core/storybook/cssprops.d.ts +0 -30
  352. package/dist/core/storybook/cssprops.js +0 -46
  353. package/dist/core/storybook/demo.d.ts +0 -4
  354. package/dist/core/storybook/demo.js +0 -17
  355. package/dist/core/types/api-errors.d.ts +0 -8
  356. package/dist/core/types/api-errors.js +0 -1
  357. package/dist/styles/contrast-fixtures.d.ts +0 -5
  358. package/dist/styles/contrast-fixtures.js +0 -131
  359. package/dist/views/payment-page/domain/payment-mappers.d.ts +0 -7
  360. package/dist/views/payment-page/domain/payment-mappers.js +0 -7
  361. package/dist/views/payment-page/domain/payment-validators.d.ts +0 -6
  362. package/dist/views/payment-page/domain/payment-validators.js +0 -6
  363. package/dist/views/payment-page/domain/recovery-payload.d.ts +0 -8
  364. package/dist/views/payment-page/domain/recovery-payload.js +0 -7
  365. package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.component.d.ts +0 -22
  366. package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.component.js +0 -65
  367. package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.d.ts +0 -8
  368. package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.js +0 -6
  369. package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.styles.d.ts +0 -2
  370. package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.styles.js +0 -12
  371. package/dist/views/payment-page/payment-page.validation-schema.d.ts +0 -28
  372. package/dist/views/payment-page/payment-page.validation-schema.js +0 -42
  373. /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
  374. /package/dist/{components/attraction-discovery/attraction-discovery.styles.d.ts → views/details-page/partials/location-categories/location-categories.styles.d.ts} +0 -0
  375. /package/dist/{components/basket-rewards/basket-rewards.styles.d.ts → views/details-page/partials/location-highlights/location-highlights.styles.d.ts} +0 -0
@@ -1,13 +1,26 @@
1
1
  import type { components } from "../../core/types/api-schema.js";
2
2
  import type { SupportedCurrencies, SupportedLocales } from "../../core/types/index.js";
3
- export declare const formatDateWithTimezone: ({ dateString, timezone, formatString, timeFormatString, includeTime, }: {
3
+ export declare const formatDateWithTimezone: ({ dateString, timezone, locale, formatString, timeFormatString, includeTime, }: {
4
4
  dateString: string;
5
5
  timezone?: string;
6
+ locale: SupportedLocales;
6
7
  formatString?: string;
7
8
  timeFormatString?: string;
8
9
  includeTime?: boolean;
9
10
  }) => string;
11
+ /**
12
+ * The expiry to store for a new booking session: the API's expiry header
13
+ * when it carries a valid date, otherwise a default lifetime from now.
14
+ */
15
+ export declare const getBookingSessionExpiry: (expiresHeader: string | null) => Date;
10
16
  export declare const getCurrentMonth: (date: string, currentMonth?: string) => string;
17
+ /**
18
+ * Identifies the date and ticket mix an availability response answers, so
19
+ * the page can tell a stale response from one that matches the current
20
+ * selection. The entries are sorted because the selection object's key order
21
+ * depends on the order the visitor clicked.
22
+ */
23
+ export declare const getAvailabilityRequestKey: (date: string, selectedPriceTypes: Record<string, number>) => string;
11
24
  export declare const getTotalTicketsCount: (selectedPriceTypes: Record<string, number>) => number;
12
25
  export declare const getTicketsAmount: (id: string, selectedPriceTypes: Record<string, number>, maxAmount: number | null) => number;
13
26
  export declare const getTicketSelectorLabel: (priceTypes: components["schemas"]["AttractionPriceType"][], selectedPriceTypes: Record<string, number>, apiResponse?: components["schemas"]["AttractionEvent"] | components["schemas"]["AttractionTour"]) => string;
@@ -28,8 +41,39 @@ export declare const formatTicketDetails: ({ prices, locale, currency, }: {
28
41
  locale: SupportedLocales;
29
42
  currency: SupportedCurrencies;
30
43
  }) => string;
31
- export declare const groupAvailabilityByTime: (items: components["schemas"]["AvailabilityItemModel"][], locale: string) => Map<string, components["schemas"]["AvailabilityItemModel"][]>;
32
- export declare const sortTimes: (times: string[]) => string[];
44
+ export declare const groupAvailabilityByTime: (items: components["schemas"]["AvailabilityItemModel"][], locale: SupportedLocales) => Map<number, {
45
+ label: string;
46
+ items: {
47
+ available: boolean;
48
+ description: string | null;
49
+ end_datetime: string | null;
50
+ full_day: boolean;
51
+ instance_id: string;
52
+ languages_spoken: {
53
+ [key: string]: string;
54
+ };
55
+ loyalty: components["schemas"]["LoyaltySchema"];
56
+ max_booking_fee: {
57
+ [key: string]: number;
58
+ };
59
+ max_full_price: {
60
+ [key: string]: number;
61
+ };
62
+ min_booking_fee: {
63
+ [key: string]: number;
64
+ };
65
+ min_full_price: {
66
+ [key: string]: number;
67
+ };
68
+ name: string | null;
69
+ pickup_points: components["schemas"]["OptionPickupPoint"][];
70
+ price_types_required: unknown[] | null;
71
+ prices: components["schemas"]["AvailabilityItemPriceModel"][];
72
+ selection_id: string | null;
73
+ start_datetime: string;
74
+ timezone: string;
75
+ }[];
76
+ }>;
33
77
  export declare const scrollToTop: (behavior?: "smooth" | "instant") => void;
34
78
  export declare const getAvailabilitySummary: (item: components["schemas"]["AvailabilityItemModel"], currency: string) => {
35
79
  totalPrice: number;
@@ -38,3 +82,19 @@ export declare const getAvailabilitySummary: (item: components["schemas"]["Avail
38
82
  ticketsPrice: number;
39
83
  totalFee: number;
40
84
  };
85
+ export type AttractionLocationSummary = {
86
+ cityName: string;
87
+ citySlug: string;
88
+ countryName: string;
89
+ countrySlug: string;
90
+ countryCode: string;
91
+ };
92
+ /**
93
+ * Flatten an attraction's location into the identifiers the page needs.
94
+ *
95
+ * The API returns either the city, carrying its country as `parent_location`,
96
+ * or the country on its own. The two location-scoped endpoints then disagree
97
+ * on how to name a country: `/landing` takes its slug, `/categories` takes its
98
+ * code, so both are resolved here.
99
+ */
100
+ export declare const resolveAttractionLocation: (location: components["schemas"]["AttractionLocation"] | null | undefined) => AttractionLocationSummary | null;
@@ -2,22 +2,47 @@ import { differenceInCalendarDays, eachDayOfInterval, format, parseISO, } from "
2
2
  import { toZonedTime } from "date-fns-tz";
3
3
  import { convertToLocaleCurrency } from "../../core/currency/index.js";
4
4
  import { capitalize } from "../../core/utils/text.js";
5
- import { formatDateTimeWithTimezone, groupItemsByTime, sortTimeStrings, } from "../../core/utils/datetime.js";
6
- export const formatDateWithTimezone = ({ dateString, timezone, formatString = "d MMM yyyy", timeFormatString = "d MMM yyyy HH:mm", includeTime = false, }) => {
5
+ import { formatDateTimeWithTimezone, groupItemsByTime, } from "../../core/utils/datetime.js";
6
+ export const formatDateWithTimezone = ({ dateString, timezone, locale, formatString = "d MMM yyyy", timeFormatString = "d MMM yyyy HH:mm", includeTime = false, }) => {
7
7
  return formatDateTimeWithTimezone({
8
8
  dateString,
9
9
  timezone,
10
+ locale,
10
11
  formatString,
11
12
  timeFormatString,
12
13
  includeTime,
13
14
  });
14
15
  };
16
+ const DEFAULT_BOOKING_SESSION_LIFETIME_MS = 20 * 60 * 1000;
17
+ /**
18
+ * The expiry to store for a new booking session: the API's expiry header
19
+ * when it carries a valid date, otherwise a default lifetime from now.
20
+ */
21
+ export const getBookingSessionExpiry = (expiresHeader) => {
22
+ const headerDate = expiresHeader ? new Date(expiresHeader) : null;
23
+ return headerDate && !Number.isNaN(headerDate.getTime())
24
+ ? headerDate
25
+ : new Date(Date.now() + DEFAULT_BOOKING_SESSION_LIFETIME_MS);
26
+ };
15
27
  export const getCurrentMonth = (date, currentMonth) => {
16
28
  if (!currentMonth) {
17
29
  return format(parseISO(date), "yyyy-MM");
18
30
  }
19
31
  return currentMonth;
20
32
  };
33
+ /**
34
+ * Identifies the date and ticket mix an availability response answers, so
35
+ * the page can tell a stale response from one that matches the current
36
+ * selection. The entries are sorted because the selection object's key order
37
+ * depends on the order the visitor clicked.
38
+ */
39
+ export const getAvailabilityRequestKey = (date, selectedPriceTypes) => {
40
+ const tickets = Object.entries(selectedPriceTypes)
41
+ .sort(([a], [b]) => a.localeCompare(b))
42
+ .map(([id, count]) => `${id}:${count}`)
43
+ .join(",");
44
+ return `${date}|${tickets}`;
45
+ };
21
46
  export const getTotalTicketsCount = (selectedPriceTypes) => {
22
47
  return Object.values(selectedPriceTypes).reduce((total, count) => total + count, 0);
23
48
  };
@@ -164,9 +189,6 @@ export const formatTicketDetails = ({ prices, locale, currency, }) => {
164
189
  export const groupAvailabilityByTime = (items, locale) => {
165
190
  return groupItemsByTime(items, locale);
166
191
  };
167
- export const sortTimes = (times) => {
168
- return sortTimeStrings(times);
169
- };
170
192
  export const scrollToTop = (behavior = "instant") => {
171
193
  window.scrollTo({ top: 0, behavior });
172
194
  };
@@ -186,3 +208,29 @@ export const getAvailabilitySummary = (item, currency) => {
186
208
  totalFee,
187
209
  };
188
210
  };
211
+ /**
212
+ * Flatten an attraction's location into the identifiers the page needs.
213
+ *
214
+ * The API returns either the city, carrying its country as `parent_location`,
215
+ * or the country on its own. The two location-scoped endpoints then disagree
216
+ * on how to name a country: `/landing` takes its slug, `/categories` takes its
217
+ * code, so both are resolved here.
218
+ */
219
+ export const resolveAttractionLocation = (location) => {
220
+ if (!location) {
221
+ return null;
222
+ }
223
+ const isCity = location.location_type === "city";
224
+ const country = isCity
225
+ ? location.parent_location
226
+ : location.location_type === "country"
227
+ ? location
228
+ : null;
229
+ return {
230
+ cityName: isCity ? (location.name ?? "") : "",
231
+ citySlug: isCity ? (location.slug ?? "") : "",
232
+ countryName: country?.name ?? "",
233
+ countrySlug: country?.slug ?? "",
234
+ countryCode: country?.code ?? "",
235
+ };
236
+ };
@@ -0,0 +1,29 @@
1
+ import { type CSSResultGroup, LitElement, nothing } from "lit";
2
+ import type { Client } from "openapi-fetch";
3
+ import "../../../../components/button/button.js";
4
+ import "../../../../components/carousel/carousel.js";
5
+ import "../../../../components/explore-card/explore-card.js";
6
+ import { type PageDispatchInput } from "../../../../contexts/events.context.js";
7
+ import type { paths } from "../../../../core/types/api-schema.js";
8
+ import type { SupportedCurrencies, SupportedLocales } from "../../../../core/types/index.js";
9
+ export declare class CorasLocationCategories extends LitElement {
10
+ static styles: CSSResultGroup;
11
+ /** Country slug, as `/landing` and the landing page understand it. */
12
+ country: string;
13
+ /** City slug, empty for an attraction that is only country-scoped. */
14
+ city: string;
15
+ /** ISO country code, which is how `/categories` names a country. */
16
+ countryCode: string;
17
+ /** Display name of the location, used in the heading. */
18
+ locationName: string;
19
+ client: Client<paths>;
20
+ distributorID: string;
21
+ assetsURL: string;
22
+ locale: SupportedLocales;
23
+ currency: SupportedCurrencies;
24
+ dispatchPageUpdate: (params: PageDispatchInput) => void;
25
+ private categoriesTask;
26
+ private handleCategoryClick;
27
+ private renderCategory;
28
+ render(): typeof nothing | import("lit").TemplateResult<1> | undefined;
29
+ }
@@ -0,0 +1,149 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { LitElement, html, nothing } from "lit";
8
+ import { property } from "lit/decorators.js";
9
+ import { consume } from "@lit/context";
10
+ import { localized, msg, str } from "@lit/localize";
11
+ import { Task } from "@lit/task";
12
+ import "../../../../components/button/button.js";
13
+ import "../../../../components/carousel/carousel.js";
14
+ import "../../../../components/explore-card/explore-card.js";
15
+ import { ExploreCardVariants } from "../../../../components/explore-card/explore-card.constants.js";
16
+ import { apiGet } from "../../../../core/api/queries.js";
17
+ import { APIError } from "../../../../core/api/api-error.js";
18
+ import { clientContext } from "../../../../contexts/client.context.js";
19
+ import { assetsURLContext, currencyContext, distributorIdContext, localeContext, } from "../../../../contexts/properties.context.js";
20
+ import { pageDispatchContext, } from "../../../../contexts/events.context.js";
21
+ import styles from "./location-categories.styles.js";
22
+ /**
23
+ * Below this the row is too thin to read as a set of things to explore, and
24
+ * the carousel it lives in has nothing to scroll.
25
+ */
26
+ const MIN_CATEGORIES = 4;
27
+ let CorasLocationCategories = class CorasLocationCategories extends LitElement {
28
+ constructor() {
29
+ super(...arguments);
30
+ /** Country slug, as `/landing` and the landing page understand it. */
31
+ this.country = "";
32
+ /** City slug, empty for an attraction that is only country-scoped. */
33
+ this.city = "";
34
+ /** ISO country code, which is how `/categories` names a country. */
35
+ this.countryCode = "";
36
+ /** Display name of the location, used in the heading. */
37
+ this.locationName = "";
38
+ this.categoriesTask = new Task(this, {
39
+ task: async ([locale, city, countryCode]) => {
40
+ if (!this.client || (!city && !countryCode)) {
41
+ return [];
42
+ }
43
+ let data;
44
+ try {
45
+ ({ data } = await apiGet({
46
+ client: this.client,
47
+ distributorID: this.distributorID,
48
+ locale,
49
+ endpoint: "/{api_version}/categories",
50
+ query: { city_slug: city, country_code: countryCode },
51
+ }));
52
+ }
53
+ catch (error) {
54
+ // An optional section: when its request fails it hides itself
55
+ // rather than showing an error.
56
+ if (error instanceof APIError) {
57
+ return [];
58
+ }
59
+ throw error;
60
+ }
61
+ return (data ?? []).flatMap((category) => {
62
+ const image = category.media?.[0]?.url;
63
+ return image ? [{ ...category, image }] : [];
64
+ });
65
+ },
66
+ args: () => [this.locale, this.city, this.countryCode],
67
+ });
68
+ }
69
+ static { this.styles = styles; }
70
+ handleCategoryClick(category) {
71
+ this.dispatchPageUpdate({
72
+ page: "landing",
73
+ country: this.country,
74
+ city: this.city,
75
+ categories: category.slug,
76
+ locale: this.locale,
77
+ currency: this.currency,
78
+ });
79
+ }
80
+ renderCategory(category) {
81
+ return html `
82
+ <coras-explore-card
83
+ image=${category.image}
84
+ label=${category.name}
85
+ variant=${ExploreCardVariants.HALF_SIZE_BG}
86
+ >
87
+ <coras-button
88
+ slot="button"
89
+ variant="outlined"
90
+ @click=${() => this.handleCategoryClick(category)}
91
+ >
92
+ ${msg("Explore")}
93
+ </coras-button>
94
+ </coras-explore-card>
95
+ `;
96
+ }
97
+ render() {
98
+ return this.categoriesTask.render({
99
+ complete: (categories) => {
100
+ const location = this.locationName;
101
+ if (!location || categories.length < MIN_CATEGORIES) {
102
+ return nothing;
103
+ }
104
+ return html `
105
+ <section>
106
+ <h2>${msg(str `See what ${location} has to offer`)}</h2>
107
+ <coras-carousel assets-url=${this.assetsURL}>
108
+ ${categories.map((category) => this.renderCategory(category))}
109
+ </coras-carousel>
110
+ </section>
111
+ `;
112
+ },
113
+ });
114
+ }
115
+ };
116
+ __decorate([
117
+ property({ type: String })
118
+ ], CorasLocationCategories.prototype, "country", void 0);
119
+ __decorate([
120
+ property({ type: String })
121
+ ], CorasLocationCategories.prototype, "city", void 0);
122
+ __decorate([
123
+ property({ type: String, attribute: "country-code" })
124
+ ], CorasLocationCategories.prototype, "countryCode", void 0);
125
+ __decorate([
126
+ property({ type: String, attribute: "location-name" })
127
+ ], CorasLocationCategories.prototype, "locationName", void 0);
128
+ __decorate([
129
+ consume({ context: clientContext, subscribe: true })
130
+ ], CorasLocationCategories.prototype, "client", void 0);
131
+ __decorate([
132
+ consume({ context: distributorIdContext, subscribe: true })
133
+ ], CorasLocationCategories.prototype, "distributorID", void 0);
134
+ __decorate([
135
+ consume({ context: assetsURLContext, subscribe: true })
136
+ ], CorasLocationCategories.prototype, "assetsURL", void 0);
137
+ __decorate([
138
+ consume({ context: localeContext, subscribe: true })
139
+ ], CorasLocationCategories.prototype, "locale", void 0);
140
+ __decorate([
141
+ consume({ context: currencyContext, subscribe: true })
142
+ ], CorasLocationCategories.prototype, "currency", void 0);
143
+ __decorate([
144
+ consume({ context: pageDispatchContext })
145
+ ], CorasLocationCategories.prototype, "dispatchPageUpdate", void 0);
146
+ CorasLocationCategories = __decorate([
147
+ localized()
148
+ ], CorasLocationCategories);
149
+ export { CorasLocationCategories };
@@ -0,0 +1,8 @@
1
+ import { CorasLocationCategories } from "./location-categories.component.js";
2
+ export * from "./location-categories.component.js";
3
+ export default CorasLocationCategories;
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ "coras-location-categories": CorasLocationCategories;
7
+ }
8
+ }
@@ -0,0 +1,6 @@
1
+ import { CorasLocationCategories } from "./location-categories.component.js";
2
+ export * from "./location-categories.component.js";
3
+ export default CorasLocationCategories;
4
+ if (!customElements.get("coras-location-categories")) {
5
+ customElements.define("coras-location-categories", CorasLocationCategories);
6
+ }
@@ -0,0 +1,35 @@
1
+ import { css } from "lit";
2
+ import component from "../../../../styles/defaults/component.js";
3
+ export default css `
4
+ ${component}
5
+
6
+ :host {
7
+ --location-categories-header-color: var(--coras-color-text);
8
+ --location-categories-header-font-size: var(--coras-font-size-2xl);
9
+ --location-categories-header-font-weight: var(--coras-font-weight-semibold);
10
+
11
+ display: block;
12
+
13
+ section {
14
+ padding-top: 3rem;
15
+ }
16
+
17
+ h2 {
18
+ margin: 0 0 1.5rem;
19
+ font-size: var(--location-categories-header-font-size);
20
+ font-weight: var(--location-categories-header-font-weight);
21
+ color: var(--location-categories-header-color);
22
+ }
23
+
24
+ coras-explore-card {
25
+ display: flex;
26
+ width: 160px;
27
+ flex-shrink: 0;
28
+ }
29
+
30
+ coras-carousel::part(carousel) {
31
+ gap: 1.875rem;
32
+ padding-bottom: 0.5rem;
33
+ }
34
+ }
35
+ `;
@@ -0,0 +1,26 @@
1
+ import { type CSSResultGroup, LitElement, nothing } from "lit";
2
+ import type { Client } from "openapi-fetch";
3
+ import "../../../../components/attraction-card/short/attraction-short-card.js";
4
+ import { type PageDispatchInput } from "../../../../contexts/events.context.js";
5
+ import type { paths } from "../../../../core/types/api-schema.js";
6
+ import type { SupportedCurrencies, SupportedLocales } from "../../../../core/types/index.js";
7
+ export declare class CorasLocationHighlights extends LitElement {
8
+ static styles: CSSResultGroup;
9
+ /** Country slug, as `/landing` and the landing page understand it. */
10
+ country: string;
11
+ /** City slug, empty for an attraction that is only country-scoped. */
12
+ city: string;
13
+ /** Display name of the location, used in the heading. */
14
+ locationName: string;
15
+ /** The attraction being viewed, so the row never links back to itself. */
16
+ excludeId: string;
17
+ client: Client<paths>;
18
+ distributorID: string;
19
+ locale: SupportedLocales;
20
+ currency: SupportedCurrencies;
21
+ dispatchPageUpdate: (params: PageDispatchInput) => void;
22
+ private highlightsTask;
23
+ private handleCardClick;
24
+ private renderCard;
25
+ render(): typeof nothing | import("lit").TemplateResult<1> | undefined;
26
+ }
@@ -0,0 +1,158 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { LitElement, html, nothing } from "lit";
8
+ import { property } from "lit/decorators.js";
9
+ import { consume } from "@lit/context";
10
+ import { localized, msg, str } from "@lit/localize";
11
+ import { Task } from "@lit/task";
12
+ import { formatISO, parseISO } from "date-fns";
13
+ import "../../../../components/attraction-card/short/attraction-short-card.js";
14
+ import { apiGet } from "../../../../core/api/queries.js";
15
+ import { APIError } from "../../../../core/api/api-error.js";
16
+ import { convertToLocaleCurrency } from "../../../../core/currency/index.js";
17
+ import { clientContext } from "../../../../contexts/client.context.js";
18
+ import { currencyContext, distributorIdContext, localeContext, } from "../../../../contexts/properties.context.js";
19
+ import { pageDispatchContext, } from "../../../../contexts/events.context.js";
20
+ import styles from "./location-highlights.styles.js";
21
+ /**
22
+ * The row is designed as a single full width of cards. A partial row reads as
23
+ * a rendering fault rather than as a short list, so the section is dropped
24
+ * when the location cannot fill it.
25
+ */
26
+ const CARDS_PER_ROW = 4;
27
+ let CorasLocationHighlights = class CorasLocationHighlights extends LitElement {
28
+ constructor() {
29
+ super(...arguments);
30
+ /** Country slug, as `/landing` and the landing page understand it. */
31
+ this.country = "";
32
+ /** City slug, empty for an attraction that is only country-scoped. */
33
+ this.city = "";
34
+ /** Display name of the location, used in the heading. */
35
+ this.locationName = "";
36
+ /** The attraction being viewed, so the row never links back to itself. */
37
+ this.excludeId = "";
38
+ this.highlightsTask = new Task(this, {
39
+ task: async ([locale, currency, country, city, excludeId]) => {
40
+ if (!this.client || (!country && !city)) {
41
+ return [];
42
+ }
43
+ let data;
44
+ try {
45
+ ({ data } = await apiGet({
46
+ client: this.client,
47
+ distributorID: this.distributorID,
48
+ locale,
49
+ endpoint: "/{api_version}/landing",
50
+ query: { country, city, currency },
51
+ }));
52
+ }
53
+ catch (error) {
54
+ // An optional section: when its request fails it hides itself
55
+ // rather than showing an error.
56
+ if (error instanceof APIError) {
57
+ return [];
58
+ }
59
+ throw error;
60
+ }
61
+ const section = data?.find((candidate) => candidate.type === "short-card");
62
+ const cards = (section?.items ?? []);
63
+ return cards.filter((card) => card.id !== excludeId);
64
+ },
65
+ args: () => [
66
+ this.locale,
67
+ this.currency,
68
+ this.country,
69
+ this.city,
70
+ this.excludeId,
71
+ ],
72
+ });
73
+ }
74
+ static { this.styles = styles; }
75
+ handleCardClick(card) {
76
+ this.dispatchPageUpdate({
77
+ page: "details",
78
+ id: card.id,
79
+ date: formatISO(parseISO(card.date), { representation: "date" }),
80
+ locale: this.locale,
81
+ currency: this.currency,
82
+ });
83
+ }
84
+ renderCard(card) {
85
+ const price = card.price[this.currency];
86
+ return html `
87
+ <coras-attraction-short-card
88
+ .images=${card.images}
89
+ ?label=${false}
90
+ name=${card.title}
91
+ rating=${card.rating || 0}
92
+ price=${price !== undefined
93
+ ? convertToLocaleCurrency({
94
+ value: price,
95
+ locale: this.locale,
96
+ currency: this.currency,
97
+ })
98
+ : ""}
99
+ category=${card.category.slug}
100
+ date=${card.date}
101
+ timezone=${card.timezone}
102
+ locale=${this.locale}
103
+ @click=${() => this.handleCardClick(card)}
104
+ ></coras-attraction-short-card>
105
+ `;
106
+ }
107
+ render() {
108
+ return this.highlightsTask.render({
109
+ complete: (cards) => {
110
+ const location = this.locationName;
111
+ if (!location || cards.length < CARDS_PER_ROW) {
112
+ return nothing;
113
+ }
114
+ return html `
115
+ <section>
116
+ <h2>${msg(str `Other ${location} highlights`)}</h2>
117
+ <div class="cards">
118
+ ${cards
119
+ .slice(0, CARDS_PER_ROW)
120
+ .map((card) => this.renderCard(card))}
121
+ </div>
122
+ </section>
123
+ `;
124
+ },
125
+ });
126
+ }
127
+ };
128
+ __decorate([
129
+ property({ type: String })
130
+ ], CorasLocationHighlights.prototype, "country", void 0);
131
+ __decorate([
132
+ property({ type: String })
133
+ ], CorasLocationHighlights.prototype, "city", void 0);
134
+ __decorate([
135
+ property({ type: String, attribute: "location-name" })
136
+ ], CorasLocationHighlights.prototype, "locationName", void 0);
137
+ __decorate([
138
+ property({ type: String, attribute: "exclude-id" })
139
+ ], CorasLocationHighlights.prototype, "excludeId", void 0);
140
+ __decorate([
141
+ consume({ context: clientContext, subscribe: true })
142
+ ], CorasLocationHighlights.prototype, "client", void 0);
143
+ __decorate([
144
+ consume({ context: distributorIdContext, subscribe: true })
145
+ ], CorasLocationHighlights.prototype, "distributorID", void 0);
146
+ __decorate([
147
+ consume({ context: localeContext, subscribe: true })
148
+ ], CorasLocationHighlights.prototype, "locale", void 0);
149
+ __decorate([
150
+ consume({ context: currencyContext, subscribe: true })
151
+ ], CorasLocationHighlights.prototype, "currency", void 0);
152
+ __decorate([
153
+ consume({ context: pageDispatchContext })
154
+ ], CorasLocationHighlights.prototype, "dispatchPageUpdate", void 0);
155
+ CorasLocationHighlights = __decorate([
156
+ localized()
157
+ ], CorasLocationHighlights);
158
+ export { CorasLocationHighlights };
@@ -0,0 +1,8 @@
1
+ import { CorasLocationHighlights } from "./location-highlights.component.js";
2
+ export * from "./location-highlights.component.js";
3
+ export default CorasLocationHighlights;
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ "coras-location-highlights": CorasLocationHighlights;
7
+ }
8
+ }
@@ -0,0 +1,6 @@
1
+ import { CorasLocationHighlights } from "./location-highlights.component.js";
2
+ export * from "./location-highlights.component.js";
3
+ export default CorasLocationHighlights;
4
+ if (!customElements.get("coras-location-highlights")) {
5
+ customElements.define("coras-location-highlights", CorasLocationHighlights);
6
+ }
@@ -0,0 +1,42 @@
1
+ import { css } from "lit";
2
+ import component from "../../../../styles/defaults/component.js";
3
+ export default css `
4
+ ${component}
5
+
6
+ :host {
7
+ --location-highlights-header-color: var(--coras-color-text);
8
+ --location-highlights-header-font-size: var(--coras-font-size-2xl);
9
+ --location-highlights-header-font-weight: var(--coras-font-weight-semibold);
10
+
11
+ display: block;
12
+
13
+ section {
14
+ padding-top: 3rem;
15
+ }
16
+
17
+ h2 {
18
+ margin: 0 0 1.5rem;
19
+ font-size: var(--location-highlights-header-font-size);
20
+ font-weight: var(--location-highlights-header-font-weight);
21
+ color: var(--location-highlights-header-color);
22
+ }
23
+
24
+ .cards {
25
+ display: grid;
26
+ grid-template-columns: repeat(4, 1fr);
27
+ gap: 1rem;
28
+ }
29
+ }
30
+
31
+ @container (max-width: 800px) {
32
+ :host .cards {
33
+ grid-template-columns: repeat(2, 1fr);
34
+ }
35
+ }
36
+
37
+ @container (max-width: 500px) {
38
+ :host .cards {
39
+ grid-template-columns: repeat(1, 1fr);
40
+ }
41
+ }
42
+ `;