@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,8 +1,8 @@
|
|
|
1
|
-
import { useMemo as
|
|
1
|
+
import { useMemo as c, useState as C, useRef as N, useCallback as p, useEffect as k } from "react";
|
|
2
2
|
import { differenceInCalendarDays as De } from "date-fns";
|
|
3
|
-
import { fr as
|
|
4
|
-
import { useMediaQuery as
|
|
5
|
-
import { createBookingPeriodConstants as
|
|
3
|
+
import { fr as at, de as ot, es as lt, it as ut, enUS as ct } from "date-fns/locale";
|
|
4
|
+
import { useMediaQuery as ft } from "@rpcbase/client";
|
|
5
|
+
import { createBookingPeriodConstants as dt, parseTimeToMinutes as R, dateToBusinessDateString as mt, instantToBusinessDateTimeParts as St, businessDateStringToDate as Tt, getWeekdayFromDateString as Dt, minutesToTimeString as pt } from "../../lib/booking-period.js";
|
|
6
6
|
import { getBookingPeriodTimeSlotsSync as pe } from "../../lib/booking-period-time-slots.js";
|
|
7
7
|
const gt = (s) => s, ht = {
|
|
8
8
|
startDate: "Start date",
|
|
@@ -11,393 +11,387 @@ const gt = (s) => s, ht = {
|
|
|
11
11
|
endDate: "End date",
|
|
12
12
|
pickEndDate: "Pick a date",
|
|
13
13
|
endTime: "End time"
|
|
14
|
-
},
|
|
14
|
+
}, vt = ({
|
|
15
15
|
locale: s,
|
|
16
16
|
localeCode: n
|
|
17
17
|
}) => {
|
|
18
18
|
if (s)
|
|
19
19
|
return s;
|
|
20
|
-
const
|
|
21
|
-
return
|
|
22
|
-
},
|
|
20
|
+
const i = n?.toLowerCase() ?? "";
|
|
21
|
+
return i.startsWith("fr") ? at : i.startsWith("de") ? ot : i.startsWith("es") ? lt : i.startsWith("it") ? ut : ct;
|
|
22
|
+
}, Et = (s) => {
|
|
23
23
|
if (!s?.length)
|
|
24
24
|
return null;
|
|
25
25
|
const n = s.map((r) => R(r.value)).filter((r) => typeof r == "number").sort((r, K) => r - K);
|
|
26
26
|
if (n.length < 2)
|
|
27
27
|
return null;
|
|
28
|
-
const
|
|
29
|
-
return !Number.isFinite(
|
|
30
|
-
},
|
|
28
|
+
const i = n[1] - n[0];
|
|
29
|
+
return !Number.isFinite(i) || i <= 0 ? null : i;
|
|
30
|
+
}, bt = (s) => {
|
|
31
31
|
if (typeof s != "string")
|
|
32
32
|
return null;
|
|
33
33
|
const n = s.match(/(\d{1,2}:\d{2})\s*-\s*(\d{1,2}:\d{2})/);
|
|
34
34
|
return n ? R(n[2]) : null;
|
|
35
|
-
}, Ae = (s, n) => s.map((
|
|
36
|
-
const r = R(
|
|
35
|
+
}, Ae = (s, n) => s.map((i) => {
|
|
36
|
+
const r = R(i.value);
|
|
37
37
|
if (r == null)
|
|
38
38
|
return null;
|
|
39
|
-
const K =
|
|
39
|
+
const K = bt(i.label) ?? r + n, m = typeof i.label == "string" ? i.label : i.value;
|
|
40
40
|
return {
|
|
41
|
-
value:
|
|
42
|
-
label:
|
|
41
|
+
value: i.value,
|
|
42
|
+
label: m,
|
|
43
43
|
startMinutes: r,
|
|
44
44
|
endMinutes: K,
|
|
45
45
|
isExtra: !1,
|
|
46
|
-
isDisabled: !!
|
|
46
|
+
isDisabled: !!i.disabled
|
|
47
47
|
};
|
|
48
|
-
}).filter((
|
|
48
|
+
}).filter((i) => !!i), ge = (s) => !s.isDisabled && !s.isExtra, Mt = (s) => {
|
|
49
49
|
for (let n = s.length - 1; n >= 0; n -= 1)
|
|
50
|
-
if (
|
|
50
|
+
if (ge(s[n]))
|
|
51
51
|
return s[n];
|
|
52
52
|
return null;
|
|
53
|
-
},
|
|
53
|
+
}, yt = (s, n) => s.find((i) => ge(i) && i.startMinutes >= n) ?? null, Bt = (s) => {
|
|
54
54
|
const {
|
|
55
55
|
startDate: n,
|
|
56
|
-
onStartDateChange:
|
|
56
|
+
onStartDateChange: i,
|
|
57
57
|
startTime: r,
|
|
58
58
|
onStartTimeChange: K,
|
|
59
|
-
endDate:
|
|
59
|
+
endDate: m,
|
|
60
60
|
onEndDateChange: _,
|
|
61
|
-
endTime:
|
|
62
|
-
onEndTimeChange:
|
|
61
|
+
endTime: S,
|
|
62
|
+
onEndTimeChange: he,
|
|
63
63
|
onEndDateCommit: Q,
|
|
64
64
|
onEndTimeCommit: V,
|
|
65
|
-
errors:
|
|
66
|
-
labels:
|
|
67
|
-
t:
|
|
68
|
-
language:
|
|
69
|
-
labelClassName:
|
|
70
|
-
inputClassName:
|
|
71
|
-
buttonClassName:
|
|
65
|
+
errors: Be = {},
|
|
66
|
+
labels: Ie,
|
|
67
|
+
t: Le = gt,
|
|
68
|
+
language: ve,
|
|
69
|
+
labelClassName: xe,
|
|
70
|
+
inputClassName: Re,
|
|
71
|
+
buttonClassName: Ke,
|
|
72
72
|
bookingPeriodConfig: o,
|
|
73
|
-
fetchTimeSlots:
|
|
73
|
+
fetchTimeSlots: a,
|
|
74
74
|
selectionFlow: E = "chained-times",
|
|
75
|
-
withMobileDateDrawer:
|
|
76
|
-
currencyCode:
|
|
75
|
+
withMobileDateDrawer: He = !1,
|
|
76
|
+
currencyCode: Ue = "EUR",
|
|
77
77
|
disableAutomaticTimeCorrection: H = !1,
|
|
78
|
-
openDatePickerOnFocus:
|
|
78
|
+
openDatePickerOnFocus: We = !0,
|
|
79
79
|
startTimeOptions: U = [],
|
|
80
80
|
endTimeOptions: Ee,
|
|
81
81
|
locale: be,
|
|
82
|
-
localeCode:
|
|
83
|
-
} = s, W =
|
|
84
|
-
() =>
|
|
82
|
+
localeCode: ze
|
|
83
|
+
} = s, W = ft("(max-width: 767px)"), Y = ze ?? ve ?? "en-US", Ne = c(
|
|
84
|
+
() => vt({ locale: be, localeCode: Y }),
|
|
85
85
|
[be, Y]
|
|
86
|
-
), b =
|
|
87
|
-
() => o ?
|
|
86
|
+
), b = c(
|
|
87
|
+
() => o ? dt(o) : null,
|
|
88
88
|
[o]
|
|
89
|
-
), L =
|
|
90
|
-
|
|
91
|
-
}, []),
|
|
89
|
+
), L = c(() => o?.timing.slotIntervalMinutes ? o.timing.slotIntervalMinutes : Et(U) ?? 30, [o?.timing.slotIntervalMinutes, U]), [te, j] = C(!1), [ne, re] = C(!1), [ie, z] = C(!1), [se, ae] = C(!1), [qe, oe] = C(void 0), [$e, Ze] = C(!1), [Me, _e] = C(!1), [le, Qe] = C([]), [ye, G] = C([]), [J, q] = C(void 0), M = N(null), ue = N(0), ce = N(0), fe = N(0), Oe = N(void 0), $ = N(void 0), Ve = p(() => {
|
|
90
|
+
oe(void 0);
|
|
91
|
+
}, []), de = c(() => !n || !m ? !1 : De(m, n) === 0, [n, m]), Ye = c(() => R(r), [r]), A = p(
|
|
92
92
|
(e) => {
|
|
93
|
-
const
|
|
93
|
+
const f = (e instanceof Date ? e : e ? new Date(e) : void 0) ?? /* @__PURE__ */ new Date();
|
|
94
94
|
if (b)
|
|
95
|
-
return
|
|
96
|
-
const u =
|
|
97
|
-
return `${u}-${
|
|
95
|
+
return mt(f, b.timeZone) ?? void 0;
|
|
96
|
+
const u = f.getFullYear(), D = String(f.getMonth() + 1).padStart(2, "0"), T = String(f.getDate()).padStart(2, "0");
|
|
97
|
+
return `${u}-${D}-${T}`;
|
|
98
98
|
},
|
|
99
99
|
[b]
|
|
100
|
-
), y =
|
|
101
|
-
if (
|
|
102
|
-
return
|
|
100
|
+
), y = c(() => A(n), [n, A]), l = c(() => A(m ?? n), [m, n, A]), Ce = b ? St(/* @__PURE__ */ new Date(), b.timeZone) : null, w = Ce?.dateString, me = Ce?.minutesFromMidnight, B = c(() => w ? !!(n && y && y === w) : !!n && De(n, /* @__PURE__ */ new Date()) === 0, [n, y, w]), Z = c(() => w ? !!(m && l && l === w) : !!m && De(m, /* @__PURE__ */ new Date()) === 0, [m, l, w]), je = c(() => {
|
|
101
|
+
if (w)
|
|
102
|
+
return Tt(w);
|
|
103
103
|
const e = /* @__PURE__ */ new Date();
|
|
104
104
|
return e.setHours(0, 0, 0, 0), e;
|
|
105
|
-
}, [
|
|
105
|
+
}, [w]), Se = o?.timing.minBufferMinutes ?? 10, I = c(() => {
|
|
106
106
|
if (!B && !Z)
|
|
107
107
|
return null;
|
|
108
108
|
if (me != null)
|
|
109
109
|
return me + Se;
|
|
110
110
|
const e = /* @__PURE__ */ new Date();
|
|
111
111
|
return e.setMinutes(e.getMinutes() + Se), e.getHours() * 60 + e.getMinutes();
|
|
112
|
-
}, [me, Z, B, Se]), Te =
|
|
112
|
+
}, [me, Z, B, Se]), Te = c(
|
|
113
113
|
() => B ? I : null,
|
|
114
114
|
[I, B]
|
|
115
|
-
), we =
|
|
115
|
+
), we = p(
|
|
116
116
|
(e) => {
|
|
117
117
|
if (!b)
|
|
118
118
|
return;
|
|
119
119
|
const t = A(e);
|
|
120
120
|
if (!t)
|
|
121
121
|
return b.defaultEndTime;
|
|
122
|
-
const
|
|
122
|
+
const f = Dt(t), u = b.getLastStartMinutesForWeekday(f, {
|
|
123
123
|
dateString: t
|
|
124
124
|
});
|
|
125
|
-
return typeof u == "number" ?
|
|
125
|
+
return typeof u == "number" ? pt(u) : b.defaultEndTime;
|
|
126
126
|
},
|
|
127
127
|
[b, A]
|
|
128
128
|
);
|
|
129
|
-
|
|
130
|
-
if (!
|
|
129
|
+
k(() => {
|
|
130
|
+
if (!a || !y)
|
|
131
131
|
return;
|
|
132
132
|
let e = !0;
|
|
133
|
-
return
|
|
134
|
-
e && t &&
|
|
133
|
+
return a(y, "start").then((t) => {
|
|
134
|
+
e && t && Qe(t);
|
|
135
135
|
}).catch((t) => {
|
|
136
136
|
console.error("Failed to fetch availability time slots", t);
|
|
137
137
|
}), () => {
|
|
138
138
|
e = !1;
|
|
139
139
|
};
|
|
140
|
-
}, [
|
|
141
|
-
if (!
|
|
140
|
+
}, [a, y]), k(() => {
|
|
141
|
+
if (!a)
|
|
142
142
|
return;
|
|
143
|
-
const e =
|
|
144
|
-
|
|
145
|
-
}, [l,
|
|
146
|
-
if (!
|
|
143
|
+
const e = Oe.current, t = e !== void 0 && e !== l;
|
|
144
|
+
Oe.current = l, t && l && ($.current = l);
|
|
145
|
+
}, [l, a]), k(() => {
|
|
146
|
+
if (!a)
|
|
147
147
|
return;
|
|
148
148
|
if (!l) {
|
|
149
149
|
G([]), q(void 0);
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
152
|
let e = !0;
|
|
153
|
-
return q(void 0),
|
|
153
|
+
return q(void 0), a(l, "end").then((t) => {
|
|
154
154
|
e && (t ? (G(t), q(l)) : (G([]), q(void 0)));
|
|
155
155
|
}).catch((t) => {
|
|
156
156
|
console.error("Failed to fetch availability time slots", t), e && (G([]), q(void 0));
|
|
157
157
|
}), () => {
|
|
158
158
|
e = !1;
|
|
159
159
|
};
|
|
160
|
-
}, [l,
|
|
161
|
-
const
|
|
160
|
+
}, [l, a]);
|
|
161
|
+
const X = c(() => a || !o ? null : pe(o, {
|
|
162
162
|
date: y
|
|
163
|
-
}), [o,
|
|
163
|
+
}), [o, a, y]), Fe = c(() => !a || !o ? null : pe(o, {
|
|
164
164
|
date: y
|
|
165
|
-
}).startTimeSlots, [o,
|
|
165
|
+
}).startTimeSlots, [o, a, y]), Pe = c(() => !a || !o ? null : pe(o, {
|
|
166
166
|
date: l
|
|
167
|
-
}).endTimeSlots, [o, l,
|
|
167
|
+
}).endTimeSlots, [o, l, a]), F = c(() => a ? le.length ? le : Fe ?? [] : o ? X?.startTimeSlots ?? [] : Ae(U, L), [
|
|
168
168
|
o,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
X?.startTimeSlots,
|
|
170
|
+
Fe,
|
|
171
|
+
a,
|
|
172
|
+
le,
|
|
173
173
|
L,
|
|
174
174
|
U
|
|
175
|
-
]),
|
|
175
|
+
]), P = c(() => a ? J === l ? ye : Pe ?? [] : o ? X?.endTimeSlots ?? [] : Ae(Ee ?? U, L), [
|
|
176
176
|
o,
|
|
177
|
-
|
|
177
|
+
X?.endTimeSlots,
|
|
178
178
|
l,
|
|
179
179
|
Ee,
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
Pe,
|
|
181
|
+
a,
|
|
182
182
|
ye,
|
|
183
183
|
J,
|
|
184
184
|
L,
|
|
185
185
|
U
|
|
186
|
-
]), O =
|
|
186
|
+
]), O = p(
|
|
187
187
|
(e, t) => {
|
|
188
|
-
e !== r && (
|
|
188
|
+
e !== r && (_e(t === "user"), K(e, { source: t }));
|
|
189
189
|
},
|
|
190
190
|
[K, r]
|
|
191
|
-
),
|
|
191
|
+
), g = p(
|
|
192
192
|
(e, t = "auto") => {
|
|
193
|
-
e !==
|
|
193
|
+
e !== S && (t !== "user" && e && P.find((u) => u.value === e)?.isExtra || he(e, { source: t }));
|
|
194
194
|
},
|
|
195
|
-
[
|
|
196
|
-
),
|
|
197
|
-
|
|
198
|
-
H || Me ||
|
|
199
|
-
}, [H,
|
|
200
|
-
if (H || !
|
|
195
|
+
[P, S, he]
|
|
196
|
+
), ee = c(() => F.length ? F.find((e) => !(e.isDisabled || Te != null && e.startMinutes < Te)) ?? null : null, [Te, F]);
|
|
197
|
+
k(() => {
|
|
198
|
+
H || Me || ee && r !== ee.value && O(ee.value, "auto");
|
|
199
|
+
}, [H, ee, Me, r, O]), k(() => {
|
|
200
|
+
if (H || !F.length)
|
|
201
201
|
return;
|
|
202
|
-
const e = r ?
|
|
203
|
-
const
|
|
204
|
-
|
|
202
|
+
const e = r ? F.find((d) => d.value === r) : void 0, t = I ?? void 0, f = B ? t : null, u = (d) => {
|
|
203
|
+
const h = typeof d == "number" ? d : null, v = F.find((x) => !(x.isDisabled || h != null && x.startMinutes < h));
|
|
204
|
+
v && v.value !== r ? O(v.value, "auto") : !v && r && O("", "auto");
|
|
205
205
|
};
|
|
206
206
|
if (r && !e) {
|
|
207
|
-
u(
|
|
207
|
+
u(f);
|
|
208
208
|
return;
|
|
209
209
|
}
|
|
210
210
|
if (e?.isDisabled) {
|
|
211
|
-
u(
|
|
211
|
+
u(f);
|
|
212
212
|
return;
|
|
213
213
|
}
|
|
214
214
|
if (!B || t == null)
|
|
215
215
|
return;
|
|
216
|
-
const
|
|
217
|
-
if (
|
|
216
|
+
const D = R(r);
|
|
217
|
+
if (D != null && D >= t && !e?.isDisabled)
|
|
218
218
|
return;
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
}, [H, I, B, r,
|
|
222
|
-
if (H || !
|
|
219
|
+
const T = F.find((d) => !d.isDisabled && d.startMinutes >= t);
|
|
220
|
+
T && T.value !== r && O(T.value, "auto");
|
|
221
|
+
}, [H, I, B, r, F, O]), k(() => {
|
|
222
|
+
if (H || !P.length)
|
|
223
223
|
return;
|
|
224
|
-
if (
|
|
224
|
+
if (a && $.current === l && J === l) {
|
|
225
225
|
$.current = void 0;
|
|
226
|
-
const
|
|
227
|
-
if (
|
|
228
|
-
|
|
226
|
+
const v = Mt(P);
|
|
227
|
+
if (v && v.value !== S) {
|
|
228
|
+
g(v.value);
|
|
229
229
|
return;
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
const e = R(r), t = R(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
const u = [];
|
|
239
|
-
Z && I != null && u.push(I), X && e != null && u.push(e + L);
|
|
240
|
-
const v = u.length ? Math.max(...u) : null, D = (c) => {
|
|
241
|
-
const h = typeof c == "number" ? c : null, x = C.find((Fe) => !(!ve(Fe) || h != null && Fe.startMinutes < h));
|
|
242
|
-
x && x.value !== d ? p(x.value) : !x && d && p("");
|
|
232
|
+
const e = R(r), t = R(S), f = S ? P.find((h) => h.value === S) : void 0, u = [];
|
|
233
|
+
Z && I != null && u.push(I), de && e != null && u.push(e + L);
|
|
234
|
+
const D = u.length ? Math.max(...u) : null, T = (h) => {
|
|
235
|
+
const v = typeof h == "number" ? h : null, x = P.find((ke) => !(!ge(ke) || v != null && ke.startMinutes < v));
|
|
236
|
+
x && x.value !== S ? g(x.value) : !x && S && g("");
|
|
243
237
|
};
|
|
244
|
-
if (
|
|
245
|
-
D
|
|
238
|
+
if (a && S && !f) {
|
|
239
|
+
T(D);
|
|
246
240
|
return;
|
|
247
241
|
}
|
|
248
|
-
if (
|
|
249
|
-
D
|
|
242
|
+
if (f?.isDisabled) {
|
|
243
|
+
T(D);
|
|
250
244
|
return;
|
|
251
245
|
}
|
|
252
|
-
if (
|
|
246
|
+
if (D == null || t != null && t >= D)
|
|
253
247
|
return;
|
|
254
|
-
const
|
|
255
|
-
|
|
248
|
+
const d = yt(P, D);
|
|
249
|
+
d && d.value !== S ? g(d.value) : !d && S && g("");
|
|
256
250
|
}, [
|
|
257
|
-
|
|
251
|
+
P,
|
|
258
252
|
H,
|
|
259
253
|
I,
|
|
260
254
|
l,
|
|
261
|
-
|
|
262
|
-
|
|
255
|
+
S,
|
|
256
|
+
a,
|
|
263
257
|
J,
|
|
264
258
|
Z,
|
|
265
|
-
|
|
259
|
+
de,
|
|
266
260
|
L,
|
|
267
261
|
r,
|
|
268
|
-
|
|
269
|
-
]),
|
|
262
|
+
g
|
|
263
|
+
]), k(() => (Ze(!0), () => {
|
|
270
264
|
M.current != null && clearTimeout(M.current);
|
|
271
|
-
}), []),
|
|
272
|
-
|
|
273
|
-
}, [
|
|
274
|
-
|
|
275
|
-
}, [
|
|
276
|
-
const
|
|
277
|
-
e &&
|
|
278
|
-
}, []),
|
|
279
|
-
e &&
|
|
280
|
-
}, []),
|
|
281
|
-
e &&
|
|
282
|
-
}, []),
|
|
265
|
+
}), []), k(() => {
|
|
266
|
+
ne && te && j(!1);
|
|
267
|
+
}, [te, ne]), k(() => {
|
|
268
|
+
se && ie && z(!1);
|
|
269
|
+
}, [ie, se]);
|
|
270
|
+
const Ge = p((e) => {
|
|
271
|
+
e && ue.current && Date.now() < ue.current || j(e);
|
|
272
|
+
}, []), Je = p((e) => {
|
|
273
|
+
e && ce.current && Date.now() < ce.current || z(e);
|
|
274
|
+
}, []), Xe = p((e) => {
|
|
275
|
+
e && fe.current && Date.now() < fe.current || ae(e);
|
|
276
|
+
}, []), et = p(
|
|
283
277
|
(e, {
|
|
284
278
|
openTimePicker: t,
|
|
285
|
-
openEndDatePicker:
|
|
279
|
+
openEndDatePicker: f,
|
|
286
280
|
close: u = !0
|
|
287
281
|
} = {}) => {
|
|
288
|
-
const
|
|
282
|
+
const D = t ?? E === "chained-times", T = f ?? E === "dates-first";
|
|
289
283
|
if (!e) {
|
|
290
284
|
u && j(!1);
|
|
291
285
|
return;
|
|
292
286
|
}
|
|
293
|
-
|
|
287
|
+
i(e), (u || T) && (ue.current = Date.now() + 250, j(!1)), m && e > m && _(e), D && re(!0), T && (M.current != null && clearTimeout(M.current), W ? (z(!0), M.current = null) : M.current = setTimeout(() => {
|
|
294
288
|
z(!0);
|
|
295
289
|
}, 100));
|
|
296
290
|
},
|
|
297
|
-
[
|
|
298
|
-
),
|
|
291
|
+
[m, W, _, i, E]
|
|
292
|
+
), tt = p(
|
|
299
293
|
(e) => {
|
|
300
|
-
O(e, "user"),
|
|
294
|
+
O(e, "user"), re(!1), M.current != null && clearTimeout(M.current), E === "chained-times" && e && n ? M.current = setTimeout(() => {
|
|
301
295
|
z(!0);
|
|
302
296
|
}, 100) : M.current = null;
|
|
303
297
|
},
|
|
304
298
|
[E, n, O]
|
|
305
|
-
),
|
|
299
|
+
), nt = p(
|
|
306
300
|
(e) => {
|
|
307
301
|
e && e !== r && O(e, "user");
|
|
308
302
|
},
|
|
309
303
|
[r, O]
|
|
310
|
-
),
|
|
304
|
+
), rt = p(
|
|
311
305
|
(e, {
|
|
312
306
|
openTimePicker: t,
|
|
313
|
-
close:
|
|
307
|
+
close: f = !0,
|
|
314
308
|
commit: u = E === "dates-first" ? W : !1
|
|
315
309
|
} = {}) => {
|
|
316
|
-
const
|
|
317
|
-
let
|
|
310
|
+
const D = t ?? E === "chained-times";
|
|
311
|
+
let T = S;
|
|
318
312
|
if (e && E === "dates-first") {
|
|
319
|
-
if (
|
|
320
|
-
const
|
|
321
|
-
|
|
313
|
+
if (a) {
|
|
314
|
+
const h = A(e);
|
|
315
|
+
h && ($.current = h);
|
|
322
316
|
}
|
|
323
|
-
const
|
|
324
|
-
|
|
317
|
+
const d = we(e);
|
|
318
|
+
d && (T = d, g(d));
|
|
325
319
|
}
|
|
326
|
-
_(e),
|
|
320
|
+
_(e), oe(void 0), f && (ce.current = Date.now() + 250, z(!1)), e && D && ae(!0), e && u && Q && (typeof window > "u" ? Q(e, T) : requestAnimationFrame(() => Q(e, T)));
|
|
327
321
|
},
|
|
328
322
|
[
|
|
329
|
-
|
|
330
|
-
|
|
323
|
+
S,
|
|
324
|
+
a,
|
|
331
325
|
we,
|
|
332
326
|
W,
|
|
333
327
|
_,
|
|
334
328
|
Q,
|
|
335
329
|
E,
|
|
336
330
|
A,
|
|
337
|
-
|
|
331
|
+
g
|
|
338
332
|
]
|
|
339
|
-
),
|
|
333
|
+
), it = p(
|
|
340
334
|
(e) => {
|
|
341
|
-
|
|
335
|
+
g(e, "user");
|
|
342
336
|
},
|
|
343
|
-
[
|
|
344
|
-
),
|
|
337
|
+
[g]
|
|
338
|
+
), st = p(
|
|
345
339
|
(e) => {
|
|
346
|
-
$.current = void 0,
|
|
340
|
+
$.current = void 0, g(e, "user"), fe.current = Date.now() + 250, ae(!1), V && (typeof window > "u" ? V() : requestAnimationFrame(() => {
|
|
347
341
|
requestAnimationFrame(V);
|
|
348
342
|
}));
|
|
349
343
|
},
|
|
350
|
-
[V,
|
|
344
|
+
[V, g]
|
|
351
345
|
);
|
|
352
346
|
return {
|
|
353
347
|
startDate: n,
|
|
354
348
|
startTime: r,
|
|
355
|
-
endDate:
|
|
356
|
-
endTime:
|
|
357
|
-
errors:
|
|
358
|
-
labels:
|
|
359
|
-
t:
|
|
360
|
-
language:
|
|
361
|
-
labelClassName:
|
|
362
|
-
inputClassName:
|
|
363
|
-
buttonClassName:
|
|
364
|
-
currencyCode:
|
|
349
|
+
endDate: m,
|
|
350
|
+
endTime: S,
|
|
351
|
+
errors: Be,
|
|
352
|
+
labels: Ie ?? ht,
|
|
353
|
+
t: Le,
|
|
354
|
+
language: ve ?? Y,
|
|
355
|
+
labelClassName: xe,
|
|
356
|
+
inputClassName: Re,
|
|
357
|
+
buttonClassName: Ke,
|
|
358
|
+
currencyCode: Ue,
|
|
365
359
|
localeCode: Y,
|
|
366
360
|
slotIntervalMinutes: L,
|
|
367
|
-
dateLocale:
|
|
361
|
+
dateLocale: Ne,
|
|
368
362
|
numberOfMonths: W ? 1 : 2,
|
|
369
363
|
isMobile: W,
|
|
370
|
-
isHydrated:
|
|
371
|
-
openDatePickerOnFocus:
|
|
372
|
-
withMobileDateDrawer:
|
|
364
|
+
isHydrated: $e,
|
|
365
|
+
openDatePickerOnFocus: We,
|
|
366
|
+
withMobileDateDrawer: He,
|
|
373
367
|
selectionFlow: E,
|
|
374
|
-
isStartDatePopoverOpen:
|
|
375
|
-
setIsStartDatePopoverOpen:
|
|
376
|
-
isStartTimeSelectOpen:
|
|
377
|
-
setIsStartTimeSelectOpen:
|
|
378
|
-
isEndDatePopoverOpen:
|
|
379
|
-
setIsEndDatePopoverOpen:
|
|
380
|
-
isEndTimeSelectOpen:
|
|
381
|
-
setIsEndTimeSelectOpen:
|
|
382
|
-
hoveredEndDate:
|
|
383
|
-
setHoveredEndDate:
|
|
384
|
-
resetHoveredEndDate:
|
|
385
|
-
startTimeSlots:
|
|
386
|
-
availableEndTimeSlots:
|
|
368
|
+
isStartDatePopoverOpen: te,
|
|
369
|
+
setIsStartDatePopoverOpen: Ge,
|
|
370
|
+
isStartTimeSelectOpen: ne,
|
|
371
|
+
setIsStartTimeSelectOpen: re,
|
|
372
|
+
isEndDatePopoverOpen: ie,
|
|
373
|
+
setIsEndDatePopoverOpen: Je,
|
|
374
|
+
isEndTimeSelectOpen: se,
|
|
375
|
+
setIsEndTimeSelectOpen: Xe,
|
|
376
|
+
hoveredEndDate: qe,
|
|
377
|
+
setHoveredEndDate: oe,
|
|
378
|
+
resetHoveredEndDate: Ve,
|
|
379
|
+
startTimeSlots: F,
|
|
380
|
+
availableEndTimeSlots: P,
|
|
387
381
|
isStartToday: B,
|
|
388
382
|
isEndToday: Z,
|
|
389
|
-
minSelectableDate:
|
|
383
|
+
minSelectableDate: je,
|
|
390
384
|
earliestMinutesForToday: I,
|
|
391
|
-
startMinutesValue:
|
|
392
|
-
isSameDaySelection:
|
|
393
|
-
updateStartTime:
|
|
394
|
-
selectStartDate:
|
|
395
|
-
selectStartTime:
|
|
396
|
-
selectEndDate:
|
|
397
|
-
updateEndTime:
|
|
398
|
-
selectEndTime:
|
|
385
|
+
startMinutesValue: Ye,
|
|
386
|
+
isSameDaySelection: de,
|
|
387
|
+
updateStartTime: nt,
|
|
388
|
+
selectStartDate: et,
|
|
389
|
+
selectStartTime: tt,
|
|
390
|
+
selectEndDate: rt,
|
|
391
|
+
updateEndTime: it,
|
|
392
|
+
selectEndTime: st
|
|
399
393
|
};
|
|
400
394
|
};
|
|
401
395
|
export {
|
|
402
|
-
|
|
396
|
+
Bt as useBookingPeriodController
|
|
403
397
|
};
|
|
@@ -72,7 +72,7 @@ function we({ preset: s, storeSlug: j }) {
|
|
|
72
72
|
c ? /* @__PURE__ */ r("a", { className: x, href: c.href, target: "_blank", rel: "noreferrer", children: [
|
|
73
73
|
/* @__PURE__ */ e("span", { className: "mt-0.5 inline-flex h-8 w-8 items-center justify-center text-current transition-colors", children: /* @__PURE__ */ e("img", { src: U, className: "h-6 w-6", alt: "", "aria-hidden": "true" }) }),
|
|
74
74
|
/* @__PURE__ */ r("span", { className: "flex min-w-0 flex-col gap-1", children: [
|
|
75
|
-
/* @__PURE__ */ e("span", { className: "text-
|
|
75
|
+
/* @__PURE__ */ e("span", { className: "text-2xs font-medium uppercase tracking-[0.08em] text-slate-500", children: t("contact_section_whatsapp_label") }),
|
|
76
76
|
/* @__PURE__ */ e(
|
|
77
77
|
w,
|
|
78
78
|
{
|
|
@@ -87,7 +87,7 @@ function we({ preset: s, storeSlug: j }) {
|
|
|
87
87
|
/* @__PURE__ */ r("a", { className: x, href: s.phone_href, children: [
|
|
88
88
|
/* @__PURE__ */ e("span", { className: "mt-0.5 inline-flex h-8 w-8 items-center justify-center text-current transition-colors", children: /* @__PURE__ */ e(q, { className: "h-5 w-5", "aria-hidden": "true" }) }),
|
|
89
89
|
/* @__PURE__ */ r("span", { className: "flex min-w-0 flex-col gap-1", children: [
|
|
90
|
-
/* @__PURE__ */ e("span", { className: "text-
|
|
90
|
+
/* @__PURE__ */ e("span", { className: "text-2xs font-medium uppercase tracking-[0.08em] text-slate-500", children: t("contact_section_phone_label") }),
|
|
91
91
|
/* @__PURE__ */ e(
|
|
92
92
|
w,
|
|
93
93
|
{
|
|
@@ -102,7 +102,7 @@ function we({ preset: s, storeSlug: j }) {
|
|
|
102
102
|
/* @__PURE__ */ r("a", { className: x, href: `mailto:${s.email}`, children: [
|
|
103
103
|
/* @__PURE__ */ e("span", { className: "mt-0.5 inline-flex h-8 w-8 items-center justify-center text-current transition-colors", children: /* @__PURE__ */ e(E, { className: "h-5 w-5", "aria-hidden": "true" }) }),
|
|
104
104
|
/* @__PURE__ */ r("span", { className: "flex min-w-0 flex-col gap-1", children: [
|
|
105
|
-
/* @__PURE__ */ e("span", { className: "text-
|
|
105
|
+
/* @__PURE__ */ e("span", { className: "text-2xs font-medium uppercase tracking-[0.08em] text-slate-500", children: t("contact_section_email_label") }),
|
|
106
106
|
/* @__PURE__ */ e(
|
|
107
107
|
w,
|
|
108
108
|
{
|
|
@@ -117,7 +117,7 @@ function we({ preset: s, storeSlug: j }) {
|
|
|
117
117
|
/* @__PURE__ */ r("a", { className: x, href: P, target: "_blank", rel: "noreferrer", children: [
|
|
118
118
|
/* @__PURE__ */ e("span", { className: "mt-0.5 inline-flex h-8 w-8 items-center justify-center text-current transition-colors", children: /* @__PURE__ */ e(H, { className: "h-5 w-5", "aria-hidden": "true" }) }),
|
|
119
119
|
/* @__PURE__ */ r("span", { className: "flex min-w-0 flex-col gap-1", children: [
|
|
120
|
-
/* @__PURE__ */ e("span", { className: "text-
|
|
120
|
+
/* @__PURE__ */ e("span", { className: "text-2xs font-medium uppercase tracking-[0.08em] text-slate-500", children: t("contact_section_address_label") }),
|
|
121
121
|
/* @__PURE__ */ e("span", { className: g, children: s.address })
|
|
122
122
|
] })
|
|
123
123
|
] })
|
|
@@ -100,7 +100,7 @@ function de({ preset: n, storefrontConfiguration: s, whatsappHref: l }) {
|
|
|
100
100
|
children: /* @__PURE__ */ a(r, { to: R, children: [
|
|
101
101
|
/* @__PURE__ */ e(F, { className: "h-4 w-4", "aria-hidden": "true" }),
|
|
102
102
|
/* @__PURE__ */ e("span", { children: t("cart_button") }),
|
|
103
|
-
/* @__PURE__ */ e(G, { className: "absolute -right-2 -top-2 h-5 min-w-5 rounded-full px-1.5 text-
|
|
103
|
+
/* @__PURE__ */ e(G, { className: "absolute -right-2 -top-2 h-5 min-w-5 rounded-full px-1.5 text-xs", children: /* @__PURE__ */ e("span", { children: p }) })
|
|
104
104
|
] })
|
|
105
105
|
}
|
|
106
106
|
),
|