@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
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loyalty programme checkout fields. `GET /reservations/check` lists the
|
|
3
|
+
* fields and their rules (required, pattern, max length); the host's
|
|
4
|
+
* `config.loyalty` supplies the wording. This module turns both into the
|
|
5
|
+
* payment page's field config (the field's label shown as its placeholder,
|
|
6
|
+
* like the billing address fields) and collects the values into the
|
|
7
|
+
* reservation `metadata` the API validates and stores.
|
|
8
|
+
*/
|
|
9
|
+
import { msg } from "@lit/localize";
|
|
10
|
+
import { composeValidators, maxLength, required, } from "./payment-page.validators.js";
|
|
11
|
+
/** Form field names are prefixed so they cannot collide with the fixed fields. */
|
|
12
|
+
const LOYALTY_FIELD_PREFIX = "loyalty_";
|
|
13
|
+
export function getLoyaltyFieldName(field) {
|
|
14
|
+
return `${LOYALTY_FIELD_PREFIX}${field}`;
|
|
15
|
+
}
|
|
16
|
+
function matchesPattern(pattern) {
|
|
17
|
+
// The API compiled the pattern already; a pattern this engine rejects is
|
|
18
|
+
// left to the API's own validation rather than blocking the form.
|
|
19
|
+
let regex = null;
|
|
20
|
+
try {
|
|
21
|
+
regex = new RegExp(`^(?:${pattern})$`);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
regex = null;
|
|
25
|
+
}
|
|
26
|
+
return ({ value }) => {
|
|
27
|
+
if (!value || !regex)
|
|
28
|
+
return undefined;
|
|
29
|
+
return regex.test(value) ? undefined : msg("Please enter a valid value");
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function createLoyaltyFieldValidator(requirement) {
|
|
33
|
+
const validators = [];
|
|
34
|
+
if (requirement.required)
|
|
35
|
+
validators.push(required);
|
|
36
|
+
validators.push(maxLength(requirement.max_length));
|
|
37
|
+
if (requirement.pattern)
|
|
38
|
+
validators.push(matchesPattern(requirement.pattern));
|
|
39
|
+
const validate = composeValidators(...validators);
|
|
40
|
+
// The value is sent trimmed, so it is validated trimmed as well.
|
|
41
|
+
return (params) => validate({
|
|
42
|
+
...params,
|
|
43
|
+
value: typeof params.value === "string" ? params.value.trim() : params.value,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/** "miles_and_more_card_number" reads as "Miles and more card number" when the host gave no wording. */
|
|
47
|
+
function humaniseFieldName(field) {
|
|
48
|
+
const words = field.replace(/_/g, " ").trim();
|
|
49
|
+
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
50
|
+
}
|
|
51
|
+
export function buildLoyaltyFieldsConfig(requirements, programme) {
|
|
52
|
+
if (!requirements)
|
|
53
|
+
return {};
|
|
54
|
+
return Object.fromEntries(requirements.requirements.map((requirement) => {
|
|
55
|
+
const text = programme?.fields?.[requirement.field];
|
|
56
|
+
return [
|
|
57
|
+
getLoyaltyFieldName(requirement.field),
|
|
58
|
+
{
|
|
59
|
+
label: () => "",
|
|
60
|
+
placeholder: () => text?.label ?? humaniseFieldName(requirement.field),
|
|
61
|
+
helpText: () => text?.helpText ?? "",
|
|
62
|
+
validators: createLoyaltyFieldValidator(requirement),
|
|
63
|
+
type: "text",
|
|
64
|
+
autocomplete: "off",
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
export function collectLoyaltyMetadata(requirements, formValues) {
|
|
70
|
+
if (!requirements)
|
|
71
|
+
return {};
|
|
72
|
+
const metadata = {};
|
|
73
|
+
for (const requirement of requirements.requirements) {
|
|
74
|
+
const value = formValues[getLoyaltyFieldName(requirement.field)];
|
|
75
|
+
if (typeof value === "string" && value.trim() !== "") {
|
|
76
|
+
metadata[requirement.field] = value.trim();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return metadata;
|
|
80
|
+
}
|
|
@@ -251,6 +251,22 @@ export default css `
|
|
|
251
251
|
padding: 2rem 0;
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
+
.loyalty-programme-earned .loyalty-terms {
|
|
255
|
+
display: inline-block;
|
|
256
|
+
margin-top: 0.5rem;
|
|
257
|
+
color: var(--coras-color-link);
|
|
258
|
+
font-size: var(--coras-font-size-sm);
|
|
259
|
+
text-decoration: underline;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.loyalty-programme-earned {
|
|
263
|
+
display: flex;
|
|
264
|
+
flex-direction: column;
|
|
265
|
+
align-items: center;
|
|
266
|
+
gap: 0.25rem;
|
|
267
|
+
margin-top: 1.5rem;
|
|
268
|
+
}
|
|
269
|
+
|
|
254
270
|
.collect-fida-container {
|
|
255
271
|
margin-top: 2rem;
|
|
256
272
|
}
|
|
@@ -69,7 +69,7 @@ export declare const validateField: (fieldName: string, value: string, formError
|
|
|
69
69
|
*/
|
|
70
70
|
export declare const validateForm: (formValues: FormValues, formErrors: Record<string, string>, FIELDS: FieldsConfig, required: (params: {
|
|
71
71
|
value: string;
|
|
72
|
-
}) => string | undefined, checkData: components["schemas"]["CheckReservationsResponse"] | undefined, shouldValidateBillingAddress?: boolean, contextProvider?: (fieldName: string) => ValidatorContext | undefined) => {
|
|
72
|
+
}) => string | undefined, checkData: components["schemas"]["CheckReservationsResponse"] | undefined, shouldValidateBillingAddress?: boolean, contextProvider?: (fieldName: string) => ValidatorContext | undefined, additionalFieldNames?: readonly string[]) => {
|
|
73
73
|
isValid: boolean;
|
|
74
74
|
errors: Record<string, string>;
|
|
75
75
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { msg } from "@lit/localize";
|
|
2
2
|
import { apiGet } from "../../core/api/queries.js";
|
|
3
3
|
import { getLoyaltyAmount } from "../../core/utils/loyalty.js";
|
|
4
|
+
import { getLoyaltyFieldName } from "./payment-page.loyalty.js";
|
|
4
5
|
import { APIError } from "../../core/api/api-error.js";
|
|
5
6
|
import { parsePhoneNumberFromString, } from "libphonenumber-js/min";
|
|
6
7
|
import { validEmail, } from "./payment-page.validators.js";
|
|
@@ -232,7 +233,7 @@ export const validateField = (fieldName, value, formErrors, FIELDS, required, co
|
|
|
232
233
|
* When false, skips billing address validation regardless of API requirements.
|
|
233
234
|
* When undefined, uses the API requirements to determine if validation is needed.
|
|
234
235
|
*/
|
|
235
|
-
export const validateForm = (formValues, formErrors, FIELDS, required, checkData, shouldValidateBillingAddress, contextProvider) => {
|
|
236
|
+
export const validateForm = (formValues, formErrors, FIELDS, required, checkData, shouldValidateBillingAddress, contextProvider, additionalFieldNames = []) => {
|
|
236
237
|
let isValid = true;
|
|
237
238
|
let newErrors = { ...formErrors };
|
|
238
239
|
const validateFieldFn = (fieldName) => {
|
|
@@ -259,6 +260,9 @@ export const validateForm = (formValues, formErrors, FIELDS, required, checkData
|
|
|
259
260
|
if (hasEmailField(checkData)) {
|
|
260
261
|
validateFieldFn("email");
|
|
261
262
|
}
|
|
263
|
+
for (const fieldName of additionalFieldNames) {
|
|
264
|
+
validateFieldFn(fieldName);
|
|
265
|
+
}
|
|
262
266
|
// Validate billing address fields only when they are displayed.
|
|
263
267
|
// Defaults to true for backward compatibility, but callers should always pass the parameter.
|
|
264
268
|
const validateBillingAddress = shouldValidateBillingAddress ?? true;
|
|
@@ -585,6 +589,20 @@ export function mapApiErrorsToForm(error, currentFormErrors, attendees, reservat
|
|
|
585
589
|
}
|
|
586
590
|
});
|
|
587
591
|
}
|
|
592
|
+
// Loyalty programme fields: `errors.metadata.<name>` maps to `loyalty_<name>`
|
|
593
|
+
else if (field === "metadata" &&
|
|
594
|
+
typeof message === "object" &&
|
|
595
|
+
message !== null &&
|
|
596
|
+
!Array.isArray(message)) {
|
|
597
|
+
Object.entries(message).forEach(([metadataKey, fieldErrors]) => {
|
|
598
|
+
const errorMessage = Array.isArray(fieldErrors) && fieldErrors.length > 0
|
|
599
|
+
? fieldErrors[0]
|
|
600
|
+
: String(fieldErrors);
|
|
601
|
+
if (errorMessage) {
|
|
602
|
+
formErrors[getLoyaltyFieldName(metadataKey)] = errorMessage;
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
}
|
|
588
606
|
// Handle nested fields like customer.email
|
|
589
607
|
else if (field.includes(".")) {
|
|
590
608
|
const [category, specificField] = field.split(".");
|
|
@@ -41,6 +41,7 @@ export declare class PaymentApiService {
|
|
|
41
41
|
data: {
|
|
42
42
|
general: components["schemas"]["GeneralRequirements"];
|
|
43
43
|
reservations: components["schemas"]["ReservationRequirementsAndRestrictions"][];
|
|
44
|
+
loyalty: components["schemas"]["LoyaltyRequirements"];
|
|
44
45
|
};
|
|
45
46
|
response: Response;
|
|
46
47
|
}>;
|
|
@@ -18,6 +18,7 @@ declare const CorasSearchPage_base: import("../../contexts/utils.js").Constructo
|
|
|
18
18
|
locale: import("../../index.js").SupportedLocales;
|
|
19
19
|
locales: import("../../index.js").SupportedLocales[];
|
|
20
20
|
loyaltyPoints: boolean;
|
|
21
|
+
loyaltyProgramme: import("../../index.js").CorasLoyaltyProgramme | null;
|
|
21
22
|
logger: import("../../core/logger.js").Logger;
|
|
22
23
|
client: Client<paths>;
|
|
23
24
|
getPageProperties(): SearchPageParamsEvent;
|
|
@@ -30,6 +30,7 @@ import { adaptPresetImages } from "../../core/images/preset-adapter.js";
|
|
|
30
30
|
import { ErrorModalMixin } from "../../mixins/error-modal.mixin.js";
|
|
31
31
|
import { getLocale, setLocale } from "../../core/i18n/localization.js";
|
|
32
32
|
import { getApiLanguageCode } from "../../core/utils/locale.js";
|
|
33
|
+
import { renderLoyaltyBadge } from "../../components/loyalty-badge/loyalty-badge.utils.js";
|
|
33
34
|
/**
|
|
34
35
|
* Search page component for displaying search results.
|
|
35
36
|
*
|
|
@@ -283,6 +284,7 @@ let CorasSearchPage = class CorasSearchPage extends ErrorModalMixin(LocationSear
|
|
|
283
284
|
?label=${false}
|
|
284
285
|
name=${result.attraction_name}
|
|
285
286
|
rating=${result.rating || 0}
|
|
287
|
+
category=${result.main_category.slug}
|
|
286
288
|
price=${convertToLocaleCurrency({
|
|
287
289
|
value: result.min_price[this.currency] || 0,
|
|
288
290
|
locale: this.locale,
|
|
@@ -297,6 +299,14 @@ let CorasSearchPage = class CorasSearchPage extends ErrorModalMixin(LocationSear
|
|
|
297
299
|
locale=${this.locale}
|
|
298
300
|
@click=${() => this.handleAttractionClick(result.attraction_id)}
|
|
299
301
|
>
|
|
302
|
+
${renderLoyaltyBadge({
|
|
303
|
+
loyalty: result.loyalty,
|
|
304
|
+
programme: this.loyaltyProgramme,
|
|
305
|
+
locale: this.locale,
|
|
306
|
+
variant: "card",
|
|
307
|
+
slot: "points",
|
|
308
|
+
from: true,
|
|
309
|
+
})}
|
|
300
310
|
</coras-attraction-long-card>
|
|
301
311
|
`)}
|
|
302
312
|
</div>
|
|
@@ -13,6 +13,7 @@ declare const CorasSuggestionWidget_base: import("../../contexts/utils.js").Cons
|
|
|
13
13
|
locale: import("../../index.js").SupportedLocales;
|
|
14
14
|
locales: import("../../index.js").SupportedLocales[];
|
|
15
15
|
loyaltyPoints: boolean;
|
|
16
|
+
loyaltyProgramme: import("../../index.js").CorasLoyaltyProgramme | null;
|
|
16
17
|
logger: import("../../core/logger.js").Logger;
|
|
17
18
|
client: import("openapi-fetch").Client<import("../../core/types/api-schema.js").paths>;
|
|
18
19
|
getPageProperties(): PageParamsEvent;
|
|
@@ -20,6 +20,7 @@ import { IMAGE_BASE_URL } from "../../core/images/constants.js";
|
|
|
20
20
|
import { BaseMixin } from "../../mixins/base.mixin.js";
|
|
21
21
|
import { apiGet } from "../../core/api/queries.js";
|
|
22
22
|
import { convertToLocaleCurrency } from "../../core/currency/index.js";
|
|
23
|
+
import { renderLoyaltyBadge } from "../../components/loyalty-badge/loyalty-badge.utils.js";
|
|
23
24
|
let CorasSuggestionWidget = class CorasSuggestionWidget extends BaseMixin(LitElement) {
|
|
24
25
|
constructor() {
|
|
25
26
|
super(...arguments);
|
|
@@ -97,7 +98,16 @@ let CorasSuggestionWidget = class CorasSuggestionWidget extends BaseMixin(LitEle
|
|
|
97
98
|
timezone=${card.timezone}
|
|
98
99
|
locale=${this.locale}
|
|
99
100
|
@click=${() => this.handleCardClick(card)}
|
|
100
|
-
|
|
101
|
+
>
|
|
102
|
+
${renderLoyaltyBadge({
|
|
103
|
+
loyalty: card.loyalty,
|
|
104
|
+
programme: this.loyaltyProgramme,
|
|
105
|
+
locale: this.locale,
|
|
106
|
+
variant: "card",
|
|
107
|
+
slot: "points",
|
|
108
|
+
from: true,
|
|
109
|
+
})}
|
|
110
|
+
</coras-attraction-short-card>
|
|
101
111
|
`;
|
|
102
112
|
}
|
|
103
113
|
renderExploreCard(country, city) {
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=22"
|
|
22
22
|
},
|
|
23
|
-
"version": "0.
|
|
23
|
+
"version": "0.9.0",
|
|
24
24
|
"private": false,
|
|
25
25
|
"homepage": "https://docs.coras.io",
|
|
26
26
|
"bugs": {
|
|
@@ -105,9 +105,9 @@
|
|
|
105
105
|
"ts-lit-plugin": "2.0.2",
|
|
106
106
|
"typescript": "6.0.3",
|
|
107
107
|
"typescript-eslint": "8.67.0",
|
|
108
|
-
"vite": "8.2.
|
|
108
|
+
"vite": "8.2.4",
|
|
109
109
|
"vitest": "4.1.11",
|
|
110
|
-
"@coras-io/static": "0.0
|
|
110
|
+
"@coras-io/static": "0.1.0"
|
|
111
111
|
},
|
|
112
112
|
"dependencies": {
|
|
113
113
|
"@coinbase/cdp-core": "0.0.122",
|
|
@@ -120,12 +120,12 @@
|
|
|
120
120
|
"@stripe/stripe-js": "^9.14.0",
|
|
121
121
|
"date-fns": "^4.4.0",
|
|
122
122
|
"date-fns-tz": "^3.2.0",
|
|
123
|
-
"dompurify": "^3.4.
|
|
123
|
+
"dompurify": "^3.4.17",
|
|
124
124
|
"libphonenumber-js": "^1.13.11",
|
|
125
125
|
"lit": "^3.3.3",
|
|
126
126
|
"openapi-fetch": "^0.17.0",
|
|
127
127
|
"viem": "^2.55.19",
|
|
128
|
-
"@coras-io/brand-tokens": "^0.
|
|
128
|
+
"@coras-io/brand-tokens": "^0.7.0"
|
|
129
129
|
},
|
|
130
130
|
"scripts": {
|
|
131
131
|
"lint": "eslint \"src/**/*.ts*\"",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type CSSResultGroup, LitElement } from "lit";
|
|
2
|
-
import "../icon/icon.js";
|
|
3
|
-
declare const CorasPoints_base: import("../../mixins/points/types.js").Constructor<import("../../mixins/points/types.js").PointsMixinInterface> & typeof LitElement;
|
|
4
|
-
export declare class CorasPoints extends CorasPoints_base {
|
|
5
|
-
static styles: CSSResultGroup;
|
|
6
|
-
points: string;
|
|
7
|
-
render(): import("lit").TemplateResult<1>;
|
|
8
|
-
}
|
|
9
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
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 { LitElement, html } from "lit";
|
|
8
|
-
import { property } from "lit/decorators.js";
|
|
9
|
-
import { PointsMixin } from "../../mixins/points/points.js";
|
|
10
|
-
import styles from "./points.styles.js";
|
|
11
|
-
import "../icon/icon.js";
|
|
12
|
-
export class CorasPoints extends PointsMixin(LitElement) {
|
|
13
|
-
constructor() {
|
|
14
|
-
super(...arguments);
|
|
15
|
-
this.points = "";
|
|
16
|
-
}
|
|
17
|
-
static { this.styles = styles; }
|
|
18
|
-
render() {
|
|
19
|
-
return html `
|
|
20
|
-
<div class="logo">
|
|
21
|
-
<img data-testid="logo" src=${this.pointsLogoUrl} />
|
|
22
|
-
</div>
|
|
23
|
-
<div class="body">
|
|
24
|
-
<img
|
|
25
|
-
data-testid="points-icon"
|
|
26
|
-
class="points-icon"
|
|
27
|
-
src=${this.pointsIconUrl}
|
|
28
|
-
/>
|
|
29
|
-
<span data-testid="points">${this.points} ${this.pointsUnit}</span>
|
|
30
|
-
</div>
|
|
31
|
-
`;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
__decorate([
|
|
35
|
-
property({ type: String })
|
|
36
|
-
], CorasPoints.prototype, "points", void 0);
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { css } from "lit";
|
|
2
|
-
import component from "../../styles/defaults/component.js";
|
|
3
|
-
export default css `
|
|
4
|
-
${component}
|
|
5
|
-
|
|
6
|
-
:host {
|
|
7
|
-
--points-background-color: var(--coras-color-success-background);
|
|
8
|
-
--points-font-size: var(--coras-font-size-base);
|
|
9
|
-
--points-font-weight: var(--coras-font-weight-semibold);
|
|
10
|
-
--points-font-color: var(--coras-color-text);
|
|
11
|
-
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
width: 100%;
|
|
15
|
-
background-color: var(--points-background-color);
|
|
16
|
-
padding-inline: 20px;
|
|
17
|
-
padding-bottom: 8px;
|
|
18
|
-
|
|
19
|
-
.logo {
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
display: flex;
|
|
22
|
-
justify-content: center;
|
|
23
|
-
align-items: center;
|
|
24
|
-
padding-block: 10px;
|
|
25
|
-
|
|
26
|
-
img {
|
|
27
|
-
height: 100%;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.body {
|
|
32
|
-
display: flex;
|
|
33
|
-
flex-direction: row;
|
|
34
|
-
gap: 4px;
|
|
35
|
-
justify-content: flex-end;
|
|
36
|
-
align-items: center;
|
|
37
|
-
font-size: var(--points-font-size);
|
|
38
|
-
font-weight: var(--points-font-weight);
|
|
39
|
-
color: var(--points-font-color);
|
|
40
|
-
|
|
41
|
-
.points-icon {
|
|
42
|
-
height: var(--points-font-size);
|
|
43
|
-
width: var(--points-font-size);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
@@ -1,30 +0,0 @@
|
|
|
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 { property } from "lit/decorators.js";
|
|
8
|
-
export const PointsMixin = (superClass) => {
|
|
9
|
-
class PointsMixinElement extends superClass {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
this.pointsLogoUrl = "";
|
|
13
|
-
this.pointsIconUrl = "";
|
|
14
|
-
this.pointsUnit = "";
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
__decorate([
|
|
18
|
-
property({ type: String, attribute: "points-logo-url" })
|
|
19
|
-
], PointsMixinElement.prototype, "pointsLogoUrl", void 0);
|
|
20
|
-
__decorate([
|
|
21
|
-
property({ type: String, attribute: "points-icon-url" })
|
|
22
|
-
], PointsMixinElement.prototype, "pointsIconUrl", void 0);
|
|
23
|
-
__decorate([
|
|
24
|
-
property({ type: String, attribute: "points-unit" })
|
|
25
|
-
], PointsMixinElement.prototype, "pointsUnit", void 0);
|
|
26
|
-
__decorate([
|
|
27
|
-
property({ attribute: false })
|
|
28
|
-
], PointsMixinElement.prototype, "calculateRewardPoints", void 0);
|
|
29
|
-
return PointsMixinElement;
|
|
30
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { CalculateRewardPoints } from "../../core/types/index.js";
|
|
2
|
-
export type Constructor<T> = new (...args: any[]) => T;
|
|
3
|
-
export declare class PointsMixinInterface {
|
|
4
|
-
pointsLogoUrl: string;
|
|
5
|
-
pointsIconUrl: string;
|
|
6
|
-
pointsUnit: string;
|
|
7
|
-
calculateRewardPoints: CalculateRewardPoints | undefined;
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
/package/dist/components/{points/points.styles.d.ts → loyalty-badge/loyalty-badge.styles.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|