@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.
Files changed (68) hide show
  1. package/dist/StorefrontContext.d.ts +0 -2
  2. package/dist/StorefrontContext.d.ts.map +1 -1
  3. package/dist/StorefrontProvider.d.ts +0 -1
  4. package/dist/StorefrontProvider.d.ts.map +1 -1
  5. package/dist/chunks/pkg/booking-engine/dist/schemas/{base-booking-C9kJFMIu.js → base-booking-BJXFzDM5.js} +0 -2
  6. package/dist/chunks/pkg/booking-engine/dist/schemas/{cart-inputs-epi7FXIk.js → cart-inputs-3lBblkB0.js} +0 -10
  7. package/dist/chunks/pkg/booking-engine/dist/{schemas-DW5gdDYz.js → schemas-JjiUWFIv.js} +2 -2
  8. package/dist/chunks/pkg/ui/dist/LanguagePicker/index-D7_3voTe.js +83 -0
  9. package/dist/components/BookingBikeQuickAddCard/index.d.ts +3 -1
  10. package/dist/components/BookingBikeQuickAddCard/index.d.ts.map +1 -1
  11. package/dist/components/BookingBikeQuickAddCard/index.js +94 -85
  12. package/dist/components/BookingPeriodSelector/components/BookingEndDateField.js +1 -1
  13. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.js +1 -1
  14. package/dist/components/BookingPeriodSelector/components/BookingStartDateField.js +1 -1
  15. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.js +1 -1
  16. package/dist/components/ContractSaleDocument/InvoiceDetails.d.ts.map +1 -1
  17. package/dist/components/ContractSaleDocument/InvoiceDetails.js +62 -56
  18. package/dist/components/Footer/businessHoursStatus.js +1 -1
  19. package/dist/components/Header/index.d.ts.map +1 -1
  20. package/dist/components/Header/index.js +56 -56
  21. package/dist/components/LanguageSelector/index.d.ts.map +1 -1
  22. package/dist/components/LanguageSelector/index.js +19 -64
  23. package/dist/components/StorefrontCartPanel/index.js +1 -1
  24. package/dist/i18n/en.d.ts +2 -4
  25. package/dist/i18n/en.d.ts.map +1 -1
  26. package/dist/i18n/en.js +3 -5
  27. package/dist/i18n/fr.d.ts +2 -4
  28. package/dist/i18n/fr.d.ts.map +1 -1
  29. package/dist/i18n/fr.js +4 -6
  30. package/dist/index.d.ts +17 -35
  31. package/dist/index.js +3 -3
  32. package/dist/lib/booking-period.js +1 -1
  33. package/dist/lib/booking.d.ts +6 -6
  34. package/dist/lib/booking.d.ts.map +1 -1
  35. package/dist/lib/booking.js +21 -21
  36. package/dist/lib/cart.d.ts +1 -0
  37. package/dist/lib/cart.d.ts.map +1 -1
  38. package/dist/lib/cart.js +2 -0
  39. package/dist/lib/checkoutSubmit.d.ts +2 -6
  40. package/dist/lib/checkoutSubmit.d.ts.map +1 -1
  41. package/dist/lib/checkoutSubmit.js +3 -11
  42. package/dist/lib/pricing.js +1 -1
  43. package/dist/lib/storefrontAvailability.d.ts +12 -8
  44. package/dist/lib/storefrontAvailability.d.ts.map +1 -1
  45. package/dist/lib/storefrontAvailability.js +17 -7
  46. package/dist/pages/BookingPage.d.ts.map +1 -1
  47. package/dist/pages/BookingPage.js +236 -238
  48. package/dist/pages/CheckoutPage.d.ts.map +1 -1
  49. package/dist/pages/CheckoutPage.js +127 -125
  50. package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
  51. package/dist/pages/ContractSaleDocumentPage.js +117 -171
  52. package/dist/pages/HomePage.js +8 -8
  53. package/dist/pages/ProductPage.d.ts.map +1 -1
  54. package/dist/pages/ProductPage.js +187 -181
  55. package/dist/pages/checkout/components/CheckoutDetailsCard.d.ts.map +1 -1
  56. package/dist/pages/checkout/components/CheckoutDetailsCard.js +4 -17
  57. package/dist/pages/checkout/components/CheckoutLoadingSkeleton.d.ts +7 -0
  58. package/dist/pages/checkout/components/CheckoutLoadingSkeleton.d.ts.map +1 -0
  59. package/dist/pages/checkout/components/CheckoutLoadingSkeleton.js +105 -0
  60. package/dist/pages/checkout/types.d.ts +1 -2
  61. package/dist/pages/checkout/types.d.ts.map +1 -1
  62. package/dist/pages/checkout/types.js +1 -2
  63. package/dist/storefront.css +1 -1
  64. package/dist/storefrontSchemas.d.ts +0 -2
  65. package/dist/storefrontSchemas.d.ts.map +1 -1
  66. package/dist/storefrontSchemas.js +1 -2
  67. package/package.json +1 -1
  68. 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 n } from "../lib/toast.js";
