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