@loczer/storefront-sdk 0.164.0 → 0.166.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/StorefrontProvider.d.ts +29 -3
- package/dist/StorefrontProvider.d.ts.map +1 -1
- package/dist/StorefrontProvider.js +64 -55
- package/dist/chunks/booking-engine/dist/schemas/{base-booking-D9k8ehGi.js → base-booking-BMAjsw9r.js} +29 -26
- package/dist/chunks/booking-engine/dist/schemas/booking-engine-configuration-DTJD2G9w.js +123 -0
- package/dist/chunks/booking-engine/dist/schemas/{cart-inputs-ByBK0IVJ.js → cart-inputs-BI_9nAXG.js} +1 -1
- package/dist/chunks/booking-engine/dist/schemas/{public-booking-engine-configuration-DKoak4s5.js → public-booking-engine-configuration-CrwffLO4.js} +1 -1
- package/dist/chunks/ui/dist/{MorphingModalWizard-D7hc-dDP.js → MorphingModalWizard-BuRND-yE.js} +3 -3
- package/dist/chunks/ui/dist/node_modules/motion-dom/dist/es/animation/optimized-appear/data-id-CNQuVmXa.js +6 -0
- package/dist/chunks/ui/dist/node_modules/motion-dom/dist/es/projection/node/create-projection-node-DL2q-YuA.js +9 -0
- package/dist/chunks/ui/dist/node_modules/motion-dom/dist/es/render/dom/utils/camel-to-dash-C-3PLS5x.js +6 -0
- package/dist/components/AboutSection/index.js +1 -1
- package/dist/components/BikeProductCard/index.d.ts +2 -1
- package/dist/components/BikeProductCard/index.d.ts.map +1 -1
- package/dist/components/BikeProductCard/index.js +59 -41
- package/dist/components/BookingBikeVariantDialog/index.js +1 -1
- package/dist/components/BookingFlowSteps/index.js +8 -8
- package/dist/components/BookingPeriodSelector/components/BookingEndDateField.js +1 -1
- package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.js +1 -1
- package/dist/components/BookingPeriodSelector/components/BookingMobileDateDrawer.js +28 -28
- package/dist/components/BookingPeriodSelector/components/BookingStartDateField.js +1 -1
- package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.js +1 -1
- package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts.map +1 -1
- package/dist/components/BookingPeriodSelector/useBookingPeriodController.js +197 -203
- package/dist/components/ContactSection/index.js +4 -4
- package/dist/components/Header/index.js +1 -1
- package/dist/components/PoweredByLoczerBadge/index.js +1 -1
- package/dist/components/ProductPriceBadge/index.js +1 -1
- package/dist/components/ProductWarningNotice/index.js +10 -10
- package/dist/components/StorefrontCancellationPolicyNotice/index.d.ts +11 -0
- package/dist/components/StorefrontCancellationPolicyNotice/index.d.ts.map +1 -0
- package/dist/components/StorefrontCancellationPolicyNotice/index.js +93 -0
- package/dist/components/payment/MollieCardFieldsForm.js +1 -1
- package/dist/components/payment/StripeCardFieldsForm.js +13 -13
- package/dist/i18n/en.d.ts +12 -0
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +12 -0
- package/dist/i18n/fr.d.ts +12 -0
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +12 -0
- package/dist/index.d.ts +116 -7
- package/dist/index.js +312 -305
- package/dist/lib/cart.js +1 -1
- package/dist/lib/cartSummary.d.ts.map +1 -1
- package/dist/lib/cartSummary.js +28 -28
- package/dist/lib/checkoutPaymentDecision.d.ts +8 -0
- package/dist/lib/checkoutPaymentDecision.d.ts.map +1 -1
- package/dist/lib/checkoutPaymentDecision.js +14 -6
- package/dist/lib/checkoutPaymentSession.d.ts +1 -0
- package/dist/lib/checkoutPaymentSession.d.ts.map +1 -1
- package/dist/lib/checkoutPaymentSession.js +12 -11
- package/dist/lib/checkoutSubmit.js +4 -4
- package/dist/lib/productVariants.d.ts.map +1 -1
- package/dist/lib/productVariants.js +34 -15
- package/dist/lib/products.d.ts +4 -0
- package/dist/lib/products.d.ts.map +1 -1
- package/dist/lib/products.js +74 -39
- package/dist/lib/securePaymentLink.d.ts +1 -0
- package/dist/lib/securePaymentLink.d.ts.map +1 -1
- package/dist/lib/securePaymentLink.js +1 -0
- package/dist/lib/storefrontAvailability.d.ts +9 -0
- package/dist/lib/storefrontAvailability.d.ts.map +1 -1
- package/dist/lib/storefrontAvailability.js +28 -18
- package/dist/pages/BookingPage.d.ts.map +1 -1
- package/dist/pages/BookingPage.js +290 -289
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +224 -216
- package/dist/pages/CheckoutPaymentPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPaymentPage.js +92 -92
- package/dist/pages/ContractSaleDocumentPage.js +3 -3
- package/dist/pages/HomePage.d.ts.map +1 -1
- package/dist/pages/HomePage.js +168 -162
- package/dist/pages/PaymentLinkPage.d.ts.map +1 -1
- package/dist/pages/PaymentLinkPage.js +62 -62
- package/dist/pages/PaymentLinkSuccessPage.js +7 -7
- package/dist/pages/ProductPage.d.ts.map +1 -1
- package/dist/pages/ProductPage.js +161 -161
- package/dist/pages/checkout/components/CheckoutCouponCard.js +6 -6
- package/dist/pages/checkout/components/CheckoutPaymentSummaryCard.js +15 -15
- package/dist/storefront.css +1 -1
- package/dist/storefrontSchemas.d.ts +14 -2
- package/dist/storefrontSchemas.d.ts.map +1 -1
- package/dist/storefrontSchemas.js +4 -4
- package/dist/ui/day-picker.js +5 -5
- package/package.json +2 -2
- package/dist/chunks/booking-engine/dist/schemas/booking-engine-configuration-BKlzwJJX.js +0 -105
- package/dist/chunks/ui/dist/node_modules/framer-motion/dist/es/animation/optimized-appear/data-id-DunDwGdX.js +0 -6
- package/dist/chunks/ui/dist/node_modules/framer-motion/dist/es/projection/node/create-projection-node-BDwaGtmx.js +0 -9
- package/dist/chunks/ui/dist/node_modules/framer-motion/dist/es/render/dom/utils/camel-to-dash-h54_qXon.js +0 -4
|
@@ -1,38 +1,35 @@
|
|
|
1
1
|
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
2
|
import { useState as p, useEffect as T, useMemo as M } from "react";
|
|
3
|
-
import { useNavigate as
|
|
4
|
-
import { loadStripe as
|
|
5
|
-
import { Elements as z, useStripe as
|
|
6
|
-
import { AlertTriangle as
|
|
3
|
+
import { useNavigate as j, useLoaderData as G, Link as Y, replace as q } from "@rpcbase/router";
|
|
4
|
+
import { loadStripe as D } from "@stripe/stripe-js";
|
|
5
|
+
import { Elements as z, useStripe as H } from "@stripe/react-stripe-js";
|
|
6
|
+
import { AlertTriangle as J, ShieldCheck as Q, Loader2 as V } from "lucide-react";
|
|
7
7
|
import { useTranslation as k } from "react-i18next";
|
|
8
|
-
import { apiPost as g, apiGet as
|
|
9
|
-
import { GET_MOLLIE_SECURE_PAYMENT_SESSION_ROUTE as R, getMollieSecurePaymentSessionResponseSchema as U, GET_STRIPE_SECURE_PAYMENT_SESSION_ROUTE as
|
|
10
|
-
import { MollieCardFieldsForm as
|
|
11
|
-
import { StripeCardFieldsForm as
|
|
12
|
-
import { Button as
|
|
8
|
+
import { apiPost as g, apiGet as W } from "../lib/apiCall.js";
|
|
9
|
+
import { GET_MOLLIE_SECURE_PAYMENT_SESSION_ROUTE as R, getMollieSecurePaymentSessionResponseSchema as U, GET_STRIPE_SECURE_PAYMENT_SESSION_ROUTE as X, getStripeSecurePaymentSessionResponseSchema as Z, GET_SECURE_PAYMENT_LINK_ROUTE as ee, getSecurePaymentLinkResponseSchema as re } from "../lib/securePaymentLink.js";
|
|
10
|
+
import { MollieCardFieldsForm as se } from "../components/payment/MollieCardFieldsForm.js";
|
|
11
|
+
import { StripeCardFieldsForm as te } from "../components/payment/StripeCardFieldsForm.js";
|
|
12
|
+
import { Button as ne } from "../ui/button.js";
|
|
13
13
|
import { Card as x } from "../ui/card.js";
|
|
14
|
-
const
|
|
15
|
-
const r = le, o = r?.RB_PUBLIC_STRIPE_PUBLISHABLE_KEY?.trim();
|
|
16
|
-
return o || (r?.RB_PUBLIC_STRIPE_PUBLISHABLE_API_KEY?.trim() ?? "");
|
|
17
|
-
}, C = ae(), oe = (r, o, l) => {
|
|
14
|
+
const ie = {}, le = () => ie?.RB_PUBLIC_STRIPE_PUBLISHABLE_KEY?.trim() ?? "", ae = le(), oe = (r, d, l) => {
|
|
18
15
|
try {
|
|
19
16
|
return new Intl.NumberFormat(l, {
|
|
20
17
|
style: "currency",
|
|
21
|
-
currency:
|
|
18
|
+
currency: d.toUpperCase()
|
|
22
19
|
}).format(r / 100);
|
|
23
20
|
} catch {
|
|
24
|
-
return `${(r / 100).toFixed(2)} ${
|
|
21
|
+
return `${(r / 100).toFixed(2)} ${d.toUpperCase()}`;
|
|
25
22
|
}
|
|
26
23
|
};
|
|
27
|
-
function
|
|
24
|
+
function C() {
|
|
28
25
|
const { t: r } = k();
|
|
29
26
|
return /* @__PURE__ */ c("div", { className: "flex min-h-48 items-center justify-center gap-2 text-sm text-slate-600", children: [
|
|
30
|
-
/* @__PURE__ */ e(
|
|
27
|
+
/* @__PURE__ */ e(V, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" }),
|
|
31
28
|
/* @__PURE__ */ e("span", { children: r("secure_payment_link.form.loading_session") })
|
|
32
29
|
] });
|
|
33
30
|
}
|
|
34
|
-
const
|
|
35
|
-
const l = typeof
|
|
31
|
+
const be = (async ({ ctx: r, params: d }) => {
|
|
32
|
+
const l = typeof d.storeSlug == "string" ? d.storeSlug.trim().toLowerCase() : "", a = typeof d.token == "string" ? d.token.trim() : "";
|
|
36
33
|
if (!l || !a)
|
|
37
34
|
return {
|
|
38
35
|
storeSlug: l,
|
|
@@ -42,14 +39,14 @@ const Ee = (async ({ ctx: r, params: o }) => {
|
|
|
42
39
|
errorKey: "invalid_link"
|
|
43
40
|
};
|
|
44
41
|
try {
|
|
45
|
-
const n = await
|
|
46
|
-
|
|
42
|
+
const n = await W(
|
|
43
|
+
ee,
|
|
47
44
|
{
|
|
48
45
|
storeSlug: l,
|
|
49
46
|
token: a
|
|
50
47
|
},
|
|
51
48
|
r
|
|
52
|
-
), t =
|
|
49
|
+
), t = re.parse(n);
|
|
53
50
|
if (!t.success || !t.paymentLinkSession)
|
|
54
51
|
return {
|
|
55
52
|
storeSlug: l,
|
|
@@ -59,7 +56,7 @@ const Ee = (async ({ ctx: r, params: o }) => {
|
|
|
59
56
|
errorKey: null
|
|
60
57
|
};
|
|
61
58
|
if (t.paymentLinkSession.status !== "pending")
|
|
62
|
-
throw
|
|
59
|
+
throw q(`/${encodeURIComponent(l)}/secure-payment-link/${encodeURIComponent(a)}/success`);
|
|
63
60
|
return {
|
|
64
61
|
storeSlug: l,
|
|
65
62
|
token: a,
|
|
@@ -81,11 +78,11 @@ const Ee = (async ({ ctx: r, params: o }) => {
|
|
|
81
78
|
});
|
|
82
79
|
function ce({
|
|
83
80
|
clientSecret: r,
|
|
84
|
-
onSuccess:
|
|
81
|
+
onSuccess: d
|
|
85
82
|
}) {
|
|
86
|
-
const { t: l } = k(), a =
|
|
83
|
+
const { t: l } = k(), a = H();
|
|
87
84
|
return /* @__PURE__ */ e(
|
|
88
|
-
|
|
85
|
+
te,
|
|
89
86
|
{
|
|
90
87
|
requireEmail: !1,
|
|
91
88
|
onSubmit: async ({ paymentMethodId: n }) => {
|
|
@@ -102,13 +99,13 @@ function ce({
|
|
|
102
99
|
const s = t.paymentIntent?.status;
|
|
103
100
|
if (s !== "succeeded" && s !== "processing" && s !== "requires_capture")
|
|
104
101
|
throw new Error(l("secure_payment_link.errors.payment_failed"));
|
|
105
|
-
|
|
102
|
+
d();
|
|
106
103
|
}
|
|
107
104
|
}
|
|
108
105
|
);
|
|
109
106
|
}
|
|
110
|
-
function
|
|
111
|
-
const { t: r, i18n:
|
|
107
|
+
function ve() {
|
|
108
|
+
const { t: r, i18n: d } = k(), l = j(), a = G(), { storeSlug: n, token: t } = a, s = a.session, N = a.errorMessage ?? (a.errorKey ? r(`secure_payment_link.errors.${a.errorKey}`) : null), K = s?.providerType === "mollie_connect_oauth" && s.status === "pending" && !!(n && t), A = s?.providerType === "stripe_connect_oauth" && s.status === "pending" && !!(n && t), [y, h] = p(null), [F, f] = p(K), [b, _] = p(null), [m, v] = p(null), [$, w] = p(A), [E, S] = p(null), L = `/${n ?? ""}/secure-payment-link/${t ?? ""}/success`;
|
|
112
109
|
T(() => {
|
|
113
110
|
if (!s || !n || !t) {
|
|
114
111
|
h(null), _(null), f(!1);
|
|
@@ -118,7 +115,7 @@ function we() {
|
|
|
118
115
|
h(null), _(null), f(!1);
|
|
119
116
|
return;
|
|
120
117
|
}
|
|
121
|
-
let
|
|
118
|
+
let o = !1;
|
|
122
119
|
return f(!0), _(null), h(null), (async () => {
|
|
123
120
|
try {
|
|
124
121
|
const u = await g(
|
|
@@ -128,68 +125,71 @@ function we() {
|
|
|
128
125
|
token: t
|
|
129
126
|
}
|
|
130
127
|
), i = U.parse(u);
|
|
131
|
-
if (
|
|
128
|
+
if (o) return;
|
|
132
129
|
if (!i.success || !i.profileId) {
|
|
133
130
|
_(i.message || r("secure_payment_link.errors.session_failed"));
|
|
134
131
|
return;
|
|
135
132
|
}
|
|
136
133
|
h(i);
|
|
137
134
|
} catch (u) {
|
|
138
|
-
if (
|
|
135
|
+
if (o) return;
|
|
139
136
|
console.error("Failed to create mollie secure session", u), _(r("secure_payment_link.errors.session_failed"));
|
|
140
137
|
} finally {
|
|
141
|
-
|
|
138
|
+
o || f(!1);
|
|
142
139
|
}
|
|
143
140
|
})(), () => {
|
|
144
|
-
|
|
141
|
+
o = !0;
|
|
145
142
|
};
|
|
146
143
|
}, [s, n, r, t]), T(() => {
|
|
147
144
|
if (!s || s.providerType !== "stripe_connect_oauth" || s.status !== "pending" || !n || !t) return;
|
|
148
|
-
let
|
|
149
|
-
return
|
|
145
|
+
let o = !1;
|
|
146
|
+
return w(!0), S(null), v(null), (async () => {
|
|
150
147
|
try {
|
|
151
148
|
const u = await g(
|
|
152
|
-
|
|
149
|
+
X,
|
|
153
150
|
{
|
|
154
151
|
storeSlug: n,
|
|
155
152
|
token: t
|
|
156
153
|
}
|
|
157
|
-
), i =
|
|
158
|
-
if (
|
|
154
|
+
), i = Z.parse(u);
|
|
155
|
+
if (o) return;
|
|
159
156
|
if (!i.success || !i.clientSecret || !i.payment) {
|
|
160
157
|
S(i.message || r("secure_payment_link.errors.session_failed"));
|
|
161
158
|
return;
|
|
162
159
|
}
|
|
163
|
-
|
|
160
|
+
v(i);
|
|
164
161
|
} catch (u) {
|
|
165
|
-
if (
|
|
162
|
+
if (o) return;
|
|
166
163
|
console.error("Failed to create stripe secure session", u), S(r("secure_payment_link.errors.session_failed"));
|
|
167
164
|
} finally {
|
|
168
|
-
|
|
165
|
+
o || w(!1);
|
|
169
166
|
}
|
|
170
167
|
})(), () => {
|
|
171
|
-
|
|
168
|
+
o = !0;
|
|
172
169
|
};
|
|
173
170
|
}, [s, n, r, t]);
|
|
174
|
-
const P = M(() =>
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
const P = M(() => {
|
|
172
|
+
const o = m?.stripePublishableKey?.trim() || ae;
|
|
173
|
+
return !o || !m?.stripeAccountId ? null : D(o, {
|
|
174
|
+
stripeAccount: m.stripeAccountId
|
|
175
|
+
});
|
|
176
|
+
}, [m?.stripeAccountId, m?.stripePublishableKey]), I = M(() => {
|
|
177
177
|
if (m?.clientSecret)
|
|
178
178
|
return {
|
|
179
179
|
clientSecret: m.clientSecret
|
|
180
180
|
};
|
|
181
|
-
}, [m?.clientSecret]),
|
|
182
|
-
return N || !s ? /* @__PURE__ */ e("div", { className: "mx-auto max-w-4xl px-4 py-14 sm:px-6", children: /* @__PURE__ */ e(x, { className: "border-
|
|
183
|
-
/* @__PURE__ */ e(
|
|
181
|
+
}, [m?.clientSecret]), B = s ? oe(s.amountMinor, s.currency, d.language) : "—";
|
|
182
|
+
return N || !s ? /* @__PURE__ */ e("div", { className: "mx-auto max-w-4xl px-4 py-14 sm:px-6", children: /* @__PURE__ */ e(x, { className: "border-destructive/25 bg-white p-5 sm:p-6 shadow-sm", children: /* @__PURE__ */ c("div", { className: "flex items-start gap-3", children: [
|
|
183
|
+
/* @__PURE__ */ e(J, { className: "mt-0.5 h-5 w-5 text-destructive", "aria-hidden": "true" }),
|
|
184
184
|
/* @__PURE__ */ c("div", { className: "space-y-3", children: [
|
|
185
185
|
/* @__PURE__ */ e("h1", { className: "text-xl font-semibold tracking-tight text-slate-950", children: /* @__PURE__ */ e("span", { children: r("secure_payment_link.errors.title") }) }),
|
|
186
186
|
/* @__PURE__ */ e("p", { className: "text-sm text-slate-700", children: /* @__PURE__ */ e("span", { children: N ?? r("secure_payment_link.errors.invalid_link") }) }),
|
|
187
|
-
/* @__PURE__ */ e(
|
|
187
|
+
/* @__PURE__ */ e(Y, { to: `/${n ?? ""}`, children: /* @__PURE__ */ e(ne, { variant: "outline", children: /* @__PURE__ */ e("span", { children: r("secure_payment_link.back_to_store") }) }) })
|
|
188
188
|
] })
|
|
189
189
|
] }) }) }) : /* @__PURE__ */ e("div", { className: "mx-auto max-w-5xl px-4 py-10 sm:px-6", children: /* @__PURE__ */ c("div", { className: "grid gap-6 lg:grid-cols-[1fr_1fr]", children: [
|
|
190
190
|
/* @__PURE__ */ e(x, { className: "border-slate-200 bg-white p-5 shadow-sm", children: /* @__PURE__ */ c("div", { className: "space-y-5", children: [
|
|
191
191
|
/* @__PURE__ */ c("div", { className: "inline-flex items-center gap-2 rounded-full border border-emerald-200 bg-emerald-50 px-3 py-1 text-xs font-medium text-emerald-700", children: [
|
|
192
|
-
/* @__PURE__ */ e(
|
|
192
|
+
/* @__PURE__ */ e(Q, { className: "h-3.5 w-3.5", "aria-hidden": "true" }),
|
|
193
193
|
/* @__PURE__ */ e("span", { children: r("secure_payment_link.secured_badge") })
|
|
194
194
|
] }),
|
|
195
195
|
/* @__PURE__ */ c("div", { children: [
|
|
@@ -199,7 +199,7 @@ function we() {
|
|
|
199
199
|
/* @__PURE__ */ c("dl", { className: "grid gap-3 rounded-xl border border-slate-200 bg-slate-50 p-4 text-sm", children: [
|
|
200
200
|
/* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-3", children: [
|
|
201
201
|
/* @__PURE__ */ e("dt", { className: "text-slate-600", children: /* @__PURE__ */ e("span", { children: r("secure_payment_link.amount_label") }) }),
|
|
202
|
-
/* @__PURE__ */ e("dd", { className: "font-semibold text-slate-950", children: /* @__PURE__ */ e("span", { children:
|
|
202
|
+
/* @__PURE__ */ e("dd", { className: "font-semibold text-slate-950", children: /* @__PURE__ */ e("span", { children: B }) })
|
|
203
203
|
] }),
|
|
204
204
|
/* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-3", children: [
|
|
205
205
|
/* @__PURE__ */ e("dt", { className: "text-slate-600", children: /* @__PURE__ */ e("span", { children: r("secure_payment_link.reference_label") }) }),
|
|
@@ -214,18 +214,18 @@ function we() {
|
|
|
214
214
|
/* @__PURE__ */ e(x, { className: "border-slate-200 bg-white p-5 shadow-sm", children: s.providerType === "mollie_connect_oauth" ? /* @__PURE__ */ c("div", { className: "space-y-4", children: [
|
|
215
215
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-slate-950", children: /* @__PURE__ */ e("span", { children: r("secure_payment_link.mollie.form_title") }) }),
|
|
216
216
|
/* @__PURE__ */ e("p", { className: "text-sm text-slate-600", children: /* @__PURE__ */ e("span", { children: r("secure_payment_link.mollie.form_description") }) }),
|
|
217
|
-
F ? /* @__PURE__ */ e(
|
|
218
|
-
|
|
217
|
+
F ? /* @__PURE__ */ e(C, {}) : b ? /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: /* @__PURE__ */ e("span", { children: b }) }) : y?.profileId ? /* @__PURE__ */ e(
|
|
218
|
+
se,
|
|
219
219
|
{
|
|
220
220
|
profileId: y.profileId,
|
|
221
221
|
testmode: y.testmode === !0,
|
|
222
|
-
onSubmit: async (
|
|
222
|
+
onSubmit: async (o) => {
|
|
223
223
|
const u = await g(
|
|
224
224
|
R,
|
|
225
225
|
{
|
|
226
226
|
storeSlug: n,
|
|
227
227
|
token: t,
|
|
228
|
-
cardToken:
|
|
228
|
+
cardToken: o
|
|
229
229
|
}
|
|
230
230
|
), i = U.parse(u);
|
|
231
231
|
if (!i.success)
|
|
@@ -236,12 +236,12 @@ function we() {
|
|
|
236
236
|
}
|
|
237
237
|
if (!i.checkoutUrl)
|
|
238
238
|
throw new Error(i.message || r("secure_payment_link.errors.mollie_missing_url"));
|
|
239
|
-
const
|
|
240
|
-
window.location.assign(
|
|
239
|
+
const O = new URL(i.checkoutUrl, window.location.origin).toString();
|
|
240
|
+
window.location.assign(O);
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
) : /* @__PURE__ */ e("p", { className: "text-sm text-
|
|
244
|
-
] }) : $ ? /* @__PURE__ */ e(
|
|
243
|
+
) : /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: /* @__PURE__ */ e("span", { children: r("secure_payment_link.errors.session_failed") }) })
|
|
244
|
+
] }) : $ ? /* @__PURE__ */ e(C, {}) : E ? /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: /* @__PURE__ */ e("span", { children: E }) }) : !m?.clientSecret || !P || !I ? /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: /* @__PURE__ */ e("span", { children: r("secure_payment_link.errors.missing_publishable_key") }) }) : /* @__PURE__ */ e(z, { stripe: P, options: I, children: /* @__PURE__ */ e(
|
|
245
245
|
ce,
|
|
246
246
|
{
|
|
247
247
|
clientSecret: m.clientSecret,
|
|
@@ -253,6 +253,6 @@ function we() {
|
|
|
253
253
|
] }) });
|
|
254
254
|
}
|
|
255
255
|
export {
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
ve as default,
|
|
257
|
+
be as loader
|
|
258
258
|
};
|
|
@@ -4,7 +4,7 @@ import { useLoaderData as C, Link as M } from "@rpcbase/router";
|
|
|
4
4
|
import { Loader2 as w, CheckCircle2 as K, XCircle as R, CircleDashed as T } from "lucide-react";
|
|
5
5
|
import { useTranslation as D } from "react-i18next";
|
|
6
6
|
import { apiGet as S } from "../lib/apiCall.js";
|
|
7
|
-
import { GET_SECURE_PAYMENT_LINK_ROUTE as
|
|
7
|
+
import { GET_SECURE_PAYMENT_LINK_ROUTE as v, getSecurePaymentLinkResponseSchema as b } from "../lib/securePaymentLink.js";
|
|
8
8
|
import { Button as $ } from "../ui/button.js";
|
|
9
9
|
import { Card as j } from "../ui/card.js";
|
|
10
10
|
const I = (s, l, r) => {
|
|
@@ -28,13 +28,13 @@ const I = (s, l, r) => {
|
|
|
28
28
|
};
|
|
29
29
|
try {
|
|
30
30
|
const c = await S(
|
|
31
|
-
|
|
31
|
+
v,
|
|
32
32
|
{
|
|
33
33
|
storeSlug: r,
|
|
34
34
|
token: a
|
|
35
35
|
},
|
|
36
36
|
s
|
|
37
|
-
), t =
|
|
37
|
+
), t = b.parse(c);
|
|
38
38
|
return !t.success || !t.paymentLinkSession ? {
|
|
39
39
|
storeSlug: r,
|
|
40
40
|
token: a,
|
|
@@ -76,11 +76,11 @@ function J() {
|
|
|
76
76
|
return (async () => {
|
|
77
77
|
u(!0), d(null);
|
|
78
78
|
try {
|
|
79
|
-
const m = await S(
|
|
79
|
+
const m = await S(v, {
|
|
80
80
|
storeSlug: a,
|
|
81
81
|
token: c,
|
|
82
82
|
reconcileStripeStatus: Date.now() - k.current >= P ? "true" : void 0
|
|
83
|
-
}), f =
|
|
83
|
+
}), f = b.parse(m);
|
|
84
84
|
if (o) return;
|
|
85
85
|
if (!f.success || !f.paymentLinkSession) {
|
|
86
86
|
d(f.message || s("secure_payment_link.errors.load_failed"));
|
|
@@ -109,14 +109,14 @@ function J() {
|
|
|
109
109
|
}, [p, _, t, n]), /* @__PURE__ */ e("div", { className: "mx-auto max-w-3xl px-4 py-14 sm:px-6", children: /* @__PURE__ */ e(j, { className: "border-slate-200 bg-white p-5 shadow-sm sm:p-6", children: _ && !t ? /* @__PURE__ */ i("div", { className: "flex items-center gap-2 text-sm text-slate-600", children: [
|
|
110
110
|
/* @__PURE__ */ e(w, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" }),
|
|
111
111
|
/* @__PURE__ */ e("span", { children: s("secure_payment_link.loading") })
|
|
112
|
-
] }) : p || !t ? /* @__PURE__ */ e("p", { className: "text-sm text-
|
|
112
|
+
] }) : p || !t ? /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: /* @__PURE__ */ e("span", { children: p ?? s("secure_payment_link.errors.invalid_link") }) }) : n === "pending" ? /* @__PURE__ */ i("div", { className: "space-y-4 text-center", children: [
|
|
113
113
|
/* @__PURE__ */ e("div", { className: "mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-slate-100", children: /* @__PURE__ */ e(w, { className: "h-6 w-6 animate-spin text-slate-600", "aria-hidden": "true" }) }),
|
|
114
114
|
/* @__PURE__ */ i("div", { className: "space-y-2", children: [
|
|
115
115
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-semibold text-slate-950", children: /* @__PURE__ */ e("span", { children: s("secure_payment_link.confirmation_loading_title") }) }),
|
|
116
116
|
/* @__PURE__ */ e("p", { className: "text-sm text-slate-600", children: /* @__PURE__ */ e("span", { children: s("secure_payment_link.confirmation_loading_description") }) })
|
|
117
117
|
] })
|
|
118
118
|
] }) : /* @__PURE__ */ i("div", { className: "space-y-6 text-center", children: [
|
|
119
|
-
/* @__PURE__ */ e("div", { className: "mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-slate-100", children: /* @__PURE__ */ e(n === "succeeded" || n === "authorized" ? K : n === "failed" || n === "cancelled" ? R : T, { className: `h-6 w-6 ${n === "succeeded" || n === "authorized" ? "text-emerald-600" : n === "failed" || n === "cancelled" ? "text-
|
|
119
|
+
/* @__PURE__ */ e("div", { className: "mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-slate-100", children: /* @__PURE__ */ e(n === "succeeded" || n === "authorized" ? K : n === "failed" || n === "cancelled" ? R : T, { className: `h-6 w-6 ${n === "succeeded" || n === "authorized" ? "text-emerald-600" : n === "failed" || n === "cancelled" ? "text-destructive" : "text-amber-600"}`, "aria-hidden": "true" }) }),
|
|
120
120
|
/* @__PURE__ */ i("div", { className: "space-y-2", children: [
|
|
121
121
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-semibold text-slate-950", children: /* @__PURE__ */ e("span", { children: s(`secure_payment_link.success_titles.${n}`) }) }),
|
|
122
122
|
/* @__PURE__ */ e("p", { className: "text-sm text-slate-600", children: /* @__PURE__ */ e("span", { children: s(`secure_payment_link.statuses.${n}`) }) })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductPage.d.ts","sourceRoot":"","sources":["../../src/pages/ProductPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProductPage.d.ts","sourceRoot":"","sources":["../../src/pages/ProductPage.tsx"],"names":[],"mappings":"AA0HA,MAAM,CAAC,OAAO,UAAU,WAAW,4CA4VlC"}
|