@coras-io/embed 0.8.2 → 0.9.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 +27 -0
- package/dist/components/attraction-card/long/attraction-long-card.styles.js +14 -4
- package/dist/components/attraction-card/short/attraction-short-card.styles.js +3 -1
- package/dist/components/basket/basket.styles.js +2 -2
- package/dist/components/locations-results/locations-results.component.d.ts +1 -0
- package/dist/components/locations-results/locations-results.component.js +5 -2
- package/dist/components/loyalty-badge/loyalty-badge.component.d.ts +34 -0
- package/dist/components/loyalty-badge/loyalty-badge.component.js +141 -0
- package/dist/components/loyalty-badge/loyalty-badge.d.ts +8 -0
- package/dist/components/loyalty-badge/loyalty-badge.js +6 -0
- package/dist/components/loyalty-badge/loyalty-badge.styles.js +61 -0
- package/dist/components/loyalty-badge/loyalty-badge.types.d.ts +6 -0
- package/dist/components/loyalty-badge/loyalty-badge.utils.d.ts +23 -0
- package/dist/components/loyalty-badge/loyalty-badge.utils.js +30 -0
- package/dist/components/seated-selector/seated-selector.component.js +2 -3
- package/dist/components/seats-io/seats-io.component.js +0 -5
- package/dist/containers/basket/basket.component.d.ts +2 -1
- package/dist/containers/basket/basket.component.js +17 -44
- package/dist/containers/navbar/navbar.component.js +3 -5
- package/dist/containers/navbar/navbar.styles.js +4 -2
- package/dist/contexts/properties.context.d.ts +8 -0
- package/dist/contexts/properties.context.js +5 -0
- package/dist/core/types/api-schema.d.ts +181 -5
- package/dist/core/types/core/index.d.ts +0 -1
- package/dist/core/types/index.d.ts +0 -1
- package/dist/core/utils/loyalty.d.ts +37 -4
- package/dist/core/utils/loyalty.js +14 -5
- package/dist/core/utils/seats.d.ts +6 -0
- package/dist/core/utils/seats.js +40 -0
- package/dist/index.d.ts +1 -1
- package/dist/locales/ar-SA.d.ts +5 -0
- package/dist/locales/ar-SA.js +6 -1
- package/dist/locales/da-DK.d.ts +5 -0
- package/dist/locales/da-DK.js +5 -0
- package/dist/locales/de-DE.d.ts +5 -0
- package/dist/locales/de-DE.js +5 -0
- package/dist/locales/en-IE.d.ts +5 -0
- package/dist/locales/en-IE.js +5 -0
- package/dist/locales/en-US.d.ts +5 -0
- package/dist/locales/en-US.js +5 -0
- package/dist/locales/es-ES.d.ts +5 -0
- package/dist/locales/es-ES.js +5 -0
- package/dist/locales/fr-FR.d.ts +5 -0
- package/dist/locales/fr-FR.js +5 -0
- package/dist/locales/fr-MA.d.ts +5 -0
- package/dist/locales/fr-MA.js +5 -0
- package/dist/locales/is-IS.d.ts +5 -0
- package/dist/locales/is-IS.js +5 -0
- package/dist/locales/it-IT.d.ts +5 -0
- package/dist/locales/it-IT.js +5 -0
- package/dist/locales/ms-MY.d.ts +5 -0
- package/dist/locales/ms-MY.js +5 -0
- package/dist/locales/nb-NO.d.ts +5 -0
- package/dist/locales/nb-NO.js +5 -0
- package/dist/locales/pl-PL.d.ts +5 -0
- package/dist/locales/pl-PL.js +5 -0
- package/dist/locales/pt-PT.d.ts +5 -0
- package/dist/locales/pt-PT.js +5 -0
- package/dist/locales/sv-SE.d.ts +5 -0
- package/dist/locales/sv-SE.js +5 -0
- package/dist/locales/th-TH.d.ts +5 -0
- package/dist/locales/th-TH.js +5 -0
- package/dist/locales/tr-TR.d.ts +5 -0
- package/dist/locales/tr-TR.js +5 -0
- package/dist/locales/zh-CN.d.ts +5 -0
- package/dist/locales/zh-CN.js +5 -0
- package/dist/locales/zh-HK.d.ts +5 -0
- package/dist/locales/zh-HK.js +5 -0
- package/dist/mixins/base.mixin.d.ts +2 -0
- package/dist/mixins/base.mixin.js +8 -1
- package/dist/mixins/location-search/location-search.js +70 -29
- package/dist/mixins/location-search/location-search.styles.js +11 -7
- package/dist/mixins/search-mixin/search-mixin.js +2 -2
- package/dist/sdk/page-registry.js +2 -0
- package/dist/sdk/theme.d.ts +1 -1
- package/dist/sdk/types.d.ts +9 -1
- package/dist/sdk/validation.js +51 -0
- package/dist/styles/tokens.d.ts +1 -1
- package/dist/styles/tokens.generated.d.ts +1 -1
- package/dist/styles/tokens.generated.js +1 -1
- package/dist/styles/tokens.metadata.js +18 -0
- package/dist/views/chrome-only-page/chrome-only-page.component.d.ts +1 -0
- package/dist/views/details-page/details-page.component.d.ts +2 -1
- package/dist/views/details-page/details-page.component.js +15 -5
- package/dist/views/details-page/partials/location-highlights/location-highlights.component.d.ts +2 -0
- package/dist/views/details-page/partials/location-highlights/location-highlights.component.js +16 -2
- package/dist/views/help-page/help-page.component.d.ts +1 -0
- package/dist/views/landing-page/landing-page.component.d.ts +5 -3
- package/dist/views/landing-page/landing-page.component.js +66 -28
- package/dist/views/payment-page/controllers/form-validation.controller.d.ts +4 -1
- package/dist/views/payment-page/controllers/form-validation.controller.js +7 -2
- package/dist/views/payment-page/partials/confirmation/confirmation.component.js +49 -27
- package/dist/views/payment-page/partials/stripe/stripe.types.d.ts +1 -0
- package/dist/views/payment-page/partials/stripe/stripe.utils.js +5 -0
- package/dist/views/payment-page/payment-page.component.d.ts +6 -0
- package/dist/views/payment-page/payment-page.component.js +76 -8
- package/dist/views/payment-page/payment-page.loyalty.d.ts +13 -0
- package/dist/views/payment-page/payment-page.loyalty.js +80 -0
- package/dist/views/payment-page/payment-page.styles.js +16 -0
- package/dist/views/payment-page/payment-page.utils.d.ts +1 -1
- package/dist/views/payment-page/payment-page.utils.js +19 -1
- package/dist/views/payment-page/services/payment-api.service.d.ts +1 -0
- package/dist/views/search-page/search-page.component.d.ts +1 -0
- package/dist/views/search-page/search-page.component.js +10 -0
- package/dist/views/suggestion-widget/suggestion-widget.component.d.ts +1 -0
- package/dist/views/suggestion-widget/suggestion-widget.component.js +11 -1
- package/package.json +5 -5
- package/dist/components/points/points.component.d.ts +0 -9
- package/dist/components/points/points.component.js +0 -36
- package/dist/components/points/points.d.ts +0 -8
- package/dist/components/points/points.js +0 -6
- package/dist/components/points/points.styles.js +0 -47
- package/dist/core/types/core/points.d.ts +0 -4
- package/dist/mixins/points/points.d.ts +0 -3
- package/dist/mixins/points/points.js +0 -30
- package/dist/mixins/points/types.d.ts +0 -8
- package/dist/mixins/points/types.js +0 -1
- /package/dist/components/{points/points.styles.d.ts → loyalty-badge/loyalty-badge.styles.d.ts} +0 -0
- /package/dist/{core/types/core/points.js → components/loyalty-badge/loyalty-badge.types.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @coras-io/embed
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f2961a9: Show distributor loyalty programmes (airline miles, partner points): a generic `coras-loyalty-badge` on attraction cards, the details page, basket items and the confirmation, plus the programme's membership fields on the payment form, sent in the reservation `metadata`. The API computes the amounts (`loyalty.earn[code]`) and lists the checkout fields in `GET /reservations/check`; the host names and dresses the programme through the new `config.loyalty` option (`CorasLoyaltyProgramme`: code, name, unit words, artwork URLs, terms link, field labels), and colours come from the new `loyalty.background` and `loyalty.text` brand tokens. Removes the unused client-side points calculation (`PointsMixin`, `coras-points`, `window.corasPointsCalculation`). Also fixes the navbar search icon, which took the navbar icon colour and vanished on the white field of dark-navbar brands; it now follows the field text colour like the placeholder.
|
|
8
|
+
- 7a5ebcd: Label country results in the location search as "All <country> locations" and let Enter open a country that is listed with its top cities
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- 36cb06b: Show the booked section and seats on the on-screen order confirmation
|
|
13
|
+
- 724900f: Require DOMPurify 3.4.17 or later to pick up its latest security fixes
|
|
14
|
+
- Updated dependencies [f2961a9]
|
|
15
|
+
- @coras-io/brand-tokens@0.7.0
|
|
16
|
+
|
|
17
|
+
## 0.8.3
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- e280124: Use the preferred Arabic wording for the search events placeholder
|
|
22
|
+
- fc4408c: Give the basket dropdown a stronger drop shadow so it stands out from the page
|
|
23
|
+
- 9c4eb79: Show only the categories available in the selected city or country in the landing page filters
|
|
24
|
+
- 9499d58: Show the search icon on the location field at the standard icon size
|
|
25
|
+
- b6cfe00: Show each search result card's category tag from the attraction's main category, instead of labelling every result as Activity
|
|
26
|
+
- 90a5e06: Search locations and events from the first letter, show recently viewed locations in the location search, and use a search icon on the location field
|
|
27
|
+
- b09b5a4: Stop the seat map holding seats in seats.io on selection, so seats reserved through the embed are held and marked as sold in seats.io correctly
|
|
28
|
+
- 40a61c0: Keep the card number, expiry and CVC fields on the field colours when the browser autofills them, instead of showing its yellow autofill background
|
|
29
|
+
|
|
3
30
|
## 0.8.2
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
|
@@ -13,8 +13,10 @@ export default css `
|
|
|
13
13
|
container-type: inline-size;
|
|
14
14
|
display: grid;
|
|
15
15
|
grid-template-columns: 200px minmax(0, 1fr) max-content;
|
|
16
|
-
grid-template-rows: 1fr;
|
|
17
|
-
grid-template-areas:
|
|
16
|
+
grid-template-rows: 1fr auto;
|
|
17
|
+
grid-template-areas:
|
|
18
|
+
"image content details"
|
|
19
|
+
"image content points";
|
|
18
20
|
overflow: hidden;
|
|
19
21
|
|
|
20
22
|
.image {
|
|
@@ -100,13 +102,21 @@ export default css `
|
|
|
100
102
|
|
|
101
103
|
::slotted(*) {
|
|
102
104
|
grid-area: points;
|
|
105
|
+
justify-self: end;
|
|
106
|
+
margin: 0 1rem 1rem 0;
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
@container (max-width: 700px) {
|
|
106
110
|
& {
|
|
107
111
|
grid-template-columns: 200px 1fr;
|
|
108
|
-
grid-template-rows: 1fr;
|
|
109
|
-
grid-template-areas:
|
|
112
|
+
grid-template-rows: 1fr auto;
|
|
113
|
+
grid-template-areas:
|
|
114
|
+
"image content"
|
|
115
|
+
"image points";
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
::slotted(*) {
|
|
119
|
+
margin: 0 0.75rem 0.75rem 0;
|
|
110
120
|
}
|
|
111
121
|
|
|
112
122
|
.details {
|
|
@@ -14,10 +14,11 @@ export default css `
|
|
|
14
14
|
height: 100%;
|
|
15
15
|
display: grid;
|
|
16
16
|
grid-template-columns: 1fr;
|
|
17
|
-
grid-template-rows: auto auto 1fr;
|
|
17
|
+
grid-template-rows: auto auto auto 1fr;
|
|
18
18
|
grid-template-areas:
|
|
19
19
|
"image"
|
|
20
20
|
"content"
|
|
21
|
+
"points"
|
|
21
22
|
"details";
|
|
22
23
|
|
|
23
24
|
.image {
|
|
@@ -52,6 +53,7 @@ export default css `
|
|
|
52
53
|
|
|
53
54
|
::slotted(*) {
|
|
54
55
|
grid-area: points;
|
|
56
|
+
padding: 0 0.5rem;
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
|
|
@@ -12,7 +12,7 @@ export default css `
|
|
|
12
12
|
);
|
|
13
13
|
--basket-items-background-color: var(--coras-color-menu);
|
|
14
14
|
--basket-items-border-color: var(--coras-color-menu-border);
|
|
15
|
-
--basket-items-shadow: var(--coras-shadow-
|
|
15
|
+
--basket-items-shadow: var(--coras-shadow-strong);
|
|
16
16
|
--basket-items-border-radius: var(--coras-radius-sm);
|
|
17
17
|
|
|
18
18
|
--basket-accent-color: var(
|
|
@@ -60,7 +60,7 @@ export default css `
|
|
|
60
60
|
width: 25.875rem;
|
|
61
61
|
background-color: var(--basket-items-background-color);
|
|
62
62
|
border-radius: var(--basket-items-border-radius);
|
|
63
|
-
box-shadow:
|
|
63
|
+
box-shadow: var(--basket-items-shadow);
|
|
64
64
|
border: 1px solid var(--basket-items-border-color);
|
|
65
65
|
box-sizing: border-box;
|
|
66
66
|
display: flex;
|
|
@@ -29,3 +29,4 @@ export interface LocationResultOptionProps {
|
|
|
29
29
|
assetsURL: string;
|
|
30
30
|
}
|
|
31
31
|
export declare function renderLocationResultOption({ item, selected, onSelect, localizedName, assetsURL, }: LocationResultOptionProps): TemplateResult;
|
|
32
|
+
export declare function locationOptionLabel(name: string, locationType: string): string;
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { LitElement, html, } from "lit";
|
|
8
8
|
import { property } from "lit/decorators.js";
|
|
9
|
-
import { localized, msg } from "@lit/localize";
|
|
9
|
+
import { localized, msg, str } from "@lit/localize";
|
|
10
10
|
import { fireInternalEvent } from "../../core/events.js";
|
|
11
11
|
import styles from "./locations-results.styles.js";
|
|
12
12
|
import "../icon/icon.js";
|
|
@@ -80,10 +80,13 @@ export function renderLocationResultOption({ item, selected, onSelect, localized
|
|
|
80
80
|
@click=${() => onSelect && onSelect(item)}
|
|
81
81
|
>
|
|
82
82
|
${renderIcon(item, assetsURL)}
|
|
83
|
-
<span>${localizedName}</span>
|
|
83
|
+
<span>${locationOptionLabel(localizedName, item.location_type)}</span>
|
|
84
84
|
</coras-select-option>
|
|
85
85
|
`;
|
|
86
86
|
}
|
|
87
|
+
export function locationOptionLabel(name, locationType) {
|
|
88
|
+
return locationType === "country" ? msg(str `All ${name} locations`) : name;
|
|
89
|
+
}
|
|
87
90
|
function renderIcon(item, assetsURL) {
|
|
88
91
|
const icon = item.location_type === "country" ? "flag" : "pin-drop";
|
|
89
92
|
return html `<coras-icon assets-url="${assetsURL}" icon=${icon}></coras-icon>`;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type CSSResultGroup, LitElement } from "lit";
|
|
2
|
+
import type { SupportedLocales } from "../../core/types/index.js";
|
|
3
|
+
import type { LoyaltyBadgeVariant } from "./loyalty-badge.types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Shows the miles or points a loyalty programme member earns. Generic by
|
|
6
|
+
* design: the amount comes from the API, the name, unit words and artwork
|
|
7
|
+
* from the host's `config.loyalty`, and the colours from the
|
|
8
|
+
* `loyalty.background` / `loyalty.text` brand tokens. On a dark surface the
|
|
9
|
+
* dark logo is tried first and the light one is kept when there is none.
|
|
10
|
+
*/
|
|
11
|
+
export declare class CorasLoyaltyBadge extends LitElement {
|
|
12
|
+
static styles: CSSResultGroup;
|
|
13
|
+
/** Programme display name, used as the logo's alternative text. */
|
|
14
|
+
name: string;
|
|
15
|
+
logo: string;
|
|
16
|
+
logoDark: string;
|
|
17
|
+
icon: string;
|
|
18
|
+
amount: number;
|
|
19
|
+
unitSingular: string;
|
|
20
|
+
unitPlural: string;
|
|
21
|
+
/** Prefix the amount with "From", for listings priced from a minimum. */
|
|
22
|
+
from: boolean;
|
|
23
|
+
variant: LoyaltyBadgeVariant;
|
|
24
|
+
locale: SupportedLocales;
|
|
25
|
+
private logoFailed;
|
|
26
|
+
private darkLogoFailed;
|
|
27
|
+
private iconFailed;
|
|
28
|
+
private readonly colorScheme;
|
|
29
|
+
private get usesDarkLogo();
|
|
30
|
+
private onLogoError;
|
|
31
|
+
private renderLogo;
|
|
32
|
+
private renderIcon;
|
|
33
|
+
render(): import("lit").TemplateResult<1>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { localized, msg } from "@lit/localize";
|
|
8
|
+
import { html, LitElement, nothing } from "lit";
|
|
9
|
+
import { property, state } from "lit/decorators.js";
|
|
10
|
+
import { ColorSchemeController } from "../../core/color-scheme.js";
|
|
11
|
+
import { DEFAULT_LOCALE } from "../../views/constants.js";
|
|
12
|
+
import styles from "./loyalty-badge.styles.js";
|
|
13
|
+
/**
|
|
14
|
+
* Shows the miles or points a loyalty programme member earns. Generic by
|
|
15
|
+
* design: the amount comes from the API, the name, unit words and artwork
|
|
16
|
+
* from the host's `config.loyalty`, and the colours from the
|
|
17
|
+
* `loyalty.background` / `loyalty.text` brand tokens. On a dark surface the
|
|
18
|
+
* dark logo is tried first and the light one is kept when there is none.
|
|
19
|
+
*/
|
|
20
|
+
let CorasLoyaltyBadge = class CorasLoyaltyBadge extends LitElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
/** Programme display name, used as the logo's alternative text. */
|
|
24
|
+
this.name = "";
|
|
25
|
+
this.logo = "";
|
|
26
|
+
this.logoDark = "";
|
|
27
|
+
this.icon = "";
|
|
28
|
+
this.amount = 0;
|
|
29
|
+
this.unitSingular = "";
|
|
30
|
+
this.unitPlural = "";
|
|
31
|
+
/** Prefix the amount with "From", for listings priced from a minimum. */
|
|
32
|
+
this.from = false;
|
|
33
|
+
this.variant = "card";
|
|
34
|
+
this.locale = DEFAULT_LOCALE;
|
|
35
|
+
this.logoFailed = false;
|
|
36
|
+
this.darkLogoFailed = false;
|
|
37
|
+
this.iconFailed = false;
|
|
38
|
+
this.colorScheme = new ColorSchemeController(this);
|
|
39
|
+
}
|
|
40
|
+
static { this.styles = styles; }
|
|
41
|
+
get usesDarkLogo() {
|
|
42
|
+
return (this.colorScheme.scheme === "dark" &&
|
|
43
|
+
this.logoDark !== "" &&
|
|
44
|
+
!this.darkLogoFailed);
|
|
45
|
+
}
|
|
46
|
+
onLogoError() {
|
|
47
|
+
if (this.usesDarkLogo) {
|
|
48
|
+
this.darkLogoFailed = true;
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.logoFailed = true;
|
|
52
|
+
}
|
|
53
|
+
renderLogo() {
|
|
54
|
+
const src = this.usesDarkLogo ? this.logoDark : this.logo;
|
|
55
|
+
if (!src || this.logoFailed)
|
|
56
|
+
return nothing;
|
|
57
|
+
return html `
|
|
58
|
+
<img
|
|
59
|
+
class="logo"
|
|
60
|
+
part="logo"
|
|
61
|
+
data-testid="logo"
|
|
62
|
+
src=${src}
|
|
63
|
+
alt=${this.name}
|
|
64
|
+
@error=${() => this.onLogoError()}
|
|
65
|
+
/>
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
renderIcon() {
|
|
69
|
+
if (!this.icon || this.iconFailed)
|
|
70
|
+
return nothing;
|
|
71
|
+
return html `
|
|
72
|
+
<img
|
|
73
|
+
class="icon"
|
|
74
|
+
part="icon"
|
|
75
|
+
data-testid="icon"
|
|
76
|
+
src=${this.icon}
|
|
77
|
+
alt=""
|
|
78
|
+
@error=${() => (this.iconFailed = true)}
|
|
79
|
+
/>
|
|
80
|
+
`;
|
|
81
|
+
}
|
|
82
|
+
render() {
|
|
83
|
+
const formattedAmount = new Intl.NumberFormat(this.locale).format(this.amount);
|
|
84
|
+
const unit = this.amount === 1 ? this.unitSingular : this.unitPlural;
|
|
85
|
+
return html `
|
|
86
|
+
<div class="badge" part="base">
|
|
87
|
+
${this.renderLogo()}
|
|
88
|
+
<span class="amount" part="amount" data-testid="amount">
|
|
89
|
+
${this.renderIcon()}
|
|
90
|
+
<span
|
|
91
|
+
>${this.from ? `${msg("From")} ` : ""}${formattedAmount}
|
|
92
|
+
${unit}</span
|
|
93
|
+
>
|
|
94
|
+
</span>
|
|
95
|
+
</div>
|
|
96
|
+
`;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
__decorate([
|
|
100
|
+
property({ type: String })
|
|
101
|
+
], CorasLoyaltyBadge.prototype, "name", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
property({ type: String })
|
|
104
|
+
], CorasLoyaltyBadge.prototype, "logo", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
property({ type: String, attribute: "logo-dark" })
|
|
107
|
+
], CorasLoyaltyBadge.prototype, "logoDark", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
property({ type: String })
|
|
110
|
+
], CorasLoyaltyBadge.prototype, "icon", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
property({ type: Number })
|
|
113
|
+
], CorasLoyaltyBadge.prototype, "amount", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
property({ type: String, attribute: "unit-singular" })
|
|
116
|
+
], CorasLoyaltyBadge.prototype, "unitSingular", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
property({ type: String, attribute: "unit-plural" })
|
|
119
|
+
], CorasLoyaltyBadge.prototype, "unitPlural", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
property({ type: Boolean })
|
|
122
|
+
], CorasLoyaltyBadge.prototype, "from", void 0);
|
|
123
|
+
__decorate([
|
|
124
|
+
property({ type: String, reflect: true })
|
|
125
|
+
], CorasLoyaltyBadge.prototype, "variant", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
property({ type: String })
|
|
128
|
+
], CorasLoyaltyBadge.prototype, "locale", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
state()
|
|
131
|
+
], CorasLoyaltyBadge.prototype, "logoFailed", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
state()
|
|
134
|
+
], CorasLoyaltyBadge.prototype, "darkLogoFailed", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
state()
|
|
137
|
+
], CorasLoyaltyBadge.prototype, "iconFailed", void 0);
|
|
138
|
+
CorasLoyaltyBadge = __decorate([
|
|
139
|
+
localized()
|
|
140
|
+
], CorasLoyaltyBadge);
|
|
141
|
+
export { CorasLoyaltyBadge };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CorasLoyaltyBadge } from "./loyalty-badge.component.js";
|
|
2
|
+
export * from "./loyalty-badge.component.js";
|
|
3
|
+
export default CorasLoyaltyBadge;
|
|
4
|
+
if (!customElements.get("coras-loyalty-badge")) {
|
|
5
|
+
customElements.define("coras-loyalty-badge", CorasLoyaltyBadge);
|
|
6
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
import component from "../../styles/defaults/component.js";
|
|
3
|
+
export default css `
|
|
4
|
+
${component}
|
|
5
|
+
|
|
6
|
+
:host {
|
|
7
|
+
--loyalty-badge-background: var(--coras-brand-loyalty-background);
|
|
8
|
+
--loyalty-badge-color: var(--coras-brand-loyalty-text);
|
|
9
|
+
--loyalty-badge-font-size: var(--coras-font-size-base);
|
|
10
|
+
--loyalty-badge-font-weight: var(--coras-font-weight-semibold);
|
|
11
|
+
--loyalty-badge-logo-height: 1.5rem;
|
|
12
|
+
--loyalty-badge-padding: 0.5rem 0.75rem;
|
|
13
|
+
--loyalty-badge-radius: 0;
|
|
14
|
+
|
|
15
|
+
display: block;
|
|
16
|
+
width: 100%;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.badge {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: 0.5rem;
|
|
24
|
+
padding: var(--loyalty-badge-padding);
|
|
25
|
+
background: var(--loyalty-badge-background);
|
|
26
|
+
color: var(--loyalty-badge-color);
|
|
27
|
+
border-radius: var(--loyalty-badge-radius);
|
|
28
|
+
font-size: var(--loyalty-badge-font-size);
|
|
29
|
+
font-weight: var(--loyalty-badge-font-weight);
|
|
30
|
+
line-height: 1.2;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.logo {
|
|
34
|
+
display: block;
|
|
35
|
+
height: var(--loyalty-badge-logo-height);
|
|
36
|
+
width: auto;
|
|
37
|
+
max-width: 100%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.amount {
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
gap: 0.4rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.icon {
|
|
47
|
+
height: 1em;
|
|
48
|
+
width: 1em;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host([variant="banner"]) {
|
|
52
|
+
--loyalty-badge-font-size: var(--coras-font-size-lg);
|
|
53
|
+
--loyalty-badge-logo-height: 2rem;
|
|
54
|
+
--loyalty-badge-padding: 0.75rem 1rem;
|
|
55
|
+
--loyalty-badge-radius: var(--coras-radius-sm);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:host([variant="basket"]) {
|
|
59
|
+
--loyalty-badge-radius: var(--coras-radius-sm);
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { nothing } from "lit";
|
|
2
|
+
import type { SupportedLocales } from "../../core/types/index.js";
|
|
3
|
+
import { type Loyalty, type LoyaltyProgramme } from "../../core/utils/loyalty.js";
|
|
4
|
+
import type { LoyaltyBadgeVariant } from "./loyalty-badge.types.js";
|
|
5
|
+
import "./loyalty-badge.js";
|
|
6
|
+
type RenderLoyaltyBadgeOptions = {
|
|
7
|
+
loyalty: Loyalty | null | undefined;
|
|
8
|
+
programme: LoyaltyProgramme | null | undefined;
|
|
9
|
+
locale: SupportedLocales;
|
|
10
|
+
variant: LoyaltyBadgeVariant;
|
|
11
|
+
slot?: string;
|
|
12
|
+
/** Prefix the amount with "From", for listings priced from a minimum. */
|
|
13
|
+
from?: boolean;
|
|
14
|
+
/** Overrides the amount read from `loyalty`, e.g. a basket total. */
|
|
15
|
+
amount?: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Renders the programme badge for an item, or nothing when the distributor has
|
|
19
|
+
* no programme or the item earns nothing. Containers call this so the decision
|
|
20
|
+
* lives in one place.
|
|
21
|
+
*/
|
|
22
|
+
export declare function renderLoyaltyBadge({ loyalty, programme, locale, variant, slot, from, amount, }: RenderLoyaltyBadgeOptions): typeof nothing | import("lit").TemplateResult<1>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { html, nothing } from "lit";
|
|
2
|
+
import { getProgrammeUnitsEarned, } from "../../core/utils/loyalty.js";
|
|
3
|
+
import "./loyalty-badge.js";
|
|
4
|
+
/**
|
|
5
|
+
* Renders the programme badge for an item, or nothing when the distributor has
|
|
6
|
+
* no programme or the item earns nothing. Containers call this so the decision
|
|
7
|
+
* lives in one place.
|
|
8
|
+
*/
|
|
9
|
+
export function renderLoyaltyBadge({ loyalty, programme, locale, variant, slot, from = false, amount, }) {
|
|
10
|
+
if (!programme)
|
|
11
|
+
return nothing;
|
|
12
|
+
const earned = amount ?? getProgrammeUnitsEarned(loyalty, programme);
|
|
13
|
+
if (earned <= 0)
|
|
14
|
+
return nothing;
|
|
15
|
+
return html `
|
|
16
|
+
<coras-loyalty-badge
|
|
17
|
+
slot=${slot ?? nothing}
|
|
18
|
+
variant=${variant}
|
|
19
|
+
name=${programme.name}
|
|
20
|
+
amount=${earned}
|
|
21
|
+
unit-singular=${programme.unit.singular}
|
|
22
|
+
unit-plural=${programme.unit.plural}
|
|
23
|
+
logo=${programme.logo ?? nothing}
|
|
24
|
+
logo-dark=${programme.logoDark ?? nothing}
|
|
25
|
+
icon=${programme.icon ?? nothing}
|
|
26
|
+
?from=${from}
|
|
27
|
+
locale=${locale}
|
|
28
|
+
></coras-loyalty-badge>
|
|
29
|
+
`;
|
|
30
|
+
}
|
|
@@ -108,9 +108,8 @@ let CorasSeatedSelector = class CorasSeatedSelector extends LitElement {
|
|
|
108
108
|
};
|
|
109
109
|
this.handleObjectSelected = (event) => {
|
|
110
110
|
const { label } = event.detail;
|
|
111
|
-
// Ignore any seat the current availability data doesn't know about
|
|
112
|
-
//
|
|
113
|
-
// it enters the selection priced at 0 and the reservation fails.
|
|
111
|
+
// Ignore any seat the current availability data doesn't know about,
|
|
112
|
+
// otherwise it enters the selection priced at 0 and the reservation fails.
|
|
114
113
|
if (this.chartData && !(label in this.chartData.availableSeats)) {
|
|
115
114
|
return;
|
|
116
115
|
}
|
|
@@ -114,11 +114,6 @@ export class CorasSeatsIO extends LitElement {
|
|
|
114
114
|
? { maxSelectedObjects: this.maxSelectedObjects }
|
|
115
115
|
: {}),
|
|
116
116
|
selectionValidators: [{ type: "noOrphanSeats" }],
|
|
117
|
-
// Start a fresh hold session on every mount. "continue" restores the
|
|
118
|
-
// previous browser session, so reopening the map after a reservation
|
|
119
|
-
// re-selected seats that are no longer available - selecting them at
|
|
120
|
-
// price 0 and breaking "Add to basket".
|
|
121
|
-
session: "start",
|
|
122
117
|
};
|
|
123
118
|
return config;
|
|
124
119
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type LoyaltyProgramme } from "../../core/utils/loyalty.js";
|
|
1
2
|
import { LitElement } from "lit";
|
|
2
3
|
import "../../components/basket/basket.js";
|
|
3
4
|
import "../../components/basket-empty/basket-empty.js";
|
|
@@ -12,6 +13,7 @@ export declare class CorasBasket extends LitElement {
|
|
|
12
13
|
locale: SupportedLocales;
|
|
13
14
|
currency: SupportedCurrencies;
|
|
14
15
|
assetsURL: string;
|
|
16
|
+
loyaltyProgramme: LoyaltyProgramme | null;
|
|
15
17
|
private basket;
|
|
16
18
|
connectedCallback(): void;
|
|
17
19
|
private getFormattedPrice;
|
|
@@ -19,7 +21,6 @@ export declare class CorasBasket extends LitElement {
|
|
|
19
21
|
private handleRemoveItem;
|
|
20
22
|
private renderCheckoutButton;
|
|
21
23
|
private renderTickets;
|
|
22
|
-
private getSeatDetails;
|
|
23
24
|
private renderBasketItems;
|
|
24
25
|
render(): import("lit").TemplateResult<1>;
|
|
25
26
|
}
|
|
@@ -4,7 +4,8 @@ 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 { getLoyaltyAmount } from "../../core/utils/loyalty.js";
|
|
7
|
+
import { getLoyaltyAmount, } from "../../core/utils/loyalty.js";
|
|
8
|
+
import { renderLoyaltyBadge } from "../../components/loyalty-badge/loyalty-badge.utils.js";
|
|
8
9
|
import { LitElement, html } from "lit";
|
|
9
10
|
import { repeat } from "lit/directives/repeat.js";
|
|
10
11
|
import { consume, ContextConsumer } from "@lit/context";
|
|
@@ -18,17 +19,19 @@ import "../../components/button/button.js";
|
|
|
18
19
|
import "../../contexts/basket/basket.js";
|
|
19
20
|
import { basketContext } from "../../contexts/basket/basket.context.js";
|
|
20
21
|
import { property } from "lit/decorators.js";
|
|
21
|
-
import { currencyContext, localeContext, assetsURLContext, } from "../../contexts/properties.context.js";
|
|
22
|
-
import { localized, msg
|
|
22
|
+
import { currencyContext, localeContext, assetsURLContext, loyaltyProgrammeContext, } from "../../contexts/properties.context.js";
|
|
23
|
+
import { localized, msg } from "@lit/localize";
|
|
23
24
|
import { convertToLocaleCurrency } from "../../core/currency/index.js";
|
|
24
25
|
import { adaptPresetImages } from "../../core/images/preset-adapter.js";
|
|
25
26
|
import { selectCorasImage } from "../../core/images/selection.js";
|
|
26
27
|
import { formatDateTimeForDisplay, formatTimeForDisplay, } from "../../core/utils/datetime.js";
|
|
28
|
+
import { getSeatDetails } from "../../core/utils/seats.js";
|
|
27
29
|
let CorasBasket = class CorasBasket extends LitElement {
|
|
28
30
|
constructor() {
|
|
29
31
|
super(...arguments);
|
|
30
32
|
this.expanded = false;
|
|
31
33
|
this.checkout = false;
|
|
34
|
+
this.loyaltyProgramme = null;
|
|
32
35
|
}
|
|
33
36
|
connectedCallback() {
|
|
34
37
|
super.connectedCallback();
|
|
@@ -132,46 +135,6 @@ let CorasBasket = class CorasBasket extends LitElement {
|
|
|
132
135
|
})}
|
|
133
136
|
`;
|
|
134
137
|
}
|
|
135
|
-
// Collapses a reservation's per-ticket seat data into a section line and a
|
|
136
|
-
// seat line ("Row 9, Seats 11, 12", or bare labels like "F5, F6" when the API
|
|
137
|
-
// gives seat names without a separate row/number). General-admission tickets
|
|
138
|
-
// carry no seat fields, so both come back empty and the seat row is dropped.
|
|
139
|
-
getSeatDetails(reservation) {
|
|
140
|
-
const tickets = reservation.tickets;
|
|
141
|
-
if (!tickets || tickets.length === 0) {
|
|
142
|
-
return { section: "", seats: "" };
|
|
143
|
-
}
|
|
144
|
-
const sections = new Set();
|
|
145
|
-
const seatsByRow = new Map();
|
|
146
|
-
const looseSeats = [];
|
|
147
|
-
for (const ticket of tickets) {
|
|
148
|
-
const section = "section" in ticket ? ticket.section : undefined;
|
|
149
|
-
const rowName = "row_name" in ticket ? ticket.row_name : undefined;
|
|
150
|
-
const seatNumber = "seat_number" in ticket ? ticket.seat_number : undefined;
|
|
151
|
-
const seatName = "seat_name" in ticket ? ticket.seat_name : undefined;
|
|
152
|
-
if (section) {
|
|
153
|
-
sections.add(section);
|
|
154
|
-
}
|
|
155
|
-
const row = rowName?.toString().trim();
|
|
156
|
-
const number = seatNumber?.toString().trim();
|
|
157
|
-
if (row && number) {
|
|
158
|
-
const seats = seatsByRow.get(row) ?? [];
|
|
159
|
-
seats.push(number);
|
|
160
|
-
seatsByRow.set(row, seats);
|
|
161
|
-
}
|
|
162
|
-
else if (seatName) {
|
|
163
|
-
looseSeats.push(seatName);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
const rowSeats = [...seatsByRow.entries()].map(([row, seats]) => {
|
|
167
|
-
const seatList = seats.join(", ");
|
|
168
|
-
return msg(str `Row ${row}, Seats ${seatList}`);
|
|
169
|
-
});
|
|
170
|
-
return {
|
|
171
|
-
section: [...sections].join(", "),
|
|
172
|
-
seats: [...rowSeats, ...looseSeats].join(" · "),
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
138
|
renderBasketItems() {
|
|
176
139
|
if (!this.basket?.value?.items || this.basket.value.items.length === 0) {
|
|
177
140
|
return html `<coras-basket-empty></coras-basket-empty>`;
|
|
@@ -199,7 +162,7 @@ let CorasBasket = class CorasBasket extends LitElement {
|
|
|
199
162
|
const imageUrl = selectCorasImage(adaptPresetImages(reservation.images), {
|
|
200
163
|
slot: "thumbnail",
|
|
201
164
|
})?.primary.url ?? "";
|
|
202
|
-
const { section, seats } =
|
|
165
|
+
const { section, seats } = getSeatDetails(reservation.tickets);
|
|
203
166
|
const tickets = reservation.tickets ?? [];
|
|
204
167
|
const distinctPriceTypes = new Set(tickets.map((ticket) => ticket.price_type_id).filter(Boolean));
|
|
205
168
|
// Show the per-ticket "ea" price on the item header only when every
|
|
@@ -226,6 +189,13 @@ let CorasBasket = class CorasBasket extends LitElement {
|
|
|
226
189
|
expires-in="${reservation.expires_in}"
|
|
227
190
|
>
|
|
228
191
|
${ticketsHtml}
|
|
192
|
+
${renderLoyaltyBadge({
|
|
193
|
+
loyalty: reservation.loyalty,
|
|
194
|
+
programme: this.loyaltyProgramme,
|
|
195
|
+
locale: this.locale,
|
|
196
|
+
variant: "basket",
|
|
197
|
+
slot: "points",
|
|
198
|
+
})}
|
|
229
199
|
<coras-icon
|
|
230
200
|
slot="remove-button"
|
|
231
201
|
icon="delete"
|
|
@@ -283,6 +253,9 @@ __decorate([
|
|
|
283
253
|
__decorate([
|
|
284
254
|
consume({ context: assetsURLContext, subscribe: true })
|
|
285
255
|
], CorasBasket.prototype, "assetsURL", void 0);
|
|
256
|
+
__decorate([
|
|
257
|
+
consume({ context: loyaltyProgrammeContext, subscribe: true })
|
|
258
|
+
], CorasBasket.prototype, "loyaltyProgramme", void 0);
|
|
286
259
|
CorasBasket = __decorate([
|
|
287
260
|
localized()
|
|
288
261
|
], CorasBasket);
|
|
@@ -178,8 +178,7 @@ let CorasNavBar = class CorasNavBar extends SearchMixin(LitElement) {
|
|
|
178
178
|
this.isSearchDropdownOpen = true;
|
|
179
179
|
const recentlySelectedSearches = getRecentlySelectedSearches();
|
|
180
180
|
if (recentlySelectedSearches.length === 0) {
|
|
181
|
-
if (
|
|
182
|
-
!this.searchTask.value) {
|
|
181
|
+
if (this.searchValue || !this.searchTask.value) {
|
|
183
182
|
void this.searchTask.run();
|
|
184
183
|
}
|
|
185
184
|
}
|
|
@@ -227,8 +226,7 @@ let CorasNavBar = class CorasNavBar extends SearchMixin(LitElement) {
|
|
|
227
226
|
this.isSearchDropdownOpen = true;
|
|
228
227
|
const recentlySelectedSearches = getRecentlySelectedSearches();
|
|
229
228
|
if (recentlySelectedSearches.length === 0) {
|
|
230
|
-
if (
|
|
231
|
-
!this.searchTask.value) {
|
|
229
|
+
if (this.searchValue || !this.searchTask.value) {
|
|
232
230
|
void this.searchTask.run();
|
|
233
231
|
}
|
|
234
232
|
}
|
|
@@ -454,7 +452,7 @@ let CorasNavBar = class CorasNavBar extends SearchMixin(LitElement) {
|
|
|
454
452
|
`;
|
|
455
453
|
}
|
|
456
454
|
renderSearchItems() {
|
|
457
|
-
if (!this.searchValue
|
|
455
|
+
if (!this.searchValue) {
|
|
458
456
|
return this.renderRecentlySearchedItems();
|
|
459
457
|
}
|
|
460
458
|
return this.searchTask.render({
|
|
@@ -56,11 +56,13 @@ export default css `
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/* The nav search reads as body copy rather than a form field waiting for
|
|
59
|
-
input, so its resting label
|
|
59
|
+
input, so its resting label and icon follow the body text colour. The
|
|
60
|
+
field keeps the page's field background on a dark navbar, so the navbar
|
|
61
|
+
icon colour would vanish on it. */
|
|
60
62
|
.search coras-field,
|
|
61
63
|
.input-wrapper-mobile coras-field {
|
|
62
64
|
--field-input-placeholder-color: var(--coras-color-text);
|
|
63
|
-
--field-prefix-icon-color: var(--
|
|
65
|
+
--field-prefix-icon-color: var(--coras-color-text);
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
.search-results coras-select-option > coras-icon {
|