@loczer/storefront-sdk 0.192.0 → 0.193.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 (29) hide show
  1. package/dist/components/ContractSaleDocument/DocumentAcceptanceSection.d.ts +10 -0
  2. package/dist/components/ContractSaleDocument/DocumentAcceptanceSection.d.ts.map +1 -0
  3. package/dist/components/ContractSaleDocument/DocumentAcceptanceSection.js +104 -0
  4. package/dist/components/ContractSaleDocument/Invoice.d.ts +2 -2
  5. package/dist/components/ContractSaleDocument/Invoice.d.ts.map +1 -1
  6. package/dist/components/ContractSaleDocument/Invoice.js +182 -135
  7. package/dist/components/ContractSaleDocument/InvoiceDetails.d.ts.map +1 -1
  8. package/dist/components/ContractSaleDocument/InvoiceDetails.js +106 -138
  9. package/dist/components/ContractSaleDocument/TermsAndConditionsContent.d.ts +0 -2
  10. package/dist/components/ContractSaleDocument/TermsAndConditionsContent.d.ts.map +1 -1
  11. package/dist/components/ContractSaleDocument/TermsAndConditionsContent.js +32 -37
  12. package/dist/i18n/en.d.ts +4 -0
  13. package/dist/i18n/en.d.ts.map +1 -1
  14. package/dist/i18n/en.js +4 -0
  15. package/dist/i18n/fr.d.ts +4 -0
  16. package/dist/i18n/fr.d.ts.map +1 -1
  17. package/dist/i18n/fr.js +4 -0
  18. package/dist/index.d.ts +121 -9
  19. package/dist/index.js +5 -5
  20. package/dist/lib/contractSaleDocument.d.ts +44 -3
  21. package/dist/lib/contractSaleDocument.d.ts.map +1 -1
  22. package/dist/lib/contractSaleDocument.js +33 -17
  23. package/dist/lib/contractSaleDocumentApi.d.ts +54 -6
  24. package/dist/lib/contractSaleDocumentApi.d.ts.map +1 -1
  25. package/dist/lib/contractSaleDocumentApi.js +41 -37
  26. package/dist/pages/ContractSaleDocumentPage.d.ts +21 -9
  27. package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
  28. package/dist/storefront.css +1 -1
  29. package/package.json +1 -1
@@ -1,28 +1,40 @@
1
1
  import { Button as e } from "../../ui/button.js";
2
2
  import { AcceptanceModal as t } from "./AcceptanceModal.js";
3
3
  import { formatContractSaleDocumentLabel as n, resolveContractSaleDocumentLanguage as r } from "./language.js";
4
- import { InvoiceDetails as i } from "./InvoiceDetails.js";
5
- import { Page as a } from "./Page.js";
6
- import { PageFooter as o } from "./PageFooter.js";
7
- import { PageHeader as s } from "./PageHeader.js";
8
- import { SignatureModal as ee } from "./SignatureModal.js";
9
- import { DEFAULT_TERMS_ARTICLES as c, TermsAndConditionsContent as te } from "./TermsAndConditionsContent.js";
10
- import { ThumbnailSidebar as ne } from "./ThumbnailSidebar.js";
4
+ import { DocumentAcceptanceSection as i } from "./DocumentAcceptanceSection.js";
5
+ import { InvoiceDetails as a } from "./InvoiceDetails.js";
6
+ import { Page as o } from "./Page.js";
7
+ import { PageFooter as s } from "./PageFooter.js";
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";
11
12
  /* empty css */
12
- import { useEffect as l, useRef as u, useState as d } from "react";
13
- import { Fragment as re, jsx as f, jsxs as p } from "react/jsx-runtime";
14
- import { useTranslation as ie } from "react-i18next";
15
- import { CheckCircle2 as ae } from "lucide-react";
16
- import * as oe from "html-to-image";
17
- import { toString as se } from "qrcode";
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";
15
+ import { useTranslation as ae } from "react-i18next";
16
+ import { CheckCircle2 as oe } from "lucide-react";
17
+ import * as se from "html-to-image";
18
+ import { toString as ce } from "qrcode";
18
19
  //#region src/components/ContractSaleDocument/Invoice.tsx
