@loczer/storefront-sdk 0.182.0 → 0.184.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 (85) hide show
  1. package/dist/StorefrontProvider.d.ts +18 -15
  2. package/dist/StorefrontProvider.d.ts.map +1 -1
  3. package/dist/StorefrontProvider.js +24 -34
  4. package/dist/chunks/booking-engine/dist/models/{Product.shared-CJ6vPb6n.js → Product.shared-CTuk4fiR.js} +2 -2
  5. package/dist/chunks/booking-engine/dist/schemas/{base-asset-PqhtKnZA.js → base-asset-B_Dm8_Vk.js} +1 -1
  6. package/dist/chunks/booking-engine/dist/schemas/{base-booking-BM3jZzqu.js → base-booking-DW8AEPKo.js} +1 -1
  7. package/dist/chunks/booking-engine/dist/schemas/{base-product-BJd4ttMP.js → base-product-1H8l2aUv.js} +1 -1
  8. package/dist/chunks/booking-engine/dist/schemas/{cart-inputs-9vM8GCrc.js → cart-inputs-j1yWfJxO.js} +8 -5
  9. package/dist/chunks/booking-engine/dist/schemas-DftrSnTE.js +13 -0
  10. package/dist/chunks/ui/dist/Map/{MapContent--PwVTg2W.js → MapContent-QPkuTBvK.js} +2 -2
  11. package/dist/chunks/ui/dist/Map/{constants-DqrK8UkE.js → constants-BNmiJXfg.js} +1 -1
  12. package/dist/chunks/ui/dist/{Map-B45AxZ-D.js → Map-BXmRf5Ep.js} +3 -3
  13. package/dist/chunks/ui/dist/static/strings-1T2w7LqX.js +4 -0
  14. package/dist/components/AboutSection/index.d.ts +1 -6
  15. package/dist/components/AboutSection/index.d.ts.map +1 -1
  16. package/dist/components/AboutSection/index.js +43 -39
  17. package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts.map +1 -1
  18. package/dist/components/BookingPeriodSelector/useBookingPeriodController.js +152 -148
  19. package/dist/components/ContactSection/index.d.ts +1 -3
  20. package/dist/components/ContactSection/index.d.ts.map +1 -1
  21. package/dist/components/ContactSection/index.js +222 -164
  22. package/dist/components/Footer/index.d.ts +3 -4
  23. package/dist/components/Footer/index.d.ts.map +1 -1
  24. package/dist/components/Footer/index.js +98 -69
  25. package/dist/components/FulfillmentSection/index.d.ts.map +1 -1
  26. package/dist/components/FulfillmentSection/index.js +17 -16
  27. package/dist/components/Header/index.d.ts +1 -3
  28. package/dist/components/Header/index.d.ts.map +1 -1
  29. package/dist/components/Header/index.js +77 -72
  30. package/dist/components/Layout/index.d.ts +3 -1
  31. package/dist/components/Layout/index.d.ts.map +1 -1
  32. package/dist/components/Layout/index.js +45 -47
  33. package/dist/components/Map/index.js +1 -1
  34. package/dist/components/ProductPriceBadge/index.d.ts.map +1 -1
  35. package/dist/components/ProductPriceBadge/index.js +68 -60
  36. package/dist/i18n/I18nProvider.js +1 -1
  37. package/dist/i18n/fr.js +1 -1
  38. package/dist/index.d.ts +159 -150
  39. package/dist/index.js +64 -64
  40. package/dist/lib/booking.d.ts +3 -0
  41. package/dist/lib/booking.d.ts.map +1 -1
  42. package/dist/lib/booking.js +76 -74
  43. package/dist/lib/cart.d.ts +4 -1
  44. package/dist/lib/cart.d.ts.map +1 -1
  45. package/dist/lib/cart.js +64 -40
  46. package/dist/lib/cartSummary.d.ts.map +1 -1
  47. package/dist/lib/cartSummary.js +4 -3
  48. package/dist/lib/checkoutSubmit.d.ts.map +1 -1
  49. package/dist/lib/checkoutSubmit.js +36 -36
  50. package/dist/lib/productVariants.d.ts.map +1 -1
  51. package/dist/lib/productVariants.js +20 -9
  52. package/dist/lib/storefrontAddress.d.ts +5 -0
  53. package/dist/lib/storefrontAddress.d.ts.map +1 -0
  54. package/dist/lib/storefrontAddress.js +24 -0
  55. package/dist/lib/storefrontAvailability.d.ts +6 -6
  56. package/dist/lib/storefrontContact.d.ts +10 -0
  57. package/dist/lib/storefrontContact.d.ts.map +1 -0
  58. package/dist/lib/storefrontContact.js +24 -0
  59. package/dist/lib/storefrontMissingValues.d.ts +5 -0
  60. package/dist/lib/storefrontMissingValues.d.ts.map +1 -0
  61. package/dist/lib/storefrontMissingValues.js +4 -0
  62. package/dist/lib/storefrontProducts.d.ts +23 -21
  63. package/dist/lib/storefrontProducts.d.ts.map +1 -1
  64. package/dist/lib/storefrontProducts.js +7 -5
  65. package/dist/lib/whatsapp.d.ts +8 -6
  66. package/dist/lib/whatsapp.d.ts.map +1 -1
  67. package/dist/lib/whatsapp.js +16 -43
  68. package/dist/pages/BookingPage.js +36 -36
  69. package/dist/pages/HomePage.d.ts.map +1 -1
  70. package/dist/pages/HomePage.js +126 -128
  71. package/dist/pages/ProductPage.js +160 -160
  72. package/dist/storefront.css +1 -1
  73. package/dist/storefrontSchemas.d.ts +14 -12
  74. package/dist/storefrontSchemas.d.ts.map +1 -1
  75. package/dist/storefrontSchemas.js +3 -2
  76. package/dist/ui/radio-group.d.ts +1 -1
  77. package/package.json +7 -6
  78. package/dist/chunks/booking-engine/dist/schemas-BNlwu75Z.js +0 -13
  79. package/dist/chunks/ui/dist/static/strings-CPnO-KbA.js +0 -4
  80. package/dist/data/config.d.ts +0 -15
  81. package/dist/data/config.d.ts.map +0 -1
  82. package/dist/data/config.js +0 -24
  83. package/dist/static/strings.d.ts +0 -2
  84. package/dist/static/strings.d.ts.map +0 -1
  85. package/dist/static/strings.js +0 -4
