@coras-io/embed 0.11.0 → 0.12.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/components/attraction-card/base/attraction-card.mixin.js +17 -0
  3. package/dist/components/attraction-card/base/attraction-card.styles.js +2 -0
  4. package/dist/components/attraction-card/base/attraction-card.types.d.ts +2 -0
  5. package/dist/components/attraction-card/long/attraction-long-card.component.js +4 -2
  6. package/dist/components/attraction-card/short/attraction-short-card.component.d.ts +2 -0
  7. package/dist/components/attraction-card/short/attraction-short-card.component.js +16 -4
  8. package/dist/components/breadcrumbs/breadcrumb-item/breadcrumb-item.component.d.ts +5 -0
  9. package/dist/components/breadcrumbs/breadcrumb-item/breadcrumb-item.component.js +16 -3
  10. package/dist/components/breadcrumbs/breadcrumb-item/breadcrumb-item.styles.js +3 -1
  11. package/dist/components/image/image.component.d.ts +12 -0
  12. package/dist/components/image/image.component.js +49 -6
  13. package/dist/components/text-section/text-section.component.js +1 -1
  14. package/dist/components/text-section/text-section.styles.js +1 -1
  15. package/dist/containers/footer/footer.component.d.ts +2 -0
  16. package/dist/containers/footer/footer.component.js +29 -22
  17. package/dist/containers/navbar/navbar.component.d.ts +3 -0
  18. package/dist/containers/navbar/navbar.component.js +33 -10
  19. package/dist/contexts/events.context.d.ts +8 -0
  20. package/dist/contexts/events.context.js +6 -0
  21. package/dist/core/images/srcset.d.ts +16 -0
  22. package/dist/core/images/srcset.js +21 -0
  23. package/dist/core/images/url.d.ts +1 -0
  24. package/dist/core/images/url.js +3 -1
  25. package/dist/core/utils/link-click.d.ts +8 -0
  26. package/dist/core/utils/link-click.js +20 -0
  27. package/dist/index.d.ts +1 -1
  28. package/dist/mixins/base.mixin.d.ts +3 -0
  29. package/dist/mixins/base.mixin.js +29 -1
  30. package/dist/sdk/mount.js +1 -0
  31. package/dist/sdk/types.d.ts +12 -0
  32. package/dist/views/chrome-only-page/chrome-only-page.component.d.ts +2 -0
  33. package/dist/views/details-page/details-page.component.d.ts +4 -1
  34. package/dist/views/details-page/details-page.component.js +22 -41
  35. package/dist/views/details-page/partials/location-highlights/location-highlights.component.d.ts +2 -1
  36. package/dist/views/details-page/partials/location-highlights/location-highlights.component.js +12 -5
  37. package/dist/views/help-page/help-page.component.d.ts +2 -0
  38. package/dist/views/landing-page/landing-page.component.d.ts +4 -1
  39. package/dist/views/landing-page/landing-page.component.js +21 -16
  40. package/dist/views/payment-page/payment-page.component.d.ts +2 -0
  41. package/dist/views/search-page/search-page.component.d.ts +5 -2
  42. package/dist/views/search-page/search-page.component.js +41 -48
  43. package/dist/views/suggestion-widget/suggestion-widget.component.d.ts +5 -2
  44. package/dist/views/suggestion-widget/suggestion-widget.component.js +7 -4
  45. package/package.json +1 -1
@@ -24,5 +24,21 @@ interface BuildSrcsetOptions extends Omit<ImgixOptions, "w" | "h" | "dpr"> {
24
24
  * straight to a `srcset` attribute without conditionals.
25
25
  */
26
26
  export declare function buildSrcset(src: string, widths?: readonly number[], options?: BuildSrcsetOptions): string;
27
+ export interface SourceSize {
28
+ width: number;
29
+ height: number;
30
+ }
31
+ /**
32
+ * The widest image imgix can cut from the source without enlarging it.
33
+ * `aspectRatio` is the ratio the image is cropped to: a crop narrower than
34
+ * the source runs out of height before it runs out of width.
35
+ */
36
+ export declare function maxWidthWithinSource(source: SourceSize, aspectRatio?: number): number;
37
+ /**
38
+ * Width candidates that never ask imgix to enlarge the source image. An
39
+ * enlarged image is a bigger download with no extra detail, so candidates
40
+ * wider than the source give way to one at the source's own size.
41
+ */
42
+ export declare function widthsWithinSource(widths: readonly number[], source: SourceSize, aspectRatio?: number): number[];
27
43
  export declare function buildSizes(preset: ImagePreset): string;
28
44
  export {};
@@ -29,6 +29,27 @@ export function buildSrcset(src, widths = RESPONSIVE_WIDTHS, options = {}) {
29
29
  })
