@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.
- package/dist/components/ContractSaleDocument/Invoice.d.ts.map +1 -1
- package/dist/components/ContractSaleDocument/Invoice.js +144 -148
- package/dist/components/ContractSaleDocument/InvoiceDetails.d.ts.map +1 -1
- package/dist/components/ContractSaleDocument/InvoiceDetails.js +10 -6
- package/dist/components/ContractSaleDocument/TermsAndConditionsContent.d.ts.map +1 -1
- package/dist/components/ContractSaleDocument/TermsAndConditionsContent.js +14 -10
- package/dist/components/Header/index.js +10 -10
- package/dist/i18n/en.d.ts +1 -0
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +1 -0
- package/dist/i18n/fr.d.ts +1 -0
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +1 -0
- package/dist/index.d.ts +5 -12
- package/dist/lib/contractSaleDocument.d.ts +1 -0
- package/dist/lib/contractSaleDocument.d.ts.map +1 -1
- package/dist/lib/contractSaleDocument.js +12 -4
- package/dist/lib/contractSaleDocumentApi.d.ts +4 -12
- package/dist/lib/contractSaleDocumentApi.d.ts.map +1 -1
- package/dist/lib/contractSaleDocumentApi.js +10 -10
- package/dist/pages/ContractSaleDocumentPage.d.ts +9 -1
- package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
- package/dist/pages/ContractSaleDocumentPage.js +146 -135
- package/dist/storefront.css +1 -1
- 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 {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
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
|
|
19
|
-
let t =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
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()}`,
|
|
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
|
-
},
|
|
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
|
-
},
|
|
52
|
+
}, I = (e) => /* @__PURE__ */ _(s, {
|
|
44
53
|
className: "size-4",
|
|
45
54
|
"aria-hidden": "true",
|
|
46
55
|
"data-testid": e
|
|
47
|
-
}),
|
|
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
|
-
}],
|
|
62
|
+
}], R = {
|
|
54
63
|
code: "fr",
|
|
55
64
|
labelKey: "docs_contract_sale_language_option_fr"
|
|
56
65
|
};
|
|
57
|
-
function
|
|
58
|
-
let { t: r } =
|
|
59
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
71
|
+
children: [/* @__PURE__ */ _(O.Trigger, {
|
|
63
72
|
nativeButton: !0,
|
|
64
|
-
render: /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
88
|
-
render: (e, t) => /* @__PURE__ */
|
|
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:
|
|
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:
|
|
100
|
-
children: [/* @__PURE__ */
|
|
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
|
|
110
|
-
let
|
|
111
|
-
if (!
|
|
112
|
-
storeSlug:
|
|
113
|
-
referenceId:
|
|
114
|
-
saleDocumentId:
|
|
115
|
-
pdfMode:
|
|
116
|
-
documentLanguage:
|
|
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(
|
|
122
|
-
storeSlug:
|
|
123
|
-
referenceId:
|
|
124
|
-
saleDocumentId:
|
|
125
|
-
...
|
|
126
|
-
}, e),
|
|
127
|
-
return !
|
|
128
|
-
storeSlug:
|
|
129
|
-
referenceId:
|
|
130
|
-
saleDocumentId:
|
|
131
|
-
pdfMode:
|
|
132
|
-
documentLanguage:
|
|
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:
|
|
143
|
+
error: n.message ?? null
|
|
135
144
|
} : {
|
|
136
|
-
storeSlug:
|
|
137
|
-
referenceId:
|
|
138
|
-
saleDocumentId:
|
|
139
|
-
pdfMode:
|
|
140
|
-
documentLanguage:
|
|
141
|
-
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:
|
|
147
|
-
referenceId:
|
|
148
|
-
saleDocumentId:
|
|
149
|
-
pdfMode:
|
|
150
|
-
documentLanguage:
|
|
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
|
-
}),
|
|
156
|
-
let t =
|
|
164
|
+
}), V = (e) => {
|
|
165
|
+
let t = p.safeParse(e);
|
|
157
166
|
return t.success ? t.data : null;
|
|
158
167
|
};
|
|
159
|
-
function
|
|
160
|
-
let { t: a, i18n: s } =
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}, [
|
|
164
|
-
t(s.language) !==
|
|
165
|
-
}, [s,
|
|
166
|
-
let
|
|
167
|
-
if (e ===
|
|
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
|
-
|
|
181
|
+
d(`${u.pathname}${n ? `?${n}` : ""}${u.hash || ""}`, { replace: !0 });
|
|
173
182
|
};
|
|
174
|
-
if (!
|
|
183
|
+
if (!R) return /* @__PURE__ */ _("div", {
|
|
175
184
|
className: "mx-auto max-w-3xl px-4 py-14 sm:px-6",
|
|
176
|
-
children: /* @__PURE__ */
|
|
185
|
+
children: /* @__PURE__ */ _(r, {
|
|
177
186
|
className: "border-slate-200 bg-white p-5 shadow-sm sm:p-6",
|
|
178
|
-
children: /* @__PURE__ */
|
|
187
|
+
children: /* @__PURE__ */ v("div", {
|
|
179
188
|
className: "space-y-4",
|
|
180
189
|
children: [
|
|
181
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ _("h1", {
|
|
182
191
|
className: "text-lg font-semibold text-slate-950",
|
|
183
|
-
children: /* @__PURE__ */
|
|
192
|
+
children: /* @__PURE__ */ _("span", { children: a("docs_contract_sale_not_found_title") })
|
|
184
193
|
}),
|
|
185
|
-
/* @__PURE__ */
|
|
194
|
+
/* @__PURE__ */ _("p", {
|
|
186
195
|
className: "text-sm text-destructive",
|
|
187
|
-
children: /* @__PURE__ */
|
|
196
|
+
children: /* @__PURE__ */ _("span", { children: K ?? a("docs_contract_sale_load_error") })
|
|
188
197
|
}),
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
to:
|
|
191
|
-
|
|
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__ */
|
|
203
|
+
children: [/* @__PURE__ */ _(T, {
|
|
194
204
|
className: "h-4 w-4",
|
|
195
205
|
"aria-hidden": "true"
|
|
196
|
-
}), /* @__PURE__ */
|
|
206
|
+
}), /* @__PURE__ */ _("span", { children: L })]
|
|
197
207
|
})
|
|
198
208
|
})
|
|
199
209
|
]
|
|
200
210
|
})
|
|
201
211
|
})
|
|
202
212
|
});
|
|
203
|
-
if (
|
|
213
|
+
if (E) return /* @__PURE__ */ _("div", {
|
|
204
214
|
className: "min-h-screen bg-white",
|
|
205
|
-
children: /* @__PURE__ */
|
|
206
|
-
data:
|
|
215
|
+
children: /* @__PURE__ */ _(i, {
|
|
216
|
+
data: R,
|
|
207
217
|
renderMode: "pdf",
|
|
208
|
-
publicDocumentUrl:
|
|
218
|
+
publicDocumentUrl: X
|
|
209
219
|
})
|
|
210
220
|
});
|
|
211
|
-
let
|
|
212
|
-
if (!
|
|
213
|
-
|
|
214
|
-
let e = n.loading(a("docs_contract_sale_preparing_pdf"), { icon:
|
|
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(
|
|
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 =
|
|
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
|
-
|
|
238
|
+
G(!1);
|
|
229
239
|
}
|
|
230
240
|
};
|
|
231
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
236
|
-
to:
|
|
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
|
-
|
|
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__ */
|
|
242
|
-
}), /* @__PURE__ */
|
|
252
|
+
}), /* @__PURE__ */ _("span", { children: L })]
|
|
253
|
+
}), /* @__PURE__ */ v("div", {
|
|
243
254
|
className: "flex min-w-0 items-center gap-2",
|
|
244
255
|
children: [
|
|
245
|
-
|
|
256
|
+
K ? /* @__PURE__ */ _("span", {
|
|
246
257
|
className: "max-w-[min(44vw,24rem)] truncate text-right text-sm text-destructive",
|
|
247
|
-
children:
|
|
248
|
-
}) :
|
|
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
|
-
}) :
|
|
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__ */
|
|
256
|
-
selectedLanguage:
|
|
257
|
-
onChange:
|
|
266
|
+
/* @__PURE__ */ _(z, {
|
|
267
|
+
selectedLanguage: J,
|
|
268
|
+
onChange: Z
|
|
258
269
|
}),
|
|
259
|
-
|
|
270
|
+
Y ? /* @__PURE__ */ v(e, {
|
|
260
271
|
variant: "outline",
|
|
261
272
|
size: "sm",
|
|
262
273
|
type: "button",
|
|
263
|
-
disabled:
|
|
274
|
+
disabled: W,
|
|
264
275
|
onClick: () => {
|
|
265
|
-
|
|
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
|
-
|
|
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__ */
|
|
285
|
+
/* @__PURE__ */ _("span", {
|
|
275
286
|
className: "hidden sm:inline",
|
|
276
287
|
children: a("docs_contract_sale_download_pdf")
|
|
277
288
|
}),
|
|
278
|
-
/* @__PURE__ */
|
|
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__ */
|
|
297
|
+
}), /* @__PURE__ */ _("div", {
|
|
287
298
|
className: "min-h-0 flex-1",
|
|
288
|
-
children: /* @__PURE__ */
|
|
289
|
-
data:
|
|
299
|
+
children: /* @__PURE__ */ _(i, {
|
|
300
|
+
data: R,
|
|
290
301
|
heightMode: "parent",
|
|
291
|
-
publicDocumentUrl:
|
|
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 || !
|
|
295
|
-
|
|
305
|
+
if (!p || !m || !w) throw Error(t);
|
|
306
|
+
U(e.mode);
|
|
296
307
|
try {
|
|
297
|
-
let n = await o(
|
|
308
|
+
let n = await o(l, {
|
|
298
309
|
storeSlug: p,
|
|
299
|
-
referenceId:
|
|
300
|
-
saleDocumentId:
|
|
301
|
-
lang:
|
|
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 =
|
|
319
|
+
}), r = f.parse(n);
|
|
309
320
|
if (!r.success) {
|
|
310
321
|
let e = r.message ?? t;
|
|
311
|
-
if (r.document) return
|
|
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
|
|
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
|
|
330
|
+
throw q(n), Error(n);
|
|
320
331
|
} finally {
|
|
321
|
-
|
|
332
|
+
U(null);
|
|
322
333
|
}
|
|
323
334
|
}
|
|
324
335
|
})
|
|
@@ -326,4 +337,4 @@ function V() {
|
|
|
326
337
|
});
|
|
327
338
|
}
|
|
328
339
|
//#endregion
|
|
329
|
-
export {
|
|
340
|
+
export { H as default, B as loader, j as resolveContractSaleDocumentBackLink };
|