@coras-io/embed 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -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.js +0 -1
- 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/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 +14 -152
- 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
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
157
|
+
}
|
|
158
|
+
finally {
|
|
159
|
+
this.endAuthCall();
|
|
149
160
|
}
|
|
150
161
|
}
|
|
151
162
|
// ─── MFA Enrollment ─────────────────────────────────────────────────────────
|
|
152
163
|
/**
|
|
153
|
-
* Gets the
|
|
154
|
-
*
|
|
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(
|
|
157
|
-
|
|
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,
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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(
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
144
|
+
const checksum = await computeTransferChecksum(transactionHash, amount, timestamp);
|
|
141
145
|
const data = {
|
|
142
146
|
transactionHash,
|
|
143
|
-
amount
|
|
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
|
|
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
|
|
182
|
-
if (!
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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.
|
|
@@ -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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
}
|