@loczer/storefront-sdk 0.198.0 → 0.199.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 (45) hide show
  1. package/dist/StorefrontContext.d.ts +483 -0
  2. package/dist/StorefrontContext.d.ts.map +1 -0
  3. package/dist/StorefrontContext.js +39 -0
  4. package/dist/StorefrontProvider.d.ts +6 -486
  5. package/dist/StorefrontProvider.d.ts.map +1 -1
  6. package/dist/StorefrontProvider.js +34 -67
  7. package/dist/components/AboutSection/index.js +5 -5
  8. package/dist/components/BikeProductCard/index.d.ts.map +1 -1
  9. package/dist/components/BikeProductCard/index.js +27 -27
  10. package/dist/components/BookingBikeVariantDialog/index.js +14 -8
  11. package/dist/components/ContactSection/index.js +107 -107
  12. package/dist/components/ContractSaleDocument/Invoice.d.ts.map +1 -1
  13. package/dist/components/ContractSaleDocument/Invoice.js +117 -111
  14. package/dist/components/Header/index.js +4 -4
  15. package/dist/components/Layout/index.d.ts.map +1 -1
  16. package/dist/components/Layout/index.js +47 -40
  17. package/dist/components/ProductPriceBadge/index.d.ts +2 -1
  18. package/dist/components/ProductPriceBadge/index.d.ts.map +1 -1
  19. package/dist/components/ProductPriceBadge/index.js +72 -70
  20. package/dist/components/TestimonialsSection/index.js +1 -1
  21. package/dist/i18n/en.d.ts +1 -0
  22. package/dist/i18n/en.d.ts.map +1 -1
  23. package/dist/i18n/en.js +1 -0
  24. package/dist/i18n/fr.d.ts +1 -0
  25. package/dist/i18n/fr.d.ts.map +1 -1
  26. package/dist/i18n/fr.js +1 -0
  27. package/dist/index.d.ts +15 -2
  28. package/dist/index.js +59 -58
  29. package/dist/lib/cartSummary.js +7 -7
  30. package/dist/lib/products.d.ts +6 -0
  31. package/dist/lib/products.d.ts.map +1 -1
  32. package/dist/lib/products.js +36 -32
  33. package/dist/lib/toast.d.ts +9 -0
  34. package/dist/lib/toast.d.ts.map +1 -0
  35. package/dist/lib/toast.js +13 -0
  36. package/dist/pages/BookingPage.d.ts.map +1 -1
  37. package/dist/pages/BookingPage.js +143 -138
  38. package/dist/pages/CheckoutPage.js +217 -217
  39. package/dist/pages/CheckoutPaymentPage.js +124 -124
  40. package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
  41. package/dist/pages/ContractSaleDocumentPage.js +83 -83
  42. package/dist/pages/HomePage.js +6 -3
  43. package/dist/pages/ProductPage.d.ts.map +1 -1
  44. package/dist/pages/ProductPage.js +177 -165
  45. package/package.json +2 -1
@@ -1,19 +1,19 @@
1
1
  import { getProductVariantAttributeValue as e, getProductVariantDisplay as t } from "./productVariants.js";
2
- import { getStorefrontCheckoutProductId as n } from "./products.js";
3
- import { resolveStorefrontCartItemProduct as r } from "./cart.js";
4
- import { calculateDailyPriceForQuantity as i } from "./pricing.js";
5
- import { getLocalizedValue as a } from "../localization.js";
2
+ import { getLocalizedValue as n } from "../localization.js";
3
+ import { getStorefrontCheckoutProductId as r } from "./products.js";
4
+ import { resolveStorefrontCartItemProduct as i } from "./cart.js";
5
+ import { calculateDailyPriceForQuantity as a } from "./pricing.js";
6
6
  //#region src/lib/cartSummary.ts
