@loczer/storefront-sdk 0.218.0 → 0.219.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/dist/components/BookingFlowPageLayout/index.d.ts +13 -0
- package/dist/components/BookingFlowPageLayout/index.d.ts.map +1 -0
- package/dist/components/BookingFlowPageLayout/index.js +35 -0
- package/dist/components/BookingPeriodSelector/components/BookingEndDateField.d.ts.map +1 -1
- package/dist/components/BookingPeriodSelector/components/BookingEndDateField.js +10 -33
- package/dist/components/BookingPeriodSelector/components/BookingStartDateField.d.ts.map +1 -1
- package/dist/components/BookingPeriodSelector/components/BookingStartDateField.js +1 -4
- package/dist/components/BookingPeriodSelector/index.d.ts +1 -1
- package/dist/components/BookingPeriodSelector/index.d.ts.map +1 -1
- package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts +0 -5
- package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts.map +1 -1
- package/dist/components/BookingPeriodSelector/useBookingPeriodController.js +150 -159
- package/dist/components/Footer/BusinessHours.d.ts +2 -1
- package/dist/components/Footer/BusinessHours.d.ts.map +1 -1
- package/dist/components/Footer/BusinessHours.js +19 -18
- package/dist/components/Footer/businessHoursStatus.d.ts +25 -0
- package/dist/components/Footer/businessHoursStatus.d.ts.map +1 -0
- package/dist/components/Footer/businessHoursStatus.js +99 -0
- package/dist/components/Footer/businessHoursUtils.d.ts +2 -1
- package/dist/components/Footer/businessHoursUtils.d.ts.map +1 -1
- package/dist/components/Footer/businessHoursUtils.js +52 -45
- package/dist/components/Footer/index.d.ts +2 -1
- package/dist/components/Footer/index.d.ts.map +1 -1
- package/dist/components/Footer/index.js +26 -25
- package/dist/components/Layout/index.d.ts.map +1 -1
- package/dist/components/Layout/index.js +2 -1
- package/dist/components/StorefrontCancellationPolicyNotice/index.d.ts.map +1 -1
- package/dist/components/StorefrontCancellationPolicyNotice/index.js +89 -86
- package/dist/components/StorefrontCartPanel/index.js +4 -4
- package/dist/components/StorefrontInsuranceNotice/index.d.ts +2 -1
- package/dist/components/StorefrontInsuranceNotice/index.d.ts.map +1 -1
- package/dist/components/StorefrontInsuranceNotice/index.js +155 -162
- package/dist/i18n/en.d.ts +7 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +8 -2
- package/dist/i18n/fr.d.ts +7 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +8 -2
- package/dist/index.d.ts +24 -9
- package/dist/index.js +66 -66
- package/dist/lib/pricing.d.ts.map +1 -1
- package/dist/lib/pricing.js +3 -1
- package/dist/lib/products.d.ts +6 -0
- package/dist/lib/products.d.ts.map +1 -1
- package/dist/lib/products.js +36 -32
- package/dist/pages/BookingPage.d.ts.map +1 -1
- package/dist/pages/BookingPage.js +306 -335
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +154 -168
- package/dist/pages/HomePage.d.ts.map +1 -1
- package/dist/pages/HomePage.js +435 -378
- package/dist/storefront.css +1 -1
- package/package.json +1 -1
package/dist/lib/products.js
CHANGED
|
@@ -4,13 +4,17 @@ import { getLocalizedValue as t } from "../localization.js";
|
|
|
4
4
|
var n = ({ product: n, productVariantId: r, language: i, fallbackLanguage: a }) => {
|
|
5
5
|
let o = t(n.name, i, a), s = r ? n.productVariants?.find((e) => e.id === r) : void 0, c = s ? e(s).label : "", l = n.storefrontDisplayMode === "variants_as_products" && n.representedVariantId === r;
|
|
6
6
|
return !c || l ? o : `${o} ${c}`.trim();
|
|
7
|
-
}, r = -1
|
|
7
|
+
}, r = -1;
|
|
8
|
+
function i(e, t) {
|
|
9
|
+
return e.find((e) => e.kind === t && e.insurance?.enabled);
|
|
10
|
+
}
|
|
11
|
+
var a = {
|
|
8
12
|
hour: "baseHourlyRateMinor",
|
|
9
13
|
half_day: "baseHalfDayRateMinor",
|
|
10
14
|
day: "baseDailyRateMinor",
|
|
11
15
|
week: "baseWeeklyRateMinor",
|
|
12
16
|
month: "baseMonthlyRateMinor"
|
|
13
|
-
},
|
|
17
|
+
}, o = /[\u0300-\u036f]/g, s = /[^a-z0-9]+/g, c = /^-+|-+$/g, l = (e) => e.normalize("NFKD").replace(o, "").toLowerCase().replace(s, "-").replace(c, ""), u = (e) => e?.en?.value.trim() || (Object.values(e ?? {}).find((e) => e.value.trim().length > 0)?.value.trim() ?? ""), d = (e, t) => {
|
|
14
18
|
let n = t.trim();
|
|
15
19
|
return n ? Object.fromEntries(Object.entries(e).map(([e, t]) => {
|
|
16
20
|
let r = t.value.trim();
|
|
@@ -19,31 +23,31 @@ var n = ({ product: n, productVariantId: r, language: i, fallbackLanguage: a })
|
|
|
19
23
|
value: r ? `${r} ${n}`.trim() : t.value
|
|
20
24
|
}];
|
|
21
25
|
})) : e;
|
|
22
|
-
},
|
|
23
|
-
let r =
|
|
26
|
+
}, f = ({ id: e, productShortCode: t, name: n }) => {
|
|
27
|
+
let r = l(typeof t == "string" ? t.trim() : ""), i = l(u(n)), a = l(e);
|
|
24
28
|
return `product-${[r, i].filter((e) => e.length > 0).join("-") || a || "item"}`;
|
|
25
|
-
},
|
|
29
|
+
}, p = (e, t) => `${e}__variant__${t}`, m = (t, n) => {
|
|
26
30
|
let r = t.checkoutProductId?.trim() || t.id, i = n.id.trim(), { label: a } = e(n);
|
|
27
31
|
return {
|
|
28
32
|
...t,
|
|
29
|
-
id:
|
|
33
|
+
id: p(r, i),
|
|
30
34
|
checkoutProductId: r,
|
|
31
35
|
representedVariantId: i,
|
|
32
|
-
name:
|
|
36
|
+
name: d(t.name, a),
|
|
33
37
|
productVariants: [n]
|
|
34
38
|
};
|
|
35
|
-
},
|
|
39
|
+
}, h = (e) => e.flatMap((e) => {
|
|
36
40
|
if (e.storefrontDisplayMode !== "variants_as_products") return [e];
|
|
37
41
|
let t = e.productVariants ?? [];
|
|
38
|
-
return t.length === 0 ? [e] : t.map((t) =>
|
|
39
|
-
}),
|
|
40
|
-
bikes:
|
|
41
|
-
accessories:
|
|
42
|
-
}),
|
|
43
|
-
function v(e) {
|
|
44
|
-
return i[e];
|
|
45
|
-
}
|
|
42
|
+
return t.length === 0 ? [e] : t.map((t) => m(e, t));
|
|
43
|
+
}), g = (e) => ({
|
|
44
|
+
bikes: h(e.bikes),
|
|
45
|
+
accessories: h(e.accessories)
|
|
46
|
+
}), _ = (e) => e === "e-bike" ? 0 : e === "bike" ? 1 : e === "accessory" ? 2 : 3, v = (e) => e.externalId?.trim() || e.id?.trim() || "";
|
|
46
47
|
function y(e) {
|
|
48
|
+
return a[e];
|
|
49
|
+
}
|
|
50
|
+
function b(e) {
|
|
47
51
|
return [
|
|
48
52
|
{
|
|
49
53
|
field: "kind",
|
|
@@ -54,7 +58,7 @@ function y(e) {
|
|
|
54
58
|
order: "desc"
|
|
55
59
|
},
|
|
56
60
|
{
|
|
57
|
-
field:
|
|
61
|
+
field: y(e),
|
|
58
62
|
order: "desc"
|
|
59
63
|
},
|
|
60
64
|
{
|
|
@@ -63,23 +67,23 @@ function y(e) {
|
|
|
63
67
|
}
|
|
64
68
|
];
|
|
65
69
|
}
|
|
66
|
-
function
|
|
70
|
+
function x(e, t = "day") {
|
|
67
71
|
let n = e?.find((e) => e.unit === t && e.quantity === 1);
|
|
68
72
|
return n ? n.value : -1;
|
|
69
73
|
}
|
|
70
|
-
function
|
|
71
|
-
return
|
|
74
|
+
function S(e) {
|
|
75
|
+
return x(e, "day");
|
|
72
76
|
}
|
|
73
|
-
function
|
|
74
|
-
let r =
|
|
77
|
+
function C(e, t, n = {}) {
|
|
78
|
+
let r = _(e.kind), i = _(t.kind);
|
|
75
79
|
if (r !== i) return r - i;
|
|
76
80
|
let a = (t.assetRelScore ?? 0) - (e.assetRelScore ?? 0);
|
|
77
81
|
if (a !== 0) return a;
|
|
78
|
-
let o = n.priceUnit ?? "day", s =
|
|
79
|
-
return s === 0 ?
|
|
82
|
+
let o = n.priceUnit ?? "day", s = x(t.prices, o) - x(e.prices, o);
|
|
83
|
+
return s === 0 ? v(e).localeCompare(v(t)) : s;
|
|
80
84
|
}
|
|
81
|
-
function
|
|
82
|
-
return
|
|
85
|
+
function w(e, t, n = {}) {
|
|
86
|
+
return C({
|
|
83
87
|
...e,
|
|
84
88
|
kind: e.kind === "e-bike" ? "e-bike" : "bike"
|
|
85
89
|
}, {
|
|
@@ -87,8 +91,8 @@ function C(e, t, n = {}) {
|
|
|
87
91
|
kind: t.kind === "e-bike" ? "e-bike" : "bike"
|
|
88
92
|
}, n);
|
|
89
93
|
}
|
|
90
|
-
function
|
|
91
|
-
return
|
|
94
|
+
function T(e, t, n = {}) {
|
|
95
|
+
return C({
|
|
92
96
|
...e,
|
|
93
97
|
kind: "accessory"
|
|
94
98
|
}, {
|
|
@@ -96,12 +100,12 @@ function w(e, t, n = {}) {
|
|
|
96
100
|
kind: "accessory"
|
|
97
101
|
}, n);
|
|
98
102
|
}
|
|
99
|
-
var
|
|
103
|
+
var E = (e) => e.map((e) => ({
|
|
100
104
|
...e,
|
|
101
105
|
kind: e.kind === "e-bike" ? "e-bike" : "bike"
|
|
102
|
-
})),
|
|
106
|
+
})), D = (e) => e.map((e) => ({
|
|
103
107
|
...e,
|
|
104
108
|
kind: "accessory"
|
|
105
|
-
})),
|
|
109
|
+
})), O = (e, t) => t.bikes.find((t) => t.id === e) || (t.accessories.find((t) => t.id === e) ?? null), k = (e, t) => t.bikes.find((t) => t.slug === e) || (t.accessories.find((t) => t.slug === e) ?? null), A = (e) => e.checkoutProductId?.trim() || e.id, j = (e) => e.representedVariantId?.trim() || void 0;
|
|
106
110
|
//#endregion
|
|
107
|
-
export { r as CATALOG_PRODUCT_BASE_RATE_UNSET,
|
|
111
|
+
export { r as CATALOG_PRODUCT_BASE_RATE_UNSET, f as buildStorefrontProductSlug, p as buildVariantStorefrontProductId, C as compareCatalogProducts, T as compareStorefrontAccessoryProducts, w as compareStorefrontBikeProducts, i as findStorefrontInsurancePricingBike, O as findStorefrontProduct, k as findStorefrontProductBySlug, x as getCatalogProductBaseRateMinor, b as getCatalogProductPaginationSort, y as getCatalogProductSortFieldForPriceUnit, S as getStorefrontBaseDailyRateMinor, A as getStorefrontCheckoutProductId, n as getStorefrontProductSelectionDisplayName, j as getStorefrontRepresentedVariantId, D as toStorefrontAccessoryProducts, E as toStorefrontBikeProducts, h as toStorefrontBookingProducts, g as toStorefrontBookingProductsCollections };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookingPage.d.ts","sourceRoot":"","sources":["../../src/pages/BookingPage.tsx"],"names":[],"mappings":"AA6MA,MAAM,CAAC,OAAO,UAAU,WAAW,
|
|
1
|
+
{"version":3,"file":"BookingPage.d.ts","sourceRoot":"","sources":["../../src/pages/BookingPage.tsx"],"names":[],"mappings":"AA6MA,MAAM,CAAC,OAAO,UAAU,WAAW,4CAoqBlC"}
|