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