@loczer/storefront-sdk 0.203.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.
Files changed (38) hide show
  1. package/dist/components/ContractSaleDocument/Invoice.d.ts.map +1 -1
  2. package/dist/components/ContractSaleDocument/Invoice.js +144 -148
  3. package/dist/components/ContractSaleDocument/InvoiceDetails.d.ts.map +1 -1
  4. package/dist/components/ContractSaleDocument/InvoiceDetails.js +10 -6
  5. package/dist/components/ContractSaleDocument/TermsAndConditionsContent.d.ts.map +1 -1
  6. package/dist/components/ContractSaleDocument/TermsAndConditionsContent.js +14 -10
  7. package/dist/components/Header/index.js +10 -10
  8. package/dist/i18n/en.d.ts +1 -0
  9. package/dist/i18n/en.d.ts.map +1 -1
  10. package/dist/i18n/en.js +1 -0
  11. package/dist/i18n/fr.d.ts +1 -0
  12. package/dist/i18n/fr.d.ts.map +1 -1
  13. package/dist/i18n/fr.js +1 -0
  14. package/dist/index.d.ts +10 -12
  15. package/dist/lib/cart.d.ts +3 -0
  16. package/dist/lib/cart.d.ts.map +1 -1
  17. package/dist/lib/cart.js +114 -76
  18. package/dist/lib/checkoutPaymentSession.d.ts +1 -0
  19. package/dist/lib/checkoutPaymentSession.d.ts.map +1 -1
  20. package/dist/lib/checkoutPaymentSession.js +1 -0
  21. package/dist/lib/checkoutSubmit.d.ts +2 -0
  22. package/dist/lib/checkoutSubmit.d.ts.map +1 -1
  23. package/dist/lib/checkoutSubmit.js +1 -0
  24. package/dist/lib/contractSaleDocument.d.ts +1 -0
  25. package/dist/lib/contractSaleDocument.d.ts.map +1 -1
  26. package/dist/lib/contractSaleDocument.js +12 -4
  27. package/dist/lib/contractSaleDocumentApi.d.ts +4 -12
  28. package/dist/lib/contractSaleDocumentApi.d.ts.map +1 -1
  29. package/dist/lib/contractSaleDocumentApi.js +10 -10
  30. package/dist/pages/CheckoutPage.d.ts.map +1 -1
  31. package/dist/pages/CheckoutPage.js +222 -211
  32. package/dist/pages/CheckoutPaymentPage.d.ts.map +1 -1
  33. package/dist/pages/CheckoutPaymentPage.js +190 -159
  34. package/dist/pages/ContractSaleDocumentPage.d.ts +9 -1
  35. package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
  36. package/dist/pages/ContractSaleDocumentPage.js +146 -135
  37. package/dist/storefront.css +1 -1
  38. package/package.json +1 -1
@@ -6,31 +6,40 @@ import { ContractSaleDocument as i } from "../components/ContractSaleDocument/In
6
6
  import "../components/ContractSaleDocument/index.js";
7
7
  import { apiGet as a, apiPost as o } from "../lib/apiCall.js";
8
8
  import { Spinner as s } from "../chunks/pkg/ui/dist/Spinner/index-Cgi70z_E.js";
