@coras-io/embed 0.12.0 → 0.13.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @coras-io/embed
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b792a0b: Finish the embed's crawlable navigation. With an `href`, `coras-attraction-short-card` and `coras-attraction-long-card` stretch the title link's hit area over the whole card, so a click on the photo or the card body behaves like a click on the title; the title text stays the only link. With `hrefFor`, the details page's category "Explore" buttons, the suggestion widget's "See all activities" button and the order confirmation's Help Centre link render as real links too, and `coras-button` takes an `href` attribute that renders it as a link with the button's look. New in `@coras-io/embed/url`: `createCorasRouting({ url, navigate, replace })` returns the `hrefFor`, `onNavigate` and `onStateChange` mount options from one URL helper or strategy, so a host wires its router in one call and its links always match its routes; and two opt-in URL strategy options, `localeCase: "lower"` to write a lower-case locale segment and `defaultCurrency` to leave a default currency out of built URLs. The default strategy is unchanged. For every link a plain click still emits `onNavigate` without a page load, and a modified or middle click opens the page in a new tab. Without `href` or `hrefFor` nothing changes.
8
+
3
9
  ## 0.12.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -31,17 +31,27 @@ copy instead of two; `@coinbase/cdp-core` is the only exact pin.
31
31
 
32
32
  ```ts
33
33
  import { mount } from "@coras-io/embed";
34
+ import { createCorasRouting, createCorasUrlState } from "@coras-io/embed/url";
35
+
36
+ const coras = createCorasUrlState({
37
+ localeCase: "lower",
38
+ currencyInPath: false,
39
+ defaultCurrency: "EUR",
40
+ });
34
41
 
35
42
  const app = mount({
36
43
  container,
37
44
  page: "landing",
38
45
  config: { apiUrl, distributorId, assetsUrl, locale, currency },
39
- onNavigate: (intent) => router.go(intent),
40
- onStateChange: (state) => router.replace(state),
46
+ ...createCorasRouting({
47
+ url: coras,
48
+ navigate: (href) => router.push(href),
49
+ replace: (href) => router.replace(href),
50
+ }),
41
51
  });
42
52
  ```
43
53
 
44
- `mount()` owns the container, chrome (navbar and footer), page swapping, and the host-routing contract (`coras:navigate` and `coras:state-change`). It returns an app handle with `ready`, `state`, `update()`, `navigate()`, `prefetch()`, and `unmount()`.
54
+ `mount()` owns the container, chrome (navbar and footer), page swapping, and the host-routing contract (`coras:navigate`, `coras:state-change` and the `hrefFor` option that renders the embed's navigation as real links). `createCorasRouting` returns those three options from one URL helper; the strategy above is the shape the Coras sites use, and the SDK default (`/en-IE/EUR/...`) stays available. It returns an app handle with `ready`, `state`, `update()`, `navigate()`, `prefetch()`, and `unmount()`.
45
55
 
46
56
  Page custom elements are internal. You never import them directly.
47
57
 
@@ -56,10 +66,10 @@ For the full guide and event reference, see the Coras docs at https://docs.coras
56
66
 
57
67
  ## Other entry points
58
68
 
59
- | Entry point | Purpose |
60
- | ------------------------- | ------------------------------------------------------------------------------- |
61
- | `@coras-io/embed/url` | URL and state helpers: `parseCorasUrl`, `buildCorasUrl`, `createCorasUrlState`. |
62
- | `@coras-io/embed/errors` | Typed error classes for host integration code. |
63
- | `@coras-io/embed/helpers` | Locale and currency helpers: `getLocale`, `getCurrency`. |
69
+ | Entry point | Purpose |
70
+ | ------------------------- | ----------------------------------------------------------------------------------------------------- |
71
+ | `@coras-io/embed/url` | URL and state helpers: `parseCorasUrl`, `buildCorasUrl`, `createCorasUrlState`, `createCorasRouting`. |
72
+ | `@coras-io/embed/errors` | Typed error classes for host integration code. |
73
+ | `@coras-io/embed/helpers` | Locale and currency helpers: `getLocale`, `getCurrency`. |
64
74
 
65
75
  Public TypeScript types come from the package root alongside `mount()`.
@@ -35,9 +35,9 @@ export const AttractionCardMixin = (superClass) => {
35
35
  this.timezone = "";
36
36
  this.locale = "en-GB";
37
37
  /**
38
- * The attraction page's URL. Set, the title becomes a link crawlers follow;
39
- * a plain click on it still reaches the card's click listener, which
40
- * navigates in the app.
38
+ * The attraction page's URL. Set, the title becomes a link crawlers follow
39
+ * whose hit area covers the whole card; a plain click anywhere on the card
40
+ * still reaches the card's click listener, which navigates in the app.
41
41
  */
42
42
  this.href = "";
43
43
  }
@@ -44,6 +44,7 @@ export default css `
44
44
  }
45
45
 
46
46
  .wrapper {
47
+ position: relative;
47
48
  container-type: inline-size;
48
49
  height: 100%;
49
50
  width: 100%;
@@ -68,6 +69,13 @@ export default css `
68
69
  text-overflow: ellipsis;
69
70
  }
