@coras-io/embed 0.11.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +18 -8
  3. package/dist/components/attraction-card/base/attraction-card.mixin.js +17 -0
  4. package/dist/components/attraction-card/base/attraction-card.styles.js +10 -0
  5. package/dist/components/attraction-card/base/attraction-card.types.d.ts +2 -0
  6. package/dist/components/attraction-card/long/attraction-long-card.component.js +4 -2
  7. package/dist/components/attraction-card/short/attraction-short-card.component.d.ts +2 -0
  8. package/dist/components/attraction-card/short/attraction-short-card.component.js +16 -4
  9. package/dist/components/breadcrumbs/breadcrumb-item/breadcrumb-item.component.d.ts +5 -0
  10. package/dist/components/breadcrumbs/breadcrumb-item/breadcrumb-item.component.js +16 -3
  11. package/dist/components/breadcrumbs/breadcrumb-item/breadcrumb-item.styles.js +3 -1
  12. package/dist/components/button/button.component.d.ts +6 -0
  13. package/dist/components/button/button.component.js +31 -8
  14. package/dist/components/button/button.styles.js +8 -1
  15. package/dist/components/image/image.component.d.ts +12 -0
  16. package/dist/components/image/image.component.js +49 -6
  17. package/dist/components/text-section/text-section.component.js +1 -1
  18. package/dist/components/text-section/text-section.styles.js +1 -1
  19. package/dist/containers/footer/footer.component.d.ts +2 -0
  20. package/dist/containers/footer/footer.component.js +29 -22
  21. package/dist/containers/navbar/navbar.component.d.ts +3 -0
  22. package/dist/containers/navbar/navbar.component.js +33 -10
  23. package/dist/contexts/events.context.d.ts +8 -0
  24. package/dist/contexts/events.context.js +6 -0
  25. package/dist/core/images/srcset.d.ts +16 -0
  26. package/dist/core/images/srcset.js +21 -0
  27. package/dist/core/images/url.d.ts +1 -0
  28. package/dist/core/images/url.js +3 -1
  29. package/dist/core/utils/link-click.d.ts +8 -0
  30. package/dist/core/utils/link-click.js +20 -0
  31. package/dist/index.d.ts +1 -1
  32. package/dist/mixins/base.mixin.d.ts +3 -0
  33. package/dist/mixins/base.mixin.js +29 -1
  34. package/dist/sdk/mount.js +1 -0
  35. package/dist/sdk/types.d.ts +12 -0
  36. package/dist/sdk/url.d.ts +44 -2
  37. package/dist/sdk/url.js +54 -6
  38. package/dist/views/chrome-only-page/chrome-only-page.component.d.ts +2 -0
  39. package/dist/views/details-page/details-page.component.d.ts +4 -1
  40. package/dist/views/details-page/details-page.component.js +22 -41
  41. package/dist/views/details-page/partials/location-categories/location-categories.component.d.ts +2 -1
  42. package/dist/views/details-page/partials/location-categories/location-categories.component.js +18 -5
  43. package/dist/views/details-page/partials/location-highlights/location-highlights.component.d.ts +2 -1
  44. package/dist/views/details-page/partials/location-highlights/location-highlights.component.js +12 -5
  45. package/dist/views/help-page/help-page.component.d.ts +2 -0
  46. package/dist/views/landing-page/landing-page.component.d.ts +4 -1
  47. package/dist/views/landing-page/landing-page.component.js +21 -16
  48. package/dist/views/payment-page/partials/confirmation/confirmation.component.d.ts +2 -0
  49. package/dist/views/payment-page/partials/confirmation/confirmation.component.js +26 -6
  50. package/dist/views/payment-page/partials/confirmation/confirmation.styles.js +4 -0
  51. package/dist/views/payment-page/payment-page.component.d.ts +2 -0
  52. package/dist/views/search-page/search-page.component.d.ts +5 -2
  53. package/dist/views/search-page/search-page.component.js +41 -48
  54. package/dist/views/suggestion-widget/suggestion-widget.component.d.ts +6 -3
  55. package/dist/views/suggestion-widget/suggestion-widget.component.js +18 -8
  56. package/package.json +1 -1
