@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.
Files changed (53) hide show
  1. package/dist/components/BookingFlowPageLayout/index.d.ts +13 -0
  2. package/dist/components/BookingFlowPageLayout/index.d.ts.map +1 -0
  3. package/dist/components/BookingFlowPageLayout/index.js +35 -0
  4. package/dist/components/BookingPeriodSelector/components/BookingEndDateField.d.ts.map +1 -1
  5. package/dist/components/BookingPeriodSelector/components/BookingEndDateField.js +10 -33
  6. package/dist/components/BookingPeriodSelector/components/BookingStartDateField.d.ts.map +1 -1
  7. package/dist/components/BookingPeriodSelector/components/BookingStartDateField.js +1 -4
  8. package/dist/components/BookingPeriodSelector/index.d.ts +1 -1
  9. package/dist/components/BookingPeriodSelector/index.d.ts.map +1 -1
  10. package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts +0 -5
  11. package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts.map +1 -1
  12. package/dist/components/BookingPeriodSelector/useBookingPeriodController.js +150 -159
  13. package/dist/components/Footer/BusinessHours.d.ts +2 -1
  14. package/dist/components/Footer/BusinessHours.d.ts.map +1 -1
  15. package/dist/components/Footer/BusinessHours.js +19 -18
  16. package/dist/components/Footer/businessHoursStatus.d.ts +25 -0
  17. package/dist/components/Footer/businessHoursStatus.d.ts.map +1 -0
  18. package/dist/components/Footer/businessHoursStatus.js +99 -0
  19. package/dist/components/Footer/businessHoursUtils.d.ts +2 -1
  20. package/dist/components/Footer/businessHoursUtils.d.ts.map +1 -1
  21. package/dist/components/Footer/businessHoursUtils.js +52 -45
  22. package/dist/components/Footer/index.d.ts +2 -1
  23. package/dist/components/Footer/index.d.ts.map +1 -1
  24. package/dist/components/Footer/index.js +26 -25
  25. package/dist/components/Layout/index.d.ts.map +1 -1
  26. package/dist/components/Layout/index.js +2 -1
  27. package/dist/components/StorefrontCancellationPolicyNotice/index.d.ts.map +1 -1
  28. package/dist/components/StorefrontCancellationPolicyNotice/index.js +89 -86
  29. package/dist/components/StorefrontCartPanel/index.js +4 -4
  30. package/dist/components/StorefrontInsuranceNotice/index.d.ts +2 -1
  31. package/dist/components/StorefrontInsuranceNotice/index.d.ts.map +1 -1
  32. package/dist/components/StorefrontInsuranceNotice/index.js +155 -162
  33. package/dist/i18n/en.d.ts +7 -1
  34. package/dist/i18n/en.d.ts.map +1 -1
  35. package/dist/i18n/en.js +8 -2
  36. package/dist/i18n/fr.d.ts +7 -1
  37. package/dist/i18n/fr.d.ts.map +1 -1
  38. package/dist/i18n/fr.js +8 -2
  39. package/dist/index.d.ts +24 -9
  40. package/dist/index.js +66 -66
  41. package/dist/lib/pricing.d.ts.map +1 -1
  42. package/dist/lib/pricing.js +3 -1
  43. package/dist/lib/products.d.ts +6 -0
  44. package/dist/lib/products.d.ts.map +1 -1
  45. package/dist/lib/products.js +36 -32
  46. package/dist/pages/BookingPage.d.ts.map +1 -1
  47. package/dist/pages/BookingPage.js +306 -335
  48. package/dist/pages/CheckoutPage.d.ts.map +1 -1
  49. package/dist/pages/CheckoutPage.js +154 -168
  50. package/dist/pages/HomePage.d.ts.map +1 -1
  51. package/dist/pages/HomePage.js +435 -378
  52. package/dist/storefront.css +1 -1
  53. package/package.json +1 -1
@@ -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, i = {
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
- }, a = /[\u0300-\u036f]/g, o = /[^a-z0-9]+/g, s = /^-+|-+$/g, c = (e) => e.normalize("NFKD").replace(a, "").toLowerCase().replace(o, "-").replace(s, ""), l = (e) => e?.en?.value.trim() || (Object.values(e ?? {}).find((e) => e.value.trim().length > 0)?.value.trim() ?? ""), u = (e, t) => {
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
- }, d = ({ id: e, productShortCode: t, name: n }) => {
23
- let r = c(typeof t == "string" ? t.trim() : ""), i = c(l(n)), a = c(e);
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
- }, f = (e, t) => `${e}__variant__${t}`, p = (t, n) => {
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: f(r, i),
33
+ id: p(r, i),
30
34
  checkoutProductId: r,
31
35
  representedVariantId: i,
32
- name: u(t.name, a),
36
+ name: d(t.name, a),
33
37
  productVariants: [n]
34
38
  };
35
- }, m = (e) => e.flatMap((e) => {
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) => p(e, t));
39
- }), h = (e) => ({
40
- bikes: m(e.bikes),
41
- accessories: m(e.accessories)
42
- }), g = (e) => e === "e-bike" ? 0 : e === "bike" ? 1 : e === "accessory" ? 2 : 3, _ = (e) => e.externalId?.trim() || e.id?.trim() || "";
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: v(e),
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 b(e, t = "day") {
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 x(e) {
71
- return b(e, "day");
74
+ function S(e) {
75
+ return x(e, "day");
72
76
  }
73
- function S(e, t, n = {}) {
74
- let r = g(e.kind), i = g(t.kind);
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 = b(t.prices, o) - b(e.prices, o);
79
- return s === 0 ? _(e).localeCompare(_(t)) : s;
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 C(e, t, n = {}) {
82
- return S({
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 w(e, t, n = {}) {
91
- return S({
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 T = (e) => e.map((e) => ({
103
+ var E = (e) => e.map((e) => ({
100
104
  ...e,
101
105
  kind: e.kind === "e-bike" ? "e-bike" : "bike"
102
- })), E = (e) => e.map((e) => ({
106
+ })), D = (e) => e.map((e) => ({
103
107
  ...e,
104
108
  kind: "accessory"
105
- })), D = (e, t) => t.bikes.find((t) => t.id === e) || (t.accessories.find((t) => t.id === e) ?? null), O = (e, t) => t.bikes.find((t) => t.slug === e) || (t.accessories.find((t) => t.slug === e) ?? null), k = (e) => e.checkoutProductId?.trim() || e.id, A = (e) => e.representedVariantId?.trim() || void 0;
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, d as buildStorefrontProductSlug, f as buildVariantStorefrontProductId, S as compareCatalogProducts, w as compareStorefrontAccessoryProducts, C as compareStorefrontBikeProducts, D as findStorefrontProduct, O as findStorefrontProductBySlug, b as getCatalogProductBaseRateMinor, y as getCatalogProductPaginationSort, v as getCatalogProductSortFieldForPriceUnit, x as getStorefrontBaseDailyRateMinor, k as getStorefrontCheckoutProductId, n as getStorefrontProductSelectionDisplayName, A as getStorefrontRepresentedVariantId, E as toStorefrontAccessoryProducts, T as toStorefrontBikeProducts, m as toStorefrontBookingProducts, h as toStorefrontBookingProductsCollections };
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,4CAsrBlC"}
1
+ {"version":3,"file":"BookingPage.d.ts","sourceRoot":"","sources":["../../src/pages/BookingPage.tsx"],"names":[],"mappings":"AA6MA,MAAM,CAAC,OAAO,UAAU,WAAW,4CAoqBlC"}