@coras-io/embed 0.1.0 → 0.1.2
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 +60 -1
- package/README.md +1 -1
- package/dist/components/accordion/accordion-item/accordion-item.component.d.ts +1 -1
- package/dist/components/accordion/accordion.component.d.ts +1 -1
- package/dist/components/alert/alert.component.d.ts +2 -2
- package/dist/components/attraction-card/base/attraction-card.mixin.d.ts +3 -3
- package/dist/components/attraction-card/base/attraction-card.mixin.js +1 -1
- package/dist/components/attraction-card/base/attraction-card.types.d.ts +2 -2
- package/dist/components/attraction-card/long/attraction-long-card.component.d.ts +1 -1
- package/dist/components/attraction-card/long/attraction-long-card.component.js +1 -1
- package/dist/components/attraction-card/short/attraction-short-card.component.d.ts +1 -1
- package/dist/components/attraction-card/short/attraction-short-card.component.js +1 -1
- package/dist/components/attraction-discovery/attraction-discovery-image/attraction-discovery-image.component.d.ts +1 -1
- package/dist/components/attraction-discovery/attraction-discovery.component.d.ts +1 -1
- package/dist/components/attraction-header/attraction-header.component.d.ts +3 -3
- package/dist/components/attraction-header/attraction-header.utils.d.ts +3 -3
- package/dist/components/attraction-option/attraction-option.component.d.ts +1 -1
- package/dist/components/basket/basket.component.d.ts +2 -2
- package/dist/components/basket-empty/basket-empty.component.d.ts +1 -1
- package/dist/components/basket-item/basket-item.component.d.ts +1 -1
- package/dist/components/basket-item-ticket/basket-item-ticket.component.d.ts +1 -1
- package/dist/components/basket-mobile/basket-mobile.component.d.ts +1 -1
- package/dist/components/basket-rewards/basket-rewards.component.d.ts +1 -1
- package/dist/components/better-carousel/better-carousel-item/better-carousel-item.component.d.ts +1 -1
- package/dist/components/better-carousel/better-carousel.component.d.ts +1 -1
- package/dist/components/bottom-drawer/bottom-drawer.component.d.ts +1 -1
- package/dist/components/bottom-drawer/bottom-drawer.component.js +1 -1
- package/dist/components/breadcrumbs/breadcrumb-item/breadcrumb-item.component.d.ts +1 -1
- package/dist/components/breadcrumbs/breadcrumbs.component.d.ts +1 -1
- package/dist/components/button/button.component.d.ts +2 -2
- package/dist/components/calendar/base/calendar.mixin.d.ts +2 -2
- package/dist/components/calendar/base/calendar.types.d.ts +2 -2
- package/dist/components/calendar/dual/dual.component.d.ts +1 -1
- package/dist/components/calendar/month/month.component.d.ts +1 -1
- package/dist/components/calendar/month/month.component.js +1 -1
- package/dist/components/calendar/multi/multi.component.d.ts +1 -1
- package/dist/components/carousel/carousel-item/carousel-item.component.d.ts +1 -1
- package/dist/components/carousel/carousel-item/carousel-item.component.js +1 -1
- package/dist/components/carousel/carousel.component.d.ts +1 -1
- package/dist/components/carousel/carousel.component.js +2 -2
- package/dist/components/carousel/carousel.styles.js +10 -0
- package/dist/components/categories-tree/categories-tree.component.d.ts +2 -2
- package/dist/components/category-tag/category-tag.component.d.ts +2 -2
- package/dist/components/category-tag/category-tag.types.d.ts +1 -1
- package/dist/components/checkbox/checkbox.component.d.ts +1 -1
- package/dist/components/checkbox-group/checkbox-group.component.d.ts +1 -1
- package/dist/components/checkbox-group/checkbox-group.types.d.ts +1 -1
- package/dist/components/chip/chip.component.d.ts +2 -2
- package/dist/components/collect-fida/collect-fida.component.d.ts +1 -1
- package/dist/components/crypto-auth-modal/crypto-auth-modal.component.d.ts +2 -2
- package/dist/components/crypto-auth-modal/crypto-auth-modal.component.js +2 -2
- package/dist/components/currencies-list/currencies-list.component.d.ts +2 -2
- package/dist/components/currencies-list/currencies-list.component.js +1 -1
- package/dist/components/dialog/dialog.component.d.ts +2 -2
- package/dist/components/drawer/drawer.component.d.ts +1 -1
- package/dist/components/drawer/drawer.component.js +1 -1
- package/dist/components/dropdown/dropdown.component.d.ts +1 -1
- package/dist/components/dropdown/dropdown.component.js +1 -1
- package/dist/components/expiration-timer/expiration-timer.component.d.ts +1 -1
- package/dist/components/explore-card/explore-card.component.d.ts +1 -1
- package/dist/components/explore-card/explore-card.component.js +1 -1
- package/dist/components/explore-card/explore-card.styles.js +23 -0
- package/dist/components/filter-chip/filter-chip.component.d.ts +2 -2
- package/dist/components/filter-chip/filter-chip.component.js +1 -1
- package/dist/components/filters-drawer/filters-drawer.component.d.ts +1 -1
- package/dist/components/flag-icon/flag-icon.component.d.ts +2 -2
- package/dist/components/footer-menu/footer-menu-item/footer-menu-item.component.d.ts +1 -1
- package/dist/components/footer-menu/footer-menu.component.d.ts +1 -1
- package/dist/components/icon/icon.component.d.ts +2 -2
- package/dist/components/icon/icon.component.js +1 -1
- package/dist/components/icon-list/icon-list-item/icon-list-item.component.d.ts +2 -2
- package/dist/components/icon-list/icon-list.component.d.ts +1 -1
- package/dist/components/image/image.component.d.ts +3 -3
- package/dist/components/image/image.component.js +1 -1
- package/dist/components/image-carousel/image-carousel-item/image-carousel-item.component.d.ts +1 -1
- package/dist/components/image-carousel/image-carousel.component.d.ts +1 -1
- package/dist/components/image-chip/image-chip.component.d.ts +1 -1
- package/dist/components/image-viewer/image-viewer.component.d.ts +1 -1
- package/dist/components/input-field/input-field.component.d.ts +2 -2
- package/dist/components/input-field/input-field.types.d.ts +2 -0
- package/dist/components/input-field/input-field.types.js +1 -0
- package/dist/components/itinerary/itinerary-item/itinerary-item.component.d.ts +1 -1
- package/dist/components/itinerary/itinerary.component.d.ts +1 -1
- package/dist/components/joined-fields/joined-fields.component.d.ts +1 -1
- package/dist/components/joined-fields/joined-fields.component.js +1 -1
- package/dist/components/layout/layout.component.d.ts +1 -1
- package/dist/components/list/list-item/list-item.component.d.ts +2 -2
- package/dist/components/list/list.component.d.ts +1 -1
- package/dist/components/loading-spinner/loading-spinner.component.d.ts +2 -2
- package/dist/components/locales-list/locales-list.component.d.ts +2 -2
- package/dist/components/locales-list/locales-list.component.js +1 -1
- package/dist/components/locales-list/locales-list.constants.d.ts +1 -1
- package/dist/components/location-image/location-image.component.d.ts +2 -2
- package/dist/components/location-image/location-image.component.js +1 -1
- package/dist/components/locations-results/locations-results.component.d.ts +2 -2
- package/dist/components/locations-results/locations-results.component.js +1 -1
- package/dist/components/marketing-tag/marketing-tag.component.d.ts +1 -1
- package/dist/components/message-card/message-card.component.d.ts +2 -2
- package/dist/components/mobile-menu-item/mobile-menu-item.component.d.ts +1 -1
- package/dist/components/option-group/option-chip/option-chip.component.d.ts +1 -1
- package/dist/components/option-group/option-chip/option-chip.component.js +1 -1
- package/dist/components/option-group/option-group.component.d.ts +1 -1
- package/dist/components/order-confirmation/order-confirmation-item/order-confirmation-item.component.d.ts +1 -1
- package/dist/components/order-confirmation/order-confirmation.component.d.ts +1 -1
- package/dist/components/order-confirmation/order-confirmation.component.js +1 -1
- package/dist/components/otp/otp.component.d.ts +1 -1
- package/dist/components/overlay/overlay.component.d.ts +1 -1
- package/dist/components/pay-in/pay-in.component.d.ts +2 -2
- package/dist/components/payment-fiat-method/payment-fiat-method.component.d.ts +3 -2
- package/dist/components/payment-fiat-method/payment-fiat-method.types.d.ts +1 -0
- package/dist/components/payment-fiat-method/payment-fiat-method.types.js +1 -0
- package/dist/components/payment-option/payment-option.component.d.ts +2 -2
- package/dist/components/payment-option/payment-option.component.js +1 -1
- package/dist/components/performance-time/performance-time.component.d.ts +1 -1
- package/dist/components/phone-country-code/phone-country-code.component.d.ts +1 -1
- package/dist/components/phone-country-codes/phone-country-codes.component.d.ts +2 -2
- package/dist/components/phone-field/phone-field.component.d.ts +3 -3
- package/dist/components/phone-field/phone-field.utils.d.ts +1 -1
- package/dist/components/points/points.component.d.ts +1 -1
- package/dist/components/price/price.component.d.ts +2 -2
- package/dist/components/reservation-preview/reservation-preview.component.d.ts +1 -1
- package/dist/components/reservation-preview-item/reservation-preview-item.component.d.ts +1 -1
- package/dist/components/reviews/review/review.component.d.ts +1 -1
- package/dist/components/reviews/reviews.component.d.ts +1 -1
- package/dist/components/search-button/search-button.component.d.ts +1 -1
- package/dist/components/search-results-item/search-results-item.d.ts +3 -3
- package/dist/components/seated-selector/seated-selector.component.d.ts +1 -1
- package/dist/components/seated-selector/seated-selector.component.js +3 -3
- package/dist/components/seats-io/seats-io.component.d.ts +4 -4
- package/dist/components/seats-io/seats-io.component.js +1 -1
- package/dist/components/seats-io/seats-io.transform.d.ts +2 -2
- package/dist/components/select-list/select-list.component.d.ts +1 -1
- package/dist/components/select-list/select-option/select-option.component.d.ts +1 -1
- package/dist/components/selected-tickets-preview/selected-tickets-preview.component.d.ts +1 -1
- package/dist/components/sort-dropdown/sort-dropdown.component.d.ts +1 -1
- package/dist/components/sort-list/sort-list.component.d.ts +1 -1
- package/dist/components/sport-options/sport-option/sport-option.component.d.ts +1 -1
- package/dist/components/sport-options/sport-options.component.d.ts +1 -1
- package/dist/components/star-rating/star-rating.component.d.ts +1 -1
- package/dist/components/star-rating/star-rating.component.js +1 -1
- package/dist/components/tab/tab.component.d.ts +1 -1
- package/dist/components/tab/tab.component.js +1 -1
- package/dist/components/tab-panel/tab-panel.component.d.ts +1 -1
- package/dist/components/tab-panel/tab-panel.component.js +1 -1
- package/dist/components/tabs/tabs.component.d.ts +1 -1
- package/dist/components/tag/tag.component.d.ts +2 -2
- package/dist/components/text-section/text-section.component.d.ts +1 -1
- package/dist/components/time-tag/time-tag.component.d.ts +2 -2
- package/dist/components/tooltip/tooltip.component.d.ts +1 -1
- package/dist/components/tour-ticket-type-selector/tour-ticket-counter-button/tour-ticket-counter-button.component.d.ts +1 -1
- package/dist/components/tour-ticket-type-selector/tour-ticket-type/tour-ticket-type.component.d.ts +1 -1
- package/dist/components/tour-ticket-type-selector/tour-ticket-type-selector.component.d.ts +1 -1
- package/dist/components/transfer-modal/transfer-modal.component.d.ts +1 -1
- package/dist/components/transfer-modal/transfer-modal.component.js +1 -1
- package/dist/containers/footer/footer.component.d.ts +1 -1
- package/dist/containers/navbar/navbar.component.d.ts +6 -6
- package/dist/containers/navbar/navbar.utils.d.ts +2 -2
- package/dist/contexts/basket/basket.context.d.ts +1 -1
- package/dist/contexts/basket/basket.provider.d.ts +4 -4
- package/dist/contexts/basket/basket.provider.js +1 -1
- package/dist/contexts/basket/basket.types.d.ts +2 -2
- package/dist/contexts/client.context.d.ts +2 -2
- package/dist/contexts/current-page.context.d.ts +1 -1
- package/dist/contexts/events.context.d.ts +3 -3
- package/dist/contexts/types.d.ts +2 -2
- package/dist/controllers/time-expiration.d.ts +1 -1
- package/dist/core/api/middlewares/booking-session/booking-session.d.ts +1 -1
- package/dist/core/api/middlewares/error-handler/error-handler.d.ts +1 -1
- package/dist/core/api/queries.d.ts +2 -2
- package/dist/core/currency/constants.d.ts +1 -1
- package/dist/core/currency/index.d.ts +3 -5
- package/dist/core/currency/index.js +16 -6
- package/dist/core/events.d.ts +2 -2
- package/dist/core/i18n/date.d.ts +2 -2
- package/dist/core/i18n/localization.js +1 -1
- package/dist/core/images/constants.d.ts +1 -1
- package/dist/core/images/constants.js +1 -1
- package/dist/core/images/filters.d.ts +2 -2
- package/dist/core/images/filters.js +2 -2
- package/dist/core/images/selection.d.ts +3 -3
- package/dist/core/images/selection.js +3 -3
- package/dist/core/images/srcset.d.ts +1 -1
- package/dist/core/images/srcset.js +6 -6
- package/dist/core/images/url.d.ts +1 -1
- package/dist/core/images/url.js +1 -1
- package/dist/core/pages.d.ts +1 -1
- package/dist/core/storybook/cssprops.d.ts +1 -1
- package/dist/core/types/core/base.d.ts +2 -2
- package/dist/core/types/core/category.d.ts +1 -1
- package/dist/core/types/core/currency.d.ts +1 -1
- package/dist/core/types/core/locale.d.ts +1 -1
- package/dist/core/types/core/sorting.d.ts +1 -1
- package/dist/core/types/currencies.d.ts +1 -1
- package/dist/core/types/locales.d.ts +2 -2
- package/dist/core/types/seats-config.d.ts +1 -1
- package/dist/core/utils/datetime.d.ts +1 -1
- package/dist/core/utils/locale.d.ts +2 -2
- package/dist/core/utils/scroll-lock.d.ts +2 -2
- package/dist/core/utils/scroll-lock.js +3 -3
- package/dist/core/utils/time.d.ts +1 -1
- package/dist/custom-elements.json +444 -355
- package/dist/helpers/helpers.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mixins/base.mixin.d.ts +6 -6
- package/dist/mixins/base.mixin.js +2 -2
- package/dist/mixins/coinbase-chains.d.ts +1 -0
- package/dist/mixins/coinbase-chains.js +7 -0
- package/dist/mixins/coinbase.mixin.d.ts +4 -4
- package/dist/mixins/coinbase.mixin.js +19 -7
- package/dist/mixins/error-modal.mixin.d.ts +2 -2
- package/dist/mixins/location-search/location-search.d.ts +3 -3
- package/dist/mixins/location-search/location-search.js +1 -1
- package/dist/mixins/location-search/types.d.ts +2 -2
- package/dist/mixins/overlay/overlay-mixin.d.ts +2 -2
- package/dist/mixins/overlay/types.d.ts +1 -1
- package/dist/mixins/points/points.d.ts +2 -2
- package/dist/mixins/points/types.d.ts +1 -1
- package/dist/mixins/search-mixin/search-mixin.d.ts +3 -3
- package/dist/mixins/search-mixin/types.d.ts +2 -2
- package/dist/sdk/chrome.js +9 -5
- package/dist/sdk/diagnostics.d.ts +9 -0
- package/dist/sdk/diagnostics.js +25 -0
- package/dist/sdk/mount.js +42 -0
- package/dist/sdk/once.d.ts +9 -0
- package/dist/sdk/once.js +18 -0
- package/dist/sdk/page-registry.d.ts +2 -2
- package/dist/sdk/page-registry.js +10 -10
- package/dist/sdk/theme.js +1 -1
- package/dist/sdk/types.d.ts +11 -11
- package/dist/sdk/validation.d.ts +2 -2
- package/dist/sdk/validation.js +7 -6
- package/dist/styles/tokens.css +1 -1
- package/dist/styles/tokens.d.ts +1 -1
- package/dist/styles/tokens.generated.d.ts +1 -1
- package/dist/styles/tokens.generated.js +2 -2
- package/dist/views/constants.d.ts +1 -1
- package/dist/views/details-page/details-page.component.d.ts +4 -4
- package/dist/views/details-page/details-page.component.js +2 -2
- package/dist/views/details-page/details-page.utilts.d.ts +2 -2
- package/dist/views/details-page/partials/theater-description/theater-description.component.d.ts +3 -3
- package/dist/views/details-page/partials/tour-description/tour-description.component.d.ts +4 -4
- package/dist/views/help-page/help-page.component.d.ts +2 -2
- package/dist/views/help-page/help-page.component.js +1 -1
- package/dist/views/help-page/help-page.types.d.ts +1 -1
- package/dist/views/help-page/help-page.utils.d.ts +2 -2
- package/dist/views/landing-page/landing-page.component.d.ts +4 -4
- package/dist/views/landing-page/landing-page.component.js +1 -1
- package/dist/views/landing-page/landing-page.types.d.ts +1 -1
- package/dist/views/payment-page/controllers/crypto-auth.controller.d.ts +3 -3
- package/dist/views/payment-page/controllers/crypto-transfer.controller.d.ts +3 -3
- package/dist/views/payment-page/controllers/crypto-transfer.controller.js +1 -1
- package/dist/views/payment-page/controllers/form-validation.controller.d.ts +5 -5
- package/dist/views/payment-page/controllers/layout.controller.d.ts +1 -1
- package/dist/views/payment-page/controllers/layout.controller.js +1 -1
- package/dist/views/payment-page/controllers/payment-flow.controller.d.ts +1 -1
- package/dist/views/payment-page/controllers/stripe-payment.controller.d.ts +3 -3
- package/dist/views/payment-page/partials/activity-details/activity-details.component.d.ts +5 -5
- package/dist/views/payment-page/partials/billing-address/billing-address.component.d.ts +4 -4
- package/dist/views/payment-page/partials/confirmation/confirmation.component.d.ts +2 -2
- package/dist/views/payment-page/partials/country-field/country-field.component.d.ts +2 -2
- package/dist/views/payment-page/partials/country-field/country-field.component.js +1 -1
- package/dist/views/payment-page/partials/hotel-pickup-field/hotel-pickup-field.component.d.ts +3 -3
- package/dist/views/payment-page/partials/hotel-pickup-list/hotel-pickup-list.component.d.ts +2 -2
- package/dist/views/payment-page/partials/payment-type-selector/payment-type-selector.component.d.ts +3 -3
- package/dist/views/payment-page/partials/payment-type-selector/payment-type-selector.component.js +1 -1
- package/dist/views/payment-page/partials/stripe/stripe.component.d.ts +1 -1
- package/dist/views/payment-page/partials/stripe/stripe.component.js +1 -1
- package/dist/views/payment-page/partials/terms-checkbox/terms-checkbox.component.d.ts +1 -1
- package/dist/views/payment-page/payment-page.component.d.ts +3 -3
- package/dist/views/payment-page/payment-page.component.js +7 -7
- package/dist/views/payment-page/payment-page.types.d.ts +3 -3
- package/dist/views/payment-page/payment-page.utils.d.ts +8 -8
- package/dist/views/payment-page/payment-page.utils.js +5 -5
- package/dist/views/payment-page/payment-page.validation-schema.d.ts +1 -1
- package/dist/views/payment-page/services/payment-api.service.d.ts +2 -2
- package/dist/views/payment-page/services/payment-api.service.js +1 -1
- package/dist/views/search-page/search-page.component.d.ts +4 -4
- package/dist/views/search-page/search-page.component.js +1 -1
- package/dist/views/suggestion-widget/suggestion-widget.component.d.ts +10 -5
- package/dist/views/suggestion-widget/suggestion-widget.component.js +118 -42
- package/dist/views/suggestion-widget/suggestion-widget.styles.js +57 -4
- package/package.json +9 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SupportedLocales } from "../core/types/index.js";
|
|
1
|
+
import type { SupportedLocales } from "../core/types/index.js";
|
|
2
2
|
export declare function getLocale(fallbackLocale?: string | string[]): SupportedLocales;
|
|
3
3
|
export declare function isLocaleSupported(locale: string): boolean;
|
|
4
4
|
export declare const getCurrency: (locale: string) => "AED" | "ALL" | "AUD" | "CAD" | "CHF" | "CNY" | "DKK" | "EUR" | "GBP" | "HRK" | "HUF" | "IDR" | "ISK" | "JPY" | "MAD" | "MYR" | "NOK" | "PHP" | "PLN" | "SEK" | "SGD" | "THB" | "TRY" | "USD" | "VND";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Public SDK entry point.
|
|
2
2
|
//
|
|
3
|
-
// The package root exposes the SDK only
|
|
3
|
+
// The package root exposes the SDK only - never page classes, providers,
|
|
4
4
|
// contexts, or other internals (ADR 0001). The page custom elements are
|
|
5
5
|
// implementation details and are loaded lazily by `mount()`; importing this
|
|
6
6
|
// module must not pull in Stripe, Coinbase, viem, seats.io, or page UI.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SupportedCurrencies, SupportedLocales } from "../core/types/index.js";
|
|
2
|
-
import { LitElement } from "lit";
|
|
1
|
+
import type { SupportedCurrencies, SupportedLocales } from "../core/types/index.js";
|
|
2
|
+
import type { LitElement } from "lit";
|
|
3
3
|
import type { paths } from "../core/types/api-schema.js";
|
|
4
|
-
import { Client } from "openapi-fetch";
|
|
5
|
-
import { Constructor } from "../contexts/utils.js";
|
|
6
|
-
import { PageDispatchInput } from "../contexts/events.context.js";
|
|
7
|
-
import { PageParamsEvent } from "../core/pages.js";
|
|
4
|
+
import { type Client } from "openapi-fetch";
|
|
5
|
+
import type { Constructor } from "../contexts/utils.js";
|
|
6
|
+
import { type PageDispatchInput } from "../contexts/events.context.js";
|
|
7
|
+
import type { PageParamsEvent } from "../core/pages.js";
|
|
8
8
|
type BaseMixinProperties<CustomPageContext extends PageParamsEvent> = {
|
|
9
9
|
apiHost: string;
|
|
10
10
|
distributorID: string;
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import createClient from "openapi-fetch";
|
|
7
|
+
import createClient, {} from "openapi-fetch";
|
|
8
8
|
import { property } from "lit/decorators.js";
|
|
9
9
|
import { bookingSessionMiddleware } from "../core/api/middlewares/booking-session/booking-session.js";
|
|
10
10
|
import { errorHandlerMiddleware } from "../core/api/middlewares/error-handler/error-handler.js";
|
|
@@ -25,7 +25,7 @@ export const BaseMixin = (superClass) => {
|
|
|
25
25
|
super(...rest);
|
|
26
26
|
this.apiHost = "";
|
|
27
27
|
this.distributorID = "";
|
|
28
|
-
this.assetsURL = "
|
|
28
|
+
this.assetsURL = "";
|
|
29
29
|
this.currency = DEFAULT_CURRENCY;
|
|
30
30
|
this.currencies = [...supportedCurrencies];
|
|
31
31
|
this.locale = DEFAULT_LOCALE;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { base, baseSepolia } from "viem/chains";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// The two chains we support, re-exported so the crypto flow can dynamically
|
|
2
|
+
// import *this* module instead of `viem/chains` directly. That keeps the chain
|
|
3
|
+
// configs in a deferred chunk (off the eager payment page) while still letting
|
|
4
|
+
// the bundler tree-shake the rest of viem's chain barrel: the re-export is
|
|
5
|
+
// static, so only `base`/`baseSepolia` (and their formatters) are pulled in,
|
|
6
|
+
// whereas a dynamic `import("viem/chains")` would bundle every chain.
|
|
7
|
+
export { base, baseSepolia } from "viem/chains";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LitElement } from "lit";
|
|
2
|
-
import { Constructor } from "../contexts/utils.js";
|
|
3
|
-
import {
|
|
1
|
+
import type { LitElement } from "lit";
|
|
2
|
+
import type { Constructor } from "../contexts/utils.js";
|
|
3
|
+
import type { Hash } from "viem";
|
|
4
4
|
/**
|
|
5
5
|
* Coinbase user session data
|
|
6
6
|
*/
|
|
@@ -56,7 +56,7 @@ export interface CoinbaseMixinInterface {
|
|
|
56
56
|
getCoinbaseAccessToken(): Promise<string | null>;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* Zero address constant
|
|
59
|
+
* Zero address constant - transfers to this address permanently burn tokens.
|
|
60
60
|
*/
|
|
61
61
|
declare const ZERO_ADDRESS: "0x0000000000000000000000000000000000000000";
|
|
62
62
|
/**
|
|
@@ -5,8 +5,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { state } from "lit/decorators.js";
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
// Only the lightweight, synchronously-needed helpers are imported statically
|
|
9
|
+
// (via `viem/utils`, which pulls no client/transport/RPC code). The heavy
|
|
10
|
+
// public-client machinery and the chain configs (`./coinbase-chains.js`) are
|
|
11
|
+
// dynamically imported inside `initCoinbase`/`transferTokens`, so a payment page
|
|
12
|
+
// that never enters the crypto flow does not eagerly bundle them.
|
|
13
|
+
import { formatUnits, isAddress } from "viem/utils";
|
|
10
14
|
/**
|
|
11
15
|
* ERC-20 ABI for balance and transfer operations
|
|
12
16
|
*/
|
|
@@ -61,7 +65,7 @@ const TOKEN_DECIMALS = 18;
|
|
|
61
65
|
*/
|
|
62
66
|
const MAX_TRANSFER_AMOUNT = 1_000_000;
|
|
63
67
|
/**
|
|
64
|
-
* Zero address constant
|
|
68
|
+
* Zero address constant - transfers to this address permanently burn tokens.
|
|
65
69
|
*/
|
|
66
70
|
const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
67
71
|
/**
|
|
@@ -189,7 +193,7 @@ export const CoinbaseMixin = (Base) => {
|
|
|
189
193
|
console.error("CDP Project ID must be a valid UUID");
|
|
190
194
|
return false;
|
|
191
195
|
}
|
|
192
|
-
// Validate addresses
|
|
196
|
+
// Validate addresses - misconfigured zero-address defaults would irreversibly burn tokens
|
|
193
197
|
try {
|
|
194
198
|
assertNonZeroAddress(this.recipientAddress, "Recipient address");
|
|
195
199
|
assertNonZeroAddress(this.tokenContractAddress, "Token contract address");
|
|
@@ -200,7 +204,12 @@ export const CoinbaseMixin = (Base) => {
|
|
|
200
204
|
}
|
|
201
205
|
this._initPromise = (async () => {
|
|
202
206
|
try {
|
|
203
|
-
|
|
207
|
+
const [cdpCore, { createPublicClient, http }, { base, baseSepolia }] = await Promise.all([
|
|
208
|
+
import("@coinbase/cdp-core"),
|
|
209
|
+
import("viem"),
|
|
210
|
+
import("./coinbase-chains.js"),
|
|
211
|
+
]);
|
|
212
|
+
this._cdpCore = cdpCore;
|
|
204
213
|
// createOnLogin: "smart" ensures new users get a smart account for gas-sponsored transactions
|
|
205
214
|
await this._cdpCore.initialize({
|
|
206
215
|
projectId: pid,
|
|
@@ -625,7 +634,7 @@ export const CoinbaseMixin = (Base) => {
|
|
|
625
634
|
error: "User not authenticated",
|
|
626
635
|
};
|
|
627
636
|
}
|
|
628
|
-
// Runtime guard
|
|
637
|
+
// Runtime guard - misconfigured zero-address would irreversibly burn tokens
|
|
629
638
|
try {
|
|
630
639
|
assertNonZeroAddress(this.recipientAddress, "Recipient address");
|
|
631
640
|
assertNonZeroAddress(this.tokenContractAddress, "Token contract address");
|
|
@@ -668,6 +677,9 @@ export const CoinbaseMixin = (Base) => {
|
|
|
668
677
|
try {
|
|
669
678
|
this.isTransferPending = true;
|
|
670
679
|
this.pendingTransferAmount = amount;
|
|
680
|
+
// viem is already evaluated (loaded during initCoinbase), so this
|
|
681
|
+
// resolves from the module cache without a second network round-trip.
|
|
682
|
+
const { parseUnits, encodeFunctionData } = await import("viem");
|
|
671
683
|
const amountInWei = parseUnits(amount, TOKEN_DECIMALS);
|
|
672
684
|
const data = encodeFunctionData({
|
|
673
685
|
abi: ERC20_ABI,
|
|
@@ -915,7 +927,7 @@ export const CoinbaseMixin = (Base) => {
|
|
|
915
927
|
}
|
|
916
928
|
disconnectedCallback() {
|
|
917
929
|
// Clean up local state so initCoinbase() can re-initialize on reconnect.
|
|
918
|
-
// Don't sign out
|
|
930
|
+
// Don't sign out - session persists in CDP SDK storage.
|
|
919
931
|
if (this._mfaListenerUnsubscribe) {
|
|
920
932
|
this._mfaListenerUnsubscribe();
|
|
921
933
|
this._mfaListenerUnsubscribe = null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { LitElement } from "lit";
|
|
1
|
+
import { type LitElement } from "lit";
|
|
2
2
|
import "../components/dialog/dialog.js";
|
|
3
3
|
import "../components/icon/icon.js";
|
|
4
4
|
import "../components/button/button.js";
|
|
5
|
-
import { Constructor } from "../contexts/utils.js";
|
|
5
|
+
import type { Constructor } from "../contexts/utils.js";
|
|
6
6
|
export interface ErrorModalMixinInterface {
|
|
7
7
|
showErrorModalOnce(): void;
|
|
8
8
|
resetErrorModalGuard(): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { LitElement } from "lit";
|
|
2
|
-
import { LocationSearchMixinInterface } from "./types.js";
|
|
1
|
+
import { type LitElement } from "lit";
|
|
2
|
+
import type { LocationSearchMixinInterface } from "./types.js";
|
|
3
3
|
import "../../components/dropdown/dropdown.js";
|
|
4
4
|
import "../../components/locations-results/locations-results.js";
|
|
5
5
|
import "../../components/input-field/input-field.js";
|
|
6
|
-
import { Constructor } from "../../contexts/utils.js";
|
|
6
|
+
import type { Constructor } from "../../contexts/utils.js";
|
|
7
7
|
export declare const LocationSearchMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<LocationSearchMixinInterface> & T;
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html } from "lit";
|
|
7
|
+
import { html, } from "lit";
|
|
8
8
|
import { property, state } from "lit/decorators.js";
|
|
9
9
|
import { consume } from "@lit/context";
|
|
10
10
|
import { classMap } from "lit/directives/class-map.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TemplateResult } from "lit";
|
|
2
|
-
import { components } from "../../core/types/api-schema.js";
|
|
1
|
+
import type { TemplateResult } from "lit";
|
|
2
|
+
import type { components } from "../../core/types/api-schema.js";
|
|
3
3
|
export declare class LocationSearchMixinInterface {
|
|
4
4
|
country: string;
|
|
5
5
|
city: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement } from "lit";
|
|
1
|
+
import { type LitElement } from "lit";
|
|
2
2
|
import "../../components/overlay/overlay.js";
|
|
3
|
-
import { OverlayMixinInterface, Constructor } from "./types.js";
|
|
3
|
+
import type { OverlayMixinInterface, Constructor } from "./types.js";
|
|
4
4
|
export declare const OverlayMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<OverlayMixinInterface> & T;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { LitElement } from "lit";
|
|
2
|
-
import { Constructor, PointsMixinInterface } from "./types.js";
|
|
1
|
+
import type { LitElement } from "lit";
|
|
2
|
+
import type { Constructor, PointsMixinInterface } from "./types.js";
|
|
3
3
|
export declare const PointsMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<PointsMixinInterface> & T;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement } from "lit";
|
|
2
|
-
import { SearchMixinInterface } from "./types.js";
|
|
3
|
-
import { Constructor } from "../../contexts/utils.js";
|
|
1
|
+
import type { LitElement } from "lit";
|
|
2
|
+
import type { SearchMixinInterface } from "./types.js";
|
|
3
|
+
import type { Constructor } from "../../contexts/utils.js";
|
|
4
4
|
export declare const SearchMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<SearchMixinInterface> & T;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Task } from "@lit/task";
|
|
2
|
-
import { components } from "../../core/types/api-schema.js";
|
|
1
|
+
import type { Task } from "@lit/task";
|
|
2
|
+
import type { components } from "../../core/types/api-schema.js";
|
|
3
3
|
export declare class SearchMixinInterface {
|
|
4
4
|
searchTask: Task<readonly [string, string | undefined], components["schemas"]["SearchGetResponse"] | undefined>;
|
|
5
5
|
getSearchTerm(): string;
|
package/dist/sdk/chrome.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { safeUrl } from "@coras-io/brand-tokens";
|
|
2
|
+
import { once } from "./once.js";
|
|
2
3
|
const SLOT_TAGS = {
|
|
3
4
|
navbar: "coras-navbar",
|
|
4
5
|
footer: "coras-footer",
|
|
5
6
|
};
|
|
6
7
|
const chromeLoaders = {
|
|
7
|
-
navbar: () => import("../containers/navbar/navbar.js"),
|
|
8
|
-
footer: () => import("../containers/footer/footer.js"),
|
|
8
|
+
navbar: once(() => import("../containers/navbar/navbar.js")),
|
|
9
|
+
footer: once(() => import("../containers/footer/footer.js")),
|
|
9
10
|
};
|
|
10
11
|
function normalizeChrome(chrome) {
|
|
11
12
|
if (chrome === undefined || chrome === false) {
|
|
@@ -70,13 +71,16 @@ async function createSlotElement(slot, spec, logo) {
|
|
|
70
71
|
*/
|
|
71
72
|
export async function createChrome(chrome, options) {
|
|
72
73
|
const normalized = normalizeChrome(chrome);
|
|
73
|
-
|
|
74
|
+
// Load both slots concurrently; each dynamically imports its own module.
|
|
74
75
|
// `theme.logo` is the public config and skips BrandConfig validation, so gate
|
|
75
76
|
// it here at the SDK boundary: an unsafe URL yields "" and renders no logo.
|
|
76
|
-
const navbar = await
|
|
77
|
+
const [navbar, footer] = await Promise.all([
|
|
78
|
+
createSlotElement("navbar", normalized.navbar, safeUrl(options?.logo)),
|
|
79
|
+
createSlotElement("footer", normalized.footer),
|
|
80
|
+
]);
|
|
81
|
+
const elements = [];
|
|
77
82
|
if (navbar)
|
|
78
83
|
elements.push(navbar);
|
|
79
|
-
const footer = await createSlotElement("footer", normalized.footer);
|
|
80
84
|
if (footer)
|
|
81
85
|
elements.push(footer);
|
|
82
86
|
return elements;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CorasConfig, CorasLogger } from "./types.js";
|
|
2
|
+
export type Diagnostics = {
|
|
3
|
+
/** Warn once per `code`. No-op if nothing consumes diagnostics. */
|
|
4
|
+
warn: (code: string, message: string, data?: unknown) => void;
|
|
5
|
+
/** True when either channel would surface a warning (logger or strict). */
|
|
6
|
+
readonly active: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function createDiagnostics(logger: CorasLogger | undefined, strict: boolean): Diagnostics;
|
|
9
|
+
export declare function themeHasNoColours(theme: CorasConfig["theme"]): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function createDiagnostics(logger, strict) {
|
|
2
|
+
const hasLogger = typeof logger?.warn === "function";
|
|
3
|
+
const active = hasLogger || strict;
|
|
4
|
+
const seen = new Set();
|
|
5
|
+
return {
|
|
6
|
+
active,
|
|
7
|
+
warn(code, message, data) {
|
|
8
|
+
if (!active || seen.has(code))
|
|
9
|
+
return;
|
|
10
|
+
seen.add(code);
|
|
11
|
+
logger?.warn?.(message, data);
|
|
12
|
+
if (strict) {
|
|
13
|
+
if (data !== undefined)
|
|
14
|
+
console.warn(`[coras] ${message}`, data);
|
|
15
|
+
else
|
|
16
|
+
console.warn(`[coras] ${message}`);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
// A theme with no brand colours means the mount falls back to Coras defaults -
|
|
22
|
+
// almost always a sign the host forgot to pass its `brand.json` as `config.theme`.
|
|
23
|
+
export function themeHasNoColours(theme) {
|
|
24
|
+
return theme?.primary == null && theme?.secondary == null;
|
|
25
|
+
}
|
package/dist/sdk/mount.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { fireEvent } from "../core/events.js";
|
|
2
2
|
import { DEFAULT_CURRENCY, DEFAULT_LOCALE } from "../views/constants.js";
|
|
3
|
+
import { createDiagnostics, themeHasNoColours } from "./diagnostics.js";
|
|
3
4
|
import { attachCallbackBridge, } from "./element-adapter.js";
|
|
4
5
|
import { createChrome } from "./chrome.js";
|
|
5
6
|
import { applyConfig, applyParams, captureParamDefaults, defaultPageRegistry, } from "./page-registry.js";
|
|
@@ -25,6 +26,15 @@ export function createMountWith(registry) {
|
|
|
25
26
|
const strict = options.strict === true;
|
|
26
27
|
const preview = options.preview === true;
|
|
27
28
|
const container = options.container;
|
|
29
|
+
// Dev-time diagnostics (see diagnostics.ts): active only when a logger is
|
|
30
|
+
// wired or `strict` is on, so production stays silent.
|
|
31
|
+
const diagnostics = createDiagnostics(options.logger, strict);
|
|
32
|
+
// Mounting a second app into a container that already holds one silently
|
|
33
|
+
// stacks two mounts - a common cause of "it renders twice" in effects that
|
|
34
|
+
// forget to unmount.
|
|
35
|
+
if (diagnostics.active &&
|
|
36
|
+
container.querySelector(":scope > [data-coras-root]"))
|
|
37
|
+
diagnostics.warn("double-mount", "mount() was called on a container that already holds a Coras mount. Call app.unmount() before mounting again, or mount into a fresh element.");
|
|
28
38
|
const root = document.createElement("div");
|
|
29
39
|
root.setAttribute("data-coras-root", "");
|
|
30
40
|
// Token system is defined on the container scope and inherits into every
|
|
@@ -35,6 +45,8 @@ export function createMountWith(registry) {
|
|
|
35
45
|
let currentConfig = validated.config;
|
|
36
46
|
let currentParams = validated.params;
|
|
37
47
|
let currentChrome = options.chrome;
|
|
48
|
+
if (themeHasNoColours(currentConfig.theme))
|
|
49
|
+
diagnostics.warn("no-theme", "config.theme has no brand colours (primary/secondary); Coras will render with default styling. Pass your brand.json as config.theme to apply your brand.");
|
|
38
50
|
applyTheme(root, currentConfig.theme);
|
|
39
51
|
applyColorScheme(root, currentConfig.colorScheme);
|
|
40
52
|
root.dataset.corasPage = currentPage;
|
|
@@ -156,6 +168,36 @@ export function createMountWith(registry) {
|
|
|
156
168
|
});
|
|
157
169
|
}
|
|
158
170
|
startRender(currentPage);
|
|
171
|
+
// Post-render diagnostics: run only when something consumes them. The assets
|
|
172
|
+
// probe confirms icons actually load; the fit check catches a container that
|
|
173
|
+
// clips the managed page (e.g. a leftover starter-template `#root`).
|
|
174
|
+
if (diagnostics.active) {
|
|
175
|
+
const assetsUrl = currentConfig.assetsUrl;
|
|
176
|
+
void (async () => {
|
|
177
|
+
const url = `${assetsUrl}/icons.svg`;
|
|
178
|
+
try {
|
|
179
|
+
const res = await fetch(url);
|
|
180
|
+
const type = res.headers.get("content-type") ?? "";
|
|
181
|
+
if (!res.ok || !/svg|xml/i.test(type))
|
|
182
|
+
diagnostics.warn("assets-unreachable", `Coras icons could not be loaded from ${url} (status ${res.status}). Set config.assetsUrl to a valid Coras asset origin.`);
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
diagnostics.warn("assets-unreachable", `Coras icons could not be loaded from ${url}. Set config.assetsUrl to a reachable Coras asset origin.`);
|
|
186
|
+
}
|
|
187
|
+
})();
|
|
188
|
+
void ready
|
|
189
|
+
.then(() => {
|
|
190
|
+
// Only meaningful with managed chrome (the page owns the width). With
|
|
191
|
+
// `chrome: false` a narrow container is the host's deliberate choice.
|
|
192
|
+
if (chromeElements.length === 0)
|
|
193
|
+
return;
|
|
194
|
+
const width = root.getBoundingClientRect().width;
|
|
195
|
+
const viewport = root.ownerDocument.defaultView?.innerWidth ?? 0;
|
|
196
|
+
if (viewport && width > 0 && width < viewport * 0.9)
|
|
197
|
+
diagnostics.warn("constrained-container", `The Coras page rendered at ${Math.round(width)}px inside a ${viewport}px viewport. With managed chrome the page expects the full width - an ancestor (often a leftover starter-template \`#root\` with max-width or centering) is constraining it. Let the container fill the page, or pass chrome: false if you are embedding into an existing layout.`);
|
|
198
|
+
})
|
|
199
|
+
.catch(() => undefined);
|
|
200
|
+
}
|
|
159
201
|
function applyUpdate(patch) {
|
|
160
202
|
if (destroyed)
|
|
161
203
|
return;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memoize a zero-arg async factory so concurrent callers share one in-flight
|
|
3
|
+
* promise. Used to wrap the lazy `import()` loaders: `mount()` and `prefetch()`
|
|
4
|
+
* can request the same page (or chrome) module at once, and browser module
|
|
5
|
+
* evaluation is already cached, but without this each call still allocates a
|
|
6
|
+
* fresh import promise. A rejected load is not cached, so a failed module
|
|
7
|
+
* (offline, chunk 404) can be retried on the next call.
|
|
8
|
+
*/
|
|
9
|
+
export declare function once<T>(factory: () => Promise<T>): () => Promise<T>;
|
package/dist/sdk/once.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memoize a zero-arg async factory so concurrent callers share one in-flight
|
|
3
|
+
* promise. Used to wrap the lazy `import()` loaders: `mount()` and `prefetch()`
|
|
4
|
+
* can request the same page (or chrome) module at once, and browser module
|
|
5
|
+
* evaluation is already cached, but without this each call still allocates a
|
|
6
|
+
* fresh import promise. A rejected load is not cached, so a failed module
|
|
7
|
+
* (offline, chunk 404) can be retried on the next call.
|
|
8
|
+
*/
|
|
9
|
+
export function once(factory) {
|
|
10
|
+
let inFlight;
|
|
11
|
+
return () => {
|
|
12
|
+
inFlight ??= factory().catch((error) => {
|
|
13
|
+
inFlight = undefined;
|
|
14
|
+
throw error;
|
|
15
|
+
});
|
|
16
|
+
return inFlight;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -19,8 +19,8 @@ export declare function applyConfig(element: ConfigurableElement, config: CorasC
|
|
|
19
19
|
/**
|
|
20
20
|
* Snapshot the element's default values for every param the page exposes. Taken
|
|
21
21
|
* right after creation (before any params are applied) so a later update can
|
|
22
|
-
* reset a param the host no longer provides back to its default
|
|
23
|
-
* it
|
|
22
|
+
* reset a param the host no longer provides back to its default - i.e. "clear"
|
|
23
|
+
* it - instead of leaving the stale value in place.
|
|
24
24
|
*/
|
|
25
25
|
export declare function captureParamDefaults(element: ConfigurableElement, entry: PageEntry): Record<string, unknown>;
|
|
26
26
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { once } from "./once.js";
|
|
1
2
|
/** Identity map helper for params whose public name equals the element property. */
|
|
2
3
|
function identity(...keys) {
|
|
3
4
|
return Object.fromEntries(keys.map((key) => [key, key]));
|
|
@@ -5,7 +6,7 @@ function identity(...keys) {
|
|
|
5
6
|
export const defaultPageRegistry = {
|
|
6
7
|
landing: {
|
|
7
8
|
tagName: "coras-landing-page",
|
|
8
|
-
load: () => import("../views/landing-page/landing-page.js"),
|
|
9
|
+
load: once(() => import("../views/landing-page/landing-page.js")),
|
|
9
10
|
// Public `sort` maps to the internal `sorting` property.
|
|
10
11
|
paramToProperty: {
|
|
11
12
|
...identity("country", "city", "startDate", "endDate", "duration", "price", "categories"),
|
|
@@ -14,28 +15,28 @@ export const defaultPageRegistry = {
|
|
|
14
15
|
},
|
|
15
16
|
search: {
|
|
16
17
|
tagName: "coras-search-page",
|
|
17
|
-
load: () => import("../views/search-page/search-page.js"),
|
|
18
|
+
load: once(() => import("../views/search-page/search-page.js")),
|
|
18
19
|
paramToProperty: identity("search", "startDate"),
|
|
19
20
|
},
|
|
20
21
|
details: {
|
|
21
22
|
tagName: "coras-details-page",
|
|
22
|
-
load: () => import("../views/details-page/details-page.js"),
|
|
23
|
+
load: once(() => import("../views/details-page/details-page.js")),
|
|
23
24
|
// Public `id` maps to the internal `attractionId` property.
|
|
24
25
|
paramToProperty: { id: "attractionId", date: "date" },
|
|
25
26
|
},
|
|
26
27
|
payment: {
|
|
27
28
|
tagName: "coras-payment-page",
|
|
28
|
-
load: () => import("../views/payment-page/payment-page.js"),
|
|
29
|
+
load: once(() => import("../views/payment-page/payment-page.js")),
|
|
29
30
|
paramToProperty: identity("metadata"),
|
|
30
31
|
},
|
|
31
32
|
help: {
|
|
32
33
|
tagName: "coras-help-page",
|
|
33
|
-
load: () => import("../views/help-page/help-page.js"),
|
|
34
|
+
load: once(() => import("../views/help-page/help-page.js")),
|
|
34
35
|
paramToProperty: identity("content"),
|
|
35
36
|
},
|
|
36
37
|
"suggestion-widget": {
|
|
37
38
|
tagName: "coras-suggestion-widget",
|
|
38
|
-
load: () => import("../views/suggestion-widget/suggestion-widget.js"),
|
|
39
|
+
load: once(() => import("../views/suggestion-widget/suggestion-widget.js")),
|
|
39
40
|
paramToProperty: identity("limit", "showExploreCard", "country", "city"),
|
|
40
41
|
},
|
|
41
42
|
};
|
|
@@ -43,8 +44,7 @@ export const defaultPageRegistry = {
|
|
|
43
44
|
export function applyConfig(element, config) {
|
|
44
45
|
element.apiHost = config.apiUrl;
|
|
45
46
|
element.distributorID = config.distributorId;
|
|
46
|
-
|
|
47
|
-
element.assetsURL = config.assetsUrl;
|
|
47
|
+
element.assetsURL = config.assetsUrl;
|
|
48
48
|
if (config.locale != null)
|
|
49
49
|
element.locale = config.locale;
|
|
50
50
|
if (config.allowedLocales != null)
|
|
@@ -60,8 +60,8 @@ export function applyConfig(element, config) {
|
|
|
60
60
|
/**
|
|
61
61
|
* Snapshot the element's default values for every param the page exposes. Taken
|
|
62
62
|
* right after creation (before any params are applied) so a later update can
|
|
63
|
-
* reset a param the host no longer provides back to its default
|
|
64
|
-
* it
|
|
63
|
+
* reset a param the host no longer provides back to its default - i.e. "clear"
|
|
64
|
+
* it - instead of leaving the stale value in place.
|
|
65
65
|
*/
|
|
66
66
|
export function captureParamDefaults(element, entry) {
|
|
67
67
|
const defaults = {};
|
package/dist/sdk/theme.js
CHANGED
|
@@ -29,7 +29,7 @@ export function applyTheme(element, theme) {
|
|
|
29
29
|
return;
|
|
30
30
|
// Each themeable var is emitted as a `light-dark()` pair (or a single value
|
|
31
31
|
// when the field has no dark variant) via the shared engine, which sanitizes
|
|
32
|
-
// both sides
|
|
32
|
+
// both sides - an invalid value yields "" and is skipped, so the Coras default
|
|
33
33
|
// (itself a light-dark pair) shows through. The dark side falls back to the
|
|
34
34
|
// Coras dark default when the brand sets only the light value.
|
|
35
35
|
const dark = (theme.dark ?? {});
|
package/dist/sdk/types.d.ts
CHANGED
|
@@ -68,17 +68,17 @@ export type CorasTheme = BrandConfig;
|
|
|
68
68
|
* its `dark` block the dark overrides; this picks which side the `light-dark()`
|
|
69
69
|
* token pairs resolve to.
|
|
70
70
|
*
|
|
71
|
-
* - `"light"` (default)
|
|
72
|
-
* - `"dark"`
|
|
73
|
-
* - `"system"`
|
|
74
|
-
* - `"inherit"`
|
|
71
|
+
* - `"light"` (default) - always light, ignoring the host page.
|
|
72
|
+
* - `"dark"` - always dark.
|
|
73
|
+
* - `"system"` - follows the OS via `prefers-color-scheme`.
|
|
74
|
+
* - `"inherit"` - follows the host page's own `color-scheme` (the SDK sets none),
|
|
75
75
|
* so the embed behaves like a native element on a light or dark site.
|
|
76
76
|
*/
|
|
77
77
|
export type CorasColorScheme = "light" | "dark" | "system" | "inherit";
|
|
78
78
|
export type CorasConfig = {
|
|
79
79
|
apiUrl: string;
|
|
80
80
|
distributorId: string;
|
|
81
|
-
assetsUrl
|
|
81
|
+
assetsUrl: string;
|
|
82
82
|
locale?: SupportedLocales;
|
|
83
83
|
allowedLocales?: SupportedLocales[];
|
|
84
84
|
currency?: SupportedCurrencies;
|
|
@@ -109,11 +109,11 @@ export type CorasNavbarProps = {
|
|
|
109
109
|
* the host owns, not the internal widget they sit beside, and use logical
|
|
110
110
|
* `start`/`end` so they stay correct under RTL.
|
|
111
111
|
*
|
|
112
|
-
* - `brand`
|
|
113
|
-
* - `nav`
|
|
114
|
-
* - `actions-start`
|
|
115
|
-
* - `actions-end`
|
|
116
|
-
* - `search`
|
|
112
|
+
* - `brand` - logo / home affordance (leading edge)
|
|
113
|
+
* - `nav` - primary navigation, after the brand
|
|
114
|
+
* - `actions-start` - leading edge of the utility cluster, before the basket
|
|
115
|
+
* - `actions-end` - trailing edge of the utility cluster, before search
|
|
116
|
+
* - `search` - replaces the built-in search (requires `showSearch: false`)
|
|
117
117
|
*/
|
|
118
118
|
export type CorasNavbarSlotName = "brand" | "nav" | "actions-start" | "actions-end" | "search";
|
|
119
119
|
/**
|
|
@@ -222,7 +222,7 @@ export type CorasMountOptions<P extends CorasPageName = CorasPageName> = {
|
|
|
222
222
|
* tools (e.g. the Studio). Pages that would otherwise show an empty
|
|
223
223
|
* or error state when there is nothing to check out instead render their full
|
|
224
224
|
* form with actions disabled, so the chrome can be styled. Not for production
|
|
225
|
-
* hosts
|
|
225
|
+
* hosts - a real customer with an empty basket should see the empty state.
|
|
226
226
|
*/
|
|
227
227
|
preview?: boolean;
|
|
228
228
|
} & CorasCallbacks;
|
package/dist/sdk/validation.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ export declare class CorasValidationError extends Error {
|
|
|
14
14
|
export declare const PUBLIC_PAGES: readonly CorasPageName[];
|
|
15
15
|
/**
|
|
16
16
|
* Reject a page name outside the public set with a typed error. Shared by mount,
|
|
17
|
-
* update, navigate and prefetch so every entry point fails the same way
|
|
18
|
-
* before any state is mutated
|
|
17
|
+
* update, navigate and prefetch so every entry point fails the same way - and
|
|
18
|
+
* before any state is mutated - instead of indexing the registry with an unknown
|
|
19
19
|
* page and throwing a bare TypeError.
|
|
20
20
|
*/
|
|
21
21
|
export declare function assertValidPage(page: unknown): asserts page is CorasPageName;
|
package/dist/sdk/validation.js
CHANGED
|
@@ -24,8 +24,8 @@ export const PUBLIC_PAGES = [
|
|
|
24
24
|
];
|
|
25
25
|
/**
|
|
26
26
|
* Reject a page name outside the public set with a typed error. Shared by mount,
|
|
27
|
-
* update, navigate and prefetch so every entry point fails the same way
|
|
28
|
-
* before any state is mutated
|
|
27
|
+
* update, navigate and prefetch so every entry point fails the same way - and
|
|
28
|
+
* before any state is mutated - instead of indexing the registry with an unknown
|
|
29
29
|
* page and throwing a bare TypeError.
|
|
30
30
|
*/
|
|
31
31
|
export function assertValidPage(page) {
|
|
@@ -128,7 +128,7 @@ const BARE_HOSTNAME_RE = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-
|
|
|
128
128
|
/**
|
|
129
129
|
* Asset URL must be one of:
|
|
130
130
|
* - an https URL (http allowed only for localhost),
|
|
131
|
-
* - a bare hostname like `
|
|
131
|
+
* - a bare hostname like `assets.example.com[:port]`,
|
|
132
132
|
* - a root-relative path like `/assets`.
|
|
133
133
|
* Rejected: protocol-relative URLs (`//host/x`), `javascript:` / `data:` URIs,
|
|
134
134
|
* traversal-style paths. `assetsUrl` is interpolated straight into image and
|
|
@@ -220,10 +220,11 @@ export function validateConfig(config, strict) {
|
|
|
220
220
|
config.distributorId.length === 0) {
|
|
221
221
|
throw new CorasValidationError("invalid_config", "config.distributorId is required.", "config.distributorId");
|
|
222
222
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
validateAssetsUrl(config.assetsUrl);
|
|
223
|
+
if (typeof config.assetsUrl !== "string" || config.assetsUrl.length === 0) {
|
|
224
|
+
throw new CorasValidationError("invalid_config", "config.assetsUrl is required.", "config.assetsUrl");
|
|
226
225
|
}
|
|
226
|
+
validateAssetsUrl(config.assetsUrl);
|
|
227
|
+
const normalized = { ...config };
|
|
227
228
|
if (config.theme != null) {
|
|
228
229
|
validateTheme(config.theme, strict);
|
|
229
230
|
}
|
package/dist/styles/tokens.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* GENERATED by scripts/generate-tokens.mjs
|
|
1
|
+
/* GENERATED by scripts/generate-tokens.mjs - do not edit by hand. */
|
|
2
2
|
/* CSS-first four-tier token system (plan F-004, P-051..P-055). */
|
|
3
3
|
|
|
4
4
|
@layer coras.palette, coras.brand, coras.semantic, coras.components;
|