@loczer/storefront-sdk 0.231.0 → 0.232.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/chunks/pkg/ui/dist/LanguagePicker/index-D7_3voTe.js +83 -0
- package/dist/components/BookingBikeQuickAddCard/index.d.ts.map +1 -1
- package/dist/components/BookingBikeQuickAddCard/index.js +0 -3
- package/dist/components/BookingBikeVariantDialog/index.d.ts.map +1 -1
- package/dist/components/BookingBikeVariantDialog/index.js +7 -9
- package/dist/components/BookingPeriodSelector/components/BookingEndDateField.js +1 -1
- package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.js +1 -1
- package/dist/components/BookingPeriodSelector/components/BookingStartDateField.js +1 -1
- package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.js +1 -1
- package/dist/components/ContractSaleDocument/InvoiceDetails.d.ts.map +1 -1
- package/dist/components/ContractSaleDocument/InvoiceDetails.js +62 -56
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +56 -56
- package/dist/components/LanguageSelector/index.d.ts.map +1 -1
- package/dist/components/LanguageSelector/index.js +19 -64
- package/dist/i18n/en.d.ts +2 -0
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +3 -1
- package/dist/i18n/fr.d.ts +2 -0
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +3 -1
- package/dist/index.d.ts +5 -0
- package/dist/lib/cart.d.ts +1 -0
- package/dist/lib/cart.d.ts.map +1 -1
- package/dist/lib/cart.js +2 -0
- package/dist/pages/BookingPage.d.ts.map +1 -1
- package/dist/pages/BookingPage.js +292 -292
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +107 -103
- package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
- package/dist/pages/ContractSaleDocumentPage.js +117 -171
- package/dist/pages/ProductPage.d.ts.map +1 -1
- package/dist/pages/ProductPage.js +31 -31
- package/dist/pages/checkout/components/CheckoutLoadingSkeleton.d.ts +7 -0
- package/dist/pages/checkout/components/CheckoutLoadingSkeleton.d.ts.map +1 -0
- package/dist/pages/checkout/components/CheckoutLoadingSkeleton.js +105 -0
- package/dist/storefront.css +1 -1
- package/package.json +1 -1
- package/dist/chunks/pkg/ui/dist/{MorphingModalWizard-j1CgFGLe.js → MorphingModalWizard-Q8O5Rjfq.js} +1 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { normalizeStorefrontI18nLanguage as e } from "../i18n/languages.js";
|
|
2
|
-
import { Button as t } from "../ui/button.js";
|
|
2
|
+
import { Button as t, storefrontButtonRadiusClassName as n } from "../ui/button.js";
|
|
3
|
+
import { LanguagePicker as r } from "../chunks/pkg/ui/dist/LanguagePicker/index-D7_3voTe.js";
|
|
3
4
|
import "../i18n/I18nProvider.js";
|
|
4
|
-
import { toast as
|
|
5
|
-
import { Card as
|
|
6
|
-
import { ContractSaleDocument as
|
|
5
|
+
import { toast as i } from "../lib/toast.js";
|
|
6
|
+
import { Card as a } from "../ui/card.js";
|
|
7
|
+
import { ContractSaleDocument as o } from "../components/ContractSaleDocument/Invoice.js";
|
|
7
8
|
import "../components/ContractSaleDocument/index.js";
|
|
8
|
-
import { apiGet as
|
|
9
|
-
import { Spinner as
|
|
10
|
-
import { resolveContractSaleDocumentRequestLanguage as
|
|
11
|
-
import { ACCEPT_CONTRACT_SALE_DOCUMENT_ROUTE as
|
|
12
|
-
import { useEffect as
|
|
13
|
-
import { jsx as
|
|
14
|
-
import { Link as
|
|
15
|
-
import { useTranslation as
|
|
16
|
-
import { cn as
|
|
17
|
-
import { ArrowLeft as
|
|
18
|
-
import { Menu as O } from "@base-ui/react/menu";
|
|
9
|
+
import { apiGet as s, apiPost as c } from "../lib/apiCall.js";
|
|
10
|
+
import { Spinner as l } from "../chunks/pkg/ui/dist/Spinner/index-Cgi70z_E.js";
|
|
11
|
+
import { resolveContractSaleDocumentRequestLanguage as u } from "../lib/contractSaleDocument.js";
|
|
12
|
+
import { ACCEPT_CONTRACT_SALE_DOCUMENT_ROUTE as d, DOWNLOAD_CONTRACT_SALE_DOCUMENT_PDF_ROUTE as f, GET_CONTRACT_SALE_DOCUMENT_ROUTE as p, acceptContractSaleDocumentResponseSchema as m, contractSaleDocumentApiSchema as h, getContractSaleDocumentResponseSchema as g } from "../lib/contractSaleDocumentApi.js";
|
|
13
|
+
import { useEffect as _, useState as v } from "react";
|
|
14
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
15
|
+
import { Link as x, useLoaderData as S, useLocation as C, useNavigate as w } from "@rpcbase/router";
|
|
16
|
+
import { useTranslation as T } from "react-i18next";
|
|
17
|
+
import { cn as E } from "@rpcbase/ui";
|
|
18
|
+
import { ArrowLeft as D, Download as O } from "lucide-react";
|
|
19
19
|
//#region src/pages/ContractSaleDocumentPage.tsx
|
|
20
|
-
var k = (e) => new URLSearchParams(e).get("pdf") === "1", A = (e) =>
|
|
20
|
+
var k = (e) => new URLSearchParams(e).get("pdf") === "1", A = (e) => u(new URLSearchParams(e).get("lang")), j = (e) => {
|
|
21
21
|
let t = new URLSearchParams(e).get("back")?.trim();
|
|
22
22
|
if (!t || !t.startsWith("/") || t.startsWith("//")) return null;
|
|
23
23
|
try {
|
|
@@ -31,7 +31,7 @@ var k = (e) => new URLSearchParams(e).get("pdf") === "1", A = (e) => c(new URLSe
|
|
|
31
31
|
if (n) return new URL(n, "http://localhost").search;
|
|
32
32
|
let r = typeof e?.req?.originalUrl == "string" ? e.req.originalUrl : "";
|
|
33
33
|
return r ? new URL(r, "http://localhost").search : typeof window < "u" ? window.location.search : "";
|
|
34
|
-
}, N = (e, t, n, r) => `${
|
|
34
|
+
}, N = (e, t, n, r) => `${f}?${new URLSearchParams({
|
|
35
35
|
storeSlug: e,
|
|
36
36
|
referenceId: t,
|
|
37
37
|
saleDocumentId: n,
|
|
@@ -50,94 +50,32 @@ var k = (e) => new URLSearchParams(e).get("pdf") === "1", A = (e) => c(new URLSe
|
|
|
50
50
|
return i;
|
|
51
51
|
}
|
|
52
52
|
return e.match(/filename="([^"]+)"/i)?.[1] ?? e.match(/filename=([^;]+)/i)?.[1]?.trim() ?? r;
|
|
53
|
-
}, I = (e) => /* @__PURE__ */
|
|
53
|
+
}, I = (e) => /* @__PURE__ */ y(l, {
|
|
54
54
|
className: "size-4",
|
|
55
55
|
"aria-hidden": "true",
|
|
56
56
|
"data-testid": e
|
|
57
|
-
}), L =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}, {
|
|
61
|
-
code: "en",
|
|
62
|
-
labelKey: "docs_contract_sale_language_option_en"
|
|
63
|
-
}], R = {
|
|
64
|
-
code: "fr",
|
|
65
|
-
labelKey: "docs_contract_sale_language_option_fr"
|
|
66
|
-
};
|
|
67
|
-
function z({ selectedLanguage: e, onChange: n }) {
|
|
68
|
-
let { t: r } = C(), [i, a] = g(!1), o = L.find((t) => t.code === e) ?? R;
|
|
69
|
-
return /* @__PURE__ */ v(O.Root, {
|
|
70
|
-
open: i,
|
|
71
|
-
onOpenChange: a,
|
|
72
|
-
children: [/* @__PURE__ */ _(O.Trigger, {
|
|
73
|
-
nativeButton: !0,
|
|
74
|
-
render: /* @__PURE__ */ v(t, {
|
|
75
|
-
variant: "outline",
|
|
76
|
-
size: "sm",
|
|
77
|
-
type: "button",
|
|
78
|
-
"aria-label": r("docs_contract_sale_language_selector_label"),
|
|
79
|
-
className: "h-9 gap-1 bg-background/80 px-2 uppercase",
|
|
80
|
-
"data-testid": "contract-sale-document-language-trigger",
|
|
81
|
-
children: [/* @__PURE__ */ _("span", { children: o.code }), /* @__PURE__ */ _(E, {
|
|
82
|
-
className: "h-4 w-4",
|
|
83
|
-
"aria-hidden": "true"
|
|
84
|
-
})]
|
|
85
|
-
})
|
|
86
|
-
}), /* @__PURE__ */ _(O.Portal, { children: /* @__PURE__ */ _(O.Positioner, {
|
|
87
|
-
align: "end",
|
|
88
|
-
sideOffset: 4,
|
|
89
|
-
positionMethod: "fixed",
|
|
90
|
-
className: "z-50",
|
|
91
|
-
collisionPadding: 8,
|
|
92
|
-
collisionAvoidance: {
|
|
93
|
-
side: "flip",
|
|
94
|
-
align: "shift",
|
|
95
|
-
fallbackAxisSide: "none"
|
|
96
|
-
},
|
|
97
|
-
children: /* @__PURE__ */ _(O.Popup, {
|
|
98
|
-
render: (e, t) => /* @__PURE__ */ _("div", {
|
|
99
|
-
...e,
|
|
100
|
-
"data-menu-content": "",
|
|
101
|
-
"data-state": t.open ? "open" : "closed"
|
|
102
|
-
}),
|
|
103
|
-
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",
|
|
104
|
-
children: L.map((t) => /* @__PURE__ */ v(O.Item, {
|
|
105
|
-
onClick: (e) => {
|
|
106
|
-
e.defaultPrevented || (n(t.code), a(!1));
|
|
107
|
-
},
|
|
108
|
-
"data-testid": `contract-sale-document-language-option-${t.code}`,
|
|
109
|
-
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", e === t.code && "bg-accent"),
|
|
110
|
-
children: [/* @__PURE__ */ _("span", { children: r(t.labelKey) }), /* @__PURE__ */ _("span", {
|
|
111
|
-
className: "text-2xs uppercase text-muted-foreground",
|
|
112
|
-
children: t.code
|
|
113
|
-
})]
|
|
114
|
-
}, t.code))
|
|
115
|
-
})
|
|
116
|
-
}) })]
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
var B = (async ({ ctx: e, params: t, request: n }) => {
|
|
120
|
-
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);
|
|
121
|
-
if (!r || !i || !o) return {
|
|
57
|
+
}), L = (async ({ ctx: e, params: t, request: n }) => {
|
|
58
|
+
let r = typeof t.storeSlug == "string" ? t.storeSlug.trim().toLowerCase() : "", i = typeof t.referenceId == "string" ? t.referenceId.trim() : "", a = typeof t.saleDocumentId == "string" ? t.saleDocumentId.trim() : "", o = M(e, n), c = k(o), l = A(o);
|
|
59
|
+
if (!r || !i || !a) return {
|
|
122
60
|
storeSlug: r,
|
|
123
61
|
referenceId: i,
|
|
124
|
-
saleDocumentId:
|
|
62
|
+
saleDocumentId: a,
|
|
125
63
|
pdfMode: c,
|
|
126
64
|
documentLanguage: l,
|
|
127
65
|
document: null,
|
|
128
66
|
error: null
|
|
129
67
|
};
|
|
130
68
|
try {
|
|
131
|
-
let t = await
|
|
69
|
+
let t = await s(p, {
|
|
132
70
|
storeSlug: r,
|
|
133
71
|
referenceId: i,
|
|
134
|
-
saleDocumentId:
|
|
72
|
+
saleDocumentId: a,
|
|
135
73
|
...l ? { lang: l } : {}
|
|
136
|
-
}, e), n =
|
|
74
|
+
}, e), n = g.parse(t);
|
|
137
75
|
return !n.success || !n.document ? {
|
|
138
76
|
storeSlug: r,
|
|
139
77
|
referenceId: i,
|
|
140
|
-
saleDocumentId:
|
|
78
|
+
saleDocumentId: a,
|
|
141
79
|
pdfMode: c,
|
|
142
80
|
documentLanguage: l,
|
|
143
81
|
document: null,
|
|
@@ -145,7 +83,7 @@ var B = (async ({ ctx: e, params: t, request: n }) => {
|
|
|
145
83
|
} : {
|
|
146
84
|
storeSlug: r,
|
|
147
85
|
referenceId: i,
|
|
148
|
-
saleDocumentId:
|
|
86
|
+
saleDocumentId: a,
|
|
149
87
|
pdfMode: c,
|
|
150
88
|
documentLanguage: l,
|
|
151
89
|
document: n.document,
|
|
@@ -155,139 +93,147 @@ var B = (async ({ ctx: e, params: t, request: n }) => {
|
|
|
155
93
|
return console.error("Failed to load storefront contract sale document", e), {
|
|
156
94
|
storeSlug: r,
|
|
157
95
|
referenceId: i,
|
|
158
|
-
saleDocumentId:
|
|
96
|
+
saleDocumentId: a,
|
|
159
97
|
pdfMode: c,
|
|
160
98
|
documentLanguage: l,
|
|
161
99
|
document: null,
|
|
162
100
|
error: null
|
|
163
101
|
};
|
|
164
102
|
}
|
|
165
|
-
}),
|
|
166
|
-
let t =
|
|
103
|
+
}), R = (e) => {
|
|
104
|
+
let t = h.safeParse(e);
|
|
167
105
|
return t.success ? t.data : null;
|
|
168
106
|
};
|
|
169
|
-
function
|
|
170
|
-
let { t:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}, [
|
|
174
|
-
e(
|
|
175
|
-
}, [
|
|
176
|
-
let
|
|
177
|
-
if (e ===
|
|
178
|
-
|
|
179
|
-
let t = new URLSearchParams(
|
|
107
|
+
function z() {
|
|
108
|
+
let { t: s, i18n: l } = T(), u = S(), f = C(), p = w(), { storeSlug: h, referenceId: g, saleDocumentId: M } = u, L = u.pdfMode || k(f.search), z = j(f.search), B = z ?? `/${h ?? ""}`, V = s(z ? "docs_contract_sale_back" : "docs_contract_sale_back_to_storefront"), [H, U] = v(R(u.document)), [W, G] = v(null), [K, q] = v(!1), [J, Y] = v(u.error), X = A(f.search) ?? e(H?.language?.customer) ?? u.documentLanguage ?? e(l.language) ?? "fr", Z = h && g && M ? N(h, g, M, X) : null, Q = h && g && M ? P(h, g, M, X) : "";
|
|
109
|
+
_(() => {
|
|
110
|
+
U(R(u.document)), Y(u.error);
|
|
111
|
+
}, [u.document, u.error]), _(() => {
|
|
112
|
+
e(l.language) !== X && l.changeLanguage(X);
|
|
113
|
+
}, [l, X]);
|
|
114
|
+
let $ = (e) => {
|
|
115
|
+
if (e === X) return;
|
|
116
|
+
l.changeLanguage(e);
|
|
117
|
+
let t = new URLSearchParams(f.search);
|
|
180
118
|
t.set("lang", e);
|
|
181
119
|
let n = t.toString();
|
|
182
|
-
|
|
120
|
+
p(`${f.pathname}${n ? `?${n}` : ""}${f.hash || ""}`, { replace: !0 });
|
|
183
121
|
};
|
|
184
|
-
if (!
|
|
122
|
+
if (!H) return /* @__PURE__ */ y("div", {
|
|
185
123
|
className: "mx-auto max-w-3xl px-4 py-14 sm:px-6",
|
|
186
|
-
children: /* @__PURE__ */
|
|
124
|
+
children: /* @__PURE__ */ y(a, {
|
|
187
125
|
className: "border-slate-200 bg-white p-5 shadow-sm sm:p-6",
|
|
188
|
-
children: /* @__PURE__ */
|
|
126
|
+
children: /* @__PURE__ */ b("div", {
|
|
189
127
|
className: "space-y-4",
|
|
190
128
|
children: [
|
|
191
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ y("h1", {
|
|
192
130
|
className: "text-lg font-semibold text-slate-950",
|
|
193
|
-
children: /* @__PURE__ */
|
|
131
|
+
children: /* @__PURE__ */ y("span", { children: s("docs_contract_sale_not_found_title") })
|
|
194
132
|
}),
|
|
195
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ y("p", {
|
|
196
134
|
className: "text-sm text-destructive",
|
|
197
|
-
children: /* @__PURE__ */
|
|
135
|
+
children: /* @__PURE__ */ y("span", { children: J ?? s("docs_contract_sale_load_error") })
|
|
198
136
|
}),
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
to:
|
|
137
|
+
/* @__PURE__ */ y(x, {
|
|
138
|
+
to: B,
|
|
201
139
|
"data-testid": "contract-sale-document-back-link",
|
|
202
|
-
children: /* @__PURE__ */
|
|
140
|
+
children: /* @__PURE__ */ b(t, {
|
|
203
141
|
className: "gap-2",
|
|
204
|
-
children: [/* @__PURE__ */
|
|
142
|
+
children: [/* @__PURE__ */ y(D, {
|
|
205
143
|
className: "h-4 w-4",
|
|
206
144
|
"aria-hidden": "true"
|
|
207
|
-
}), /* @__PURE__ */
|
|
145
|
+
}), /* @__PURE__ */ y("span", { children: V })]
|
|
208
146
|
})
|
|
209
147
|
})
|
|
210
148
|
]
|
|
211
149
|
})
|
|
212
150
|
})
|
|
213
151
|
});
|
|
214
|
-
if (
|
|
152
|
+
if (L) return /* @__PURE__ */ y("div", {
|
|
215
153
|
className: "min-h-screen bg-white",
|
|
216
|
-
children: /* @__PURE__ */
|
|
217
|
-
data:
|
|
154
|
+
children: /* @__PURE__ */ y(o, {
|
|
155
|
+
data: H,
|
|
218
156
|
renderMode: "pdf",
|
|
219
|
-
publicDocumentUrl:
|
|
157
|
+
publicDocumentUrl: Q
|
|
220
158
|
})
|
|
221
159
|
});
|
|
222
|
-
let
|
|
223
|
-
if (!
|
|
224
|
-
|
|
225
|
-
let e =
|
|
160
|
+
let ee = async () => {
|
|
161
|
+
if (!Z || K) return;
|
|
162
|
+
q(!0);
|
|
163
|
+
let e = i.loading(s("docs_contract_sale_preparing_pdf"), { icon: I() });
|
|
226
164
|
try {
|
|
227
|
-
let t = await fetch(
|
|
165
|
+
let t = await fetch(Z, {
|
|
228
166
|
method: "GET",
|
|
229
167
|
credentials: "include"
|
|
230
168
|
});
|
|
231
169
|
if (!t.ok) throw Error(`PDF request failed with status ${t.status}`);
|
|
232
|
-
let
|
|
233
|
-
a.href =
|
|
234
|
-
window.URL.revokeObjectURL(
|
|
170
|
+
let n = await t.blob(), r = window.URL.createObjectURL(n), a = window.document.createElement("a");
|
|
171
|
+
a.href = r, a.download = F(t.headers.get("content-disposition"), H.saleDocumentNumber, H.kind), window.document.body.appendChild(a), a.click(), a.remove(), i.dismiss(e), window.setTimeout(() => {
|
|
172
|
+
window.URL.revokeObjectURL(r);
|
|
235
173
|
}, 0);
|
|
236
174
|
} catch (t) {
|
|
237
|
-
console.error("Failed to download storefront contract sale document PDF", t),
|
|
175
|
+
console.error("Failed to download storefront contract sale document PDF", t), i.dismiss(e), i.error(s("docs_contract_sale_download_pdf_error"));
|
|
238
176
|
} finally {
|
|
239
|
-
|
|
177
|
+
q(!1);
|
|
240
178
|
}
|
|
241
179
|
};
|
|
242
|
-
return /* @__PURE__ */
|
|
180
|
+
return /* @__PURE__ */ b("div", {
|
|
243
181
|
className: "flex h-dvh min-h-0 flex-col overflow-hidden bg-gradient-to-br from-slate-100 via-slate-100 to-slate-200",
|
|
244
|
-
children: [/* @__PURE__ */
|
|
182
|
+
children: [/* @__PURE__ */ b("div", {
|
|
245
183
|
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",
|
|
246
|
-
children: [/* @__PURE__ */
|
|
247
|
-
to:
|
|
184
|
+
children: [/* @__PURE__ */ b(x, {
|
|
185
|
+
to: B,
|
|
248
186
|
className: "inline-flex items-center gap-2 text-sm font-medium text-slate-700 hover:text-slate-950",
|
|
249
187
|
"data-testid": "contract-sale-document-back-link",
|
|
250
|
-
children: [/* @__PURE__ */
|
|
188
|
+
children: [/* @__PURE__ */ y(D, {
|
|
251
189
|
className: "h-4 w-4",
|
|
252
190
|
"aria-hidden": "true"
|
|
253
|
-
}), /* @__PURE__ */
|
|
254
|
-
}), /* @__PURE__ */
|
|
191
|
+
}), /* @__PURE__ */ y("span", { children: V })]
|
|
192
|
+
}), /* @__PURE__ */ b("div", {
|
|
255
193
|
className: "flex min-w-0 items-center gap-2",
|
|
256
194
|
children: [
|
|
257
|
-
|
|
195
|
+
J ? /* @__PURE__ */ y("span", {
|
|
258
196
|
className: "max-w-[min(44vw,24rem)] truncate text-right text-sm text-destructive",
|
|
259
|
-
children:
|
|
260
|
-
}) :
|
|
197
|
+
children: J
|
|
198
|
+
}) : W === "signature" ? /* @__PURE__ */ y("span", {
|
|
261
199
|
className: "max-w-[min(44vw,24rem)] truncate text-right text-sm text-slate-600",
|
|
262
|
-
children:
|
|
263
|
-
}) :
|
|
200
|
+
children: s("docs_contract_sale_submitting_signature")
|
|
201
|
+
}) : W === "acceptance" ? /* @__PURE__ */ y("span", {
|
|
264
202
|
className: "max-w-[min(44vw,24rem)] truncate text-right text-sm text-slate-600",
|
|
265
|
-
children:
|
|
203
|
+
children: s("docs_contract_sale_submitting_acceptance")
|
|
266
204
|
}) : null,
|
|
267
|
-
/* @__PURE__ */
|
|
268
|
-
|
|
269
|
-
|
|
205
|
+
/* @__PURE__ */ y(r, {
|
|
206
|
+
value: X,
|
|
207
|
+
onValueChange: $,
|
|
208
|
+
ariaLabel: s("docs_contract_sale_language_selector_label"),
|
|
209
|
+
labels: {
|
|
210
|
+
fr: s("docs_contract_sale_language_option_fr"),
|
|
211
|
+
en: s("docs_contract_sale_language_option_en")
|
|
212
|
+
},
|
|
213
|
+
triggerClassName: E("h-9 bg-background/80 px-2", n),
|
|
214
|
+
triggerTestId: "contract-sale-document-language-trigger",
|
|
215
|
+
optionTestIdPrefix: "contract-sale-document-language-option"
|
|
270
216
|
}),
|
|
271
|
-
|
|
217
|
+
Z ? /* @__PURE__ */ b(t, {
|
|
272
218
|
variant: "outline",
|
|
273
219
|
size: "sm",
|
|
274
220
|
type: "button",
|
|
275
|
-
disabled:
|
|
221
|
+
disabled: K,
|
|
276
222
|
onClick: () => {
|
|
277
|
-
|
|
223
|
+
ee();
|
|
278
224
|
},
|
|
279
225
|
className: "h-9 bg-background/80 px-3",
|
|
280
226
|
"data-testid": "contract-sale-document-download-pdf",
|
|
281
227
|
children: [
|
|
282
|
-
|
|
228
|
+
K ? I("contract-sale-document-download-spinner") : /* @__PURE__ */ y(O, {
|
|
283
229
|
className: "h-4 w-4",
|
|
284
230
|
"aria-hidden": "true"
|
|
285
231
|
}),
|
|
286
|
-
/* @__PURE__ */
|
|
232
|
+
/* @__PURE__ */ y("span", {
|
|
287
233
|
className: "hidden sm:inline",
|
|
288
|
-
children:
|
|
234
|
+
children: s("docs_contract_sale_download_pdf")
|
|
289
235
|
}),
|
|
290
|
-
/* @__PURE__ */
|
|
236
|
+
/* @__PURE__ */ y("span", {
|
|
291
237
|
className: "sm:hidden",
|
|
292
238
|
children: "PDF"
|
|
293
239
|
})
|
|
@@ -295,42 +241,42 @@ function H() {
|
|
|
295
241
|
}) : null
|
|
296
242
|
]
|
|
297
243
|
})]
|
|
298
|
-
}), /* @__PURE__ */
|
|
244
|
+
}), /* @__PURE__ */ y("div", {
|
|
299
245
|
className: "min-h-0 flex-1",
|
|
300
|
-
children: /* @__PURE__ */
|
|
301
|
-
data:
|
|
246
|
+
children: /* @__PURE__ */ y(o, {
|
|
247
|
+
data: H,
|
|
302
248
|
heightMode: "parent",
|
|
303
|
-
publicDocumentUrl:
|
|
249
|
+
publicDocumentUrl: Q,
|
|
304
250
|
onAccept: async (e) => {
|
|
305
|
-
let t = e.mode === "signature" ?
|
|
306
|
-
if (!
|
|
307
|
-
|
|
251
|
+
let t = e.mode === "signature" ? s("docs_contract_sale_signature_submit_error") : s("docs_contract_sale_acceptance_submit_error");
|
|
252
|
+
if (!h || !g || !M) throw Error(t);
|
|
253
|
+
G(e.mode);
|
|
308
254
|
try {
|
|
309
|
-
let n = await
|
|
310
|
-
storeSlug:
|
|
311
|
-
referenceId:
|
|
312
|
-
saleDocumentId:
|
|
313
|
-
lang:
|
|
255
|
+
let n = await c(d, {
|
|
256
|
+
storeSlug: h,
|
|
257
|
+
referenceId: g,
|
|
258
|
+
saleDocumentId: M,
|
|
259
|
+
lang: X,
|
|
314
260
|
acceptance: e.mode === "signature" ? {
|
|
315
261
|
mode: "signature",
|
|
316
262
|
name: e.name,
|
|
317
263
|
phone: e.phone,
|
|
318
264
|
signature: e.signature
|
|
319
265
|
} : { mode: "acceptance" }
|
|
320
|
-
}), r =
|
|
266
|
+
}), r = m.parse(n);
|
|
321
267
|
if (!r.success) {
|
|
322
268
|
let e = r.message ?? t;
|
|
323
|
-
if (r.document) return
|
|
269
|
+
if (r.document) return U(r.document), Y(e), r.document;
|
|
324
270
|
throw Error(e);
|
|
325
271
|
}
|
|
326
272
|
if (!r.document) throw Error(t);
|
|
327
|
-
return
|
|
273
|
+
return U(r.document), Y(null), r.document;
|
|
328
274
|
} catch (e) {
|
|
329
275
|
console.error("Failed to submit storefront contract sale document acceptance", e);
|
|
330
276
|
let n = e instanceof Error && e.message.trim().length > 0 ? e.message : t;
|
|
331
|
-
throw
|
|
277
|
+
throw Y(n), Error(n);
|
|
332
278
|
} finally {
|
|
333
|
-
|
|
279
|
+
G(null);
|
|
334
280
|
}
|
|
335
281
|
}
|
|
336
282
|
})
|
|
@@ -338,4 +284,4 @@ function H() {
|
|
|
338
284
|
});
|
|
339
285
|
}
|
|
340
286
|
//#endregion
|
|
341
|
-
export {
|
|
287
|
+
export { z as default, L as loader, j as resolveContractSaleDocumentBackLink };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductPage.d.ts","sourceRoot":"","sources":["../../src/pages/ProductPage.tsx"],"names":[],"mappings":"AAiIA,MAAM,CAAC,OAAO,UAAU,WAAW,
|
|
1
|
+
{"version":3,"file":"ProductPage.d.ts","sourceRoot":"","sources":["../../src/pages/ProductPage.tsx"],"names":[],"mappings":"AAiIA,MAAM,CAAC,OAAO,UAAU,WAAW,4CAuYlC"}
|
|
@@ -4,7 +4,7 @@ import { getLocalizedValue as a } from "../localization.js";
|
|
|
4
4
|
import { findStorefrontProductBySlug as te, getStorefrontCheckoutProductId as o, getStorefrontProductSelectionDisplayName as ne } from "../lib/products.js";
|
|
5
5
|
import { useStorefrontCart as re } from "../lib/cart.js";
|
|
6
6
|
import { getAvailabilityVariant as ie } from "../lib/utils.js";
|
|
7
|
-
import { ROUTE as ae, buildStorefrontAvailabilityKey as s, getStorefrontAvailabilityIssue as oe, getStorefrontAvailabilityStatus as
|
|
7
|
+
import { ROUTE as ae, buildStorefrontAvailabilityKey as s, getStorefrontAvailabilityIssue as oe, getStorefrontAvailabilityStatus as c, getStorefrontProductAvailabilityStatus as se, getValidStorefrontAvailabilitySchedule as ce, isStorefrontAvailabilityInsufficient as le, responseSchema as ue } from "../lib/storefrontAvailability.js";
|
|
8
8
|
import { Badge as l } from "../ui/badge.js";
|
|
9
9
|
import { Button as u } from "../ui/button.js";
|
|
10
10
|
import { useStorefront as de, useStorefrontProducts as fe } from "../StorefrontContext.js";
|
|
@@ -68,7 +68,7 @@ function C() {
|
|
|
68
68
|
]), M = t(Ne).toString(), N = f(() => n(new URLSearchParams(M), T), [M, T]), P = f(() => e(N, {
|
|
69
69
|
startTime: "",
|
|
70
70
|
endTime: ""
|
|
71
|
-
}), [N]), F = f(() =>
|
|
71
|
+
}), [N]), F = f(() => ce(P), [P]), I = N.toString(), L = `/${T ?? ""}/checkout${I ? `?${I}` : ""}`, R = `/${T ?? ""}`, Re = R, z = Pe.state, ze = typeof z?.backTo == "string" && z.backTo.startsWith(R) ? z.backTo : Re, [B, V] = p(1), [H, U] = p(() => b(j)), W = Number.isFinite(B) ? Math.max(1, Math.min(99, Math.floor(B))) : 1, G = f(() => Ae(j, W), [W, j]), [K, q] = p([]), [Be, J] = p(!1);
|
|
72
72
|
d(() => {
|
|
73
73
|
if (V(1), !j) {
|
|
74
74
|
U(null);
|
|
@@ -79,15 +79,15 @@ function C() {
|
|
|
79
79
|
r(T, N);
|
|
80
80
|
}, [N, T]), d(() => {
|
|
81
81
|
if (!T || G.length === 0) {
|
|
82
|
-
|
|
82
|
+
q([]), J(!1);
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
if (!F) {
|
|
86
|
-
|
|
86
|
+
q([]), J(!1);
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
let e = !1;
|
|
90
|
-
return
|
|
90
|
+
return J(!0), q([]), (async () => {
|
|
91
91
|
try {
|
|
92
92
|
let t = await ye(ae, {
|
|
93
93
|
storeSlug: T,
|
|
@@ -95,12 +95,12 @@ function C() {
|
|
|
95
95
|
products: G
|
|
96
96
|
}), n = ue.parse(t);
|
|
97
97
|
if (e) return;
|
|
98
|
-
|
|
98
|
+
q(n.success ? n.availability ?? [] : []);
|
|
99
99
|
} catch (t) {
|
|
100
100
|
if (e) return;
|
|
101
|
-
console.error("Failed to load storefront product availability", t),
|
|
101
|
+
console.error("Failed to load storefront product availability", t), q([]);
|
|
102
102
|
} finally {
|
|
103
|
-
e ||
|
|
103
|
+
e || J(!1);
|
|
104
104
|
}
|
|
105
105
|
})(), () => {
|
|
106
106
|
e = !0;
|
|
@@ -114,7 +114,7 @@ function C() {
|
|
|
114
114
|
P.startTime,
|
|
115
115
|
T
|
|
116
116
|
]);
|
|
117
|
-
let
|
|
117
|
+
let Y = f(() => new Map(K.map((e) => [s(e.productId, e.productVariantId), e])), [K]), Ve = () => {
|
|
118
118
|
Fe(ze);
|
|
119
119
|
};
|
|
120
120
|
if (!j) return /* @__PURE__ */ m("div", {
|
|
@@ -135,7 +135,7 @@ function C() {
|
|
|
135
135
|
children: /* @__PURE__ */ h(u, {
|
|
136
136
|
type: "button",
|
|
137
137
|
className: "gap-2",
|
|
138
|
-
onClick:
|
|
138
|
+
onClick: Ve,
|
|
139
139
|
children: [/* @__PURE__ */ m(v, {
|
|
140
140
|
className: "h-4 w-4",
|
|
141
141
|
"aria-hidden": "true"
|
|
@@ -145,13 +145,13 @@ function C() {
|
|
|
145
145
|
]
|
|
146
146
|
})
|
|
147
147
|
});
|
|
148
|
-
let
|
|
149
|
-
availabilityByKey:
|
|
148
|
+
let He = a(j.name, w.language, O), Ue = a(j.description, w.language, O), We = a(j.warning, w.language, O), Ge = typeof j.images?.[0] == "string" ? j.images[0].trim() : "", Ke = ve(j.primaryImageStyle), X = j.productVariants ?? [], Z = je(j, Y), Q = se({
|
|
149
|
+
availabilityByKey: Y,
|
|
150
150
|
fallbackStatus: Me(j),
|
|
151
151
|
productId: o(j),
|
|
152
|
-
productVariantIds:
|
|
152
|
+
productVariantIds: X.map((e) => e.id),
|
|
153
153
|
representedVariantId: j.representedVariantId
|
|
154
|
-
}),
|
|
154
|
+
}), qe = Z ? c(Z) === Q : !1, Je = Q === "OUT_OF_STOCK" ? X.map((e) => x(j, e.id, Y)).find((e) => oe(e) === "quantityUnavailable") : void 0, Ye = ie(Q), Xe = Be ? C("availability_checking") : S(C, qe ? Z : Je, Q), $ = Q === "OUT_OF_STOCK", Ze = X.some((e) => !!i(e, "size")) ? C("product_size_label") : C("product_variant_label"), Qe = !!H && F !== null;
|
|
155
155
|
return /* @__PURE__ */ m("div", {
|
|
156
156
|
className: "mx-auto max-w-7xl px-4 py-8 sm:px-6",
|
|
157
157
|
children: /* @__PURE__ */ h("div", {
|
|
@@ -162,7 +162,7 @@ function C() {
|
|
|
162
162
|
type: "button",
|
|
163
163
|
variant: "ghost",
|
|
164
164
|
className: "h-auto justify-start gap-2 self-start px-0 text-sm font-medium text-slate-700 hover:bg-transparent hover:text-slate-950",
|
|
165
|
-
onClick:
|
|
165
|
+
onClick: Ve,
|
|
166
166
|
children: [/* @__PURE__ */ m(v, {
|
|
167
167
|
className: "h-4 w-4",
|
|
168
168
|
"aria-hidden": "true"
|
|
@@ -184,11 +184,11 @@ function C() {
|
|
|
184
184
|
children: [/* @__PURE__ */ h("div", {
|
|
185
185
|
className: "lg:col-span-7",
|
|
186
186
|
children: [/* @__PURE__ */ m("div", {
|
|
187
|
-
className: _("relative aspect-[1618/1000] overflow-hidden rounded-2xl",
|
|
188
|
-
style:
|
|
189
|
-
children:
|
|
190
|
-
src:
|
|
191
|
-
alt:
|
|
187
|
+
className: _("relative aspect-[1618/1000] overflow-hidden rounded-2xl", Ke.className),
|
|
188
|
+
style: Ke.style,
|
|
189
|
+
children: Ge ? /* @__PURE__ */ m("img", {
|
|
190
|
+
src: Ge,
|
|
191
|
+
alt: He,
|
|
192
192
|
className: "absolute inset-0 h-full w-full object-contain p-2",
|
|
193
193
|
loading: "lazy"
|
|
194
194
|
}) : /* @__PURE__ */ m("div", {
|
|
@@ -204,8 +204,8 @@ function C() {
|
|
|
204
204
|
/* @__PURE__ */ h("div", {
|
|
205
205
|
className: "flex flex-wrap items-center gap-2",
|
|
206
206
|
children: [/* @__PURE__ */ m(l, {
|
|
207
|
-
variant:
|
|
208
|
-
children: /* @__PURE__ */ m("span", { children:
|
|
207
|
+
variant: Ye.variant,
|
|
208
|
+
children: /* @__PURE__ */ m("span", { children: Xe })
|
|
209
209
|
}), /* @__PURE__ */ m(_e, {
|
|
210
210
|
prices: j.prices,
|
|
211
211
|
openOnHover: j.kind !== "accessory"
|
|
@@ -213,11 +213,11 @@ function C() {
|
|
|
213
213
|
}),
|
|
214
214
|
/* @__PURE__ */ m("h1", {
|
|
215
215
|
className: "text-2xl font-semibold tracking-tight text-slate-950",
|
|
216
|
-
children: /* @__PURE__ */ m("span", { children:
|
|
216
|
+
children: /* @__PURE__ */ m("span", { children: He })
|
|
217
217
|
}),
|
|
218
218
|
/* @__PURE__ */ m("p", {
|
|
219
219
|
className: "text-sm text-slate-600",
|
|
220
|
-
children: /* @__PURE__ */ m("span", { children:
|
|
220
|
+
children: /* @__PURE__ */ m("span", { children: Ue })
|
|
221
221
|
}),
|
|
222
222
|
j.features?.length ? /* @__PURE__ */ h("div", {
|
|
223
223
|
className: "mt-2 space-y-2",
|
|
@@ -235,7 +235,7 @@ function C() {
|
|
|
235
235
|
}, `${j.id}-${t}`))
|
|
236
236
|
})]
|
|
237
237
|
}) : null,
|
|
238
|
-
/* @__PURE__ */ m(ge, { warning:
|
|
238
|
+
/* @__PURE__ */ m(ge, { warning: We })
|
|
239
239
|
]
|
|
240
240
|
})]
|
|
241
241
|
}), /* @__PURE__ */ m("div", {
|
|
@@ -259,17 +259,17 @@ function C() {
|
|
|
259
259
|
className: "text-sm text-destructive",
|
|
260
260
|
children: /* @__PURE__ */ m("span", { children: C("booking_time_slots_required") })
|
|
261
261
|
}),
|
|
262
|
-
|
|
262
|
+
X.length > 1 ? /* @__PURE__ */ h("div", {
|
|
263
263
|
className: "grid gap-2",
|
|
264
264
|
children: [/* @__PURE__ */ m("p", {
|
|
265
265
|
className: "text-xs font-medium text-slate-700",
|
|
266
|
-
children: /* @__PURE__ */ m("span", { children:
|
|
266
|
+
children: /* @__PURE__ */ m("span", { children: Ze })
|
|
267
267
|
}), /* @__PURE__ */ m(be, {
|
|
268
268
|
value: H ?? "",
|
|
269
269
|
onValueChange: U,
|
|
270
270
|
className: "grid gap-2",
|
|
271
|
-
children:
|
|
272
|
-
let t = `variant-${j.id}-${e.id}`.toLowerCase(), n = `storefront-product-variant-option-${j.id}-${e.id}`.toLowerCase(), { label: r, description: i } = ee(e), a = x(j, e.id,
|
|
271
|
+
children: X.map((e) => {
|
|
272
|
+
let t = `variant-${j.id}-${e.id}`.toLowerCase(), n = `storefront-product-variant-option-${j.id}-${e.id}`.toLowerCase(), { label: r, description: i } = ee(e), a = x(j, e.id, Y), te = a ? le(a) : $, o = a ? S(C, a, c(a)) : $ ? C("availability_out_of_stock") : null;
|
|
273
273
|
return /* @__PURE__ */ h("label", {
|
|
274
274
|
htmlFor: t,
|
|
275
275
|
"data-testid": n,
|
|
@@ -318,7 +318,7 @@ function C() {
|
|
|
318
318
|
/* @__PURE__ */ h(u, {
|
|
319
319
|
className: "h-11 rounded-xl text-sm font-semibold gap-2",
|
|
320
320
|
onClick: () => {
|
|
321
|
-
!H || !F ||
|
|
321
|
+
!H || !F || (Ie({
|
|
322
322
|
kind: j.kind,
|
|
323
323
|
productId: o(j),
|
|
324
324
|
...H ? { productVariantId: H } : {},
|
|
@@ -333,7 +333,7 @@ function C() {
|
|
|
333
333
|
})
|
|
334
334
|
})));
|
|
335
335
|
},
|
|
336
|
-
disabled: !
|
|
336
|
+
disabled: !Qe,
|
|
337
337
|
children: [/* @__PURE__ */ m("span", { children: C("add_to_cart") }), /* @__PURE__ */ m(ke, {
|
|
338
338
|
className: "h-4 w-4",
|
|
339
339
|
"aria-hidden": "true"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type CheckoutLoadingSkeletonProps = {
|
|
2
|
+
bookingPath: string;
|
|
3
|
+
checkoutPath: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function CheckoutLoadingSkeleton({ bookingPath, checkoutPath, }: CheckoutLoadingSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=CheckoutLoadingSkeleton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckoutLoadingSkeleton.d.ts","sourceRoot":"","sources":["../../../../src/pages/checkout/components/CheckoutLoadingSkeleton.tsx"],"names":[],"mappings":"AAMA,KAAK,4BAA4B,GAAG;IAClC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAMD,wBAAgB,uBAAuB,CAAC,EACtC,WAAW,EACX,YAAY,GACb,EAAE,4BAA4B,2CAuF9B"}
|