@loczer/storefront-sdk 0.209.0 → 0.210.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/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/date/index-DAbcklF5.js +1 -0
- package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/date/mini-CSEBo1ZP.js +60 -0
- package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/index--u3Qf-qy.js +4 -0
- package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/tz/index-CEcibV-H.js +1 -0
- package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/tzOffset/index-COlDDdap.js +22 -0
- package/dist/chunks/pkg/booking-engine/dist/pricing-BJaynUu_.js +3 -0
- package/dist/chunks/pkg/booking-engine/dist/utils/schedule-ssRov9xe.js +39 -0
- package/dist/chunks/pkg/booking-engine/dist/utils/timezone-B6XIbBPz.js +79 -0
- package/dist/components/ProductPriceBadge/index.d.ts.map +1 -1
- package/dist/components/ProductPriceBadge/index.js +86 -80
- package/dist/components/StorefrontCartPanel/index.d.ts +4 -4
- package/dist/components/StorefrontCartPanel/index.d.ts.map +1 -1
- package/dist/components/StorefrontCartPanel/index.js +10 -9
- package/dist/i18n/en.d.ts +11 -6
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +13 -8
- package/dist/i18n/fr.d.ts +11 -6
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +13 -8
- package/dist/index.d.ts +54 -36
- package/dist/index.js +66 -66
- package/dist/lib/booking.d.ts +0 -6
- package/dist/lib/booking.d.ts.map +1 -1
- package/dist/lib/booking.js +51 -65
- package/dist/lib/cartSummary.d.ts +5 -3
- package/dist/lib/cartSummary.d.ts.map +1 -1
- package/dist/lib/cartSummary.js +7 -7
- package/dist/lib/pricing.d.ts +18 -6
- package/dist/lib/pricing.d.ts.map +1 -1
- package/dist/lib/pricing.js +45 -29
- package/dist/pages/BookingPage.d.ts.map +1 -1
- package/dist/pages/BookingPage.js +205 -201
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +277 -274
- package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts +2 -2
- package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts.map +1 -1
- package/dist/pages/checkout/components/CheckoutSummaryColumn.js +4 -4
- package/package.json +1 -1
package/dist/lib/pricing.js
CHANGED
|
@@ -1,45 +1,61 @@
|
|
|
1
1
|
import { calculatePriceForQuantity as e } from "../chunks/pkg/booking-engine/dist/utils/pricing-CqXJ5fMP.js";
|
|
2
|
-
import {
|
|
2
|
+
import { calculateRentalQuantity as t, combineDateAndTime as n } from "../chunks/pkg/booking-engine/dist/utils/schedule-ssRov9xe.js";
|
|
3
|
+
import "../chunks/pkg/booking-engine/dist/pricing-BJaynUu_.js";
|
|
4
|
+
import { formatPriceMinor as r } from "./utils.js";
|
|
3
5
|
//#region src/lib/pricing.ts
|
|
4
|
-
var
|
|
6
|
+
var i = "EUR", a = "day", o = 8, s = (e) => [...e].sort((e, t) => e.quantity - t.quantity), c = (e) => e.find((e) => e.currency?.trim())?.currency?.trim() || i, l = (e) => Math.abs(e) % 100 == 0 ? {
|
|
5
7
|
minimumFractionDigits: 0,
|
|
6
8
|
maximumFractionDigits: 0
|
|
7
|
-
} : {},
|
|
8
|
-
currency:
|
|
9
|
-
...
|
|
10
|
-
}),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
} : {}, u = (e, t, { currency: n = i } = {}) => r(e, t, {
|
|
10
|
+
currency: n,
|
|
11
|
+
...l(e)
|
|
12
|
+
}), d = (e, t) => s((e ?? []).filter((e) => e.unit === t && e.quantity > 0)), f = (e, t) => new Intl.NumberFormat(t, { maximumFractionDigits: 3 }).format(e);
|
|
13
|
+
function p(e, t, n = 1) {
|
|
14
|
+
return t(`price_unit_${e}`, { count: n });
|
|
15
|
+
}
|
|
16
|
+
function m(e, t, n, r) {
|
|
17
|
+
return `${f(e, n)} ${p(t, r, e)}`;
|
|
18
|
+
}
|
|
19
|
+
function h(e, r, i = "UTC") {
|
|
20
|
+
try {
|
|
21
|
+
let a = n(e.start_date, e.start_time, i), o = n(e.end_date, e.end_time, i);
|
|
22
|
+
return o.getTime() <= a.getTime() ? null : {
|
|
23
|
+
priceUnit: r.baseUnit,
|
|
24
|
+
billableUnitCount: t(a, o, r, i)
|
|
25
|
+
};
|
|
26
|
+
} catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function g(t, n, r = a) {
|
|
31
|
+
if (!Number.isFinite(n) || n <= 0) return null;
|
|
32
|
+
let i = d(t, r);
|
|
33
|
+
if (i.length === 0) return null;
|
|
18
34
|
try {
|
|
19
|
-
return e(
|
|
35
|
+
return e(i, n, r);
|
|
20
36
|
} catch {
|
|
21
37
|
return null;
|
|
22
38
|
}
|
|
23
39
|
}
|
|
24
|
-
function
|
|
25
|
-
let
|
|
26
|
-
if (
|
|
27
|
-
let i =
|
|
28
|
-
return Array.from({ length:
|
|
29
|
-
let
|
|
40
|
+
function _(e, t, n = a) {
|
|
41
|
+
let r = d(e, n);
|
|
42
|
+
if (r.length === 0) return [];
|
|
43
|
+
let i = c(r);
|
|
44
|
+
return Array.from({ length: o }, (e, a) => {
|
|
45
|
+
let o = a + 1, s = g(r, o, n) ?? 0, c = Math.ceil(s / o / 10) * 10;
|
|
30
46
|
return {
|
|
31
|
-
|
|
32
|
-
totalPriceLabel: s
|
|
33
|
-
|
|
47
|
+
unitCount: o,
|
|
48
|
+
totalPriceLabel: u(s, t, { currency: i }),
|
|
49
|
+
perUnitPriceLabel: u(c, t, { currency: i })
|
|
34
50
|
};
|
|
35
51
|
});
|
|
36
52
|
}
|
|
37
|
-
function
|
|
38
|
-
let
|
|
39
|
-
return
|
|
40
|
-
let
|
|
41
|
-
return d <= 0 || f < 0 ?
|
|
53
|
+
function v(e, t, n, r = a) {
|
|
54
|
+
let i = d(e, r), o = c(i);
|
|
55
|
+
return i.map((e, a) => {
|
|
56
|
+
let s = a > 0 ? i[a - 1] : void 0, c = s?.quantity ?? 0, l = s?.value ?? 0, d = e.quantity - c, f = e.value - l;
|
|
57
|
+
return d <= 0 || f < 0 ? u(e.value, t, { currency: o }) : `${u(f, t, { currency: o })} / ${m(d, r, t, n)}`;
|
|
42
58
|
});
|
|
43
59
|
}
|
|
44
60
|
//#endregion
|
|
45
|
-
export {
|
|
61
|
+
export { v as buildPriceTierLabels, _ as buildRentalPriceRows, h as calculateBookingRentalUnitSummary, g as calculateRentalPriceForQuantity, m as formatRentalUnitQuantity, u as formatStorefrontPriceMinor, p as getPricingUnitLabel };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookingPage.d.ts","sourceRoot":"","sources":["../../src/pages/BookingPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BookingPage.d.ts","sourceRoot":"","sources":["../../src/pages/BookingPage.tsx"],"names":[],"mappings":"AAuMA,MAAM,CAAC,OAAO,UAAU,WAAW,4CA2nBlC"}
|