@loczer/storefront-sdk 0.198.0 → 0.200.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 (55) 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/BookingBikeQuickAddCard/index.d.ts.map +1 -1
  11. package/dist/components/BookingBikeQuickAddCard/index.js +54 -61
  12. package/dist/components/BookingBikeVariantDialog/index.d.ts.map +1 -1
  13. package/dist/components/BookingBikeVariantDialog/index.js +129 -116
  14. package/dist/components/ContactSection/index.js +107 -107
  15. package/dist/components/ContractSaleDocument/Invoice.d.ts.map +1 -1
  16. package/dist/components/ContractSaleDocument/Invoice.js +117 -111
  17. package/dist/components/Header/index.js +4 -4
  18. package/dist/components/Layout/index.d.ts.map +1 -1
  19. package/dist/components/Layout/index.js +47 -40
  20. package/dist/components/ProductPriceBadge/index.d.ts +2 -1
  21. package/dist/components/ProductPriceBadge/index.d.ts.map +1 -1
  22. package/dist/components/ProductPriceBadge/index.js +72 -70
  23. package/dist/components/StorefrontCancellationPolicyNotice/index.d.ts.map +1 -1
  24. package/dist/components/StorefrontCancellationPolicyNotice/index.js +3 -6
  25. package/dist/components/StorefrontInsuranceNotice/index.d.ts.map +1 -1
  26. package/dist/components/StorefrontInsuranceNotice/index.js +3 -6
  27. package/dist/components/TestimonialsSection/index.js +1 -1
  28. package/dist/i18n/en.d.ts +1 -0
  29. package/dist/i18n/en.d.ts.map +1 -1
  30. package/dist/i18n/en.js +1 -0
  31. package/dist/i18n/fr.d.ts +1 -0
  32. package/dist/i18n/fr.d.ts.map +1 -1
  33. package/dist/i18n/fr.js +1 -0
  34. package/dist/index.d.ts +15 -2
  35. package/dist/index.js +59 -58
  36. package/dist/lib/cartSummary.js +7 -7
  37. package/dist/lib/productVariants.d.ts +1 -0
  38. package/dist/lib/productVariants.d.ts.map +1 -1
  39. package/dist/lib/productVariants.js +27 -15
  40. package/dist/lib/products.d.ts +6 -0
  41. package/dist/lib/products.d.ts.map +1 -1
  42. package/dist/lib/products.js +36 -32
  43. package/dist/lib/toast.d.ts +9 -0
  44. package/dist/lib/toast.d.ts.map +1 -0
  45. package/dist/lib/toast.js +13 -0
  46. package/dist/pages/BookingPage.d.ts.map +1 -1
  47. package/dist/pages/BookingPage.js +143 -138
  48. package/dist/pages/CheckoutPage.js +217 -217
  49. package/dist/pages/CheckoutPaymentPage.js +124 -124
  50. package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
  51. package/dist/pages/ContractSaleDocumentPage.js +83 -83
  52. package/dist/pages/HomePage.js +6 -3
  53. package/dist/pages/ProductPage.d.ts.map +1 -1
  54. package/dist/pages/ProductPage.js +177 -165
  55. package/package.json +2 -1
@@ -6,18 +6,18 @@ import { InvoiceDetails as a } from "./InvoiceDetails.js";
6
6
  import { Page as o } from "./Page.js";
7
7
  import { PageFooter as s } from "./PageFooter.js";
8
8
  import { PageHeader as ee } from "./PageHeader.js";
9
- import { SignatureModal as te } from "./SignatureModal.js";
10
- import { TermsAndConditionsContent as ne } from "./TermsAndConditionsContent.js";
11
- import { ThumbnailSidebar as re } from "./ThumbnailSidebar.js";
9
+ import { TermsAndConditionsContent as te } from "./TermsAndConditionsContent.js";
10
+ import { ThumbnailSidebar as ne } from "./ThumbnailSidebar.js";
12
11
  /* empty css */
13
- import { useEffect as c, useRef as l, useState as u } from "react";
14
- import { Fragment as ie, jsx as d, jsxs as f } from "react/jsx-runtime";
12
+ import { Suspense as re, lazy as c, useEffect as l, useRef as u, useState as d } from "react";
13
+ import { Fragment as ie, jsx as f, jsxs as p } from "react/jsx-runtime";
15
14
  import { useTranslation as ae } from "react-i18next";
16
15
  import { CheckCircle2 as oe } from "lucide-react";
17
16
  import * as se from "html-to-image";
18
17
  import { toString as ce } from "qrcode";
19
18
  //#region src/components/ContractSaleDocument/Invoice.tsx
