@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.
Files changed (38) hide show
  1. package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/date/index-DAbcklF5.js +1 -0
  2. package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/date/mini-CSEBo1ZP.js +60 -0
  3. package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/index--u3Qf-qy.js +4 -0
  4. package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/tz/index-CEcibV-H.js +1 -0
  5. package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/tzOffset/index-COlDDdap.js +22 -0
  6. package/dist/chunks/pkg/booking-engine/dist/pricing-BJaynUu_.js +3 -0
  7. package/dist/chunks/pkg/booking-engine/dist/utils/schedule-ssRov9xe.js +39 -0
  8. package/dist/chunks/pkg/booking-engine/dist/utils/timezone-B6XIbBPz.js +79 -0
  9. package/dist/components/ProductPriceBadge/index.d.ts.map +1 -1
  10. package/dist/components/ProductPriceBadge/index.js +86 -80
  11. package/dist/components/StorefrontCartPanel/index.d.ts +4 -4
  12. package/dist/components/StorefrontCartPanel/index.d.ts.map +1 -1
  13. package/dist/components/StorefrontCartPanel/index.js +10 -9
  14. package/dist/i18n/en.d.ts +11 -6
  15. package/dist/i18n/en.d.ts.map +1 -1
  16. package/dist/i18n/en.js +13 -8
  17. package/dist/i18n/fr.d.ts +11 -6
  18. package/dist/i18n/fr.d.ts.map +1 -1
  19. package/dist/i18n/fr.js +13 -8
  20. package/dist/index.d.ts +54 -36
  21. package/dist/index.js +66 -66
  22. package/dist/lib/booking.d.ts +0 -6
  23. package/dist/lib/booking.d.ts.map +1 -1
  24. package/dist/lib/booking.js +51 -65
  25. package/dist/lib/cartSummary.d.ts +5 -3
  26. package/dist/lib/cartSummary.d.ts.map +1 -1
  27. package/dist/lib/cartSummary.js +7 -7
  28. package/dist/lib/pricing.d.ts +18 -6
  29. package/dist/lib/pricing.d.ts.map +1 -1
  30. package/dist/lib/pricing.js +45 -29
  31. package/dist/pages/BookingPage.d.ts.map +1 -1
  32. package/dist/pages/BookingPage.js +205 -201
  33. package/dist/pages/CheckoutPage.d.ts.map +1 -1
  34. package/dist/pages/CheckoutPage.js +277 -274
  35. package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts +2 -2
  36. package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts.map +1 -1
  37. package/dist/pages/checkout/components/CheckoutSummaryColumn.js +4 -4
  38. package/package.json +1 -1
@@ -1,45 +1,61 @@
1
1
  import { calculatePriceForQuantity as e } from "../chunks/pkg/booking-engine/dist/utils/pricing-CqXJ5fMP.js";
2
- import { formatPriceMinor as t } from "./utils.js";
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 n = "EUR", r = 8, i = (e) => [...e].sort((e, t) => e.quantity - t.quantity), a = (e) => e.find((e) => e.currency?.trim())?.currency?.trim() || n, o = (e) => Math.abs(e) % 100 == 0 ? {
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
- } : {}, s = (e, r, { currency: i = n } = {}) => t(e, r, {
8
- currency: i,
9
- ...o(e)
10
- }), c = (e) => i((e ?? []).filter((e) => e.unit === "day" && e.quantity > 0)), l = (e, t, n) => e === 1 ? n("price_unit_day", { count: 1 }) : `${new Intl.NumberFormat(t, {
11
- maximumFractionDigits: 2,
12
- minimumFractionDigits: +!Number.isInteger(e)
13
- }).format(e)} ${n("price_unit_day", { count: e })}`;
14
- function u(t, n) {
15
- if (!Number.isInteger(n) || n <= 0) return null;
16
- let r = c(t);
17
- if (r.length === 0) return null;
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(r, n, "day");
35
+ return e(i, n, r);
20
36
  } catch {
21
37
  return null;
22
38
  }
23
39
  }
24
- function d(e, t) {
25
- let n = c(e);
26
- if (n.length === 0) return [];
27
- let i = a(n);
28
- return Array.from({ length: r }, (e, r) => {
29
- let a = r + 1, o = u(n, a) ?? 0, c = Math.ceil(o / a / 10) * 10;
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
- dayCount: a,
32
- totalPriceLabel: s(o, t, { currency: i }),
33
- perDayPriceLabel: s(c, t, { currency: i })
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 f(e, t, n) {
38
- let r = c(e), i = a(r);
39
- return r.map((e, a) => {
40
- let o = a > 0 ? r[a - 1] : void 0, c = o?.quantity ?? 0, u = o?.value ?? 0, d = e.quantity - c, f = e.value - u;
41
- return d <= 0 || f < 0 ? s(e.value, t, { currency: i }) : `${s(f, t, { currency: i })} / ${l(d, t, n)}`;
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 { d as buildDailyPriceRows, f as buildPriceTierLabels, u as calculateDailyPriceForQuantity, s as formatStorefrontPriceMinor };
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":"AAsMA,MAAM,CAAC,OAAO,UAAU,WAAW,4CAunBlC"}
1
+ {"version":3,"file":"BookingPage.d.ts","sourceRoot":"","sources":["../../src/pages/BookingPage.tsx"],"names":[],"mappings":"AAuMA,MAAM,CAAC,OAAO,UAAU,WAAW,4CA2nBlC"}