7
7
  var o = (o) => {
8
8
  let s = typeof o.estimatedDays == "number" && Number.isFinite(o.estimatedDays) && o.estimatedDays > 0 ? Math.max(1, Math.floor(o.estimatedDays)) : void 0, c = o.items.map((c) => {
9
- let l = r(c, o.products);
9
+ let l = i(c, o.products);
10
10
  if (!l) return null;
11
11
  let u = c.productVariantId ? l.productVariants?.find((e) => e.id === c.productVariantId) : void 0;
12
12
  if (c.productVariantId && !u) return null;
13
- let d = u ? t(u) : void 0, f = l.prices ?? [], p = i(f, 1) ?? 0, m = a(l.name, o.language, o.fallbackLanguage), h = l.storefrontDisplayMode === "variants_as_products" && d?.label ? `${m} ${d.label}`.trim() : m, g = a(l.warning, o.language, o.fallbackLanguage).trim(), _ = u ? !!e(u, "size") : !1, v = typeof s == "number" ? i(f, s) ?? p * s : void 0, y = typeof v == "number" ? v * c.quantity : void 0;
13
+ let d = u ? t(u) : void 0, f = l.prices ?? [], p = a(f, 1) ?? 0, m = n(l.name, o.language, o.fallbackLanguage), h = l.storefrontDisplayMode === "variants_as_products" && d?.label ? `${m} ${d.label}`.trim() : m, g = n(l.warning, o.language, o.fallbackLanguage).trim(), _ = u ? !!e(u, "size") : !1, v = typeof s == "number" ? a(f, s) ?? p * s : void 0, y = typeof v == "number" ? v * c.quantity : void 0;
14
14
  return {
15
15
  ...c,
16
- checkoutProductId: n(l),
16
+ checkoutProductId: r(l),
17
17
  productName: h,
18
18
  ...g ? { productWarning: g } : {},
19
19
  productVariantLabel: d?.label,
@@ -7,6 +7,12 @@ export type AccessoryProduct = StorefrontPublicAccessoryProduct & {
7
7
  kind: "accessory";
8
8
  };
9
9
  export type StorefrontProduct = BikeProduct | AccessoryProduct;
10
+ export declare const getStorefrontProductSelectionDisplayName: ({ product, productVariantId, language, fallbackLanguage, }: {
11
+ product: StorefrontProduct;
12
+ productVariantId?: string;
13
+ language: string;
14
+ fallbackLanguage?: string;
15
+ }) => string;
10
16
  export declare const CATALOG_PRODUCT_BASE_RATE_UNSET = -1;
11
17
  export type CatalogProductSortPriceUnit = StorefrontPublicProductPrice["unit"];
12
18
  export type CatalogProductSortField = "kind" | "assetRelScore" | "baseHourlyRateMinor" | "baseHalfDayRateMinor" | "baseDailyRateMinor" | "baseWeeklyRateMinor" | "baseMonthlyRateMinor" | "externalId";
@@ -1 +1 @@
1
- {"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../src/lib/products.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,EAChC,2BAA2B,EAC3B,4BAA4B,EAE7B,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGtD,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,2BAA2B,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,C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,EAAE,KAC9C,gBAAgB,EAKlB,CAAA;AAED,eAAO,MAAM,qBAAqB,GAChC,IAAI,MAAM,EACV,UAAU,6BAA6B,KACtC,iBAAiB,GAAG,IAKtB,CAAA;AAED,eAAO,MAAM,2BAA2B,GACtC,MAAM,MAAM,EACZ,UAAU,6BAA6B,KACtC,iBAAiB,GAAG,IAKtB,CAAA;AAED,eAAO,MAAM,8BAA8B,GAAI,SAAS,IAAI,CAAC,iBAAiB,EAAE,IAAI,GAAG,mBAAmB,CAAC,KAAG,MAC7D,CAAA;AAEjD,eAAO,MAAM,iCAAiC,GAC5C,SAAS,IAAI,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,KACvD,MAAM,GAAG,SAGX,CAAA"}
@@ -1,12 +1,16 @@
1
1
  import { getStorefrontProductVariantDisplay as e } from "./productVariants.js";
2
+ import { getLocalizedValue as t } from "../localization.js";
2
3
  //#region src/lib/products.ts
3
- var t = -1, n = {
4
+ var n = ({ product: n, productVariantId: r, language: i, fallbackLanguage: a }) => {
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
+ return !c || l ? o : `${o} ${c}`.trim();
7
+ }, r = -1, i = {
4
8
  hour: "baseHourlyRateMinor",
5
9
  half_day: "baseHalfDayRateMinor",
6
10
  day: "baseDailyRateMinor",
7
11
  week: "baseWeeklyRateMinor",
8
12
  month: "baseMonthlyRateMinor"
9
- }, r = /[\u0300-\u036f]/g, i = /[^a-z0-9]+/g, a = /^-+|-+$/g, o = (e) => e.normalize("NFKD").replace(r, "").toLowerCase().replace(i, "-").replace(a, ""), s = (e) => e?.en?.value.trim() || (Object.values(e ?? {}).find((e) => e.value.trim().length > 0)?.value.trim() ?? ""), c = (e, t) => {
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) => {
10
14
  let n = t.trim();
11
15
  return n ? Object.fromEntries(Object.entries(e).map(([e, t]) => {
12
16
  let r = t.value.trim();
@@ -15,31 +19,31 @@ var t = -1, n = {
15
19
  value: r ? `${r} ${n}`.trim() : t.value
16
20
  }];
17
21
  })) : e;
18
- }, l = ({ id: e, productShortCode: t, name: n }) => {
19
- let r = o(typeof t == "string" ? t.trim() : ""), i = o(s(n)), a = o(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);
20
24
  return `product-${[r, i].filter((e) => e.length > 0).join("-") || a || "item"}`;
21
- }, u = (e, t) => `${e}__variant__${t}`, d = (t, n) => {
25
+ }, f = (e, t) => `${e}__variant__${t}`, p = (t, n) => {
22
26
  let r = t.checkoutProductId?.trim() || t.id, i = n.id.trim(), { label: a } = e(n);
23
27
  return {
24
28
  ...t,
25
- id: u(r, i),
29
+ id: f(r, i),
26
30
  checkoutProductId: r,
27
31
  representedVariantId: i,
28
- name: c(t.name, a),
32
+ name: u(t.name, a),
29
33
  productVariants: [n]
30
34
  };
31
- }, f = (e) => e.flatMap((e) => {
35
+ }, m = (e) => e.flatMap((e) => {
32
36
  if (e.storefrontDisplayMode !== "variants_as_products") return [e];
33
37
  let t = e.productVariants ?? [];
34
- return t.length === 0 ? [e] : t.map((t) => d(e, t));
35
- }), p = (e) => ({
36
- bikes: f(e.bikes),
37
- accessories: f(e.accessories)
38
- }), m = (e) => e === "e-bike" ? 0 : e === "bike" ? 1 : e === "accessory" ? 2 : 3, h = (e) => e.externalId?.trim() || e.id?.trim() || "";
39
- function g(e) {
40
- return n[e];
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];
41
45
  }
42
- function _(e) {
46
+ function y(e) {
43
47
  return [
44
48
  {
45
49
  field: "kind",
@@ -50,7 +54,7 @@ function _(e) {
50
54
  order: "desc"
51
55
  },
52
56
  {
53
- field: g(e),
57
+ field: v(e),
54
58
  order: "desc"
55
59
  },
56
60
  {
@@ -59,23 +63,23 @@ function _(e) {
59
63
  }
60
64
  ];
61
65
  }
62
- function v(e, t = "day") {
66
+ function b(e, t = "day") {
63
67
  let n = e?.find((e) => e.unit === t && e.quantity === 1);
64
68
  return n ? n.value : -1;
65
69
  }
66
- function y(e) {
67
- return v(e, "day");
70
+ function x(e) {
71
+ return b(e, "day");
68
72
  }
69
- function b(e, t, n = {}) {
70
- let r = m(e.kind), i = m(t.kind);
73
+ function S(e, t, n = {}) {
74
+ let r = g(e.kind), i = g(t.kind);
71
75
  if (r !== i) return r - i;
72
76
  let a = (t.assetRelScore ?? 0) - (e.assetRelScore ?? 0);
73
77
  if (a !== 0) return a;
74
- let o = n.priceUnit ?? "day", s = v(t.prices, o) - v(e.prices, o);
75
- return s === 0 ? h(e).localeCompare(h(t)) : s;
78
+ let o = n.priceUnit ?? "day", s = b(t.prices, o) - b(e.prices, o);
79
+ return s === 0 ? _(e).localeCompare(_(t)) : s;
76
80
  }
77
- function x(e, t, n = {}) {
78
- return b({
81
+ function C(e, t, n = {}) {
82
+ return S({
79
83
  ...e,
80
84
  kind: e.kind === "e-bike" ? "e-bike" : "bike"
81
85
  }, {
@@ -83,8 +87,8 @@ function x(e, t, n = {}) {
83
87
  kind: t.kind === "e-bike" ? "e-bike" : "bike"
84
88
  }, n);
85
89
  }
86
- function S(e, t, n = {}) {
87
- return b({
90
+ function w(e, t, n = {}) {
91
+ return S({
88
92
  ...e,
89
93
  kind: "accessory"
90
94
  }, {
@@ -92,12 +96,12 @@ function S(e, t, n = {}) {
92
96
  kind: "accessory"
93
97
  }, n);
94
98
  }
95
- var C = (e) => e.map((e) => ({
99
+ var T = (e) => e.map((e) => ({
96
100
  ...e,
97
101
  kind: e.kind === "e-bike" ? "e-bike" : "bike"
98
- })), w = (e) => e.map((e) => ({
102
+ })), E = (e) => e.map((e) => ({
99
103
  ...e,
100
104
  kind: "accessory"
101
- })), T = (e, t) => t.bikes.find((t) => t.id === e) || (t.accessories.find((t) => t.id === e) ?? null), E = (e, t) => t.bikes.find((t) => t.slug === e) || (t.accessories.find((t) => t.slug === e) ?? null), D = (e) => e.checkoutProductId?.trim() || e.id, O = (e) => e.representedVariantId?.trim() || void 0;
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;
102
106
  //#endregion
103
- export { t as CATALOG_PRODUCT_BASE_RATE_UNSET, l as buildStorefrontProductSlug, u as buildVariantStorefrontProductId, b as compareCatalogProducts, S as compareStorefrontAccessoryProducts, x as compareStorefrontBikeProducts, T as findStorefrontProduct, E as findStorefrontProductBySlug, v as getCatalogProductBaseRateMinor, _ as getCatalogProductPaginationSort, g as getCatalogProductSortFieldForPriceUnit, y as getStorefrontBaseDailyRateMinor, D as getStorefrontCheckoutProductId, O as getStorefrontRepresentedVariantId, w as toStorefrontAccessoryProducts, C as toStorefrontBikeProducts, f as toStorefrontBookingProducts, p as toStorefrontBookingProductsCollections };
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 };
@@ -0,0 +1,9 @@
1
+ import { toast as sonnerToast, ExternalToast } from 'sonner';
2
+ export declare const STOREFRONT_TOASTER_ID = "loczer-storefront";
3
+ export declare const toast: {
4
+ dismiss: (id?: number | string) => string | number;
5
+ error: (message: Parameters<typeof sonnerToast.error>[0], options?: ExternalToast) => string | number;
6
+ loading: (message: Parameters<typeof sonnerToast.loading>[0], options?: ExternalToast) => string | number;
7
+ success: (message: Parameters<typeof sonnerToast.success>[0], options?: ExternalToast) => string | number;
8
+ };
9
+ //# sourceMappingURL=toast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../src/lib/toast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAA;AAGjE,eAAO,MAAM,qBAAqB,sBAAsB,CAAA;AAOxD,eAAO,MAAM,KAAK;;qBAEC,UAAU,CAAC,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,aAAa;uBAE9D,UAAU,CAAC,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,YAAY,aAAa;uBAElE,UAAU,CAAC,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,YAAY,aAAa;CAEtF,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { toast as e } from "sonner";
2
+ //#region src/lib/toast.ts
3
+ var t = "loczer-storefront", n = (e) => ({
4
+ ...e,
5
+ toasterId: t
6
+ }), r = {
7
+ dismiss: e.dismiss,
8
+ error: (t, r) => e.error(t, n(r)),
9
+ loading: (t, r) => e.loading(t, n(r)),
10
+ success: (t, r) => e.success(t, n(r))
11
+ };
12
+ //#endregion
13
+ export { t as STOREFRONT_TOASTER_ID, r as toast };
@@ -1 +1 @@
1
- {"version":3,"file":"BookingPage.d.ts","sourceRoot":"","sources":["../../src/pages/BookingPage.tsx"],"names":[],"mappings":"AAoMA,MAAM,CAAC,OAAO,UAAU,WAAW,4CAqnBlC"}
1
+ {"version":3,"file":"BookingPage.d.ts","sourceRoot":"","sources":["../../src/pages/BookingPage.tsx"],"names":[],"mappings":"AAsMA,MAAM,CAAC,OAAO,UAAU,WAAW,4CAunBlC"}