70
71
 
72
+ /* The link's hit area is the whole card; the text stays the only link. */
73
+ a.title::after {
74
+ content: "";
75
+ position: absolute;
76
+ inset: 0;
77
+ }
78
+
71
79
  .date {
72
80
  font-size: var(--attraction-card-details-font-size);
73
81
  line-height: var(--attraction-card-details-line-height);
@@ -18,11 +18,17 @@ export declare class CorasButton extends LitElement {
18
18
  clickable: boolean;
19
19
  error: boolean;
20
20
  loading: boolean;
21
+ /**
22
+ * Renders the button as a link to this URL, with the button's look. A
23
+ * disabled or loading button stays a button, since a link cannot be disabled.
24
+ */
25
+ href: string;
21
26
  constructor();
22
27
  connectedCallback(): void;
23
28
  disconnectedCallback(): void;
24
29
  click(): void;
25
30
  private handleHostClick;
26
31
  private computeClasses;
32
+ private renderContent;
27
33
  render(): import("lit").TemplateResult<1>;
28
34
  }
@@ -27,6 +27,11 @@ export class CorasButton extends LitElement {
27
27
  this.clickable = true;
28
28
  this.error = false;
29
29
  this.loading = false;
30
+ /**
31
+ * Renders the button as a link to this URL, with the button's look. A
32
+ * disabled or loading button stays a button, since a link cannot be disabled.
33
+ */
34
+ this.href = "";
30
35
  this.internals = this.attachInternals();
31
36
  }
32
37
  connectedCallback() {
@@ -90,26 +95,41 @@ export class CorasButton extends LitElement {
90
95
  loading: this.loading,
91
96
  };
92
97
  }
98
+ renderContent() {
99
+ return when(this.loading, () => html `<coras-loading-spinner size="small"></coras-loading-spinner>`, () => html `
100
+ <slot name="prefix" part="prefix"></slot>
101
+ <slot part="label"></slot>
102
+ <slot name="suffix" part="suffix"></slot>
103
+ `);
104
+ }
93
105
  render() {
106
+ const inactive = this.disabled || this.loading;
107
+ if (this.href && !inactive) {
108
+ return html `
109
+ <a
110
+ part="base"
111
+ href=${this.href}
112
+ class="${classMap(this.computeClasses())}"
113
+ >
114
+ ${this.renderContent()}
115
+ </a>
116
+ `;
117
+ }
94
118
  return html `
95
119
  <button
96
120
  part="base"
97
121
  type="${this.type}"
98
- ?disabled="${this.disabled || this.loading}"
99
- aria-disabled="${this.disabled || this.loading ? "true" : "false"}"
122
+ ?disabled="${inactive}"
123
+ aria-disabled="${inactive ? "true" : "false"}"
100
124
  class="${classMap(this.computeClasses())}"
101
125
  >
102
- ${when(this.loading, () => html `<coras-loading-spinner size="small"></coras-loading-spinner>`, () => html `
103
- <slot name="prefix" part="prefix"></slot>
104
- <slot part="label"></slot>
105
- <slot name="suffix" part="suffix"></slot>
106
- `)}
126
+ ${this.renderContent()}
107
127
  </button>
108
128
  `;
109
129
  }
110
130
  }