5
- import { Card as r } from "../ui/card.js";
6
- import { ContractSaleDocument as i } from "../components/ContractSaleDocument/Invoice.js";
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 a, apiPost as o } from "../lib/apiCall.js";
9
- import { Spinner as s } from "../chunks/pkg/ui/dist/Spinner/index-Cgi70z_E.js";
10
- import { resolveContractSaleDocumentRequestLanguage as c } from "../lib/contractSaleDocument.js";
11
- 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";
12
- import { useEffect as h, useState as g } from "react";
13
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
14
- import { Link as y, useLoaderData as b, useLocation as x, useNavigate as S } from "@rpcbase/router";
15
- import { useTranslation as C } from "react-i18next";
16
- import { cn as w } from "@rpcbase/ui";
17
- import { ArrowLeft as T, ChevronDown as E, Download as D } from "lucide-react";
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) => c(new URLSearchParams(e).get("lang")), j = (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) => `${u}?${new URLSearchParams({
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__ */ _(s, {
53
+ }, I = (e) => /* @__PURE__ */ y(l, {
54
54
  className: "size-4",
55
55
  "aria-hidden": "true",
56
56
  "data-testid": e
57
- }), L = [{
58
- code: "fr",
59
- labelKey: "docs_contract_sale_language_option_fr"
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: o,
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 a(d, {
69
+ let t = await s(p, {
132
70
  storeSlug: r,
133
71
  referenceId: i,
134
- saleDocumentId: o,
72
+ saleDocumentId: a,
135
73
  ...l ? { lang: l } : {}
136
- }, e), n = m.parse(t);
74
+ }, e), n = g.parse(t);
137
75
  return !n.success || !n.document ? {
138
76
  storeSlug: r,
139
77
  referenceId: i,
140
- saleDocumentId: o,
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: o,
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: o,
96
+ saleDocumentId: a,
159
97
  pdfMode: c,
160
98
  documentLanguage: l,
161
99
  document: null,
162
100
  error: null
163
101
  };
164
102
  }
165
- }), V = (e) => {
166
- let t = p.safeParse(e);
103
+ }), R = (e) => {
104
+ let t = h.safeParse(e);
167
105
  return t.success ? t.data : null;
168
106
  };
169
- function H() {
170
- 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) ?? e(R?.language?.customer) ?? c.documentLanguage ?? e(s.language) ?? "fr", Y = p && m && w ? N(p, m, w, J) : null, X = p && m && w ? P(p, m, w, J) : "";
171
- h(() => {
172
- B(V(c.document)), q(c.error);
173
- }, [c.document, c.error]), h(() => {
174
- e(s.language) !== J && s.changeLanguage(J);
175
- }, [s, J]);
176
- let Z = (e) => {
177
- if (e === J) return;
178
- s.changeLanguage(e);
179
- let t = new URLSearchParams(u.search);
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
- d(`${u.pathname}${n ? `?${n}` : ""}${u.hash || ""}`, { replace: !0 });
120
+ p(`${f.pathname}${n ? `?${n}` : ""}${f.hash || ""}`, { replace: !0 });
183
121
  };
184
- if (!R) return /* @__PURE__ */ _("div", {
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__ */ _(r, {
124
+ children: /* @__PURE__ */ y(a, {
187
125
  className: "border-slate-200 bg-white p-5 shadow-sm sm:p-6",
188
- children: /* @__PURE__ */ v("div", {
126
+ children: /* @__PURE__ */ b("div", {
189
127
  className: "space-y-4",
190
128
  children: [
191
- /* @__PURE__ */ _("h1", {
129
+ /* @__PURE__ */ y("h1", {
192
130
  className: "text-lg font-semibold text-slate-950",
193
- children: /* @__PURE__ */ _("span", { children: a("docs_contract_sale_not_found_title") })
131
+ children: /* @__PURE__ */ y("span", { children: s("docs_contract_sale_not_found_title") })
194
132
  }),
195
- /* @__PURE__ */ _("p", {
133
+ /* @__PURE__ */ y("p", {
196
134
  className: "text-sm text-destructive",
197
- children: /* @__PURE__ */ _("span", { children: K ?? a("docs_contract_sale_load_error") })
135
+ children: /* @__PURE__ */ y("span", { children: J ?? s("docs_contract_sale_load_error") })
198
136
  }),
199
- /* @__PURE__ */ _(y, {
200
- to: M,
137
+ /* @__PURE__ */ y(x, {
138
+ to: B,
201
139
  "data-testid": "contract-sale-document-back-link",
202
- children: /* @__PURE__ */ v(t, {
140
+ children: /* @__PURE__ */ b(t, {
203
141
  className: "gap-2",
204
- children: [/* @__PURE__ */ _(T, {
142
+ children: [/* @__PURE__ */ y(D, {
205
143
  className: "h-4 w-4",
206
144
  "aria-hidden": "true"
207
- }), /* @__PURE__ */ _("span", { children: L })]
145
+ }), /* @__PURE__ */ y("span", { children: V })]
208
146
  })
209
147
  })
210
148
  ]
211
149
  })
212
150
  })
213
151
  });
214
- if (E) return /* @__PURE__ */ _("div", {
152
+ if (L) return /* @__PURE__ */ y("div", {
215
153
  className: "min-h-screen bg-white",
216
- children: /* @__PURE__ */ _(i, {
217
- data: R,
154
+ children: /* @__PURE__ */ y(o, {
155
+ data: H,
218
156
  renderMode: "pdf",
219
- publicDocumentUrl: X
157
+ publicDocumentUrl: Q
220
158
  })
221
159
  });
222
- let Q = async () => {
223
- if (!Y || W) return;
224
- G(!0);
225
- let e = n.loading(a("docs_contract_sale_preparing_pdf"), { icon: I() });
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(Y, {
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 r = await t.blob(), i = window.URL.createObjectURL(r), a = window.document.createElement("a");
233
- 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(() => {
234
- window.URL.revokeObjectURL(i);
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), n.dismiss(e), n.error(a("docs_contract_sale_download_pdf_error"));
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
- G(!1);
177
+ q(!1);
240
178
  }
241
179
  };
242
- return /* @__PURE__ */ v("div", {
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__ */ v("div", {
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__ */ v(y, {
247
- to: M,
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__ */ _(T, {
188
+ children: [/* @__PURE__ */ y(D, {
251
189
  className: "h-4 w-4",
252
190
  "aria-hidden": "true"
253
- }), /* @__PURE__ */ _("span", { children: L })]
254
- }), /* @__PURE__ */ v("div", {
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
- K ? /* @__PURE__ */ _("span", {
195
+ J ? /* @__PURE__ */ y("span", {
258
196
  className: "max-w-[min(44vw,24rem)] truncate text-right text-sm text-destructive",
259
- children: K
260
- }) : H === "signature" ? /* @__PURE__ */ _("span", {
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: a("docs_contract_sale_submitting_signature")
263
- }) : H === "acceptance" ? /* @__PURE__ */ _("span", {
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: a("docs_contract_sale_submitting_acceptance")
203
+ children: s("docs_contract_sale_submitting_acceptance")
266
204
  }) : null,
267
- /* @__PURE__ */ _(z, {
268
- selectedLanguage: J,
269
- onChange: Z
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
- Y ? /* @__PURE__ */ v(t, {
217
+ Z ? /* @__PURE__ */ b(t, {
272
218
  variant: "outline",
273
219
  size: "sm",
274
220
  type: "button",
275
- disabled: W,
221
+ disabled: K,
276
222
  onClick: () => {
277
- Q();
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
- W ? I("contract-sale-document-download-spinner") : /* @__PURE__ */ _(D, {
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__ */ _("span", {
232
+ /* @__PURE__ */ y("span", {
287
233
  className: "hidden sm:inline",
288
- children: a("docs_contract_sale_download_pdf")
234
+ children: s("docs_contract_sale_download_pdf")
289
235
  }),
290
- /* @__PURE__ */ _("span", {
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__ */ _("div", {
244
+ }), /* @__PURE__ */ y("div", {
299
245
  className: "min-h-0 flex-1",
300
- children: /* @__PURE__ */ _(i, {
301
- data: R,
246
+ children: /* @__PURE__ */ y(o, {
247
+ data: H,
302
248
  heightMode: "parent",
303
- publicDocumentUrl: X,
249
+ publicDocumentUrl: Q,
304
250
  onAccept: async (e) => {
305
- let t = e.mode === "signature" ? a("docs_contract_sale_signature_submit_error") : a("docs_contract_sale_acceptance_submit_error");
306
- if (!p || !m || !w) throw Error(t);
307
- U(e.mode);
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 o(l, {
310
- storeSlug: p,
311
- referenceId: m,
312
- saleDocumentId: w,
313
- lang: J,
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 = f.parse(n);
266
+ }), r = m.parse(n);
321
267
  if (!r.success) {
322
268
  let e = r.message ?? t;
323
- if (r.document) return B(r.document), q(e), r.document;
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 B(r.document), q(null), r.document;
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 q(n), Error(n);
277
+ throw Y(n), Error(n);
332
278
  } finally {
333
- U(null);
279
+ G(null);
334
280
  }
335
281
  }
336
282
  })
@@ -338,4 +284,4 @@ function H() {
338
284
  });
339
285
  }
340
286
  //#endregion
341
- export { H as default, B as loader, j as resolveContractSaleDocumentBackLink };
287
+ export { z as default, L as loader, j as resolveContractSaleDocumentBackLink };
@@ -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.start_date), [F.start_date]), pt = f(() => E(F.end_date) ?? I, [F.end_date, 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.start_time), [V, yt] = m(() => {
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.end_time), [xt, St] = m(void 0), Ct = p(void 0), [wt, Tt] = m(!1), [U, W] = m(() => ht.start_address), [G, K] = m(() => ht.end_address), q = p(null), Et = (e) => {
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
- start_date: T(e),
170
- start_time: Y ? B : "",
171
- end_date: T(n),
172
- end_time: Y ? H : "",
173
- start_address: U,
174
- end_address: G
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":"AAgIA,MAAM,CAAC,OAAO,UAAU,WAAW,4CAyXlC"}
1
+ {"version":3,"file":"ProductPage.d.ts","sourceRoot":"","sources":["../../src/pages/ProductPage.tsx"],"names":[],"mappings":"AAiIA,MAAM,CAAC,OAAO,UAAU,WAAW,4CAuYlC"}