@loczer/storefront-sdk 0.241.0 → 0.243.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 (33) hide show
  1. package/dist/chunks/pkg/booking-engine/dist/models/{Product.shared-VisFafx-.js → Product.shared-JIXwUVrg.js} +1 -1
  2. package/dist/chunks/pkg/booking-engine/dist/schemas/{base-asset-BuqI-BM_.js → base-asset-DtBfhenO.js} +1 -1
  3. package/dist/chunks/pkg/booking-engine/dist/schemas/{base-booking-gCY-ZP5p.js → base-booking-D9S-zS-D.js} +2 -2
  4. package/dist/chunks/pkg/booking-engine/dist/schemas/{base-product-r04ZJglB.js → base-product-Dj-bv0QD.js} +1 -1
  5. package/dist/chunks/pkg/booking-engine/dist/schemas/{cart-inputs-ps94yuAR.js → cart-inputs-CIeuiTzp.js} +1 -1
  6. package/dist/chunks/pkg/booking-engine/dist/schemas/{insurance-XwIj1m3Z.js → insurance-v2GZHSVq.js} +1 -1
  7. package/dist/chunks/pkg/booking-engine/dist/{schemas-7yx45S2o.js → schemas-B82mPOxs.js} +6 -6
  8. package/dist/components/Footer/businessHoursStatus.js +1 -1
  9. package/dist/i18n/en.d.ts +1 -0
  10. package/dist/i18n/en.d.ts.map +1 -1
  11. package/dist/i18n/en.js +2 -1
  12. package/dist/i18n/fr.d.ts +1 -0
  13. package/dist/i18n/fr.d.ts.map +1 -1
  14. package/dist/i18n/fr.js +2 -1
  15. package/dist/index.d.ts +2 -0
  16. package/dist/index.js +6 -6
  17. package/dist/lib/booking-period.js +1 -1
  18. package/dist/lib/booking.js +2 -2
  19. package/dist/lib/checkoutSubmit.d.ts +4 -0
  20. package/dist/lib/checkoutSubmit.d.ts.map +1 -1
  21. package/dist/lib/checkoutSubmit.js +19 -11
  22. package/dist/pages/CheckoutPage.d.ts.map +1 -1
  23. package/dist/pages/CheckoutPage.js +199 -199
  24. package/dist/pages/CheckoutPaymentPage.d.ts.map +1 -1
  25. package/dist/pages/CheckoutPaymentPage.js +168 -167
  26. package/dist/pages/CheckoutSuccessPage.d.ts.map +1 -1
  27. package/dist/pages/CheckoutSuccessPage.js +37 -25
  28. package/dist/storefront.css +1 -1
  29. package/dist/storefrontSchemas.js +1 -1
  30. package/dist/ui/drawer.d.ts +12 -13
  31. package/dist/ui/drawer.d.ts.map +1 -1
  32. package/dist/ui/drawer.js +119 -143
  33. package/package.json +1 -1
@@ -1,28 +1,29 @@
1
1
  import { pickBookingSearchParams as e } from "../lib/booking.js";
2
2
  import { useStorefrontCart as t } from "../lib/cart.js";
3
- import { Button as n } from "../ui/button.js";
4
- import { toast as r } from "../lib/toast.js";
5
- import { Card as i } from "../ui/card.js";
6
- import { apiPost as a } from "../lib/apiCall.js";
7
- import { Spinner as o } from "../chunks/pkg/ui/dist/Spinner/index-Cgi70z_E.js";
8
- import { ROUTE as ee, responseSchema as te } from "../lib/checkoutPaymentSession.js";
9
- import { MollieCardFieldsForm as ne } from "../components/payment/MollieCardFieldsForm.js";
10
- import { StripeCardFieldsForm as s } from "../components/payment/StripeCardFieldsForm.js";
3
+ import { CHECKOUT_BOOKING_NUMBER_SEARCH_PARAM as n, addCheckoutBookingNumberToPath as r, getCheckoutBookingNumberFromSearchParams as i } from "../lib/checkoutSubmit.js";
4
+ import { Button as a } from "../ui/button.js";
5
+ import { toast as o } from "../lib/toast.js";
6
+ import { Card as s } from "../ui/card.js";
7
+ import { apiPost as ee } from "../lib/apiCall.js";
8
+ import { Spinner as c } from "../chunks/pkg/ui/dist/Spinner/index-Cgi70z_E.js";
9
+ import { ROUTE as te, responseSchema as ne } from "../lib/checkoutPaymentSession.js";
10
+ import { MollieCardFieldsForm as re } from "../components/payment/MollieCardFieldsForm.js";
11
+ import { StripeCardFieldsForm as l } from "../components/payment/StripeCardFieldsForm.js";
11
12
  import "../components/payment/index.js";
