@loczer/storefront-sdk 0.230.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/StorefrontContext.d.ts +0 -2
- package/dist/StorefrontContext.d.ts.map +1 -1
- package/dist/StorefrontProvider.d.ts +0 -1
- package/dist/StorefrontProvider.d.ts.map +1 -1
- package/dist/chunks/pkg/booking-engine/dist/schemas/{base-booking-C9kJFMIu.js → base-booking-BJXFzDM5.js} +0 -2
- package/dist/chunks/pkg/booking-engine/dist/schemas/{cart-inputs-epi7FXIk.js → cart-inputs-3lBblkB0.js} +0 -10
- package/dist/chunks/pkg/booking-engine/dist/{schemas-DW5gdDYz.js → schemas-JjiUWFIv.js} +2 -2
- package/dist/chunks/pkg/ui/dist/LanguagePicker/index-D7_3voTe.js +83 -0
- package/dist/components/BookingBikeQuickAddCard/index.d.ts +3 -1
- package/dist/components/BookingBikeQuickAddCard/index.d.ts.map +1 -1
- package/dist/components/BookingBikeQuickAddCard/index.js +94 -85
- 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/Footer/businessHoursStatus.js +1 -1
- 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/components/StorefrontCartPanel/index.js +1 -1
- package/dist/i18n/en.d.ts +2 -4
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +3 -5
- package/dist/i18n/fr.d.ts +2 -4
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +4 -6
- package/dist/index.d.ts +17 -35
- package/dist/index.js +3 -3
- package/dist/lib/booking-period.js +1 -1
- package/dist/lib/booking.d.ts +6 -6
- package/dist/lib/booking.d.ts.map +1 -1
- package/dist/lib/booking.js +21 -21
- 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/lib/checkoutSubmit.d.ts +2 -6
- package/dist/lib/checkoutSubmit.d.ts.map +1 -1
- package/dist/lib/checkoutSubmit.js +3 -11
- package/dist/lib/pricing.js +1 -1
- package/dist/lib/storefrontAvailability.d.ts +12 -8
- package/dist/lib/storefrontAvailability.d.ts.map +1 -1
- package/dist/lib/storefrontAvailability.js +17 -7
- package/dist/pages/BookingPage.d.ts.map +1 -1
- package/dist/pages/BookingPage.js +236 -238
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +127 -125
- package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
- package/dist/pages/ContractSaleDocumentPage.js +117 -171
- package/dist/pages/HomePage.js +8 -8
- package/dist/pages/ProductPage.d.ts.map +1 -1
- package/dist/pages/ProductPage.js +187 -181
- package/dist/pages/checkout/components/CheckoutDetailsCard.d.ts.map +1 -1
- package/dist/pages/checkout/components/CheckoutDetailsCard.js +4 -17
- 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/pages/checkout/types.d.ts +1 -2
- package/dist/pages/checkout/types.d.ts.map +1 -1
- package/dist/pages/checkout/types.js +1 -2
- package/dist/storefront.css +1 -1
- package/dist/storefrontSchemas.d.ts +0 -2
- package/dist/storefrontSchemas.d.ts.map +1 -1
- package/dist/storefrontSchemas.js +1 -2
- 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 };
|
package/dist/pages/HomePage.js
CHANGED
|
@@ -134,10 +134,10 @@ function D() {
|
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
let j = te(w.shop), { bikes: M, accessories: ct } = ce(), [N, lt] = Be(), ut = N.get(Ye) === "true", dt = Re(), P = f(() => a(N, S), [N, S]), ft = f(() => n(w), [w]), F = f(() => i(w), [w]), I = f(() => E(F.
|
|
137
|
+
let j = te(w.shop), { bikes: M, accessories: ct } = ce(), [N, lt] = Be(), ut = N.get(Ye) === "true", dt = Re(), P = f(() => a(N, S), [N, S]), ft = f(() => n(w), [w]), F = f(() => i(w), [w]), I = f(() => E(F.startDate), [F.startDate]), pt = f(() => E(F.endDate) ?? I, [F.endDate, I]), L = w.settings.fulfillmentModes.includes("delivery"), mt = w.settings.deliveryDisabledReason.trim(), ht = f(() => r(P, F), [F, P]), [R, gt] = m(() => ht.fulfillment === "delivery" && L ? "delivery" : "pickup"), [z, _t] = m(() => E(P.get("start_date")) ?? I), [B, vt] = m(() => P.get("start_time") ?? F.startTime), [V, yt] = m(() => {
|
|
138
138
|
let e = E(P.get("start_date")) ?? I;
|
|
139
139
|
return E(P.get("end_date")) ?? e ?? pt;
|
|
140
|
-
}), [H, bt] = m(() => P.get("end_time") ?? F.
|
|
140
|
+
}), [H, bt] = m(() => P.get("end_time") ?? F.endTime), [xt, St] = m(void 0), Ct = p(void 0), [wt, Tt] = m(!1), [U, W] = m(() => ht.startAddress), [G, K] = m(() => ht.endAddress), q = p(null), Et = (e) => {
|
|
141
141
|
let t = new URLSearchParams(N);
|
|
142
142
|
e ? t.set(Ye, "true") : t.delete(Ye), lt(t, { replace: !0 });
|
|
143
143
|
}, J = [
|
|
@@ -166,12 +166,12 @@ function D() {
|
|
|
166
166
|
let e = z ?? I ?? /* @__PURE__ */ new Date(), n = V ?? e;
|
|
167
167
|
return t(new URLSearchParams(), {
|
|
168
168
|
fulfillment: R === "delivery" && L ? "delivery" : "pickup",
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
169
|
+
startDate: T(e),
|
|
170
|
+
startTime: Y ? B : "",
|
|
171
|
+
endDate: T(n),
|
|
172
|
+
endTime: Y ? H : "",
|
|
173
|
+
startAddress: U,
|
|
174
|
+
endAddress: G
|
|
175
175
|
});
|
|
176
176
|
}, [
|
|
177
177
|
I,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductPage.d.ts","sourceRoot":"","sources":["../../src/pages/ProductPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProductPage.d.ts","sourceRoot":"","sources":["../../src/pages/ProductPage.tsx"],"names":[],"mappings":"AAiIA,MAAM,CAAC,OAAO,UAAU,WAAW,4CAuYlC"}
|