9
- import { ACCEPT_CONTRACT_SALE_DOCUMENT_ROUTE as c, DOWNLOAD_CONTRACT_SALE_DOCUMENT_PDF_ROUTE as l, GET_CONTRACT_SALE_DOCUMENT_ROUTE as u, acceptContractSaleDocumentResponseSchema as d, contractSaleDocumentApiSchema as f, getContractSaleDocumentResponseSchema as p } from "../lib/contractSaleDocumentApi.js";
10
- import { useEffect as m, useState as h } from "react";
11
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
12
- import { Link as v, useLoaderData as y, useLocation as b, useNavigate as x } from "@rpcbase/router";
13
- import { useTranslation as S } from "react-i18next";
14
- import { cn as C } from "@rpcbase/ui";
15
- import { ArrowLeft as w, ChevronDown as T, Download as E } from "lucide-react";
16
- import { Menu as D } from "@base-ui/react/menu";
9
+ import { resolveContractSaleDocumentRequestLanguage as c } from "../lib/contractSaleDocument.js";
10
+ import { ACCEPT_CONTRACT_SALE_DOCUMENT_ROUTE as l, DOWNLOAD_CONTRACT_SALE_DOCUMENT_PDF_ROUTE as u, GET_CONTRACT_SALE_DOCUMENT_ROUTE as d, acceptContractSaleDocumentResponseSchema as f, contractSaleDocumentApiSchema as p, getContractSaleDocumentResponseSchema as m } from "../lib/contractSaleDocumentApi.js";
11
+ import { useEffect as h, useState as g } from "react";
12
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
13
+ import { Link as y, useLoaderData as b, useLocation as x, useNavigate as S } from "@rpcbase/router";
14
+ import { useTranslation as C } from "react-i18next";
15
+ import { cn as w } from "@rpcbase/ui";
16
+ import { ArrowLeft as T, ChevronDown as E, Download as D } from "lucide-react";
17
+ import { Menu as O } from "@base-ui/react/menu";
17
18
  //#region src/pages/ContractSaleDocumentPage.tsx
18
- var O = (e) => new URLSearchParams(e).get("pdf") === "1", k = (e) => t(new URLSearchParams(e).get("lang")), A = (e) => {
19
- let t = typeof e?.req?.originalUrl == "string" ? e.req.originalUrl : "";
20
- return t ? O(new URL(t, "http://localhost").search) : typeof window < "u" && O(window.location.search);
21
- }, j = (e) => {
22
- let t = typeof e?.req?.originalUrl == "string" ? e.req.originalUrl : "";
23
- return t ? k(new URL(t, "http://localhost").search) : typeof window < "u" ? k(window.location.search) : null;
24
- }, M = (e, t, n, r) => `${l}?${new URLSearchParams({
19
+ var k = (e) => new URLSearchParams(e).get("pdf") === "1", A = (e) => c(new URLSearchParams(e).get("lang")), j = (e) => {
20
+ let t = new URLSearchParams(e).get("back")?.trim();
21
+ if (!t || !t.startsWith("/") || t.startsWith("//")) return null;
22
+ try {
23
+ let e = "https://loczer.internal", n = new URL(t, e);
24
+ return n.origin !== e || n.pathname !== "/app" && !n.pathname.startsWith("/app/") ? null : `${n.pathname}${n.search}${n.hash}`;
25
+ } catch {
26
+ return null;
27
+ }
28
+ }, M = (e, t) => {
29
+ let n = typeof t?.url == "string" ? t.url : "";
30
+ if (n) return new URL(n, "http://localhost").search;
31
+ let r = typeof e?.req?.originalUrl == "string" ? e.req.originalUrl : "";
32
+ return r ? new URL(r, "http://localhost").search : typeof window < "u" ? window.location.search : "";
33
+ }, N = (e, t, n, r) => `${u}?${new URLSearchParams({
25
34
  storeSlug: e,
26
35
  referenceId: t,
27
36
  saleDocumentId: n,
28
37
  lang: r
29
- }).toString()}`, N = (e, t, n, r) => {
38
+ }).toString()}`, P = (e, t, n, r) => {
30
39
  if (typeof window > "u") return "";
31
40
  let i = new URL(`/${encodeURIComponent(e)}/docs/${encodeURIComponent(t)}/${encodeURIComponent(n)}`, window.location.origin);
32
41
  return i.searchParams.set("lang", r), i.toString();
33
- }, P = (e, t, n) => {
42
+ }, F = (e, t, n) => {
34
43
  let r = `${n === "credit_note" ? "credit-note" : n === "quote" ? "quote" : "invoice"}-${t?.trim() || "document"}.pdf`;
35
44
  if (!e) return r;
36
45
  let i = e.match(/filename\*=UTF-8''([^;]+)/i)?.[1];
@@ -40,40 +49,40 @@ var O = (e) => new URLSearchParams(e).get("pdf") === "1", k = (e) => t(new URLSe
40
49
  return i;
41
50
  }
42
51
  return e.match(/filename="([^"]+)"/i)?.[1] ?? e.match(/filename=([^;]+)/i)?.[1]?.trim() ?? r;