12
- import { useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
13
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
14
- import { Link as m, useNavigate as h, useParams as re, useSearchParams as ie } from "@rpcbase/router";
15
- import { useTranslation as g } from "react-i18next";
16
- import { AlertTriangle as _, ArrowRight as ae, CheckCircle2 as oe, CircleDashed as v, ShieldCheck as se, XCircle as ce } from "lucide-react";
17
- import { loadStripe as le } from "@stripe/stripe-js";
18
- import { Elements as ue, useStripe as y } from "@stripe/react-stripe-js";
19
- var de = {
13
+ import { useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
14
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
15
+ import { Link as g, useNavigate as ie, useParams as ae, useSearchParams as oe } from "@rpcbase/router";
16
+ import { useTranslation as _ } from "react-i18next";
17
+ import { AlertTriangle as v, ArrowRight as se, CheckCircle2 as ce, CircleDashed as le, ShieldCheck as ue, XCircle as de } from "lucide-react";
18
+ import { loadStripe as fe } from "@stripe/stripe-js";
19
+ import { Elements as pe, useStripe as y } from "@stripe/react-stripe-js";
20
+ var me = {
20
21
  BASE_URL: "/",
21
22
  DEV: !1,
22
23
  MODE: "production",
23
24
  PROD: !0,
24
25
  SSR: !1
25
- }.RB_PUBLIC_STRIPE_PUBLISHABLE_KEY?.trim() ?? "", fe = 20, pe = 2500, b = (e, t, n) => {
26
+ }.RB_PUBLIC_STRIPE_PUBLISHABLE_KEY?.trim() ?? "", he = 20, b = 2500, x = (e, t, n) => {
26
27
  try {
27
28
  return new Intl.NumberFormat(n, {
28
29
  style: "currency",
@@ -32,9 +33,9 @@ var de = {
32
33
  return `${(e / 100).toFixed(2)} ${t.toUpperCase()}`;
33
34
  }
34
35
  };
35
- function x({ clientSecret: e, onSuccess: t }) {
36
- let { t: n } = g(), r = y();
37
- return /* @__PURE__ */ f(s, {
36
+ function ge({ clientSecret: e, onSuccess: t }) {
37
+ let { t: n } = _(), r = y();
38
+ return /* @__PURE__ */ m(l, {
38
39
  requireEmail: !1,
39
40
  submitLabel: n("checkout_payment_authorize_button"),
40
41
  submittingLabel: n("checkout_payment_authorizing_button"),
@@ -48,313 +49,313 @@ function x({ clientSecret: e, onSuccess: t }) {
48
49
  }
49
50
  });
50
51
  }
51
- function S() {
52
- let { t: e } = g();
53
- return /* @__PURE__ */ p("div", {
52
+ function _e() {
53
+ let { t: e } = _();
54
+ return /* @__PURE__ */ h("div", {
54
55
  className: "flex min-h-48 items-center justify-center gap-2 text-sm text-slate-600",
55
- children: [/* @__PURE__ */ f(o, {
56
+ children: [/* @__PURE__ */ m(c, {
56
57
  className: "size-4",
57
58
  "aria-hidden": "true"
58
- }), /* @__PURE__ */ f("span", { children: e("secure_payment_link.form.loading_session") })]
59
+ }), /* @__PURE__ */ m("span", { children: e("secure_payment_link.form.loading_session") })]
59
60
  });
60
61
  }
61
- function C() {
62
- let { t: s, i18n: y } = g(), { storeSlug: C } = re(), w = h(), { clear: T, clearCheckoutSession: E } = t(), [D] = ie(), [O, k] = d(null), [A, j] = d(!0), [M, N] = d(null), [P, F] = d(0), [I, L] = d(0), R = u(!1), z = u(null), B = D.get("checkout_session_id")?.trim() ?? "", V = new URLSearchParams(D.toString());
63
- V.delete("checkout_session_id");
64
- let H = e(V).toString(), U = `/${C ?? ""}/checkout${H ? `?${H}` : ""}`, W = `/${C ?? ""}/checkout/success${H ? `?${H}` : ""}`, G = async (e) => {
65
- if (!C || !B) throw Error(s("checkout_payment_return_missing_session"));
66
- let t = await a(ee, {
67
- storeSlug: C,
68
- checkoutSessionId: B,
62
+ function S() {
63
+ let { t: l, i18n: y } = _(), { storeSlug: S } = ae(), C = ie(), { clear: w, clearCheckoutSession: T } = t(), [E] = oe(), [D, O] = p(null), [ve, k] = p(!0), [A, j] = p(null), [ye, M] = p(0), [N, P] = p(0), F = f(!1), I = f(null), L = E.get("checkout_session_id")?.trim() ?? "", R = e(E), z = R.toString(), B = i(E), V = new URLSearchParams(R);
64
+ B && V.set(n, B);
65
+ let H = V.toString(), U = `/${S ?? ""}/checkout${z ? `?${z}` : ""}`, W = `/${S ?? ""}/checkout/success${H ? `?${H}` : ""}`, G = async (e) => {
66
+ if (!S || !L) throw Error(l("checkout_payment_return_missing_session"));
67
+ let t = await ee(te, {
68
+ storeSlug: S,
69
+ checkoutSessionId: L,
69
70
  returnSearch: H || void 0,
70
71
  cardToken: e
71
72
  });
72
- return te.parse(t);
73
- }, K = async () => {
74
- R.current || (R.current = !0, r.success(s("checkout_success_toast")), await w(W, { replace: !0 }), T());
73
+ return ne.parse(t);
74
+ }, K = async (e) => {
75
+ F.current || (F.current = !0, o.success(l("checkout_success_toast")), await C(r(W, e?.payment?.reference), { replace: !0 }), w());
75
76
  };
76
- c(() => {
77
- R.current = !1, z.current = null, k(null), j(!0), L(0);
78
- }, [B]), c(() => {
79
- if (!C || !B) {
80
- z.current = null, k(null), N(s("checkout_payment_return_missing_session")), j(!1);
77
+ u(() => {
78
+ F.current = !1, I.current = null, O(null), k(!0), P(0);
79
+ }, [L]), u(() => {
80
+ if (!S || !L) {
81
+ I.current = null, O(null), j(l("checkout_payment_return_missing_session")), k(!1);
81
82
  return;
82
83
  }
83
- let e = !1, t = z.current === null;
84
- return j(t), N(null), (async () => {
84
+ let e = !1, t = I.current === null;
85
+ return k(t), j(null), (async () => {
85
86
  try {
86
87
  let t = await G();
87
88
  if (e) return;
88
89
  if (!t.success) {
89
- t.canRetryCheckout && E(), z.current = null, k(null), N(t.message || s("checkout_payment_return_status_error"));
90
+ t.canRetryCheckout && T(), I.current = null, O(null), j(t.message || l("checkout_payment_return_status_error"));
90
91
  return;
91
92
  }
92
- z.current = t, k(t);
93
+ I.current = t, O(t);
93
94
  let n = t.paymentStatus;
94
- (n === "cancelled" || n === "failed" && t.providerType === "mollie_connect_oauth") && E(), (n === "authorized" || n === "succeeded") && !R.current && await K();
95
+ (n === "cancelled" || n === "failed" && t.providerType === "mollie_connect_oauth") && T(), (n === "authorized" || n === "succeeded") && !F.current && await K(t);
95
96
  } catch (t) {
96
97
  if (e) return;
97
- console.error("Failed to fetch checkout payment session", t), z.current = null, k(null), N(s("checkout_payment_return_status_error"));
98
+ console.error("Failed to fetch checkout payment session", t), I.current = null, O(null), j(l("checkout_payment_return_status_error"));
98
99
  } finally {
99
- !e && t && j(!1);
100
+ !e && t && k(!1);
100
101
  }
101
102
  })(), () => {
102
103
  e = !0;
103
104
  };
104
105
  }, [
105
- B,
106
- T,
107
- E,
106
+ L,
108
107
  w,
109
- H,
110
- P,
108
+ T,
111
109
  C,
110
+ ye,
111
+ H,
112
+ S,
112
113
  W,
113
- s
114
+ l
114
115
  ]);
115
- let q = O?.paymentStatus ?? "pending", J = q === "pending" && O?.providerType === "stripe_connect_oauth" && O.payment?.status.trim().toLowerCase() === "processing";
116
- c(() => {
117
- if (q !== "pending" || O?.providerType === "stripe_connect_oauth" && !J || I >= fe || !O?.payment?.providerPaymentId) return;
116
+ let q = D?.paymentStatus ?? "pending", J = q === "pending" && D?.providerType === "stripe_connect_oauth" && D.payment?.status.trim().toLowerCase() === "processing";
117
+ u(() => {
118
+ if (q !== "pending" || D?.providerType === "stripe_connect_oauth" && !J || N >= he || !D?.payment?.providerPaymentId) return;
118
119
  let e = window.setTimeout(() => {
119
- L((e) => e + 1), F((e) => e + 1);
120
- }, pe);
120
+ P((e) => e + 1), M((e) => e + 1);
121
+ }, b);
121
122
  return () => {
122
123
  window.clearTimeout(e);
123
124
  };
124
125
  }, [
125
126
  q,
126
- I,
127
- O?.payment?.providerPaymentId,
128
- O?.providerType,
127
+ N,
128
+ D?.payment?.providerPaymentId,
129
+ D?.providerType,
129
130
  J
130
131
  ]);
131
- let Y = l(() => {
132
- let e = O?.stripePublishableKey?.trim() || de;
133
- return !e || !O?.providerAccountId ? null : le(e, { stripeAccount: O.providerAccountId });
134
- }, [O?.providerAccountId, O?.stripePublishableKey]), X = l(() => {
135
- if (O?.clientSecret) return { clientSecret: O.clientSecret };
136
- }, [O?.clientSecret]);
137
- if (!B) return /* @__PURE__ */ f("div", {
132
+ let Y = d(() => {
133
+ let e = D?.stripePublishableKey?.trim() || me;
134
+ return !e || !D?.providerAccountId ? null : fe(e, { stripeAccount: D.providerAccountId });
135
+ }, [D?.providerAccountId, D?.stripePublishableKey]), X = d(() => {
136
+ if (D?.clientSecret) return { clientSecret: D.clientSecret };
137
+ }, [D?.clientSecret]);
138
+ if (!L) return /* @__PURE__ */ m("div", {
138
139
  className: "mx-auto max-w-3xl px-4 py-14 sm:px-6",
139
- children: /* @__PURE__ */ f(i, {
140
+ children: /* @__PURE__ */ m(s, {
140
141
  className: "border-destructive/25 bg-white p-5 sm:p-6 shadow-sm",
141
- children: /* @__PURE__ */ p("div", {
142
+ children: /* @__PURE__ */ h("div", {
142
143
  className: "space-y-4",
143
- children: [/* @__PURE__ */ p("div", {
144
+ children: [/* @__PURE__ */ h("div", {
144
145
  className: "flex items-start gap-3",
145
- children: [/* @__PURE__ */ f(_, {
146
+ children: [/* @__PURE__ */ m(v, {
146
147
  className: "mt-0.5 h-5 w-5 text-destructive",
147
148
  "aria-hidden": "true"
148
- }), /* @__PURE__ */ f("p", {
149
+ }), /* @__PURE__ */ m("p", {
149
150
  className: "text-sm text-slate-700",
150
- children: /* @__PURE__ */ f("span", { children: s("checkout_payment_return_missing_session") })
151
+ children: /* @__PURE__ */ m("span", { children: l("checkout_payment_return_missing_session") })
151
152
  })]
152
- }), /* @__PURE__ */ f(m, {
153
+ }), /* @__PURE__ */ m(g, {
153
154
  to: U,
154
- children: /* @__PURE__ */ f(n, {
155
+ children: /* @__PURE__ */ m(a, {
155
156
  variant: "outline",
156
- children: /* @__PURE__ */ f("span", { children: s("checkout_payment_return_back_to_checkout") })
157
+ children: /* @__PURE__ */ m("span", { children: l("checkout_payment_return_back_to_checkout") })
157
158
  })
158
159
  })]
159
160
  })
160
161
  })
161
162
  });
162
- if (A && !O) return /* @__PURE__ */ f("div", {
163
+ if (ve && !D) return /* @__PURE__ */ m("div", {
163
164
  className: "mx-auto max-w-3xl px-4 py-14 sm:px-6",
164
- children: /* @__PURE__ */ f(i, {
165
+ children: /* @__PURE__ */ m(s, {
165
166
  className: "border-slate-200 bg-white p-5 sm:p-6 shadow-sm",
166
- children: /* @__PURE__ */ f(S, {})
167
+ children: /* @__PURE__ */ m(_e, {})
167
168
  })
168
169
  });
169
- if (M || !O) return /* @__PURE__ */ f("div", {
170
+ if (A || !D) return /* @__PURE__ */ m("div", {
170
171
  className: "mx-auto max-w-3xl px-4 py-14 sm:px-6",
171
- children: /* @__PURE__ */ f(i, {
172
+ children: /* @__PURE__ */ m(s, {
172
173
  className: "border-destructive/25 bg-white p-5 sm:p-6 shadow-sm",
173
- children: /* @__PURE__ */ p("div", {
174
+ children: /* @__PURE__ */ h("div", {
174
175
  className: "space-y-4",
175
- children: [/* @__PURE__ */ p("div", {
176
+ children: [/* @__PURE__ */ h("div", {
176
177
  className: "flex items-start gap-3",
177
- children: [/* @__PURE__ */ f(_, {
178
+ children: [/* @__PURE__ */ m(v, {
178
179
  className: "mt-0.5 h-5 w-5 text-destructive",
179
180
  "aria-hidden": "true"
180
- }), /* @__PURE__ */ f("p", {
181
+ }), /* @__PURE__ */ m("p", {
181
182
  className: "text-sm text-slate-700",
182
- children: /* @__PURE__ */ f("span", { children: M ?? s("checkout_payment_return_status_error") })
183
+ children: /* @__PURE__ */ m("span", { children: A ?? l("checkout_payment_return_status_error") })
183
184
  })]
184
- }), /* @__PURE__ */ f(m, {
185
+ }), /* @__PURE__ */ m(g, {
185
186
  to: U,
186
- children: /* @__PURE__ */ f(n, {
187
+ children: /* @__PURE__ */ m(a, {
187
188
  variant: "outline",
188
- children: /* @__PURE__ */ f("span", { children: s("checkout_payment_return_back_to_checkout") })
189
+ children: /* @__PURE__ */ m("span", { children: l("checkout_payment_return_back_to_checkout") })
189
190
  })
190
191
  })]
191
192
  })
192
193
  })
193
194
  });
194
- let Z = typeof O.amountMinor == "number" && O.currency ? b(O.amountMinor, O.currency, y.language) : null, Q = q === "authorized" || q === "succeeded", $ = q === "failed" || q === "cancelled", me = Q ? oe : $ ? ce : v, he = Q ? "text-success" : $ ? "text-destructive" : "text-warning";
195
- return /* @__PURE__ */ f("div", {
195
+ let Z = typeof D.amountMinor == "number" && D.currency ? x(D.amountMinor, D.currency, y.language) : null, Q = q === "authorized" || q === "succeeded", $ = q === "failed" || q === "cancelled", be = Q ? ce : $ ? de : le, xe = Q ? "text-success" : $ ? "text-destructive" : "text-warning";
196
+ return /* @__PURE__ */ m("div", {
196
197
  className: "mx-auto max-w-5xl px-4 py-10 sm:px-6",
197
- children: /* @__PURE__ */ p("div", {
198
+ children: /* @__PURE__ */ h("div", {
198
199
  className: "grid gap-6 lg:grid-cols-[1fr_1fr]",
199
- children: [/* @__PURE__ */ f(i, {
200
+ children: [/* @__PURE__ */ m(s, {
200
201
  className: "border-slate-200 bg-white p-5 shadow-sm",
201
- children: /* @__PURE__ */ p("div", {
202
+ children: /* @__PURE__ */ h("div", {
202
203
  className: "space-y-5",
203
204
  children: [
204
- /* @__PURE__ */ p("div", {
205
+ /* @__PURE__ */ h("div", {
205
206
  className: "inline-flex items-center gap-2 rounded-full border border-success-border bg-success-subtle px-3 py-1 text-xs font-medium text-success",
206
- children: [/* @__PURE__ */ f(se, {
207
+ children: [/* @__PURE__ */ m(ue, {
207
208
  className: "h-3.5 w-3.5",
208
209
  "aria-hidden": "true"
209
- }), /* @__PURE__ */ f("span", { children: s("secure_payment_link.secured_badge") })]
210
+ }), /* @__PURE__ */ m("span", { children: l("secure_payment_link.secured_badge") })]
210
211
  }),
211
- /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h1", {
212
+ /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("h1", {
212
213
  className: "text-2xl font-semibold tracking-tight text-slate-950",
213
- children: /* @__PURE__ */ f("span", { children: s("checkout_payment_title") })
214
- }), /* @__PURE__ */ f("p", {
214
+ children: /* @__PURE__ */ m("span", { children: l("checkout_payment_title") })
215
+ }), /* @__PURE__ */ m("p", {
215
216
  className: "mt-2 text-sm text-slate-600",
216
- children: /* @__PURE__ */ f("span", { children: s("checkout_payment_hold_description") })
217
+ children: /* @__PURE__ */ m("span", { children: l("checkout_payment_hold_description") })
217
218
  })] }),
218
- /* @__PURE__ */ p("dl", {
219
+ /* @__PURE__ */ h("dl", {
219
220
  className: "grid gap-3 rounded-xl border border-slate-200 bg-slate-50 p-4 text-sm",
220
- children: [Z ? /* @__PURE__ */ p("div", {
221
+ children: [Z ? /* @__PURE__ */ h("div", {
221
222
  className: "flex items-center justify-between gap-3",
222
- children: [/* @__PURE__ */ f("dt", {
223
+ children: [/* @__PURE__ */ m("dt", {
223
224
  className: "text-slate-600",
224
- children: /* @__PURE__ */ f("span", { children: s("checkout_payment_hold_amount") })
225
- }), /* @__PURE__ */ f("dd", {
225
+ children: /* @__PURE__ */ m("span", { children: l("checkout_payment_hold_amount") })
226
+ }), /* @__PURE__ */ m("dd", {
226
227
  className: "font-semibold text-slate-950",
227
- children: /* @__PURE__ */ f("span", { children: Z })
228
+ children: /* @__PURE__ */ m("span", { children: Z })
228
229
  })]
229
- }) : null, O.providerType ? /* @__PURE__ */ p("div", {
230
+ }) : null, D.providerType ? /* @__PURE__ */ h("div", {
230
231
  className: "flex items-center justify-between gap-3",
231
- children: [/* @__PURE__ */ f("dt", {
232
+ children: [/* @__PURE__ */ m("dt", {
232
233
  className: "text-slate-600",
233
- children: /* @__PURE__ */ f("span", { children: s("checkout_payment_provider") })
234
- }), /* @__PURE__ */ f("dd", {
234
+ children: /* @__PURE__ */ m("span", { children: l("checkout_payment_provider") })
235
+ }), /* @__PURE__ */ m("dd", {
235
236
  className: "font-medium text-slate-950",
236
- children: /* @__PURE__ */ f("span", { children: s(`secure_payment_link.providers.${O.providerType}`) })
237
+ children: /* @__PURE__ */ m("span", { children: l(`secure_payment_link.providers.${D.providerType}`) })
237
238
  })]
238
239
  }) : null]
239
240
  })
240
241
  ]
241
242
  })
242
- }), /* @__PURE__ */ f(i, {
243
+ }), /* @__PURE__ */ m(s, {
243
244
  className: "border-slate-200 bg-white p-5 shadow-sm",
244
- children: Q || $ ? /* @__PURE__ */ p("div", {
245
+ children: Q || $ ? /* @__PURE__ */ h("div", {
245
246
  className: "space-y-6 text-center",
246
247
  children: [
247
- /* @__PURE__ */ f("div", {
248
+ /* @__PURE__ */ m("div", {
248
249
  className: "mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-slate-100",
249
- children: /* @__PURE__ */ f(me, {
250
- className: `h-6 w-6 ${he}`,
250
+ children: /* @__PURE__ */ m(be, {
251
+ className: `h-6 w-6 ${xe}`,
251
252
  "aria-hidden": "true"
252
253
  })
253
254
  }),
254
- /* @__PURE__ */ p("div", {
255
+ /* @__PURE__ */ h("div", {
255
256
  className: "space-y-2",
256
- children: [/* @__PURE__ */ f("h2", {
257
+ children: [/* @__PURE__ */ m("h2", {
257
258
  className: "text-xl font-semibold text-slate-950",
258
- children: /* @__PURE__ */ f("span", { children: s(`secure_payment_link.success_titles.${q}`) })
259
- }), /* @__PURE__ */ f("p", {
259
+ children: /* @__PURE__ */ m("span", { children: l(`secure_payment_link.success_titles.${q}`) })
260
+ }), /* @__PURE__ */ m("p", {
260
261
  className: "text-sm text-slate-600",
261
- children: /* @__PURE__ */ f("span", { children: s(`secure_payment_link.statuses.${q}`) })
262
+ children: /* @__PURE__ */ m("span", { children: l(`secure_payment_link.statuses.${q}`) })
262
263
  })]
263
264
  }),
264
- Q ? /* @__PURE__ */ f(m, {
265
- to: W,
266
- children: /* @__PURE__ */ p(n, {
265
+ Q ? /* @__PURE__ */ m(g, {
266
+ to: r(W, D.payment?.reference),
267
+ children: /* @__PURE__ */ h(a, {
267
268
  className: "gap-2",
268
- children: [/* @__PURE__ */ f("span", { children: s("checkout_payment_return_go_to_success") }), /* @__PURE__ */ f(ae, {
269
+ children: [/* @__PURE__ */ m("span", { children: l("checkout_payment_return_go_to_success") }), /* @__PURE__ */ m(se, {
269
270
  className: "h-4 w-4",
270
271
  "aria-hidden": "true"
271
272
  })]
272
273
  })
273
- }) : /* @__PURE__ */ f(m, {
274
+ }) : /* @__PURE__ */ m(g, {
274
275
  to: U,
275
- children: /* @__PURE__ */ f(n, { children: /* @__PURE__ */ f("span", { children: s("checkout_payment_return_retry_checkout") }) })
276
+ children: /* @__PURE__ */ m(a, { children: /* @__PURE__ */ m("span", { children: l("checkout_payment_return_retry_checkout") }) })
276
277
  })
277
278
  ]
278
- }) : J ? /* @__PURE__ */ p("div", {
279
+ }) : J ? /* @__PURE__ */ h("div", {
279
280
  className: "flex min-h-48 flex-col items-center justify-center gap-3 text-center",
280
- children: [/* @__PURE__ */ f(o, {
281
+ children: [/* @__PURE__ */ m(c, {
281
282
  className: "size-5 text-warning",
282
283
  "aria-hidden": "true"
283
- }), /* @__PURE__ */ p("div", {
284
+ }), /* @__PURE__ */ h("div", {
284
285
  className: "space-y-1",
285
- children: [/* @__PURE__ */ f("h2", {
286
+ children: [/* @__PURE__ */ m("h2", {
286
287
  className: "text-lg font-semibold text-slate-950",
287
- children: /* @__PURE__ */ f("span", { children: s("secure_payment_link.confirmation_loading_title") })
288
- }), /* @__PURE__ */ f("p", {
288
+ children: /* @__PURE__ */ m("span", { children: l("secure_payment_link.confirmation_loading_title") })
289
+ }), /* @__PURE__ */ m("p", {
289
290
  className: "text-sm text-slate-600",
290
- children: /* @__PURE__ */ f("span", { children: s("secure_payment_link.confirmation_loading_description") })
291
+ children: /* @__PURE__ */ m("span", { children: l("secure_payment_link.confirmation_loading_description") })
291
292
  })]
292
293
  })]
293
- }) : O.providerType === "mollie_connect_oauth" ? /* @__PURE__ */ p("div", {
294
+ }) : D.providerType === "mollie_connect_oauth" ? /* @__PURE__ */ h("div", {
294
295
  className: "space-y-4",
295
296
  children: [
296
- /* @__PURE__ */ f("h2", {
297
+ /* @__PURE__ */ m("h2", {
297
298
  className: "text-lg font-semibold text-slate-950",
298
- children: /* @__PURE__ */ f("span", { children: s("secure_payment_link.mollie.form_title") })
299
+ children: /* @__PURE__ */ m("span", { children: l("secure_payment_link.mollie.form_title") })
299
300
  }),
300
- /* @__PURE__ */ f("p", {
301
+ /* @__PURE__ */ m("p", {
301
302
  className: "text-sm text-slate-600",
302
- children: /* @__PURE__ */ f("span", { children: s("checkout_payment_hold_form_description") })
303
+ children: /* @__PURE__ */ m("span", { children: l("checkout_payment_hold_form_description") })
303
304
  }),
304
- O.profileId ? /* @__PURE__ */ f(ne, {
305
- profileId: O.profileId,
306
- testmode: O.testmode === !0,
307
- submitLabel: s("checkout_payment_authorize_button"),
308
- submittingLabel: s("checkout_payment_authorizing_button"),
305
+ D.profileId ? /* @__PURE__ */ m(re, {
306
+ profileId: D.profileId,
307
+ testmode: D.testmode === !0,
308
+ submitLabel: l("checkout_payment_authorize_button"),
309
+ submittingLabel: l("checkout_payment_authorizing_button"),
309
310
  onSubmit: async (e) => {
310
311
  let t = await G(e);
311
- if (!t.success) throw t.canRetryCheckout && E(), Error(t.message || s("secure_payment_link.errors.payment_failed"));
312
- if (z.current = t, k(t), t.paymentStatus === "authorized" || t.paymentStatus === "succeeded") {
313
- await K();
312
+ if (!t.success) throw t.canRetryCheckout && T(), Error(t.message || l("secure_payment_link.errors.payment_failed"));
313
+ if (I.current = t, O(t), t.paymentStatus === "authorized" || t.paymentStatus === "succeeded") {
314
+ await K(t);
314
315
  return;
315
316
  }
316
317
  if (t.paymentStatus === "failed" || t.paymentStatus === "cancelled") {
317
- E();
318
+ T();
318
319
  return;
319
320
  }
320
- if (!t.checkoutUrl) throw Error(t.message || s("secure_payment_link.errors.mollie_missing_url"));
321
+ if (!t.checkoutUrl) throw Error(t.message || l("secure_payment_link.errors.mollie_missing_url"));
321
322
  let n = new URL(t.checkoutUrl, window.location.origin).toString();
322
323
  window.location.assign(n);
323
324
  }
324
- }) : /* @__PURE__ */ f("p", {
325
+ }) : /* @__PURE__ */ m("p", {
325
326
  className: "text-sm text-destructive",
326
- children: /* @__PURE__ */ f("span", { children: s("secure_payment_link.errors.session_failed") })
327
+ children: /* @__PURE__ */ m("span", { children: l("secure_payment_link.errors.session_failed") })
327
328
  })
328
329
  ]
329
- }) : O.providerType === "stripe_connect_oauth" ? !O.clientSecret || !Y || !X ? /* @__PURE__ */ f("p", {
330
+ }) : D.providerType === "stripe_connect_oauth" ? !D.clientSecret || !Y || !X ? /* @__PURE__ */ m("p", {
330
331
  className: "text-sm text-destructive",
331
- children: /* @__PURE__ */ f("span", { children: s("secure_payment_link.errors.missing_publishable_key") })
332
- }) : /* @__PURE__ */ f(ue, {
332
+ children: /* @__PURE__ */ m("span", { children: l("secure_payment_link.errors.missing_publishable_key") })
333
+ }) : /* @__PURE__ */ m(pe, {
333
334
  stripe: Y,
334
335
  options: X,
335
- children: /* @__PURE__ */ f(x, {
336
- clientSecret: O.clientSecret,
336
+ children: /* @__PURE__ */ m(ge, {
337
+ clientSecret: D.clientSecret,
337
338
  onSuccess: async () => {
338
339
  let e = await G();
339
- if (!e.success) throw e.canRetryCheckout && E(), Error(e.message || s("secure_payment_link.errors.payment_failed"));
340
- if (z.current = e, k(e), e.paymentStatus === "authorized" || e.paymentStatus === "succeeded") {
341
- await K();
340
+ if (!e.success) throw e.canRetryCheckout && T(), Error(e.message || l("secure_payment_link.errors.payment_failed"));
341
+ if (I.current = e, O(e), e.paymentStatus === "authorized" || e.paymentStatus === "succeeded") {
342
+ await K(e);
342
343
  return;
343
344
  }
344
345
  if (e.paymentStatus === "pending" && e.payment?.status.trim().toLowerCase() === "processing") {
345
- L(0);
346
+ P(0);
346
347
  return;
347
348
  }
348
- throw Error(e.message || s("secure_payment_link.errors.payment_failed"));
349
+ throw Error(e.message || l("secure_payment_link.errors.payment_failed"));
349
350
  }
350
351
  })
351
- }, O.clientSecret) : /* @__PURE__ */ f("p", {
352
+ }, D.clientSecret) : /* @__PURE__ */ m("p", {
352
353
  className: "text-sm text-destructive",
353
- children: /* @__PURE__ */ f("span", { children: s("secure_payment_link.errors.session_failed") })
354
+ children: /* @__PURE__ */ m("span", { children: l("secure_payment_link.errors.session_failed") })
354
355
  })
355
356
  })]
356
357
  })
357
358
  });
358
359
  }
359
360
  //#endregion
360
- export { C as default };
361
+ export { S as default };
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutSuccessPage.d.ts","sourceRoot":"","sources":["../../src/pages/CheckoutSuccessPage.tsx"],"names":[],"mappings":"AAQA,MAAM,CAAC,OAAO,UAAU,mBAAmB,4CAoC1C"}
1
+ {"version":3,"file":"CheckoutSuccessPage.d.ts","sourceRoot":"","sources":["../../src/pages/CheckoutSuccessPage.tsx"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,UAAU,mBAAmB,4CAkD1C"}
@@ -1,44 +1,56 @@
1
1
  import { resolveBookingSearchParamsFromSessionStorage as e } from "../lib/booking.js";
2
- import { Button as t } from "../ui/button.js";
3
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
- import { Link as i, useParams as a, useSearchParams as o } from "@rpcbase/router";
5
- import { useTranslation as s } from "react-i18next";
6
- import { ArrowRight as c, CheckCircle2 as l } from "lucide-react";
2
+ import { getCheckoutBookingNumberFromSearchParams as t } from "../lib/checkoutSubmit.js";
3
+ import { Button as n } from "../ui/button.js";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ import { Link as a, useParams as o, useSearchParams as s } from "@rpcbase/router";
6
+ import { useTranslation as c } from "react-i18next";
7
+ import { ArrowRight as l, CheckCircle2 as u } from "lucide-react";
7
8
  //#region src/pages/CheckoutSuccessPage.tsx
8
- function u() {
9
- let { t: u } = s(), { storeSlug: d } = a(), [f] = o(), p = e(f, d).toString(), m = `/${d ?? ""}/booking${p ? `?${p}` : ""}`, h = `/${d ?? ""}${p ? `?${p}` : ""}`;
10
- return /* @__PURE__ */ r("div", {
9
+ function d() {
10
+ let { t: d } = c(), { storeSlug: f } = o(), [p] = s(), m = t(p), h = e(p, f).toString(), g = `/${f ?? ""}/booking${h ? `?${h}` : ""}`, _ = `/${f ?? ""}${h ? `?${h}` : ""}`;
11
+ return /* @__PURE__ */ i("div", {
11
12
  className: "mx-auto max-w-3xl px-4 py-14 sm:px-6",
12
13
  children: [
13
- /* @__PURE__ */ n("div", {
14
+ /* @__PURE__ */ r("div", {
14
15
  className: "mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-success-subtle text-success",
15
- children: /* @__PURE__ */ n(l, {
16
+ children: /* @__PURE__ */ r(u, {
16
17
  className: "h-6 w-6",
17
18
  "aria-hidden": "true"
18
19
  })
19
20
  }),
20
- /* @__PURE__ */ n("h1", {
21
+ /* @__PURE__ */ r("h1", {
21
22
  className: "mt-6 text-center text-2xl font-semibold tracking-tight text-slate-950",
22
- children: /* @__PURE__ */ n("span", { children: u("checkout_success_title") })
23
+ children: /* @__PURE__ */ r("span", { children: d("checkout_success_title") })
23
24
  }),
24
- /* @__PURE__ */ n("p", {
25
- className: "mt-2 text-center text-sm text-slate-600",
26
- children: /* @__PURE__ */ n("span", { children: u("checkout_success_description") })
25
+ m ? /* @__PURE__ */ i("div", {
26
+ className: "mx-auto mt-6 max-w-sm rounded-xl border border-success-border bg-success-subtle px-5 py-4 text-center",
27
+ "data-testid": "checkout-success-booking-number",
28
+ children: [/* @__PURE__ */ r("p", {
29
+ className: "text-sm text-slate-600",
30
+ children: /* @__PURE__ */ r("span", { children: d("checkout_success_booking_number") })
31
+ }), /* @__PURE__ */ r("p", {
32
+ className: "mt-1 font-mono text-xl font-semibold tracking-wide text-slate-950",
33
+ children: /* @__PURE__ */ r("span", { children: m })
34
+ })]
35
+ }) : null,
36
+ /* @__PURE__ */ r("p", {
37
+ className: "mt-3 text-center text-sm text-slate-600",
38
+ children: /* @__PURE__ */ r("span", { children: d("checkout_success_description") })
27
39
  }),
28
- /* @__PURE__ */ r("div", {
40
+ /* @__PURE__ */ i("div", {
29
41
  className: "mt-8 flex flex-col gap-3 sm:flex-row sm:justify-center",
30
- children: [/* @__PURE__ */ n(i, {
31
- to: m,
32
- children: /* @__PURE__ */ n(t, {
42
+ children: [/* @__PURE__ */ r(a, {
43
+ to: g,
44
+ children: /* @__PURE__ */ r(n, {
33
45
  variant: "outline",
34
46
  className: "w-full sm:w-auto",
35
- children: /* @__PURE__ */ n("span", { children: u("checkout_success_back_to_products") })
47
+ children: /* @__PURE__ */ r("span", { children: d("checkout_success_back_to_products") })
36
48
  })
37
- }), /* @__PURE__ */ n(i, {
38
- to: h,
39
- children: /* @__PURE__ */ r(t, {
49
+ }), /* @__PURE__ */ r(a, {
50
+ to: _,
51
+ children: /* @__PURE__ */ i(n, {
40
52
  className: "w-full gap-2 sm:w-auto",
41
- children: [/* @__PURE__ */ n("span", { children: u("checkout_success_back_home") }), /* @__PURE__ */ n(c, {
53
+ children: [/* @__PURE__ */ r("span", { children: d("checkout_success_back_home") }), /* @__PURE__ */ r(l, {
42
54
  className: "h-4 w-4",
43
55
  "aria-hidden": "true"
44
56
  })]
@@ -49,4 +61,4 @@ function u() {
49
61
  });
50
62
  }
51
63
  //#endregion
52
- export { u as default };
64
+ export { d as default };