@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,6 +1,6 @@
1
1
  import { msg, str } from "@lit/localize";
2
2
  import { OTP_INACTIVITY_TIMEOUT_MS, OTP_MIN_RESEND_INTERVAL_MS, OTP_MAX_ATTEMPTS_PER_SESSION, SMS_OTP_MIN_RESEND_INTERVAL_MS, SMS_OTP_MAX_ATTEMPTS_PER_SESSION, } from "../payment-page.constants.js";
3
- import { sanitizeErrorMessage } from "../payment-page.utils.js";
3
+ import { sanitizeErrorMessage, toE164 } from "../payment-page.utils.js";
4
4
  /**
5
5
  * CryptoAuthController manages the OTP email authentication and MFA enrollment
6
6
  * flows for crypto payments.
@@ -12,6 +12,8 @@ import { sanitizeErrorMessage } from "../payment-page.utils.js";
12
12
  */
13
13
  export class CryptoAuthController {
14
14
  constructor(host, deps) {
15
+ /** True while a CDP auth call (send, login, MFA enrolment) is in flight. */
16
+ this.isAuthenticating = false;
15
17
  this.otpCode = "";
16
18
  this.otpError = "";
17
19
  this.showResend = false;
@@ -92,16 +94,19 @@ export class CryptoAuthController {
92
94
  return;
93
95
  }
94
96
  this.otpRateLimitError = "";
97
+ this.beginAuthCall();
95
98
  try {
96
99
  await this.deps.sendCode(email);
97
100
  this.otpAttempts += 1;
98
101
  this.lastOtpSentTime = Date.now();
99
- this.host.requestUpdate();
100
102
  }
101
103
  catch (error) {
102
- console.error("Error sending verification code:", error);
104
+ this.deps.logger.error("Error sending verification code:", error);
103
105
  setEmailError(sanitizeErrorMessage(error, msg("Failed to send verification code. Please try again.")));
104
106
  }
107
+ finally {
108
+ this.endAuthCall();
109
+ }
105
110
  }
106
111
  async handleResendCode(email, codeSent, hasSession) {
107
112
  const rateLimitError = this.checkOtpRateLimit();
@@ -111,6 +116,7 @@ export class CryptoAuthController {
111
116
  return;
112
117
  }
113
118
  this.otpRateLimitError = "";
119
+ this.beginAuthCall();
114
120
  try {
115
121
  await this.deps.sendCode(email);
116
122
  this.otpAttempts += 1;
@@ -119,46 +125,49 @@ export class CryptoAuthController {
119
125
  this.otpError = "";
120
126
  this.showResend = false;
121
127
  this.startOtpInactivityTimer(codeSent, hasSession);
122
- this.host.requestUpdate();
123
128
  }
124
129
  catch (error) {
125
- console.error("Error resending verification code:", error);
130
+ this.deps.logger.error("Error resending verification code:", error);
131
+ // The OTP step shows otpError; the email field error is not visible there.
132
+ this.otpError = sanitizeErrorMessage(error, msg("Failed to resend the verification code. Please try again."));
133
+ }
134
+ finally {
135
+ this.endAuthCall();
126
136
  }
127
137
  }
128
138
  async handleLogin(email) {
139
+ if (!this.otpCode) {
140
+ this.otpError = msg("Please enter the verification code");
141
+ this.host.requestUpdate();
142
+ return;
143
+ }
144
+ this.beginAuthCall();
129
145
  try {
130
- if (!this.otpCode) {
131
- this.otpError = msg("Please enter the verification code");
132
- this.host.requestUpdate();
133
- return;
134
- }
135
146
  const session = await this.deps.loginWithCode(email, this.otpCode);
136
147
  if (!session) {
137
148
  this.otpError = msg("Login failed. Please try again.");
138
- this.host.requestUpdate();
139
149
  return;
140
150
  }
141
151
  this.otpError = "";
142
152
  await this.deps.onLoginSuccess();
143
153
  this.deps.onBalanceRefresh();
144
- this.host.requestUpdate();
145
154
  }
146
155
  catch (error) {
147
156
  this.otpError = sanitizeErrorMessage(error, msg("Invalid or expired code. Please try again."));
148
- this.host.requestUpdate();
157
+ }
158
+ finally {
159
+ this.endAuthCall();
149
160
  }
150
161
  }
151
162
  // ─── MFA Enrollment ─────────────────────────────────────────────────────────
152
163
  /**
153
- * Gets the full phone number for MFA enrollment, combining the selected
154
- * code with the local number.
164
+ * Gets the E.164 phone number for MFA enrollment from the local number and
165
+ * the selected country (falling back to the payment form's country).
155
166
  */
156
- getFullPhoneNumber(fallbackPhoneCode) {
157
- const mfaPhoneCode = this.mfaSelectedPhoneCode?.phoneCode || fallbackPhoneCode;
158
- const phoneNumber = this.localPhoneNumber.replace(/^[+0]+/, "");
159
- return `+${mfaPhoneCode}${phoneNumber}`;
167
+ getFullPhoneNumber(fallbackCountryCode) {
168
+ return (toE164(this.localPhoneNumber, this.mfaSelectedPhoneCode?.code || fallbackCountryCode) ?? "");
160
169
  }
161
- async handleMfaEnrollmentWithFormPhone(formPhone, useFormPhone, fallbackPhoneCode, setEnrollmentError) {
170
+ async handleMfaEnrollmentWithFormPhone(formPhone, useFormPhone, fallbackCountryCode, setEnrollmentError) {
162
171
  const smsRateLimit = this.checkSmsRateLimit();
163
172
  if (smsRateLimit) {
164
173
  this.smsRateLimitError = smsRateLimit;
@@ -172,7 +181,7 @@ export class CryptoAuthController {
172
181
  phoneNumber = formPhone;
173
182
  }
174
183
  else {
175
- phoneNumber = this.getFullPhoneNumber(fallbackPhoneCode);
184
+ phoneNumber = this.getFullPhoneNumber(fallbackCountryCode);
176
185
  }
177
186
  // Guard against invalid values: empty, bare "+", or too short to be E.164
178
187
  if (!phoneNumber || !/^\+[1-9]\d{7,14}$/.test(phoneNumber)) {
@@ -180,39 +189,51 @@ export class CryptoAuthController {
180
189
  this.host.requestUpdate();
181
190
  return;
182
191
  }
192
+ this.beginAuthCall();
183
193
  await this.deps.initiateMfaEnrollment(phoneNumber);
184
194
  this.smsAttempts += 1;
185
195
  this.lastSmsSentTime = Date.now();
186
196
  this.mfaEnrollmentPhoneNumber = phoneNumber;
187
- this.host.requestUpdate();
188
197
  }
189
198
  catch (error) {
190
- console.error("MFA enrollment initiation failed:", error);
199
+ this.deps.logger.error("MFA enrollment initiation failed:", error);
191
200
  setEnrollmentError(sanitizeErrorMessage(error, msg("Failed to initiate MFA enrollment")));
192
201
  }
202
+ finally {
203
+ this.endAuthCall();
204
+ }
193
205
  }
194
206
  async handleVerifyMfaEnrollment() {
207
+ if (!this.mfaCode) {
208
+ this.mfaError = msg("Please enter the verification code");
209
+ this.host.requestUpdate();
210
+ return;
211
+ }
212
+ this.beginAuthCall();
195
213
  try {
196
- if (!this.mfaCode) {
197
- this.mfaError = msg("Please enter the verification code");
198
- this.host.requestUpdate();
199
- return;
200
- }
201
214
  const success = await this.deps.submitMfaEnrollment(this.mfaCode);
202
215
  if (!success) {
203
216
  this.mfaError = msg("Verification failed. Please try again.");
204
- this.host.requestUpdate();
205
217
  return;
206
218
  }
207
219
  this.mfaError = "";
208
220
  this.mfaCode = "";
209
221
  this.deps.onMfaEnrollmentComplete();
210
- this.host.requestUpdate();
211
222
  }
212
223
  catch (error) {
213
224
  this.mfaError = sanitizeErrorMessage(error, msg("Invalid or expired verification code. Please try again."));
214
- this.host.requestUpdate();
215
225
  }
226
+ finally {
227
+ this.endAuthCall();
228
+ }
229
+ }
230
+ beginAuthCall() {
231
+ this.isAuthenticating = true;
232
+ this.host.requestUpdate();
233
+ }
234
+ endAuthCall() {
235
+ this.isAuthenticating = false;
236
+ this.host.requestUpdate();
216
237
  }
217
238
  handlePhoneEnrollmentChange(value) {
218
239
  this.localPhoneNumber = value;
@@ -231,6 +252,7 @@ export class CryptoAuthController {
231
252
  }
232
253
  // ─── Reset ──────────────────────────────────────────────────────────────────
233
254
  reset() {
255
+ this.isAuthenticating = false;
234
256
  this.otpCode = "";
235
257
  this.otpError = "";
236
258
  this.showResend = false;
@@ -1,6 +1,7 @@
1
1
  import type { ReactiveController, ReactiveControllerHost } from "lit";
2
2
  import type { TransferModalState } from "../../../components/transfer-modal/transfer-modal.component.js";
3
3
  import { type PendingTransferPayload } from "../payment-page.utils.js";
4
+ import type { Logger } from "../../../core/logger.js";
4
5
  /**
5
6
  * Result returned from the on-chain token transfer.
6
7
  */
@@ -17,6 +18,7 @@ export type TransferOutcome = "completed" | "failed";
17
18
  * Maps to CoinbaseMixin methods and other component APIs.
18
19
  */
19
20
  export interface CryptoTransferDeps {
21
+ logger: Logger;
20
22
  transferTokens(amount: string): Promise<TransferResult>;
21
23
  confirmReservation(): Promise<{
22
24
  transaction_id: string;
@@ -24,7 +26,8 @@ export interface CryptoTransferDeps {
24
26
  } | null>;
25
27
  checkTransactionStatus(userId: string): Promise<string | null>;
26
28
  showErrorModalOnce(): void;
27
- redirectToConfirmation(success: boolean): void;
29
+ /** Moves the page to success, failure or pending for a polled status */
30
+ settleTransaction(status: string | null): void;
28
31
  refreshBalance(): void;
29
32
  submitMfaVerification(code: string): Promise<boolean>;
30
33
  initiateMfaVerification(): Promise<void>;
@@ -54,7 +57,6 @@ export declare class CryptoTransferController implements ReactiveController {
54
57
  showTransferModal: boolean;
55
58
  transferModalState: TransferModalState;
56
59
  transferTransactionHash: string;
57
- transferErrorMessage: string;
58
60
  mfaVerificationError: string;
59
61
  mfaVerificationLoading: boolean;
60
62
  constructor(host: ReactiveControllerHost, deps: CryptoTransferDeps);
@@ -69,7 +71,7 @@ export declare class CryptoTransferController implements ReactiveController {
69
71
  * Handles successful on-chain transfer - confirms reservation with API.
70
72
  * Persists the transaction hash BEFORE calling the API for crash recovery.
71
73
  */
72
- handleTransferSuccess(transactionHash: string): Promise<TransferOutcome>;
74
+ handleTransferSuccess(transactionHash: string, amount: string): Promise<TransferOutcome>;
73
75
  /**
74
76
  * Opens the transfer modal for MFA verification.
75
77
  * Called from the component when MFA fires during transfer.
@@ -78,12 +80,14 @@ export declare class CryptoTransferController implements ReactiveController {
78
80
  handleMfaCodeSubmitted(code: string): Promise<void>;
79
81
  handleMfaResendRequested(): Promise<void>;
80
82
  handleTransferCancelled(): void;
81
- persistPendingTransfer(transactionHash: string): Promise<void>;
83
+ persistPendingTransfer(transactionHash: string, amount: string): Promise<void>;
82
84
  clearPendingTransfer(): void;
83
85
  private updatePendingTransferPhase;
84
86
  /**
85
87
  * Checks for a pending transfer that wasn't confirmed with the backend.
86
- * Called once on initialization to recover from crashes/failures.
88
+ * Called once by the host, after CDP restored the session and the basket
89
+ * is known, to recover from crashes/failures. Silent on failure: the
90
+ * payload stays for the next submit, which retries it explicitly.
87
91
  */
88
92
  recoverPendingTransfer(): Promise<void>;
89
93
  /**
@@ -1,3 +1,4 @@
1
+ import { msg } from "@lit/localize";
1
2
  import { isValidPendingTransferPayload, computeTransferChecksum, verifyTransferChecksum, sanitizeErrorMessage, } from "../payment-page.utils.js";
2
3
  const PENDING_TRANSFER_KEY = "coras-pending-crypto-transfer";
3
4
  const ONE_HOUR_MS = 60 * 60 * 1000;
@@ -16,7 +17,6 @@ export class CryptoTransferController {
16
17
  this.showTransferModal = false;
17
18
  this.transferModalState = "mfa-verification";
18
19
  this.transferTransactionHash = "";
19
- this.transferErrorMessage = "";
20
20
  this.mfaVerificationError = "";
21
21
  this.mfaVerificationLoading = false;
22
22
  this.host = host;
@@ -34,8 +34,12 @@ export class CryptoTransferController {
34
34
  */
35
35
  async startTransfer() {
36
36
  this.mfaVerificationError = "";
37
+ // Captured before the transfer: the mixin clears its pending amount once
38
+ // the user operation settles, and the persisted payload must carry the
39
+ // amount that actually left the wallet.
40
+ const amount = this.deps.getPendingTransferAmount();
37
41
  try {
38
- const result = await this.deps.transferTokens(this.deps.getPendingTransferAmount());
42
+ const result = await this.deps.transferTokens(amount);
39
43
  if (!result.success || !result.transactionHash) {
40
44
  this.showTransferModal = false;
41
45
  this.transferModalState = "mfa-verification";
@@ -43,10 +47,10 @@ export class CryptoTransferController {
43
47
  this.deps.showErrorModalOnce();
44
48
  return "failed";
45
49
  }
46
- return await this.handleTransferSuccess(result.transactionHash);
50
+ return await this.handleTransferSuccess(result.transactionHash, amount);
47
51
  }
48
52
  catch (error) {
49
- console.error("Transfer error:", error);
53
+ this.deps.logger.error("Transfer error:", error);
50
54
  this.showTransferModal = false;
51
55
  this.transferModalState = "mfa-verification";
52
56
  this.host.requestUpdate();
@@ -61,11 +65,11 @@ export class CryptoTransferController {
61
65
  * Handles successful on-chain transfer - confirms reservation with API.
62
66
  * Persists the transaction hash BEFORE calling the API for crash recovery.
63
67
  */
64
- async handleTransferSuccess(transactionHash) {
68
+ async handleTransferSuccess(transactionHash, amount) {
65
69
  this.transferModalState = "loading";
66
70
  this.transferTransactionHash = transactionHash;
67
71
  this.host.requestUpdate();
68
- await this.persistPendingTransfer(transactionHash);
72
+ await this.persistPendingTransfer(transactionHash, amount);
69
73
  this.deps.setTransactionId(transactionHash);
70
74
  const confirmationResult = await this.deps.confirmReservation();
71
75
  if (!confirmationResult) {
@@ -82,7 +86,7 @@ export class CryptoTransferController {
82
86
  this.showTransferModal = false;
83
87
  this.transferModalState = "mfa-verification";
84
88
  this.host.requestUpdate();
85
- this.deps.redirectToConfirmation(finalStatus === "PAID");
89
+ this.deps.settleTransaction(finalStatus);
86
90
  return "completed";
87
91
  }
88
92
  // ─── MFA Verification (during transfer) ─────────────────────────────────────
@@ -105,8 +109,8 @@ export class CryptoTransferController {
105
109
  this.transferModalState = "loading";
106
110
  }
107
111
  catch (error) {
108
- console.error("MFA verification error:", error);
109
- this.mfaVerificationError = sanitizeErrorMessage(error, "Verification failed");
112
+ this.deps.logger.error("MFA verification error:", error);
113
+ this.mfaVerificationError = sanitizeErrorMessage(error, msg("Verification failed"));
110
114
  }
111
115
  finally {
112
116
  this.mfaVerificationLoading = false;
@@ -120,8 +124,8 @@ export class CryptoTransferController {
120
124
  await this.deps.initiateMfaVerification();
121
125
  }
122
126
  catch (error) {
123
- console.error("Failed to resend MFA code:", error);
124
- this.mfaVerificationError = sanitizeErrorMessage(error, "Failed to resend code");
127
+ this.deps.logger.error("Failed to resend MFA code:", error);
128
+ this.mfaVerificationError = sanitizeErrorMessage(error, msg("Failed to resend code"));
125
129
  this.host.requestUpdate();
126
130
  }
127
131
  }
@@ -134,13 +138,13 @@ export class CryptoTransferController {
134
138
  this.host.requestUpdate();
135
139
  }
136
140
  // ─── Pending Transfer Persistence ───────────────────────────────────────────
137
- async persistPendingTransfer(transactionHash) {
141
+ async persistPendingTransfer(transactionHash, amount) {
138
142
  try {
139
143
  const timestamp = Date.now();
140
- const checksum = await computeTransferChecksum(transactionHash, this.deps.getPendingTransferAmount(), timestamp);
144
+ const checksum = await computeTransferChecksum(transactionHash, amount, timestamp);
141
145
  const data = {
142
146
  transactionHash,
143
- amount: this.deps.getPendingTransferAmount(),
147
+ amount,
144
148
  timestamp,
145
149
  checksum,
146
150
  phase: "transfer_submitted",
@@ -174,38 +178,22 @@ export class CryptoTransferController {
174
178
  }
175
179
  /**
176
180
  * Checks for a pending transfer that wasn't confirmed with the backend.
177
- * Called once on initialization to recover from crashes/failures.
181
+ * Called once by the host, after CDP restored the session and the basket
182
+ * is known, to recover from crashes/failures. Silent on failure: the
183
+ * payload stays for the next submit, which retries it explicitly.
178
184
  */
179
185
  async recoverPendingTransfer() {
180
186
  try {
181
- const raw = localStorage.getItem(PENDING_TRANSFER_KEY);
182
- if (!raw)
183
- return;
184
- const data = JSON.parse(raw);
185
- if (!isValidPendingTransferPayload(data)) {
186
- this.clearPendingTransfer();
187
- return;
188
- }
189
- if (Date.now() - data.timestamp > ONE_HOUR_MS) {
190
- this.clearPendingTransfer();
191
- return;
192
- }
193
- const checksumValid = await verifyTransferChecksum(data);
194
- if (!checksumValid) {
195
- console.warn("Pending transfer recovery rejected: checksum verification failed. " +
196
- "Local recovery data is treated as a hint only.");
197
- this.clearPendingTransfer();
187
+ const data = await this.getValidPendingTransfer();
188
+ if (!data)
198
189
  return;
199
- }
200
190
  this.deps.setTransactionId(data.transactionHash);
201
191
  this.transferTransactionHash = data.transactionHash;
202
192
  const confirmationResult = await this.deps.confirmReservation();
203
193
  if (confirmationResult) {
204
194
  this.clearPendingTransfer();
205
195
  const finalStatus = await this.deps.checkTransactionStatus(confirmationResult.user_id);
206
- if (finalStatus === "PAID") {
207
- this.deps.redirectToConfirmation(true);
208
- }
196
+ this.deps.settleTransaction(finalStatus);
209
197
  }
210
198
  }
211
199
  catch {
@@ -258,7 +246,7 @@ export class CryptoTransferController {
258
246
  if (confirmationResult) {
259
247
  this.clearPendingTransfer();
260
248
  const finalStatus = await this.deps.checkTransactionStatus(confirmationResult.user_id);
261
- this.deps.redirectToConfirmation(finalStatus === "PAID");
249
+ this.deps.settleTransaction(finalStatus);
262
250
  return "completed";
263
251
  }
264
252
  else {
@@ -267,7 +255,7 @@ export class CryptoTransferController {
267
255
  }
268
256
  }
269
257
  catch (error) {
270
- console.error("Pending transfer retry failed:", error);
258
+ this.deps.logger.error("Pending transfer retry failed:", error);
271
259
  this.deps.showErrorModalOnce();
272
260
  return "failed";
273
261
  }
@@ -280,7 +268,6 @@ export class CryptoTransferController {
280
268
  this.showTransferModal = false;
281
269
  this.transferModalState = "mfa-verification";
282
270
  this.transferTransactionHash = "";
283
- this.transferErrorMessage = "";
284
271
  this.mfaVerificationError = "";
285
272
  this.mfaVerificationLoading = false;
286
273
  this.host.requestUpdate();
@@ -6,9 +6,14 @@ import type { ReactiveController, ReactiveControllerHost } from "lit";
6
6
  * idle ──▶ validating ──▶ auth_required (crypto only, user must log in)
7
7
  * ──▶ confirming ──▶ processing_payment ──▶ polling ──▶ success
8
8
  * ──▶ failed
9
+ * ──▶ pending
9
10
  * failed ──▶ idle (via retry)
11
+ * pending ──▶ polling (via check again)
12
+ *
13
+ * `pending`: the charge went through but the API had not reported a final
14
+ * transaction status within the polling budget.
10
15
  */
11
- export type SubmitState = "idle" | "validating" | "auth_required" | "confirming" | "processing_payment" | "polling" | "success" | "failed";
16
+ export type SubmitState = "idle" | "validating" | "auth_required" | "confirming" | "processing_payment" | "polling" | "success" | "failed" | "pending";
12
17
  /**
13
18
  * PaymentFlowController manages the submit lifecycle as a deterministic state machine.
14
19
  * Every terminal path (success, failed, idle via retry) guarantees isProcessing === false.
@@ -5,6 +5,7 @@ const NON_PROCESSING_STATES = new Set([
5
5
  "idle",
6
6
  "success",
7
7
  "failed",
8
+ "pending",
8
9
  "auth_required",
9
10
  ]);
10
11
  /**
@@ -2,6 +2,7 @@ import type { ReactiveController, ReactiveControllerHost } from "lit";
2
2
  import type { PaymentMethod, PaymentRequestPaymentMethodEvent } from "@stripe/stripe-js";
3
3
  import type { StripeComponent, CustomerData } from "../payment-page.types.js";
4
4
  import type { PaymentFiatMethodType } from "../../../components/payment-fiat-method/payment-fiat-method.component.js";
5
+ import type { Logger } from "../../../core/logger.js";
5
6
  /**
6
7
  * StripePaymentController manages Stripe-specific payment processing:
7
8
  * - Card payment confirmation
@@ -11,19 +12,27 @@ import type { PaymentFiatMethodType } from "../../../components/payment-fiat-met
11
12
  */
12
13
  export declare class StripePaymentController implements ReactiveController {
13
14
  private host;
15
+ private logger;
14
16
  authorizedPaymentMethod: PaymentMethod | null;
15
17
  authorizedPaymentEvent: PaymentRequestPaymentMethodEvent | null;
16
18
  cardError: string;
17
19
  cardNumberErrorExt: string;
18
20
  cardExpiryErrorExt: string;
19
21
  cardCvcErrorExt: string;
20
- constructor(host: ReactiveControllerHost);
22
+ constructor(host: ReactiveControllerHost, logger: Logger);
21
23
  hostConnected(): void;
22
24
  hostDisconnected(): void;
23
25
  /**
24
26
  * Store the authorized payment method from Apple Pay / Google Pay.
25
27
  */
26
28
  setAuthorizedPayment(paymentMethod: PaymentMethod, event: PaymentRequestPaymentMethodEvent): void;
29
+ /**
30
+ * Abandon a wallet authorisation that will not be charged: closes the
31
+ * Apple Pay / Google Pay sheet with "fail" and forgets the PaymentMethod so
32
+ * the next submit opens a fresh sheet instead of reusing a dead event.
33
+ * No-op when nothing is authorised.
34
+ */
35
+ abortAuthorizedPayment(): void;
27
36
  /**
28
37
  * Clear all Stripe field-level errors.
29
38
  */
@@ -49,8 +58,17 @@ export declare class StripePaymentController implements ReactiveController {
49
58
  *
50
59
  * Returns true if payment was successful, false otherwise.
51
60
  * Sets error state on the controller for the host to render.
61
+ *
62
+ * The charged amount is not checked here, and deliberately so. It is fixed by
63
+ * the server when it creates the PaymentIntent and reaches this client only
64
+ * as an opaque `client_secret`, so nothing on this side can alter it. A
65
+ * comparison here could only ever restate one server value against another,
66
+ * and the only point at which the client learns the confirmed amount is after
67
+ * `confirmCardPayment` has already taken the money - failing then would show
68
+ * an error for a payment that went through. The amount is the server's
69
+ * invariant to hold.
52
70
  */
53
- processPayment(clientSecret: string, stripeComponent: StripeComponent, paymentMethod: PaymentFiatMethodType, customer: CustomerData, _expectedAmount: number): Promise<boolean>;
71
+ processPayment(clientSecret: string, stripeComponent: StripeComponent, paymentMethod: PaymentFiatMethodType, customer: CustomerData): Promise<boolean>;
54
72
  /**
55
73
  * Handle the result of a Stripe card validation error.
56
74
  * Maps the Stripe error to the appropriate field and sets errors.
@@ -1,3 +1,4 @@
1
+ import { msg } from "@lit/localize";
1
2
  import { mapStripeErrorToField, extractPaymentIntentId, } from "../payment-page.utils.js";
2
3
  /**
3
4
  * StripePaymentController manages Stripe-specific payment processing:
@@ -7,7 +8,7 @@ import { mapStripeErrorToField, extractPaymentIntentId, } from "../payment-page.
7
8
  * - Payment intent validation
8
9
  */
9
10
  export class StripePaymentController {
10
- constructor(host) {
11
+ constructor(host, logger) {
11
12
  this.authorizedPaymentMethod = null;
12
13
  this.authorizedPaymentEvent = null;
13
14
  this.cardError = "";
@@ -15,6 +16,7 @@ export class StripePaymentController {
15
16
  this.cardExpiryErrorExt = "";
16
17
  this.cardCvcErrorExt = "";
17
18
  this.host = host;
19
+ this.logger = logger;
18
20
  host.addController(this);
19
21
  }
20
22
  hostConnected() { }
@@ -30,6 +32,20 @@ export class StripePaymentController {
30
32
  this.authorizedPaymentEvent = event;
31
33
  this.host.requestUpdate();
32
34
  }
35
+ /**
36
+ * Abandon a wallet authorisation that will not be charged: closes the
37
+ * Apple Pay / Google Pay sheet with "fail" and forgets the PaymentMethod so
38
+ * the next submit opens a fresh sheet instead of reusing a dead event.
39
+ * No-op when nothing is authorised.
40
+ */
41
+ abortAuthorizedPayment() {
42
+ if (!this.authorizedPaymentEvent)
43
+ return;
44
+ this.authorizedPaymentEvent.complete("fail");
45
+ this.authorizedPaymentMethod = null;
46
+ this.authorizedPaymentEvent = null;
47
+ this.host.requestUpdate();
48
+ }
33
49
  /**
34
50
  * Clear all Stripe field-level errors.
35
51
  */
@@ -73,7 +89,7 @@ export class StripePaymentController {
73
89
  validatePaymentIntentFormat(clientSecret) {
74
90
  const intentId = extractPaymentIntentId(clientSecret);
75
91
  if (!intentId || !intentId.startsWith("pi_")) {
76
- console.error("Invalid payment intent format");
92
+ this.logger.error("Invalid payment intent format");
77
93
  return false;
78
94
  }
79
95
  return true;
@@ -83,19 +99,28 @@ export class StripePaymentController {
83
99
  *
84
100
  * Returns true if payment was successful, false otherwise.
85
101
  * Sets error state on the controller for the host to render.
102
+ *
103
+ * The charged amount is not checked here, and deliberately so. It is fixed by
104
+ * the server when it creates the PaymentIntent and reaches this client only
105
+ * as an opaque `client_secret`, so nothing on this side can alter it. A
106
+ * comparison here could only ever restate one server value against another,
107
+ * and the only point at which the client learns the confirmed amount is after
108
+ * `confirmCardPayment` has already taken the money - failing then would show
109
+ * an error for a payment that went through. The amount is the server's
110
+ * invariant to hold.
86
111
  */
87
- async processPayment(clientSecret, stripeComponent, paymentMethod, customer, _expectedAmount) {
112
+ async processPayment(clientSecret, stripeComponent, paymentMethod, customer) {
88
113
  const stripe = stripeComponent?.getStripe();
89
114
  const elements = stripeComponent?.getElements();
90
115
  const cardElement = stripeComponent?.getCardNumberElement();
91
116
  if (!stripe || !elements) {
92
- this.cardError = "Payment configuration error. Please try again.";
117
+ this.cardError = msg("Payment configuration error. Please try again.");
93
118
  this.host.requestUpdate();
94
119
  return false;
95
120
  }
96
121
  // Reject malformed client_secret values before they reach Stripe's SDK
97
122
  if (!this.validatePaymentIntentFormat(clientSecret)) {
98
- this.cardError = "Payment validation error. Please try again.";
123
+ this.cardError = msg("Payment validation error. Please try again.");
99
124
  this.host.requestUpdate();
100
125
  return false;
101
126
  }
@@ -103,7 +128,7 @@ export class StripePaymentController {
103
128
  return this.processPaymentRequest(stripe, clientSecret);
104
129
  }
105
130
  if (!cardElement) {
106
- this.cardError = "Payment configuration error. Please try again.";
131
+ this.cardError = msg("Payment configuration error. Please try again.");
107
132
  this.host.requestUpdate();
108
133
  return false;
109
134
  }
@@ -115,7 +140,7 @@ export class StripePaymentController {
115
140
  */
116
141
  handleStripeValidationError(error) {
117
142
  this.clearFieldErrors();
118
- const message = error.message || "Payment failed";
143
+ const message = error.message || msg("Payment failed");
119
144
  const field = mapStripeErrorToField(error);
120
145
  this.cardError = "";
121
146
  if (field) {
@@ -128,7 +153,7 @@ export class StripePaymentController {
128
153
  }
129
154
  async processPaymentRequest(stripe, clientSecret) {
130
155
  if (!this.authorizedPaymentMethod || !this.authorizedPaymentEvent) {
131
- this.cardError = "Payment authorization failed. Please try again.";
156
+ this.cardError = msg("Payment authorization failed. Please try again.");
132
157
  this.host.requestUpdate();
133
158
  return false;
134
159
  }
@@ -137,8 +162,8 @@ export class StripePaymentController {
137
162
  payment_method: this.authorizedPaymentMethod.id,
138
163
  });
139
164
  if (result.error) {
140
- console.error(`${this.authorizedPaymentEvent ? "wallet" : "card"} payment failed`);
141
- this.cardError = result.error.message || "Payment failed";
165
+ this.logger.error(`${this.authorizedPaymentEvent ? "wallet" : "card"} payment failed`);
166
+ this.cardError = result.error.message || msg("Payment failed");
142
167
  this.authorizedPaymentEvent.complete("fail");
143
168
  this.authorizedPaymentMethod = null;
144
169
  this.authorizedPaymentEvent = null;
@@ -152,9 +177,8 @@ export class StripePaymentController {
152
177
  return true;
153
178
  }
154
179
  catch {
155
- console.error("Error processing wallet payment");
156
- this.cardError =
157
- "An error occurred while processing your payment. Please try again.";
180
+ this.logger.error("Error processing wallet payment");
181
+ this.cardError = msg("An error occurred while processing your payment. Please try again.");
158
182
  if (this.authorizedPaymentEvent) {
159
183
  this.authorizedPaymentEvent.complete("fail");
160
184
  }
@@ -168,8 +192,8 @@ export class StripePaymentController {
168
192
  try {
169
193
  const paymentIntentId = extractPaymentIntentId(clientSecret);
170
194
  if (!paymentIntentId) {
171
- console.error("Invalid client secret format");
172
- this.cardError = "Invalid payment configuration. Please try again.";
195
+ this.logger.error("Invalid client secret format");
196
+ this.cardError = msg("Invalid payment configuration. Please try again.");
173
197
  this.host.requestUpdate();
174
198
  return false;
175
199
  }
@@ -185,16 +209,15 @@ export class StripePaymentController {
185
209
  },
186
210
  });
187
211
  if (result.error) {
188
- console.error("Payment failed");
212
+ this.logger.error("Card payment failed");
189
213
  this.handleStripeValidationError(result.error);
190
214
  return false;
191
215
  }
192
216
  return !!result.paymentIntent;
193
217
  }
194
218
  catch {
195
- console.error("Error processing payment");
196
- this.cardError =
197
- "An error occurred while processing your payment. Please try again.";
219
+ this.logger.error("Error processing payment");
220
+ this.cardError = msg("An error occurred while processing your payment. Please try again.");
198
221
  this.host.requestUpdate();
199
222
  return false;
200
223
  }