package/dist/lib/cart.js CHANGED
@@ -1,10 +1,17 @@
1
- import { createContext as e, useCallback as t, useContext as n, useEffect as r, useMemo as i, useState as a } from "react";
2
- import { jsx as o } from "react/jsx-runtime";
1
+ import { getStorefrontCheckoutProductId as e } from "./products.js";
2
+ import { createContext as t, useCallback as n, useContext as r, useEffect as i, useMemo as a, useState as o } from "react";
3
+ import { jsx as s } from "react/jsx-runtime";
3
4
  //#region src/lib/cart.tsx
4
- var s = e(void 0), c = "loczer.storefront.cart.v5", l = (e) => {
5
+ var c = t(void 0), l = "loczer.storefront.cart.v5", u = (e) => {
5
6
  let t = e.productVariantId ? `variant:${e.productVariantId}` : "product";
6
7
  return `${e.kind}:${e.productId}:${t}`.toLowerCase();
7
- }, u = (e) => {
8
+ }, d = (t, n) => [...n.bikes, ...n.accessories].find((n) => {
9
+ let r = n.id === t.productId || e(n) === t.productId, i = !t.productVariantId || n.productVariants?.some((e) => e.id === t.productVariantId);
10
+ return r && n.kind === t.kind && i;
11
+ }) ?? null, f = (e, t) => {
12
+ let n = e.filter((e) => d(e, t) !== null);
13
+ return n.length === e.length ? e : n;
14
+ }, p = (e) => {
8
15
  if (!e) return { items: [] };
9
16
  try {
10
17
  let t = JSON.parse(e);
@@ -18,7 +25,7 @@ var s = e(void 0), c = "loczer.storefront.cart.v5", l = (e) => {
18
25
  quantity: a
19
26
  };
20
27
  return {
21
- key: l(o),
28
+ key: u(o),
22
29
  ...o
23
30
  };
24
31
  }).filter((e) => e !== null) };
@@ -26,22 +33,36 @@ var s = e(void 0), c = "loczer.storefront.cart.v5", l = (e) => {
26
33
  return { items: [] };
27
34
  }
28
35
  };