19
- var m = 22, h = 10, g = 14, _ = 14, v = 3, ce = 6, y = (e, t) => {
20
+ async function le(e) {
21
+ e.complete || await new Promise((t) => {
22
+ let n = () => {
23
+ e.removeEventListener("load", n), e.removeEventListener("error", n), t();
24
+ };
25
+ e.addEventListener("load", n), e.addEventListener("error", n), e.complete && n();
26
+ });
27
+ try {
28
+ await e.decode();
29
+ } catch {}
30
+ }
31
+ var p = 22, m = 10, h = 14, g = 14, ue = 3, _ = 6, v = (e, t) => {
20
32
  if (t <= 0) return [e];
21
33
  let n = [];
22
34
  for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
23
35
  return n;
24
- }, le = (e) => {
25
- if (e.length <= h) return [{
36
+ }, de = (e) => {
37
+ if (e.length <= m) return [{
26
38
  kind: "invoice",
27
39
  key: "invoice-page-1",
28
40
  items: e,
@@ -34,13 +46,13 @@ var m = 22, h = 10, g = 14, _ = 14, v = 3, ce = 6, y = (e, t) => {
34
46
  let t = [{
35
47
  kind: "invoice",
36
48
  key: "invoice-page-1",
37
- items: e.slice(0, h),
49
+ items: e.slice(0, m),
38
50
  showInvoiceMeta: !0,
39
51
  showTotalsSection: !1,
40
52
  showNotesSection: !1,
41
53
  showAcceptanceSection: !1
42
- }], n = e.slice(h);
43
- if (n.length <= _) return t.push({
54
+ }], n = e.slice(m);
55
+ if (n.length <= g) return t.push({
44
56
  kind: "invoice",
45
57
  key: "invoice-page-final-1",
46
58
  items: n,
@@ -49,9 +61,9 @@ var m = 22, h = 10, g = 14, _ = 14, v = 3, ce = 6, y = (e, t) => {
49
61
  showNotesSection: !0,
50
62
  showAcceptanceSection: !0
51
63
  }), t;
52
- let r = n.length % g;
53
- r === 0 && (r = Math.min(_, g));
54
- let i = Math.max(0, n.length - r), a = n.slice(0, i), o = n.slice(i), s = y(a, g);
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);
55
67
  return s.forEach((e, n) => {
56
68
  t.push({
57
69
  kind: "invoice",
@@ -71,24 +83,28 @@ var m = 22, h = 10, g = 14, _ = 14, v = 3, ce = 6, y = (e, t) => {
71
83
  showNotesSection: !0,
72
84
  showAcceptanceSection: !0
73
85
  }), t;
74
- }, ue = (e, t, n) => y(e, n ? v : ce).map((e, n) => ({
75
- kind: "terms",
76
- key: `terms-page-${n + 1}`,
77
- title: t,
78
- showTitle: n === 0,
79
- articles: e
80
- })), de = (e) => e.kind === "credit_note" ? [] : !e.terms || e.terms.articles.length === 0 ? c : e.terms.articles, fe = (e) => e.terms?.title ?? "Conditions Generales de Vente";
81
- function b({ data: c, showTermsPage: h = !0, withEnglishTranslation: g = !0, heightMode: _ = "viewport", renderMode: v = "interactive", publicDocumentUrl: ce, onAccept: y }) {
82
- let { t: b, i18n: pe } = ie(), x = ce?.trim() ?? "", S = v === "pdf", [C, w] = d(c), [T, E] = d(!1), [D, O] = d(null), [me, k] = d(0), [A, j] = d([]), [he, M] = d(!0), [ge, N] = d(0), [P, F] = d(""), [_e, I] = d(x.length === 0 && !S), L = u(null), R = u(null), z = u([]);
83
- l(() => {
84
- w(c);
85
- }, [c]), l(() => {
86
+ }, fe = (e, t) => {
87
+ let n = t && e.articles.some((e) => !!(e.translationTitle || e.translationBody || e.translationBodyHtml)), r = n ? ue : _;
88
+ return v(e.articles, r).map((t, r) => ({
89
+ kind: "appendix",
90
+ key: `${e.id}-page-${r + 1}`,
91
+ title: e.title,
92
+ showTitle: r === 0,
93
+ articles: t,
94
+ withTranslation: n
95
+ }));
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(() => {
86
102
  if (!x) {
87
- F(""), I(!S);
103
+ P(""), F(!S);
88
104
  return;
89
105
  }
90
106
  let e = !1;
91
- return F(""), I(!1), se(x, {
107
+ return P(""), F(!1), ce(x, {
92
108
  type: "svg",
93
109
  errorCorrectionLevel: "M",
94
110
  margin: 1,
@@ -98,54 +114,80 @@ function b({ data: c, showTermsPage: h = !0, withEnglishTranslation: g = !0, hei
98
114
  light: "#FFFFFF"
99
115
  }
100
116
  }).then((t) => {
101
- e || F(`data:image/svg+xml;utf8,${encodeURIComponent(t)}`);
117
+ e || P(`data:image/svg+xml;utf8,${encodeURIComponent(t)}`);
102
118
  }).catch((t) => {
103
- e || (console.error("Document QR code generation failed:", t), F(""));
119
+ e || (console.error("Document QR code generation failed:", t), P(""));
104
120
  }).finally(() => {
105
- e || I(!0);
121
+ e || F(!0);
106
122
  }), () => {
107
123
  e = !0;
108
124
  };
109
125
  }, [x, S]);
110
- let B = r(C, pe.language), ve = (e, t = {}) => n(b, B, e, t), V = C.kind === "credit_note" ? -1 : 1, H = C.items.reduce((e, t) => e + t.quantity * t.unitPrice, 0) * V, U = C.items.reduce((e, t) => e + t.quantity * t.unitPrice * V / (1 + (t.taxRate ?? C.taxRate ?? 0)), 0), ye = H - U, W = ve(C.kind === "credit_note" ? "docs_contract_sale_credit_note_title" : C.kind === "quote" ? "docs_contract_sale_quote_title" : "docs_contract_sale_invoice_title"), G = fe(C), K = de(C), be = le(C.items), q = g, xe = h ? ue(K, G, q) : [], J = [...be, ...xe], Y = J.length, Se = [
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 = [
111
127
  C.id,
112
128
  C.kind,
113
129
  C.saleDocumentNumber,
114
130
  C.items.map((e) => `${e.id}:${e.description}:${e.quantity}:${e.unitPrice}`).join(","),
115
- h ? G : "",
116
- h ? K.map((e) => `${e.id}:${e.title}:${e.body}:${e.translationTitle ?? ""}:${e.translationBody ?? ""}`).join(",") : "",
117
- q ? "translated" : "legal-only",
118
- B.legal,
119
- B.customer,
120
- B.translation ?? "",
131
+ C.rental ? `${C.rental.bookingNumber}:${C.rental.start.toISOString()}:${C.rental.end.toISOString()}:${C.rental.pickupAddress ?? ""}:${C.rental.returnAddress ?? ""}` : "",
132
+ h ? K.map((e) => [
133
+ e.id,
134
+ e.title,
135
+ e.articles.map((e) => `${e.id}:${e.title}:${e.body}:${e.bodyHtml ?? ""}:${e.translationTitle ?? ""}:${e.translationBody ?? ""}:${e.translationBodyHtml ?? ""}`).join(",")
136
+ ].join(":")).join("|") : "",
137
+ g ? "translated" : "legal-only",
138
+ V.legal,
139
+ V.customer,
140
+ V.translation ?? "",
121
141
  J.map((e) => e.key).join(",")
122
- ].join("|"), X = !S && (C.acceptanceLevel !== "none" || C.acceptance != null), Z = C.acceptance;
123
- z.current.length > Y && (z.current.length = Y), l(() => {
124
- N((e) => Y === 0 ? 0 : Math.min(e, Y - 1));
125
- }, [Y]), l(() => {
142
+ ].join("|"), Z = !S && (C.acceptanceLevel !== "none" || C.acceptance != null), Q = C.acceptance;
143
+ c(() => {
144
+ if (!S) {
145
+ I(!0);
146
+ return;
147
+ }
148
+ let e = z.current;
149
+ if (!e) {
150
+ I(!1);
151
+ return;
152
+ }
153
+ let t = !1;
154
+ I(!1);
155
+ let n = Array.from(e.querySelectorAll("img"));
156
+ return Promise.all(n.map(le)).then(() => {
157
+ t || I(!0);
158
+ }), () => {
159
+ t = !0;
160
+ };
161
+ }, [
162
+ N,
163
+ S,
164
+ X
165
+ ]), B.current.length > Y && (B.current.length = Y), c(() => {
166
+ M((e) => Y === 0 ? 0 : Math.min(e, Y - 1));
167
+ }, [Y]), c(() => {
126
168
  let e = L.current;
127
- E(!1), N(0), e?.scrollTo({
169
+ me(!1), M(0), e?.scrollTo({
128
170
  top: 0,
129
171
  left: 0,
130
172
  behavior: "auto"
131
173
  });
132
174
  let t = () => {
133
- e && e.scrollHeight - e.scrollTop <= e.clientHeight + 5 && E(!0);
175
+ e && e.scrollHeight - e.scrollTop <= e.clientHeight + 5 && me(!0);
134
176
  };
135
177
  return e?.addEventListener("scroll", t), t(), () => {
136
178
  e?.removeEventListener("scroll", t);
137
179
  };
138
- }, [Se]), l(() => {
180
+ }, [X]), c(() => {
139
181
  let e = !1;
140
182
  return (async () => {
141
183
  if (S) {
142
- j([]), M(!1);
184
+ A([]), j(!1);
143
185
  return;
144
186
  }
145
- M(!0), await new Promise((e) => setTimeout(e, 0));
146
- let t = [], n = z.current.slice(0, Y);
187
+ j(!0), await new Promise((e) => setTimeout(e, 0));
188
+ let t = [], n = B.current.slice(0, Y);
147
189
  for (let e of n) if (e) try {
148
- let n = await oe.toPng(e, {
190
+ let n = await se.toPng(e, {
149
191
  quality: .7,
150
192
  pixelRatio: 1,
151
193
  style: {
@@ -158,26 +200,26 @@ function b({ data: c, showTermsPage: h = !0, withEnglishTranslation: g = !0, hei
158
200
  } catch (e) {
159
201
  console.error("Thumbnail generation failed:", e);
160
202
  }
161
- e || (j(t), M(!1));
203
+ e || (A(t), j(!1));
162
204
  })(), () => {
163
205
  e = !0;
164
206
  };
165
207
  }, [
166
208
  C,
167
209
  h,
168
- q,
210
+ g,
169
211
  Y,
170
212
  S,
171
- P
172
- ]), l(() => {
173
- if (S || A.length === 0) return;
174
- let e = z.current.slice(0, Y).filter((e) => e != null);
213
+ N
214
+ ]), c(() => {
215
+ if (S || k.length === 0) return;
216
+ let e = B.current.slice(0, Y).filter((e) => e != null);
175
217
  if (e.length === 0) return;
176
218
  let t = new IntersectionObserver((t) => {
177
219
  for (let n of t) {
178
220
  if (!n.isIntersecting) continue;
179
221
  let t = e.findIndex((e) => e === n.target);
180
- t !== -1 && N(t);
222
+ t !== -1 && M(t);
181
223
  }
182
224
  }, {
183
225
  root: L.current,
@@ -191,44 +233,44 @@ function b({ data: c, showTermsPage: h = !0, withEnglishTranslation: g = !0, hei
191
233
  });
192
234
  };
193
235
  }, [
194
- A,
236
+ k,
195
237
  Y,
196
238
  S
197
- ]), l(() => {
239
+ ]), c(() => {
198
240
  let e = R.current;
199
- if (!X || !e) {
200
- k(0);
241
+ if (!Z || !e) {
242
+ O(0);
201
243
  return;
202
244
  }
203
245
  let t = () => {
204
- k(Math.ceil(e.getBoundingClientRect().height));
246
+ O(Math.ceil(e.getBoundingClientRect().height));
205
247
  };
206
248
  if (t(), typeof ResizeObserver > "u") return;
207
249
  let n = new ResizeObserver(t);
208
250
  return n.observe(e), () => {
209
251
  n.disconnect();
210
252
  };
211
- }, [C.acceptance, X]);
212
- let Q = (e) => {
253
+ }, [C.acceptance, Z]);
254
+ let Ce = (e) => {
213
255
  let t = e instanceof Date ? e : new Date(e);
214
256
  return Number.isNaN(t.getTime()) ? null : t;
215
- }, Ce = (e) => {
216
- let t = Q(e);
217
- return t ? new Intl.DateTimeFormat(B.legal, {
257
+ }, we = (e) => {
258
+ let t = Ce(e);
259
+ return t ? new Intl.DateTimeFormat(V.legal, {
218
260
  day: "2-digit",
219
261
  month: "2-digit",
220
262
  year: "numeric"
221
263
  }).format(t) : "-";
222
- }, we = (e) => {
223
- let t = Q(e);
224
- return t ? new Intl.DateTimeFormat(B.legal, {
264
+ }, Te = (e) => {
265
+ let t = Ce(e);
266
+ return t ? new Intl.DateTimeFormat(V.legal, {
225
267
  day: "2-digit",
226
268
  month: "2-digit",
227
269
  year: "numeric",
228
270
  hour: "2-digit",
229
271
  minute: "2-digit"
230
272
  }).format(t) : "-";
231
- }, Te = async (e) => {
273
+ }, Ee = async (e) => {
232
274
  let t = y ? await y(e) : void 0;
233
275
  if (t) {
234
276
  w(t);
@@ -238,124 +280,129 @@ function b({ data: c, showTermsPage: h = !0, withEnglishTranslation: g = !0, hei
238
280
  ...t,
239
281
  acceptance: e
240
282
  }));
241
- }, Ee = async () => {
242
- await Te({
283
+ }, De = async () => {
284
+ await Ee({
243
285
  mode: "acceptance",
244
286
  date: /* @__PURE__ */ new Date()
245
287
  });
246
- }, De = async (e) => {
247
- await Te(e);
248
- }, Oe = (e) => {
249
- N(e), z.current[e]?.scrollIntoView({
288
+ }, Oe = async (e) => {
289
+ await Ee(e);
290
+ }, ke = (e) => {
291
+ M(e), B.current[e]?.scrollIntoView({
250
292
  behavior: "smooth",
251
293
  block: "start"
252
294
  });
253
- }, ke = X ? me + m : m, $ = _ === "parent", Ae = 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"), je = Z?.mode === "signature" ? b("docs_contract_sale_already_signed", { date: we(Z.date) }) : Z?.mode === "acceptance" ? b("docs_contract_sale_already_accepted", { date: we(Z.date) }) : null, Me = (e, t) => /* @__PURE__ */ p(a, {
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, {
254
296
  ref: (e) => {
255
- z.current[t] = e;
297
+ B.current[t] = e;
256
298
  },
257
299
  className: S || t === Y - 1 ? "!mb-0" : void 0,
258
300
  children: [
259
- /* @__PURE__ */ f(s, {
260
- documentTitle: W,
301
+ /* @__PURE__ */ d(ee, {
302
+ documentTitle: G,
261
303
  saleDocumentNumber: C.saleDocumentNumber,
262
304
  currentPage: t + 1,
263
305
  totalPages: Y,
264
- documentLanguage: B
306
+ documentLanguage: V
265
307
  }),
266
- e.kind === "invoice" ? /* @__PURE__ */ f(i, {
308
+ e.kind === "invoice" ? /* @__PURE__ */ d(a, {
267
309
  saleDocument: C,
268
310
  items: e.items,
269
- subtotal: U,
270
- tax: ye,
271
- total: H,
272
- formatDate: Ce,
311
+ subtotal: W,
312
+ tax: xe,
313
+ total: U,
314
+ formatDate: we,
273
315
  showInvoiceMeta: e.showInvoiceMeta,
274
316
  showTotalsSection: e.showTotalsSection,
275
317
  showNotesSection: e.showNotesSection,
276
- showAcceptanceSection: e.showAcceptanceSection,
277
- documentQrCodeUrl: e.showInvoiceMeta ? P : void 0,
278
- documentLanguage: B
318
+ showAcceptanceSection: e.showAcceptanceSection && q.length === 0,
319
+ documentQrCodeUrl: e.showInvoiceMeta ? N : void 0,
320
+ documentLanguage: V
279
321
  }) : /* @__PURE__ */ f("main", {
280
- className: "flex-grow px-4 text-left md:px-8",
281
- children: /* @__PURE__ */ f(te, {
322
+ className: "flex flex-grow flex-col px-4 text-left md:px-8",
323
+ children: [/* @__PURE__ */ d(ne, {
282
324
  title: e.title,
283
325
  articles: e.articles,
284
- withEnglishTranslation: q,
326
+ withEnglishTranslation: e.withTranslation,
285
327
  showTitle: e.showTitle
286
- })
328
+ }), t === Y - 1 ? /* @__PURE__ */ d(i, {
329
+ saleDocument: C,
330
+ documentLanguage: V,
331
+ formatDate: we
332
+ }) : null]
287
333
  }),
288
- /* @__PURE__ */ f(o, {
289
- documentTitle: W,
334
+ /* @__PURE__ */ d(s, {
335
+ documentTitle: G,
290
336
  saleDocumentNumber: C.saleDocumentNumber,
291
337
  currentPage: t + 1,
292
338
  totalPages: Y,
293
- documentLanguage: B
339
+ documentLanguage: V
294
340
  })
295
341
  ]
296
342
  }, e.key);
297
- return S ? /* @__PURE__ */ f("div", {
298
- "data-testid": _e ? "contract-sale-document-pdf-ready" : void 0,
343
+ return S ? /* @__PURE__ */ d("div", {
344
+ ref: z,
345
+ "data-testid": ve && ye ? "contract-sale-document-pdf-ready" : void 0,
299
346
  className: "contract-sale-document contract-sale-document-pdf bg-white text-foreground",
300
- children: J.map(Me)
301
- }) : /* @__PURE__ */ f(re, { children: /* @__PURE__ */ p("div", {
347
+ children: J.map(Ne)
348
+ }) : /* @__PURE__ */ d(ie, { children: /* @__PURE__ */ f("div", {
302
349
  className: `contract-sale-document ${$ ? "h-full" : "h-dvh"} min-h-0 md:flex`,
303
- children: [/* @__PURE__ */ f(ne, {
304
- thumbnails: A,
305
- activePage: ge,
306
- onThumbnailClick: Oe,
350
+ children: [/* @__PURE__ */ d(re, {
351
+ thumbnails: k,
352
+ activePage: _e,
353
+ onThumbnailClick: ke,
307
354
  totalPages: Y,
308
355
  heightClassName: $ ? "h-full" : "h-dvh",
309
356
  contentClassName: $ ? "pt-16" : void 0,
310
- isLoading: he
311
- }), /* @__PURE__ */ p("div", {
357
+ isLoading: ge
358
+ }), /* @__PURE__ */ f("div", {
312
359
  ref: L,
313
360
  "data-testid": "contract-sale-document-scroll-container",
314
361
  className: `${$ ? "h-full" : "h-dvh"} min-h-0 flex-1 overflow-y-auto overscroll-y-contain bg-transparent`,
315
362
  style: {
316
363
  paddingTop: $ ? "3.5rem" : void 0,
317
364
  scrollPaddingTop: $ ? "3.5rem" : void 0,
318
- paddingBottom: `${ke}px`
365
+ paddingBottom: `${Ae}px`
319
366
  },
320
367
  children: [
321
- J.map(Me),
322
- /* @__PURE__ */ f("p", {
368
+ J.map(Ne),
369
+ /* @__PURE__ */ d("p", {
323
370
  className: "px-4 text-center text-xs text-muted-foreground/75 md:px-8",
324
- style: { paddingTop: `${m}px` },
371
+ style: { paddingTop: `${p}px` },
325
372
  children: b("docs_contract_sale_end")
326
373
  }),
327
- X ? /* @__PURE__ */ f("div", {
374
+ Z ? /* @__PURE__ */ d("div", {
328
375
  ref: R,
329
376
  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",
330
- children: je ? /* @__PURE__ */ p("div", {
377
+ children: Me ? /* @__PURE__ */ f("div", {
331
378
  className: "flex items-center gap-2 px-6 py-3 text-sm font-semibold text-success",
332
- children: [/* @__PURE__ */ f(ae, {
379
+ children: [/* @__PURE__ */ d(oe, {
333
380
  className: "h-4 w-4 shrink-0",
334
381
  "aria-hidden": "true"
335
- }), /* @__PURE__ */ f("p", {
382
+ }), /* @__PURE__ */ d("p", {
336
383
  className: "text-center",
337
- children: je
384
+ children: Me
338
385
  })]
339
- }) : /* @__PURE__ */ f(e, {
340
- onClick: () => O(C.acceptanceLevel === "signature" ? "signature" : "acceptance"),
386
+ }) : /* @__PURE__ */ d(e, {
387
+ onClick: () => D(C.acceptanceLevel === "signature" ? "signature" : "acceptance"),
341
388
  disabled: !T,
342
389
  className: "px-6 py-3 text-sm font-semibold",
343
390
  "data-testid": "contract-sale-document-action-button",
344
- children: Ae
391
+ children: je
345
392
  })
346
393
  }) : null,
347
- /* @__PURE__ */ f(t, {
348
- isOpen: D === "acceptance",
349
- onClose: () => O(null),
394
+ /* @__PURE__ */ d(t, {
395
+ isOpen: E === "acceptance",
396
+ onClose: () => D(null),
350
397
  onAccept: async () => {
351
- await Ee(), O(null);
398
+ await De(), D(null);
352
399
  }
353
400
  }),
354
- /* @__PURE__ */ f(ee, {
355
- isOpen: D === "signature",
356
- onClose: () => O(null),
401
+ /* @__PURE__ */ d(te, {
402
+ isOpen: E === "signature",
403
+ onClose: () => D(null),
357
404
  onSave: async (e) => {
358
- await De(e), O(null);
405
+ await Oe(e), D(null);
359
406
  }
360
407
  })
361
408
  ]
@@ -363,4 +410,4 @@ function b({ data: c, showTermsPage: h = !0, withEnglishTranslation: g = !0, hei
363
410
  }) });
364
411
  }
365
412
  //#endregion
366
- export { b as ContractSaleDocument };
413
+ export { y as ContractSaleDocument };
@@ -1 +1 @@
1
- {"version":3,"file":"InvoiceDetails.d.ts","sourceRoot":"","sources":["../../../src/components/ContractSaleDocument/InvoiceDetails.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,gCAAgC,CAAA;AAIvC,KAAK,mBAAmB,GAAG;IACzB,YAAY,EAAE,oBAAoB,CAAA;IAClC,KAAK,EAAE,4BAA4B,EAAE,CAAA;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,KAAK,MAAM,CAAA;IACpD,gBAAgB,EAAE,4BAA4B,CAAA;IAC9C,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAoBD,wBAAgB,cAAc,CAAC,EAC7B,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,GAAG,EACH,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,eAAsB,EACtB,iBAAwB,EACxB,gBAAuB,EACvB,qBAA4B,EAC5B,iBAAiB,GAClB,EAAE,mBAAmB,2CAoPrB"}
1
+ {"version":3,"file":"InvoiceDetails.d.ts","sourceRoot":"","sources":["../../../src/components/ContractSaleDocument/InvoiceDetails.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,gCAAgC,CAAA;AAKvC,KAAK,mBAAmB,GAAG;IACzB,YAAY,EAAE,oBAAoB,CAAA;IAClC,KAAK,EAAE,4BAA4B,EAAE,CAAA;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,KAAK,MAAM,CAAA;IACpD,gBAAgB,EAAE,4BAA4B,CAAA;IAC9C,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AA0CD,wBAAgB,cAAc,CAAC,EAC7B,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,GAAG,EACH,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,eAAsB,EACtB,iBAAwB,EACxB,gBAAuB,EACvB,qBAA4B,EAC5B,iBAAiB,GAClB,EAAE,mBAAmB,2CAyOrB"}