@loczer/storefront-sdk 0.187.0 → 0.189.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 (66) hide show
  1. package/dist/chunks/booking-engine/dist/models/{Product.shared-CTuk4fiR.js → Product.shared-IYOeC3N7.js} +12 -10
  2. package/dist/chunks/booking-engine/dist/schemas/{base-asset-B_Dm8_Vk.js → base-asset-zsUj5_3O.js} +1 -1
  3. package/dist/chunks/booking-engine/dist/schemas/{base-booking-DW8AEPKo.js → base-booking-TzCge_mR.js} +2 -2
  4. package/dist/chunks/booking-engine/dist/schemas/{base-product-1H8l2aUv.js → base-product-DvFFzAcg.js} +1 -1
  5. package/dist/chunks/booking-engine/dist/schemas/{booking-engine-configuration-D02MRF9U.js → booking-engine-configuration-LnrhShqm.js} +4 -1
  6. package/dist/chunks/booking-engine/dist/schemas/{cart-inputs-j1yWfJxO.js → cart-inputs-B0HpcFe5.js} +1 -1
  7. package/dist/chunks/booking-engine/dist/schemas/{public-booking-engine-configuration-BnJ_H-p1.js → public-booking-engine-configuration-CEM9mexX.js} +1 -1
  8. package/dist/chunks/booking-engine/dist/schemas-BNUzqsci.js +13 -0
  9. package/dist/chunks/ui/dist/Map/{MapContent-QPkuTBvK.js → MapContent-PK-ptOx6.js} +126 -94
  10. package/dist/chunks/ui/dist/Map/mapboxError-oRn0l3EE.js +25 -0
  11. package/dist/chunks/ui/dist/{Map-BXmRf5Ep.js → Map-BwXj49kV.js} +1 -1
  12. package/dist/components/BookingBikeVariantDialog/index.d.ts +2 -1
  13. package/dist/components/BookingBikeVariantDialog/index.d.ts.map +1 -1
  14. package/dist/components/BookingBikeVariantDialog/index.js +39 -38
  15. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.d.ts.map +1 -1
  16. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.js +32 -30
  17. package/dist/components/BookingPeriodSelector/components/BookingMobileDateDrawer.d.ts.map +1 -1
  18. package/dist/components/BookingPeriodSelector/components/BookingMobileDateDrawer.js +127 -122
  19. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.d.ts.map +1 -1
  20. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.js +32 -30
  21. package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.d.ts +7 -0
  22. package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.d.ts.map +1 -0
  23. package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.js +29 -0
  24. package/dist/components/BookingPeriodSelector/index.d.ts +2 -1
  25. package/dist/components/BookingPeriodSelector/index.d.ts.map +1 -1
  26. package/dist/components/BookingPeriodSelector/index.js +15 -14
  27. package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts +11 -0
  28. package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts.map +1 -1
  29. package/dist/components/BookingPeriodSelector/useBookingPeriodController.js +280 -216
  30. package/dist/components/ContactSection/index.d.ts.map +1 -1
  31. package/dist/components/ContactSection/index.js +120 -116
  32. package/dist/components/Header/index.d.ts.map +1 -1
  33. package/dist/components/Header/index.js +35 -35
  34. package/dist/components/Map/index.js +1 -1
  35. package/dist/components/StorefrontCancellationPolicyNotice/index.d.ts.map +1 -1
  36. package/dist/components/StorefrontCancellationPolicyNotice/index.js +51 -48
  37. package/dist/components/StorefrontInsuranceNotice/index.d.ts +9 -0
  38. package/dist/components/StorefrontInsuranceNotice/index.d.ts.map +1 -0
  39. package/dist/components/StorefrontInsuranceNotice/index.js +191 -0
  40. package/dist/i18n/en.d.ts +24 -0
  41. package/dist/i18n/en.d.ts.map +1 -1
  42. package/dist/i18n/en.js +26 -2
  43. package/dist/i18n/fr.d.ts +24 -0
  44. package/dist/i18n/fr.d.ts.map +1 -1
  45. package/dist/i18n/fr.js +26 -2
  46. package/dist/index.d.ts +91 -0
  47. package/dist/index.js +69 -68
  48. package/dist/lib/booking.js +2 -2
  49. package/dist/lib/checkoutSubmit.js +3 -3
  50. package/dist/lib/fetchStorefrontTimeSlots.d.ts.map +1 -1
  51. package/dist/lib/fetchStorefrontTimeSlots.js +2 -1
  52. package/dist/lib/storefrontProducts.d.ts +16 -0
  53. package/dist/lib/storefrontProducts.d.ts.map +1 -1
  54. package/dist/lib/storefrontProducts.js +27 -22
  55. package/dist/pages/BookingPage.d.ts.map +1 -1
  56. package/dist/pages/BookingPage.js +109 -95
  57. package/dist/pages/CheckoutPage.d.ts.map +1 -1
  58. package/dist/pages/CheckoutPage.js +229 -231
  59. package/dist/pages/HomePage.d.ts.map +1 -1
  60. package/dist/pages/HomePage.js +339 -314
  61. package/dist/pages/ProductPage.d.ts.map +1 -1
  62. package/dist/pages/ProductPage.js +60 -52
  63. package/dist/storefront.css +1 -1
  64. package/dist/storefrontSchemas.js +2 -2
  65. package/package.json +1 -1
  66. package/dist/chunks/booking-engine/dist/schemas-DftrSnTE.js +0 -13
