@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.
Files changed (39) hide show
  1. package/dist/chunks/pkg/ui/dist/LanguagePicker/index-D7_3voTe.js +83 -0
  2. package/dist/components/BookingBikeQuickAddCard/index.d.ts.map +1 -1
  3. package/dist/components/BookingBikeQuickAddCard/index.js +0 -3
  4. package/dist/components/BookingBikeVariantDialog/index.d.ts.map +1 -1
  5. package/dist/components/BookingBikeVariantDialog/index.js +7 -9
  6. package/dist/components/BookingPeriodSelector/components/BookingEndDateField.js +1 -1
  7. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.js +1 -1
  8. package/dist/components/BookingPeriodSelector/components/BookingStartDateField.js +1 -1
  9. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.js +1 -1
  10. package/dist/components/ContractSaleDocument/InvoiceDetails.d.ts.map +1 -1
  11. package/dist/components/ContractSaleDocument/InvoiceDetails.js +62 -56
  12. package/dist/components/Header/index.d.ts.map +1 -1
  13. package/dist/components/Header/index.js +56 -56
  14. package/dist/components/LanguageSelector/index.d.ts.map +1 -1
  15. package/dist/components/LanguageSelector/index.js +19 -64
  16. package/dist/i18n/en.d.ts +2 -0
  17. package/dist/i18n/en.d.ts.map +1 -1
  18. package/dist/i18n/en.js +3 -1
  19. package/dist/i18n/fr.d.ts +2 -0
  20. package/dist/i18n/fr.d.ts.map +1 -1
  21. package/dist/i18n/fr.js +3 -1
  22. package/dist/index.d.ts +5 -0
  23. package/dist/lib/cart.d.ts +1 -0
  24. package/dist/lib/cart.d.ts.map +1 -1
  25. package/dist/lib/cart.js +2 -0
  26. package/dist/pages/BookingPage.d.ts.map +1 -1
  27. package/dist/pages/BookingPage.js +292 -292
  28. package/dist/pages/CheckoutPage.d.ts.map +1 -1
  29. package/dist/pages/CheckoutPage.js +107 -103
  30. package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
  31. package/dist/pages/ContractSaleDocumentPage.js +117 -171
  32. package/dist/pages/ProductPage.d.ts.map +1 -1
  33. package/dist/pages/ProductPage.js +31 -31
  34. package/dist/pages/checkout/components/CheckoutLoadingSkeleton.d.ts +7 -0
  35. package/dist/pages/checkout/components/CheckoutLoadingSkeleton.d.ts.map +1 -0
  36. package/dist/pages/checkout/components/CheckoutLoadingSkeleton.js +105 -0
  37. package/dist/storefront.css +1 -1
  38. package/package.json +1 -1
  39. 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 };
@@ -1 +1 @@
1
- {"version":3,"file":"ProductPage.d.ts","sourceRoot":"","sources":["../../src/pages/ProductPage.tsx"],"names":[],"mappings":"AAiIA,MAAM,CAAC,OAAO,UAAU,WAAW,4CA6YlC"}
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 se, getStorefrontProductAvailabilityStatus as ce, getValidStorefrontAvailabilitySchedule as le, isStorefrontAvailabilityInsufficient as c, responseSchema as ue } from "../lib/storefrontAvailability.js";
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(() => le(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]), [Be, K] = p([]), [Ve, q] = p(!1);
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
- K([]), q(!1);
82
+ q([]), J(!1);
83
83
  return;
84
84
  }
85
85
  if (!F) {
86
- K([]), q(!1);
86
+ q([]), J(!1);
87
87
  return;
88
88
  }
89
89
  let e = !1;
90
- return q(!0), K([]), (async () => {
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
- K(n.success ? n.availability ?? [] : []);
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), K([]);
101
+ console.error("Failed to load storefront product availability", t), q([]);
102
102
  } finally {
103
- e || q(!1);
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 J = f(() => new Map(Be.map((e) => [s(e.productId, e.productVariantId), e])), [Be]), He = () => {
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: He,
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 Ue = a(j.name, w.language, O), We = a(j.description, w.language, O), Ge = a(j.warning, w.language, O), Ke = typeof j.images?.[0] == "string" ? j.images[0].trim() : "", qe = ve(j.primaryImageStyle), Y = j.productVariants ?? [], X = je(j, J), Z = ce({
149
- availabilityByKey: J,
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: Y.map((e) => e.id),
152
+ productVariantIds: X.map((e) => e.id),
153
153
  representedVariantId: j.representedVariantId
154
- }), Je = X ? se(X) === Z : !1, Ye = Z === "OUT_OF_STOCK" ? Y.map((e) => x(j, e.id, J)).find((e) => oe(e) === "quantityUnavailable") : void 0, Xe = ie(Z), Ze = Ve ? C("availability_checking") : S(C, Je ? X : Ye, Z), Q = Z === "OUT_OF_STOCK", Qe = Y.some((e) => !!i(e, "size")) ? C("product_size_label") : C("product_variant_label"), $e = H ? x(j, H, J) : void 0, $ = $e ? c($e) : Q, et = !!H && F !== null && !$;
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: He,
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", qe.className),
188
- style: qe.style,
189
- children: Ke ? /* @__PURE__ */ m("img", {
190
- src: Ke,
191
- alt: Ue,
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: Xe.variant,
208
- children: /* @__PURE__ */ m("span", { children: Ze })
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: Ue })
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: We })
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: Ge })
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
- Y.length > 1 ? /* @__PURE__ */ h("div", {
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: Qe })
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: Y.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, J), te = a ? c(a) : Q, o = a ? S(C, a, se(a)) : Q ? C("availability_out_of_stock") : null;
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 || $ || (Ie({
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: !et,
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"}