@coras-io/embed 0.1.2 → 0.3.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 +139 -0
- package/README.md +8 -7
- package/dist/components/accordion/accordion-item/accordion-item.styles.js +1 -1
- package/dist/components/alert/alert.styles.js +14 -14
- package/dist/components/attraction-card/base/attraction-card.styles.js +7 -3
- package/dist/components/attraction-discovery/attraction-discovery.styles.js +1 -1
- package/dist/components/attraction-header/attraction-header.styles.js +1 -1
- package/dist/components/attraction-option/attraction-option.styles.js +4 -4
- package/dist/components/basket/basket.styles.js +27 -26
- package/dist/components/basket-empty/basket-empty.styles.js +1 -0
- package/dist/components/basket-item/basket-item.component.js +10 -4
- package/dist/components/basket-item/basket-item.styles.js +9 -3
- package/dist/components/basket-item-ticket/basket-item-ticket.styles.js +1 -3
- package/dist/components/basket-mobile/basket-mobile.styles.js +5 -5
- package/dist/components/better-carousel/better-carousel.styles.js +2 -0
- package/dist/components/bottom-drawer/bottom-drawer.styles.js +6 -4
- package/dist/components/button/button.component.d.ts +0 -1
- package/dist/components/button/button.component.js +1 -8
- package/dist/components/button/button.constants.d.ts +1 -1
- package/dist/components/button/button.constants.js +1 -1
- package/dist/components/button/button.styles.js +66 -39
- package/dist/components/calendar/base/calendar.styles.js +3 -5
- package/dist/components/calendar/multi/multi.styles.js +7 -0
- package/dist/components/category-tag/category-tag.styles.js +10 -7
- package/dist/components/checkbox/checkbox.styles.js +2 -2
- package/dist/components/chip/chip.styles.js +2 -2
- package/dist/components/collect-fida/collect-fida.component.js +5 -3
- package/dist/components/collect-fida/collect-fida.styles.js +9 -16
- package/dist/components/crypto-auth-modal/crypto-auth-modal.component.js +6 -4
- package/dist/components/crypto-auth-modal/crypto-auth-modal.styles.js +2 -2
- package/dist/components/dialog/dialog.styles.js +10 -17
- package/dist/components/drawer/drawer.component.js +6 -0
- package/dist/components/drawer/drawer.styles.js +17 -3
- package/dist/components/dropdown/dropdown.component.js +7 -0
- package/dist/components/dropdown/dropdown.styles.js +3 -6
- package/dist/components/expiration-timer/expiration-timer.styles.js +3 -3
- package/dist/components/explore-card/explore-card.styles.js +1 -1
- package/dist/components/filter-chip/filter-chip.styles.js +11 -9
- package/dist/components/filters-drawer/filters-drawer.component.js +1 -1
- package/dist/components/filters-drawer/filters-drawer.styles.js +6 -5
- package/dist/components/image/image.styles.js +3 -3
- package/dist/components/image-chip/image-chip.styles.js +1 -1
- package/dist/components/input-field/input-field.styles.js +22 -17
- package/dist/components/itinerary/itinerary-item/itinerary-item.styles.js +1 -1
- package/dist/components/joined-fields/joined-fields.styles.js +10 -6
- package/dist/components/loading-spinner/loading-spinner.styles.js +1 -1
- package/dist/components/location-image/location-image.component.d.ts +6 -0
- package/dist/components/location-image/location-image.component.js +15 -2
- package/dist/components/location-image/location-image.styles.js +1 -1
- package/dist/components/locations-results/locations-results.styles.js +4 -6
- package/dist/components/marketing-tag/marketing-tag.styles.js +1 -1
- package/dist/components/message-card/message-card.styles.js +6 -6
- package/dist/components/option-group/option-chip/option-chip.styles.js +4 -3
- package/dist/components/order-confirmation/order-confirmation-item/order-confirmation-item.styles.js +9 -0
- package/dist/components/order-confirmation/order-confirmation.component.js +4 -3
- package/dist/components/order-confirmation/order-confirmation.styles.js +1 -1
- package/dist/components/otp/otp.styles.js +6 -6
- package/dist/components/overlay/overlay.styles.js +5 -1
- package/dist/components/pay-in/pay-in.styles.js +2 -2
- package/dist/components/payment-fiat-method/payment-fiat-method.styles.js +20 -4
- package/dist/components/payment-option/payment-option.styles.js +10 -12
- package/dist/components/performance-time/performance-time.styles.js +2 -2
- package/dist/components/phone-country-code/phone-country-code.styles.js +1 -1
- package/dist/components/points/points.styles.js +1 -1
- package/dist/components/search-button/search-button.styles.js +15 -7
- package/dist/components/seated-selector/seated-selector.component.d.ts +4 -1
- package/dist/components/seated-selector/seated-selector.component.js +90 -36
- package/dist/components/seated-selector/seated-selector.styles.js +89 -14
- package/dist/components/seats-io/seats-io.component.d.ts +2 -0
- package/dist/components/seats-io/seats-io.component.js +35 -2
- package/dist/components/seats-io/seats-io.constants.d.ts +5 -0
- package/dist/components/seats-io/seats-io.constants.js +12 -0
- package/dist/components/seats-io/seats-io.transform.d.ts +8 -2
- package/dist/components/seats-io/seats-io.transform.js +12 -4
- package/dist/components/select-list/select-list.styles.js +1 -0
- package/dist/components/select-list/select-option/select-option.styles.js +3 -3
- package/dist/components/sort-dropdown/sort-dropdown.styles.js +1 -1
- package/dist/components/sort-list/sort-list.styles.js +1 -1
- package/dist/components/sport-options/sport-option/sport-option.styles.js +2 -2
- package/dist/components/star-rating/star-rating.component.d.ts +1 -0
- package/dist/components/star-rating/star-rating.component.js +19 -23
- package/dist/components/star-rating/star-rating.styles.js +32 -6
- package/dist/components/tab/tab.styles.js +1 -1
- package/dist/components/tabs/tabs.styles.js +1 -1
- package/dist/components/tag/tag.styles.js +7 -7
- package/dist/components/text-section/text-section.styles.js +2 -1
- package/dist/components/time-tag/time-tag.styles.js +1 -2
- package/dist/components/tooltip/tooltip.styles.js +3 -3
- package/dist/components/tour-ticket-type-selector/tour-ticket-type/tour-ticket-type.styles.js +2 -2
- package/dist/components/tour-ticket-type-selector/tour-ticket-type-selector.component.js +1 -1
- package/dist/components/tour-ticket-type-selector/tour-ticket-type-selector.styles.js +1 -9
- package/dist/components/transfer-modal/transfer-modal.component.js +3 -3
- package/dist/components/transfer-modal/transfer-modal.styles.js +6 -8
- package/dist/containers/basket/basket.component.d.ts +1 -1
- package/dist/containers/basket/basket.component.js +56 -25
- package/dist/containers/footer/footer.styles.js +4 -0
- package/dist/containers/navbar/navbar.component.d.ts +5 -1
- package/dist/containers/navbar/navbar.component.js +38 -9
- package/dist/containers/navbar/navbar.styles.js +38 -12
- package/dist/contexts/basket/basket.provider.d.ts +1 -0
- package/dist/contexts/basket/basket.provider.js +31 -4
- package/dist/contexts/properties.context.d.ts +4 -4
- package/dist/core/api/middlewares/booking-session/booking-session.constants.d.ts +1 -0
- package/dist/core/api/middlewares/booking-session/booking-session.constants.js +1 -0
- package/dist/core/api/middlewares/booking-session/booking-session.js +18 -27
- package/dist/core/api/middlewares/booking-session/booking-session.utils.d.ts +4 -4
- package/dist/core/api/middlewares/booking-session/booking-session.utils.js +13 -10
- package/dist/core/api/queries.js +3 -2
- package/dist/core/color-scheme.d.ts +14 -0
- package/dist/core/color-scheme.js +48 -0
- package/dist/core/currency/constants.d.ts +1 -1
- package/dist/core/currency/constants.js +4 -3
- package/dist/core/i18n/date.js +20 -9
- package/dist/core/i18n/locale-codes.d.ts +2 -2
- package/dist/core/i18n/locale-codes.js +4 -0
- package/dist/core/images/constants.d.ts +0 -5
- package/dist/core/images/constants.js +0 -5
- package/dist/core/images/helpers.d.ts +8 -0
- package/dist/core/images/helpers.js +14 -6
- package/dist/core/images/srcset.js +2 -2
- package/dist/core/storybook/demo.d.ts +4 -0
- package/dist/core/storybook/demo.js +17 -0
- package/dist/core/types/locales.d.ts +7 -0
- package/dist/core/utils/datetime.js +10 -4
- package/dist/core/utils/locale.d.ts +8 -1
- package/dist/core/utils/locale.js +10 -0
- package/dist/helpers/helpers.d.ts +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +1 -2
- package/dist/locales/ar-SA.d.ts +279 -0
- package/dist/locales/ar-SA.js +288 -0
- package/dist/locales/da-DK.d.ts +100 -82
- package/dist/locales/da-DK.js +104 -89
- package/dist/locales/de-DE.d.ts +100 -82
- package/dist/locales/de-DE.js +104 -89
- package/dist/locales/en-IE.d.ts +250 -232
- package/dist/locales/en-IE.js +253 -238
- package/dist/locales/en-US.d.ts +100 -82
- package/dist/locales/en-US.js +105 -90
- package/dist/locales/es-ES.d.ts +100 -82
- package/dist/locales/es-ES.js +104 -89
- package/dist/locales/fr-FR.d.ts +100 -82
- package/dist/locales/fr-FR.js +104 -89
- package/dist/locales/fr-MA.d.ts +100 -82
- package/dist/locales/fr-MA.js +104 -89
- package/dist/locales/is-IS.d.ts +100 -82
- package/dist/locales/is-IS.js +104 -89
- package/dist/locales/it-IT.d.ts +100 -82
- package/dist/locales/it-IT.js +104 -89
- package/dist/locales/ms-MY.d.ts +100 -82
- package/dist/locales/ms-MY.js +104 -89
- package/dist/locales/nb-NO.d.ts +100 -82
- package/dist/locales/nb-NO.js +104 -89
- package/dist/locales/pl-PL.d.ts +100 -82
- package/dist/locales/pl-PL.js +104 -89
- package/dist/locales/pt-PT.d.ts +100 -82
- package/dist/locales/pt-PT.js +104 -89
- package/dist/locales/sv-SE.d.ts +100 -82
- package/dist/locales/sv-SE.js +104 -89
- package/dist/locales/th-TH.d.ts +100 -82
- package/dist/locales/th-TH.js +104 -89
- package/dist/locales/tr-TR.d.ts +100 -82
- package/dist/locales/tr-TR.js +104 -89
- package/dist/locales/zh-CN.d.ts +100 -82
- package/dist/locales/zh-CN.js +105 -90
- package/dist/locales/zh-HK.d.ts +279 -0
- package/dist/locales/zh-HK.js +288 -0
- package/dist/mixins/coinbase.mixin.js +1 -1
- package/dist/mixins/error-modal.styles.js +2 -2
- package/dist/mixins/location-search/location-search.js +3 -3
- package/dist/mixins/location-search/location-search.styles.js +6 -5
- package/dist/sdk/chrome.d.ts +9 -3
- package/dist/sdk/chrome.js +21 -9
- package/dist/sdk/element-adapter.js +11 -8
- package/dist/sdk/mount.d.ts +3 -3
- package/dist/sdk/mount.js +150 -42
- package/dist/sdk/navigation-intent.js +3 -0
- package/dist/sdk/page-registry.d.ts +14 -2
- package/dist/sdk/page-registry.js +33 -13
- package/dist/sdk/theme.d.ts +1 -15
- package/dist/sdk/theme.js +4 -39
- package/dist/sdk/types.d.ts +55 -24
- package/dist/sdk/url.d.ts +24 -3
- package/dist/sdk/url.js +66 -27
- package/dist/sdk/validation.d.ts +0 -7
- package/dist/sdk/validation.js +105 -47
- package/dist/styles/contrast-fixtures.d.ts +0 -5
- package/dist/styles/contrast-fixtures.js +79 -9
- package/dist/styles/contrast.js +4 -3
- package/dist/styles/defaults/component.js +17 -1
- package/dist/styles/primitives.d.ts +0 -10
- package/dist/styles/primitives.js +2 -12
- 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/styles/tokens.metadata.d.ts +1 -1
- package/dist/styles/tokens.metadata.js +360 -90
- package/dist/views/details-page/details-page.component.d.ts +5 -5
- package/dist/views/details-page/details-page.component.js +97 -71
- package/dist/views/details-page/details-page.styles.js +64 -9
- package/dist/views/details-page/partials/theater-description/theater-description.component.js +5 -0
- package/dist/views/help-page/help-page.component.d.ts +1 -0
- package/dist/views/help-page/help-page.component.js +11 -4
- package/dist/views/help-page/help-page.styles.js +21 -8
- package/dist/views/landing-page/landing-page.component.d.ts +4 -4
- package/dist/views/landing-page/landing-page.component.js +65 -65
- package/dist/views/landing-page/landing-page.styles.js +70 -3
- package/dist/views/payment-page/partials/activity-details/activity-details.styles.js +10 -33
- package/dist/views/payment-page/partials/billing-address/billing-address.styles.js +4 -9
- package/dist/views/payment-page/partials/confirmation/confirmation.styles.js +6 -6
- package/dist/views/payment-page/partials/hotel-pickup-list/hotel-pickup-list.styles.js +4 -4
- package/dist/views/payment-page/partials/payment-type-selector/payment-type-selector.styles.js +1 -0
- package/dist/views/payment-page/partials/stripe/stripe.component.d.ts +1 -1
- package/dist/views/payment-page/partials/stripe/stripe.component.js +11 -12
- package/dist/views/payment-page/partials/stripe/stripe.constants.d.ts +2 -15
- package/dist/views/payment-page/partials/stripe/stripe.constants.js +4 -17
- package/dist/views/payment-page/partials/stripe/stripe.styles.js +16 -23
- package/dist/views/payment-page/partials/stripe/stripe.utils.d.ts +25 -14
- package/dist/views/payment-page/partials/stripe/stripe.utils.js +111 -62
- package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.styles.js +1 -1
- package/dist/views/payment-page/payment-page.component.d.ts +1 -0
- package/dist/views/payment-page/payment-page.component.js +19 -9
- package/dist/views/payment-page/payment-page.styles.js +37 -32
- package/dist/views/payment-page/payment-page.utils.d.ts +7 -0
- package/dist/views/payment-page/payment-page.utils.js +29 -14
- package/dist/views/payment-page/payment-page.validators.js +9 -3
- package/dist/views/payment-page/services/payment-api.service.d.ts +1 -1
- package/dist/views/search-page/search-page.component.d.ts +1 -0
- package/dist/views/search-page/search-page.component.js +12 -6
- package/dist/views/search-page/search-page.styles.js +24 -2
- package/dist/views/suggestion-widget/suggestion-widget.styles.js +1 -1
- package/package.json +62 -75
- package/dist/custom-elements.json +0 -37378
- package/dist/sdk/meta.d.ts +0 -7
- package/dist/sdk/meta.js +0 -9
- package/dist/styles/tokens.css +0 -359
|
@@ -15,9 +15,9 @@ import "../../../../components/joined-fields/joined-fields.js";
|
|
|
15
15
|
import "../../../../components/input-field/input-field.js";
|
|
16
16
|
import styles from "./stripe.styles.js";
|
|
17
17
|
import { localized, msg } from "@lit/localize";
|
|
18
|
-
import { CSS_CLASSES, PLACEHOLDERS,
|
|
18
|
+
import { CSS_CLASSES, PLACEHOLDERS, INITIAL_PORTAL_UPDATE_DELAY_MS, } from "./stripe.constants.js";
|
|
19
19
|
import { fireInternalEvent, } from "../../../../core/events.js";
|
|
20
|
-
import { validateStripeKey, extractThemeColors, createStripeElementStyle, buildStripeAppearance, createPortalElement, positionPortalElement,
|
|
20
|
+
import { validateStripeKey, extractThemeColors, createStripeElementStyle, buildStripeAppearance, createPortalElement, positionPortalElement, createFrameThrottle, normalizeLocale, normalizeCountry, normalizeCurrency, } from "./stripe.utils.js";
|
|
21
21
|
let CorasStripe = class CorasStripe extends LitElement {
|
|
22
22
|
constructor() {
|
|
23
23
|
super(...arguments);
|
|
@@ -52,9 +52,9 @@ let CorasStripe = class CorasStripe extends LitElement {
|
|
|
52
52
|
this.isCardNumberValid = false;
|
|
53
53
|
this.isCardExpiryValid = false;
|
|
54
54
|
this.isCardCvcValid = false;
|
|
55
|
-
this.
|
|
55
|
+
this.portalUpdate = null;
|
|
56
56
|
this.handleWindowEvent = () => {
|
|
57
|
-
this.
|
|
57
|
+
this.portalUpdate?.execute();
|
|
58
58
|
};
|
|
59
59
|
this.handleCardChange = (event) => {
|
|
60
60
|
const errorMessage = event.error?.message ?? "";
|
|
@@ -113,11 +113,11 @@ let CorasStripe = class CorasStripe extends LitElement {
|
|
|
113
113
|
document.body.appendChild(this.cardNumberPortal);
|
|
114
114
|
document.body.appendChild(this.cardExpiryPortal);
|
|
115
115
|
document.body.appendChild(this.cardCvcPortal);
|
|
116
|
-
this.
|
|
116
|
+
this.portalUpdate = createFrameThrottle(() => this.positionAllPortals());
|
|
117
117
|
}
|
|
118
118
|
cleanupPortals() {
|
|
119
|
-
this.
|
|
120
|
-
this.
|
|
119
|
+
this.portalUpdate?.cancel();
|
|
120
|
+
this.portalUpdate = null;
|
|
121
121
|
this.cardNumberPortal?.remove();
|
|
122
122
|
this.cardExpiryPortal?.remove();
|
|
123
123
|
this.cardCvcPortal?.remove();
|
|
@@ -143,7 +143,7 @@ let CorasStripe = class CorasStripe extends LitElement {
|
|
|
143
143
|
this.intersectionObserver = null;
|
|
144
144
|
}
|
|
145
145
|
updatePortals() {
|
|
146
|
-
this.
|
|
146
|
+
this.portalUpdate?.execute();
|
|
147
147
|
}
|
|
148
148
|
positionAllPortals() {
|
|
149
149
|
const portals = [
|
|
@@ -190,7 +190,7 @@ let CorasStripe = class CorasStripe extends LitElement {
|
|
|
190
190
|
// Theme the hosted card iframe to match the embed's surface, brand, and
|
|
191
191
|
// colour scheme (light/dark) - the per-element style only sets text.
|
|
192
192
|
this.elements = this.stripe.elements({
|
|
193
|
-
appearance: buildStripeAppearance(
|
|
193
|
+
appearance: buildStripeAppearance(this),
|
|
194
194
|
});
|
|
195
195
|
this.initializeCardElement();
|
|
196
196
|
this.initializePaymentRequest();
|
|
@@ -256,11 +256,10 @@ let CorasStripe = class CorasStripe extends LitElement {
|
|
|
256
256
|
return;
|
|
257
257
|
}
|
|
258
258
|
this.destroyStripeElements();
|
|
259
|
-
const
|
|
260
|
-
const colors = extractThemeColors(computed);
|
|
259
|
+
const colors = extractThemeColors(this);
|
|
261
260
|
const baseStyle = createStripeElementStyle(colors);
|
|
262
261
|
// Re-theme on re-init so a colour-scheme change is reflected in the iframe.
|
|
263
|
-
this.elements.update({ appearance: buildStripeAppearance(
|
|
262
|
+
this.elements.update({ appearance: buildStripeAppearance(this) });
|
|
264
263
|
this.cardNumberElement = this.elements.create("cardNumber", {
|
|
265
264
|
style: baseStyle,
|
|
266
265
|
placeholder: PLACEHOLDERS.CARD_NUMBER,
|
|
@@ -1,43 +1,30 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Constants for the Stripe payment component.
|
|
3
|
-
*/
|
|
4
|
-
/** Valid Stripe publishable key prefixes. */
|
|
5
1
|
export declare const STRIPE_KEY_PREFIXES: readonly ["pk_test_", "pk_live_"];
|
|
6
|
-
/** Minimum length for a valid Stripe publishable key. */
|
|
7
2
|
export declare const STRIPE_KEY_MIN_LENGTH = 32;
|
|
8
|
-
/** Debounce delay for portal position updates (ms). ~60fps */
|
|
9
|
-
export declare const PORTAL_UPDATE_DEBOUNCE_MS = 16;
|
|
10
|
-
/** Default timeout before initial portal positioning (ms). */
|
|
11
3
|
export declare const INITIAL_PORTAL_UPDATE_DELAY_MS = 50;
|
|
12
|
-
/** CSS class names used by the component. */
|
|
13
4
|
export declare const CSS_CLASSES: {
|
|
14
5
|
readonly STRIPE_PLACEHOLDER: "stripe-placeholder";
|
|
15
6
|
readonly ERROR: "error";
|
|
16
7
|
readonly LOADING: "loading";
|
|
17
8
|
};
|
|
18
|
-
/** Default Stripe element style configuration. */
|
|
19
9
|
export declare const DEFAULT_STRIPE_STYLE: {
|
|
20
10
|
readonly fontSize: "16px";
|
|
21
11
|
readonly lineHeight: "52px";
|
|
22
12
|
readonly fontFamily: "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif";
|
|
23
13
|
};
|
|
24
|
-
/** Placeholder text for card input fields. */
|
|
25
14
|
export declare const PLACEHOLDERS: {
|
|
26
15
|
readonly CARD_NUMBER: "1234 1234 1234 1234";
|
|
27
16
|
readonly CARD_EXPIRY: "MM / YY";
|
|
28
17
|
readonly CARD_CVC: "CVC";
|
|
29
18
|
};
|
|
30
|
-
/** CSS variable names for theming. */
|
|
31
19
|
export declare const CSS_VARS: {
|
|
32
20
|
readonly FIELD_INPUT_COLOR: "--field-input-color";
|
|
33
21
|
readonly FIELD_INPUT_PLACEHOLDER_COLOR: "--field-input-placeholder-color";
|
|
34
22
|
readonly FIELD_INPUT_ERROR_COLOR: "--field-input-error-color";
|
|
35
|
-
readonly SURFACE: "--coras-color-
|
|
23
|
+
readonly SURFACE: "--coras-color-field";
|
|
36
24
|
readonly PRIMARY: "--coras-color-primary";
|
|
37
25
|
readonly FONT_FAMILY: "--coras-font-family-sans";
|
|
38
|
-
readonly BORDER_RADIUS: "--coras-radius-
|
|
26
|
+
readonly BORDER_RADIUS: "--coras-radius-field";
|
|
39
27
|
};
|
|
40
|
-
/** Default colors when CSS variables are not set. */
|
|
41
28
|
export declare const DEFAULT_COLORS: {
|
|
42
29
|
readonly TEXT: "#32325d";
|
|
43
30
|
readonly PLACEHOLDER: "#aab7c4";
|
|
@@ -1,45 +1,32 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Constants for the Stripe payment component.
|
|
3
|
-
*/
|
|
4
|
-
/** Valid Stripe publishable key prefixes. */
|
|
5
1
|
export const STRIPE_KEY_PREFIXES = ["pk_test_", "pk_live_"];
|
|
6
|
-
/** Minimum length for a valid Stripe publishable key. */
|
|
7
2
|
export const STRIPE_KEY_MIN_LENGTH = 32;
|
|
8
|
-
/** Debounce delay for portal position updates (ms). ~60fps */
|
|
9
|
-
export const PORTAL_UPDATE_DEBOUNCE_MS = 16;
|
|
10
|
-
/** Default timeout before initial portal positioning (ms). */
|
|
11
3
|
export const INITIAL_PORTAL_UPDATE_DELAY_MS = 50;
|
|
12
|
-
/** CSS class names used by the component. */
|
|
13
4
|
export const CSS_CLASSES = {
|
|
14
5
|
STRIPE_PLACEHOLDER: "stripe-placeholder",
|
|
15
6
|
ERROR: "error",
|
|
16
7
|
LOADING: "loading",
|
|
17
8
|
};
|
|
18
|
-
/** Default Stripe element style configuration. */
|
|
19
9
|
export const DEFAULT_STRIPE_STYLE = {
|
|
20
10
|
fontSize: "16px",
|
|
21
11
|
lineHeight: "52px",
|
|
22
12
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
|
|
23
13
|
};
|
|
24
|
-
/** Placeholder text for card input fields. */
|
|
25
14
|
export const PLACEHOLDERS = {
|
|
26
15
|
CARD_NUMBER: "1234 1234 1234 1234",
|
|
27
16
|
CARD_EXPIRY: "MM / YY",
|
|
28
17
|
CARD_CVC: "CVC",
|
|
29
18
|
};
|
|
30
|
-
/** CSS variable names for theming. */
|
|
31
19
|
export const CSS_VARS = {
|
|
32
20
|
FIELD_INPUT_COLOR: "--field-input-color",
|
|
33
21
|
FIELD_INPUT_PLACEHOLDER_COLOR: "--field-input-placeholder-color",
|
|
34
22
|
FIELD_INPUT_ERROR_COLOR: "--field-input-error-color",
|
|
35
|
-
|
|
36
|
-
// embed's surface, brand colour, and (light/dark) scheme.
|
|
37
|
-
SURFACE: "--coras-color-surface",
|
|
23
|
+
SURFACE: "--coras-color-field",
|
|
38
24
|
PRIMARY: "--coras-color-primary",
|
|
39
25
|
FONT_FAMILY: "--coras-font-family-sans",
|
|
40
|
-
|
|
26
|
+
// The Stripe card element sits in the same row as the embed's own text
|
|
27
|
+
// fields, so it takes the field radius rather than the general radius scale.
|
|
28
|
+
BORDER_RADIUS: "--coras-radius-field",
|
|
41
29
|
};
|
|
42
|
-
/** Default colors when CSS variables are not set. */
|
|
43
30
|
export const DEFAULT_COLORS = {
|
|
44
31
|
TEXT: "#32325d",
|
|
45
32
|
PLACEHOLDER: "#aab7c4",
|
|
@@ -11,10 +11,9 @@ export default css `
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.stripe-placeholder {
|
|
14
|
-
border: 1px solid
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
background-color: var(--coras-color-surface);
|
|
14
|
+
border: 1px solid var(--field-input-border-color);
|
|
15
|
+
border-radius: var(--field-input-border-radius);
|
|
16
|
+
background-color: var(--coras-color-field);
|
|
18
17
|
min-height: 3.2rem;
|
|
19
18
|
box-sizing: border-box;
|
|
20
19
|
padding-inline: 1rem;
|
|
@@ -24,12 +23,9 @@ export default css `
|
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
.stripe-placeholder:focus-within {
|
|
27
|
-
border-color: var(--field-input-
|
|
26
|
+
border-color: var(--field-input-focused-border-color);
|
|
28
27
|
box-shadow: 0 0 0 3px
|
|
29
|
-
var(
|
|
30
|
-
--field-input-focus-shadow-color,
|
|
31
|
-
color-mix(in srgb, var(--coras-color-primary-500), transparent 90%)
|
|
32
|
-
);
|
|
28
|
+
color-mix(in srgb, var(--coras-color-primary), transparent 90%);
|
|
33
29
|
outline: none;
|
|
34
30
|
}
|
|
35
31
|
|
|
@@ -42,34 +38,31 @@ export default css `
|
|
|
42
38
|
|
|
43
39
|
.card-field-container label {
|
|
44
40
|
display: block;
|
|
45
|
-
margin-bottom: var(--field-label-bottom-margin
|
|
46
|
-
font-size: var(--field-label-font-size
|
|
47
|
-
line-height: var(--field-label-line-height
|
|
48
|
-
color: var(--field-label-color
|
|
41
|
+
margin-bottom: var(--field-label-bottom-margin);
|
|
42
|
+
font-size: var(--field-label-font-size);
|
|
43
|
+
line-height: var(--field-label-line-height);
|
|
44
|
+
color: var(--field-label-color);
|
|
49
45
|
}
|
|
50
46
|
|
|
51
47
|
.stripe-element {
|
|
52
|
-
border: 1px solid var(--field-input-border-color
|
|
53
|
-
border-radius: var(--field-input-border-radius
|
|
48
|
+
border: 1px solid var(--field-input-border-color);
|
|
49
|
+
border-radius: var(--field-input-border-radius);
|
|
54
50
|
padding: 1rem;
|
|
55
|
-
background-color: var(--coras-color-
|
|
51
|
+
background-color: var(--coras-color-field);
|
|
56
52
|
min-height: 3.2rem;
|
|
57
53
|
box-sizing: border-box;
|
|
58
54
|
}
|
|
59
55
|
|
|
60
56
|
.stripe-element-error {
|
|
61
|
-
border-color: var(--field-input-error-color
|
|
57
|
+
border-color: var(--field-input-error-color);
|
|
62
58
|
}
|
|
63
59
|
|
|
64
60
|
.stripe-placeholder.error {
|
|
65
|
-
border-color: var(--field-input-error-color
|
|
61
|
+
border-color: var(--field-input-error-color);
|
|
66
62
|
}
|
|
67
63
|
|
|
68
64
|
.stripe-placeholder.disabled {
|
|
69
|
-
background-color: var(
|
|
70
|
-
--field-input-disabled-bg,
|
|
71
|
-
var(--coras-color-neutral-50)
|
|
72
|
-
);
|
|
65
|
+
background-color: var(--coras-color-neutral-50);
|
|
73
66
|
cursor: not-allowed;
|
|
74
67
|
opacity: 0.6;
|
|
75
68
|
}
|
|
@@ -95,7 +88,7 @@ export default css `
|
|
|
95
88
|
}
|
|
96
89
|
|
|
97
90
|
.error-message {
|
|
98
|
-
color: var(--field-input-error-color
|
|
91
|
+
color: var(--field-input-error-color);
|
|
99
92
|
font-size: 0.875rem;
|
|
100
93
|
margin-top: 0.5rem;
|
|
101
94
|
}
|
|
@@ -12,20 +12,21 @@ import type { StripeKeyValidationResult, ThemeColors, StripeElementStyle } from
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function validateStripeKey(key: string): StripeKeyValidationResult;
|
|
14
14
|
/**
|
|
15
|
-
* Extracts theme colors from
|
|
15
|
+
* Extracts theme colors from the host's resolved tokens or returns defaults.
|
|
16
16
|
*
|
|
17
|
-
* @param
|
|
18
|
-
* @returns Theme colors for Stripe elements
|
|
17
|
+
* @param host - The element whose Coras tokens theme the Stripe elements
|
|
18
|
+
* @returns Theme colors for Stripe elements, as concrete `rgb(...)` values
|
|
19
19
|
*/
|
|
20
|
-
export declare function extractThemeColors(
|
|
20
|
+
export declare function extractThemeColors(host: HTMLElement): ThemeColors;
|
|
21
21
|
/**
|
|
22
22
|
* Builds a Stripe Elements `appearance` from the resolved Coras tokens, so the
|
|
23
23
|
* hosted card iframe matches the embed's surface, brand colour, and colour
|
|
24
|
-
* scheme.
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* scheme. Colours and the radius are resolved to concrete values Stripe accepts
|
|
25
|
+
* (see `withTokenResolver`); the `night` theme and a dark `colorBackground` are
|
|
26
|
+
* selected automatically when the surface resolves to a dark colour, which the
|
|
27
|
+
* probe evaluates against the mount's `color-scheme`.
|
|
27
28
|
*/
|
|
28
|
-
export declare function buildStripeAppearance(
|
|
29
|
+
export declare function buildStripeAppearance(host: HTMLElement): Appearance;
|
|
29
30
|
/**
|
|
30
31
|
* Creates a Stripe element style configuration based on theme colors.
|
|
31
32
|
*
|
|
@@ -43,6 +44,12 @@ export declare function createPortalElement(className: string): HTMLElement;
|
|
|
43
44
|
/**
|
|
44
45
|
* Positions a portal element to match a placeholder's position.
|
|
45
46
|
*
|
|
47
|
+
* The coordinates are document-relative, so a host page that scrolls the window
|
|
48
|
+
* moves the portal with the document and every recomputed value is identical.
|
|
49
|
+
* Only a scroll in an ancestor container (the Studio preview frame) actually
|
|
50
|
+
* moves the placeholder under the portal. Tracking runs every frame, so an
|
|
51
|
+
* unchanged position returns without writing and costs that host page nothing.
|
|
52
|
+
*
|
|
46
53
|
* @param placeholder - The placeholder element inside Shadow DOM
|
|
47
54
|
* @param portal - The portal element in the document body
|
|
48
55
|
* @param zIndex - The z-index value for the portal
|
|
@@ -50,14 +57,18 @@ export declare function createPortalElement(className: string): HTMLElement;
|
|
|
50
57
|
*/
|
|
51
58
|
export declare function positionPortalElement(placeholder: HTMLElement | null, portal: HTMLElement | null, zIndex: number, inlinePadding?: number): void;
|
|
52
59
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
60
|
+
* Coalesces repeated calls into one run in the next animation frame.
|
|
61
|
+
*
|
|
62
|
+
* Portal tracking has to keep up with a scroll that is still in progress. A
|
|
63
|
+
* trailing debounce cannot: each scroll event restarts its timer, so the portals
|
|
64
|
+
* hold their stale position for the whole gesture and only catch up once the
|
|
65
|
+
* scroll stops. Running on every frame that had at least one call matches the
|
|
66
|
+
* rate the portals are painted at.
|
|
55
67
|
*
|
|
56
|
-
* @param fn - The function to
|
|
57
|
-
* @
|
|
58
|
-
* @returns Object with the debounced function and a cancel method
|
|
68
|
+
* @param fn - The function to run, at most once per frame
|
|
69
|
+
* @returns Object with the throttled function and a cancel method
|
|
59
70
|
*/
|
|
60
|
-
export declare function
|
|
71
|
+
export declare function createFrameThrottle(fn: () => void): {
|
|
61
72
|
execute: () => void;
|
|
62
73
|
cancel: () => void;
|
|
63
74
|
};
|
|
@@ -42,21 +42,56 @@ export function validateStripeKey(key) {
|
|
|
42
42
|
return { isValid: true };
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* Runs `use` with a resolver that turns the Coras token expressions
|
|
46
|
+
* (`var()`, `light-dark()`, `calc()`) into the concrete `rgb(...)` / px strings
|
|
47
|
+
* Stripe accepts. Stripe silently drops a `light-dark(...)` colour and a
|
|
48
|
+
* `calc(.../)` length, so every token value must be resolved before it is handed
|
|
49
|
+
* to Stripe (otherwise the card iframe falls back to Stripe's own defaults).
|
|
46
50
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
51
|
+
* Each value is applied to a hidden probe mounted in the host's own scope, so it
|
|
52
|
+
* inherits the same custom properties and `color-scheme`, then read back from
|
|
53
|
+
* `getComputedStyle`. An empty input is returned unchanged so callers keep their
|
|
54
|
+
* own fallbacks.
|
|
49
55
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
function withTokenResolver(host, use) {
|
|
57
|
+
const probe = document.createElement("span");
|
|
58
|
+
probe.style.position = "absolute";
|
|
59
|
+
probe.style.visibility = "hidden";
|
|
60
|
+
probe.style.pointerEvents = "none";
|
|
61
|
+
const root = host.shadowRoot ?? host;
|
|
62
|
+
root.appendChild(probe);
|
|
63
|
+
try {
|
|
64
|
+
return use((value, as) => {
|
|
65
|
+
if (!value)
|
|
66
|
+
return value;
|
|
67
|
+
if (as === "color") {
|
|
68
|
+
probe.style.color = value;
|
|
69
|
+
return getComputedStyle(probe).color || value;
|
|
70
|
+
}
|
|
71
|
+
probe.style.borderTopLeftRadius = value;
|
|
72
|
+
return getComputedStyle(probe).borderTopLeftRadius || value;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
probe.remove();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Extracts theme colors from the host's resolved tokens or returns defaults.
|
|
81
|
+
*
|
|
82
|
+
* @param host - The element whose Coras tokens theme the Stripe elements
|
|
83
|
+
* @returns Theme colors for Stripe elements, as concrete `rgb(...)` values
|
|
84
|
+
*/
|
|
85
|
+
export function extractThemeColors(host) {
|
|
86
|
+
const computed = getComputedStyle(host);
|
|
87
|
+
const read = (name) => computed.getPropertyValue(name).trim();
|
|
88
|
+
return withTokenResolver(host, (resolve) => ({
|
|
89
|
+
textColor: resolve(read(CSS_VARS.FIELD_INPUT_COLOR), "color") || DEFAULT_COLORS.TEXT,
|
|
90
|
+
placeholderColor: resolve(read(CSS_VARS.FIELD_INPUT_PLACEHOLDER_COLOR), "color") ||
|
|
91
|
+
DEFAULT_COLORS.PLACEHOLDER,
|
|
92
|
+
errorColor: resolve(read(CSS_VARS.FIELD_INPUT_ERROR_COLOR), "color") ||
|
|
58
93
|
DEFAULT_COLORS.ERROR,
|
|
59
|
-
};
|
|
94
|
+
}));
|
|
60
95
|
}
|
|
61
96
|
/** True when a resolved CSS colour (rgb()/rgba()/#hex) reads as dark. */
|
|
62
97
|
function isDarkColor(color) {
|
|
@@ -69,26 +104,31 @@ function isDarkColor(color) {
|
|
|
69
104
|
/**
|
|
70
105
|
* Builds a Stripe Elements `appearance` from the resolved Coras tokens, so the
|
|
71
106
|
* hosted card iframe matches the embed's surface, brand colour, and colour
|
|
72
|
-
* scheme.
|
|
73
|
-
*
|
|
74
|
-
*
|
|
107
|
+
* scheme. Colours and the radius are resolved to concrete values Stripe accepts
|
|
108
|
+
* (see `withTokenResolver`); the `night` theme and a dark `colorBackground` are
|
|
109
|
+
* selected automatically when the surface resolves to a dark colour, which the
|
|
110
|
+
* probe evaluates against the mount's `color-scheme`.
|
|
75
111
|
*/
|
|
76
|
-
export function buildStripeAppearance(
|
|
112
|
+
export function buildStripeAppearance(host) {
|
|
113
|
+
const computed = getComputedStyle(host);
|
|
77
114
|
const read = (name) => computed.getPropertyValue(name).trim();
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
DEFAULT_COLORS.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
115
|
+
return withTokenResolver(host, (resolve) => {
|
|
116
|
+
const color = (name) => resolve(read(name), "color");
|
|
117
|
+
const surface = color(CSS_VARS.SURFACE) || DEFAULT_COLORS.BACKGROUND;
|
|
118
|
+
return {
|
|
119
|
+
theme: isDarkColor(surface) ? "night" : "stripe",
|
|
120
|
+
variables: {
|
|
121
|
+
colorBackground: surface,
|
|
122
|
+
colorText: color(CSS_VARS.FIELD_INPUT_COLOR) || DEFAULT_COLORS.TEXT,
|
|
123
|
+
colorTextPlaceholder: color(CSS_VARS.FIELD_INPUT_PLACEHOLDER_COLOR) ||
|
|
124
|
+
DEFAULT_COLORS.PLACEHOLDER,
|
|
125
|
+
colorDanger: color(CSS_VARS.FIELD_INPUT_ERROR_COLOR) || DEFAULT_COLORS.ERROR,
|
|
126
|
+
colorPrimary: color(CSS_VARS.PRIMARY) || undefined,
|
|
127
|
+
fontFamily: read(CSS_VARS.FONT_FAMILY) || undefined,
|
|
128
|
+
borderRadius: resolve(read(CSS_VARS.BORDER_RADIUS), "length") || undefined,
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
});
|
|
92
132
|
}
|
|
93
133
|
/**
|
|
94
134
|
* Creates a Stripe element style configuration based on theme colors.
|
|
@@ -130,6 +170,12 @@ export function createPortalElement(className) {
|
|
|
130
170
|
/**
|
|
131
171
|
* Positions a portal element to match a placeholder's position.
|
|
132
172
|
*
|
|
173
|
+
* The coordinates are document-relative, so a host page that scrolls the window
|
|
174
|
+
* moves the portal with the document and every recomputed value is identical.
|
|
175
|
+
* Only a scroll in an ancestor container (the Studio preview frame) actually
|
|
176
|
+
* moves the placeholder under the portal. Tracking runs every frame, so an
|
|
177
|
+
* unchanged position returns without writing and costs that host page nothing.
|
|
178
|
+
*
|
|
133
179
|
* @param placeholder - The placeholder element inside Shadow DOM
|
|
134
180
|
* @param portal - The portal element in the document body
|
|
135
181
|
* @param zIndex - The z-index value for the portal
|
|
@@ -147,51 +193,54 @@ export function positionPortalElement(placeholder, portal, zIndex, inlinePadding
|
|
|
147
193
|
// Calculate padding in pixels (assuming 16px base font size)
|
|
148
194
|
const paddingPx = inlinePadding * 16;
|
|
149
195
|
const totalPadding = paddingPx * 2;
|
|
196
|
+
const top = `${rect.top + window.scrollY}px`;
|
|
197
|
+
const left = `${rect.left + window.scrollX}px`;
|
|
198
|
+
const width = `${rect.width - totalPadding}px`;
|
|
199
|
+
const height = `${rect.height}px`;
|
|
200
|
+
if (portal.style.display === "" &&
|
|
201
|
+
portal.style.top === top &&
|
|
202
|
+
portal.style.left === left &&
|
|
203
|
+
portal.style.width === width &&
|
|
204
|
+
portal.style.height === height) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
150
207
|
portal.style.display = "";
|
|
151
208
|
portal.style.position = "absolute";
|
|
152
|
-
portal.style.top =
|
|
153
|
-
portal.style.left =
|
|
154
|
-
portal.style.width =
|
|
155
|
-
portal.style.height =
|
|
209
|
+
portal.style.top = top;
|
|
210
|
+
portal.style.left = left;
|
|
211
|
+
portal.style.width = width;
|
|
212
|
+
portal.style.height = height;
|
|
156
213
|
portal.style.zIndex = `${zIndex}`;
|
|
157
214
|
portal.style.margin = "0";
|
|
158
215
|
portal.style.paddingInline = `${inlinePadding}rem`;
|
|
159
216
|
}
|
|
160
217
|
/**
|
|
161
|
-
*
|
|
162
|
-
*
|
|
218
|
+
* Coalesces repeated calls into one run in the next animation frame.
|
|
219
|
+
*
|
|
220
|
+
* Portal tracking has to keep up with a scroll that is still in progress. A
|
|
221
|
+
* trailing debounce cannot: each scroll event restarts its timer, so the portals
|
|
222
|
+
* hold their stale position for the whole gesture and only catch up once the
|
|
223
|
+
* scroll stops. Running on every frame that had at least one call matches the
|
|
224
|
+
* rate the portals are painted at.
|
|
163
225
|
*
|
|
164
|
-
* @param fn - The function to
|
|
165
|
-
* @
|
|
166
|
-
* @returns Object with the debounced function and a cancel method
|
|
226
|
+
* @param fn - The function to run, at most once per frame
|
|
227
|
+
* @returns Object with the throttled function and a cancel method
|
|
167
228
|
*/
|
|
168
|
-
export function
|
|
169
|
-
let timeoutId = null;
|
|
229
|
+
export function createFrameThrottle(fn) {
|
|
170
230
|
let rafId = null;
|
|
171
231
|
const execute = () => {
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
rafId = requestAnimationFrame(() => {
|
|
180
|
-
fn();
|
|
181
|
-
rafId = null;
|
|
182
|
-
});
|
|
183
|
-
timeoutId = null;
|
|
184
|
-
}, delay);
|
|
232
|
+
if (rafId !== null)
|
|
233
|
+
return;
|
|
234
|
+
rafId = requestAnimationFrame(() => {
|
|
235
|
+
rafId = null;
|
|
236
|
+
fn();
|
|
237
|
+
});
|
|
185
238
|
};
|
|
186
239
|
const cancel = () => {
|
|
187
|
-
if (
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
if (rafId !== null) {
|
|
192
|
-
cancelAnimationFrame(rafId);
|
|
193
|
-
rafId = null;
|
|
194
|
-
}
|
|
240
|
+
if (rafId === null)
|
|
241
|
+
return;
|
|
242
|
+
cancelAnimationFrame(rafId);
|
|
243
|
+
rafId = null;
|
|
195
244
|
};
|
|
196
245
|
return { execute, cancel };
|
|
197
246
|
}
|
|
@@ -204,6 +204,7 @@ export declare class CorasPaymentPage extends CorasPaymentPage_base {
|
|
|
204
204
|
private getShortestExpirationSeconds;
|
|
205
205
|
private getTotalQuantity;
|
|
206
206
|
private getTotalPriceFormatted;
|
|
207
|
+
private renderPaymentSkeleton;
|
|
207
208
|
private renderContent;
|
|
208
209
|
private getLoyaltyAccountUrl;
|
|
209
210
|
private renderSuccess;
|
|
@@ -54,6 +54,7 @@ import { FormValidationController } from "./controllers/form-validation.controll
|
|
|
54
54
|
import { LayoutController } from "./controllers/layout.controller.js";
|
|
55
55
|
import { CryptoAuthController } from "./controllers/crypto-auth.controller.js";
|
|
56
56
|
import { CryptoTransferController, } from "./controllers/crypto-transfer.controller.js";
|
|
57
|
+
import { getApiLanguageCode } from "../../core/utils/locale.js";
|
|
57
58
|
/**
|
|
58
59
|
* Payment page component for processing checkout and payments.
|
|
59
60
|
*
|
|
@@ -169,7 +170,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
169
170
|
this.countriesTask = new Task(this, {
|
|
170
171
|
autoRun: false,
|
|
171
172
|
task: async () => {
|
|
172
|
-
const language_code = this.locale
|
|
173
|
+
const language_code = getApiLanguageCode(this.locale);
|
|
173
174
|
const { data, error } = await this.getApiService().fetchCountries(language_code);
|
|
174
175
|
if (error) {
|
|
175
176
|
console.error("Error fetching countries:", error);
|
|
@@ -254,7 +255,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
254
255
|
this.reservationsCheckTask = new Task(this, {
|
|
255
256
|
autoRun: false,
|
|
256
257
|
task: async () => {
|
|
257
|
-
const bookingSession = getBookingSession();
|
|
258
|
+
const bookingSession = getBookingSession(this.distributorID);
|
|
258
259
|
// No session means there is nothing to check out: a legitimate empty
|
|
259
260
|
// state (lost/expired session, or the branding preview), not an error.
|
|
260
261
|
// Returning empty keeps the error modal reserved for real API failures.
|
|
@@ -271,7 +272,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
271
272
|
this.reservationsTask = new Task(this, {
|
|
272
273
|
autoRun: false,
|
|
273
274
|
task: async () => {
|
|
274
|
-
const bookingSession = getBookingSession();
|
|
275
|
+
const bookingSession = getBookingSession(this.distributorID);
|
|
275
276
|
if (!bookingSession) {
|
|
276
277
|
return {
|
|
277
278
|
reservations: null,
|
|
@@ -1161,7 +1162,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1161
1162
|
this.scrollToFirstError();
|
|
1162
1163
|
return null;
|
|
1163
1164
|
}
|
|
1164
|
-
const bookingSession = getBookingSession();
|
|
1165
|
+
const bookingSession = getBookingSession(this.distributorID);
|
|
1165
1166
|
if (!bookingSession) {
|
|
1166
1167
|
console.error("Cannot confirm reservation: booking session is missing.");
|
|
1167
1168
|
return null;
|
|
@@ -1210,7 +1211,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1210
1211
|
this.userId = responseData.user_id;
|
|
1211
1212
|
this.pendingClientSecret = responseData.client_secret ?? null;
|
|
1212
1213
|
// Invalidate booking session so a page refresh cannot replay the reservation
|
|
1213
|
-
removeBookingSession();
|
|
1214
|
+
removeBookingSession(this.distributorID);
|
|
1214
1215
|
return responseData;
|
|
1215
1216
|
}
|
|
1216
1217
|
return null;
|
|
@@ -1441,6 +1442,15 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1441
1442
|
currency: this.currency,
|
|
1442
1443
|
});
|
|
1443
1444
|
}
|
|
1445
|
+
renderPaymentSkeleton() {
|
|
1446
|
+
return html `
|
|
1447
|
+
<div class="payment-skeleton" aria-hidden="true">
|
|
1448
|
+
${Array.from({ length: 5 }, () => html `<div class="coras-skeleton sk-field"></div>`)}
|
|
1449
|
+
<div class="coras-skeleton sk-block"></div>
|
|
1450
|
+
</div>
|
|
1451
|
+
<span class="coras-sr-only" role="status">${msg("Loading")}</span>
|
|
1452
|
+
`;
|
|
1453
|
+
}
|
|
1444
1454
|
renderContent() {
|
|
1445
1455
|
if (this.paymentSuccessful) {
|
|
1446
1456
|
return this.renderSuccess();
|
|
@@ -1449,8 +1459,8 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1449
1459
|
return this.renderFailure();
|
|
1450
1460
|
}
|
|
1451
1461
|
return this.configTask.render({
|
|
1452
|
-
initial: () =>
|
|
1453
|
-
pending: () =>
|
|
1462
|
+
initial: () => this.renderPaymentSkeleton(),
|
|
1463
|
+
pending: () => this.renderPaymentSkeleton(),
|
|
1454
1464
|
error: () => {
|
|
1455
1465
|
this.showErrorModalOnce();
|
|
1456
1466
|
return html ``;
|
|
@@ -1513,7 +1523,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1513
1523
|
// reservations below - the check response only carries requirements, and a
|
|
1514
1524
|
// basket of plain tickets returns no per-reservation entries.
|
|
1515
1525
|
return this.reservationsCheckTask.render({
|
|
1516
|
-
pending: () =>
|
|
1526
|
+
pending: () => this.renderPaymentSkeleton(),
|
|
1517
1527
|
error: () => {
|
|
1518
1528
|
this.showErrorModalOnce();
|
|
1519
1529
|
return html ``;
|
|
@@ -1523,7 +1533,7 @@ let CorasPaymentPage = class CorasPaymentPage extends CoinbaseMixin(ErrorModalMi
|
|
|
1523
1533
|
}
|
|
1524
1534
|
renderReservations() {
|
|
1525
1535
|
return this.reservationsTask.render({
|
|
1526
|
-
pending: () =>
|
|
1536
|
+
pending: () => this.renderPaymentSkeleton(),
|
|
1527
1537
|
complete: (data) => {
|
|
1528
1538
|
// Nothing to check out: real customers are guided back to browse;
|
|
1529
1539
|
// the branding preview renders the full form (with Pay now disabled).
|