@@ -1 +1 @@
1
- {"version":3,"file":"ProductPage.d.ts","sourceRoot":"","sources":["../../src/pages/ProductPage.tsx"],"names":[],"mappings":"AA0HA,MAAM,CAAC,OAAO,UAAU,WAAW,4CA4VlC"}
1
+ {"version":3,"file":"ProductPage.d.ts","sourceRoot":"","sources":["../../src/pages/ProductPage.tsx"],"names":[],"mappings":"AA0HA,MAAM,CAAC,OAAO,UAAU,WAAW,4CA4WlC"}
@@ -64,53 +64,56 @@ function T() {
64
64
  M,
65
65
  j,
66
66
  D
67
- ]), P = g(() => t(O, E), [O, E]), F = g(() => e(P), [P]), I = P.toString(), L = `/${E ?? ""}/checkout${I ? `?${I}` : ""}`, R = `/${E ?? ""}`, Ae = R, z = Ee.state, je = typeof z?.backTo == "string" && z.backTo.startsWith(R) ? z.backTo : Ae, [B, V] = _(1), [H, U] = _(() => C(N)), W = Number.isFinite(B) ? Math.max(1, Math.min(99, Math.floor(B))) : 1, G = g(() => Se(N, W), [W, N]), [K, q] = _([]), [Me, J] = _(!1);
67
+ ]), P = g(() => t(O, E), [O, E]), F = g(() => e(P, {
68
+ start_time: "",
69
+ end_time: ""
70
+ }), [P]), I = g(() => te(F), [F]), L = P.toString(), R = `/${E ?? ""}/checkout${L ? `?${L}` : ""}`, z = `/${E ?? ""}`, Ae = z, B = Ee.state, je = typeof B?.backTo == "string" && B.backTo.startsWith(z) ? B.backTo : Ae, [V, H] = _(1), [U, W] = _(() => C(N)), G = Number.isFinite(V) ? Math.max(1, Math.min(99, Math.floor(V))) : 1, K = g(() => Se(N, G), [G, N]), [q, J] = _([]), [Me, Y] = _(!1);
68
71
  h(() => {
69
- if (V(1), !N) {
70
- U(null);
72
+ if (H(1), !N) {
73
+ W(null);
71
74
  return;
72
75
  }
73
- U(C(N));
76
+ W(C(N));
74
77
  }, [D, N]), h(() => {
75
78
  n(E, P);
76
79
  }, [P, E]), h(() => {
77
- if (!E || G.length === 0) {
78
- q([]), J(!1);
80
+ if (!E || K.length === 0) {
81
+ J([]), Y(!1);
79
82
  return;
80
83
  }
81
- let e = te(F);
82
- if (!e) {
83
- J(!1);
84
+ if (!I) {
85
+ J([]), Y(!1);
84
86
  return;
85
87
  }
86
- let t = !1;
87
- return J(!0), q([]), (async () => {
88
+ let e = !1;
89
+ return Y(!0), J([]), (async () => {
88
90
  try {
89
- let n = await de(ee, {
91
+ let t = await de(ee, {
90
92
  storeSlug: E,
91
- schedule: e,
92
- products: G
93
- }), r = ne.parse(n);
94
- if (t) return;
95
- q(r.success ? r.availability ?? [] : []);
96
- } catch (e) {
97
- if (t) return;
98
- console.error("Failed to load storefront product availability", e), q([]);
93
+ schedule: I,
94
+ products: K
95
+ }), n = ne.parse(t);
96
+ if (e) return;
97
+ J(n.success ? n.availability ?? [] : []);
98
+ } catch (t) {
99
+ if (e) return;
100
+ console.error("Failed to load storefront product availability", t), J([]);
99
101
  } finally {
100
- t || J(!1);
102
+ e || Y(!1);
101
103
  }
102
104
  })(), () => {
103
- t = !0;
105
+ e = !0;
104
106
  };
105
107
  }, [
106
- G,
108
+ K,
109
+ I,
107
110
  F.end_date,
108
111
  F.end_time,
109
112
  F.start_date,
110
113
  F.start_time,
111
114
  E
112
115
  ]);
113
- let Y = g(() => new Map(K.map((e) => [u(e.productId, e.productVariantId), e])), [K]), Ne = () => {
116
+ let Ne = g(() => new Map(q.map((e) => [u(e.productId, e.productVariantId), e])), [q]), Pe = () => {
114
117
  De(je);
115
118
  };
116
119
  if (!N) return /* @__PURE__ */ v("div", {
@@ -131,7 +134,7 @@ function T() {
131
134
  children: /* @__PURE__ */ y(m, {
132
135
  type: "button",
133
136
  className: "gap-2",
134
- onClick: Ne,
137
+ onClick: Pe,
135
138
  children: [/* @__PURE__ */ v(x, {
136
139
  className: "h-4 w-4",
137
140
  "aria-hidden": "true"
@@ -141,7 +144,7 @@ function T() {
141
144
  ]
142
145
  })
143
146
  });
144
- let Pe = l(N.name, T.language, A), Fe = l(N.description, T.language, A), Ie = l(N.warning, T.language, A), Le = typeof N.images?.[0] == "string" ? N.images[0].trim() : "", X = ue(N.primaryImageStyle), Z = Ce(N, Y), Re = Te(N), ze = Z ? f(Z) : Re, Be = c(ze), Ve = Me ? d("availability_checking") : w(d, Z, ze), Q = Z ? p(Z) : Re === "OUT_OF_STOCK", $ = N.productVariants ?? [], He = $.some((e) => !!r(e, "size")) ? d("product_size_label") : d("product_variant_label"), Ue = !!H;
147
+ let Fe = l(N.name, T.language, A), Ie = l(N.description, T.language, A), Le = l(N.warning, T.language, A), X = typeof N.images?.[0] == "string" ? N.images[0].trim() : "", Re = ue(N.primaryImageStyle), Z = Ce(N, Ne), ze = Te(N), Be = Z ? f(Z) : ze, Ve = c(Be), He = Me ? d("availability_checking") : w(d, Z, Be), Q = Z ? p(Z) : ze === "OUT_OF_STOCK", $ = N.productVariants ?? [], Ue = $.some((e) => !!r(e, "size")) ? d("product_size_label") : d("product_variant_label"), We = !!U && I !== null;
145
148
  return /* @__PURE__ */ v("div", {
146
149
  className: "mx-auto max-w-7xl px-4 py-8 sm:px-6",
147
150
  children: /* @__PURE__ */ y("div", {
@@ -152,14 +155,14 @@ function T() {
152
155
  type: "button",
153
156
  variant: "ghost",
154
157
  className: "h-auto justify-start gap-2 self-start px-0 text-sm font-medium text-slate-700 hover:bg-transparent hover:text-slate-950",
155
- onClick: Ne,
158
+ onClick: Pe,
156
159
  children: [/* @__PURE__ */ v(x, {
157
160
  className: "h-4 w-4",
158
161
  "aria-hidden": "true"
159
162
  }), /* @__PURE__ */ v("span", { children: d("go_back") })]
160
163
  }), /* @__PURE__ */ v(me, {
161
- to: L,
162
- className: b(k > 0 ? "inline-flex" : "hidden"),
164
+ to: R,
165
+ className: b(k > 0 && I ? "inline-flex" : "hidden"),
163
166
  children: /* @__PURE__ */ y(m, {
164
167
  size: "sm",
165
168
  className: "gap-2",
@@ -174,11 +177,11 @@ function T() {
174
177
  children: [/* @__PURE__ */ y("div", {
175
178
  className: "lg:col-span-7",
176
179
  children: [/* @__PURE__ */ v("div", {
177
- className: b("relative aspect-[1618/1000] overflow-hidden rounded-2xl", X.className),
178
- style: X.style,
179
- children: Le ? /* @__PURE__ */ v("img", {
180
- src: Le,
181
- alt: Pe,
180
+ className: b("relative aspect-[1618/1000] overflow-hidden rounded-2xl", Re.className),
181
+ style: Re.style,
182
+ children: X ? /* @__PURE__ */ v("img", {
183
+ src: X,
184
+ alt: Fe,
182
185
  className: "absolute inset-0 h-full w-full object-contain p-2",
183
186
  loading: "lazy"
184
187
  }) : /* @__PURE__ */ v("div", {
@@ -194,17 +197,17 @@ function T() {
194
197
  /* @__PURE__ */ y("div", {
195
198
  className: "flex flex-wrap items-center gap-2",
196
199
  children: [/* @__PURE__ */ v(re, {
197
- variant: Be.variant,
198
- children: /* @__PURE__ */ v("span", { children: Ve })
200
+ variant: Ve.variant,
201
+ children: /* @__PURE__ */ v("span", { children: He })
199
202
  }), /* @__PURE__ */ v(le, { prices: N.prices })]
200
203
  }),
201
204
  /* @__PURE__ */ v("h1", {
202
205
  className: "text-2xl font-semibold tracking-tight text-slate-950",
203
- children: /* @__PURE__ */ v("span", { children: Pe })
206
+ children: /* @__PURE__ */ v("span", { children: Fe })
204
207
  }),
205
208
  /* @__PURE__ */ v("p", {
206
209
  className: "text-sm text-slate-600",
207
- children: /* @__PURE__ */ v("span", { children: Fe })
210
+ children: /* @__PURE__ */ v("span", { children: Ie })
208
211
  }),
209
212
  N.features?.length ? /* @__PURE__ */ y("div", {
210
213
  className: "mt-2 space-y-2",
@@ -222,7 +225,7 @@ function T() {
222
225
  }, `${N.id}-${t}`))
223
226
  })]
224
227
  }) : null,
225
- /* @__PURE__ */ v(ce, { warning: Ie })
228
+ /* @__PURE__ */ v(ce, { warning: Le })
226
229
  ]
227
230
  })]
228
231
  }), /* @__PURE__ */ v("div", {
@@ -241,21 +244,26 @@ function T() {
241
244
  }), /* @__PURE__ */ y("div", {
242
245
  className: "grid gap-4 px-4 py-4",
243
246
  children: [
247
+ I ? null : /* @__PURE__ */ v("p", {
248
+ role: "alert",
249
+ className: "text-sm text-destructive",
250
+ children: /* @__PURE__ */ v("span", { children: d("booking_time_slots_required") })
251
+ }),
244
252
  $.length > 1 ? /* @__PURE__ */ y("div", {
245
253
  className: "grid gap-2",
246
254
  children: [/* @__PURE__ */ v("p", {
247
255
  className: "text-xs font-medium text-slate-700",
248
- children: /* @__PURE__ */ v("span", { children: He })
256
+ children: /* @__PURE__ */ v("span", { children: Ue })
249
257
  }), /* @__PURE__ */ v(fe, {
250
- value: H ?? "",
251
- onValueChange: U,
258
+ value: U ?? "",
259
+ onValueChange: W,
252
260
  className: "grid gap-2",
253
261
  children: $.map((e) => {
254
- let t = `variant-${N.id}-${e.id}`.toLowerCase(), n = `storefront-product-variant-option-${N.id}-${e.id}`.toLowerCase(), { label: r, description: a } = i(e), o = we(N, e.id, Y), s = o ? p(o) : Q, c = o ? w(d, o, f(o)) : Q ? d("availability_out_of_stock") : null;
262
+ let t = `variant-${N.id}-${e.id}`.toLowerCase(), n = `storefront-product-variant-option-${N.id}-${e.id}`.toLowerCase(), { label: r, description: a } = i(e), o = we(N, e.id, Ne), s = o ? p(o) : Q, c = o ? w(d, o, f(o)) : Q ? d("availability_out_of_stock") : null;
255
263
  return /* @__PURE__ */ y("label", {
256
264
  htmlFor: t,
257
265
  "data-testid": n,
258
- className: b("flex items-start gap-3 rounded-xl border p-3 transition", H === e.id ? "border-slate-900 bg-slate-50" : "border-slate-200 bg-white"),
266
+ className: b("flex items-start gap-3 rounded-xl border p-3 transition", U === e.id ? "border-slate-900 bg-slate-50" : "border-slate-200 bg-white"),
259
267
  children: [/* @__PURE__ */ v(pe, {
260
268
  id: t,
261
269
  value: e.id,
@@ -293,29 +301,29 @@ function T() {
293
301
  type: "number",
294
302
  min: 1,
295
303
  max: 99,
296
- value: B,
297
- onChange: (e) => V(Number(e.target.value))
304
+ value: V,
305
+ onChange: (e) => H(Number(e.target.value))
298
306
  })]
299
307
  }),
300
308
  /* @__PURE__ */ y(m, {
301
309
  className: "h-11 rounded-xl text-sm font-semibold gap-2",
302
310
  onClick: () => {
303
- H && Oe({
311
+ !U || !I || Oe({
304
312
  kind: N.kind,
305
313
  productId: o(N),
306
- ...H ? { productVariantId: H } : {},
307
- quantity: W
314
+ ...U ? { productVariantId: U } : {},
315
+ quantity: G
308
316
  });
309
317
  },
310
- disabled: !Ue,
318
+ disabled: !We,
311
319
  children: [/* @__PURE__ */ v("span", { children: d("add_to_cart") }), /* @__PURE__ */ v(S, {
312
320
  className: "h-4 w-4",
313
321
  "aria-hidden": "true"
314
322
  })]
315
323
  }),
316
324
  /* @__PURE__ */ v(me, {
317
- to: L,
318
- className: b(k > 0 ? "block" : "hidden"),
325
+ to: R,
326
+ className: b(k > 0 && I ? "block" : "hidden"),
319
327
  children: /* @__PURE__ */ y(m, {
320
328
  variant: "outline",
321
329
  className: "h-11 w-full rounded-xl gap-2",