@loczer/storefront-sdk 0.204.0 → 0.205.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.
@@ -1 +1 @@
1
- {"version":3,"file":"Invoice.d.ts","sourceRoot":"","sources":["../../../src/components/ContractSaleDocument/Invoice.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,oBAAoB,IAAI,wBAAwB,EAChD,oCAAoC,EAKrC,MAAM,gCAAgC,CAAA;AAWvC,OAAO,eAAe,CAAA;AAOtB,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,wBAAwB,CAAA;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,UAAU,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IAClC,UAAU,CAAC,EAAE,aAAa,GAAG,KAAK,CAAA;IAClC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,CACT,UAAU,EAAE,oCAAoC,KAC7C,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,GAAG,wBAAwB,GAAG,IAAI,CAAA;CAChF,CAAA;AAsKD,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EAAE,WAAW,EACjB,cAAqB,EACrB,sBAA6B,EAC7B,UAAuB,EACvB,UAA0B,EAC1B,iBAAiB,EACjB,QAAQ,GACT,EAAE,yBAAyB,2CAmiB3B;AAED,YAAY,EAAE,yBAAyB,EAAE,CAAA"}
1
+ {"version":3,"file":"Invoice.d.ts","sourceRoot":"","sources":["../../../src/components/ContractSaleDocument/Invoice.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,oBAAoB,IAAI,wBAAwB,EAChD,oCAAoC,EAKrC,MAAM,gCAAgC,CAAA;AAUvC,OAAO,eAAe,CAAA;AAOtB,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,wBAAwB,CAAA;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,UAAU,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IAClC,UAAU,CAAC,EAAE,aAAa,GAAG,KAAK,CAAA;IAClC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,CACT,UAAU,EAAE,oCAAoC,KAC7C,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,GAAG,wBAAwB,GAAG,IAAI,CAAA;CAChF,CAAA;AAsKD,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EAAE,WAAW,EACjB,cAAqB,EACrB,sBAA6B,EAC7B,UAAuB,EACvB,UAA0B,EAC1B,iBAAiB,EACjB,QAAQ,GACT,EAAE,yBAAyB,2CAmiB3B;AAED,YAAY,EAAE,yBAAyB,EAAE,CAAA"}
@@ -1,17 +1,17 @@
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 { 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 { TermsAndConditionsContent as te } from "./TermsAndConditionsContent.js";
10
- import { ThumbnailSidebar as ne } from "./ThumbnailSidebar.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 { TermsAndConditionsContent as ee } from "./TermsAndConditionsContent.js";
9
+ import { ThumbnailSidebar as te } from "./ThumbnailSidebar.js";
11
10
  /* empty css */
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";
14
- import { useTranslation as ae } from "react-i18next";
11
+ import { Suspense as ne, lazy as c, useEffect as l, useRef as u, useState as d } from "react";
12
+ import { Fragment as re, jsx as f, jsxs as p } from "react/jsx-runtime";
13
+ import { useTranslation as ie } from "react-i18next";
14
+ import { cn as ae } from "@rpcbase/ui";
15
15
  import { CheckCircle2 as oe } from "lucide-react";
16
16
  import * as se from "html-to-image";
17
17
  import { toString as ce } from "qrcode";
@@ -28,12 +28,12 @@ async function ue(e) {
28
28
  await e.decode();
29
29
  } catch {}
30
30
  }
31
- var m = 22, h = 10, g = 14, _ = 14, de = 3, fe = 6, v = (e, t) => {
31
+ var m = 22, h = 10, g = 14, _ = 14, v = 3, y = 6, b = (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
- }, pe = (e) => {
36
+ }, de = (e) => {
37
37
  if (e.length <= h) return [{
38
38
  kind: "invoice",
39
39
  key: "invoice-page-1",
@@ -63,7 +63,7 @@ var m = 22, h = 10, g = 14, _ = 14, de = 3, fe = 6, v = (e, t) => {
63
63
  }), t;
64
64
  let r = n.length % g;
65
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);
66
+ let i = Math.max(0, n.length - r), a = n.slice(0, i), o = n.slice(i), s = b(a, g);
67
67
  return s.forEach((e, n) => {
68
68
  t.push({
69
69
  kind: "invoice",
@@ -83,9 +83,9 @@ var m = 22, h = 10, g = 14, _ = 14, de = 3, fe = 6, v = (e, t) => {
83
83
  showNotesSection: !0,
84
84
  showAcceptanceSection: !0
85
85
  }), t;
86
- }, me = (e, t) => {
87
- let n = t && e.articles.some((e) => !!(e.translationTitle || e.translationBody || e.translationBodyHtml)), r = n ? de : fe;
88
- return v(e.articles, r).map((t, r) => ({
86
+ }, fe = (e, t) => {
87
+ let n = t && e.articles.some((e) => !!(e.translationTitle || e.translationBody || e.translationBodyHtml)), r = n ? v : y;
88
+ return b(e.articles, r).map((t, r) => ({
89
89
  kind: "appendix",
90
90
  key: `${e.id}-page-${r + 1}`,
91
91
  title: e.title,
@@ -94,17 +94,17 @@ var m = 22, h = 10, g = 14, _ = 14, de = 3, fe = 6, v = (e, t) => {
94
94
  withTranslation: n
95
95
  }));
96
96
  };
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([]);
97
+ function x({ data: c, showAppendices: h = !0, withEnglishTranslation: g = !0, heightMode: _ = "viewport", renderMode: v = "interactive", publicDocumentUrl: y, onAccept: b }) {
98
+ let { t: x, i18n: pe } = ie(), S = y?.trim() ?? "", me = y !== void 0, C = v === "pdf", [w, T] = d(c), [E, D] = d(!1), [O, k] = d(null), [he, ge] = d(!1), [_e, A] = d(0), [j, M] = d([]), [ve, N] = d(!0), [ye, P] = d(0), [F, I] = d(""), [be, L] = d(S.length === 0 && !C), [xe, R] = d(!C), z = u(null), B = u(null), V = u(null), H = u([]);
99
99
  l(() => {
100
- C(c);
100
+ T(c);
101
101
  }, [c]), l(() => {
102
- if (!b) {
103
- P(""), F(!x);
102
+ if (!S) {
103
+ I(""), L(!C);
104
104
  return;
105
105
  }
106
106
  let e = !1;
107
- return P(""), F(!1), ce(b, {
107
+ return I(""), L(!1), ce(S, {
108
108
  type: "svg",
109
109
  errorCorrectionLevel: "M",
110
110
  margin: 1,
@@ -114,78 +114,78 @@ function y({ data: c, showAppendices: h = !0, withEnglishTranslation: g = !0, he
114
114
  light: "#FFFFFF"
115
115
  }
116
116
  }).then((t) => {
117
- e || P(`data:image/svg+xml;utf8,${encodeURIComponent(t)}`);
117
+ e || I(`data:image/svg+xml;utf8,${encodeURIComponent(t)}`);
118
118
  }).catch((t) => {
119
- e || (console.error("Document QR code generation failed:", t), P(""));
119
+ e || (console.error("Document QR code generation failed:", t), I(""));
120
120
  }).finally(() => {
121
- e || F(!0);
121
+ e || L(!0);
122
122
  }), () => {
123
123
  e = !0;
124
124
  };
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
- h ? K.map((e) => [
125
+ }, [S, C]);
126
+ let U = r(w, pe.language), Se = (e, t = {}) => n(x, U, e, t), W = w.kind === "credit_note" ? -1 : 1, G = w.items.reduce((e, t) => e + t.quantity * t.unitPrice, 0) * W, K = w.items.reduce((e, t) => e + t.quantity * t.unitPrice * W / (1 + (t.taxRate ?? w.taxRate ?? 0)), 0), Ce = G - K, q = Se(w.kind === "credit_note" ? "docs_contract_sale_credit_note_title" : w.kind === "quote" ? "docs_contract_sale_quote_title" : "docs_contract_sale_invoice_title"), we = de(w.items), Te = w.kind === "credit_note" || !h ? [] : w.appendices, Ee = g && U.translation !== void 0, De = Te.flatMap((e) => fe(e, Ee)), J = [...we, ...De], Y = J.length, Oe = [
127
+ w.id,
128
+ w.kind,
129
+ w.saleDocumentNumber,
130
+ w.items.map((e) => `${e.id}:${e.description}:${e.quantity}:${e.unitPrice}`).join(","),
131
+ w.rental ? `${w.rental.bookingNumber}:${w.rental.start.toISOString()}:${w.rental.end.toISOString()}:${w.rental.pickupAddress ?? ""}:${w.rental.returnAddress ?? ""}` : "",
132
+ h ? Te.map((e) => [
133
133
  e.id,
134
134
  e.title,
135
135
  e.articles.map((e) => `${e.id}:${e.title}:${e.body}:${e.bodyHtml ?? ""}:${e.translationTitle ?? ""}:${e.translationBody ?? ""}:${e.translationBodyHtml ?? ""}`).join(",")
136
136
  ].join(":")).join("|") : "",
137
- g ? "translated" : "legal-only",
138
- V.legal,
139
- V.customer,
140
- V.translation ?? "",
137
+ Ee ? "translated" : "legal-only",
138
+ U.legal,
139
+ U.customer,
140
+ U.translation ?? "",
141
141
  J.map((e) => e.key).join(",")
142
- ].join("|"), Z = !x && (S.acceptanceLevel !== "none" || S.acceptance != null), Q = S.acceptance;
142
+ ].join("|"), X = !C && (w.acceptanceLevel !== "none" || w.acceptance != null), Z = w.acceptance;
143
143
  l(() => {
144
- if (!x) {
145
- I(!0);
144
+ if (!C) {
145
+ R(!0);
146
146
  return;
147
147
  }
148
- let e = z.current;
148
+ let e = V.current;
149
149
  if (!e) {
150
- I(!1);
150
+ R(!1);
151
151
  return;
152
152
  }
153
153
  let t = !1;
154
- I(!1);
154
+ R(!1);
155
155
  let n = Array.from(e.querySelectorAll("img"));
156
156
  return Promise.all(n.map(ue)).then(() => {
157
- t || I(!0);
157
+ t || R(!0);
158
158
  }), () => {
159
159
  t = !0;
160
160
  };
161
161
  }, [
162
- N,
163
- x,
164
- X
165
- ]), B.current.length > Y && (B.current.length = Y), l(() => {
166
- M((e) => Y === 0 ? 0 : Math.min(e, Y - 1));
162
+ F,
163
+ C,
164
+ Oe
165
+ ]), H.current.length > Y && (H.current.length = Y), l(() => {
166
+ P((e) => Y === 0 ? 0 : Math.min(e, Y - 1));
167
167
  }, [Y]), l(() => {
168
- let e = L.current;
169
- T(!1), M(0), e?.scrollTo({
168
+ let e = z.current;
169
+ D(!1), P(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 && T(!0);
175
+ e && e.scrollHeight - e.scrollTop <= e.clientHeight + 5 && D(!0);
176
176
  };
177
177
  return e?.addEventListener("scroll", t), t(), () => {
178
178
  e?.removeEventListener("scroll", t);
179
179
  };
180
- }, [X]), l(() => {
180
+ }, [Oe]), l(() => {
181
181
  let e = !1;
182
182
  return (async () => {
183
- if (x) {
184
- A([]), j(!1);
183
+ if (C) {
184
+ M([]), N(!1);
185
185
  return;
186
186
  }
187
- j(!0), await new Promise((e) => setTimeout(e, 0));
188
- let t = [], n = B.current.slice(0, Y);
187
+ N(!0), await new Promise((e) => setTimeout(e, 0));
188
+ let t = [], n = H.current.slice(0, Y);
189
189
  for (let e of n) if (e) try {
190
190
  let n = await se.toPng(e, {
191
191
  quality: .7,
@@ -200,29 +200,29 @@ function y({ data: c, showAppendices: h = !0, withEnglishTranslation: g = !0, he
200
200
  } catch (e) {
201
201
  console.error("Thumbnail generation failed:", e);
202
202
  }
203
- e || (A(t), j(!1));
203
+ e || (M(t), N(!1));
204
204
  })(), () => {
205
205
  e = !0;
206
206
  };
207
207
  }, [
208
- S,
208
+ w,
209
209
  h,
210
210
  g,
211
211
  Y,
212
- x,
213
- N
212
+ C,
213
+ F
214
214
  ]), l(() => {
215
- if (x || k.length === 0) return;
216
- let e = B.current.slice(0, Y).filter((e) => e != null);
215
+ if (C || j.length === 0) return;
216
+ let e = H.current.slice(0, Y).filter((e) => e != null);
217
217
  if (e.length === 0) return;
218
218
  let t = new IntersectionObserver((t) => {
219
219
  for (let n of t) {
220
220
  if (!n.isIntersecting) continue;
221
221
  let t = e.findIndex((e) => e === n.target);
222
- t !== -1 && M(t);
222
+ t !== -1 && P(t);
223
223
  }
224
224
  }, {
225
- root: L.current,
225
+ root: z.current,
226
226
  threshold: .5
227
227
  });
228
228
  return e.forEach((e) => {
@@ -233,181 +233,177 @@ function y({ data: c, showAppendices: h = !0, withEnglishTranslation: g = !0, he
233
233
  });
234
234
  };
235
235
  }, [
236
- k,
236
+ j,
237
237
  Y,
238
- x
238
+ C
239
239
  ]), l(() => {
240
- let e = R.current;
241
- if (!Z || !e) {
242
- O(0);
240
+ let e = B.current;
241
+ if (!X || !e) {
242
+ A(0);
243
243
  return;
244
244
  }
245
245
  let t = () => {
246
- O(Math.ceil(e.getBoundingClientRect().height));
246
+ A(Math.ceil(e.getBoundingClientRect().height));
247
247
  };
248
248
  if (t(), typeof ResizeObserver > "u") return;
249
249
  let n = new ResizeObserver(t);
250
250
  return n.observe(e), () => {
251
251
  n.disconnect();
252
252
  };
253
- }, [S.acceptance, Z]);
254
- let Ee = (e) => {
253
+ }, [w.acceptance, X]);
254
+ let ke = (e) => {
255
255
  let t = e instanceof Date ? e : new Date(e);
256
256
  return Number.isNaN(t.getTime()) ? null : t;
257
- }, De = (e) => {
258
- let t = Ee(e);
259
- return t ? new Intl.DateTimeFormat(V.legal, {
257
+ }, Ae = (e) => {
258
+ let t = ke(e);
259
+ return t ? new Intl.DateTimeFormat(U.legal, {
260
260
  day: "2-digit",
261
261
  month: "2-digit",
262
262
  year: "numeric"
263
263
  }).format(t) : "-";
264
- }, Oe = (e) => {
265
- let t = Ee(e);
266
- return t ? new Intl.DateTimeFormat(V.legal, {
264
+ }, je = (e) => {
265
+ let t = ke(e);
266
+ return t ? new Intl.DateTimeFormat(U.legal, {
267
267
  day: "2-digit",
268
268
  month: "2-digit",
269
269
  year: "numeric",
270
270
  hour: "2-digit",
271
271
  minute: "2-digit"
272
272
  }).format(t) : "-";
273
- }, ke = async (e) => {
274
- let t = v ? await v(e) : void 0;
273
+ }, Q = async (e) => {
274
+ let t = b ? await b(e) : void 0;
275
275
  if (t) {
276
- C(t);
276
+ T(t);
277
277
  return;
278
278
  }
279
- C((t) => ({
279
+ T((t) => ({
280
280
  ...t,
281
281
  acceptance: e
282
282
  }));
283
- }, Ae = async () => {
284
- await ke({
283
+ }, Me = async () => {
284
+ await Q({
285
285
  mode: "acceptance",
286
286
  date: /* @__PURE__ */ new Date()
287
287
  });
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) => {
294
- M(e), B.current[e]?.scrollIntoView({
288
+ }, Ne = async (e) => {
289
+ await Q(e);
290
+ }, Pe = () => {
291
+ let e = w.acceptanceLevel === "signature" ? "signature" : "acceptance";
292
+ e === "signature" && ge(!0), k(e);
293
+ }, Fe = (e) => {
294
+ P(e), H.current[e]?.scrollIntoView({
295
295
  behavior: "smooth",
296
296
  block: "start"
297
297
  });
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, {
298
+ }, Ie = X ? _e + m : m, $ = _ === "parent", Le = w.acceptanceLevel === "signature" ? x(E ? "docs_contract_sale_action_signature_ready" : "docs_contract_sale_action_signature_locked") : x(E ? "docs_contract_sale_action_acceptance_ready" : "docs_contract_sale_action_acceptance_locked"), Re = Z?.mode === "signature" ? x("docs_contract_sale_already_signed", { date: je(Z.date) }) : Z?.mode === "acceptance" ? x("docs_contract_sale_already_accepted", { date: je(Z.date) }) : null, ze = (e, t) => /* @__PURE__ */ p(a, {
299
299
  ref: (e) => {
300
- B.current[t] = e;
300
+ H.current[t] = e;
301
301
  },
302
- className: x || t === Y - 1 ? "!mb-0" : void 0,
302
+ className: ae($ && t === 0 && "md:!border-t-0", (C || t === Y - 1) && "!mb-0"),
303
303
  children: [
304
- /* @__PURE__ */ f(ee, {
305
- documentTitle: G,
306
- saleDocumentNumber: S.saleDocumentNumber,
304
+ /* @__PURE__ */ f(s, {
305
+ documentTitle: q,
306
+ saleDocumentNumber: w.saleDocumentNumber,
307
307
  currentPage: t + 1,
308
308
  totalPages: Y,
309
- documentLanguage: V
309
+ documentLanguage: U
310
310
  }),
311
- e.kind === "invoice" ? /* @__PURE__ */ f(a, {
312
- saleDocument: S,
311
+ e.kind === "invoice" ? /* @__PURE__ */ f(i, {
312
+ saleDocument: w,
313
313
  items: e.items,
314
- subtotal: W,
315
- tax: we,
316
- total: U,
317
- formatDate: De,
314
+ subtotal: K,
315
+ tax: Ce,
316
+ total: G,
317
+ formatDate: Ae,
318
318
  showInvoiceMeta: e.showInvoiceMeta,
319
319
  showTotalsSection: e.showTotalsSection,
320
320
  showNotesSection: e.showNotesSection,
321
- showAcceptanceSection: e.showAcceptanceSection && q.length === 0,
322
- documentQrCodeUrl: e.showInvoiceMeta ? N : void 0,
323
- documentLanguage: V
324
- }) : /* @__PURE__ */ p("main", {
321
+ showAcceptanceSection: e.showAcceptanceSection,
322
+ documentQrCodeUrl: e.showInvoiceMeta && me ? F : void 0,
323
+ documentLanguage: U
324
+ }) : /* @__PURE__ */ f("main", {
325
325
  className: "flex flex-grow flex-col px-4 text-left md:px-8",
326
- children: [/* @__PURE__ */ f(te, {
326
+ children: /* @__PURE__ */ f(ee, {
327
327
  title: e.title,
328
328
  articles: e.articles,
329
329
  withEnglishTranslation: e.withTranslation,
330
330
  showTitle: e.showTitle
331
- }), t === Y - 1 ? /* @__PURE__ */ f(i, {
332
- saleDocument: S,
333
- documentLanguage: V,
334
- formatDate: De
335
- }) : null]
331
+ })
336
332
  }),
337
- /* @__PURE__ */ f(s, {
338
- documentTitle: G,
339
- saleDocumentNumber: S.saleDocumentNumber,
333
+ /* @__PURE__ */ f(o, {
334
+ documentTitle: q,
335
+ saleDocumentNumber: w.saleDocumentNumber,
340
336
  currentPage: t + 1,
341
337
  totalPages: Y,
342
- documentLanguage: V
338
+ documentLanguage: U
343
339
  })
344
340
  ]
345
341
  }, e.key);
346
- return x ? /* @__PURE__ */ f("div", {
347
- ref: z,
348
- "data-testid": xe && Se ? "contract-sale-document-pdf-ready" : void 0,
342
+ return C ? /* @__PURE__ */ f("div", {
343
+ ref: V,
344
+ "data-testid": be && xe ? "contract-sale-document-pdf-ready" : void 0,
349
345
  className: "contract-sale-document contract-sale-document-pdf bg-white text-foreground",
350
- children: J.map(Le)
351
- }) : /* @__PURE__ */ f(ie, { children: /* @__PURE__ */ p("div", {
346
+ children: J.map(ze)
347
+ }) : /* @__PURE__ */ f(re, { children: /* @__PURE__ */ p("div", {
352
348
  className: `contract-sale-document ${$ ? "h-full" : "h-dvh"} min-h-0 md:flex`,
353
- children: [/* @__PURE__ */ f(ne, {
354
- thumbnails: k,
355
- activePage: be,
356
- onThumbnailClick: Ne,
349
+ children: [/* @__PURE__ */ f(te, {
350
+ thumbnails: j,
351
+ activePage: ye,
352
+ onThumbnailClick: Fe,
357
353
  totalPages: Y,
358
354
  heightClassName: $ ? "h-full" : "h-dvh",
359
355
  contentClassName: $ ? "pt-16" : void 0,
360
- isLoading: ye
356
+ isLoading: ve
361
357
  }), /* @__PURE__ */ p("div", {
362
- ref: L,
358
+ ref: z,
363
359
  "data-testid": "contract-sale-document-scroll-container",
364
360
  className: `${$ ? "h-full" : "h-dvh"} min-h-0 flex-1 overflow-y-auto overscroll-y-contain bg-transparent`,
365
361
  style: {
366
362
  paddingTop: $ ? "3.5rem" : void 0,
367
363
  scrollPaddingTop: $ ? "3.5rem" : void 0,
368
- paddingBottom: `${Pe}px`
364
+ paddingBottom: `${Ie}px`
369
365
  },
370
366
  children: [
371
- J.map(Le),
367
+ J.map(ze),
372
368
  /* @__PURE__ */ f("p", {
373
369
  className: "px-4 text-center text-xs text-muted-foreground/75 md:px-8",
374
370
  style: { paddingTop: `${m}px` },
375
- children: y("docs_contract_sale_end")
371
+ children: x("docs_contract_sale_end")
376
372
  }),
377
- Z ? /* @__PURE__ */ f("div", {
378
- ref: R,
373
+ X ? /* @__PURE__ */ f("div", {
374
+ ref: B,
379
375
  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",
380
- children: Ie ? /* @__PURE__ */ p("div", {
376
+ children: Re ? /* @__PURE__ */ p("div", {
381
377
  className: "flex items-center gap-2 px-6 py-3 text-sm font-semibold text-success",
382
378
  children: [/* @__PURE__ */ f(oe, {
383
379
  className: "h-4 w-4 shrink-0",
384
380
  "aria-hidden": "true"
385
381
  }), /* @__PURE__ */ f("p", {
386
382
  className: "text-center",
387
- children: Ie
383
+ children: Re
388
384
  })]
389
385
  }) : /* @__PURE__ */ f(e, {
390
- onClick: Me,
391
- disabled: !w,
386
+ onClick: Pe,
387
+ disabled: !E,
392
388
  className: "px-6 py-3 text-sm font-semibold",
393
389
  "data-testid": "contract-sale-document-action-button",
394
- children: Fe
390
+ children: Le
395
391
  })
396
392
  }) : null,
397
393
  /* @__PURE__ */ f(t, {
398
- isOpen: E === "acceptance",
399
- onClose: () => D(null),
394
+ isOpen: O === "acceptance",
395
+ onClose: () => k(null),
400
396
  onAccept: async () => {
401
- await Ae(), D(null);
397
+ await Me(), k(null);
402
398
  }
403
399
  }),
404
- ge ? /* @__PURE__ */ f(re, {
400
+ he ? /* @__PURE__ */ f(ne, {
405
401
  fallback: null,
406
402
  children: /* @__PURE__ */ f(le, {
407
- isOpen: E === "signature",
408
- onClose: () => D(null),
403
+ isOpen: O === "signature",
404
+ onClose: () => k(null),
409
405
  onSave: async (e) => {
410
- await je(e), D(null);
406
+ await Ne(e), k(null);
411
407
  }
412
408
  })
413
409
  }) : null
@@ -416,4 +412,4 @@ function y({ data: c, showAppendices: h = !0, withEnglishTranslation: g = !0, he
416
412
  }) });
417
413
  }
418
414
  //#endregion
419
- export { y as ContractSaleDocument };
415
+ export { x 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;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"}
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,2CAgPrB"}
@@ -58,12 +58,16 @@ function l({ saleDocument: l, items: u, subtotal: d, tax: f, total: p, formatDat
58
58
  className: "font-normal text-muted-foreground",
59
59
  children: ["#", l.saleDocumentNumber]
60
60
  })]
61
- }), b ? /* @__PURE__ */ r("img", {
62
- src: b,
63
- alt: x("docs_contract_sale_qr_alt"),
64
- className: "mt-4 block h-24 w-24",
65
- "data-testid": "contract-sale-document-public-url-qr"
66
- }) : null] }), /* @__PURE__ */ i("div", {
61
+ }), b === void 0 ? null : /* @__PURE__ */ r("div", {
62
+ className: "mt-4 h-24 w-24",
63
+ "data-testid": "contract-sale-document-public-url-qr-container",
64
+ children: b ? /* @__PURE__ */ r("img", {
65
+ src: b,
66
+ alt: x("docs_contract_sale_qr_alt"),
67
+ className: "block h-full w-full",
68
+ "data-testid": "contract-sale-document-public-url-qr"
69
+ }) : null
70
+ })] }), /* @__PURE__ */ i("div", {
67
71
  className: "md:text-right",
68
72
  children: [/* @__PURE__ */ i("div", {
69
73
  className: "mb-2",
@@ -1 +1 @@
1
- {"version":3,"file":"TermsAndConditionsContent.d.ts","sourceRoot":"","sources":["../../../src/components/ContractSaleDocument/TermsAndConditionsContent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAA;AAGrF,KAAK,8BAA8B,GAAG;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,+BAA+B,EAAE,CAAA;IAC3C,sBAAsB,EAAE,OAAO,CAAA;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAoDD,eAAO,MAAM,yBAAyB,GAAI,yDAKvC,8BAA8B,4CAoChC,CAAA"}
1
+ {"version":3,"file":"TermsAndConditionsContent.d.ts","sourceRoot":"","sources":["../../../src/components/ContractSaleDocument/TermsAndConditionsContent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAA;AAGrF,KAAK,8BAA8B,GAAG;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,+BAA+B,EAAE,CAAA;IAC3C,sBAAsB,EAAE,OAAO,CAAA;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAoDD,eAAO,MAAM,yBAAyB,GAAI,yDAKvC,8BAA8B,4CAuChC,CAAA"}
@@ -25,17 +25,21 @@ var s = ({ title: r, articles: i, withEnglishTranslation: s, showTitle: c = !0 }
25
25
  children: r
26
26
  }), /* @__PURE__ */ n("div", {
27
27
  className: `text-sm ${s ? "grid grid-cols-1 gap-8 md:grid-cols-2" : ""}`,
28
- children: [/* @__PURE__ */ t("div", { children: i.map((e) => /* @__PURE__ */ n("section", {
29
- className: "mb-4",
30
- children: [e.title ? /* @__PURE__ */ t("h3", {
31
- className: "mb-2 text-left text-lg font-serif font-semibold text-foreground",
32
- children: /* @__PURE__ */ t("span", { children: e.title })
33
- }) : null, /* @__PURE__ */ t(a, {
34
- body: e.body,
35
- bodyHtml: e.bodyHtml
36
- })]
37
- }, `fr-${e.id}`)) }), s && /* @__PURE__ */ t("div", {
28
+ children: [/* @__PURE__ */ t("div", {
29
+ "data-testid": "contract-sale-document-source-column",
30
+ children: i.map((e) => /* @__PURE__ */ n("section", {
31
+ className: "mb-4",
32
+ children: [e.title ? /* @__PURE__ */ t("h3", {
33
+ className: "mb-2 text-left text-lg font-serif font-semibold text-foreground",
34
+ children: /* @__PURE__ */ t("span", { children: e.title })
35
+ }) : null, /* @__PURE__ */ t(a, {
36
+ body: e.body,
37
+ bodyHtml: e.bodyHtml
38
+ })]
39
+ }, `fr-${e.id}`))
40
+ }), s && /* @__PURE__ */ t("div", {
38
41
  className: "border-t border-border pt-8 md:border-l md:border-t-0 md:pl-8 md:pt-0",
42
+ "data-testid": "contract-sale-document-translation-column",
39
43
  children: i.map((e) => /* @__PURE__ */ n("section", {
40
44
  className: "mb-4",
41
45
  children: [e.translationTitle ?? e.title ? /* @__PURE__ */ t("h3", {
@@ -41,15 +41,7 @@ function S({ storefrontConfiguration: r, whatsappHref: S, whatsappPhoneDisplay:
41
41
  children: /* @__PURE__ */ c("span", { children: Y })
42
42
  }), /* @__PURE__ */ l("div", {
43
43
  className: "hidden items-center gap-4 sm:flex",
44
- children: [U ? /* @__PURE__ */ c("a", {
45
- className: "inline-flex items-center gap-2 rounded-md px-2 py-1 text-white/90 hover:bg-white/10 hover:text-white",
46
- href: `mailto:${U}`,
47
- "aria-label": U,
48
- children: /* @__PURE__ */ c("span", { children: U })
49
- }) : /* @__PURE__ */ c("span", {
50
- className: "inline-flex items-center rounded-md px-2 py-1 text-destructive",
51
- children: i
52
- }), S ? /* @__PURE__ */ l("a", {
44
+ children: [S ? /* @__PURE__ */ l("a", {
53
45
  className: "inline-flex items-center gap-2 rounded-md px-2 py-1 text-white/90 hover:bg-white/10 hover:text-white",
54
46
  href: S,
55
47
  target: "_blank",
@@ -61,7 +53,15 @@ function S({ storefrontConfiguration: r, whatsappHref: S, whatsappPhoneDisplay:
61
53
  alt: "",
62
54
  "aria-hidden": "true"
63
55
  }), C ? /* @__PURE__ */ c("span", { children: C }) : null]
64
- }) : null]
56
+ }) : null, U ? /* @__PURE__ */ c("a", {
57
+ className: "inline-flex items-center gap-2 rounded-md px-2 py-1 text-white/90 hover:bg-white/10 hover:text-white",
58
+ href: `mailto:${U}`,
59
+ "aria-label": U,
60
+ children: /* @__PURE__ */ c("span", { children: U })
61
+ }) : /* @__PURE__ */ c("span", {
62
+ className: "inline-flex items-center rounded-md px-2 py-1 text-destructive",
63
+ children: i
64
+ })]
65
65
  })]
66
66
  })
67
67
  })
package/dist/i18n/en.d.ts CHANGED
@@ -231,6 +231,7 @@ export declare const storefront: {
231
231
  docs_contract_sale_not_found_title: string;
232
232
  docs_contract_sale_load_error: string;
233
233
  docs_contract_sale_download_pdf: string;
234
+ docs_contract_sale_back: string;
234
235
  docs_contract_sale_back_to_storefront: string;
235
236
  docs_contract_sale_language_selector_label: string;
236
237
  docs_contract_sale_language_option_fr: string;
@@ -1 +1 @@
1
- {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0ctB,CAAA"}
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2ctB,CAAA"}
package/dist/i18n/en.js CHANGED
@@ -232,6 +232,7 @@ var e = {
232
232
  docs_contract_sale_not_found_title: "Document unavailable",
233
233
  docs_contract_sale_load_error: "Unable to load this sale contract document.",
234
234
  docs_contract_sale_download_pdf: "Download PDF",
235
+ docs_contract_sale_back: "Back",
235
236
  docs_contract_sale_back_to_storefront: "Back to storefront",
236
237
  docs_contract_sale_language_selector_label: "Document language",
237
238
  docs_contract_sale_language_option_fr: "French",