43
- }, F = (e) => /* @__PURE__ */ g(s, {
52
+ }, I = (e) => /* @__PURE__ */ _(s, {
44
53
  className: "size-4",
45
54
  "aria-hidden": "true",
46
55
  "data-testid": e
47
- }), I = [{
56
+ }), L = [{
48
57
  code: "fr",
49
58
  labelKey: "docs_contract_sale_language_option_fr"
50
59
  }, {
51
60
  code: "en",
52
61
  labelKey: "docs_contract_sale_language_option_en"
53
- }], L = {
62
+ }], R = {
54
63
  code: "fr",
55
64
  labelKey: "docs_contract_sale_language_option_fr"
56
65
  };
57
- function R({ selectedLanguage: t, onChange: n }) {
58
- let { t: r } = S(), [i, a] = h(!1), o = I.find((e) => e.code === t) ?? L;
59
- return /* @__PURE__ */ _(D.Root, {
66
+ function z({ selectedLanguage: t, onChange: n }) {
67
+ let { t: r } = C(), [i, a] = g(!1), o = L.find((e) => e.code === t) ?? R;
68
+ return /* @__PURE__ */ v(O.Root, {
60
69
  open: i,
61
70
  onOpenChange: a,
62
- children: [/* @__PURE__ */ g(D.Trigger, {
71
+ children: [/* @__PURE__ */ _(O.Trigger, {
63
72
  nativeButton: !0,
64
- render: /* @__PURE__ */ _(e, {
73
+ render: /* @__PURE__ */ v(e, {
65
74
  variant: "outline",
66
75
  size: "sm",
67
76
  type: "button",
68
77
  "aria-label": r("docs_contract_sale_language_selector_label"),
69
78
  className: "h-9 gap-1 bg-background/80 px-2 uppercase",
70
79
  "data-testid": "contract-sale-document-language-trigger",
71
- children: [/* @__PURE__ */ g("span", { children: o.code }), /* @__PURE__ */ g(T, {
80
+ children: [/* @__PURE__ */ _("span", { children: o.code }), /* @__PURE__ */ _(E, {
72
81
  className: "h-4 w-4",
73
82
  "aria-hidden": "true"
74
83
  })]
75
84
  })
76
- }), /* @__PURE__ */ g(D.Portal, { children: /* @__PURE__ */ g(D.Positioner, {
85
+ }), /* @__PURE__ */ _(O.Portal, { children: /* @__PURE__ */ _(O.Positioner, {
77
86
  align: "end",
78
87
  sideOffset: 4,
79
88
  positionMethod: "fixed",
@@ -84,20 +93,20 @@ function R({ selectedLanguage: t, onChange: n }) {
84
93
  align: "shift",
85
94
  fallbackAxisSide: "none"
86
95
  },
87
- children: /* @__PURE__ */ g(D.Popup, {
88
- render: (e, t) => /* @__PURE__ */ g("div", {
96
+ children: /* @__PURE__ */ _(O.Popup, {
97
+ render: (e, t) => /* @__PURE__ */ _("div", {
89
98
  ...e,
90
99
  "data-menu-content": "",
91
100
  "data-state": t.open ? "open" : "closed"
92
101
  }),
93
102
  className: "z-50 min-w-36 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md transition-opacity duration-75 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 data-[instant]:transition-none",
94
- children: I.map((e) => /* @__PURE__ */ _(D.Item, {
103
+ children: L.map((e) => /* @__PURE__ */ v(O.Item, {
95
104
  onClick: (t) => {
96
105
  t.defaultPrevented || (n(e.code), a(!1));
97
106
  },
98
107
  "data-testid": `contract-sale-document-language-option-${e.code}`,
99
- className: C("relative flex cursor-pointer select-none items-center justify-between gap-3 whitespace-nowrap rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground", t === e.code && "bg-accent"),
100
- children: [/* @__PURE__ */ g("span", { children: r(e.labelKey) }), /* @__PURE__ */ g("span", {
108
+ className: w("relative flex cursor-pointer select-none items-center justify-between gap-3 whitespace-nowrap rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground", t === e.code && "bg-accent"),
109
+ children: [/* @__PURE__ */ _("span", { children: r(e.labelKey) }), /* @__PURE__ */ _("span", {
101
110
  className: "text-2xs uppercase text-muted-foreground",
102
111
  children: e.code
103
112
  })]
@@ -106,176 +115,178 @@ function R({ selectedLanguage: t, onChange: n }) {
106
115
  }) })]
107
116
  });
108
117
  }
109
- var z = (async ({ ctx: e, params: t }) => {
110
- let n = typeof t.storeSlug == "string" ? t.storeSlug.trim().toLowerCase() : "", r = typeof t.referenceId == "string" ? t.referenceId.trim() : "", i = typeof t.saleDocumentId == "string" ? t.saleDocumentId.trim() : "", o = A(e), s = j(e);
111
- if (!n || !r || !i) return {
112
- storeSlug: n,
113
- referenceId: r,
114
- saleDocumentId: i,
115
- pdfMode: o,
116
- documentLanguage: s,
118
+ var B = (async ({ ctx: e, params: t, request: n }) => {
119
+ let r = typeof t.storeSlug == "string" ? t.storeSlug.trim().toLowerCase() : "", i = typeof t.referenceId == "string" ? t.referenceId.trim() : "", o = typeof t.saleDocumentId == "string" ? t.saleDocumentId.trim() : "", s = M(e, n), c = k(s), l = A(s);
120
+ if (!r || !i || !o) return {
121
+ storeSlug: r,
122
+ referenceId: i,
123
+ saleDocumentId: o,
124
+ pdfMode: c,
125
+ documentLanguage: l,
117
126
  document: null,
118
127
  error: null
119
128
  };
120
129
  try {
121
- let t = await a(u, {
122
- storeSlug: n,
123
- referenceId: r,
124
- saleDocumentId: i,
125
- ...s ? { lang: s } : {}
126
- }, e), c = p.parse(t);
127
- return !c.success || !c.document ? {
128
- storeSlug: n,
129
- referenceId: r,
130
- saleDocumentId: i,
131
- pdfMode: o,
132
- documentLanguage: s,
130
+ let t = await a(d, {
131
+ storeSlug: r,
132
+ referenceId: i,
133
+ saleDocumentId: o,
134
+ ...l ? { lang: l } : {}
135
+ }, e), n = m.parse(t);
136
+ return !n.success || !n.document ? {
137
+ storeSlug: r,
138
+ referenceId: i,
139
+ saleDocumentId: o,
140
+ pdfMode: c,
141
+ documentLanguage: l,
133
142
  document: null,
134
- error: c.message ?? null
143
+ error: n.message ?? null
135
144
  } : {
136
- storeSlug: n,
137
- referenceId: r,
138
- saleDocumentId: i,
139
- pdfMode: o,
140
- documentLanguage: s,
141
- document: c.document,
145
+ storeSlug: r,
146
+ referenceId: i,
147
+ saleDocumentId: o,
148
+ pdfMode: c,
149
+ documentLanguage: l,
150
+ document: n.document,
142
151
  error: null
143
152
  };
144
153
  } catch (e) {
145
154
  return console.error("Failed to load storefront contract sale document", e), {
146
- storeSlug: n,
147
- referenceId: r,
148
- saleDocumentId: i,
149
- pdfMode: o,
150
- documentLanguage: s,
155
+ storeSlug: r,
156
+ referenceId: i,
157
+ saleDocumentId: o,
158
+ pdfMode: c,
159
+ documentLanguage: l,
151
160
  document: null,
152
161
  error: null
153
162
  };
154
163
  }
155
- }), B = (e) => {
156
- let t = f.safeParse(e);
164
+ }), V = (e) => {
165
+ let t = p.safeParse(e);
157
166
  return t.success ? t.data : null;
158
167
  };
159
- function V() {
160
- let { t: a, i18n: s } = S(), l = y(), u = b(), f = x(), { storeSlug: p, referenceId: C, saleDocumentId: T } = l, D = l.pdfMode || O(u.search), [A, j] = h(B(l.document)), [I, L] = h(null), [z, V] = h(!1), [H, U] = h(l.error), W = k(u.search) ?? t(A?.language?.customer) ?? l.documentLanguage ?? t(s.language) ?? "fr", G = p && C && T ? M(p, C, T, W) : null, K = p && C && T ? N(p, C, T, W) : "";
161
- m(() => {
162
- j(B(l.document)), U(l.error);
163
- }, [l.document, l.error]), m(() => {
164
- t(s.language) !== W && s.changeLanguage(W);
165
- }, [s, W]);
166
- let q = (e) => {
167
- if (e === W) return;
168
+ function H() {
169
+ let { t: a, i18n: s } = C(), c = b(), u = x(), d = S(), { storeSlug: p, referenceId: m, saleDocumentId: w } = c, E = c.pdfMode || k(u.search), O = j(u.search), M = O ?? `/${p ?? ""}`, L = a(O ? "docs_contract_sale_back" : "docs_contract_sale_back_to_storefront"), [R, B] = g(V(c.document)), [H, U] = g(null), [W, G] = g(!1), [K, q] = g(c.error), J = A(u.search) ?? t(R?.language?.customer) ?? c.documentLanguage ?? t(s.language) ?? "fr", Y = p && m && w ? N(p, m, w, J) : null, X = p && m && w ? P(p, m, w, J) : "";
170
+ h(() => {
171
+ B(V(c.document)), q(c.error);
172
+ }, [c.document, c.error]), h(() => {
173
+ t(s.language) !== J && s.changeLanguage(J);
174
+ }, [s, J]);
175
+ let Z = (e) => {
176
+ if (e === J) return;
168
177
  s.changeLanguage(e);
169
178
  let t = new URLSearchParams(u.search);
170
179
  t.set("lang", e);
171
180
  let n = t.toString();
172
- f(`${u.pathname}${n ? `?${n}` : ""}${u.hash || ""}`, { replace: !0 });
181
+ d(`${u.pathname}${n ? `?${n}` : ""}${u.hash || ""}`, { replace: !0 });
173
182
  };
174
- if (!A) return /* @__PURE__ */ g("div", {
183
+ if (!R) return /* @__PURE__ */ _("div", {
175
184
  className: "mx-auto max-w-3xl px-4 py-14 sm:px-6",
176
- children: /* @__PURE__ */ g(r, {
185
+ children: /* @__PURE__ */ _(r, {
177
186
  className: "border-slate-200 bg-white p-5 shadow-sm sm:p-6",
178
- children: /* @__PURE__ */ _("div", {
187
+ children: /* @__PURE__ */ v("div", {
179
188
  className: "space-y-4",
180
189
  children: [
181
- /* @__PURE__ */ g("h1", {
190
+ /* @__PURE__ */ _("h1", {
182
191
  className: "text-lg font-semibold text-slate-950",
183
- children: /* @__PURE__ */ g("span", { children: a("docs_contract_sale_not_found_title") })
192
+ children: /* @__PURE__ */ _("span", { children: a("docs_contract_sale_not_found_title") })
184
193
  }),
185
- /* @__PURE__ */ g("p", {
194
+ /* @__PURE__ */ _("p", {
186
195
  className: "text-sm text-destructive",
187
- children: /* @__PURE__ */ g("span", { children: H ?? a("docs_contract_sale_load_error") })
196
+ children: /* @__PURE__ */ _("span", { children: K ?? a("docs_contract_sale_load_error") })
188
197
  }),
189
- /* @__PURE__ */ g(v, {
190
- to: `/${p ?? ""}`,
191
- children: /* @__PURE__ */ _(e, {
198
+ /* @__PURE__ */ _(y, {
199
+ to: M,
200
+ "data-testid": "contract-sale-document-back-link",
201
+ children: /* @__PURE__ */ v(e, {
192
202
  className: "gap-2",
193
- children: [/* @__PURE__ */ g(w, {
203
+ children: [/* @__PURE__ */ _(T, {
194
204
  className: "h-4 w-4",
195
205
  "aria-hidden": "true"
196
- }), /* @__PURE__ */ g("span", { children: a("docs_contract_sale_back_to_storefront") })]
206
+ }), /* @__PURE__ */ _("span", { children: L })]
197
207
  })
198
208
  })
199
209
  ]
200
210
  })
201
211
  })
202
212
  });
203
- if (D) return /* @__PURE__ */ g("div", {
213
+ if (E) return /* @__PURE__ */ _("div", {
204
214
  className: "min-h-screen bg-white",
205
- children: /* @__PURE__ */ g(i, {
206
- data: A,
215
+ children: /* @__PURE__ */ _(i, {
216
+ data: R,
207
217
  renderMode: "pdf",
208
- publicDocumentUrl: K
218
+ publicDocumentUrl: X
209
219
  })
210
220
  });
211
- let J = async () => {
212
- if (!G || z) return;
213
- V(!0);
214
- let e = n.loading(a("docs_contract_sale_preparing_pdf"), { icon: F() });
221
+ let Q = async () => {
222
+ if (!Y || W) return;
223
+ G(!0);
224
+ let e = n.loading(a("docs_contract_sale_preparing_pdf"), { icon: I() });
215
225
  try {
216
- let t = await fetch(G, {
226
+ let t = await fetch(Y, {
217
227
  method: "GET",
218
228
  credentials: "include"
219
229
  });
220
230
  if (!t.ok) throw Error(`PDF request failed with status ${t.status}`);
221
231
  let r = await t.blob(), i = window.URL.createObjectURL(r), a = window.document.createElement("a");
222
- a.href = i, a.download = P(t.headers.get("content-disposition"), A.saleDocumentNumber, A.kind), window.document.body.appendChild(a), a.click(), a.remove(), n.dismiss(e), window.setTimeout(() => {
232
+ a.href = i, a.download = F(t.headers.get("content-disposition"), R.saleDocumentNumber, R.kind), window.document.body.appendChild(a), a.click(), a.remove(), n.dismiss(e), window.setTimeout(() => {
223
233
  window.URL.revokeObjectURL(i);
224
234
  }, 0);
225
235
  } catch (t) {
226
236
  console.error("Failed to download storefront contract sale document PDF", t), n.dismiss(e), n.error(a("docs_contract_sale_download_pdf_error"));
227
237
  } finally {
228
- V(!1);
238
+ G(!1);
229
239
  }
230
240
  };
231
- return /* @__PURE__ */ _("div", {
241
+ return /* @__PURE__ */ v("div", {
232
242
  className: "flex h-dvh min-h-0 flex-col overflow-hidden bg-gradient-to-br from-slate-100 via-slate-100 to-slate-200",
233
- children: [/* @__PURE__ */ _("div", {
243
+ children: [/* @__PURE__ */ v("div", {
234
244
  className: "fixed inset-x-0 top-0 z-40 flex h-14 items-center justify-between gap-3 border-b border-border bg-background/70 px-4 backdrop-blur-xl backdrop-saturate-125 supports-[backdrop-filter]:bg-background/55 sm:px-6",
235
- children: [/* @__PURE__ */ _(v, {
236
- to: `/${p ?? ""}`,
245
+ children: [/* @__PURE__ */ v(y, {
246
+ to: M,
237
247
  className: "inline-flex items-center gap-2 text-sm font-medium text-slate-700 hover:text-slate-950",
238
- children: [/* @__PURE__ */ g(w, {
248
+ "data-testid": "contract-sale-document-back-link",
249
+ children: [/* @__PURE__ */ _(T, {
239
250
  className: "h-4 w-4",
240
251
  "aria-hidden": "true"
241
- }), /* @__PURE__ */ g("span", { children: a("docs_contract_sale_back_to_storefront") })]
242
- }), /* @__PURE__ */ _("div", {
252
+ }), /* @__PURE__ */ _("span", { children: L })]
253
+ }), /* @__PURE__ */ v("div", {
243
254
  className: "flex min-w-0 items-center gap-2",
244
255
  children: [
245
- H ? /* @__PURE__ */ g("span", {
256
+ K ? /* @__PURE__ */ _("span", {
246
257
  className: "max-w-[min(44vw,24rem)] truncate text-right text-sm text-destructive",
247
- children: H
248
- }) : I === "signature" ? /* @__PURE__ */ g("span", {
258
+ children: K
259
+ }) : H === "signature" ? /* @__PURE__ */ _("span", {
249
260
  className: "max-w-[min(44vw,24rem)] truncate text-right text-sm text-slate-600",
250
261
  children: a("docs_contract_sale_submitting_signature")
251
- }) : I === "acceptance" ? /* @__PURE__ */ g("span", {
262
+ }) : H === "acceptance" ? /* @__PURE__ */ _("span", {
252
263
  className: "max-w-[min(44vw,24rem)] truncate text-right text-sm text-slate-600",
253
264
  children: a("docs_contract_sale_submitting_acceptance")
254
265
  }) : null,
255
- /* @__PURE__ */ g(R, {
256
- selectedLanguage: W,
257
- onChange: q
266
+ /* @__PURE__ */ _(z, {
267
+ selectedLanguage: J,
268
+ onChange: Z
258
269
  }),
259
- G ? /* @__PURE__ */ _(e, {
270
+ Y ? /* @__PURE__ */ v(e, {
260
271
  variant: "outline",
261
272
  size: "sm",
262
273
  type: "button",
263
- disabled: z,
274
+ disabled: W,
264
275
  onClick: () => {
265
- J();
276
+ Q();
266
277
  },
267
278
  className: "h-9 bg-background/80 px-3",
268
279
  "data-testid": "contract-sale-document-download-pdf",
269
280
  children: [
270
- z ? F("contract-sale-document-download-spinner") : /* @__PURE__ */ g(E, {
281
+ W ? I("contract-sale-document-download-spinner") : /* @__PURE__ */ _(D, {
271
282
  className: "h-4 w-4",
272
283
  "aria-hidden": "true"
273
284
  }),
274
- /* @__PURE__ */ g("span", {
285
+ /* @__PURE__ */ _("span", {
275
286
  className: "hidden sm:inline",
276
287
  children: a("docs_contract_sale_download_pdf")
277
288
  }),
278
- /* @__PURE__ */ g("span", {
289
+ /* @__PURE__ */ _("span", {
279
290
  className: "sm:hidden",
280
291
  children: "PDF"
281
292
  })
@@ -283,42 +294,42 @@ function V() {
283
294
  }) : null
284
295
  ]
285
296
  })]
286
- }), /* @__PURE__ */ g("div", {
297
+ }), /* @__PURE__ */ _("div", {
287
298
  className: "min-h-0 flex-1",
288
- children: /* @__PURE__ */ g(i, {
289
- data: A,
299
+ children: /* @__PURE__ */ _(i, {
300
+ data: R,
290
301
  heightMode: "parent",
291
- publicDocumentUrl: K,
302
+ publicDocumentUrl: X,
292
303
  onAccept: async (e) => {
293
304
  let t = e.mode === "signature" ? a("docs_contract_sale_signature_submit_error") : a("docs_contract_sale_acceptance_submit_error");
294
- if (!p || !C || !T) throw Error(t);
295
- L(e.mode);
305
+ if (!p || !m || !w) throw Error(t);
306
+ U(e.mode);
296
307
  try {
297
- let n = await o(c, {
308
+ let n = await o(l, {
298
309
  storeSlug: p,
299
- referenceId: C,
300
- saleDocumentId: T,
301
- lang: W,
310
+ referenceId: m,
311
+ saleDocumentId: w,
312
+ lang: J,
302
313
  acceptance: e.mode === "signature" ? {
303
314
  mode: "signature",
304
315
  name: e.name,
305
316
  phone: e.phone,
306
317
  signature: e.signature
307
318
  } : { mode: "acceptance" }
308
- }), r = d.parse(n);
319
+ }), r = f.parse(n);
309
320
  if (!r.success) {
310
321
  let e = r.message ?? t;
311
- if (r.document) return j(r.document), U(e), r.document;
322
+ if (r.document) return B(r.document), q(e), r.document;
312
323
  throw Error(e);
313
324
  }
314
325
  if (!r.document) throw Error(t);
315
- return j(r.document), U(null), r.document;
326
+ return B(r.document), q(null), r.document;
316
327
  } catch (e) {
317
328
  console.error("Failed to submit storefront contract sale document acceptance", e);
318
329
  let n = e instanceof Error && e.message.trim().length > 0 ? e.message : t;
319
- throw U(n), Error(n);
330
+ throw q(n), Error(n);
320
331
  } finally {
321
- L(null);
332
+ U(null);
322
333
  }
323
334
  }
324
335
  })
@@ -326,4 +337,4 @@ function V() {
326
337
  });
327
338
  }
328
339
  //#endregion
329
- export { V as default, z as loader };
340
+ export { H as default, B as loader, j as resolveContractSaleDocumentBackLink };