29
- function d({ storeSlug: e, children: n }) {
30
- let d = `${c}.${e || "unknown"}`, [f, p] = a(!1), [m, h] = a({ items: [] });
31
- r(() => {
36
+ function m({ storeSlug: e, products: t, children: r }) {
37
+ let d = `${l}.${e || "unknown"}`, [m, h] = o(!1), [g, _] = o({ items: [] }), v = t.bikes, y = t.accessories;
38
+ i(() => {
32
39
  if (typeof window > "u") return;
33
- let e = u(window.localStorage.getItem(d));
34
- h((t) => !f && t.items.length > 0 ? t : e), p(!0);
35
- }, [d]), r(() => {
36
- typeof window > "u" || f && window.localStorage.setItem(d, JSON.stringify(m));
40
+ let e = p(window.localStorage.getItem(d));
41
+ _((t) => !m && t.items.length > 0 ? t : e), h(!0);
42
+ }, [d]), i(() => {
43
+ typeof window > "u" || m && window.localStorage.setItem(d, JSON.stringify(g));
37
44
  }, [
38
- f,
39
45
  m,
46
+ g,
40
47
  d
48
+ ]), i(() => {
49
+ if (!m) return;
50
+ let e = {
51
+ bikes: v,
52
+ accessories: y
53
+ };
54
+ _((t) => {
55
+ let n = f(t.items, e);
56
+ return n === t.items ? t : { items: n };
57
+ });
58
+ }, [
59
+ y,
60
+ v,
61
+ m
41
62
  ]);
42
- let g = t((e) => {
43
- h((t) => {
44
- let n = e.key?.trim() ? e.key.trim().toLowerCase() : l(e), r = Math.max(1, Math.floor(e.quantity));
63
+ let b = n((e) => {
64
+ _((t) => {
65
+ let n = e.key?.trim() ? e.key.trim().toLowerCase() : u(e), r = Math.max(1, Math.floor(e.quantity));
45
66
  return t.items.find((e) => e.key === n) ? { items: t.items.map((e) => e.key === n ? {
46
67
  ...e,
47
68
  quantity: e.quantity + r
@@ -53,42 +74,45 @@ function d({ storeSlug: e, children: n }) {
53
74
  quantity: r
54
75
  }] };
55
76
  });
56
- }, []), _ = t((e, t) => {
57
- h((n) => {
77
+ }, []), x = n((e, t) => {
78
+ _((n) => {
58
79
  let r = Math.max(0, Math.floor(t));
59
80
  return r <= 0 ? { items: n.items.filter((t) => t.key !== e) } : { items: n.items.map((t) => t.key === e ? {
60
81
  ...t,
61
82
  quantity: r
62
83
  } : t) };
63
84
  });
64
- }, []), v = t((e) => {
65
- h((t) => ({ items: t.items.filter((t) => t.key !== e) }));
66
- }, []), y = t(() => {
67
- h({ items: [] });
68
- }, []), b = i(() => m.items.reduce((e, t) => e + t.quantity, 0), [m.items]), x = i(() => ({
69
- items: m.items,
70
- itemCount: b,
71
- addItem: g,
72
- setQuantity: _,
73
- removeItem: v,
74
- clear: y
85
+ }, []), S = n((e) => {
86
+ _((t) => ({ items: t.items.filter((t) => t.key !== e) }));
87
+ }, []), C = n(() => {
88
+ _({ items: [] });
89
+ }, []), w = f(g.items, {
90
+ bikes: v,
91
+ accessories: y
92
+ }), T = w.reduce((e, t) => e + t.quantity, 0), E = a(() => ({
93
+ items: w,
94
+ itemCount: T,
95
+ addItem: b,
96
+ setQuantity: x,
97
+ removeItem: S,
98
+ clear: C
75
99
  }), [
76
- g,
77
- y,
78
100
  b,
79
- v,
80
- _,
81
- m.items
101
+ C,
102
+ T,
103
+ w,
104
+ S,
105
+ x
82
106
  ]);
83
- return /* @__PURE__ */ o(s.Provider, {
84
- value: x,
85
- children: n
107
+ return /* @__PURE__ */ s(c.Provider, {
108
+ value: E,
109
+ children: r
86
110
  });
87
111
  }
88
- var f = () => {
89
- let e = n(s);
112
+ var h = () => {
113
+ let e = r(c);
90
114
  if (!e) throw Error("useStorefrontCart must be used within StorefrontCartProvider");
91
115
  return e;
92
116
  };
93
117
  //#endregion
94
- export { d as StorefrontCartProvider, f as useStorefrontCart };
118
+ export { m as StorefrontCartProvider, d as resolveStorefrontCartItemProduct, h as useStorefrontCart };
@@ -1 +1 @@
1
- {"version":3,"file":"cartSummary.d.ts","sourceRoot":"","sources":["../../src/lib/cartSummary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAA;AAE3E,OAAO,EAAyD,KAAK,6BAA6B,EAAE,MAAM,YAAY,CAAA;AAKtH,MAAM,MAAM,yBAAyB,GAAG,kBAAkB,GAAG;IAC3D,iBAAiB,EAAE,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,yBAAyB,CAAC,EAAE,MAAM,CAAA;IAClC,oBAAoB,EAAE,OAAO,CAAA;IAC7B,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,kBAAkB,CAAC,EAAE,WAAW,GAAG,WAAW,GAAG,cAAc,CAAA;IAC/D,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,iBAAiB,CAAC,EAAE,2BAA2B,CAAA;CAChD,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,yBAAyB,EAAE,CAAA;IAClC,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,CAAC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,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,0BAA0B,GAAI,QAAQ;IACjD,KAAK,EAAE,kBAAkB,EAAE,CAAA;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,6BAA6B,CAAA;IACvC,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,KAAG,qBAoEH,CAAA"}
@@ -1,18 +1,19 @@
1
1
  import { getProductVariantAttributeValue as e, getProductVariantDisplay as t } from "./productVariants.js";
2
- import { findStorefrontProduct as n, getStorefrontCheckoutProductId as r } from "./products.js";
2
+ import { getStorefrontCheckoutProductId as n } from "./products.js";
3
+ import { resolveStorefrontCartItemProduct as r } from "./cart.js";
3
4
  import { calculateDailyPriceForQuantity as i } from "./pricing.js";
4
5
  import { getLocalizedValue as a } from "../localization.js";
5
6
  //#region src/lib/cartSummary.ts
6
7
  var o = (o) => {
7
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) => {
8
- let l = n(c.productId, o.products);
9
+ let l = r(c, o.products);
9
10
  if (!l) return null;
10
11
  let u = c.productVariantId ? l.productVariants?.find((e) => e.id === c.productVariantId) : void 0;
11
12
  if (c.productVariantId && !u) return null;
12
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
14
  return {
14
15
  ...c,
15
- checkoutProductId: r(l),
16
+ checkoutProductId: n(l),
16
17
  productName: h,
17
18
  ...g ? { productWarning: g } : {},
18
19
  productVariantLabel: d?.label,
@@ -1 +1 @@
1
- {"version":3,"file":"checkoutSubmit.d.ts","sourceRoot":"","sources":["../../src/lib/checkoutSubmit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AASvB,eAAO,MAAM,KAAK,2CAA2C,CAAA;AAE7D,eAAO,MAAM,yBAAyB;;;;;iBAKpC,CAAA;AACF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAI3E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkB5B,CAAA;AAEF,eAAO,MAAM,yBAAyB,GACpC,SAAS;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,EACxD,KAAK,CAAC,CAAC,aAAa,SAWrB,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA2D,CAAA;AACrF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAE1D,eAAO,MAAM,cAAc;;;;;;;;;;iBAYzB,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA"}
1
+ {"version":3,"file":"checkoutSubmit.d.ts","sourceRoot":"","sources":["../../src/lib/checkoutSubmit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,eAAO,MAAM,KAAK,2CAA2C,CAAA;AAE7D,eAAO,MAAM,yBAAyB;;;;;iBAKpC,CAAA;AACF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAI3E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkB5B,CAAA;AAEF,eAAO,MAAM,yBAAyB,GACpC,SAAS;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,EACxD,KAAK,CAAC,CAAC,aAAa,SAWrB,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA2D,CAAA;AACrF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAE1D,eAAO,MAAM,cAAc;;;;;;;;;;iBAYzB,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA"}
@@ -1,46 +1,46 @@
1
- import { productKindSchema as e } from "../chunks/booking-engine/dist/models/Product.shared-CJ6vPb6n.js";
2
- import { bookingScheduleInputSchema as t } from "../chunks/booking-engine/dist/schemas/cart-inputs-9vM8GCrc.js";
3
- import "../chunks/booking-engine/dist/schemas-BNlwu75Z.js";
4
- import { storefrontFulfillmentModeSchema as n } from "../storefrontSchemas.js";
5
- import { z as r } from "zod";
1
+ import { productKindSchema as e } from "../chunks/booking-engine/dist/models/Product.shared-CTuk4fiR.js";
2
+ import { DEFAULT_BOOKING_DELIVERY_OPTION as t, bookingScheduleInputSchema as n } from "../chunks/booking-engine/dist/schemas/cart-inputs-j1yWfJxO.js";
3
+ import "../chunks/booking-engine/dist/schemas-DftrSnTE.js";
4
+ import { storefrontFulfillmentModeSchema as r } from "../storefrontSchemas.js";
5
+ import { z as i } from "zod";
6
6
  //#region src/lib/checkoutSubmit.ts
7
- var i = "/api/public/storefront/checkout/submit", a = r.object({
7
+ var a = "/api/public/storefront/checkout/submit", o = i.object({
8
8
  kind: e,
9
- productId: r.string().trim().min(1),
10
- productVariantId: r.string().trim().min(1).optional(),
11
- quantity: r.number().int().positive()
12
- }), o = r.object({
13
- storeSlug: r.string().trim().min(1).toLowerCase(),
14
- schedule: t,
15
- fulfillment: n.default("pickup"),
16
- startAddress: r.string().trim().max(500).optional(),
17
- endAddress: r.string().trim().max(500).optional(),
18
- couponCode: r.string().trim().max(64).optional().or(r.literal("")),
19
- couponAutoApplied: r.boolean().optional(),
20
- customer: r.object({
21
- fullName: r.string().trim().min(2),
22
- email: r.string().trim().email(),
23
- phone: r.string().trim().min(6),
24
- notes: r.string().trim().max(2e3).optional().or(r.literal(""))
9
+ productId: i.string().trim().min(1),
10
+ productVariantId: i.string().trim().min(1).optional(),
11
+ quantity: i.number().int().positive()
12
+ }), s = i.object({
13
+ storeSlug: i.string().trim().min(1).toLowerCase(),
14
+ schedule: n,
15
+ fulfillment: r.default(t),
16
+ startAddress: i.string().trim().max(500).optional(),
17
+ endAddress: i.string().trim().max(500).optional(),
18
+ couponCode: i.string().trim().max(64).optional().or(i.literal("")),
19
+ couponAutoApplied: i.boolean().optional(),
20
+ customer: i.object({
21
+ fullName: i.string().trim().min(2),
22
+ email: i.string().trim().email(),
23
+ phone: i.string().trim().min(6),
24
+ notes: i.string().trim().max(2e3).optional().or(i.literal(""))
25
25
  }),
26
- items: r.array(a).min(1),
27
- nowIso: r.string().datetime({ offset: !0 }).optional()
28
- }), s = (e, t) => {
26
+ items: i.array(o).min(1),
27
+ nowIso: i.string().datetime({ offset: !0 }).optional()
28
+ }), c = (e, t) => {
29
29
  e.fulfillment === "delivery" && (e.startAddress?.trim() || t.addIssue({
30
- code: r.ZodIssueCode.custom,
30
+ code: i.ZodIssueCode.custom,
31
31
  message: "Delivery start address is required.",
32
32
  path: ["startAddress"]
33
33
  }));
34
- }, c = o.superRefine(s), l = r.object({
35
- success: r.boolean(),
36
- message: r.string().optional(),
37
- checkout: r.object({
38
- bookingExternalId: r.string().trim().min(1),
39
- saleId: r.string().trim().min(1),
40
- nextPath: r.string().trim().min(1),
41
- successPath: r.string().trim().min(1),
42
- requiresPayment: r.boolean()
34
+ }, l = s.superRefine(c), u = i.object({
35
+ success: i.boolean(),
36
+ message: i.string().optional(),
37
+ checkout: i.object({
38
+ bookingExternalId: i.string().trim().min(1),
39
+ saleId: i.string().trim().min(1),
40
+ nextPath: i.string().trim().min(1),
41
+ successPath: i.string().trim().min(1),
42
+ requiresPayment: i.boolean()
43
43
  }).optional()
44
44
  });
45
45
  //#endregion
46
- export { i as ROUTE, o as requestBaseSchema, a as requestCheckoutItemSchema, s as requestDeliveryRefinement, c as requestSchema, l as responseSchema };
46
+ export { a as ROUTE, s as requestBaseSchema, o as requestCheckoutItemSchema, c as requestDeliveryRefinement, l as requestSchema, u as responseSchema };
@@ -1 +1 @@
1
- {"version":3,"file":"productVariants.d.ts","sourceRoot":"","sources":["../../src/lib/productVariants.ts"],"names":[],"mappings":"AAKA,KAAK,kBAAkB,GAAG;IACxB,EAAE,CAAC,EAAE,OAAO,CAAA;IACZ,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAcD,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAW5G;AAwBD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAY7G;AAED,eAAO,MAAM,kCAAkC,iCAA2B,CAAA"}
1
+ {"version":3,"file":"productVariants.d.ts","sourceRoot":"","sources":["../../src/lib/productVariants.ts"],"names":[],"mappings":"AAKA,KAAK,kBAAkB,GAAG;IACxB,EAAE,CAAC,EAAE,OAAO,CAAA;IACZ,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAcD,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAW5G;AAiDD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAiB7G;AAED,eAAO,MAAM,kCAAkC,iCAA2B,CAAA"}
@@ -28,19 +28,30 @@ function o(a) {
28
28
  s.push(i);
29
29
  }
30
30
  }
31
- return [...o, ...s].join(" · ");
31
+ return [...o, ...s];
32
32
  }
33
- function s(t) {
34
- let n = e(t.id), r = e(t.computedName), i = [
35
- o(t),
33
+ function s(e) {
34
+ return e.trim().replace(/\s+/g, " ").toLowerCase();
35
+ }
36
+ function c(e, t) {
37
+ if (!e || t.length === 0) return !1;
38
+ let n = e.split(/\s+\/\s+/).map((e) => {
39
+ let t = e.indexOf(":");
40
+ return s(t >= 0 ? e.slice(t + 1) : e);
41
+ }).filter((e) => e.length > 0).sort(), r = t.map(s).sort();
42
+ return n.length === r.length && n.every((e, t) => e === r[t]);
43
+ }
44
+ function l(t) {
45
+ let n = e(t.id), r = e(t.computedName), i = o(t), a = [
46
+ i.join(" · "),
36
47
  r,
37
48
  n
38
- ].find((e) => e.length > 0) ?? n, a = r.length > 0 && r !== i ? r : "";
49
+ ].find((e) => e.length > 0) ?? n, s = r.length > 0 && r !== a && !c(r, i) ? r : "";
39
50
  return {
40
- label: i || n,
41
- description: a || void 0
51
+ label: a || n,
52
+ description: s || void 0
42
53
  };
43
54
  }
44
- var c = s;
55
+ var u = l;
45
56
  //#endregion
46
- export { a as getProductVariantAttributeValue, s as getProductVariantDisplay, c as getStorefrontProductVariantDisplay };
57
+ export { a as getProductVariantAttributeValue, l as getProductVariantDisplay, u as getStorefrontProductVariantDisplay };
@@ -0,0 +1,5 @@
1
+ import { StorefrontShop } from '../storefrontSchemas';
2
+ type StorefrontAddressSource = Pick<StorefrontShop, "address" | "city" | "country">;
3
+ export declare const formatStorefrontAddressTagline: (shop: StorefrontAddressSource | undefined) => string;
4
+ export {};
5
+ //# sourceMappingURL=storefrontAddress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storefrontAddress.d.ts","sourceRoot":"","sources":["../../src/lib/storefrontAddress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAG1D,KAAK,uBAAuB,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC,CAAA;AAkCnF,eAAO,MAAM,8BAA8B,GAAI,MAAM,uBAAuB,GAAG,SAAS,KAAG,MAkC1F,CAAA"}
@@ -0,0 +1,24 @@
1
+ //#region src/lib/storefrontAddress.ts
2
+ var e = /^(?:[A-Z]{1,3}[-\s]*)?\d{4,10}(?:[-\s]+\d{3,4})?\s+/i, t = /^(\d+[A-Za-z]?(?:[-/]\d+[A-Za-z]?)?(?:\s+(?:bis|ter|quater))?)\s+(.+)$/i, n = (e) => e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, " ").trim(), r = (e) => {
3
+ let t = /* @__PURE__ */ new Set(), r = n(e);
4
+ r && t.add(r);
5
+ let i = e.trim().toUpperCase();
6
+ if (!/^[A-Z]{2}$/.test(i)) return t;
7
+ for (let e of ["en", "fr"]) {
8
+ let r = new Intl.DisplayNames([e], { type: "region" }).of(i);
9
+ r && t.add(n(r));
10
+ }
11
+ return t;
12
+ }, i = (e, t) => {
13
+ let r = n(t);
14
+ !r || e.some((e) => n(e) === r) || e.push(t);
15
+ }, a = (a) => {
16
+ let o = a?.address?.trim() ?? "";
17
+ if (!o) return "";
18
+ let s = r(a?.country?.trim() ?? ""), c = o.split(/[,\n]/).map((e) => e.trim()).filter(Boolean), l = c.findIndex((t) => e.test(t)), u = (l >= 0 ? c.slice(0, l + 1) : c).map((t) => t.replace(e, "").trim()).filter((e) => e.length > 0 && !s.has(n(e))), d = [], f = u.shift() ?? "", p = f.match(t);
19
+ p ? (i(d, p[1] ?? ""), i(d, p[2] ?? "")) : i(d, f);
20
+ for (let e of u) i(d, e);
21
+ return i(d, a?.city?.trim() ?? ""), d.join(", ");
22
+ };
23
+ //#endregion
24
+ export { a as formatStorefrontAddressTagline };
@@ -37,22 +37,22 @@ export declare const requestSchema: z.ZodObject<{
37
37
  export type RequestPayload = z.infer<typeof requestSchema>;
38
38
  export type StorefrontAvailabilityRequestPayload = RequestPayload;
39
39
  export declare const publicAvailabilityDisplayModeSchema: z.ZodEnum<{
40
- soldOutOnly: "soldOutOnly";
41
- soldOutAndFewRemaining: "soldOutAndFewRemaining";
42
40
  fewRemaining: "fewRemaining";
43
41
  fewRemainingCounts: "fewRemainingCounts";
44
42
  remainingCounts: "remainingCounts";
43
+ soldOutAndFewRemaining: "soldOutAndFewRemaining";
44
+ soldOutOnly: "soldOutOnly";
45
45
  }>;
46
46
  export type PublicAvailabilityDisplayMode = z.infer<typeof publicAvailabilityDisplayModeSchema>;
47
47
  export declare const storefrontPublicAvailabilityRecordSchema: z.ZodObject<{
48
48
  productId: z.ZodString;
49
49
  productVariantId: z.ZodOptional<z.ZodString>;
50
50
  displayMode: z.ZodEnum<{
51
- soldOutOnly: "soldOutOnly";
52
- soldOutAndFewRemaining: "soldOutAndFewRemaining";
53
51
  fewRemaining: "fewRemaining";
54
52
  fewRemainingCounts: "fewRemainingCounts";
55
53
  remainingCounts: "remainingCounts";
54
+ soldOutAndFewRemaining: "soldOutAndFewRemaining";
55
+ soldOutOnly: "soldOutOnly";
56
56
  }>;
57
57
  soldOut: z.ZodBoolean;
58
58
  unlimited: z.ZodBoolean;
@@ -69,11 +69,11 @@ export declare const responseSchema: z.ZodObject<{
69
69
  productId: z.ZodString;
70
70
  productVariantId: z.ZodOptional<z.ZodString>;
71
71
  displayMode: z.ZodEnum<{
72
- soldOutOnly: "soldOutOnly";
73
- soldOutAndFewRemaining: "soldOutAndFewRemaining";
74
72
  fewRemaining: "fewRemaining";
75
73
  fewRemainingCounts: "fewRemainingCounts";
76
74
  remainingCounts: "remainingCounts";
75
+ soldOutAndFewRemaining: "soldOutAndFewRemaining";
76
+ soldOutOnly: "soldOutOnly";
77
77
  }>;
78
78
  soldOut: z.ZodBoolean;
79
79
  unlimited: z.ZodBoolean;
@@ -0,0 +1,10 @@
1
+ import { StorefrontShop } from '../storefrontSchemas';
2
+ type StorefrontContactShop = Pick<StorefrontShop, "address" | "contactPhone1" | "contactPhone2" | "country" | "googleMapsLink">;
3
+ export declare const formatStorefrontPhoneDisplay: (phone: string, country?: string) => string;
4
+ export declare const resolveStorefrontPhoneContact: (shop: StorefrontContactShop | undefined) => {
5
+ href: string;
6
+ phoneDisplay: string;
7
+ } | undefined;
8
+ export declare const resolveStorefrontMapsHref: (shop: StorefrontContactShop | undefined) => string | undefined;
9
+ export {};
10
+ //# sourceMappingURL=storefrontContact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storefrontContact.d.ts","sourceRoot":"","sources":["../../src/lib/storefrontContact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAG1D,KAAK,qBAAqB,GAAG,IAAI,CAC/B,cAAc,EACd,SAAS,GAAG,eAAe,GAAG,eAAe,GAAG,SAAS,GAAG,gBAAgB,CAC7E,CAAA;AASD,eAAO,MAAM,4BAA4B,GAAI,OAAO,MAAM,EAAE,UAAU,MAAM,KAAG,MAgB9E,CAAA;AAED,eAAO,MAAM,6BAA6B,GACxC,MAAM,qBAAqB,GAAG,SAAS,KACtC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAAG,SAQ3C,CAAA;AAED,eAAO,MAAM,yBAAyB,GAAI,MAAM,qBAAqB,GAAG,SAAS,KAAG,MAAM,GAAG,SAQ5F,CAAA"}
@@ -0,0 +1,24 @@
1
+ //#region src/lib/storefrontContact.ts
2
+ var e = (e) => e.replace(/\D/g, ""), t = (e) => e.match(/.{1,2}/g)?.join(" ") ?? e, n = (n, r) => {
3
+ let i = n.trim(), a = e(i);
4
+ if (!a) return i;
5
+ let o = r?.trim().toUpperCase() ?? "";
6
+ if ((o === "FR" || a.startsWith("33")) && a.startsWith("33") && a.length === 11) {
7
+ let e = a.slice(2);
8
+ return `+33 (0)${e.slice(0, 1)} ${t(e.slice(1))}`;
9
+ }
10
+ return (o === "US" || o === "CA" || a.startsWith("1")) && a.startsWith("1") && a.length === 11 ? `+1 (${a.slice(1, 4)}) ${a.slice(4, 7)}-${a.slice(7)}` : i;
11
+ }, r = (e) => {
12
+ let t = e?.contactPhone1?.trim() || e?.contactPhone2?.trim() || "";
13
+ if (t) return {
14
+ href: `tel:${t}`,
15
+ phoneDisplay: n(t, e?.country)
16
+ };
17
+ }, i = (e) => {
18
+ let t = e?.googleMapsLink?.trim() ?? "";
19
+ if (t) return t;
20
+ let n = e?.address?.trim() ?? "";
21
+ return n ? `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(n)}` : void 0;
22
+ };
23
+ //#endregion
24
+ export { n as formatStorefrontPhoneDisplay, i as resolveStorefrontMapsHref, r as resolveStorefrontPhoneContact };
@@ -0,0 +1,5 @@
1
+ export declare const MISSING_SHOP_ADDRESS = "[Missing shop address]";
2
+ export declare const MISSING_SHOP_EMAIL = "[Missing shop email]";
3
+ export declare const MISSING_SHOP_PHONE_NUMBER = "[Missing phone number]";
4
+ export declare const UNCONFIGURED_SHOP_MAP_CENTER: readonly [0, 0];
5
+ //# sourceMappingURL=storefrontMissingValues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storefrontMissingValues.d.ts","sourceRoot":"","sources":["../../src/lib/storefrontMissingValues.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,2BAA2B,CAAA;AAC5D,eAAO,MAAM,kBAAkB,yBAAyB,CAAA;AACxD,eAAO,MAAM,yBAAyB,2BAA2B,CAAA;AAGjE,eAAO,MAAM,4BAA4B,iBAAkB,CAAA"}
@@ -0,0 +1,4 @@
1
+ //#region src/lib/storefrontMissingValues.ts
2
+ var e = "[Missing shop address]", t = "[Missing shop email]", n = "[Missing phone number]", r = [0, 0];
3
+ //#endregion
4
+ export { e as MISSING_SHOP_ADDRESS, t as MISSING_SHOP_EMAIL, n as MISSING_SHOP_PHONE_NUMBER, r as UNCONFIGURED_SHOP_MAP_CENTER };
@@ -2,11 +2,11 @@ import { z } from 'zod';
2
2
  export declare const storefrontPublicProductPriceSchema: z.ZodObject<{
3
3
  value: z.ZodNumber;
4
4
  unit: z.ZodEnum<{
5
- hour: "hour";
6
- half_day: "half_day";
7
5
  day: "day";
8
- week: "week";
6
+ half_day: "half_day";
7
+ hour: "hour";
9
8
  month: "month";
9
+ week: "week";
10
10
  }>;
11
11
  quantity: z.ZodNumber;
12
12
  currency: z.ZodOptional<z.ZodString>;
@@ -105,11 +105,11 @@ export declare const storefrontPublicBikeProductSchema: z.ZodObject<{
105
105
  prices: z.ZodOptional<z.ZodArray<z.ZodObject<{
106
106
  value: z.ZodNumber;
107
107
  unit: z.ZodEnum<{
108
- hour: "hour";
109
- half_day: "half_day";
110
108
  day: "day";
111
- week: "week";
109
+ half_day: "half_day";
110
+ hour: "hour";
112
111
  month: "month";
112
+ week: "week";
113
113
  }>;
114
114
  quantity: z.ZodNumber;
115
115
  currency: z.ZodOptional<z.ZodString>;
@@ -178,11 +178,11 @@ export declare const storefrontPublicAccessoryProductSchema: z.ZodObject<{
178
178
  prices: z.ZodArray<z.ZodObject<{
179
179
  value: z.ZodNumber;
180
180
  unit: z.ZodEnum<{
181
- hour: "hour";
182
- half_day: "half_day";
183
181
  day: "day";
184
- week: "week";
182
+ half_day: "half_day";
183
+ hour: "hour";
185
184
  month: "month";
185
+ week: "week";
186
186
  }>;
187
187
  quantity: z.ZodNumber;
188
188
  currency: z.ZodOptional<z.ZodString>;
@@ -217,10 +217,9 @@ export declare const requestSchema: z.ZodObject<{
217
217
  }, z.core.$strip>;
218
218
  export type RequestPayload = z.infer<typeof requestSchema>;
219
219
  export type StorefrontProductsRequestPayload = RequestPayload;
220
- export declare const responseSchema: z.ZodObject<{
221
- success: z.ZodBoolean;
222
- message: z.ZodOptional<z.ZodString>;
223
- products: z.ZodOptional<z.ZodObject<{
220
+ export declare const responseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
221
+ success: z.ZodLiteral<true>;
222
+ products: z.ZodObject<{
224
223
  bikes: z.ZodDefault<z.ZodArray<z.ZodObject<{
225
224
  id: z.ZodString;
226
225
  checkoutProductId: z.ZodOptional<z.ZodString>;
@@ -260,11 +259,11 @@ export declare const responseSchema: z.ZodObject<{
260
259
  prices: z.ZodOptional<z.ZodArray<z.ZodObject<{
261
260
  value: z.ZodNumber;
262
261
  unit: z.ZodEnum<{
263
- hour: "hour";
264
- half_day: "half_day";
265
262
  day: "day";
266
- week: "week";
263
+ half_day: "half_day";
264
+ hour: "hour";
267
265
  month: "month";
266
+ week: "week";
268
267
  }>;
269
268
  quantity: z.ZodNumber;
270
269
  currency: z.ZodOptional<z.ZodString>;
@@ -332,11 +331,11 @@ export declare const responseSchema: z.ZodObject<{
332
331
  prices: z.ZodArray<z.ZodObject<{
333
332
  value: z.ZodNumber;
334
333
  unit: z.ZodEnum<{
335
- hour: "hour";
336
- half_day: "half_day";
337
334
  day: "day";
338
- week: "week";
335
+ half_day: "half_day";
336
+ hour: "hour";
339
337
  month: "month";
338
+ week: "week";
340
339
  }>;
341
340
  quantity: z.ZodNumber;
342
341
  currency: z.ZodOptional<z.ZodString>;
@@ -364,8 +363,11 @@ export declare const responseSchema: z.ZodObject<{
364
363
  variants_as_products: "variants_as_products";
365
364
  }>>;
366
365
  }, z.core.$strip>>>;
367
- }, z.core.$strip>>;
368
- }, z.core.$strip>;
366
+ }, z.core.$strip>;
367
+ }, z.core.$strip>, z.ZodObject<{
368
+ success: z.ZodLiteral<false>;
369
+ message: z.ZodOptional<z.ZodString>;
370
+ }, z.core.$strip>], "success">;
369
371
  export type ResponsePayload = z.infer<typeof responseSchema>;
370
372
  export type StorefrontProductsResponsePayload = ResponsePayload;
371
373
  //# sourceMappingURL=stor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;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAcjD,CAAA;AACF,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sCAAsC,CAAC,CAAA;AAErG,eAAO,MAAM,KAAK,oCAAoC,CAAA;AAEtD,eAAO,MAAM,aAAa;;iBAExB,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAC1D,MAAM,MAAM,gCAAgC,GAAG,cAAc,CAAA;AAE7D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAYzB,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAC5D,MAAM,MAAM,iCAAiC,GAAG,eAAe,CAAA"}
@@ -71,13 +71,15 @@ var t = e.object({
71
71
  features: e.array(n).optional(),
72
72
  productVariants: e.array(c).min(1),
73
73
  storefrontDisplayMode: f.default("variant_selector")
74
- }), g = "/api/public/storefront/products", _ = e.object({ storeSlug: e.string().trim().min(1).toLowerCase() }), v = e.object({
75
- success: e.boolean(),
76
- message: e.string().optional(),
74
+ }), g = "/api/public/storefront/products", _ = e.object({ storeSlug: e.string().trim().min(1).toLowerCase() }), v = e.discriminatedUnion("success", [e.object({
75
+ success: e.literal(!0),
77
76
  products: e.object({
78
77
  bikes: e.array(m).default([]),
79
78
  accessories: e.array(h).default([])
80
- }).optional()
81
- });
79
+ })
80
+ }), e.object({
81
+ success: e.literal(!1),
82
+ message: e.string().optional()
83
+ })]);
82
84
  //#endregion
83
85
  export { g as ROUTE, _ as requestSchema, v as responseSchema, h as storefrontPublicAccessoryProductSchema, l as storefrontPublicBikeAvailabilityStatusSchema, u as storefrontPublicBikeKindSchema, m as storefrontPublicBikeProductSchema, p as storefrontPublicImageStyleSchema, f as storefrontPublicProductDisplayModeSchema, a as storefrontPublicProductPriceSchema, d as storefrontPublicProductSlugSchema, s as storefrontPublicProductVariantAttributeSchema, o as storefrontPublicProductVariantIdentifierSchema, c as storefrontPublicProductVariantSchema };
@@ -1,17 +1,19 @@
1
- import { StorefrontPreset } from '../data/config';
2
1
  import { StorefrontConfiguration } from '../storefrontSchemas';
2
+ type StorefrontWhatsAppConfiguration = {
3
+ shop: Pick<StorefrontConfiguration["shop"], "contactPhone1" | "contactPhone2" | "country">;
4
+ content?: Pick<NonNullable<StorefrontConfiguration["content"]>, "whatsappMessage" | "whatsappPhone1Enabled" | "whatsappPhone2Enabled">;
5
+ };
3
6
  export declare function buildWhatsAppHref(phone: string | undefined, message?: string): string | undefined;
4
- export declare function resolveStorefrontWhatsAppContact({ preset, storefrontConfiguration, language, }: {
5
- preset: StorefrontPreset;
6
- storefrontConfiguration?: StorefrontConfiguration;
7
+ export declare function resolveStorefrontWhatsAppContact({ storefrontConfiguration, language, }: {
8
+ storefrontConfiguration?: StorefrontWhatsAppConfiguration;
7
9
  language: string;
8
10
  }): {
9
11
  href: string;
10
12
  phoneDisplay: string;
11
13
  } | undefined;
12
14
  export declare function resolveStorefrontWhatsAppHref(params: {
13
- preset: StorefrontPreset;
14
- storefrontConfiguration?: StorefrontConfiguration;
15
+ storefrontConfiguration?: StorefrontWhatsAppConfiguration;
15
16
  language: string;
16
17
  }): string | undefined;
18
+ export {};
17
19
  //# sourceMappingURL=whatsapp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"whatsapp.d.ts","sourceRoot":"","sources":["../../src/lib/whatsapp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAgDnE,wBAAgB,iB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