30
30
  .join(", ");
31
31
  }
32
+ /**
33
+ * The widest image imgix can cut from the source without enlarging it.
34
+ * `aspectRatio` is the ratio the image is cropped to: a crop narrower than
35
+ * the source runs out of height before it runs out of width.
36
+ */
37
+ export function maxWidthWithinSource(source, aspectRatio) {
38
+ return Math.floor(aspectRatio
39
+ ? Math.min(source.width, source.height * aspectRatio)
40
+ : source.width);
41
+ }
42
+ /**
43
+ * Width candidates that never ask imgix to enlarge the source image. An
44
+ * enlarged image is a bigger download with no extra detail, so candidates
45
+ * wider than the source give way to one at the source's own size.
46
+ */
47
+ export function widthsWithinSource(widths, source, aspectRatio) {
48
+ const max = maxWidthWithinSource(source, aspectRatio);
49
+ if (widths.every((w) => w <= max))
50
+ return Array.from(widths);
51
+ return [...widths.filter((w) => w < max), max];
52
+ }
32
53
  /**
33
54
  * Slot presets for the `sizes` attribute. These describe the rendered size of
34
55
  * the image in the layout, NOT the viewport - which is exactly what `sizes`
@@ -20,4 +20,5 @@ export interface ImgixOptions {
20
20
  fpX?: number;
21
21
  fpY?: number;
22
22
  }
23
+ export declare const DEFAULT_QUALITY = 45;
23
24
  export declare function buildImgixUrl(src: string, opts?: ImgixOptions): string;
@@ -8,7 +8,9 @@
8
8
  * not call this helper.
9
9
  */
10
10
  const DEFAULT_AUTO = "compress,format";