111
131
  __decorate([
112
- query("button")
132
+ query("button, a")
113
133
  ], CorasButton.prototype, "button", void 0);
114
134
  __decorate([
115
135
  property({ type: String })
@@ -147,3 +167,6 @@ __decorate([
147
167
  __decorate([
148
168
  property({ type: Boolean })
149
169
  ], CorasButton.prototype, "loading", void 0);
170
+ __decorate([
171
+ property({ type: String })
172
+ ], CorasButton.prototype, "href", void 0);
@@ -105,7 +105,14 @@ export default css `
105
105
  pointer-events: none;
106
106
  }
107
107
 
108
- button {
108
+ /* Outranks the shared :host a default, so a linked button keeps the button's look. */
109
+ :host a {
110
+ font-weight: var(--button-font-weight);
111
+ text-decoration: none;
112
+ }
113
+
114
+ button,
115
+ a {
109
116
  align-items: center;
110
117
  background-color: transparent;
111
118
  border-radius: var(--button-border-radius);
package/dist/sdk/url.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { SupportedCurrencies } from "../core/types/core/currency.js";
2
2
  import type { SupportedLocales } from "../core/types/core/locale.js";
3
- import type { CorasPageName, CorasPageParams } from "./types.js";
3
+ import type { CorasHrefFor, CorasNavigateDetail, CorasPageName, CorasPageParams, CorasStateChangeDetail } from "./types.js";
4
4
  /**
5
5
  * Framework-neutral URL helpers for host-controlled routing. The host owns the
6
6
  * URL; these helpers translate between a Coras state and a canonical URL so each
@@ -47,8 +47,19 @@ export type CorasUrlStrategy = {
47
47
  * collide with real ids.
48
48
  */
49
49
  reservedSegments?: Partial<Record<CorasRoutablePage, string>>;
50
+ /**
51
+ * How a built URL writes the locale segment: the canonical `en-IE` by
52
+ * default, or `"lower"` for `en-ie`. Parsing accepts either case.
53
+ */
54
+ localeCase?: "canonical" | "lower";
55
+ /**
56
+ * A currency a built URL leaves out, as a code or as a function of the
57
+ * state's locale. A parsed URL without a currency has `currency: undefined`,
58
+ * so the host supplies the same default when it reads one.
59
+ */
60
+ defaultCurrency?: SupportedCurrencies | ((locale?: SupportedLocales) => SupportedCurrencies | undefined);
50
61
  };
51
- export declare const DEFAULT_URL_STRATEGY: Required<Omit<CorasUrlStrategy, "reservedSegments">> & {
62
+ export declare const DEFAULT_URL_STRATEGY: Required<Omit<CorasUrlStrategy, "reservedSegments" | "localeCase" | "defaultCurrency">> & {
52
63
  reservedSegments: Partial<Record<CorasRoutablePage, string>>;
53
64
  };
54
65
  /** Parse a (relative or absolute) URL into a Coras state. */
@@ -66,3 +77,34 @@ export declare function createCorasUrlState(strategy?: CorasUrlStrategy): {
66
77
  normalize: typeof normalizeCorasUrlState;
67
78
  isSame: typeof isSameCorasUrlState;
68
79
  };
80
+ /**
81
+ * What the routing glue needs from a URL helper: `createCorasUrlState()`
82
+ * itself, or a wrapper around its `build` for a host whose URL shape differs
83
+ * from the strategy (a lower-case locale segment, a currency left out).
84
+ */
85
+ export type CorasUrlBuilder = Pick<ReturnType<typeof createCorasUrlState>, "build">;
86
+ export type CorasRoutingOptions = {
87
+ /** The URL helper to build with, or the strategy to bind one to. */
88
+ url: CorasUrlBuilder | CorasUrlStrategy;
89
+ /** Shows `href` as a new history entry; `intent` is the detail it was built from. */
90
+ navigate: (href: string, intent: CorasNavigateDetail) => void;
91
+ /** Shows `href` in place of the current history entry. */
92
+ replace: (href: string, state: CorasStateChangeDetail) => void;
93
+ /** Opens an external link. By default a new tab that cannot reach the opener. */
94
+ external?: (href: string, intent: CorasNavigateDetail) => void;
95
+ };
96
+ export type CorasRouting = {
97
+ hrefFor: CorasHrefFor;
98
+ onNavigate: (intent: CorasNavigateDetail) => void;
99
+ onStateChange: (state: CorasStateChangeDetail) => void;
100
+ };
101
+ /**
102
+ * The three mount options that connect Coras to a host router, built from one
103
+ * URL helper so the link a control renders (`hrefFor`) and the route a click
104
+ * takes (`onNavigate`) are always the same URL. `onNavigate` pushes a history
105
+ * entry through `navigate`, `onStateChange` replaces the current one through
106
+ * `replace`, and an intent carrying `href` is an external link: it gets no
107
+ * `hrefFor` and is opened by `external` instead of routed. Spread the result
108
+ * into `mount()`.
109
+ */
110
+ export declare function createCorasRouting({ url: urlOrStrategy, navigate, replace, external, }: CorasRoutingOptions): CorasRouting;
package/dist/sdk/url.js CHANGED
@@ -141,6 +141,15 @@ export function parseCorasUrl(url, strategy = {}) {
141
141
  ...(currency ? { currency } : {}),
142
142
  };
143
143
  }
144
+ // The state's currency, unless the strategy leaves that one out as the default.
145
+ function currencyToWrite(state, defaultCurrency) {
146
+ if (!state.currency)
147
+ return undefined;
148
+ const omitted = typeof defaultCurrency === "function"
149
+ ? defaultCurrency(state.locale)
150
+ : defaultCurrency;
151
+ return state.currency === omitted ? undefined : state.currency;
152
+ }
144
153
  /** Build a canonical URL from a Coras state. */
145
154
  export function buildCorasUrl(state, strategy = {}) {
146
155
  const resolved = resolveStrategy(strategy);
@@ -156,10 +165,14 @@ export function buildCorasUrl(state, strategy = {}) {
156
165
  const base = trimSlashes(resolved.basePath);
157
166
  if (base)
158
167
  segments.push(base);
159
- if (resolved.localeInPath && state.locale)
160
- segments.push(state.locale);
161
- if (resolved.currencyInPath && state.currency)
162
- segments.push(state.currency);
168
+ if (resolved.localeInPath && state.locale) {
169
+ segments.push(resolved.localeCase === "lower"
170
+ ? state.locale.toLowerCase()
171
+ : state.locale);
172
+ }
173
+ const currency = currencyToWrite(state, resolved.defaultCurrency);
174
+ if (resolved.currencyInPath && currency)
175
+ segments.push(currency);
163
176
  const params = (state.params ?? {});
164
177
  if (state.page === "details") {
165
178
  const id = params.id;
@@ -195,8 +208,8 @@ export function buildCorasUrl(state, strategy = {}) {
195
208
  if (value != null && value !== "")
196
209
  query.set(key, String(value));
197
210
  }
198
- if (!resolved.currencyInPath && state.currency) {
199
- query.set(resolved.currencyParam, state.currency);
211
+ if (!resolved.currencyInPath && currency) {
212
+ query.set(resolved.currencyParam, currency);
200
213
  }
201
214
  const path = `/${segments.join("/")}`.replace(/\/+/g, "/");
202
215
  const queryString = query.toString();
@@ -243,3 +256,38 @@ export function createCorasUrlState(strategy = {}) {
243
256
  isSame: isSameCorasUrlState,
244
257
  };
245
258
  }
259
+ function urlStateOf(detail) {
260
+ return {
261
+ page: detail.page,
262
+ params: detail.params ?? {},
263
+ ...(detail.locale ? { locale: detail.locale } : {}),
264
+ ...(detail.currency ? { currency: detail.currency } : {}),
265
+ };
266
+ }
267
+ function openInNewTab(href) {
268
+ window.open(href, "_blank", "noopener,noreferrer");
269
+ }
270
+ /**
271
+ * The three mount options that connect Coras to a host router, built from one
272
+ * URL helper so the link a control renders (`hrefFor`) and the route a click
273
+ * takes (`onNavigate`) are always the same URL. `onNavigate` pushes a history
274
+ * entry through `navigate`, `onStateChange` replaces the current one through
275
+ * `replace`, and an intent carrying `href` is an external link: it gets no
276
+ * `hrefFor` and is opened by `external` instead of routed. Spread the result
277
+ * into `mount()`.
278
+ */
279
+ export function createCorasRouting({ url: urlOrStrategy, navigate, replace, external = openInNewTab, }) {
280
+ const url = "build" in urlOrStrategy && typeof urlOrStrategy.build === "function"
281
+ ? urlOrStrategy
282
+ : createCorasUrlState(urlOrStrategy);
283
+ return {
284
+ hrefFor: (intent) => intent.href ? undefined : url.build(urlStateOf(intent)),
285
+ onNavigate: (intent) => {
286
+ if (intent.href)
287
+ external(intent.href, intent);
288
+ else
289
+ navigate(url.build(urlStateOf(intent)), intent);
290
+ },
291
+ onStateChange: (state) => replace(url.build(urlStateOf(state)), state),
292
+ };
293
+ }
@@ -22,8 +22,9 @@ export declare class CorasLocationCategories extends LitElement {
22
22
  locale: SupportedLocales;
23
23
  currency: SupportedCurrencies;
24
24
  dispatchPageUpdate: (params: PageDispatchInput) => void;
25
+ pageUpdateHref?: (params: PageDispatchInput) => string | undefined;
25
26
  private categoriesTask;
26
- private handleCategoryClick;
27
+ private categoryTarget;
27
28
  private renderCategory;
28
29
  render(): typeof nothing | import("lit").TemplateResult<1> | undefined;
29
30
  }
@@ -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";
@@ -17,7 +18,8 @@ import { apiGet } from "../../../../core/api/queries.js";
17
18
  import { APIError } from "../../../../core/api/api-error.js";
18
19
  import { clientContext } from "../../../../contexts/client.context.js";
19
20
  import { assetsURLContext, currencyContext, distributorIdContext, localeContext, } from "../../../../contexts/properties.context.js";
20
- import { pageDispatchContext, } from "../../../../contexts/events.context.js";
21
+ import { pageDispatchContext, pageHrefContext, } from "../../../../contexts/events.context.js";
22
+ import { claimLinkClick } from "../../../../core/utils/link-click.js";
21
23
  import styles from "./location-categories.styles.js";
22
24
  /**
23
25
  * Below this the row is too thin to read as a set of things to explore, and
@@ -67,17 +69,21 @@ let CorasLocationCategories = class CorasLocationCategories extends LitElement {
67
69
  });
68
70
  }
69
71
  static { this.styles = styles; }
70
- handleCategoryClick(category) {
71
- this.dispatchPageUpdate({
72
+ categoryTarget(category) {
73
+ return {
72
74
  page: "landing",
73
75
  country: this.country,
74
76
  city: this.city,
75
77
  categories: category.slug,
76
78
  locale: this.locale,
77
79
  currency: this.currency,
78
- });
80
+ };
79
81
  }
82
+ // A link when the host builds URLs, a button otherwise; a plain click
83
+ // navigates in the app either way.
80
84
  renderCategory(category) {
85
+ const target = this.categoryTarget(category);
86
+ const href = this.pageUpdateHref?.(target);
81
87
  return html `
82
88
  <coras-explore-card
83
89
  image=${category.image}
@@ -87,7 +93,11 @@ let CorasLocationCategories = class CorasLocationCategories extends LitElement {
87
93
  <coras-button
88
94
  slot="button"
89
95
  variant="outlined"
90
- @click=${() => this.handleCategoryClick(category)}
96
+ href=${ifDefined(href)}
97
+ @click=${(event) => {
98
+ if (!href || claimLinkClick(event))
99
+ this.dispatchPageUpdate(target);
100
+ }}
91
101
  >
92
102
  ${msg("Explore")}
93
103
  </coras-button>
@@ -143,6 +153,9 @@ __decorate([
143
153
  __decorate([
144
154
  consume({ context: pageDispatchContext })
145
155
  ], CorasLocationCategories.prototype, "dispatchPageUpdate", void 0);
156
+ __decorate([
157
+ consume({ context: pageHrefContext })
158
+ ], CorasLocationCategories.prototype, "pageUpdateHref", void 0);
146
159
  CorasLocationCategories = __decorate([
147
160
  localized()
148
161
  ], CorasLocationCategories);
@@ -10,7 +10,9 @@ export declare class CorasConfirmation extends LitElement {
10
10
  reservations: ReservationSummary[];
11
11
  loyalty: boolean;
12
12
  private dispatchPageUpdate;
13
+ private pageUpdateHref?;
13
14
  private handleHelpClick;
15
+ private renderHelpLink;
14
16
  private getImgixParams;
15
17
  private renderTicketImage;
16
18
  render(): import("lit").TemplateResult<1>;
@@ -15,7 +15,9 @@ import { getLoyaltyAmount } from "../../../../core/utils/loyalty.js";
15
15
  import { formatDateTimeForDisplay, formatTimeForDisplay, } from "../../../../core/utils/datetime.js";
16
16
  import { getSeatDetails } from "../../../../core/utils/seats.js";
17
17
  import { consume } from "@lit/context";
18
- import { pageDispatchContext, } from "../../../../contexts/events.context.js";
18
+ import { pageDispatchContext, pageHrefContext, } from "../../../../contexts/events.context.js";
19
+ import { claimLinkClick } from "../../../../core/utils/link-click.js";
20
+ const HELP_PAGE = { page: "help" };
19
21
  let CorasConfirmation = class CorasConfirmation extends LitElement {
20
22
  constructor() {
21
23
  super(...arguments);
@@ -27,8 +29,25 @@ let CorasConfirmation = class CorasConfirmation extends LitElement {
27
29
  }
28
30
  static { this.styles = styles; }
29
31
  handleHelpClick(event) {
30
- event.preventDefault();
31
- this.dispatchPageUpdate?.({ page: "help" });
32
+ const linked = Boolean(this.pageUpdateHref?.(HELP_PAGE));
33
+ if (!linked || claimLinkClick(event))
34
+ this.dispatchPageUpdate?.(HELP_PAGE);
35
+ }
36
+ // A link to the help page when the host builds URLs, a button otherwise.
37
+ renderHelpLink() {
38
+ const href = this.pageUpdateHref?.(HELP_PAGE);
39
+ const label = msg("Help Centre");
40
+ return href
41
+ ? html `<a class="help-link" href=${href} @click=${this.handleHelpClick}
42
+ >${label}</a
43
+ >`
44
+ : html `<button
45
+ type="button"
46
+ class="help-link"
47
+ @click=${this.handleHelpClick}
48
+ >
49
+ ${label}
50
+ </button>`;
32
51
  }
33
52
  getImgixParams() {
34
53
  const params = new URLSearchParams({
@@ -183,9 +202,7 @@ let CorasConfirmation = class CorasConfirmation extends LitElement {
183
202
 
184
203
  <div class="help-text">
185
204
  ${msg("If you need help with your order, please visit our")}
186
- <span class="help-link" @click="${this.handleHelpClick}">
187
- ${msg("Help Centre")}
188
- </span>
205
+ ${this.renderHelpLink()}
189
206
  </div>
190
207
  `;
191
208
  }
@@ -208,6 +225,9 @@ __decorate([
208
225
  __decorate([
209
226
  consume({ context: pageDispatchContext })
210
227
  ], CorasConfirmation.prototype, "dispatchPageUpdate", void 0);
228
+ __decorate([
229
+ consume({ context: pageHrefContext })
230
+ ], CorasConfirmation.prototype, "pageUpdateHref", void 0);
211
231
  CorasConfirmation = __decorate([
212
232
  localized()
213
233
  ], CorasConfirmation);
@@ -158,6 +158,10 @@ export default css `
158
158
  }
159
159
 
160
160
  .help-link {
161
+ padding: 0;
162
+ border: 0;
163
+ background: none;
164
+ font: inherit;
161
165
  color: var(--confirmation-help-link-color);
162
166
  text-decoration: none;
163
167
  font-weight: var(--confirmation-help-link-font-weight);
@@ -33,7 +33,7 @@ export declare class CorasSuggestionWidget extends CorasSuggestionWidget_base {
33
33
  private humanize;
34
34
  private suggestionsTask;
35
35
  private cardTarget;
36
- private handleExploreCardClick;
36
+ private exploreTarget;
37
37
  private renderCard;
38
38
  private renderExploreCard;
39
39
  private renderContent;
@@ -22,6 +22,7 @@ import { BaseMixin } from "../../mixins/base.mixin.js";
22
22
  import { apiGet } from "../../core/api/queries.js";
23
23
  import { convertToLocaleCurrency } from "../../core/currency/index.js";
24
24
  import { renderLoyaltyBadge } from "../../components/loyalty-badge/loyalty-badge.utils.js";
25
+ import { claimLinkClick } from "../../core/utils/link-click.js";
25
26
  let CorasSuggestionWidget = class CorasSuggestionWidget extends BaseMixin(LitElement) {
26
27
  constructor() {
27
28
  super(...arguments);
@@ -70,14 +71,14 @@ let CorasSuggestionWidget = class CorasSuggestionWidget extends BaseMixin(LitEle
70
71
  currency: this.currency,
71
72
  };
72
73
  }
73
- handleExploreCardClick(country, city) {
74
- this.dispatchPageUpdate({
74
+ exploreTarget(country, city) {
75
+ return {
75
76
  page: "landing",
76
77
  country,
77
78
  city,
78
79
  locale: this.locale,
79
80
  currency: this.currency,
80
- });
81
+ };
81
82
  }
82
83
  renderCard(card) {
83
84
  const price = card.price[this.currency];
@@ -125,6 +126,8 @@ let CorasSuggestionWidget = class CorasSuggestionWidget extends BaseMixin(LitEle
125
126
  imageExtension: "png",
126
127
  params: { auto: "compress,format", ar: "2:3", fit: "crop" },
127
128
  });
129
+ const target = this.exploreTarget(country, city);
130
+ const href = this.pageUpdateHref(target);
128
131
  return html `
129
132
  <coras-explore-card
130
133
  image=${imageUrl}
@@ -134,7 +137,11 @@ let CorasSuggestionWidget = class CorasSuggestionWidget extends BaseMixin(LitEle
134
137
  <coras-button
135
138
  slot="button"
136
139
  variant="outlined"
137
- @click=${() => this.handleExploreCardClick(country, city)}
140
+ href=${ifDefined(href)}
141
+ @click=${(event) => {
142
+ if (!href || claimLinkClick(event))
143
+ this.dispatchPageUpdate(target);
144
+ }}
138
145
  >
139
146
  ${msg("See all activities")}
140
147
  </coras-button>
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "engines": {
21
21
  "node": ">=22"
22
22
  },
23
- "version": "0.12.0",
23
+ "version": "0.13.0",
24
24
  "private": false,
25
25
  "homepage": "https://docs.coras.io",
26
26
  "bugs": {