20
- async function le(e) {
19
+ var le = c(async () => ({ default: (await import("./SignatureModal.js")).SignatureModal }));
20
+ async function ue(e) {
21
21
  e.complete || await new Promise((t) => {
22
22
  let n = () => {
23
23
  e.removeEventListener("load", n), e.removeEventListener("error", n), t();
@@ -28,13 +28,13 @@ async function le(e) {
28
28
  await e.decode();
29
29
  } catch {}
30
30
  }
31
- var p = 22, m = 10, h = 14, g = 14, ue = 3, _ = 6, v = (e, t) => {
31
+ var m = 22, h = 10, g = 14, _ = 14, de = 3, fe = 6, v = (e, t) => {
32
32
  if (t <= 0) return [e];
33
33
  let n = [];
34
34
  for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
35
35
  return n;
36
- }, de = (e) => {
37
- if (e.length <= m) return [{
36
+ }, pe = (e) => {
37
+ if (e.length <= h) return [{
38
38
  kind: "invoice",
39
39
  key: "invoice-page-1",
40
40
  items: e,
@@ -46,13 +46,13 @@ var p = 22, m = 10, h = 14, g = 14, ue = 3, _ = 6, v = (e, t) => {
46
46
  let t = [{
47
47
  kind: "invoice",
48
48
  key: "invoice-page-1",
49
- items: e.slice(0, m),
49
+ items: e.slice(0, h),
50
50
  showInvoiceMeta: !0,
51
51
  showTotalsSection: !1,
52
52
  showNotesSection: !1,
53
53
  showAcceptanceSection: !1
54
- }], n = e.slice(m);
55
- if (n.length <= g) return t.push({
54
+ }], n = e.slice(h);
55
+ if (n.length <= _) return t.push({
56
56
  kind: "invoice",
57
57
  key: "invoice-page-final-1",
58
58
  items: n,
@@ -61,9 +61,9 @@ var p = 22, m = 10, h = 14, g = 14, ue = 3, _ = 6, v = (e, t) => {
61
61
  showNotesSection: !0,
62
62
  showAcceptanceSection: !0
63
63
  }), t;
64
- let r = n.length % h;
65
- r === 0 && (r = Math.min(g, h));
66
- let i = Math.max(0, n.length - r), a = n.slice(0, i), o = n.slice(i), s = v(a, h);
64
+ let r = n.length % g;
65
+ r === 0 && (r = Math.min(_, g));
66
+ let i = Math.max(0, n.length - r), a = n.slice(0, i), o = n.slice(i), s = v(a, g);
67
67
  return s.forEach((e, n) => {
68
68
  t.push({
69
69
  kind: "invoice",
@@ -83,8 +83,8 @@ var p = 22, m = 10, h = 14, g = 14, ue = 3, _ = 6, v = (e, t) => {
83
83
  showNotesSection: !0,
84
84
  showAcceptanceSection: !0
85
85
  }), t;
86
- }, fe = (e, t) => {
87
- let n = t && e.articles.some((e) => !!(e.translationTitle || e.translationBody || e.translationBodyHtml)), r = n ? ue : _;
86
+ }, me = (e, t) => {
87
+ let n = t && e.articles.some((e) => !!(e.translationTitle || e.translationBody || e.translationBodyHtml)), r = n ? de : fe;
88
88
  return v(e.articles, r).map((t, r) => ({
89
89
  kind: "appendix",
90
90
  key: `${e.id}-page-${r + 1}`,
@@ -94,17 +94,17 @@ var p = 22, m = 10, h = 14, g = 14, ue = 3, _ = 6, v = (e, t) => {
94
94
  withTranslation: n
95
95
  }));
96
96
  };
97
- function y({ data: m, showAppendices: h = !0, withEnglishTranslation: g = !0, heightMode: ue = "viewport", renderMode: _ = "interactive", publicDocumentUrl: v, onAccept: y }) {
98
- let { t: b, i18n: pe } = ae(), x = v?.trim() ?? "", S = _ === "pdf", [C, w] = u(m), [T, me] = u(!1), [E, D] = u(null), [he, O] = u(0), [k, A] = u([]), [ge, j] = u(!0), [_e, M] = u(0), [N, P] = u(""), [ve, F] = u(x.length === 0 && !S), [ye, I] = u(!S), L = l(null), R = l(null), z = l(null), B = l([]);
99
- c(() => {
100
- w(m);
101
- }, [m]), c(() => {
102
- if (!x) {
103
- P(""), F(!S);
97
+ function y({ data: c, showAppendices: h = !0, withEnglishTranslation: g = !0, heightMode: _ = "viewport", renderMode: de = "interactive", publicDocumentUrl: fe, onAccept: v }) {
98
+ let { t: y, i18n: he } = ae(), b = fe?.trim() ?? "", x = de === "pdf", [S, C] = d(c), [w, T] = d(!1), [E, D] = d(null), [ge, _e] = d(!1), [ve, O] = d(0), [k, A] = d([]), [ye, j] = d(!0), [be, M] = d(0), [N, P] = d(""), [xe, F] = d(b.length === 0 && !x), [Se, I] = d(!x), L = u(null), R = u(null), z = u(null), B = u([]);
99
+ l(() => {
100
+ C(c);
101
+ }, [c]), l(() => {
102
+ if (!b) {
103
+ P(""), F(!x);
104
104
  return;
105
105
  }
106
106
  let e = !1;
107
- return P(""), F(!1), ce(x, {
107
+ return P(""), F(!1), ce(b, {
108
108
  type: "svg",
109
109
  errorCorrectionLevel: "M",
110
110
  margin: 1,
@@ -122,13 +122,13 @@ function y({ data: m, showAppendices: h = !0, withEnglishTranslation: g = !0, he
122
122
  }), () => {
123
123
  e = !0;
124
124
  };
125
- }, [x, S]);
126
- let V = r(C, pe.language), be = (e, t = {}) => n(b, V, e, t), H = C.kind === "credit_note" ? -1 : 1, U = C.items.reduce((e, t) => e + t.quantity * t.unitPrice, 0) * H, W = C.items.reduce((e, t) => e + t.quantity * t.unitPrice * H / (1 + (t.taxRate ?? C.taxRate ?? 0)), 0), xe = U - W, G = be(C.kind === "credit_note" ? "docs_contract_sale_credit_note_title" : C.kind === "quote" ? "docs_contract_sale_quote_title" : "docs_contract_sale_invoice_title"), Se = de(C.items), K = C.kind === "credit_note" || !h ? [] : C.appendices, q = K.flatMap((e) => fe(e, g)), J = [...Se, ...q], Y = J.length, X = [
127
- C.id,
128
- C.kind,
129
- C.saleDocumentNumber,
130
- C.items.map((e) => `${e.id}:${e.description}:${e.quantity}:${e.unitPrice}`).join(","),
131
- C.rental ? `${C.rental.bookingNumber}:${C.rental.start.toISOString()}:${C.rental.end.toISOString()}:${C.rental.pickupAddress ?? ""}:${C.rental.returnAddress ?? ""}` : "",
125
+ }, [b, x]);
126
+ let V = r(S, he.language), Ce = (e, t = {}) => n(y, V, e, t), H = S.kind === "credit_note" ? -1 : 1, U = S.items.reduce((e, t) => e + t.quantity * t.unitPrice, 0) * H, W = S.items.reduce((e, t) => e + t.quantity * t.unitPrice * H / (1 + (t.taxRate ?? S.taxRate ?? 0)), 0), we = U - W, G = Ce(S.kind === "credit_note" ? "docs_contract_sale_credit_note_title" : S.kind === "quote" ? "docs_contract_sale_quote_title" : "docs_contract_sale_invoice_title"), Te = pe(S.items), K = S.kind === "credit_note" || !h ? [] : S.appendices, q = K.flatMap((e) => me(e, g)), J = [...Te, ...q], Y = J.length, X = [
127
+ S.id,
128
+ S.kind,
129
+ S.saleDocumentNumber,
130
+ S.items.map((e) => `${e.id}:${e.description}:${e.quantity}:${e.unitPrice}`).join(","),
131
+ S.rental ? `${S.rental.bookingNumber}:${S.rental.start.toISOString()}:${S.rental.end.toISOString()}:${S.rental.pickupAddress ?? ""}:${S.rental.returnAddress ?? ""}` : "",
132
132
  h ? K.map((e) => [
133
133
  e.id,
134
134
  e.title,
@@ -139,9 +139,9 @@ function y({ data: m, showAppendices: h = !0, withEnglishTranslation: g = !0, he
139
139
  V.customer,
140
140
  V.translation ?? "",
141
141
  J.map((e) => e.key).join(",")
142
- ].join("|"), Z = !S && (C.acceptanceLevel !== "none" || C.acceptance != null), Q = C.acceptance;
143
- c(() => {
144
- if (!S) {
142
+ ].join("|"), Z = !x && (S.acceptanceLevel !== "none" || S.acceptance != null), Q = S.acceptance;
143
+ l(() => {
144
+ if (!x) {
145
145
  I(!0);
146
146
  return;
147
147
  }
@@ -153,34 +153,34 @@ function y({ data: m, showAppendices: h = !0, withEnglishTranslation: g = !0, he
153
153
  let t = !1;
154
154
  I(!1);
155
155
  let n = Array.from(e.querySelectorAll("img"));
156
- return Promise.all(n.map(le)).then(() => {
156
+ return Promise.all(n.map(ue)).then(() => {
157
157
  t || I(!0);
158
158
  }), () => {
159
159
  t = !0;
160
160
  };
161
161
  }, [
162
162
  N,
163
- S,
163
+ x,
164
164
  X
165
- ]), B.current.length > Y && (B.current.length = Y), c(() => {
165
+ ]), B.current.length > Y && (B.current.length = Y), l(() => {
166
166
  M((e) => Y === 0 ? 0 : Math.min(e, Y - 1));
167
- }, [Y]), c(() => {
167
+ }, [Y]), l(() => {
168
168
  let e = L.current;
169
- me(!1), M(0), e?.scrollTo({
169
+ T(!1), M(0), e?.scrollTo({
170
170
  top: 0,
171
171
  left: 0,
172
172
  behavior: "auto"
173
173
  });
174
174
  let t = () => {
175
- e && e.scrollHeight - e.scrollTop <= e.clientHeight + 5 && me(!0);
175
+ e && e.scrollHeight - e.scrollTop <= e.clientHeight + 5 && T(!0);
176
176
  };
177
177
  return e?.addEventListener("scroll", t), t(), () => {
178
178
  e?.removeEventListener("scroll", t);
179
179
  };
180
- }, [X]), c(() => {
180
+ }, [X]), l(() => {
181
181
  let e = !1;
182
182
  return (async () => {
183
- if (S) {
183
+ if (x) {
184
184
  A([]), j(!1);
185
185
  return;
186
186
  }
@@ -205,14 +205,14 @@ function y({ data: m, showAppendices: h = !0, withEnglishTranslation: g = !0, he
205
205
  e = !0;
206
206
  };
207
207
  }, [
208
- C,
208
+ S,
209
209
  h,
210
210
  g,
211
211
  Y,
212
- S,
212
+ x,
213
213
  N
214
- ]), c(() => {
215
- if (S || k.length === 0) return;
214
+ ]), l(() => {
215
+ if (x || k.length === 0) return;
216
216
  let e = B.current.slice(0, Y).filter((e) => e != null);
217
217
  if (e.length === 0) return;
218
218
  let t = new IntersectionObserver((t) => {
@@ -235,8 +235,8 @@ function y({ data: m, showAppendices: h = !0, withEnglishTranslation: g = !0, he
235
235
  }, [
236
236
  k,
237
237
  Y,
238
- S
239
- ]), c(() => {
238
+ x
239
+ ]), l(() => {
240
240
  let e = R.current;
241
241
  if (!Z || !e) {
242
242
  O(0);
@@ -250,19 +250,19 @@ function y({ data: m, showAppendices: h = !0, withEnglishTranslation: g = !0, he
250
250
  return n.observe(e), () => {
251
251
  n.disconnect();
252
252
  };
253
- }, [C.acceptance, Z]);
254
- let Ce = (e) => {
253
+ }, [S.acceptance, Z]);
254
+ let Ee = (e) => {
255
255
  let t = e instanceof Date ? e : new Date(e);
256
256
  return Number.isNaN(t.getTime()) ? null : t;
257
- }, we = (e) => {
258
- let t = Ce(e);
257
+ }, De = (e) => {
258
+ let t = Ee(e);
259
259
  return t ? new Intl.DateTimeFormat(V.legal, {
260
260
  day: "2-digit",
261
261
  month: "2-digit",
262
262
  year: "numeric"
263
263
  }).format(t) : "-";
264
- }, Te = (e) => {
265
- let t = Ce(e);
264
+ }, Oe = (e) => {
265
+ let t = Ee(e);
266
266
  return t ? new Intl.DateTimeFormat(V.legal, {
267
267
  day: "2-digit",
268
268
  month: "2-digit",
@@ -270,141 +270,147 @@ function y({ data: m, showAppendices: h = !0, withEnglishTranslation: g = !0, he
270
270
  hour: "2-digit",
271
271
  minute: "2-digit"
272
272
  }).format(t) : "-";
273
- }, Ee = async (e) => {
274
- let t = y ? await y(e) : void 0;
273
+ }, ke = async (e) => {
274
+ let t = v ? await v(e) : void 0;
275
275
  if (t) {
276
- w(t);
276
+ C(t);
277
277
  return;
278
278
  }
279
- w((t) => ({
279
+ C((t) => ({
280
280
  ...t,
281
281
  acceptance: e
282
282
  }));
283
- }, De = async () => {
284
- await Ee({
283
+ }, Ae = async () => {
284
+ await ke({
285
285
  mode: "acceptance",
286
286
  date: /* @__PURE__ */ new Date()
287
287
  });
288
- }, Oe = async (e) => {
289
- await Ee(e);
290
- }, ke = (e) => {
288
+ }, je = async (e) => {
289
+ await ke(e);
290
+ }, Me = () => {
291
+ let e = S.acceptanceLevel === "signature" ? "signature" : "acceptance";
292
+ e === "signature" && _e(!0), D(e);
293
+ }, Ne = (e) => {
291
294
  M(e), B.current[e]?.scrollIntoView({
292
295
  behavior: "smooth",
293
296
  block: "start"
294
297
  });
295
- }, Ae = Z ? he + p : p, $ = ue === "parent", je = C.acceptanceLevel === "signature" ? b(T ? "docs_contract_sale_action_signature_ready" : "docs_contract_sale_action_signature_locked") : b(T ? "docs_contract_sale_action_acceptance_ready" : "docs_contract_sale_action_acceptance_locked"), Me = Q?.mode === "signature" ? b("docs_contract_sale_already_signed", { date: Te(Q.date) }) : Q?.mode === "acceptance" ? b("docs_contract_sale_already_accepted", { date: Te(Q.date) }) : null, Ne = (e, t) => /* @__PURE__ */ f(o, {
298
+ }, Pe = Z ? ve + m : m, $ = _ === "parent", Fe = S.acceptanceLevel === "signature" ? y(w ? "docs_contract_sale_action_signature_ready" : "docs_contract_sale_action_signature_locked") : y(w ? "docs_contract_sale_action_acceptance_ready" : "docs_contract_sale_action_acceptance_locked"), Ie = Q?.mode === "signature" ? y("docs_contract_sale_already_signed", { date: Oe(Q.date) }) : Q?.mode === "acceptance" ? y("docs_contract_sale_already_accepted", { date: Oe(Q.date) }) : null, Le = (e, t) => /* @__PURE__ */ p(o, {
296
299
  ref: (e) => {
297
300
  B.current[t] = e;
298
301
  },
299
- className: S || t === Y - 1 ? "!mb-0" : void 0,
302
+ className: x || t === Y - 1 ? "!mb-0" : void 0,
300
303
  children: [
301
- /* @__PURE__ */ d(ee, {
304
+ /* @__PURE__ */ f(ee, {
302
305
  documentTitle: G,
303
- saleDocumentNumber: C.saleDocumentNumber,
306
+ saleDocumentNumber: S.saleDocumentNumber,
304
307
  currentPage: t + 1,
305
308
  totalPages: Y,
306
309
  documentLanguage: V
307
310
  }),
308
- e.kind === "invoice" ? /* @__PURE__ */ d(a, {
309
- saleDocument: C,
311
+ e.kind === "invoice" ? /* @__PURE__ */ f(a, {
312
+ saleDocument: S,
310
313
  items: e.items,
311
314
  subtotal: W,
312
- tax: xe,
315
+ tax: we,
313
316
  total: U,
314
- formatDate: we,
317
+ formatDate: De,
315
318
  showInvoiceMeta: e.showInvoiceMeta,
316
319
  showTotalsSection: e.showTotalsSection,
317
320
  showNotesSection: e.showNotesSection,
318
321
  showAcceptanceSection: e.showAcceptanceSection && q.length === 0,
319
322
  documentQrCodeUrl: e.showInvoiceMeta ? N : void 0,
320
323
  documentLanguage: V
321
- }) : /* @__PURE__ */ f("main", {
324
+ }) : /* @__PURE__ */ p("main", {
322
325
  className: "flex flex-grow flex-col px-4 text-left md:px-8",
323
- children: [/* @__PURE__ */ d(ne, {
326
+ children: [/* @__PURE__ */ f(te, {
324
327
  title: e.title,
325
328
  articles: e.articles,
326
329
  withEnglishTranslation: e.withTranslation,
327
330
  showTitle: e.showTitle
328
- }), t === Y - 1 ? /* @__PURE__ */ d(i, {
329
- saleDocument: C,
331
+ }), t === Y - 1 ? /* @__PURE__ */ f(i, {
332
+ saleDocument: S,
330
333
  documentLanguage: V,
331
- formatDate: we
334
+ formatDate: De
332
335
  }) : null]
333
336
  }),
334
- /* @__PURE__ */ d(s, {
337
+ /* @__PURE__ */ f(s, {
335
338
  documentTitle: G,
336
- saleDocumentNumber: C.saleDocumentNumber,
339
+ saleDocumentNumber: S.saleDocumentNumber,
337
340
  currentPage: t + 1,
338
341
  totalPages: Y,
339
342
  documentLanguage: V
340
343
  })
341
344
  ]
342
345
  }, e.key);
343
- return S ? /* @__PURE__ */ d("div", {
346
+ return x ? /* @__PURE__ */ f("div", {
344
347
  ref: z,
345
- "data-testid": ve && ye ? "contract-sale-document-pdf-ready" : void 0,
348
+ "data-testid": xe && Se ? "contract-sale-document-pdf-ready" : void 0,
346
349
  className: "contract-sale-document contract-sale-document-pdf bg-white text-foreground",
347
- children: J.map(Ne)
348
- }) : /* @__PURE__ */ d(ie, { children: /* @__PURE__ */ f("div", {
350
+ children: J.map(Le)
351
+ }) : /* @__PURE__ */ f(ie, { children: /* @__PURE__ */ p("div", {
349
352
  className: `contract-sale-document ${$ ? "h-full" : "h-dvh"} min-h-0 md:flex`,
350
- children: [/* @__PURE__ */ d(re, {
353
+ children: [/* @__PURE__ */ f(ne, {
351
354
  thumbnails: k,
352
- activePage: _e,
353
- onThumbnailClick: ke,
355
+ activePage: be,
356
+ onThumbnailClick: Ne,
354
357
  totalPages: Y,
355
358
  heightClassName: $ ? "h-full" : "h-dvh",
356
359
  contentClassName: $ ? "pt-16" : void 0,
357
- isLoading: ge
358
- }), /* @__PURE__ */ f("div", {
360
+ isLoading: ye
361
+ }), /* @__PURE__ */ p("div", {
359
362
  ref: L,
360
363
  "data-testid": "contract-sale-document-scroll-container",
361
364
  className: `${$ ? "h-full" : "h-dvh"} min-h-0 flex-1 overflow-y-auto overscroll-y-contain bg-transparent`,
362
365
  style: {
363
366
  paddingTop: $ ? "3.5rem" : void 0,
364
367
  scrollPaddingTop: $ ? "3.5rem" : void 0,
365
- paddingBottom: `${Ae}px`
368
+ paddingBottom: `${Pe}px`
366
369
  },
367
370
  children: [
368
- J.map(Ne),
369
- /* @__PURE__ */ d("p", {
371
+ J.map(Le),
372
+ /* @__PURE__ */ f("p", {
370
373
  className: "px-4 text-center text-xs text-muted-foreground/75 md:px-8",
371
- style: { paddingTop: `${p}px` },
372
- children: b("docs_contract_sale_end")
374
+ style: { paddingTop: `${m}px` },
375
+ children: y("docs_contract_sale_end")
373
376
  }),
374
- Z ? /* @__PURE__ */ d("div", {
377
+ Z ? /* @__PURE__ */ f("div", {
375
378
  ref: R,
376
379
  className: "fixed bottom-0 left-0 right-0 z-30 flex items-center justify-center border-t border-border bg-background/70 p-4 backdrop-blur-xl backdrop-saturate-125 supports-[backdrop-filter]:bg-background/55",
377
- children: Me ? /* @__PURE__ */ f("div", {
380
+ children: Ie ? /* @__PURE__ */ p("div", {
378
381
  className: "flex items-center gap-2 px-6 py-3 text-sm font-semibold text-success",
379
- children: [/* @__PURE__ */ d(oe, {
382
+ children: [/* @__PURE__ */ f(oe, {
380
383
  className: "h-4 w-4 shrink-0",
381
384
  "aria-hidden": "true"
382
- }), /* @__PURE__ */ d("p", {
385
+ }), /* @__PURE__ */ f("p", {
383
386
  className: "text-center",
384
- children: Me
387
+ children: Ie
385
388
  })]
386
- }) : /* @__PURE__ */ d(e, {
387
- onClick: () => D(C.acceptanceLevel === "signature" ? "signature" : "acceptance"),
388
- disabled: !T,
389
+ }) : /* @__PURE__ */ f(e, {
390
+ onClick: Me,
391
+ disabled: !w,
389
392
  className: "px-6 py-3 text-sm font-semibold",
390
393
  "data-testid": "contract-sale-document-action-button",
391
- children: je
394
+ children: Fe
392
395
  })
393
396
  }) : null,
394
- /* @__PURE__ */ d(t, {
397
+ /* @__PURE__ */ f(t, {
395
398
  isOpen: E === "acceptance",
396
399
  onClose: () => D(null),
397
400
  onAccept: async () => {
398
- await De(), D(null);
401
+ await Ae(), D(null);
399
402
  }
400
403
  }),
401
- /* @__PURE__ */ d(te, {
402
- isOpen: E === "signature",
403
- onClose: () => D(null),
404
- onSave: async (e) => {
405
- await Oe(e), D(null);
406
- }
407
- })
404
+ ge ? /* @__PURE__ */ f(re, {
405
+ fallback: null,
406
+ children: /* @__PURE__ */ f(le, {
407
+ isOpen: E === "signature",
408
+ onClose: () => D(null),
409
+ onSave: async (e) => {
410
+ await je(e), D(null);
411
+ }
412
+ })
413
+ }) : null
408
414
  ]
409
415
  })]
410
416
  }) });
@@ -1,6 +1,6 @@
1
1
  import { resolveBookingSearchParamsFromSessionStorage as e } from "../../lib/booking.js";
2
- import { useStorefrontCart as t } from "../../lib/cart.js";
3
- import { getLocalizedValue as n } from "../../localization.js";
2
+ import { getLocalizedValue as t } from "../../localization.js";
3
+ import { useStorefrontCart as n } from "../../lib/cart.js";
4
4
  import { buildStorefrontImageUrl as r } from "../../lib/storefrontImage.js";
5
5
  import ee from "../../chunks/assets/whatsapp-m5e0vjnZ.js";
6
6
  import { MISSING_SHOP_EMAIL as i } from "../../lib/storefrontMissingValues.js";
@@ -19,13 +19,13 @@ var b = 36, x = (e, t) => {
19
19
  return n ? r(n, t ?? "") : "";
20
20
  };
21
21
  function S({ storefrontConfiguration: r, whatsappHref: S, whatsappPhoneDisplay: C }) {
22
- let { t: w, i18n: T } = h(), { storeSlug: E } = m(), D = p(), { itemCount: O } = t(), k = u("(max-width: 640px)"), [A, te] = d(), j = te?.height ?? b, M = _({
22
+ let { t: w, i18n: T } = h(), { storeSlug: E } = m(), D = p(), { itemCount: O } = n(), k = u("(max-width: 640px)"), [A, te] = d(), j = te?.height ?? b, M = _({
23
23
  enabled: k,
24
24
  thresholdPx: j
25
25
  }), N = k && M ? `translateY(-${j}px)` : "translateY(0)", P = () => {
26
26
  let e = T.language.startsWith("fr") ? "en" : "fr";
27
27
  T.changeLanguage(e);
28
- }, F = `/${E ?? ""}`, I = e(new URLSearchParams(D.search), E), L = I.toString(), R = !!(I.get("start_time")?.trim() && I.get("end_time")?.trim()), z = L ? `?${L}` : "", B = `${F}/booking${z}`, V = `${F}/checkout${z}`, H = r?.shop.name?.trim() ?? "", U = r?.shop.emailAddress?.trim() ?? "", W = r?.workspace?.workspaceLanguage, G = n(r?.content?.tagline, T.language, W).trim(), K = a(r?.shop), q = G || K || "[Missing shop address]", J = !G && !K, Y = n(r?.content?.topBannerMessage, T.language, W).trim() || w("top_bar_message"), X = x(r?.content?.logoWideImageId, E), Z = x(r?.shop.logoImageId ?? r?.content?.logoSquareImageId, E), Q = X.length > 0, $ = Z.length > 0;
28
+ }, F = `/${E ?? ""}`, I = e(new URLSearchParams(D.search), E), L = I.toString(), R = !!(I.get("start_time")?.trim() && I.get("end_time")?.trim()), z = L ? `?${L}` : "", B = `${F}/booking${z}`, V = `${F}/checkout${z}`, H = r?.shop.name?.trim() ?? "", U = r?.shop.emailAddress?.trim() ?? "", W = r?.workspace?.workspaceLanguage, G = t(r?.content?.tagline, T.language, W).trim(), K = a(r?.shop), q = G || K || "[Missing shop address]", J = !G && !K, Y = t(r?.content?.topBannerMessage, T.language, W).trim() || w("top_bar_message"), X = x(r?.content?.logoWideImageId, E), Z = x(r?.shop.logoImageId ?? r?.content?.logoSquareImageId, E), Q = X.length > 0, $ = Z.length > 0;
29
29
  return /* @__PURE__ */ l("div", {
30
30
  className: "sticky top-0 z-30",
31
31
  children: [/* @__PURE__ */ c("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Layout/index.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAA;AAEvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AAItE,KAAK,WAAW,GAAG;IACjB,uBAAuB,CAAC,EAAE,uBAAuB,CAAA;IACjD,kBAAkB,EAAE,6BAA6B,CAAA;CAClD,CAAA;AAED,wBAAgB,MAAM,CAAC,EACrB,uBAAuB,EACvB,kBAAkB,GACnB,EAAE,WAAW,2CA2Db"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Layout/index.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAA;AAGvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AAItE,KAAK,WAAW,GAAG;IACjB,uBAAuB,CAAC,EAAE,uBAAuB,CAAA;IACjD,kBAAkB,EAAE,6BAA6B,CAAA;CAClD,CAAA;AAED,wBAAgB,MAAM,CAAC,EACrB,uBAAuB,EACvB,kBAAkB,GACnB,EAAE,WAAW,2CAiEb"}
@@ -7,54 +7,61 @@ import { PlaygroundDevFloatingButton as a } from "../PlaygroundDevFloatingButton
7
7
  import { StorefrontPopupMessages as o } from "../StorefrontPopupMessages/index.js";
8
8
  import { WhatsAppFloatingButton as s } from "../WhatsAppFloatingButton/WhatsAppFloatingButton.js";
9
9
  import "../WhatsAppFloatingButton/index.js";
10
- import { Provider as c } from "../../ui/tooltip.js";
11
- import { useEffect as l } from "react";
12
- import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
13
- import { RootProvider as p } from "@rpcbase/client";
14
- import { Outlet as m, useLocation as h, useParams as g } from "@rpcbase/router";
15
- import { useTranslation as _ } from "react-i18next";
10
+ import { STOREFRONT_TOASTER_ID as c } from "../../lib/toast.js";
11
+ import { Provider as l } from "../../ui/tooltip.js";
12
+ import { useEffect as u } from "react";
13
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
14
+ import { RootProvider as m } from "@rpcbase/client";
15
+ import { Outlet as h, useLocation as g, useParams as _ } from "@rpcbase/router";
16
+ import { useTranslation as v } from "react-i18next";
17
+ import { Toaster as y } from "sonner";
16
18
  //#region src/components/Layout/index.tsx
17
- function v({ storefrontConfiguration: v, storefrontProducts: y }) {
18
- let { storeSlug: b, referenceId: x } = g(), S = h(), { i18n: C } = _();
19
- l(() => {
19
+ function b({ storefrontConfiguration: b, storefrontProducts: x }) {
20
+ let { storeSlug: S, referenceId: C } = _(), w = g(), { i18n: T } = v();
21
+ u(() => {
20
22
  document.documentElement.setAttribute("data-hydrated", "true");
21
23
  }, []);
22
- let w = t({
23
- storefrontConfiguration: v,
24
- language: C.language
25
- }), T = w?.href, E = typeof x == "string" && x.trim().length > 0, D = E && new URLSearchParams(S.search).get("pdf") === "1";
26
- return /* @__PURE__ */ d(p, { children: /* @__PURE__ */ d(c, { children: /* @__PURE__ */ d(e, {
27
- storeSlug: b ?? "",
28
- products: y,
29
- children: /* @__PURE__ */ d("div", {
30
- className: `loczer-storefront flex flex-col bg-background text-foreground ${E && !D ? "h-dvh overflow-hidden" : "min-h-screen"}`,
31
- children: E ? /* @__PURE__ */ d("main", {
32
- className: `flex-1 ${D ? "bg-white" : "overflow-hidden"}`,
33
- children: /* @__PURE__ */ d(m, {})
34
- }) : /* @__PURE__ */ f(u, { children: [
35
- /* @__PURE__ */ d(r, {
36
- storefrontConfiguration: v,
37
- whatsappHref: T,
38
- whatsappPhoneDisplay: w?.phoneDisplay
24
+ let E = t({
25
+ storefrontConfiguration: b,
26
+ language: T.language
27
+ }), D = E?.href, O = typeof C == "string" && C.trim().length > 0, k = O && new URLSearchParams(w.search).get("pdf") === "1";
28
+ return /* @__PURE__ */ p(m, { children: [/* @__PURE__ */ f(y, {
29
+ id: c,
30
+ closeButton: !0,
31
+ position: "bottom-center",
32
+ theme: "dark"
33
+ }), /* @__PURE__ */ f(l, { children: /* @__PURE__ */ f(e, {
34
+ storeSlug: S ?? "",
35
+ products: x,
36
+ children: /* @__PURE__ */ f("div", {
37
+ className: `loczer-storefront flex flex-col bg-background text-foreground ${O && !k ? "h-dvh overflow-hidden" : "min-h-screen"}`,
38
+ children: O ? /* @__PURE__ */ f("main", {
39
+ className: `flex-1 ${k ? "bg-white" : "overflow-hidden"}`,
40
+ children: /* @__PURE__ */ f(h, {})
41
+ }) : /* @__PURE__ */ p(d, { children: [
42
+ /* @__PURE__ */ f(r, {
43
+ storefrontConfiguration: b,
44
+ whatsappHref: D,
45
+ whatsappPhoneDisplay: E?.phoneDisplay
39
46
  }),
40
- /* @__PURE__ */ d("main", {
47
+ /* @__PURE__ */ f("main", {
41
48
  className: "flex-1",
42
- children: /* @__PURE__ */ d(m, {})
49
+ children: /* @__PURE__ */ f(h, {})
43
50
  }),
44
- /* @__PURE__ */ d(n, {
45
- shop: v?.shop,
46
- whatsappHref: T,
47
- whatsappPhoneDisplay: w?.phoneDisplay,
48
- openingHours: v?.bookingEngine.shop.openingHours,
49
- openingHoursOverrides: v?.bookingEngine.shop.openingHoursOverrides
51
+ /* @__PURE__ */ f(n, {
52
+ shop: b?.shop,
53
+ whatsappHref: D,
54
+ whatsappPhoneDisplay: E?.phoneDisplay,
55
+ openingHours: b?.bookingEngine.shop.openingHours,
56
+ openingHoursOverrides: b?.bookingEngine.shop.openingHoursOverrides
50
57
  }),
51
- /* @__PURE__ */ d(i, {}),
52
- T && v?.content?.showWhatsappFloatingButton !== !1 ? /* @__PURE__ */ d(s, { href: T }) : null,
53
- /* @__PURE__ */ d(a, {}),
54
- /* @__PURE__ */ d(o, { storefrontConfiguration: v })
58
+ /* @__PURE__ */ f(i, {}),
59
+ D && b?.content?.showWhatsappFloatingButton !== !1 ? /* @__PURE__ */ f(s, { href: D }) : null,
60
+ /* @__PURE__ */ f(a, {}),
61
+ /* @__PURE__ */ f(o, { storefrontConfiguration: b })
55
62
  ] })
56
63
  })
57
- }) }) });
64
+ }) })] });
58
65
  }
59
66
  //#endregion
60
- export { v as Layout };
67
+ export { b as Layout };
@@ -3,7 +3,8 @@ type ProductPriceBadgeProps = {
3
3
  prices?: StorefrontPublicProductPrice[];
4
4
  minPriceMinor?: number;
5
5
  className?: string;
6
+ openOnHover?: boolean;
6
7
  };
7
- export declare const ProductPriceBadge: ({ prices, minPriceMinor, className }: ProductPriceBadgeProps) => import("react/jsx-runtime").JSX.Element | null;
8
+ export declare const ProductPriceBadge: ({ prices, minPriceMinor, className, openOnHover, }: ProductPriceBadgeProps) => import("react/jsx-runtime").JSX.Element | null;
8
9
  export {};
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ProductPriceBadge/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAA;AAoBhF,KAAK,sBAAsB,GAAG;IAC5B,MAAM,CAAC,EAAE,4BAA4B,EAAE,CAAA;IACvC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,sCAAsC,sBAAsB,mDA4W7F,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ProductPriceBadge/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAA;AAoBhF,KAAK,sBAAsB,GAAG;IAC5B,MAAM,CAAC,EAAE,4BAA4B,EAAE,CAAA;IACvC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,oDAK/B,sBAAsB,mDA8WxB,CAAA"}