11
- const DEFAULT_QUALITY = 85;
11
+ // The quality imgix itself uses for `auto=compress`. Photos at 85 were about
12
+ // a third larger with no visible gain at the sizes the SDK shows them.
13
+ export const DEFAULT_QUALITY = 45;
12
14
  export function buildImgixUrl(src, opts = {}) {
13
15
  if (!src)
14
16
  return "";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Claims a click on a link the host routes. A plain left click is claimed: its
3
+ * default is prevented so the page does not load the href, and `true` tells the
4
+ * caller (or a listener up the tree) to emit the navigation intent instead. A
5
+ * modified click is left to the browser, which opens the href in a new tab or
6
+ * window, and is stopped from reaching the listeners that would also navigate.
7
+ */
8
+ export declare function claimLinkClick(event: MouseEvent): boolean;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Claims a click on a link the host routes. A plain left click is claimed: its
3
+ * default is prevented so the page does not load the href, and `true` tells the
4
+ * caller (or a listener up the tree) to emit the navigation intent instead. A
5
+ * modified click is left to the browser, which opens the href in a new tab or
6
+ * window, and is stopped from reaching the listeners that would also navigate.
7
+ */
8
+ export function claimLinkClick(event) {
9
+ const modified = event.button !== 0 ||
10
+ event.metaKey ||
11
+ event.ctrlKey ||
12
+ event.shiftKey ||
13
+ event.altKey;
14
+ if (modified) {
15
+ event.stopPropagation();
16
+ return false;
17
+ }
18
+ event.preventDefault();
19
+ return true;
20
+ }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { mount } from "./sdk/mount.js";
2
2
  export { CorasValidationError, type CorasValidationErrorCode, } from "./sdk/validation.js";
3
- export type { CorasApp, CorasConfig, CorasLoyaltyProgramme, CorasTheme, CorasColorScheme, CorasChrome, CorasChromeOptions, CorasNavbar, CorasFooter, CorasManagedNavbar, CorasManagedFooter, CorasNavbarSlotName, CorasNavbarProps, CorasMountOptions, CorasState, CorasUpdate, CorasConfigUpdate, CorasNavigateOptions, CorasCallbacks, CorasLogger, CorasObservabilityEvent, CorasPageName, CorasPageParams, CorasPageParamsByPage, CorasLandingPageParams, CorasSearchPageParams, CorasDetailsPageParams, CorasPaymentPageParams, CorasHelpPageParams, CorasSuggestionWidgetParams, CorasHostEventMap, CorasHostEventName, CorasReadyDetail, CorasNavigateDetail, CorasStateChangeDetail, CorasReservationCreatedDetail, CorasPaymentStatusDetail, CorasPaymentStatus, CorasErrorDetail, CorasNavigationSource, } from "./sdk/types.js";
3
+ export type { CorasApp, CorasConfig, CorasLoyaltyProgramme, CorasTheme, CorasColorScheme, CorasChrome, CorasChromeOptions, CorasNavbar, CorasFooter, CorasManagedNavbar, CorasManagedFooter, CorasNavbarSlotName, CorasNavbarProps, CorasMountOptions, CorasState, CorasUpdate, CorasConfigUpdate, CorasNavigateOptions, CorasCallbacks, CorasLogger, CorasHrefFor, CorasObservabilityEvent, CorasPageName, CorasPageParams, CorasPageParamsByPage, CorasLandingPageParams, CorasSearchPageParams, CorasDetailsPageParams, CorasPaymentPageParams, CorasHelpPageParams, CorasSuggestionWidgetParams, CorasHostEventMap, CorasHostEventName, CorasReadyDetail, CorasNavigateDetail, CorasStateChangeDetail, CorasReservationCreatedDetail, CorasPaymentStatusDetail, CorasPaymentStatus, CorasErrorDetail, CorasNavigationSource, } from "./sdk/types.js";
4
4
  export type { SupportedLocales } from "./core/types/core/locale.js";
5
5
  export type { SupportedCurrencies } from "./core/types/core/currency.js";
6
6
  export { allLocales } from "./core/i18n/locale-codes.js";
@@ -5,6 +5,7 @@ import type { Client } from "openapi-fetch";
5
5
  import type { LoyaltyProgramme } from "../core/utils/loyalty.js";
6
6
  import type { Constructor } from "../contexts/utils.js";
7
7
  import { type PageDispatchInput } from "../contexts/events.context.js";
8
+ import type { CorasHrefFor } from "../sdk/types.js";
8
9
  import { type Logger } from "../core/logger.js";
9
10
  import type { PageParamsEvent } from "../core/pages.js";
10
11
  type BaseMixinProperties<CustomPageContext extends PageParamsEvent> = {
@@ -18,9 +19,11 @@ type BaseMixinProperties<CustomPageContext extends PageParamsEvent> = {
18
19
  loyaltyPoints: boolean;
19
20
  loyaltyProgramme: LoyaltyProgramme | null;
20
21
  logger: Logger;
22
+ hrefFor: CorasHrefFor | null;
21
23
  client: Client<paths>;
22
24
  getPageProperties(): CustomPageContext;
23
25
  dispatchPageUpdate(params: PageDispatchInput): void;
26
+ pageUpdateHref(params: PageDispatchInput): string | undefined;
24
27
  };
25
28
  export declare const BaseMixin: <T extends Constructor<LitElement>, CustomPageContext extends PageParamsEvent>(superClass: T) => Constructor<BaseMixinProperties<CustomPageContext>> & T;
26
29
  export {};
@@ -13,7 +13,7 @@ import { allLocales } from "../core/i18n/locale-codes.js";
13
13
  import { getTextDirection } from "../core/utils/locale.js";
14
14
  import { ContextRoot, provide } from "@lit/context";
15
15
  import { clientContext } from "../contexts/client.context.js";
16
- import { pageDispatchContext, } from "../contexts/events.context.js";
16
+ import { pageDispatchContext, pageHrefContext, } from "../contexts/events.context.js";
17
17
  import { fireEvent } from "../core/events.js";
18
18
  import { classifyPageUpdate } from "../sdk/navigation-intent.js";
19
19
  import { apiHostContext, assetsURLContext, loyaltyPointsContext, loyaltyProgrammeContext, currenciesContext, currencyContext, distributorIdContext, localeContext, localesContext, } from "../contexts/properties.context.js";
@@ -38,7 +38,10 @@ export const BaseMixin = (superClass) => {
38
38
  // Set by the SDK mount, not an attribute: a host cannot pass a function
39
39
  // through markup, so the default stays silent until `mount` wires one.
40
40
  this.logger = NOOP_LOGGER;
41
+ // The host's `hrefFor` mount option, set by the SDK mount like the logger.
42
+ this.hrefFor = null;
41
43
  this._pageDispatch = this.dispatchPageUpdate.bind(this);
44
+ this._pageHref = this.pageUpdateHref.bind(this);
42
45
  // Replays context requests that arrive before their provider renders
43
46
  // inside this page's shadow DOM. See docs/ARCHITECTURE.md.
44
47
  new ContextRoot().attach(this);
@@ -46,6 +49,25 @@ export const BaseMixin = (superClass) => {
46
49
  getPageProperties() {
47
50
  return {};
48
51
  }
52
+ // The link for a control that would call `dispatchPageUpdate` with the same
53
+ // params. Unlike a same-page dispatch, which merges the current params in,
54
+ // the link names the target state alone: a crumb or the logo opened in a
55
+ // new tab lands on that page as a visitor would reach it, not with this
56
+ // page's filters carried over.
57
+ pageUpdateHref(params) {
58
+ if (!this.hrefFor)
59
+ return undefined;
60
+ const { page, currency, locale, href, text, ...pageSpecific } = params;
61
+ void text;
62
+ return this.hrefFor({
63
+ page: page ?? this.currentPage,
64
+ params: pageSpecific,
65
+ locale: locale ?? this.locale,
66
+ currency: currency ?? this.currency,
67
+ ...(href != null ? { href } : {}),
68
+ source: "embed",
69
+ });
70
+ }
49
71
  dispatchPageUpdate(params) {
50
72
  const { page, currency, locale, href, text, ...pageSpecific } = params;
51
73
  // External-link text is not part of the minimal public payload.
@@ -134,8 +156,14 @@ export const BaseMixin = (superClass) => {
134
156
  __decorate([
135
157
  provide({ context: loggerContext })
136
158
  ], BaseMixinElement.prototype, "logger", void 0);
159
+ __decorate([
160
+ property({ attribute: false })
161
+ ], BaseMixinElement.prototype, "hrefFor", void 0);
137
162
  __decorate([
138
163
  provide({ context: pageDispatchContext })
139
164
  ], BaseMixinElement.prototype, "_pageDispatch", void 0);
165
+ __decorate([
166
+ provide({ context: pageHrefContext })
167
+ ], BaseMixinElement.prototype, "_pageHref", void 0);
140
168
  return BaseMixinElement;
141
169
  };
package/dist/sdk/mount.js CHANGED
@@ -178,6 +178,7 @@ export function createMountWith(registry) {
178
178
  // set directly on the element; pages that honor it read their own property.
179
179
  element.preview = preview;
180
180
  element.logger = toLogger(options.logger);
181
+ element.hrefFor = options.hrefFor ?? null;
181
182
  const paramDefaults = captureParamDefaults(element, entry);
182
183
  applyParams(element, entry, currentParams, paramDefaults);
183
184
  // Chrome is rebuilt per page rather than moved: the navbar/footer consume
@@ -242,6 +242,7 @@ export type CorasCallbacks = {
242
242
  onError?: (detail: CorasErrorDetail) => void;
243
243
  onObservability?: (event: CorasObservabilityEvent) => void;
244
244
  };
245
+ export type CorasHrefFor = (intent: CorasNavigateDetail) => string | undefined;
245
246
  /**
246
247
  * `mount()` is generic over `P`, so a call passing a literal page gets its own
247
248
  * params checked against it. The alias is deliberately *not* distributed over
@@ -266,6 +267,17 @@ export type CorasMountOptions<P extends CorasPageName = CorasPageName> = {
266
267
  */
267
268
  content?: HTMLElement;
268
269
  logger?: CorasLogger;
270
+ /**
271
+ * The URL the host would route a navigation intent to. When set, pages render
272
+ * their internal navigation (attraction cards, breadcrumbs, the navbar logo,
273
+ * the footer's help links) as real `<a href>` links that crawlers follow,
274
+ * built the same way `onNavigate` routes them (usually with `buildCorasUrl`).
275
+ * A plain click on such a link still emits `onNavigate` and never loads the
276
+ * page; a modified or middle click opens the href the browser's way. Return
277
+ * `undefined` for an intent that has no link. Unset, those controls stay
278
+ * buttons.
279
+ */
280
+ hrefFor?: CorasHrefFor;
269
281
  /** Reject unknown config/param keys instead of ignoring them. */
270
282
  strict?: boolean;
271
283
  /**
@@ -12,9 +12,11 @@ declare const CorasChromeOnlyPage_base: import("../../contexts/utils.js").Constr
12
12
  loyaltyPoints: boolean;
13
13
  loyaltyProgramme: import("../../index.js").CorasLoyaltyProgramme | null;
14
14
  logger: import("../../core/logger.js").Logger;
15
+ hrefFor: import("../../index.js").CorasHrefFor | null;
15
16
  client: import("openapi-fetch").Client<import("../../core/types/api-schema.js").paths>;
16
17
  getPageProperties(): PageParamsEvent;
17
18
  dispatchPageUpdate(params: import("../../contexts/events.context.js").PageDispatchInput): void;
19
+ pageUpdateHref(params: import("../../contexts/events.context.js").PageDispatchInput): string | undefined;
18
20
  }> & typeof LitElement;
19
21
  /**
20
22
  * The managed chrome around markup the host owns, with no Coras page inside it.
@@ -1,5 +1,6 @@
1
1
  import { type CSSResultGroup, LitElement, type PropertyValues } from "lit";
2
2
  import { Task } from "@lit/task";
3
+ import type { PageDispatchInput } from "../../contexts/events.context.js";
3
4
  import type { SupportedLocales, SupportedCurrencies } from "../../core/types/index.js";
4
5
  import "../../components/button/button.js";
5
6
  import "../../components/attraction-header/attraction-header.js";
@@ -48,9 +49,11 @@ declare const CorasDetailsPage_base: import("../../contexts/utils.js").Construct
48
49
  loyaltyPoints: boolean;
49
50
  loyaltyProgramme: import("../../core/utils/loyalty.js").LoyaltyProgramme | null;
50
51
  logger: import("../../core/logger.js").Logger;
52
+ hrefFor: import("../../index.js").CorasHrefFor | null;
51
53
  client: import("openapi-fetch").Client<import("../../core/types/api-schema.js").paths>;
52
54
  getPageProperties(): DetailsPageParamsEvent;
53
- dispatchPageUpdate(params: import("../../contexts/events.context.js").PageDispatchInput): void;
55
+ dispatchPageUpdate(params: PageDispatchInput): void;
56
+ pageUpdateHref(params: PageDispatchInput): string | undefined;
54
57
  }> & typeof LitElement;
55
58
  /**
56
59
  * @fires coras:navigate
@@ -11,6 +11,7 @@ import { state, property } from "lit/decorators.js";
11
11
  import { Task, TaskStatus } from "@lit/task";
12
12
  import { localized, msg, str } from "@lit/localize";
13
13
  import { classMap } from "lit/directives/class-map.js";
14
+ import { ifDefined } from "lit/directives/if-defined.js";
14
15
  import { fireEvent } from "../../core/events.js";
15
16
  import { map } from "lit/directives/map.js";
16
17
  import { consume } from "@lit/context";
@@ -439,6 +440,8 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(BaseMixin(
439
440
  src=${image.url}
440
441
  width=${IMAGE_CAROUSEL_WIDTH}
441
442
  height=${IMAGE_CAROUSEL_HEIGHT}
443
+ source-width=${image.width ?? nothing}
444
+ source-height=${image.height ?? nothing}
442
445
  preset="carousel-hero"
443
446
  loading=${index === 0 ? "eager" : "lazy"}
444
447
  fetch-priority=${index === 0 ? "high" : "auto"}
@@ -1383,50 +1386,28 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(BaseMixin(
1383
1386
  if (!summary)
1384
1387
  return nothing;
1385
1388
  const { cityName, citySlug, countryName, countrySlug } = summary;
1386
- const handleCountryClick = () => {
1387
- if (!countrySlug)
1388
- return;
1389
- this.dispatchPageUpdate({
1390
- page: "landing",
1391
- country: countrySlug,
1392
- city: "",
1393
- });
1394
- };
1395
- const handleCityClick = () => {
1396
- if (!countrySlug || !citySlug)
1397
- return;
1398
- this.dispatchPageUpdate({
1399
- page: "landing",
1400
- country: countrySlug,
1401
- city: citySlug,
1402
- });
1403
- };
1404
- const handleCategoryClick = () => {
1405
- if (!countrySlug || !citySlug)
1406
- return;
1407
- this.dispatchPageUpdate({
1408
- page: "landing",
1409
- country: countrySlug,
1410
- city: citySlug,
1411
- categories: attraction.main_category.slug,
1412
- });
1413
- };
1389
+ const countryTarget = countrySlug
1390
+ ? { page: "landing", country: countrySlug, city: "" }
1391
+ : null;
1392
+ const cityTarget = countrySlug && citySlug
1393
+ ? { page: "landing", country: countrySlug, city: citySlug }
1394
+ : null;
1395
+ const categoryTarget = cityTarget
1396
+ ? { ...cityTarget, categories: attraction.main_category.slug }
1397
+ : null;
1398
+ const renderLink = (label, target) => html `<coras-breadcrumb-item
1399
+ href=${ifDefined(target ? this.pageUpdateHref(target) : undefined)}
1400
+ @click=${() => target && this.dispatchPageUpdate(target)}
1401
+ clickable
1402
+ >
1403
+ ${label}
1404
+ </coras-breadcrumb-item>`;
1414
1405
  return html `
1415
1406
  <coras-breadcrumbs assets-url="${this.assetsURL}">
1416
- ${countryName
1417
- ? html `<coras-breadcrumb-item @click=${handleCountryClick} clickable>
1418
- ${countryName}
1419
- </coras-breadcrumb-item>`
1420
- : nothing}
1421
- ${cityName
1422
- ? html `<coras-breadcrumb-item @click=${handleCityClick} clickable>
1423
- ${cityName}
1424
- </coras-breadcrumb-item>`
1425
- : nothing}
1407
+ ${countryName ? renderLink(countryName, countryTarget) : nothing}
1408
+ ${cityName ? renderLink(cityName, cityTarget) : nothing}
1426
1409
  ${attraction.main_category.name
1427
- ? html `<coras-breadcrumb-item @click=${handleCategoryClick} clickable>
1428
- ${attraction.main_category.name}
1429
- </coras-breadcrumb-item>`
1410
+ ? renderLink(attraction.main_category.name, categoryTarget)
1430
1411
  : nothing}
1431
1412
  <coras-breadcrumb-item>
1432
1413
  ${attraction.attraction_name}
@@ -21,8 +21,9 @@ export declare class CorasLocationHighlights extends LitElement {
21
21
  currency: SupportedCurrencies;
22
22
  loyaltyProgramme: LoyaltyProgramme | null;
23
23
  dispatchPageUpdate: (params: PageDispatchInput) => void;
24
+ private _pageHref?;
24
25
  private highlightsTask;
25
- private handleCardClick;
26
+ private cardTarget;
26
27
  private renderCard;
27
28
  render(): typeof nothing | import("lit").TemplateResult<1> | undefined;
28
29
  }
@@ -6,6 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { LitElement, html, nothing } from "lit";
8
8
  import { property } from "lit/decorators.js";
9
+ import { ifDefined } from "lit/directives/if-defined.js";
9
10
  import { consume } from "@lit/context";
10
11
  import { localized, msg, str } from "@lit/localize";
11
12
  import { Task } from "@lit/task";
@@ -16,7 +17,7 @@ import { APIError } from "../../../../core/api/api-error.js";
16
17
  import { convertToLocaleCurrency } from "../../../../core/currency/index.js";
17
18
  import { clientContext } from "../../../../contexts/client.context.js";
18
19
  import { currencyContext, distributorIdContext, localeContext, loyaltyProgrammeContext, } from "../../../../contexts/properties.context.js";
19
- import { pageDispatchContext, } from "../../../../contexts/events.context.js";
20
+ import { pageDispatchContext, pageHrefContext, } from "../../../../contexts/events.context.js";
20
21
  import styles from "./location-highlights.styles.js";
21
22
  import { renderLoyaltyBadge } from "../../../../components/loyalty-badge/loyalty-badge.utils.js";
22
23
  /**
@@ -74,20 +75,22 @@ let CorasLocationHighlights = class CorasLocationHighlights extends LitElement {
74
75
  });
75
76
  }
76
77
  static { this.styles = styles; }
77
- handleCardClick(card) {
78
- this.dispatchPageUpdate({
78
+ cardTarget(card) {
79
+ return {
79
80
  page: "details",
80
81
  id: card.id,
81
82
  date: formatISO(parseISO(card.date), { representation: "date" }),
82
83
  locale: this.locale,
83
84
  currency: this.currency,
84
- });
85
+ };
85
86
  }
86
87
  renderCard(card) {
87
88
  const price = card.price[this.currency];
89
+ const target = this.cardTarget(card);
88
90
  return html `
89
91
  <coras-attraction-short-card
90
92
  .images=${card.images}
93
+ loading="lazy"
91
94
  ?label=${false}
92
95
  name=${card.title}
93
96
  rating=${card.rating || 0}
@@ -102,7 +105,8 @@ let CorasLocationHighlights = class CorasLocationHighlights extends LitElement {
102
105
  date=${card.date}
103
106
  timezone=${card.timezone}
104
107
  locale=${this.locale}
105
- @click=${() => this.handleCardClick(card)}
108
+ href=${ifDefined(this._pageHref?.(target))}
109
+ @click=${() => this.dispatchPageUpdate(target)}
106
110
  >
107
111
  ${renderLoyaltyBadge({
108
112
  loyalty: card.loyalty,
@@ -166,6 +170,9 @@ __decorate([
166
170
  __decorate([
167
171
  consume({ context: pageDispatchContext })
168
172
  ], CorasLocationHighlights.prototype, "dispatchPageUpdate", void 0);
173
+ __decorate([
174
+ consume({ context: pageHrefContext })
175
+ ], CorasLocationHighlights.prototype, "_pageHref", void 0);
169
176
  CorasLocationHighlights = __decorate([
170
177
  localized()
171
178
  ], CorasLocationHighlights);
@@ -25,9 +25,11 @@ declare const CorasHelpPage_base: import("../../contexts/utils.js").Constructor<
25
25
  loyaltyPoints: boolean;
26
26
  loyaltyProgramme: import("../../index.js").CorasLoyaltyProgramme | null;
27
27
  logger: import("../../core/logger.js").Logger;
28
+ hrefFor: import("../../index.js").CorasHrefFor | null;
28
29
  client: import("openapi-fetch").Client<import("../../core/types/api-schema.js").paths>;
29
30
  getPageProperties(): HelpPageParamsEvent;
30
31
  dispatchPageUpdate(params: import("../../contexts/events.context.js").PageDispatchInput): void;
32
+ pageUpdateHref(params: import("../../contexts/events.context.js").PageDispatchInput): string | undefined;
31
33
  }> & typeof LitElement;
32
34
  /**
33
35
  * Help page component for FAQs, contact form, and policy pages.
@@ -1,5 +1,6 @@
1
1
  import { type CSSResultGroup, LitElement, type PropertyValues } from "lit";
2
2
  import type { LandingPageParamsEvent } from "../../core/pages.js";
3
+ import type { PageDispatchInput } from "../../contexts/events.context.js";
3
4
  import type { PageName } from "../../core/types/shared.js";
4
5
  import "../../components/location-image/location-image.js";
5
6
  import "../../components/dropdown/dropdown.js";
@@ -38,9 +39,11 @@ declare const CorasLandingPage_base: import("../../contexts/utils.js").Construct
38
39
  loyaltyPoints: boolean;
39
40
  loyaltyProgramme: import("../../index.js").CorasLoyaltyProgramme | null;
40
41
  logger: import("../../core/logger.js").Logger;
42
+ hrefFor: import("../../index.js").CorasHrefFor | null;
41
43
  client: import("openapi-fetch").Client<import("../../core/types/api-schema.js").paths>;
42
44
  getPageProperties(): LandingPageParamsEvent;
43
- dispatchPageUpdate(params: import("../../contexts/events.context.js").PageDispatchInput): void;
45
+ dispatchPageUpdate(params: PageDispatchInput): void;
46
+ pageUpdateHref(params: PageDispatchInput): string | undefined;
44
47
  }> & typeof LitElement;
45
48
  /**
46
49
  * @fires coras:navigate
@@ -6,6 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { html, LitElement, nothing, } from "lit";
8
8
  import { when } from "lit/directives/when.js";
9
+ import { ifDefined } from "lit/directives/if-defined.js";
9
10
  import { property, query, state } from "lit/decorators.js";
10
11
  import { msg, localized } from "@lit/localize";
11
12
  import { Task } from "@lit/task";
@@ -830,6 +831,15 @@ let CorasLandingPage = class CorasLandingPage extends ErrorModalMixin(LocationSe
830
831
 
831
832
  <div class="cards">
832
833
  ${cards.map((card) => {
834
+ const target = {
835
+ locale: this.locale,
836
+ currency: this.currency,
837
+ page: "details",
838
+ id: card.id,
839
+ date: formatISO(parseISO(card.date), {
840
+ representation: "date",
841
+ }),
842
+ };
833
843
  return html `
834
844
  <coras-attraction-short-card
835
845
  .images=${card.images}
@@ -845,15 +855,8 @@ let CorasLandingPage = class CorasLandingPage extends ErrorModalMixin(LocationSe
845
855
  date=${card.date}
846
856
  timezone=${card.timezone}
847
857
  locale=${this.locale}
848
- @click=${() => this.dispatchPageUpdate({
849
- locale: this.locale,
850
- currency: this.currency,
851
- page: "details",
852
- id: card.id,
853
- date: formatISO(parseISO(card.date), {
854
- representation: "date",
855
- }),
856
- })}
858
+ href=${ifDefined(this.pageUpdateHref(target))}
859
+ @click=${() => this.dispatchPageUpdate(target)}
857
860
  >
858
861
  ${renderLoyaltyBadge({
859
862
  loyalty: card.loyalty,
@@ -911,17 +914,19 @@ let CorasLandingPage = class CorasLandingPage extends ErrorModalMixin(LocationSe
911
914
  if (!matchingCity) {
912
915
  return nothing;
913
916
  }
914
- const handleCountryClick = () => {
915
- this.dispatchPageUpdate({
916
- page: "landing",
917
- country: this.resolvedCountry,
918
- city: "",
919
- });
917
+ const countryTarget = {
918
+ page: "landing",
919
+ country: this.resolvedCountry,
920
+ city: "",
920
921
  };
921
922
  return html `
922
923
  <div class="breadcrumbs-container">
923
924
  <coras-breadcrumbs assets-url="${this.assetsURL}">
924
- <coras-breadcrumb-item @click=${handleCountryClick} clickable>
925
+ <coras-breadcrumb-item
926
+ href=${ifDefined(this.pageUpdateHref(countryTarget))}
927
+ @click=${() => this.dispatchPageUpdate(countryTarget)}
928
+ clickable
929
+ >
925
930
  ${matchingCountry.name}
926
931
  </coras-breadcrumb-item>
927
932
  <coras-breadcrumb-item> ${matchingCity.name} </coras-breadcrumb-item>
@@ -39,9 +39,11 @@ declare const CorasPaymentPage_base: import("../../contexts/utils.js").Construct
39
39
  loyaltyPoints: boolean;
40
40
  loyaltyProgramme: import("../../core/utils/loyalty.js").LoyaltyProgramme | null;
41
41
  logger: Logger;
42
+ hrefFor: import("../../index.js").CorasHrefFor | null;
42
43
  client: import("openapi-fetch").Client<import("../../core/types/api-schema.js").paths>;
43
44
  getPageProperties(): PaymentPageParamsEvent;
44
45
  dispatchPageUpdate(params: import("../../contexts/events.context.js").PageDispatchInput): void;
46
+ pageUpdateHref(params: import("../../contexts/events.context.js").PageDispatchInput): string | undefined;
45
47
  }> & typeof LitElement;
46
48
  /**
47
49
  * Payment page component for processing checkout and payments.
@@ -1,4 +1,5 @@
1
1
  import { type CSSResultGroup, LitElement, type PropertyValues } from "lit";
2
+ import type { PageDispatchInput } from "../../contexts/events.context.js";
2
3
  import "../../components/attraction-card/long/attraction-long-card.js";
3
4
  import "../../components/button/button.js";
4
5
  import "../../components/loading-spinner/loading-spinner.js";
@@ -20,9 +21,11 @@ declare const CorasSearchPage_base: import("../../contexts/utils.js").Constructo
20
21
  loyaltyPoints: boolean;
21
22
  loyaltyProgramme: import("../../index.js").CorasLoyaltyProgramme | null;
22
23
  logger: import("../../core/logger.js").Logger;
24
+ hrefFor: import("../../index.js").CorasHrefFor | null;
23
25
  client: Client<paths>;
24
26
  getPageProperties(): SearchPageParamsEvent;
25
- dispatchPageUpdate(params: import("../../contexts/events.context.js").PageDispatchInput): void;
27
+ dispatchPageUpdate(params: PageDispatchInput): void;
28
+ pageUpdateHref(params: PageDispatchInput): string | undefined;
26
29
  }> & typeof LitElement;
27
30
  /**
28
31
  * Search page component for displaying search results.
@@ -58,7 +61,7 @@ export declare class CorasSearchPage extends CorasSearchPage_base {
58
61
  updated(changedProperties: PropertyValues): void;
59
62
  private renderSkeleton;
60
63
  private renderAttractions;
61
- private handleAttractionClick;
64
+ private renderBreadcrumbLink;
62
65
  private renderBottomSection;
63
66
  render(): import("lit").TemplateResult<1>;
64
67
  }