@loczer/storefront-sdk 0.164.0 → 0.165.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 +167 -161
- 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,38 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as c, useMemo as u, useEffect as
|
|
3
|
-
import { toast as
|
|
4
|
-
import { useForm as
|
|
5
|
-
import { useParams as
|
|
6
|
-
import { ArrowLeft as
|
|
7
|
-
import { useTranslation as
|
|
8
|
-
import { apiPost as
|
|
9
|
-
import { ROUTE as
|
|
10
|
-
import { ROUTE as
|
|
11
|
-
import { ROUTE as
|
|
12
|
-
import { ROUTE as
|
|
13
|
-
import { resolveBookingSearchParamsFromSessionStorage as
|
|
14
|
-
import { buildStorefrontCartSummary as
|
|
15
|
-
import { useStorefrontCart as
|
|
16
|
-
import { useStorefront as
|
|
17
|
-
import { BookingFlowSteps as
|
|
18
|
-
import { Button as
|
|
19
|
-
import { CheckoutDetailsCard as
|
|
20
|
-
import { CheckoutPaymentSummaryCard as
|
|
21
|
-
import { CheckoutSummaryColumn as
|
|
22
|
-
import { FulfillmentSection as
|
|
23
|
-
import { checkoutFormSchema as
|
|
24
|
-
const
|
|
1
|
+
import { jsx as r, jsxs as _ } from "react/jsx-runtime";
|
|
2
|
+
import { useState as c, useMemo as u, useEffect as $ } from "react";
|
|
3
|
+
import { toast as J } from "@rpcbase/client";
|
|
4
|
+
import { useForm as tt, zodResolver as ot } from "@rpcbase/form";
|
|
5
|
+
import { useParams as nt, useSearchParams as at, useNavigate as rt, Link as Se } from "@rpcbase/router";
|
|
6
|
+
import { ArrowLeft as Me } from "lucide-react";
|
|
7
|
+
import { useTranslation as st } from "react-i18next";
|
|
8
|
+
import { apiPost as B } from "../lib/apiCall.js";
|
|
9
|
+
import { ROUTE as it, responseSchema as lt } from "../lib/checkoutPaymentDecision.js";
|
|
10
|
+
import { ROUTE as ct, responseSchema as ut } from "../lib/checkoutVerifyCoupon.js";
|
|
11
|
+
import { ROUTE as dt, responseSchema as mt } from "../lib/checkoutSubmit.js";
|
|
12
|
+
import { getValidStorefrontAvailabilitySchedule as pt, ROUTE as ht, responseSchema as ft, buildStorefrontAvailabilityKey as Pe, getStorefrontAvailabilityIssue as gt } from "../lib/storefrontAvailability.js";
|
|
13
|
+
import { resolveBookingSearchParamsFromSessionStorage as yt, getBookingParamsFromSearch as _t, getBookingDurationLabel as bt, getBookingDurationMinutes as kt, applyBookingParamsToSearch as xe, writeBookingSearchParamsToSessionStorage as Ae } from "../lib/booking.js";
|
|
14
|
+
import { buildStorefrontCartSummary as Ct } from "../lib/cartSummary.js";
|
|
15
|
+
import { useStorefrontCart as vt } from "../lib/cart.js";
|
|
16
|
+
import { useStorefront as St, useStorefrontProducts as Mt } from "../StorefrontProvider.js";
|
|
17
|
+
import { BookingFlowSteps as Pt } from "../components/BookingFlowSteps/index.js";
|
|
18
|
+
import { Button as Te } from "../ui/button.js";
|
|
19
|
+
import { CheckoutDetailsCard as xt } from "./checkout/components/CheckoutDetailsCard.js";
|
|
20
|
+
import { CheckoutPaymentSummaryCard as At } from "./checkout/components/CheckoutPaymentSummaryCard.js";
|
|
21
|
+
import { CheckoutSummaryColumn as Tt } from "./checkout/components/CheckoutSummaryColumn.js";
|
|
22
|
+
import { FulfillmentSection as Dt } from "../components/FulfillmentSection/index.js";
|
|
23
|
+
import { checkoutFormSchema as wt } from "./checkout/types.js";
|
|
24
|
+
const De = 0.2, It = (o) => o <= 0 ? 1 : Math.max(1, Math.ceil(o / 1440)), g = (o, a, p) => {
|
|
25
25
|
try {
|
|
26
26
|
return new Intl.NumberFormat(p, {
|
|
27
27
|
style: "currency",
|
|
28
|
-
currency:
|
|
28
|
+
currency: a.toUpperCase()
|
|
29
29
|
}).format(o / 100);
|
|
30
30
|
} catch {
|
|
31
|
-
return `${(o / 100).toFixed(2)} ${
|
|
31
|
+
return `${(o / 100).toFixed(2)} ${a.toUpperCase()}`;
|
|
32
32
|
}
|
|
33
|
-
},
|
|
33
|
+
}, X = (o, a) => {
|
|
34
34
|
try {
|
|
35
|
-
return new Intl.NumberFormat(
|
|
35
|
+
return new Intl.NumberFormat(a, {
|
|
36
36
|
style: "percent",
|
|
37
37
|
minimumFractionDigits: 0,
|
|
38
38
|
maximumFractionDigits: 2
|
|
@@ -40,100 +40,100 @@ const Pe = 0.2, At = (o) => o <= 0 ? 1 : Math.max(1, Math.ceil(o / 1440)), _ = (
|
|
|
40
40
|
} catch {
|
|
41
41
|
return `${Math.round(o * 100)}%`;
|
|
42
42
|
}
|
|
43
|
-
},
|
|
44
|
-
const
|
|
43
|
+
}, Lt = (o, a, p) => {
|
|
44
|
+
const M = {
|
|
45
45
|
dateStyle: "medium",
|
|
46
46
|
timeStyle: "short"
|
|
47
47
|
};
|
|
48
48
|
if (p)
|
|
49
49
|
try {
|
|
50
|
-
return new Intl.DateTimeFormat(
|
|
50
|
+
return new Intl.DateTimeFormat(a, { ...M, timeZone: p }).format(o);
|
|
51
51
|
} catch {
|
|
52
52
|
}
|
|
53
|
-
return new Intl.DateTimeFormat(
|
|
53
|
+
return new Intl.DateTimeFormat(a, M).format(o);
|
|
54
54
|
};
|
|
55
|
-
function
|
|
56
|
-
const { t: o, i18n:
|
|
57
|
-
() =>
|
|
58
|
-
[
|
|
59
|
-
),
|
|
60
|
-
const e =
|
|
61
|
-
return e.fulfillment === "delivery" && !
|
|
62
|
-
}, [
|
|
63
|
-
() =>
|
|
64
|
-
items:
|
|
65
|
-
language:
|
|
66
|
-
fallbackLanguage:
|
|
67
|
-
products: { bikes:
|
|
68
|
-
estimatedDays:
|
|
55
|
+
function oo() {
|
|
56
|
+
const { t: o, i18n: a } = st(), { storefrontConfiguration: p } = St(), M = p.workspace?.workspaceLanguage, { bikes: Y, accessories: ee } = Mt(), { storeSlug: i } = nt(), [P, we] = at(), Ie = rt(), { items: te, itemCount: Le, setQuantity: Re, removeItem: Ne, clear: Ee } = vt(), [O, oe] = c(!1), [l, T] = c(null), [ne, V] = c(!1), [ae, D] = c(null), re = P.get("coupon") ?? P.get("code") ?? "", [se, q] = c(re), [ie, le] = c(re.trim()), [y, x] = c(null), [ce, w] = c(null), [ue, H] = c(!1), [Fe, b] = c(null), [de, k] = c(null), [K, me] = c(!1), pe = u(
|
|
57
|
+
() => yt(P, i),
|
|
58
|
+
[P, i]
|
|
59
|
+
), I = p.settings.fulfillmentModes.includes("delivery"), he = p.settings.deliveryDisabledReason.trim(), Ue = I || he.length > 0, $e = p.shop.address?.trim() ?? "", t = u(() => {
|
|
60
|
+
const e = _t(pe);
|
|
61
|
+
return e.fulfillment === "delivery" && !I ? { ...e, fulfillment: "pickup" } : e;
|
|
62
|
+
}, [pe, I]), Be = u(() => bt(t), [t]), fe = u(() => kt(t), [t]), ge = u(() => It(fe), [fe]), d = u(
|
|
63
|
+
() => Ct({
|
|
64
|
+
items: te,
|
|
65
|
+
language: a.language,
|
|
66
|
+
fallbackLanguage: M,
|
|
67
|
+
products: { bikes: Y, accessories: ee },
|
|
68
|
+
estimatedDays: ge
|
|
69
69
|
}),
|
|
70
|
-
[
|
|
71
|
-
),
|
|
70
|
+
[ee, Y, ge, a.language, te, M]
|
|
71
|
+
), Q = u(
|
|
72
72
|
() => d.lines.map((e) => ({
|
|
73
73
|
productId: e.checkoutProductId,
|
|
74
74
|
productVariantId: e.productVariantId,
|
|
75
75
|
quantity: e.quantity
|
|
76
76
|
})),
|
|
77
77
|
[d.lines]
|
|
78
|
-
), [
|
|
79
|
-
|
|
80
|
-
if (!
|
|
81
|
-
|
|
78
|
+
), [ye, L] = c([]), [j, R] = c(!1);
|
|
79
|
+
$(() => {
|
|
80
|
+
if (!i || Q.length === 0) {
|
|
81
|
+
L([]), R(!1);
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
const e = pt(t);
|
|
85
|
+
if (!e) {
|
|
86
|
+
R(!1);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
let s = !1;
|
|
90
|
+
return R(!0), L([]), (async () => {
|
|
86
91
|
try {
|
|
87
|
-
const
|
|
88
|
-
|
|
92
|
+
const n = await B(
|
|
93
|
+
ht,
|
|
89
94
|
{
|
|
90
|
-
storeSlug:
|
|
91
|
-
schedule:
|
|
92
|
-
|
|
93
|
-
endDate: t.end_date,
|
|
94
|
-
startTime: t.start_time,
|
|
95
|
-
endTime: t.end_time
|
|
96
|
-
},
|
|
97
|
-
products: q
|
|
95
|
+
storeSlug: i,
|
|
96
|
+
schedule: e,
|
|
97
|
+
products: Q
|
|
98
98
|
}
|
|
99
|
-
),
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
} catch (
|
|
103
|
-
if (
|
|
104
|
-
console.error("Failed to load checkout cart availability",
|
|
99
|
+
), S = ft.parse(n);
|
|
100
|
+
if (s) return;
|
|
101
|
+
L(S.success ? S.availability ?? [] : []);
|
|
102
|
+
} catch (n) {
|
|
103
|
+
if (s) return;
|
|
104
|
+
console.error("Failed to load checkout cart availability", n), L([]);
|
|
105
105
|
} finally {
|
|
106
|
-
|
|
106
|
+
s || R(!1);
|
|
107
107
|
}
|
|
108
108
|
})(), () => {
|
|
109
|
-
|
|
109
|
+
s = !0;
|
|
110
110
|
};
|
|
111
111
|
}, [
|
|
112
112
|
t.end_date,
|
|
113
113
|
t.end_time,
|
|
114
114
|
t.start_date,
|
|
115
115
|
t.start_time,
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
Q,
|
|
117
|
+
i
|
|
118
118
|
]);
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
const _e = u(() => new Map(
|
|
120
|
+
ye.map((e) => [
|
|
121
|
+
Pe(e.productId, e.productVariantId),
|
|
122
122
|
e
|
|
123
123
|
])
|
|
124
|
-
), [
|
|
124
|
+
), [ye]), N = u(
|
|
125
125
|
() => ({
|
|
126
126
|
...d,
|
|
127
127
|
lines: d.lines.map((e) => {
|
|
128
|
-
const
|
|
128
|
+
const s = _e.get(Pe(e.checkoutProductId, e.productVariantId)), n = s ? gt(s) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
|
|
129
129
|
return {
|
|
130
130
|
...e,
|
|
131
|
-
insufficientCapacity: !
|
|
132
|
-
availabilityIssue:
|
|
131
|
+
insufficientCapacity: !j && n !== void 0,
|
|
132
|
+
availabilityIssue: j ? void 0 : n
|
|
133
133
|
};
|
|
134
134
|
})
|
|
135
135
|
}),
|
|
136
|
-
[
|
|
136
|
+
[_e, j, d]
|
|
137
137
|
), C = u(
|
|
138
138
|
() => d.lines.map((e) => ({
|
|
139
139
|
kind: e.kind,
|
|
@@ -142,30 +142,30 @@ function Yt() {
|
|
|
142
142
|
quantity: e.quantity
|
|
143
143
|
})),
|
|
144
144
|
[d.lines]
|
|
145
|
-
),
|
|
146
|
-
resolver:
|
|
145
|
+
), Oe = d.estimatedTotalMinor ?? d.totalPerDayMinor, v = ce?.totalMinor ?? Oe, A = y?.discountAmountMinor ?? 0, E = xe(new URLSearchParams(), t).toString(), z = `/${i ?? ""}/booking${E ? `?${E}` : ""}`, Ve = `/${i ?? ""}/checkout${E ? `?${E}` : ""}`, be = tt({
|
|
146
|
+
resolver: ot(wt),
|
|
147
147
|
defaultValues: { full_name: "", email: "", phone: "", notes: "" }
|
|
148
148
|
});
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}, [t,
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
|
|
149
|
+
$(() => {
|
|
150
|
+
Ae(i, t);
|
|
151
|
+
}, [t, i]);
|
|
152
|
+
const W = (e) => {
|
|
153
|
+
const s = { ...t, ...e }, n = xe(P, s);
|
|
154
|
+
we(n, { replace: !0 }), Ae(i, n);
|
|
155
155
|
};
|
|
156
|
-
|
|
157
|
-
if (!
|
|
158
|
-
x(null),
|
|
156
|
+
$(() => {
|
|
157
|
+
if (!i || C.length === 0) {
|
|
158
|
+
x(null), w(null), H(!1), b(null), k(null);
|
|
159
159
|
return;
|
|
160
160
|
}
|
|
161
|
-
const e =
|
|
161
|
+
const e = ie.trim(), s = e.length === 0 && !K;
|
|
162
162
|
let n = !1;
|
|
163
|
-
return
|
|
163
|
+
return H(!0), k(null), b(null), (async () => {
|
|
164
164
|
try {
|
|
165
|
-
const
|
|
166
|
-
|
|
165
|
+
const S = await B(
|
|
166
|
+
ct,
|
|
167
167
|
{
|
|
168
|
-
storeSlug:
|
|
168
|
+
storeSlug: i,
|
|
169
169
|
schedule: {
|
|
170
170
|
startDate: t.start_date,
|
|
171
171
|
endDate: t.end_date,
|
|
@@ -174,11 +174,11 @@ function Yt() {
|
|
|
174
174
|
},
|
|
175
175
|
items: C,
|
|
176
176
|
couponCode: e || void 0,
|
|
177
|
-
includeAutoApply:
|
|
177
|
+
includeAutoApply: s
|
|
178
178
|
}
|
|
179
|
-
), m =
|
|
179
|
+
), m = ut.parse(S);
|
|
180
180
|
if (n) return;
|
|
181
|
-
if (
|
|
181
|
+
if (w(
|
|
182
182
|
typeof m.subtotalMinor == "number" && typeof m.totalMinor == "number" ? {
|
|
183
183
|
subtotalMinor: m.subtotalMinor,
|
|
184
184
|
totalMinor: m.totalMinor,
|
|
@@ -188,38 +188,38 @@ function Yt() {
|
|
|
188
188
|
x(null), k(m.message || o("checkout_coupon_invalid"));
|
|
189
189
|
return;
|
|
190
190
|
}
|
|
191
|
-
x(m.coupon ?? null), m.coupon && (m.coupon.autoApplied && e.length === 0 ? (
|
|
192
|
-
} catch (
|
|
191
|
+
x(m.coupon ?? null), m.coupon && (m.coupon.autoApplied && e.length === 0 ? (q(m.coupon.code), b(o("checkout_coupon_auto_applied", { code: m.coupon.code }))) : b(o("checkout_coupon_manual_applied")));
|
|
192
|
+
} catch (S) {
|
|
193
193
|
if (n) return;
|
|
194
|
-
console.error("Failed to verify checkout coupon",
|
|
194
|
+
console.error("Failed to verify checkout coupon", S), x(null), w(null), k(o("checkout_coupon_error"));
|
|
195
195
|
} finally {
|
|
196
|
-
n ||
|
|
196
|
+
n || H(!1);
|
|
197
197
|
}
|
|
198
198
|
})(), () => {
|
|
199
199
|
n = !0;
|
|
200
200
|
};
|
|
201
201
|
}, [
|
|
202
|
-
|
|
202
|
+
K,
|
|
203
203
|
t.end_date,
|
|
204
204
|
t.end_time,
|
|
205
205
|
t.start_date,
|
|
206
206
|
t.start_time,
|
|
207
207
|
C,
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
i,
|
|
209
|
+
ie,
|
|
210
210
|
o
|
|
211
|
-
]),
|
|
212
|
-
if (!
|
|
213
|
-
T(null),
|
|
211
|
+
]), $(() => {
|
|
212
|
+
if (!i || d.lines.length === 0) {
|
|
213
|
+
T(null), D(null), V(!1);
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
216
|
let e = !1;
|
|
217
|
-
return
|
|
217
|
+
return V(!0), D(null), (async () => {
|
|
218
218
|
try {
|
|
219
|
-
const
|
|
220
|
-
|
|
219
|
+
const s = await B(
|
|
220
|
+
it,
|
|
221
221
|
{
|
|
222
|
-
storeSlug:
|
|
222
|
+
storeSlug: i,
|
|
223
223
|
schedule: {
|
|
224
224
|
startDate: t.start_date,
|
|
225
225
|
endDate: t.end_date,
|
|
@@ -228,18 +228,18 @@ function Yt() {
|
|
|
228
228
|
},
|
|
229
229
|
estimatedTotalMinor: v
|
|
230
230
|
}
|
|
231
|
-
), n =
|
|
231
|
+
), n = lt.parse(s);
|
|
232
232
|
if (e) return;
|
|
233
233
|
if (!n.success || !n.decision) {
|
|
234
|
-
T(null),
|
|
234
|
+
T(null), D(n.message || o("checkout_payment_error"));
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
237
|
T(n.decision);
|
|
238
|
-
} catch (
|
|
238
|
+
} catch (s) {
|
|
239
239
|
if (e) return;
|
|
240
|
-
console.error("Failed to load checkout payment decision",
|
|
240
|
+
console.error("Failed to load checkout payment decision", s), T(null), D(o("checkout_payment_error"));
|
|
241
241
|
} finally {
|
|
242
|
-
e ||
|
|
242
|
+
e || V(!1);
|
|
243
243
|
}
|
|
244
244
|
})(), () => {
|
|
245
245
|
e = !0;
|
|
@@ -251,36 +251,44 @@ function Yt() {
|
|
|
251
251
|
t.start_time,
|
|
252
252
|
v,
|
|
253
253
|
d.lines.length,
|
|
254
|
-
|
|
254
|
+
i,
|
|
255
255
|
o
|
|
256
256
|
]);
|
|
257
|
-
const
|
|
257
|
+
const f = l?.currency ?? "EUR", qe = g(v, f, a.language), He = A > 0 ? `-${g(A, f, a.language)}` : null, ke = Math.round(v / (1 + De)), Ke = Math.max(0, v - ke), Qe = g(ke, f, a.language), je = g(Ke, f, a.language), ze = X(De, a.language), h = l?.amountToCollectMinor ?? 0, We = g(h, f, a.language), Ze = l?.paymentMode === "deposit" && h > 0 ? g(h, f, a.language) : null, Ge = l?.shouldCollectOnlinePayment === !0 && h > 0, Ce = p.shop.timeZone?.trim() || void 0, F = u(() => {
|
|
258
258
|
if (!l) return null;
|
|
259
259
|
const e = Math.max(0, Math.min(1, l.bookingDepositPercentage));
|
|
260
|
-
return
|
|
261
|
-
}, [
|
|
260
|
+
return X(e, a.language);
|
|
261
|
+
}, [a.language, l]), Z = u(() => {
|
|
262
262
|
if (!l?.depositRefundableUntilIso) return null;
|
|
263
263
|
const e = new Date(l.depositRefundableUntilIso);
|
|
264
|
-
return Number.isNaN(e.getTime()) ? null :
|
|
265
|
-
}, [
|
|
266
|
-
percent:
|
|
267
|
-
|
|
268
|
-
}) :
|
|
269
|
-
|
|
270
|
-
|
|
264
|
+
return Number.isNaN(e.getTime()) ? null : Lt(e, a.language, Ce);
|
|
265
|
+
}, [a.language, l?.depositRefundableUntilIso, Ce]), G = l?.cancellationQuote, U = G?.policyEnabled ? o("checkout_payment_cancellation_policy_helper", {
|
|
266
|
+
percent: X(G.refundPercentage, a.language),
|
|
267
|
+
amount: g(G.refundableAmountMinor, f, a.language)
|
|
268
|
+
}) : null, Je = u(() => {
|
|
269
|
+
if (!l) return null;
|
|
270
|
+
const e = (s) => [s, U].filter(Boolean).join(" ");
|
|
271
|
+
return l.paymentMode === "deposit" && h > 0 && F ? e(Z ? o("checkout_payment_due_now_helper_deposit_refundable_until", {
|
|
272
|
+
percent: F,
|
|
273
|
+
date: Z
|
|
274
|
+
}) : o("checkout_payment_due_now_helper_deposit", {
|
|
275
|
+
percent: F
|
|
276
|
+
})) : l.paymentMode === "full" && h > 0 ? U : l.paymentMode === "none" || h <= 0 ? e(o("checkout_payment_due_now_helper_none")) : U;
|
|
277
|
+
}, [
|
|
271
278
|
h,
|
|
272
|
-
|
|
273
|
-
|
|
279
|
+
F,
|
|
280
|
+
U,
|
|
281
|
+
Z,
|
|
274
282
|
l,
|
|
275
283
|
o
|
|
276
|
-
]),
|
|
277
|
-
if (!(!
|
|
278
|
-
|
|
284
|
+
]), Xe = be.handleSubmit(async (e) => {
|
|
285
|
+
if (!(!i || C.length === 0)) {
|
|
286
|
+
oe(!0);
|
|
279
287
|
try {
|
|
280
|
-
const
|
|
281
|
-
|
|
288
|
+
const s = await B(
|
|
289
|
+
dt,
|
|
282
290
|
{
|
|
283
|
-
storeSlug:
|
|
291
|
+
storeSlug: i,
|
|
284
292
|
schedule: {
|
|
285
293
|
startDate: t.start_date,
|
|
286
294
|
endDate: t.end_date,
|
|
@@ -290,8 +298,8 @@ function Yt() {
|
|
|
290
298
|
fulfillment: t.fulfillment,
|
|
291
299
|
startAddress: t.fulfillment === "delivery" ? t.start_address : void 0,
|
|
292
300
|
endAddress: t.fulfillment === "delivery" ? t.end_address : void 0,
|
|
293
|
-
couponCode:
|
|
294
|
-
couponAutoApplied:
|
|
301
|
+
couponCode: y?.code,
|
|
302
|
+
couponAutoApplied: K ? !1 : y?.autoApplied,
|
|
295
303
|
customer: {
|
|
296
304
|
fullName: e.full_name,
|
|
297
305
|
email: e.email,
|
|
@@ -300,123 +308,123 @@ function Yt() {
|
|
|
300
308
|
},
|
|
301
309
|
items: C
|
|
302
310
|
}
|
|
303
|
-
), n =
|
|
311
|
+
), n = mt.parse(s);
|
|
304
312
|
if (!n.success || !n.checkout) {
|
|
305
|
-
|
|
313
|
+
J.error(n.message || o("checkout_payment_error"));
|
|
306
314
|
return;
|
|
307
315
|
}
|
|
308
|
-
n.checkout.requiresPayment ||
|
|
309
|
-
} catch (
|
|
310
|
-
console.error("Failed to submit storefront checkout",
|
|
316
|
+
n.checkout.requiresPayment || J.success(o("checkout_success_toast")), await Ie(n.checkout.nextPath), Ee();
|
|
317
|
+
} catch (s) {
|
|
318
|
+
console.error("Failed to submit storefront checkout", s), J.error(o("checkout_payment_error"));
|
|
311
319
|
} finally {
|
|
312
|
-
|
|
320
|
+
oe(!1);
|
|
313
321
|
}
|
|
314
322
|
}
|
|
315
|
-
}),
|
|
316
|
-
return d.lines.length === 0 ? /* @__PURE__ */
|
|
317
|
-
/* @__PURE__ */
|
|
318
|
-
/* @__PURE__ */
|
|
319
|
-
/* @__PURE__ */
|
|
320
|
-
/* @__PURE__ */
|
|
321
|
-
/* @__PURE__ */
|
|
323
|
+
}), Ye = o(Ge ? "checkout_continue_to_payment" : "checkout_submit"), ve = t.fulfillment === "delivery" && t.start_address.trim().length === 0, et = !O && !ne && !ae && !ue && !de && !!l && !ve && C.length > 0;
|
|
324
|
+
return d.lines.length === 0 ? /* @__PURE__ */ r("div", { className: "mx-auto max-w-3xl px-4 py-10 sm:px-6", children: /* @__PURE__ */ _("div", { className: "rounded-xl border border-slate-200 bg-white p-4 shadow-sm", children: [
|
|
325
|
+
/* @__PURE__ */ r("h1", { className: "text-xl font-semibold tracking-tight text-slate-950", children: /* @__PURE__ */ r("span", { children: o("cart_empty_title") }) }),
|
|
326
|
+
/* @__PURE__ */ r("p", { className: "mt-2 text-sm text-slate-600", children: /* @__PURE__ */ r("span", { children: o("cart_empty_description") }) }),
|
|
327
|
+
/* @__PURE__ */ r("div", { className: "mt-6", children: /* @__PURE__ */ r(Se, { to: z, children: /* @__PURE__ */ _(Te, { className: "gap-2", children: [
|
|
328
|
+
/* @__PURE__ */ r(Me, { className: "h-4 w-4", "aria-hidden": "true" }),
|
|
329
|
+
/* @__PURE__ */ r("span", { children: o("back_to_booking") })
|
|
322
330
|
] }) }) })
|
|
323
|
-
] }) }) : /* @__PURE__ */
|
|
324
|
-
/* @__PURE__ */
|
|
325
|
-
/* @__PURE__ */
|
|
326
|
-
/* @__PURE__ */
|
|
327
|
-
/* @__PURE__ */
|
|
331
|
+
] }) }) : /* @__PURE__ */ r("div", { className: "mx-auto max-w-7xl px-4 py-8 sm:px-6", children: /* @__PURE__ */ _("div", { className: "flex flex-col gap-6", children: [
|
|
332
|
+
/* @__PURE__ */ r(Pt, { currentStep: "checkout", bookingPath: z, checkoutPath: Ve }),
|
|
333
|
+
/* @__PURE__ */ _(Se, { to: z, className: "inline-flex items-center gap-2 text-sm font-medium text-slate-700 hover:text-slate-950", children: [
|
|
334
|
+
/* @__PURE__ */ r(Me, { className: "h-4 w-4", "aria-hidden": "true" }),
|
|
335
|
+
/* @__PURE__ */ r("span", { children: o("back_to_booking") })
|
|
328
336
|
] }),
|
|
329
|
-
/* @__PURE__ */
|
|
330
|
-
/* @__PURE__ */
|
|
331
|
-
/* @__PURE__ */
|
|
332
|
-
/* @__PURE__ */
|
|
333
|
-
|
|
334
|
-
|
|
337
|
+
/* @__PURE__ */ _("div", { className: "grid gap-6 lg:grid-cols-12", children: [
|
|
338
|
+
/* @__PURE__ */ _("div", { className: "lg:col-span-7", children: [
|
|
339
|
+
/* @__PURE__ */ r("h1", { className: "text-xl font-semibold tracking-tight text-slate-950", children: /* @__PURE__ */ r("span", { children: o("checkout_title") }) }),
|
|
340
|
+
/* @__PURE__ */ _("div", { className: "mt-5 grid gap-4", children: [
|
|
341
|
+
Ue ? /* @__PURE__ */ r("div", { className: "rounded-xl border border-slate-200 bg-white p-3 shadow-sm", children: /* @__PURE__ */ r(
|
|
342
|
+
Dt,
|
|
335
343
|
{
|
|
336
344
|
value: t.fulfillment,
|
|
337
|
-
onValueChange: (e) =>
|
|
338
|
-
pickupAddress:
|
|
339
|
-
deliveryEnabled:
|
|
340
|
-
deliveryDisabledReason:
|
|
345
|
+
onValueChange: (e) => W({ fulfillment: e }),
|
|
346
|
+
pickupAddress: $e,
|
|
347
|
+
deliveryEnabled: I,
|
|
348
|
+
deliveryDisabledReason: he,
|
|
341
349
|
startAddress: t.start_address,
|
|
342
|
-
onStartAddressChange: (e) =>
|
|
350
|
+
onStartAddressChange: (e) => W({ start_address: e }),
|
|
343
351
|
endAddress: t.end_address,
|
|
344
|
-
onEndAddressChange: (e) =>
|
|
352
|
+
onEndAddressChange: (e) => W({ end_address: e }),
|
|
345
353
|
showPickupAddressWhenPickupOnly: !1,
|
|
346
354
|
testIdPrefix: "storefront-checkout-fulfillment"
|
|
347
355
|
}
|
|
348
356
|
) }) : null,
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
|
|
357
|
+
/* @__PURE__ */ r(xt, { form: be }),
|
|
358
|
+
/* @__PURE__ */ r(
|
|
359
|
+
At,
|
|
352
360
|
{
|
|
353
|
-
estimatedTotalLabel:
|
|
354
|
-
couponCode:
|
|
355
|
-
discountAmountLabel:
|
|
356
|
-
totalExcludingTaxLabel:
|
|
357
|
-
vatAmountLabel:
|
|
358
|
-
vatRateLabel:
|
|
359
|
-
depositAmountLabel:
|
|
361
|
+
estimatedTotalLabel: qe,
|
|
362
|
+
couponCode: y?.code,
|
|
363
|
+
discountAmountLabel: He,
|
|
364
|
+
totalExcludingTaxLabel: Qe,
|
|
365
|
+
vatAmountLabel: je,
|
|
366
|
+
vatRateLabel: ze,
|
|
367
|
+
depositAmountLabel: Ze,
|
|
360
368
|
amountToCollectMinor: h,
|
|
361
|
-
amountToCollectLabel:
|
|
362
|
-
paymentSummaryHelper:
|
|
363
|
-
paymentDecisionLoading:
|
|
364
|
-
paymentDecisionError:
|
|
369
|
+
amountToCollectLabel: We,
|
|
370
|
+
paymentSummaryHelper: Je,
|
|
371
|
+
paymentDecisionLoading: ne,
|
|
372
|
+
paymentDecisionError: ae,
|
|
365
373
|
canChoosePaymentMethod: !1,
|
|
366
374
|
showAmountDueNowRow: !0,
|
|
367
375
|
selectedPaymentMethod: "card",
|
|
368
|
-
submitting:
|
|
376
|
+
submitting: O,
|
|
369
377
|
onSelectPaymentMethod: () => {
|
|
370
378
|
}
|
|
371
379
|
}
|
|
372
380
|
),
|
|
373
|
-
/* @__PURE__ */
|
|
374
|
-
|
|
381
|
+
/* @__PURE__ */ r(
|
|
382
|
+
Te,
|
|
375
383
|
{
|
|
376
384
|
type: "button",
|
|
377
385
|
size: "lg",
|
|
378
386
|
onClick: () => {
|
|
379
|
-
|
|
387
|
+
Xe();
|
|
380
388
|
},
|
|
381
|
-
disabled: !
|
|
389
|
+
disabled: !et,
|
|
382
390
|
className: "mt-4 w-fit",
|
|
383
|
-
children: /* @__PURE__ */
|
|
391
|
+
children: /* @__PURE__ */ r("span", { children: Ye })
|
|
384
392
|
}
|
|
385
393
|
),
|
|
386
|
-
|
|
394
|
+
ve ? /* @__PURE__ */ r("p", { className: "text-sm text-slate-600", children: /* @__PURE__ */ r("span", { children: o("checkout_delivery_address_required") }) }) : null
|
|
387
395
|
] })
|
|
388
396
|
] }),
|
|
389
|
-
/* @__PURE__ */
|
|
390
|
-
|
|
397
|
+
/* @__PURE__ */ r(
|
|
398
|
+
Tt,
|
|
391
399
|
{
|
|
392
|
-
lines:
|
|
393
|
-
itemCount:
|
|
394
|
-
totalPerDayMinor:
|
|
395
|
-
estimatedDays:
|
|
396
|
-
estimatedTotalMinor:
|
|
400
|
+
lines: N.lines,
|
|
401
|
+
itemCount: Le,
|
|
402
|
+
totalPerDayMinor: N.totalPerDayMinor,
|
|
403
|
+
estimatedDays: N.estimatedDays,
|
|
404
|
+
estimatedTotalMinor: N.estimatedTotalMinor,
|
|
397
405
|
discountedEstimatedTotalMinor: v,
|
|
398
|
-
discountAmountMinor:
|
|
399
|
-
lateReturnSurchargeMinor:
|
|
400
|
-
couponCode:
|
|
401
|
-
durationLabel:
|
|
402
|
-
onQuantityChange:
|
|
403
|
-
onRemove:
|
|
406
|
+
discountAmountMinor: A,
|
|
407
|
+
lateReturnSurchargeMinor: ce?.lateReturnSurchargeMinor,
|
|
408
|
+
couponCode: y?.code,
|
|
409
|
+
durationLabel: Be.label,
|
|
410
|
+
onQuantityChange: Re,
|
|
411
|
+
onRemove: Ne,
|
|
404
412
|
coupon: {
|
|
405
|
-
code:
|
|
406
|
-
appliedCode:
|
|
407
|
-
discountLabel:
|
|
408
|
-
message:
|
|
409
|
-
error:
|
|
410
|
-
loading:
|
|
411
|
-
disabled:
|
|
413
|
+
code: se,
|
|
414
|
+
appliedCode: y?.code,
|
|
415
|
+
discountLabel: y && A > 0 ? g(A, f, a.language) : null,
|
|
416
|
+
message: Fe,
|
|
417
|
+
error: de,
|
|
418
|
+
loading: ue,
|
|
419
|
+
disabled: O,
|
|
412
420
|
onCodeChange: (e) => {
|
|
413
|
-
|
|
421
|
+
q(e), k(null), b(null);
|
|
414
422
|
},
|
|
415
423
|
onApply: () => {
|
|
416
|
-
|
|
424
|
+
me(!1), le(se.trim());
|
|
417
425
|
},
|
|
418
426
|
onRemove: () => {
|
|
419
|
-
|
|
427
|
+
q(""), le(""), x(null), w(null), k(null), b(null), me(!0);
|
|
420
428
|
}
|
|
421
429
|
}
|
|
422
430
|
}
|
|
@@ -425,5 +433,5 @@ function Yt() {
|
|
|
425
433
|
] }) });
|
|
426
434
|
}
|
|
427
435
|
export {
|
|
428
|
-
|
|
436
|
+
oo as default
|
|
429
437
|
};
|