@@ -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 { localized, msg, str } from "@lit/localize";
10
11
  import { Task } from "@lit/task";
11
12
  import { formatISO, parseISO } from "date-fns";
@@ -21,6 +22,7 @@ import { BaseMixin } from "../../mixins/base.mixin.js";
21
22
  import { apiGet } from "../../core/api/queries.js";
22
23
  import { convertToLocaleCurrency } from "../../core/currency/index.js";
23
24
  import { renderLoyaltyBadge } from "../../components/loyalty-badge/loyalty-badge.utils.js";
25
+ import { claimLinkClick } from "../../core/utils/link-click.js";
24
26
  let CorasSuggestionWidget = class CorasSuggestionWidget extends BaseMixin(LitElement) {
25
27
  constructor() {
26
28
  super(...arguments);
@@ -60,26 +62,27 @@ let CorasSuggestionWidget = class CorasSuggestionWidget extends BaseMixin(LitEle
60
62
  .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
61
63
  .join(" ");
62
64
  }
63
- handleCardClick(card) {
64
- this.dispatchPageUpdate({
65
+ cardTarget(card) {
66
+ return {
65
67
  page: "details",
66
68
  id: card.id,
67
69
  date: formatISO(parseISO(card.date), { representation: "date" }),
68
70
  locale: this.locale,
69
71
  currency: this.currency,
70
- });
72
+ };
71
73
  }
72
- handleExploreCardClick(country, city) {
73
- this.dispatchPageUpdate({
74
+ exploreTarget(country, city) {
75
+ return {
74
76
  page: "landing",
75
77
  country,
76
78
  city,
77
79
  locale: this.locale,
78
80
  currency: this.currency,
79
- });
81
+ };
80
82
  }
81
83
  renderCard(card) {
82
84
  const price = card.price[this.currency];
85
+ const target = this.cardTarget(card);
83
86
  return html `
84
87
  <coras-attraction-short-card
85
88
  .images=${card.images}
@@ -97,7 +100,8 @@ let CorasSuggestionWidget = class CorasSuggestionWidget extends BaseMixin(LitEle
97
100
  date=${card.date}
98
101
  timezone=${card.timezone}
99
102
  locale=${this.locale}
100
- @click=${() => this.handleCardClick(card)}
103
+ href=${ifDefined(this.pageUpdateHref(target))}
104
+ @click=${() => this.dispatchPageUpdate(target)}
101
105
  >
102
106
  ${renderLoyaltyBadge({
103
107
  loyalty: card.loyalty,
@@ -122,6 +126,8 @@ let CorasSuggestionWidget = class CorasSuggestionWidget extends BaseMixin(LitEle
122
126
  imageExtension: "png",
123
127
  params: { auto: "compress,format", ar: "2:3", fit: "crop" },
124
128
  });
129
+ const target = this.exploreTarget(country, city);
130
+ const href = this.pageUpdateHref(target);
125
131
  return html `
126
132
  <coras-explore-card
127
133
  image=${imageUrl}
@@ -131,7 +137,11 @@ let CorasSuggestionWidget = class CorasSuggestionWidget extends BaseMixin(LitEle
131
137
  <coras-button
132
138
  slot="button"
133
139
  variant="outlined"
134
- @click=${() => this.handleExploreCardClick(country, city)}
140
+ href=${ifDefined(href)}
141
+ @click=${(event) => {
142
+ if (!href || claimLinkClick(event))
143
+ this.dispatchPageUpdate(target);
144
+ }}
135
145
  >
136
146
  ${msg("See all activities")}
137
147
  </coras-button>
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "engines": {
21
21
  "node": ">=22"
22
22
  },
23
- "version": "0.11.0",
23
+ "version": "0.13.0",
24
24
  "private": false,
25
25
  "homepage": "https://docs.coras.io",
26
26
  "bugs": {