@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.
- package/CHANGELOG.md +34 -0
- package/README.md +15 -2
- package/dist/components/accordion/accordion-item/accordion-item.component.js +9 -3
- package/dist/components/accordion/accordion-item/accordion-item.styles.js +4 -0
- package/dist/components/accordion/accordion.component.js +8 -0
- package/dist/components/alert/alert.component.d.ts +1 -1
- package/dist/components/alert/alert.component.js +4 -3
- package/dist/components/attraction-card/base/attraction-card.mixin.d.ts +0 -2
- package/dist/components/attraction-card/base/attraction-card.mixin.js +0 -6
- package/dist/components/attraction-card/base/attraction-card.types.d.ts +0 -1
- package/dist/components/basket-mobile/basket-mobile.component.d.ts +14 -3
- package/dist/components/basket-mobile/basket-mobile.component.js +71 -15
- package/dist/components/better-carousel/better-carousel.component.d.ts +3 -5
- package/dist/components/better-carousel/better-carousel.component.js +13 -34
- package/dist/components/breadcrumbs/breadcrumb-item/breadcrumb-item.component.js +5 -12
- package/dist/components/breadcrumbs/breadcrumb-item/breadcrumb-item.styles.js +13 -5
- package/dist/components/breadcrumbs/breadcrumbs.component.d.ts +0 -1
- package/dist/components/breadcrumbs/breadcrumbs.component.js +5 -8
- package/dist/components/breadcrumbs/breadcrumbs.styles.js +8 -2
- package/dist/components/button/button.constants.d.ts +1 -2
- package/dist/components/button/button.constants.js +0 -1
- package/dist/components/calendar/base/calendar.mixin.js +5 -1
- package/dist/components/calendar/multi/multi.component.d.ts +2 -2
- package/dist/components/calendar/multi/multi.component.js +12 -19
- package/dist/components/carousel/carousel.component.js +9 -2
- package/dist/components/categories-tree/categories-tree.component.d.ts +5 -3
- package/dist/components/categories-tree/categories-tree.component.js +22 -21
- package/dist/components/checkbox/checkbox.component.js +5 -1
- package/dist/components/checkbox-group/checkbox-group.component.js +1 -1
- package/dist/components/checkbox-group/checkbox-group.styles.js +1 -1
- package/dist/components/chip/chip.component.js +8 -3
- package/dist/components/crypto-auth-modal/crypto-auth-modal.component.d.ts +6 -0
- package/dist/components/crypto-auth-modal/crypto-auth-modal.component.js +15 -1
- package/dist/components/currencies-list/currencies-list.component.js +0 -1
- package/dist/components/dialog/dialog.component.js +52 -21
- package/dist/components/drawer/drawer.component.d.ts +3 -2
- package/dist/components/drawer/drawer.component.js +13 -18
- package/dist/components/drawer/drawer.styles.js +5 -2
- package/dist/components/dropdown/dropdown.component.js +6 -9
- package/dist/components/expiration-timer/expiration-timer.component.d.ts +2 -3
- package/dist/components/expiration-timer/expiration-timer.component.js +10 -8
- package/dist/components/explore-card/explore-card.component.js +3 -1
- package/dist/components/explore-card/explore-card.styles.js +31 -0
- package/dist/components/filters-drawer/filters-drawer.component.js +1 -1
- package/dist/components/flag-icon/flag-icon.component.d.ts +4 -2
- package/dist/components/flag-icon/flag-icon.component.js +16 -4
- package/dist/components/icon/icon.component.js +15 -2
- package/dist/components/image/image.component.js +4 -3
- package/dist/components/image-viewer/image-viewer.component.js +6 -4
- package/dist/components/input-field/input-field.component.js +10 -6
- package/dist/components/layout/layout.styles.js +1 -1
- package/dist/components/locales-list/locales-list.component.js +0 -1
- package/dist/components/location-image/location-image.component.d.ts +4 -4
- package/dist/components/location-image/location-image.component.js +6 -7
- package/dist/components/locations-results/locations-results.component.d.ts +10 -0
- package/dist/components/locations-results/locations-results.component.js +22 -15
- package/dist/components/locations-results/locations-results.styles.js +4 -1
- package/dist/components/message-card/message-card.component.d.ts +1 -1
- package/dist/components/message-card/message-card.component.js +4 -3
- package/dist/components/mobile-menu-item/mobile-menu-item.component.d.ts +0 -1
- package/dist/components/mobile-menu-item/mobile-menu-item.component.js +14 -16
- package/dist/components/mobile-menu-item/mobile-menu-item.styles.js +9 -5
- package/dist/components/option-group/option-chip/option-chip.component.d.ts +4 -1
- package/dist/components/option-group/option-chip/option-chip.component.js +23 -10
- package/dist/components/option-group/option-group.component.d.ts +3 -1
- package/dist/components/option-group/option-group.component.js +10 -3
- package/dist/components/overlay/overlay.component.d.ts +0 -5
- package/dist/components/overlay/overlay.component.js +3 -15
- package/dist/components/phone-country-code/phone-country-code.component.d.ts +4 -0
- package/dist/components/phone-country-code/phone-country-code.component.js +37 -0
- package/dist/components/phone-country-codes/phone-country-codes.component.js +1 -1
- package/dist/components/phone-field/phone-field.component.js +2 -2
- package/dist/components/search-button/search-button.component.d.ts +1 -1
- package/dist/components/search-button/search-button.component.js +13 -7
- package/dist/components/seated-selector/seated-selector.component.js +3 -3
- package/dist/components/seats-io/seats-io.component.d.ts +3 -2
- package/dist/components/seats-io/seats-io.component.js +31 -13
- package/dist/components/seats-io/seats-io.constants.d.ts +0 -2
- package/dist/components/seats-io/seats-io.constants.js +0 -3
- package/dist/components/seats-io/seats-io.transform.d.ts +1 -6
- package/dist/components/seats-io/seats-io.transform.js +1 -20
- package/dist/components/select-list/select-list.component.js +7 -2
- package/dist/components/select-list/select-option/select-option.component.d.ts +3 -1
- package/dist/components/select-list/select-option/select-option.component.js +10 -3
- package/dist/components/tabs/tabs.component.d.ts +2 -0
- package/dist/components/tabs/tabs.component.js +59 -5
- package/dist/components/time-tag/time-tag.component.js +1 -1
- package/dist/containers/basket/basket.component.d.ts +1 -1
- package/dist/containers/basket/basket.component.js +21 -20
- package/dist/containers/navbar/navbar.component.d.ts +12 -8
- package/dist/containers/navbar/navbar.component.js +108 -62
- package/dist/containers/navbar/navbar.styles.js +23 -5
- package/dist/containers/navbar/navbar.utils.js +4 -4
- package/dist/contexts/basket/basket.provider.d.ts +3 -4
- package/dist/contexts/basket/basket.provider.js +46 -61
- package/dist/contexts/basket/basket.types.d.ts +0 -2
- package/dist/controllers/time-expiration.d.ts +15 -2
- package/dist/controllers/time-expiration.js +47 -17
- package/dist/core/api/client.d.ts +9 -0
- package/dist/core/api/client.js +26 -0
- package/dist/core/api/middlewares/booking-session/booking-session.constants.d.ts +0 -2
- package/dist/core/api/middlewares/booking-session/booking-session.constants.js +0 -2
- package/dist/core/api/middlewares/booking-session/booking-session.js +3 -12
- package/dist/core/api/middlewares/booking-session/booking-session.utils.d.ts +0 -1
- package/dist/core/api/middlewares/booking-session/booking-session.utils.js +6 -28
- package/dist/core/api/middlewares/error-handler/error-handler.js +5 -1
- package/dist/core/api/middlewares/retry/retry.constants.d.ts +3 -0
- package/dist/core/api/middlewares/retry/retry.constants.js +7 -0
- package/dist/core/api/middlewares/retry/retry.d.ts +2 -0
- package/dist/core/api/middlewares/retry/retry.js +48 -0
- package/dist/core/api/queries.d.ts +13 -38
- package/dist/core/api/queries.js +16 -99
- package/dist/core/events.d.ts +2 -4
- package/dist/core/i18n/date.d.ts +14 -5
- package/dist/core/i18n/date.js +47 -20
- package/dist/core/i18n/localization.js +10 -3
- package/dist/core/images/helpers.js +6 -5
- package/dist/core/images/srcset.js +2 -2
- package/dist/core/logger.d.ts +17 -0
- package/dist/core/logger.js +13 -0
- package/dist/core/types/api-schema.d.ts +7872 -0
- package/dist/core/types/seats-config.d.ts +5 -4
- package/dist/core/types/seats-config.js +10 -3
- package/dist/core/utils/crypto-address.d.ts +12 -0
- package/dist/core/utils/crypto-address.js +17 -0
- package/dist/core/utils/datetime.d.ts +13 -11
- package/dist/core/utils/datetime.js +41 -51
- package/dist/core/utils/loyalty.d.ts +8 -0
- package/dist/core/utils/loyalty.js +10 -0
- package/dist/core/utils/redaction.d.ts +9 -0
- package/dist/core/utils/redaction.js +58 -0
- package/dist/core/utils/time.js +2 -3
- package/dist/helpers/helpers.d.ts +6 -0
- package/dist/helpers/helpers.js +33 -16
- package/dist/locales/ar-SA.d.ts +38 -21
- package/dist/locales/ar-SA.js +38 -21
- package/dist/locales/da-DK.d.ts +38 -21
- package/dist/locales/da-DK.js +38 -21
- package/dist/locales/de-DE.d.ts +38 -21
- package/dist/locales/de-DE.js +38 -21
- package/dist/locales/en-IE.d.ts +38 -21
- package/dist/locales/en-IE.js +38 -21
- package/dist/locales/en-US.d.ts +38 -21
- package/dist/locales/en-US.js +38 -21
- package/dist/locales/es-ES.d.ts +38 -21
- package/dist/locales/es-ES.js +38 -21
- package/dist/locales/fr-FR.d.ts +38 -21
- package/dist/locales/fr-FR.js +38 -21
- package/dist/locales/fr-MA.d.ts +38 -21
- package/dist/locales/fr-MA.js +38 -21
- package/dist/locales/is-IS.d.ts +38 -21
- package/dist/locales/is-IS.js +38 -21
- package/dist/locales/it-IT.d.ts +38 -21
- package/dist/locales/it-IT.js +38 -21
- package/dist/locales/ms-MY.d.ts +38 -21
- package/dist/locales/ms-MY.js +38 -21
- package/dist/locales/nb-NO.d.ts +38 -21
- package/dist/locales/nb-NO.js +38 -21
- package/dist/locales/pl-PL.d.ts +38 -21
- package/dist/locales/pl-PL.js +38 -21
- package/dist/locales/pt-PT.d.ts +38 -21
- package/dist/locales/pt-PT.js +38 -21
- package/dist/locales/sv-SE.d.ts +38 -21
- package/dist/locales/sv-SE.js +38 -21
- package/dist/locales/th-TH.d.ts +38 -21
- package/dist/locales/th-TH.js +38 -21
- package/dist/locales/tr-TR.d.ts +38 -21
- package/dist/locales/tr-TR.js +38 -21
- package/dist/locales/zh-CN.d.ts +38 -21
- package/dist/locales/zh-CN.js +38 -21
- package/dist/locales/zh-HK.d.ts +38 -21
- package/dist/locales/zh-HK.js +38 -21
- package/dist/mixins/base.mixin.d.ts +3 -1
- package/dist/mixins/base.mixin.js +10 -7
- package/dist/mixins/coinbase.mixin.d.ts +13 -17
- package/dist/mixins/coinbase.mixin.js +251 -288
- package/dist/mixins/error-modal.mixin.js +8 -4
- package/dist/mixins/location-search/location-search.d.ts +13 -1
- package/dist/mixins/location-search/location-search.js +35 -27
- package/dist/mixins/overlay/overlay-mixin.js +39 -3
- package/dist/mixins/overlay/types.d.ts +1 -0
- package/dist/mixins/search-mixin/search-mixin.js +8 -5
- package/dist/sdk/diagnostics.js +2 -0
- package/dist/sdk/mount.d.ts +10 -0
- package/dist/sdk/mount.js +20 -1
- package/dist/sdk/page-registry.js +5 -0
- package/dist/sdk/params.d.ts +53 -0
- package/dist/sdk/params.js +180 -0
- package/dist/sdk/redaction.d.ts +1 -4
- package/dist/sdk/redaction.js +2 -41
- package/dist/sdk/types.d.ts +21 -7
- package/dist/sdk/url.d.ts +1 -1
- package/dist/sdk/url.js +12 -5
- package/dist/sdk/validation.d.ts +1 -26
- package/dist/sdk/validation.js +8 -145
- package/dist/styles/tokens.d.ts +1 -1
- package/dist/styles/tokens.generated.d.ts +1 -1
- package/dist/styles/tokens.generated.js +1 -1
- package/dist/views/chrome-only-page/chrome-only-page.component.d.ts +30 -0
- package/dist/views/chrome-only-page/chrome-only-page.component.js +24 -0
- package/dist/views/chrome-only-page/chrome-only-page.d.ts +8 -0
- package/dist/views/chrome-only-page/chrome-only-page.js +6 -0
- package/dist/views/chrome-only-page/chrome-only-page.styles.js +13 -0
- package/dist/views/details-page/details-page.component.d.ts +11 -4
- package/dist/views/details-page/details-page.component.js +263 -237
- package/dist/views/details-page/details-page.utilts.d.ts +63 -3
- package/dist/views/details-page/details-page.utilts.js +53 -5
- package/dist/views/details-page/partials/location-categories/location-categories.component.d.ts +29 -0
- package/dist/views/details-page/partials/location-categories/location-categories.component.js +149 -0
- package/dist/views/details-page/partials/location-categories/location-categories.d.ts +8 -0
- package/dist/views/details-page/partials/location-categories/location-categories.js +6 -0
- package/dist/views/details-page/partials/location-categories/location-categories.styles.js +35 -0
- package/dist/views/details-page/partials/location-highlights/location-highlights.component.d.ts +26 -0
- package/dist/views/details-page/partials/location-highlights/location-highlights.component.js +158 -0
- package/dist/views/details-page/partials/location-highlights/location-highlights.d.ts +8 -0
- package/dist/views/details-page/partials/location-highlights/location-highlights.js +6 -0
- package/dist/views/details-page/partials/location-highlights/location-highlights.styles.js +42 -0
- package/dist/views/details-page/partials/tour-description/tour-description.component.js +1 -4
- package/dist/views/help-page/help-page.component.d.ts +2 -0
- package/dist/views/help-page/help-page.component.js +37 -18
- package/dist/views/help-page/help-page.utils.js +6 -5
- package/dist/views/landing-page/landing-page.component.d.ts +5 -8
- package/dist/views/landing-page/landing-page.component.js +82 -97
- package/dist/views/payment-page/controllers/crypto-auth.controller.d.ts +10 -4
- package/dist/views/payment-page/controllers/crypto-auth.controller.js +53 -31
- package/dist/views/payment-page/controllers/crypto-transfer.controller.d.ts +9 -5
- package/dist/views/payment-page/controllers/crypto-transfer.controller.js +26 -39
- package/dist/views/payment-page/controllers/payment-flow.controller.d.ts +6 -1
- package/dist/views/payment-page/controllers/payment-flow.controller.js +1 -0
- package/dist/views/payment-page/controllers/stripe-payment.controller.d.ts +20 -2
- package/dist/views/payment-page/controllers/stripe-payment.controller.js +42 -19
- package/dist/views/payment-page/partials/activity-details/activity-details.component.d.ts +2 -0
- package/dist/views/payment-page/partials/activity-details/activity-details.component.js +6 -3
- package/dist/views/payment-page/partials/billing-address/billing-address.component.d.ts +2 -0
- package/dist/views/payment-page/partials/billing-address/billing-address.component.js +5 -1
- package/dist/views/payment-page/partials/confirmation/confirmation.component.js +2 -3
- package/dist/views/payment-page/partials/country-field/country-field.component.js +1 -1
- package/dist/views/payment-page/partials/payment-type-selector/payment-type-selector.component.js +3 -3
- package/dist/views/payment-page/partials/stripe/stripe.component.d.ts +2 -0
- package/dist/views/payment-page/partials/stripe/stripe.component.js +36 -7
- package/dist/views/payment-page/partials/stripe/stripe.utils.js +0 -3
- package/dist/views/payment-page/payment-page.component.d.ts +39 -6
- package/dist/views/payment-page/payment-page.component.js +302 -178
- package/dist/views/payment-page/payment-page.constants.d.ts +1 -27
- package/dist/views/payment-page/payment-page.constants.js +3 -30
- package/dist/views/payment-page/payment-page.types.d.ts +1 -19
- package/dist/views/payment-page/payment-page.utils.d.ts +22 -13
- package/dist/views/payment-page/payment-page.utils.js +57 -75
- package/dist/views/payment-page/services/payment-api.service.d.ts +16 -34
- package/dist/views/payment-page/services/payment-api.service.js +19 -27
- package/dist/views/search-page/search-page.component.d.ts +2 -0
- package/dist/views/search-page/search-page.component.js +39 -20
- package/dist/views/suggestion-widget/suggestion-widget.component.d.ts +1 -0
- package/dist/views/suggestion-widget/suggestion-widget.component.js +6 -5
- package/package.json +24 -20
- package/dist/components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.component.d.ts +0 -10
- package/dist/components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.component.js +0 -43
- package/dist/components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.d.ts +0 -8
- package/dist/components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.js +0 -6
- package/dist/components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.styles.js +0 -23
- package/dist/components/attraction-discovery/attraction-discovery.component.d.ts +0 -10
- package/dist/components/attraction-discovery/attraction-discovery.component.js +0 -52
- package/dist/components/attraction-discovery/attraction-discovery.constants.d.ts +0 -4
- package/dist/components/attraction-discovery/attraction-discovery.constants.js +0 -5
- package/dist/components/attraction-discovery/attraction-discovery.d.ts +0 -8
- package/dist/components/attraction-discovery/attraction-discovery.js +0 -6
- package/dist/components/attraction-discovery/attraction-discovery.styles.js +0 -193
- package/dist/components/basket-rewards/basket-rewards.component.d.ts +0 -10
- package/dist/components/basket-rewards/basket-rewards.component.js +0 -52
- package/dist/components/basket-rewards/basket-rewards.d.ts +0 -8
- package/dist/components/basket-rewards/basket-rewards.js +0 -6
- package/dist/components/basket-rewards/basket-rewards.styles.js +0 -18
- package/dist/components/filter-chip/filter-chip.component.d.ts +0 -12
- package/dist/components/filter-chip/filter-chip.component.js +0 -68
- package/dist/components/filter-chip/filter-chip.constants.d.ts +0 -2
- package/dist/components/filter-chip/filter-chip.constants.js +0 -2
- package/dist/components/filter-chip/filter-chip.d.ts +0 -8
- package/dist/components/filter-chip/filter-chip.js +0 -6
- package/dist/components/filter-chip/filter-chip.styles.d.ts +0 -2
- package/dist/components/filter-chip/filter-chip.styles.js +0 -162
- package/dist/components/image-carousel/image-carousel-item/image-carousel-item.component.d.ts +0 -10
- package/dist/components/image-carousel/image-carousel-item/image-carousel-item.component.js +0 -43
- package/dist/components/image-carousel/image-carousel-item/image-carousel-item.d.ts +0 -8
- package/dist/components/image-carousel/image-carousel-item/image-carousel-item.js +0 -6
- package/dist/components/image-carousel/image-carousel-item/image-carousel-item.styles.d.ts +0 -2
- package/dist/components/image-carousel/image-carousel-item/image-carousel-item.styles.js +0 -28
- package/dist/components/image-carousel/image-carousel.component.d.ts +0 -8
- package/dist/components/image-carousel/image-carousel.component.js +0 -36
- package/dist/components/image-carousel/image-carousel.d.ts +0 -8
- package/dist/components/image-carousel/image-carousel.js +0 -6
- package/dist/components/image-carousel/image-carousel.styles.d.ts +0 -2
- package/dist/components/image-carousel/image-carousel.styles.js +0 -72
- package/dist/components/itinerary/itinerary-item/itinerary-item.component.d.ts +0 -9
- package/dist/components/itinerary/itinerary-item/itinerary-item.component.js +0 -45
- package/dist/components/itinerary/itinerary-item/itinerary-item.d.ts +0 -8
- package/dist/components/itinerary/itinerary-item/itinerary-item.js +0 -6
- package/dist/components/itinerary/itinerary-item/itinerary-item.styles.d.ts +0 -2
- package/dist/components/itinerary/itinerary-item/itinerary-item.styles.js +0 -70
- package/dist/components/itinerary/itinerary.component.d.ts +0 -7
- package/dist/components/itinerary/itinerary.component.js +0 -23
- package/dist/components/itinerary/itinerary.d.ts +0 -8
- package/dist/components/itinerary/itinerary.js +0 -6
- package/dist/components/itinerary/itinerary.styles.d.ts +0 -2
- package/dist/components/itinerary/itinerary.styles.js +0 -15
- package/dist/components/marketing-tag/marketing-tag.component.d.ts +0 -5
- package/dist/components/marketing-tag/marketing-tag.component.js +0 -8
- package/dist/components/marketing-tag/marketing-tag.d.ts +0 -8
- package/dist/components/marketing-tag/marketing-tag.js +0 -6
- package/dist/components/marketing-tag/marketing-tag.styles.d.ts +0 -2
- package/dist/components/marketing-tag/marketing-tag.styles.js +0 -36
- package/dist/components/price/price.component.d.ts +0 -12
- package/dist/components/price/price.component.js +0 -38
- package/dist/components/price/price.d.ts +0 -8
- package/dist/components/price/price.js +0 -6
- package/dist/components/reviews/review/review.component.d.ts +0 -9
- package/dist/components/reviews/review/review.component.js +0 -41
- package/dist/components/reviews/review/review.d.ts +0 -8
- package/dist/components/reviews/review/review.js +0 -6
- package/dist/components/reviews/review/review.styles.d.ts +0 -2
- package/dist/components/reviews/review/review.styles.js +0 -45
- package/dist/components/reviews/reviews.component.d.ts +0 -9
- package/dist/components/reviews/reviews.component.js +0 -56
- package/dist/components/reviews/reviews.d.ts +0 -8
- package/dist/components/reviews/reviews.js +0 -6
- package/dist/components/reviews/reviews.styles.d.ts +0 -2
- package/dist/components/reviews/reviews.styles.js +0 -73
- package/dist/components/selected-tickets-preview/selected-tickets-preview.component.d.ts +0 -10
- package/dist/components/selected-tickets-preview/selected-tickets-preview.component.js +0 -51
- package/dist/components/selected-tickets-preview/selected-tickets-preview.d.ts +0 -8
- package/dist/components/selected-tickets-preview/selected-tickets-preview.js +0 -6
- package/dist/components/selected-tickets-preview/selected-tickets-preview.styles.d.ts +0 -2
- package/dist/components/selected-tickets-preview/selected-tickets-preview.styles.js +0 -89
- package/dist/components/tag/tag.component.d.ts +0 -8
- package/dist/components/tag/tag.component.js +0 -33
- package/dist/components/tag/tag.constants.d.ts +0 -1
- package/dist/components/tag/tag.constants.js +0 -1
- package/dist/components/tag/tag.d.ts +0 -8
- package/dist/components/tag/tag.js +0 -6
- package/dist/components/tag/tag.styles.d.ts +0 -2
- package/dist/components/tag/tag.styles.js +0 -56
- package/dist/components/tooltip/tooltip.component.d.ts +0 -19
- package/dist/components/tooltip/tooltip.component.js +0 -124
- package/dist/components/tooltip/tooltip.d.ts +0 -8
- package/dist/components/tooltip/tooltip.js +0 -6
- package/dist/components/tooltip/tooltip.styles.d.ts +0 -2
- package/dist/components/tooltip/tooltip.styles.js +0 -79
- package/dist/core/signals.d.ts +0 -2
- package/dist/core/signals.js +0 -3
- package/dist/core/storybook/argTypes.d.ts +0 -1
- package/dist/core/storybook/argTypes.js +0 -46
- package/dist/core/storybook/cssprops.d.ts +0 -30
- package/dist/core/storybook/cssprops.js +0 -46
- package/dist/core/storybook/demo.d.ts +0 -4
- package/dist/core/storybook/demo.js +0 -17
- package/dist/core/types/api-errors.d.ts +0 -8
- package/dist/core/types/api-errors.js +0 -1
- package/dist/styles/contrast-fixtures.d.ts +0 -5
- package/dist/styles/contrast-fixtures.js +0 -131
- package/dist/views/payment-page/domain/payment-mappers.d.ts +0 -7
- package/dist/views/payment-page/domain/payment-mappers.js +0 -7
- package/dist/views/payment-page/domain/payment-validators.d.ts +0 -6
- package/dist/views/payment-page/domain/payment-validators.js +0 -6
- package/dist/views/payment-page/domain/recovery-payload.d.ts +0 -8
- package/dist/views/payment-page/domain/recovery-payload.js +0 -7
- package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.component.d.ts +0 -22
- package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.component.js +0 -65
- package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.d.ts +0 -8
- package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.js +0 -6
- package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.styles.d.ts +0 -2
- package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.styles.js +0 -12
- package/dist/views/payment-page/payment-page.validation-schema.d.ts +0 -28
- package/dist/views/payment-page/payment-page.validation-schema.js +0 -42
- /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
- /package/dist/{components/attraction-discovery/attraction-discovery.styles.d.ts → views/details-page/partials/location-categories/location-categories.styles.d.ts} +0 -0
- /package/dist/{components/basket-rewards/basket-rewards.styles.d.ts → views/details-page/partials/location-highlights/location-highlights.styles.d.ts} +0 -0
|
@@ -31,7 +31,7 @@ import { CoinbaseMixin } from "../../mixins/coinbase.mixin.js";
|
|
|
31
31
|
import styles from "./payment-page.styles.js";
|
|
32
32
|
import "../../components/bottom-drawer/bottom-drawer.js";
|
|
33
33
|
import "../../components/expiration-timer/expiration-timer.js";
|
|
34
|
-
import { Task } from "@lit/task";
|
|
34
|
+
import { Task, TaskStatus } from "@lit/task";
|
|
35
35
|
import { FIELDS } from "./payment-page.fields.js";
|
|
36
36
|
import "./partials/stripe/stripe.js";
|
|
37
37
|
import "./partials/country-field/country-field.js";
|
|
@@ -42,11 +42,12 @@ import "./partials/activity-details/activity-details.js";
|
|
|
42
42
|
import "./partials/billing-address/billing-address.js";
|
|
43
43
|
import { getBookingSession, removeBookingSession, } from "../../core/api/middlewares/booking-session/booking-session.utils.js";
|
|
44
44
|
import { PaymentApiService } from "./services/payment-api.service.js";
|
|
45
|
-
import { getDefaultPhoneCode, getDefaultCountry, getShortestExpirationSeconds, getTotalQuantity, getTotalPrice,
|
|
45
|
+
import { getDefaultPhoneCode, getDefaultCountry, getShortestExpirationSeconds, getTotalQuantity, getTotalPrice, validateWalletEmail, findCountryCode as findCountryCodeUtil, toE164, prepareReservationData, prepareAttendeesData, isApiError, unwrapApiErrorBody, mapApiErrorsToForm, prepareCustomerData as prepareCustomerDataUtil, getFieldConfig, isFinalStatus, pollTransactionStatus, INVALID_FIELD_SELECTOR, } from "./payment-page.utils.js";
|
|
46
|
+
import { getLoyaltyAmount } from "../../core/utils/loyalty.js";
|
|
46
47
|
import { consume } from "@lit/context";
|
|
47
48
|
import { currentPageContext } from "../../contexts/current-page.context.js";
|
|
48
49
|
import { convertToLocaleCurrency } from "../../core/currency/index.js";
|
|
49
|
-
import { TRANSACTION_POLLING_MAX_ATTEMPTS, TRANSACTION_POLLING_INITIAL_INTERVAL_MS, TRANSACTION_POLLING_MAX_INTERVAL_MS, BALANCE_BACKOFF_INITIAL_MS, BALANCE_BACKOFF_MAX_MS, } from "./payment-page.constants.js";
|
|
50
|
+
import { TRANSACTION_POLLING_MAX_ATTEMPTS, TRANSACTION_POLLING_INITIAL_INTERVAL_MS, TRANSACTION_POLLING_MAX_INTERVAL_MS, TRANSACTION_RECHECK_MAX_ATTEMPTS, BALANCE_BACKOFF_INITIAL_MS, BALANCE_BACKOFF_MAX_MS, } from "./payment-page.constants.js";
|
|
50
51
|
import { getLocale, setLocale } from "../../core/i18n/localization.js";
|
|
51
52
|
import { StripePaymentController } from "./controllers/stripe-payment.controller.js";
|
|
52
53
|
import { PaymentFlowController } from "./controllers/payment-flow.controller.js";
|
|
@@ -55,11 +56,14 @@ import { LayoutController } from "./controllers/layout.controller.js";
|
|
|
55
56
|
import { CryptoAuthController } from "./controllers/crypto-auth.controller.js";
|
|
56
57
|
import { CryptoTransferController, } from "./controllers/crypto-transfer.controller.js";
|
|
57
58
|
import { getApiLanguageCode } from "../../core/utils/locale.js";
|
|
59
|
+
import { safeUrl } from "@coras-io/brand-tokens";
|
|
58
60
|
/**
|
|
59
61
|
* Payment page component for processing checkout and payments.
|
|
60
62
|
*
|
|
61
63
|
* @fires coras:navigate - Dispatched when navigating to another page
|
|
62
|
-
* @fires coras:payment-status - Dispatched when a payment attempt
|
|
64
|
+
* @fires coras:payment-status - Dispatched when a payment attempt settles:
|
|
65
|
+
* `succeeded`, `failed`, or `pending` when the charge went through but the
|
|
66
|
+
* API had not confirmed the transaction within the polling budget
|
|
63
67
|
*/
|
|
64
68
|
let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMixin(BaseMixin(LitElement))) {
|
|
65
69
|
constructor() {
|
|
@@ -74,22 +78,35 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
74
78
|
this.preview = false;
|
|
75
79
|
this.cdpProjectId = "";
|
|
76
80
|
this.currentPage = "payment";
|
|
77
|
-
|
|
81
|
+
// The controllers are built before the SDK mount assigns `logger`, so they
|
|
82
|
+
// get a forwarder that reads the current one on every call.
|
|
83
|
+
this.controllerLogger = {
|
|
84
|
+
warn: (message, data) => this.logger.warn(message, data),
|
|
85
|
+
error: (error, data) => this.logger.error(error, data),
|
|
86
|
+
};
|
|
87
|
+
this.stripeController = new StripePaymentController(this, this.controllerLogger);
|
|
78
88
|
this.flowController = new PaymentFlowController(this);
|
|
79
89
|
this.formController = new FormValidationController(this);
|
|
80
90
|
this.layoutController = new LayoutController(this);
|
|
81
91
|
this.cryptoAuthController = new CryptoAuthController(this, {
|
|
92
|
+
logger: this.controllerLogger,
|
|
82
93
|
sendCode: (email) => this.sendCode(email),
|
|
83
94
|
loginWithCode: (email, code) => this.loginWithCode(email, code),
|
|
84
95
|
initiateMfaEnrollment: (phone) => this.initiateMfaEnrollment(phone),
|
|
85
96
|
submitMfaEnrollment: (code) => this.submitMfaEnrollment(code),
|
|
86
97
|
onLoginSuccess: () => this.handleCryptoLoginSuccess(),
|
|
87
|
-
onBalanceRefresh: () =>
|
|
98
|
+
onBalanceRefresh: () => {
|
|
99
|
+
void this.balanceTask.run();
|
|
100
|
+
},
|
|
88
101
|
onMfaEnrollmentComplete: () => this._syncMfaPhoneToFormIfEmpty(),
|
|
89
102
|
});
|
|
90
103
|
this.cryptoTransferController = new CryptoTransferController(this, {
|
|
104
|
+
logger: this.controllerLogger,
|
|
91
105
|
transferTokens: (amount) => this.transferTokens(amount),
|
|
92
106
|
confirmReservation: async () => {
|
|
107
|
+
// Every controller-driven confirmation follows an on-chain transfer,
|
|
108
|
+
// including recovery on page load where the selector still says card.
|
|
109
|
+
this.paymentType = "crypto";
|
|
93
110
|
const result = await this.confirmReservation();
|
|
94
111
|
if (result) {
|
|
95
112
|
return {
|
|
@@ -101,8 +118,10 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
101
118
|
},
|
|
102
119
|
checkTransactionStatus: (userId) => this.checkTransactionStatus(userId),
|
|
103
120
|
showErrorModalOnce: () => this.showErrorModalOnce(),
|
|
104
|
-
|
|
105
|
-
refreshBalance: () =>
|
|
121
|
+
settleTransaction: (status) => this.settleTransaction(status),
|
|
122
|
+
refreshBalance: () => {
|
|
123
|
+
void this.balanceTask.run();
|
|
124
|
+
},
|
|
106
125
|
submitMfaVerification: (code) => this.submitMfaVerification(code),
|
|
107
126
|
initiateMfaVerification: () => this.initiateMfaVerification(),
|
|
108
127
|
resetMfaVerificationState: () => this.resetMfaVerificationState(),
|
|
@@ -117,6 +136,9 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
117
136
|
});
|
|
118
137
|
/** AbortController for canceling long-running async ops on disconnect. */
|
|
119
138
|
this.abortController = new AbortController();
|
|
139
|
+
/** True once initCoinbase has resolved (and restored any saved session). */
|
|
140
|
+
this.cdpReady = false;
|
|
141
|
+
this.pendingTransferRecoveryStarted = false;
|
|
120
142
|
this.apiService = null;
|
|
121
143
|
this.showCryptoAuthModal = false;
|
|
122
144
|
this.transactionId = "";
|
|
@@ -135,16 +157,16 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
135
157
|
this.paymentMethod = "card";
|
|
136
158
|
this.paymentSuccessful = false;
|
|
137
159
|
this.paymentFailed = false;
|
|
160
|
+
// The charge went through but the API had not reported a final transaction
|
|
161
|
+
// status within the polling budget. Not a failure: the booking may still
|
|
162
|
+
// complete, so the reference is kept and the customer can poll again.
|
|
163
|
+
this.paymentPending = false;
|
|
138
164
|
this.loyaltyPageUrl = null;
|
|
139
165
|
this.userEmail = "";
|
|
140
166
|
this.configTask = new Task(this, {
|
|
141
167
|
autoRun: false,
|
|
142
168
|
task: async () => {
|
|
143
|
-
const
|
|
144
|
-
if (!result.data) {
|
|
145
|
-
throw new Error("Failed to fetch payment configuration");
|
|
146
|
-
}
|
|
147
|
-
const config = result.data;
|
|
169
|
+
const { data: config } = await this.getApiService().fetchConfig();
|
|
148
170
|
this.stripeKey = config.stripe_publishable_key;
|
|
149
171
|
if (config.coinbase_project_id) {
|
|
150
172
|
this.cdpProjectId = config.coinbase_project_id;
|
|
@@ -161,9 +183,9 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
161
183
|
if (config.treasury_wallet_address) {
|
|
162
184
|
this.recipientAddress = config.treasury_wallet_address;
|
|
163
185
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
186
|
+
// The URL comes from the API and is opened in a new tab by the
|
|
187
|
+
// collect-fida link; safeUrl rejects javascript: and other schemes.
|
|
188
|
+
this.loyaltyPageUrl = safeUrl(config.loyalty_page_url) || null;
|
|
167
189
|
return config;
|
|
168
190
|
},
|
|
169
191
|
});
|
|
@@ -171,9 +193,12 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
171
193
|
autoRun: false,
|
|
172
194
|
task: async () => {
|
|
173
195
|
const language_code = getApiLanguageCode(this.locale);
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
196
|
+
let data;
|
|
197
|
+
try {
|
|
198
|
+
data = (await this.getApiService().fetchCountries(language_code)).data;
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
this.logger.error("Error fetching countries:", error);
|
|
177
202
|
return [];
|
|
178
203
|
}
|
|
179
204
|
if (data) {
|
|
@@ -200,12 +225,14 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
200
225
|
this.geolocationTask = new Task(this, {
|
|
201
226
|
autoRun: false,
|
|
202
227
|
task: async () => {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
228
|
+
try {
|
|
229
|
+
const { data } = await this.getApiService().fetchGeolocation();
|
|
230
|
+
return data ?? null;
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
this.logger.error("Error fetching geolocation:", error);
|
|
206
234
|
return null;
|
|
207
235
|
}
|
|
208
|
-
return result.data ?? null;
|
|
209
236
|
},
|
|
210
237
|
});
|
|
211
238
|
this.balanceBackoffMs = BALANCE_BACKOFF_INITIAL_MS;
|
|
@@ -222,7 +249,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
222
249
|
// The EOA balance doesn't matter for sponsored transactions
|
|
223
250
|
const smartAccountAddress = this.coinbaseSession?.smartAccountAddress;
|
|
224
251
|
if (!smartAccountAddress) {
|
|
225
|
-
|
|
252
|
+
this.logger.error("No smart account address available for balance check");
|
|
226
253
|
this.balanceBackoffMs = BALANCE_BACKOFF_INITIAL_MS;
|
|
227
254
|
this.clearBalanceBackoff();
|
|
228
255
|
return null;
|
|
@@ -234,12 +261,12 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
234
261
|
return balance;
|
|
235
262
|
}
|
|
236
263
|
catch (error) {
|
|
237
|
-
|
|
264
|
+
this.logger.error("Balance fetch failed, retrying with backoff:", error);
|
|
238
265
|
// Schedule retry with exponential backoff
|
|
239
266
|
this.clearBalanceBackoff();
|
|
240
267
|
this.balanceRetryTimerId = setTimeout(() => {
|
|
241
268
|
this.balanceRetryTimerId = undefined;
|
|
242
|
-
this.balanceTask.run();
|
|
269
|
+
void this.balanceTask.run();
|
|
243
270
|
}, this.balanceBackoffMs);
|
|
244
271
|
this.balanceBackoffMs = Math.min(this.balanceBackoffMs * 2, BALANCE_BACKOFF_MAX_MS);
|
|
245
272
|
// Re-throw so the Task stays in error state
|
|
@@ -262,10 +289,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
262
289
|
if (!bookingSession) {
|
|
263
290
|
return undefined;
|
|
264
291
|
}
|
|
265
|
-
const { data
|
|
266
|
-
if (error) {
|
|
267
|
-
throw error;
|
|
268
|
-
}
|
|
292
|
+
const { data } = await this.getApiService().checkReservations(bookingSession);
|
|
269
293
|
return data;
|
|
270
294
|
},
|
|
271
295
|
});
|
|
@@ -279,12 +303,14 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
279
303
|
total_price: 0,
|
|
280
304
|
};
|
|
281
305
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
306
|
+
try {
|
|
307
|
+
const { data } = await this.getApiService().fetchReservations(bookingSession);
|
|
308
|
+
return data || { reservations: [] };
|
|
309
|
+
}
|
|
310
|
+
catch {
|
|
311
|
+
this.logger.error("Failed to fetch reservations");
|
|
285
312
|
return { reservations: [] };
|
|
286
313
|
}
|
|
287
|
-
return result.data || { reservations: [] };
|
|
288
314
|
},
|
|
289
315
|
});
|
|
290
316
|
this.handleCardValidationChange = (event) => {
|
|
@@ -317,7 +343,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
317
343
|
this.handlePaymentMethodAuthorized = (event) => {
|
|
318
344
|
event.stopPropagation();
|
|
319
345
|
this.stripeController.setAuthorizedPayment(event.detail.paymentMethod, event.detail.event);
|
|
320
|
-
this.onFormSubmit(new Event("submit"));
|
|
346
|
+
void this.onFormSubmit(new Event("submit"));
|
|
321
347
|
};
|
|
322
348
|
this.onFormSubmit = async (e) => {
|
|
323
349
|
e.preventDefault();
|
|
@@ -344,8 +370,9 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
344
370
|
isCardValid = await this.stripeComponent.validateCardElements();
|
|
345
371
|
}
|
|
346
372
|
if (!isFormValid || !isCardValid) {
|
|
373
|
+
// Client-side validation is not a payment attempt, so no status event.
|
|
374
|
+
this.stripeController.abortAuthorizedPayment();
|
|
347
375
|
this.flowController.transition("idle");
|
|
348
|
-
this.dispatchPaymentFailure();
|
|
349
376
|
await this.updateComplete;
|
|
350
377
|
this.scrollToFirstError();
|
|
351
378
|
return;
|
|
@@ -358,7 +385,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
358
385
|
const price = getTotalPrice(this.reservationsTask.value);
|
|
359
386
|
pr.update({
|
|
360
387
|
total: {
|
|
361
|
-
label: "Total",
|
|
388
|
+
label: msg("Total"),
|
|
362
389
|
amount: Math.round(price),
|
|
363
390
|
},
|
|
364
391
|
});
|
|
@@ -404,6 +431,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
404
431
|
if (!clientSecret) {
|
|
405
432
|
const confirmationResult = await this.confirmReservation();
|
|
406
433
|
if (!confirmationResult) {
|
|
434
|
+
this.stripeController.abortAuthorizedPayment();
|
|
407
435
|
this.flowController.transition("failed");
|
|
408
436
|
this.dispatchPaymentFailure();
|
|
409
437
|
return;
|
|
@@ -414,11 +442,9 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
414
442
|
this.flowController.transition("processing_payment");
|
|
415
443
|
{
|
|
416
444
|
const customer = this.prepareCustomerData();
|
|
417
|
-
const
|
|
418
|
-
const expectedAmount = getTotalPrice(data);
|
|
419
|
-
const paymentSuccess = await this.stripeController.processPayment(clientSecret, this.stripeComponent, this.paymentMethod, customer, expectedAmount);
|
|
445
|
+
const paymentSuccess = await this.stripeController.processPayment(clientSecret, this.stripeComponent, this.paymentMethod, customer);
|
|
420
446
|
if (!paymentSuccess) {
|
|
421
|
-
|
|
447
|
+
this.logger.error("Payment processing failed");
|
|
422
448
|
this.flowController.transition("failed");
|
|
423
449
|
this.dispatchPaymentFailure();
|
|
424
450
|
return;
|
|
@@ -426,26 +452,23 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
426
452
|
}
|
|
427
453
|
this.flowController.transition("polling");
|
|
428
454
|
const finalStatus = await this.checkTransactionStatus(this.userId);
|
|
429
|
-
|
|
430
|
-
// PaymentIntent is consumed; drop it so a later submit cannot reuse it
|
|
431
|
-
this.pendingClientSecret = null;
|
|
432
|
-
this.flowController.transition("success");
|
|
433
|
-
this.redirectToConfirmation(true);
|
|
434
|
-
}
|
|
435
|
-
else {
|
|
436
|
-
console.error("Transaction failed with status:", finalStatus);
|
|
437
|
-
this.flowController.transition("failed");
|
|
438
|
-
this.redirectToConfirmation(false);
|
|
439
|
-
}
|
|
455
|
+
this.settleTransaction(finalStatus);
|
|
440
456
|
}
|
|
441
457
|
catch (error) {
|
|
442
|
-
|
|
443
|
-
this.stripeController.
|
|
444
|
-
|
|
458
|
+
this.logger.error("Error during payment process:", error);
|
|
459
|
+
this.stripeController.abortAuthorizedPayment();
|
|
460
|
+
this.stripeController.cardError = msg("An unexpected error occurred. Please try again.");
|
|
445
461
|
this.flowController.transition("failed");
|
|
446
462
|
this.dispatchPaymentFailure();
|
|
447
463
|
}
|
|
448
464
|
};
|
|
465
|
+
this.handleCheckAgain = async () => {
|
|
466
|
+
if (this.flowController.isProcessing)
|
|
467
|
+
return;
|
|
468
|
+
this.flowController.transition("polling");
|
|
469
|
+
const status = await this.checkTransactionStatus(this.userId, TRANSACTION_RECHECK_MAX_ATTEMPTS);
|
|
470
|
+
this.settleTransaction(status);
|
|
471
|
+
};
|
|
449
472
|
this.handleSendCode = async () => {
|
|
450
473
|
await this.cryptoAuthController.handleSendCode(this.walletEmail, () => this.validateWalletEmail(this.walletEmail), (error) => {
|
|
451
474
|
this.walletEmailError = error;
|
|
@@ -502,7 +525,9 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
502
525
|
updated(changedProperties) {
|
|
503
526
|
super.updated(changedProperties);
|
|
504
527
|
if (getLocale() !== this.locale) {
|
|
505
|
-
|
|
528
|
+
// `loadLocale` falls back on its own (see core/i18n/localization.ts), so
|
|
529
|
+
// the returned promise does not reject; an unknown code throws synchronously.
|
|
530
|
+
void setLocale(this.locale);
|
|
506
531
|
}
|
|
507
532
|
if (changedProperties.has("codeSent")) {
|
|
508
533
|
if (this.codeSent) {
|
|
@@ -519,11 +544,13 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
519
544
|
? changedProperties.get("loyaltyPoints")
|
|
520
545
|
: this.loyaltyPoints;
|
|
521
546
|
if (this.loyaltyPoints && this.cdpProjectId) {
|
|
522
|
-
this.initCoinbase(this.cdpProjectId).then(() => {
|
|
547
|
+
void this.initCoinbase(this.cdpProjectId).then(() => {
|
|
523
548
|
this.getUser()
|
|
524
549
|
.catch(() => { })
|
|
525
550
|
.finally(() => this.syncEmailFromCoinbase());
|
|
526
|
-
this.balanceTask.run();
|
|
551
|
+
void this.balanceTask.run();
|
|
552
|
+
this.cdpReady = true;
|
|
553
|
+
this.maybeRecoverPendingTransfer();
|
|
527
554
|
});
|
|
528
555
|
}
|
|
529
556
|
else if (prevLoyalty && !this.loyaltyPoints) {
|
|
@@ -533,7 +560,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
533
560
|
this.walletEmail = "";
|
|
534
561
|
this.walletEmailError = "";
|
|
535
562
|
this.cleanupCoinbase();
|
|
536
|
-
this.balanceTask.run();
|
|
563
|
+
void this.balanceTask.run();
|
|
537
564
|
}
|
|
538
565
|
}
|
|
539
566
|
if (changedProperties.has("mfaVerificationRequired")) {
|
|
@@ -546,28 +573,40 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
546
573
|
this.isMfaEnrolled) {
|
|
547
574
|
this.showCryptoAuthModal = false;
|
|
548
575
|
}
|
|
576
|
+
// Reservations may load after CDP; re-check on every update, guarded.
|
|
577
|
+
this.maybeRecoverPendingTransfer();
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Confirms a transfer that left the wallet before the previous confirmation
|
|
581
|
+
* completed. Runs once, and only when CDP has restored the session and the
|
|
582
|
+
* basket is known, since both are needed for the confirmation request.
|
|
583
|
+
*/
|
|
584
|
+
maybeRecoverPendingTransfer() {
|
|
585
|
+
if (this.pendingTransferRecoveryStarted ||
|
|
586
|
+
!this.cdpReady ||
|
|
587
|
+
!this.coinbaseSession ||
|
|
588
|
+
!this.reservationsTask.value) {
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
this.pendingTransferRecoveryStarted = true;
|
|
592
|
+
void this.cryptoTransferController.recoverPendingTransfer();
|
|
549
593
|
}
|
|
550
594
|
firstUpdated() {
|
|
551
|
-
this.configTask.run();
|
|
552
|
-
this.countriesTask.run();
|
|
553
|
-
this.geolocationTask.run();
|
|
554
|
-
this.reservationsCheckTask.run();
|
|
555
|
-
this.reservationsTask.run();
|
|
556
|
-
this.updateComplete.then(() => {
|
|
595
|
+
void this.configTask.run();
|
|
596
|
+
void this.countriesTask.run();
|
|
597
|
+
void this.geolocationTask.run();
|
|
598
|
+
void this.reservationsCheckTask.run();
|
|
599
|
+
void this.reservationsTask.run();
|
|
600
|
+
void this.updateComplete.then(() => {
|
|
557
601
|
const el = this.layoutElement;
|
|
558
602
|
if (el) {
|
|
559
603
|
this.layoutController.observe(el);
|
|
560
604
|
}
|
|
561
605
|
});
|
|
562
606
|
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
// disconnect/reconnect cycles (e.g. route transitions).
|
|
567
|
-
if (this.abortController.signal.aborted) {
|
|
568
|
-
this.abortController = new AbortController();
|
|
569
|
-
}
|
|
570
|
-
}
|
|
607
|
+
// This element is single-use: the SDK creates a fresh instance for every
|
|
608
|
+
// navigation, so nothing re-initialises the tasks, CDP or the abort signal
|
|
609
|
+
// after a disconnect. Disconnecting cancels the in-flight polling for good.
|
|
571
610
|
disconnectedCallback() {
|
|
572
611
|
this.abortController.abort();
|
|
573
612
|
this.clearBalanceBackoff();
|
|
@@ -586,12 +625,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
586
625
|
const reservations = this.reservationsTask?.value?.reservations;
|
|
587
626
|
if (!reservations?.length)
|
|
588
627
|
return 0;
|
|
589
|
-
return reservations.reduce((sum,
|
|
590
|
-
const val = r.loyalty
|
|
591
|
-
? Number(Object.values(r.loyalty[field])[0] ?? 0)
|
|
592
|
-
: 0;
|
|
593
|
-
return sum + (isNaN(val) ? 0 : val);
|
|
594
|
-
}, 0);
|
|
628
|
+
return reservations.reduce((sum, reservation) => sum + getLoyaltyAmount(reservation.loyalty, field), 0);
|
|
595
629
|
}
|
|
596
630
|
formatEarnedTokens() {
|
|
597
631
|
if (!this.earnedTokensToIssue)
|
|
@@ -611,9 +645,6 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
611
645
|
this.formController.marketing = event.detail.value;
|
|
612
646
|
this.requestUpdate();
|
|
613
647
|
}
|
|
614
|
-
isValidEmail(email) {
|
|
615
|
-
return isValidEmail(email);
|
|
616
|
-
}
|
|
617
648
|
handlePaymentTypeSelected(event) {
|
|
618
649
|
this.paymentType = event.detail.type;
|
|
619
650
|
if (this.paymentType === "crypto" &&
|
|
@@ -638,29 +669,19 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
638
669
|
*/
|
|
639
670
|
scrollToFirstError() {
|
|
640
671
|
const root = this.renderRoot;
|
|
641
|
-
//
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
"coras-checkbox[error]",
|
|
672
|
+
// Candidates in form order. The activity details and billing address
|
|
673
|
+
// partials render inside their own shadow roots, so each reports its own
|
|
674
|
+
// first invalid field; the page's own fields sit around them.
|
|
675
|
+
const candidates = [
|
|
676
|
+
root.querySelector(INVALID_FIELD_SELECTOR),
|
|
677
|
+
this.activityDetails?.firstInvalidElement(),
|
|
678
|
+
this.stripeController.hasError
|
|
679
|
+
? root.querySelector("coras-stripe")
|
|
680
|
+
: null,
|
|
681
|
+
this.billingAddress?.firstInvalidElement(),
|
|
682
|
+
root.querySelector("coras-checkbox[error]"),
|
|
652
683
|
];
|
|
653
|
-
|
|
654
|
-
selectors.push("coras-stripe");
|
|
655
|
-
}
|
|
656
|
-
let target = null;
|
|
657
|
-
for (const sel of selectors) {
|
|
658
|
-
const el = root.querySelector(sel);
|
|
659
|
-
if (el) {
|
|
660
|
-
target = el;
|
|
661
|
-
break;
|
|
662
|
-
}
|
|
663
|
-
}
|
|
684
|
+
const target = candidates.find((candidate) => !!candidate);
|
|
664
685
|
if (!target)
|
|
665
686
|
return;
|
|
666
687
|
target.scrollIntoView({
|
|
@@ -774,9 +795,6 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
774
795
|
hasCryptoEmail() {
|
|
775
796
|
return !!(this.formController.formValues.email || this.coinbaseSession?.email);
|
|
776
797
|
}
|
|
777
|
-
renderCryptoWalletInfo() {
|
|
778
|
-
return nothing;
|
|
779
|
-
}
|
|
780
798
|
renderPaymentDetailsStep() {
|
|
781
799
|
const fidaAmount = this.getReservationsLoyaltyTotal("pay");
|
|
782
800
|
const formattedFidaAmount = new Intl.NumberFormat(this.locale).format(isNaN(fidaAmount) ? 0 : fidaAmount);
|
|
@@ -791,9 +809,6 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
791
809
|
const currentBalance = Number(formattedBalance);
|
|
792
810
|
const insufficientBalance = balance === null || balance === 0n || currentBalance < fidaAmount;
|
|
793
811
|
return html `
|
|
794
|
-
${isLoggedIn && isFullyAuthenticated
|
|
795
|
-
? this.renderCryptoWalletInfo()
|
|
796
|
-
: nothing}
|
|
797
812
|
${this.renderBillingAddress()}
|
|
798
813
|
<div class="footer">
|
|
799
814
|
<div class="terms-and-button crypto-footer">
|
|
@@ -900,13 +915,14 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
900
915
|
mfa-error=${this.cryptoAuthController.mfaError}
|
|
901
916
|
mfa-enrollment-error=${this.mfaEnrollmentError || ""}
|
|
902
917
|
?show-resend=${this.cryptoAuthController.showResend}
|
|
918
|
+
email-code-send-count=${this.cryptoAuthController.otpAttempts}
|
|
903
919
|
rate-limit-error=${this.cryptoAuthController.otpRateLimitError}
|
|
904
920
|
sms-rate-limit-error=${this.cryptoAuthController.smsRateLimitError}
|
|
905
921
|
form-phone=${formPhone || ""}
|
|
906
922
|
masked-phone=${maskedPhone}
|
|
907
923
|
phone-number-error=${this.cryptoAuthController.phoneNumberError || ""}
|
|
908
924
|
assets-url=${this.assetsURL}
|
|
909
|
-
?loading=${this.
|
|
925
|
+
?loading=${this.cryptoAuthController.isAuthenticating}
|
|
910
926
|
?show-phone-input=${this.cryptoAuthController.showMfaPhoneInput}
|
|
911
927
|
.countries=${this.countriesTask.value || []}
|
|
912
928
|
.selectedPhoneCode=${this.cryptoAuthController.mfaSelectedPhoneCode ||
|
|
@@ -928,13 +944,13 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
928
944
|
this.cryptoAuthController.otpError = "";
|
|
929
945
|
this.cryptoAuthController.clearOtpInactivityTimer();
|
|
930
946
|
this.cryptoAuthController.showResend = false;
|
|
931
|
-
this.handleLogin();
|
|
947
|
+
void this.handleLogin();
|
|
932
948
|
}}
|
|
933
949
|
@resend-email-code=${this.handleResendCode}
|
|
934
950
|
@initiate-mfa-enrollment=${() => {
|
|
935
951
|
const formPhone = this.getFormPhoneNumber();
|
|
936
952
|
const hasFormPhone = !!formPhone && !this.cryptoAuthController.showMfaPhoneInput;
|
|
937
|
-
this.cryptoAuthController.handleMfaEnrollmentWithFormPhone(formPhone, hasFormPhone, this.formController.selectedPhoneCode?.
|
|
953
|
+
void this.cryptoAuthController.handleMfaEnrollmentWithFormPhone(formPhone, hasFormPhone, this.formController.selectedPhoneCode?.code || "", (err) => {
|
|
938
954
|
this.mfaEnrollmentError = err;
|
|
939
955
|
});
|
|
940
956
|
}}
|
|
@@ -942,12 +958,12 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
942
958
|
this.cryptoAuthController.mfaCode = e.detail.code || "";
|
|
943
959
|
if (this.cryptoAuthController.mfaError)
|
|
944
960
|
this.cryptoAuthController.mfaError = "";
|
|
945
|
-
this.cryptoAuthController.handleVerifyMfaEnrollment();
|
|
961
|
+
void this.cryptoAuthController.handleVerifyMfaEnrollment();
|
|
946
962
|
}}
|
|
947
963
|
@resend-mfa-code=${() => {
|
|
948
964
|
const formPhone = this.getFormPhoneNumber();
|
|
949
965
|
const hasFormPhone = !!formPhone && !this.cryptoAuthController.showMfaPhoneInput;
|
|
950
|
-
this.cryptoAuthController.handleMfaEnrollmentWithFormPhone(formPhone, hasFormPhone, this.formController.selectedPhoneCode?.
|
|
966
|
+
void this.cryptoAuthController.handleMfaEnrollmentWithFormPhone(formPhone, hasFormPhone, this.formController.selectedPhoneCode?.code || "", (err) => {
|
|
951
967
|
this.mfaEnrollmentError = err;
|
|
952
968
|
});
|
|
953
969
|
}}
|
|
@@ -1070,7 +1086,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1070
1086
|
}
|
|
1071
1087
|
async handleCryptoLoginSuccess() {
|
|
1072
1088
|
await this.syncEmailFromCoinbase();
|
|
1073
|
-
this.submitUserConsent();
|
|
1089
|
+
void this.submitUserConsent();
|
|
1074
1090
|
}
|
|
1075
1091
|
async submitUserConsent() {
|
|
1076
1092
|
try {
|
|
@@ -1112,6 +1128,37 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1112
1128
|
? reservations
|
|
1113
1129
|
: [], this.reservationsCheckTask.value, this.getFieldValue.bind(this), this.formController.selectedPhoneCode);
|
|
1114
1130
|
}
|
|
1131
|
+
/**
|
|
1132
|
+
* PATCHes the chosen pickup point onto every reservation that requires one.
|
|
1133
|
+
* Returns the form field names whose PATCH failed (empty when all saved).
|
|
1134
|
+
*/
|
|
1135
|
+
async savePickupPoints() {
|
|
1136
|
+
const reservations = this.reservationsCheckTask.value?.reservations ?? [];
|
|
1137
|
+
const pickupUpdates = reservations.flatMap((reservation) => {
|
|
1138
|
+
const requiresPickup = reservation.requirements?.some((req) => req.field === "pickup_point");
|
|
1139
|
+
if (!reservation.id || !requiresPickup)
|
|
1140
|
+
return [];
|
|
1141
|
+
const fieldName = `reservation_${reservation.id}_pickup_point`;
|
|
1142
|
+
const pickupId = this.getFieldValue(fieldName);
|
|
1143
|
+
return pickupId
|
|
1144
|
+
? [{ reservationId: reservation.id, fieldName, pickupId }]
|
|
1145
|
+
: [];
|
|
1146
|
+
});
|
|
1147
|
+
const results = await Promise.all(pickupUpdates.map(async ({ reservationId, fieldName, pickupId }) => {
|
|
1148
|
+
try {
|
|
1149
|
+
await this.getApiService().patchReservation(reservationId, {
|
|
1150
|
+
pickup_id: pickupId,
|
|
1151
|
+
pickup_entry: null,
|
|
1152
|
+
});
|
|
1153
|
+
return null;
|
|
1154
|
+
}
|
|
1155
|
+
catch {
|
|
1156
|
+
this.logger.error("Failed to update pickup_id for reservation");
|
|
1157
|
+
return fieldName;
|
|
1158
|
+
}
|
|
1159
|
+
}));
|
|
1160
|
+
return results.filter((fieldName) => !!fieldName);
|
|
1161
|
+
}
|
|
1115
1162
|
/**
|
|
1116
1163
|
* Confirms the reservation with the API
|
|
1117
1164
|
*/
|
|
@@ -1122,36 +1169,27 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1122
1169
|
/* reservation data prepared */
|
|
1123
1170
|
try {
|
|
1124
1171
|
if (!reservations.length) {
|
|
1125
|
-
|
|
1172
|
+
this.logger.error("No reservations found");
|
|
1126
1173
|
this.formController.formErrors = {
|
|
1127
1174
|
...this.formController.formErrors,
|
|
1128
|
-
reservations: "At least one reservation is required",
|
|
1175
|
+
reservations: msg("At least one reservation is required"),
|
|
1129
1176
|
};
|
|
1130
1177
|
return null;
|
|
1131
1178
|
}
|
|
1132
|
-
const
|
|
1133
|
-
if (
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
});
|
|
1145
|
-
if (error) {
|
|
1146
|
-
console.error("Failed to update pickup_id for reservation");
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1179
|
+
const failedPickupFields = await this.savePickupPoints();
|
|
1180
|
+
if (failedPickupFields.length > 0) {
|
|
1181
|
+
const pickupErrors = Object.fromEntries(failedPickupFields.map((fieldName) => [
|
|
1182
|
+
fieldName,
|
|
1183
|
+
msg("We could not save your pickup point. Please try again."),
|
|
1184
|
+
]));
|
|
1185
|
+
this.formController.formErrors = {
|
|
1186
|
+
...this.formController.formErrors,
|
|
1187
|
+
...pickupErrors,
|
|
1188
|
+
};
|
|
1189
|
+
void this.updateComplete.then(() => this.scrollToFirstError());
|
|
1190
|
+
return null;
|
|
1152
1191
|
}
|
|
1153
|
-
|
|
1154
|
-
if (customer.phone && !phoneNumber) {
|
|
1192
|
+
if (this.getFieldValue("phone") && !customer.phone) {
|
|
1155
1193
|
// Validate phone format client-side before sending to the API
|
|
1156
1194
|
this.formController.formErrors = {
|
|
1157
1195
|
...this.formController.formErrors,
|
|
@@ -1164,14 +1202,14 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1164
1202
|
}
|
|
1165
1203
|
const bookingSession = getBookingSession(this.distributorID);
|
|
1166
1204
|
if (!bookingSession) {
|
|
1167
|
-
|
|
1205
|
+
this.logger.error("Cannot confirm reservation: booking session is missing.");
|
|
1168
1206
|
return null;
|
|
1169
1207
|
}
|
|
1170
1208
|
const body = {
|
|
1171
|
-
first_name:
|
|
1172
|
-
second_name:
|
|
1209
|
+
first_name: this.getFieldValue("first_name"),
|
|
1210
|
+
second_name: this.getFieldValue("second_name"),
|
|
1173
1211
|
email: customer.email,
|
|
1174
|
-
phone_number:
|
|
1212
|
+
phone_number: customer.phone || "",
|
|
1175
1213
|
reservations,
|
|
1176
1214
|
attendees: hasRequirements && attendees.length > 0 ? attendees : null,
|
|
1177
1215
|
payment_type: this.paymentType === "crypto" ? 1 : 0,
|
|
@@ -1200,11 +1238,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1200
1238
|
customHeaders["Coinbase-Access-Token"] = accessToken;
|
|
1201
1239
|
}
|
|
1202
1240
|
}
|
|
1203
|
-
const { data
|
|
1204
|
-
if (error) {
|
|
1205
|
-
this.handleApiErrors(error);
|
|
1206
|
-
return null;
|
|
1207
|
-
}
|
|
1241
|
+
const { data } = await this.getApiService().confirmReservation(body, bookingSession, customHeaders);
|
|
1208
1242
|
if (data) {
|
|
1209
1243
|
const responseData = data;
|
|
1210
1244
|
this.transactionId = responseData.transaction_id;
|
|
@@ -1221,27 +1255,52 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1221
1255
|
return null;
|
|
1222
1256
|
}
|
|
1223
1257
|
}
|
|
1224
|
-
async checkTransactionStatus(userId, maxAttempts = TRANSACTION_POLLING_MAX_ATTEMPTS
|
|
1225
|
-
const { status, tokensToIssue } = await pollTransactionStatus(userId, maxAttempts,
|
|
1258
|
+
async checkTransactionStatus(userId, maxAttempts = TRANSACTION_POLLING_MAX_ATTEMPTS) {
|
|
1259
|
+
const { status, tokensToIssue } = await pollTransactionStatus(userId, this.transactionId, maxAttempts, TRANSACTION_POLLING_INITIAL_INTERVAL_MS, TRANSACTION_POLLING_MAX_INTERVAL_MS, this.client, this.distributorID, this.locale, this.logger, (referenceId) => {
|
|
1226
1260
|
this.referenceId = referenceId;
|
|
1227
1261
|
}, this.abortController.signal);
|
|
1228
1262
|
if (status === "PAID") {
|
|
1229
|
-
this.paymentSuccessful = true;
|
|
1230
1263
|
this.earnedTokensToIssue = tokensToIssue;
|
|
1231
1264
|
}
|
|
1265
|
+
return status;
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Moves the page to the outcome of a polled transaction status. Only a
|
|
1269
|
+
* final non-PAID status is a failure; anything else after the polling
|
|
1270
|
+
* budget is pending and keeps the reference for a later check.
|
|
1271
|
+
*/
|
|
1272
|
+
settleTransaction(status) {
|
|
1273
|
+
if (status === "PAID") {
|
|
1274
|
+
// PaymentIntent is consumed; drop it so a later submit cannot reuse it
|
|
1275
|
+
this.pendingClientSecret = null;
|
|
1276
|
+
this.flowController.transition("success");
|
|
1277
|
+
this.redirectToConfirmation(true);
|
|
1278
|
+
}
|
|
1279
|
+
else if (isFinalStatus(status)) {
|
|
1280
|
+
this.logger.error("Transaction failed with status:", status);
|
|
1281
|
+
this.flowController.transition("failed");
|
|
1282
|
+
this.redirectToConfirmation(false);
|
|
1283
|
+
}
|
|
1232
1284
|
else {
|
|
1233
|
-
this.
|
|
1285
|
+
this.flowController.transition("pending");
|
|
1286
|
+
if (this.paymentPending)
|
|
1287
|
+
return;
|
|
1288
|
+
fireEvent(this, "coras:payment-status", {
|
|
1289
|
+
status: "pending",
|
|
1290
|
+
...(this.transactionId ? { reference: this.transactionId } : {}),
|
|
1291
|
+
});
|
|
1292
|
+
window.scrollTo({ top: 0, behavior: "instant" });
|
|
1293
|
+
this.paymentPending = true;
|
|
1234
1294
|
}
|
|
1235
|
-
return status;
|
|
1236
1295
|
}
|
|
1237
1296
|
/**
|
|
1238
1297
|
* Sanitizes error objects to prevent leaking internal/SDK details to the user.
|
|
1239
|
-
* Only
|
|
1298
|
+
* Only a structured `{ errors }` body maps to fields; anything else (5xx,
|
|
1299
|
+
* text body, network failure) returns null so the generic card error shows.
|
|
1240
1300
|
*/
|
|
1241
1301
|
sanitizeError(error) {
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
return { errors: {} };
|
|
1302
|
+
const body = unwrapApiErrorBody(error);
|
|
1303
|
+
return isApiError(body) ? body : null;
|
|
1245
1304
|
}
|
|
1246
1305
|
/**
|
|
1247
1306
|
* Handles API errors by mapping them to form fields
|
|
@@ -1255,7 +1314,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1255
1314
|
if (cardError) {
|
|
1256
1315
|
this.stripeController.cardError = cardError;
|
|
1257
1316
|
}
|
|
1258
|
-
this.updateComplete.then(() => this.scrollToFirstError());
|
|
1317
|
+
void this.updateComplete.then(() => this.scrollToFirstError());
|
|
1259
1318
|
}
|
|
1260
1319
|
handleTryAgain() {
|
|
1261
1320
|
// Reset submit state so the user can re-submit
|
|
@@ -1296,18 +1355,18 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1296
1355
|
}
|
|
1297
1356
|
}
|
|
1298
1357
|
renderField(options) {
|
|
1299
|
-
const { fieldName,
|
|
1358
|
+
const { fieldName, borderless, suppressHelpText } = options;
|
|
1300
1359
|
if (fieldName === "phone") {
|
|
1301
1360
|
return this.renderPhoneField(fieldName);
|
|
1302
1361
|
}
|
|
1303
|
-
const fieldConfig = getFieldConfig(fieldName, FIELDS
|
|
1362
|
+
const fieldConfig = getFieldConfig(fieldName, FIELDS);
|
|
1304
1363
|
if (!fieldConfig)
|
|
1305
1364
|
return null;
|
|
1306
1365
|
const value = this.getFieldValue(fieldName);
|
|
1307
1366
|
const error = this.formController.formErrors[fieldName] || "";
|
|
1308
1367
|
const validated = this.flowController.submissionAttempts > 0;
|
|
1309
1368
|
const hasError = validated && !!error;
|
|
1310
|
-
if (fieldName === "country"
|
|
1369
|
+
if (fieldName === "country") {
|
|
1311
1370
|
return html `
|
|
1312
1371
|
<coras-country-field
|
|
1313
1372
|
name="${fieldName}"
|
|
@@ -1458,6 +1517,9 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1458
1517
|
if (this.paymentFailed) {
|
|
1459
1518
|
return this.renderFailure();
|
|
1460
1519
|
}
|
|
1520
|
+
if (this.paymentPending) {
|
|
1521
|
+
return this.renderPending();
|
|
1522
|
+
}
|
|
1461
1523
|
return this.configTask.render({
|
|
1462
1524
|
initial: () => this.renderPaymentSkeleton(),
|
|
1463
1525
|
pending: () => this.renderPaymentSkeleton(),
|
|
@@ -1497,12 +1559,62 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1497
1559
|
</div>
|
|
1498
1560
|
`;
|
|
1499
1561
|
}
|
|
1562
|
+
renderPending() {
|
|
1563
|
+
const reference = this.referenceId || this.transactionId;
|
|
1564
|
+
return html `
|
|
1565
|
+
<div class="payment-error-container">
|
|
1566
|
+
<coras-alert
|
|
1567
|
+
variant="warning"
|
|
1568
|
+
heading="${msg("We are confirming your payment")}"
|
|
1569
|
+
assets-url="${this.assetsURL}"
|
|
1570
|
+
>
|
|
1571
|
+
${msg("Your payment was received but we are still waiting for the confirmation. This can take a few minutes; you do not need to pay again.")}
|
|
1572
|
+
${reference ? html `<br />${msg("Reference")}: ${reference}` : nothing}
|
|
1573
|
+
<coras-button
|
|
1574
|
+
slot="action-below"
|
|
1575
|
+
?loading=${this.flowController.isProcessing}
|
|
1576
|
+
@click=${this.handleCheckAgain}
|
|
1577
|
+
data-testid="check-again"
|
|
1578
|
+
>
|
|
1579
|
+
${msg("Check again")}
|
|
1580
|
+
</coras-button>
|
|
1581
|
+
</coras-alert>
|
|
1582
|
+
</div>
|
|
1583
|
+
`;
|
|
1584
|
+
}
|
|
1500
1585
|
renderFailure() {
|
|
1586
|
+
// After an on-chain transfer the tokens have already moved and the booking
|
|
1587
|
+
// session is consumed, so a retry would transfer again: give the customer
|
|
1588
|
+
// the reference for support instead of a "Try again" button.
|
|
1589
|
+
if (this.paymentType === "crypto") {
|
|
1590
|
+
const reference = this.referenceId || this.transactionId;
|
|
1591
|
+
return html `
|
|
1592
|
+
<div class="payment-error-container">
|
|
1593
|
+
<coras-alert
|
|
1594
|
+
variant="error"
|
|
1595
|
+
heading="${msg("Sorry, your order was not successful")}"
|
|
1596
|
+
assets-url="${this.assetsURL}"
|
|
1597
|
+
>
|
|
1598
|
+
${msg("Your FIDA tokens were transferred but the order could not be completed. Please contact our help centre and quote your reference; do not pay again.")}
|
|
1599
|
+
${reference
|
|
1600
|
+
? html `<br />${msg("Reference")}: ${reference}`
|
|
1601
|
+
: nothing}
|
|
1602
|
+
<coras-button
|
|
1603
|
+
slot="action-below"
|
|
1604
|
+
@click=${() => this.dispatchPageUpdate({ page: "help" })}
|
|
1605
|
+
data-testid="help-centre"
|
|
1606
|
+
>
|
|
1607
|
+
${msg("Help centre")}
|
|
1608
|
+
</coras-button>
|
|
1609
|
+
</coras-alert>
|
|
1610
|
+
</div>
|
|
1611
|
+
`;
|
|
1612
|
+
}
|
|
1501
1613
|
return html `
|
|
1502
1614
|
<div class="payment-error-container">
|
|
1503
1615
|
<coras-alert
|
|
1504
1616
|
variant="error"
|
|
1505
|
-
|
|
1617
|
+
heading="${msg("Sorry, your order was not successful")}"
|
|
1506
1618
|
assets-url="${this.assetsURL}"
|
|
1507
1619
|
>
|
|
1508
1620
|
${msg("Your card has not been charged. If you want to try again, please click the button to go back to the same event")}
|
|
@@ -1517,6 +1629,19 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1517
1629
|
</div>
|
|
1518
1630
|
`;
|
|
1519
1631
|
}
|
|
1632
|
+
/**
|
|
1633
|
+
* Re-runs whichever page task failed. The modal is also shown for crypto
|
|
1634
|
+
* transfer failures, where no task is in error; re-checking the reservations
|
|
1635
|
+
* then refreshes the requirements without losing the form.
|
|
1636
|
+
*/
|
|
1637
|
+
retryFailedTask() {
|
|
1638
|
+
const failedTask = [
|
|
1639
|
+
this.configTask,
|
|
1640
|
+
this.reservationsCheckTask,
|
|
1641
|
+
this.reservationsTask,
|
|
1642
|
+
].find((task) => task.status === TaskStatus.ERROR);
|
|
1643
|
+
void (failedTask ?? this.reservationsCheckTask).run();
|
|
1644
|
+
}
|
|
1520
1645
|
renderReservationsTask() {
|
|
1521
1646
|
// The check task gates the form: it surfaces API failures and supplies the
|
|
1522
1647
|
// field requirements. Basket emptiness, though, is decided by the actual
|
|
@@ -1567,8 +1692,9 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1567
1692
|
`;
|
|
1568
1693
|
}
|
|
1569
1694
|
renderBottomDrawer() {
|
|
1570
|
-
if (this.paymentSuccessful || this.paymentFailed)
|
|
1695
|
+
if (this.paymentSuccessful || this.paymentFailed || this.paymentPending) {
|
|
1571
1696
|
return nothing;
|
|
1697
|
+
}
|
|
1572
1698
|
return html `
|
|
1573
1699
|
<coras-bottom-drawer
|
|
1574
1700
|
.open=${!this.layoutController.isBasketVisible}
|
|
@@ -1621,18 +1747,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1621
1747
|
* Returns the E.164 formatted phone or null if not available.
|
|
1622
1748
|
*/
|
|
1623
1749
|
getFormPhoneNumber() {
|
|
1624
|
-
|
|
1625
|
-
const phoneNumber = this.formController.formValues.phone;
|
|
1626
|
-
if (!phoneCode || !phoneNumber) {
|
|
1627
|
-
return null;
|
|
1628
|
-
}
|
|
1629
|
-
const cleanNumber = phoneNumber
|
|
1630
|
-
.replace(/^[+0]+/, "")
|
|
1631
|
-
.replace(/[\s\-()]/g, "");
|
|
1632
|
-
return `+${phoneCode}${cleanNumber}`;
|
|
1633
|
-
}
|
|
1634
|
-
recoverPendingTransfer() {
|
|
1635
|
-
return this.cryptoTransferController.recoverPendingTransfer();
|
|
1750
|
+
return (toE164(this.formController.formValues.phone, this.formController.selectedPhoneCode?.code) ?? null);
|
|
1636
1751
|
}
|
|
1637
1752
|
/**
|
|
1638
1753
|
* Renders the OTP verification modal for crypto payments
|
|
@@ -1664,14 +1779,14 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1664
1779
|
<slot name="navbar" slot="navbar"></slot>
|
|
1665
1780
|
<div class="content">
|
|
1666
1781
|
${this.renderContent()}
|
|
1667
|
-
${this.paymentSuccessful || this.paymentFailed
|
|
1782
|
+
${this.paymentSuccessful || this.paymentFailed || this.paymentPending
|
|
1668
1783
|
? nothing
|
|
1669
1784
|
: html `<coras-basket></coras-basket>`}
|
|
1670
1785
|
</div>
|
|
1671
1786
|
${this.renderErrorModal({
|
|
1672
1787
|
assetsURL: this.assetsURL,
|
|
1673
1788
|
buttonLabel: msg("Refresh the page"),
|
|
1674
|
-
onRetry: () => this.
|
|
1789
|
+
onRetry: () => this.retryFailedTask(),
|
|
1675
1790
|
onHelp: () => this.dispatchPageUpdate({ page: "help" }),
|
|
1676
1791
|
})}
|
|
1677
1792
|
${this.renderBottomDrawer()} ${this.renderTransferModal()}
|
|
@@ -1698,6 +1813,12 @@ __decorate([
|
|
|
1698
1813
|
__decorate([
|
|
1699
1814
|
query("coras-stripe")
|
|
1700
1815
|
], CorasPaymentPage.prototype, "stripeComponent", void 0);
|
|
1816
|
+
__decorate([
|
|
1817
|
+
query("coras-billing-address")
|
|
1818
|
+
], CorasPaymentPage.prototype, "billingAddress", void 0);
|
|
1819
|
+
__decorate([
|
|
1820
|
+
query("coras-activity-details")
|
|
1821
|
+
], CorasPaymentPage.prototype, "activityDetails", void 0);
|
|
1701
1822
|
__decorate([
|
|
1702
1823
|
state()
|
|
1703
1824
|
], CorasPaymentPage.prototype, "showCryptoAuthModal", void 0);
|
|
@@ -1728,6 +1849,9 @@ __decorate([
|
|
|
1728
1849
|
__decorate([
|
|
1729
1850
|
state()
|
|
1730
1851
|
], CorasPaymentPage.prototype, "paymentFailed", void 0);
|
|
1852
|
+
__decorate([
|
|
1853
|
+
state()
|
|
1854
|
+
], CorasPaymentPage.prototype, "paymentPending", void 0);
|
|
1731
1855
|
__decorate([
|
|
1732
1856
|
state()
|
|
1733
1857
|
], CorasPaymentPage.prototype, "loyaltyPageUrl", void 0);
|