@wix/bookings 1.0.1782 → 1.0.1783
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/build/cjs/context-booking-checkout.d.ts +32 -0
- package/build/cjs/context-booking-checkout.js +2002 -1762
- package/build/cjs/context-booking-checkout.js.map +1 -1
- package/build/cjs/context-my-booking.d.ts +2832 -0
- package/build/cjs/context-my-booking.js +592 -0
- package/build/cjs/context-my-booking.js.map +1 -0
- package/build/cjs/context-my-bookings.d.ts +2862 -0
- package/build/cjs/context-my-bookings.js +12885 -0
- package/build/cjs/context-my-bookings.js.map +1 -0
- package/build/cjs/context-service.d.ts +18 -24
- package/build/cjs/context-service.js +403 -396
- package/build/cjs/context-service.js.map +1 -1
- package/build/cjs/context-time-slots.d.ts +24 -7
- package/build/cjs/context-time-slots.js +82 -81
- package/build/cjs/context-time-slots.js.map +1 -1
- package/build/es/context-booking-checkout.d.mts +32 -0
- package/build/es/context-booking-checkout.mjs +2002 -1762
- package/build/es/context-booking-checkout.mjs.map +1 -1
- package/build/es/context-my-booking.d.mts +2832 -0
- package/build/es/context-my-booking.mjs +562 -0
- package/build/es/context-my-booking.mjs.map +1 -0
- package/build/es/context-my-bookings.d.mts +2862 -0
- package/build/es/context-my-bookings.mjs +12844 -0
- package/build/es/context-my-bookings.mjs.map +1 -0
- package/build/es/context-service.d.mts +18 -24
- package/build/es/context-service.mjs +403 -396
- package/build/es/context-service.mjs.map +1 -1
- package/build/es/context-time-slots.d.mts +24 -7
- package/build/es/context-time-slots.mjs +82 -81
- package/build/es/context-time-slots.mjs.map +1 -1
- package/build/internal/cjs/context-booking-checkout.d.ts +32 -0
- package/build/internal/cjs/context-my-booking.d.ts +2832 -0
- package/build/internal/cjs/context-my-bookings.d.ts +2862 -0
- package/build/internal/cjs/context-service.d.ts +18 -24
- package/build/internal/cjs/context-time-slots.d.ts +24 -7
- package/build/internal/es/context-booking-checkout.d.mts +32 -0
- package/build/internal/es/context-my-booking.d.mts +2832 -0
- package/build/internal/es/context-my-bookings.d.mts +2862 -0
- package/build/internal/es/context-service.d.mts +18 -24
- package/build/internal/es/context-time-slots.d.mts +24 -7
- package/context/my-booking/package.json +3 -0
- package/context/my-bookings/package.json +3 -0
- package/context-runtime/context-booking-checkout/runtime.d.ts +32 -0
- package/context-runtime/context-booking-checkout/runtime.js +3 -3
- package/context-runtime/context-my-booking/runtime.d.ts +2832 -0
- package/context-runtime/context-my-booking/runtime.js +2 -0
- package/context-runtime/context-my-bookings/runtime.d.ts +2862 -0
- package/context-runtime/context-my-bookings/runtime.js +11 -0
- package/context-runtime/context-service/runtime.d.ts +18 -24
- package/context-runtime/context-service/runtime.js +3 -3
- package/context-runtime/context-time-slots/runtime.d.ts +24 -7
- package/context-runtime/context-time-slots/runtime.js +2 -2
- package/package.json +20 -4
|
@@ -738,10 +738,15 @@ interface TimeSlotsContextValue extends TimeSlotsContextFields {
|
|
|
738
738
|
* Starts loading the upcoming time slots, which are the service's time slots from the current
|
|
739
739
|
* time on, a page at a time. `timeSlots` holds them while no date is selected.
|
|
740
740
|
*
|
|
741
|
-
* Until it's called, `timeSlots` is empty while no date is selected
|
|
742
|
-
*
|
|
743
|
-
*
|
|
744
|
-
*
|
|
741
|
+
* Until it's called, `timeSlots` is empty while no date is selected, and `isLoading` doesn't
|
|
742
|
+
* count the wait for the call. A component renders at least once before its call, so check
|
|
743
|
+
* `upcomingTimeSlotsRequested` too, as in the example, to show a loading state instead of an
|
|
744
|
+
* empty list.
|
|
745
|
+
*
|
|
746
|
+
* Calling it again has no effect, so every component that shows the upcoming time slots can call
|
|
747
|
+
* it. After the first call, the list reloads when the time zone or a filter changes. When the
|
|
748
|
+
* service changes, the context starts over and the components inside it mount again, so they
|
|
749
|
+
* call it again.
|
|
745
750
|
*
|
|
746
751
|
* A multi-service appointment, and a course whose last session has ended, have no upcoming
|
|
747
752
|
* time slots. When the first page fails to load, `errorCode` is `'upcomingSlotsLoadFailed'`.
|
|
@@ -754,14 +759,15 @@ interface TimeSlotsContextValue extends TimeSlotsContextFields {
|
|
|
754
759
|
* import { useTimeSlotsContext } from '@wix/bookings/context/time-slots';
|
|
755
760
|
*
|
|
756
761
|
* function UpcomingSlots() {
|
|
757
|
-
* const { timeSlots, isLoading, hasError, loadUpcomingTimeSlots } =
|
|
762
|
+
* const { timeSlots, isLoading, hasError, loadUpcomingTimeSlots, upcomingTimeSlotsRequested } =
|
|
763
|
+
* useTimeSlotsContext();
|
|
758
764
|
*
|
|
759
765
|
* useEffect(() => {
|
|
760
766
|
* void loadUpcomingTimeSlots();
|
|
761
767
|
* }, [loadUpcomingTimeSlots]);
|
|
762
768
|
*
|
|
763
|
-
* if (isLoading) return <p>Loading times...</p>;
|
|
764
769
|
* if (hasError && !timeSlots.length) return <p>We couldn't load the times. Try again later.</p>;
|
|
770
|
+
* if (!upcomingTimeSlotsRequested || isLoading) return <p>Loading times...</p>;
|
|
765
771
|
* if (!timeSlots.length) return <p>No upcoming times.</p>;
|
|
766
772
|
*
|
|
767
773
|
* return (
|
|
@@ -775,7 +781,18 @@ interface TimeSlotsContextValue extends TimeSlotsContextFields {
|
|
|
775
781
|
* ```
|
|
776
782
|
*/
|
|
777
783
|
readonly loadUpcomingTimeSlots: () => Promise<void>;
|
|
778
|
-
/**
|
|
784
|
+
/**
|
|
785
|
+
* Whether a component called `loadUpcomingTimeSlots()`.
|
|
786
|
+
*
|
|
787
|
+
* Until a component calls it, `isLoading` is `false` and `timeSlots` is empty, though the list
|
|
788
|
+
* isn't loaded yet. A component that shows the upcoming time slots treats
|
|
789
|
+
* `!upcomingTimeSlotsRequested` as loading, so it doesn't show an empty list before its call.
|
|
790
|
+
* Once any component calls it, it's `true` for every component in the context, so one that
|
|
791
|
+
* mounts later shows the time slots that already loaded.
|
|
792
|
+
*
|
|
793
|
+
* When the context fails to load, it stays `false` and `hasError` is `true`, so check `hasError`
|
|
794
|
+
* first.
|
|
795
|
+
*/
|
|
779
796
|
readonly upcomingTimeSlotsRequested: boolean;
|
|
780
797
|
/**
|
|
781
798
|
* Shows the previous page of upcoming time slots in `timeSlots`, from the pages that already
|
|
@@ -2341,7 +2341,7 @@ function Fc({ nextAvailableSlotsCount: e2, isLoading: t2, hasError: n2, children
|
|
|
2341
2341
|
}, navigateToBookingForm: () => {
|
|
2342
2342
|
}, timeSlotLimitPerDay: null, daysWithMore: /* @__PURE__ */ new Set(), loadingDate: null, loadAllTimeSlotsForDay: async () => {
|
|
2343
2343
|
} };
|
|
2344
|
-
return p(
|
|
2344
|
+
return p(Ul.Provider, { value: a2, children: r2 });
|
|
2345
2345
|
}
|
|
2346
2346
|
function Ic({ nextAvailableSlotsCount: e2, children: t2 }) {
|
|
2347
2347
|
return p(Fc, { nextAvailableSlotsCount: e2, isLoading: true, hasError: false, children: t2 });
|
|
@@ -2544,61 +2544,62 @@ function ll(e2) {
|
|
|
2544
2544
|
function ul(e2, t2) {
|
|
2545
2545
|
return t2 === void 0 ? false : !e2 || new Date(e2).getTime() <= t2;
|
|
2546
2546
|
}
|
|
2547
|
-
|
|
2547
|
+
var dl = 864e5;
|
|
2548
|
+
function fl({ serviceId: e2, serviceType: t2, lastSessionEnd: n2, timeZone: r2, now: i2, onlyAvailableSlots: a2, locationId: o2, staffId: s2, timeSlotLimitPerDay: c2, customerChoices: l2, minRemainingCapacity: u2 }) {
|
|
2548
2549
|
let d2 = { serviceId: e2, onlyAvailableSlots: a2, locationId: o2 ?? void 0, staffId: s2 ?? void 0, timeZone: r2, fromLocalDate: No(new Date(i2), r2) };
|
|
2549
|
-
return Xa(t2) ? { ...d2, serviceType: `CLASS`, minRemainingCapacity: u2 } : Za(t2) ? !n2 || ul(n2, i2) ? void 0 : { ...d2, serviceType: `COURSE`, toLocalDate: No(new Date(n2), r2) } : { ...d2, serviceType: `APPOINTMENT`, toLocalDate: hs().toLocalDate, timeSlotsPerDay: c2 + 1, customerChoices: l2 };
|
|
2550
|
+
return Xa(t2) ? { ...d2, serviceType: `CLASS`, minRemainingCapacity: u2 } : Za(t2) ? !n2 || ul(n2, i2) ? void 0 : { ...d2, serviceType: `COURSE`, toLocalDate: No(new Date(new Date(n2).getTime() + dl), r2) } : { ...d2, serviceType: `APPOINTMENT`, toLocalDate: hs().toLocalDate, timeSlotsPerDay: c2 + 1, customerChoices: l2 };
|
|
2550
2551
|
}
|
|
2551
|
-
function
|
|
2552
|
+
function pl({ isAppointment: e2, staffOnSlotCount: t2, hasStaffFilter: n2, hasRequestedGender: r2, hasStaffPricedVariants: i2, staffSelectionStrategy: a2 }) {
|
|
2552
2553
|
return e2 && t2 > 1 && !n2 && !i2 && (a2 !== `CUSTOMER_MUST_CHOOSE` || r2);
|
|
2553
2554
|
}
|
|
2554
|
-
function
|
|
2555
|
+
function ml(e2, t2) {
|
|
2555
2556
|
return e2.length ? e2.length === 1 ? { anyResource: false, staffMemberId: e2[0] } : t2 ? { anyResource: true } : null : null;
|
|
2556
2557
|
}
|
|
2557
|
-
function
|
|
2558
|
+
function hl(e2, t2, n2) {
|
|
2558
2559
|
return t2 && !t2.anyResource && e2.includes(t2.staffMemberId) ? { isComplete: true, resourceId: t2.staffMemberId } : t2?.anyResource && n2 ? { isComplete: true, resourceId: void 0 } : e2.length <= 1 ? { isComplete: true, resourceId: e2[0] } : { isComplete: n2, resourceId: void 0 };
|
|
2559
2560
|
}
|
|
2560
|
-
var
|
|
2561
|
-
function
|
|
2562
|
-
if (!e2) return
|
|
2561
|
+
var gl = { staff: null, requestedGender: null, locationId: null };
|
|
2562
|
+
function _l({ entry: e2, appointmentLike: t2, staffChoiceHidden: n2, staffPriced: r2, staffSelectionStrategy: i2, genderAllowed: a2, staffMemberIds: o2, locationIds: s2 }) {
|
|
2563
|
+
if (!e2) return gl;
|
|
2563
2564
|
let c2 = e2.locationId && s2.includes(e2.locationId) ? e2.locationId : null, l2 = t2 && !n2 ? oo(e2) : null;
|
|
2564
|
-
if (!l2) return { ...
|
|
2565
|
-
if (!l2.anyResource) return o2.includes(l2.staffMemberId) ? { staff: l2, requestedGender: null, locationId: c2 } : { ...
|
|
2565
|
+
if (!l2) return { ...gl, locationId: c2 };
|
|
2566
|
+
if (!l2.anyResource) return o2.includes(l2.staffMemberId) ? { staff: l2, requestedGender: null, locationId: c2 } : { ...gl, locationId: c2 };
|
|
2566
2567
|
let u2 = a2 ? e2.requestedGender ?? null : null;
|
|
2567
|
-
return o2.length > 1 && !r2 && (i2 !== `CUSTOMER_MUST_CHOOSE` || u2 !== null) ? { staff: l2, requestedGender: u2, locationId: c2 } : { ...
|
|
2568
|
+
return o2.length > 1 && !r2 && (i2 !== `CUSTOMER_MUST_CHOOSE` || u2 !== null) ? { staff: l2, requestedGender: u2, locationId: c2 } : { ...gl, locationId: c2 };
|
|
2568
2569
|
}
|
|
2569
|
-
var
|
|
2570
|
-
function
|
|
2571
|
-
let s2 =
|
|
2572
|
-
return { rows: t2 ? c2 :
|
|
2570
|
+
var vl = [];
|
|
2571
|
+
function yl({ sessions: e2, dayQuery: t2, daySlots: n2, staffFilter: r2, appointmentLike: i2, limitPerDay: a2, expandedDates: o2 }) {
|
|
2572
|
+
let s2 = Ol(kl(e2, r2)), c2 = n2 ? kl(i2 ? Xo(n2) : n2, r2) : vl;
|
|
2573
|
+
return { rows: t2 ? c2 : Al(s2, a2, o2), slotIdOf: t2 ? qo : Yo, daysWithMore: Dl(s2, a2, o2) };
|
|
2573
2574
|
}
|
|
2574
|
-
function
|
|
2575
|
-
return [...e2.filter((e3) => t2(e3) === n2)].sort((e3, t3) =>
|
|
2575
|
+
function bl({ rows: e2, slotIdOf: t2 }, n2) {
|
|
2576
|
+
return [...e2.filter((e3) => t2(e3) === n2)].sort((e3, t3) => El(t3) - El(e3))[0] ?? null;
|
|
2576
2577
|
}
|
|
2577
|
-
function
|
|
2578
|
-
return { slotId: n2(e2), slotStartTime: e2.localStartDate ?? null, slotEndTime: e2.localEndDate ?? null, bookable: e2.bookable ?? false, tooEarlyToBook: e2.bookingPolicyViolations?.tooEarlyToBook ?? false, tooLateToBook: e2.bookingPolicyViolations?.tooLateToBook ?? false, totalCapacity: e2.totalCapacity ?? null, remainingCapacity: e2.remainingCapacity ?? null, bookableCapacity: e2.bookableCapacity ?? null, eventId: e2.eventInfo?.eventId ?? null, eventTitle: e2.eventInfo?.eventTitle ?? null, waitlistCapacity: e2.eventInfo?.waitingList?.remainingCapacity ?? null, locationId: e2.location?._id ?? null, locationName: e2.location?.name || e2.location?.formattedAddress || null, durationMinutes:
|
|
2578
|
+
function xl(e2, t2, n2, r2) {
|
|
2579
|
+
return { slotId: n2(e2), slotStartTime: e2.localStartDate ?? null, slotEndTime: e2.localEndDate ?? null, bookable: e2.bookable ?? false, tooEarlyToBook: e2.bookingPolicyViolations?.tooEarlyToBook ?? false, tooLateToBook: e2.bookingPolicyViolations?.tooLateToBook ?? false, totalCapacity: e2.totalCapacity ?? null, remainingCapacity: e2.remainingCapacity ?? null, bookableCapacity: e2.bookableCapacity ?? null, eventId: e2.eventInfo?.eventId ?? null, eventTitle: e2.eventInfo?.eventTitle ?? null, waitlistCapacity: e2.eventInfo?.waitingList?.remainingCapacity ?? null, locationId: e2.location?._id ?? null, locationName: e2.location?.name || e2.location?.formattedAddress || null, durationMinutes: Tl(e2, t2), isAllDay: e2.allDay ?? false, staff: r2 ? [] : Sl(e2) };
|
|
2579
2580
|
}
|
|
2580
|
-
function
|
|
2581
|
+
function Sl(e2) {
|
|
2581
2582
|
let t2 = /* @__PURE__ */ new Map();
|
|
2582
2583
|
for (let n2 of e2.availableResources ?? []) if (n2.resourceTypeId === `1cd44cf8-756f-41c3-bd90-3e2ffcaf1155`) for (let e3 of n2.resources ?? []) e3._id && !t2.has(e3._id) && t2.set(e3._id, e3.name ?? ``);
|
|
2583
2584
|
return [...t2].map(([e3, t3]) => ({ staffMemberId: e3, name: t3 }));
|
|
2584
2585
|
}
|
|
2585
|
-
function
|
|
2586
|
-
let t2 =
|
|
2586
|
+
function Cl(e2) {
|
|
2587
|
+
let t2 = Sl(e2);
|
|
2587
2588
|
if (t2.length) return t2.length === 1 ? t2[0].staffMemberId : null;
|
|
2588
2589
|
}
|
|
2589
|
-
function
|
|
2590
|
-
return
|
|
2590
|
+
function wl(e2) {
|
|
2591
|
+
return Sl(e2).map((e3) => e3.staffMemberId);
|
|
2591
2592
|
}
|
|
2592
|
-
function
|
|
2593
|
+
function Tl(e2, t2) {
|
|
2593
2594
|
if (!e2.localStartDate || !e2.localEndDate) return null;
|
|
2594
2595
|
let n2 = e2.allDay ? `UTC` : t2 ?? `UTC`, r2 = Nc(e2.localStartDate, n2), i2 = Nc(e2.localEndDate, n2);
|
|
2595
2596
|
return !r2 || !i2 || i2 < r2 ? null : Math.round((i2.getTime() - r2.getTime()) / 6e4);
|
|
2596
2597
|
}
|
|
2597
|
-
function
|
|
2598
|
+
function El(e2) {
|
|
2598
2599
|
let t2 = e2.bookableCapacity ?? e2.remainingCapacity;
|
|
2599
2600
|
return (e2.eventInfo?.waitingList?.remainingCapacity ?? 0) > 0 && (t2 ?? 0) <= 0 ? 1 : e2.bookable ? 2 : 0;
|
|
2600
2601
|
}
|
|
2601
|
-
function
|
|
2602
|
+
function Dl(e2, t2, n2) {
|
|
2602
2603
|
let r2 = /* @__PURE__ */ new Map();
|
|
2603
2604
|
for (let t3 of e2) {
|
|
2604
2605
|
let e3 = (t3.localStartDate ?? ``).slice(0, 10);
|
|
@@ -2606,16 +2607,16 @@ function El(e2, t2, n2) {
|
|
|
2606
2607
|
}
|
|
2607
2608
|
return new Set([...r2].filter(([e3, r3]) => r3 > t2 && !n2.has(e3)).map(([e3]) => e3));
|
|
2608
2609
|
}
|
|
2609
|
-
function
|
|
2610
|
+
function Ol(e2) {
|
|
2610
2611
|
return e2.flatMap((e3) => {
|
|
2611
2612
|
let t2 = e3.availableResources?.find((e4) => e4.resourceTypeId === Wr), n2 = t2?.resources ?? [];
|
|
2612
2613
|
return n2.length <= 1 ? [e3] : n2.map((n3) => ({ ...e3, availableResources: [{ ...t2, resources: [n3] }] }));
|
|
2613
2614
|
});
|
|
2614
2615
|
}
|
|
2615
|
-
function
|
|
2616
|
+
function kl(e2, t2) {
|
|
2616
2617
|
return t2 ? e2.map((e3) => ({ ...e3, availableResources: e3.availableResources?.map((e4) => e4.resourceTypeId === `1cd44cf8-756f-41c3-bd90-3e2ffcaf1155` ? { ...e4, resources: e4.resources?.filter((e5) => e5._id === t2) } : e4) })) : e2;
|
|
2617
2618
|
}
|
|
2618
|
-
function
|
|
2619
|
+
function Al(e2, t2, n2) {
|
|
2619
2620
|
let r2 = /* @__PURE__ */ new Map();
|
|
2620
2621
|
return e2.filter((e3) => {
|
|
2621
2622
|
let i2 = (e3.localStartDate ?? ``).slice(0, 10);
|
|
@@ -2624,21 +2625,21 @@ function kl(e2, t2, n2) {
|
|
|
2624
2625
|
return r2.set(i2, a2 + 1), a2 < t2;
|
|
2625
2626
|
});
|
|
2626
2627
|
}
|
|
2627
|
-
async function
|
|
2628
|
+
async function jl() {
|
|
2628
2629
|
try {
|
|
2629
2630
|
return await Ko();
|
|
2630
2631
|
} catch (e2) {
|
|
2631
2632
|
return $(e2, { feature: Q.timeSlots, action: `fetch-business-time-zone`, level: `warning` }), { businessTimeZone: null, staffSelectionStrategy: void 0, allowGenderSelection: false };
|
|
2632
2633
|
}
|
|
2633
2634
|
}
|
|
2634
|
-
function jl(e2) {
|
|
2635
|
-
return Xs({ key: zs(), warmupData: e2, fetchData: Al });
|
|
2636
|
-
}
|
|
2637
2635
|
function Ml(e2) {
|
|
2636
|
+
return Xs({ key: zs(), warmupData: e2, fetchData: jl });
|
|
2637
|
+
}
|
|
2638
|
+
function Nl(e2) {
|
|
2638
2639
|
return (e2.localStartDate ?? ``).slice(0, 10);
|
|
2639
2640
|
}
|
|
2640
|
-
var
|
|
2641
|
-
function
|
|
2641
|
+
var Pl = [];
|
|
2642
|
+
function Fl(e2, t2) {
|
|
2642
2643
|
let { serviceId: n2 = ``, serviceType: r2 = `CLASS`, fromLocalDate: i2 = ``, toLocalDate: o2, timeZone: l2, locationId: u2, staffId: d2, onlyAvailableSlots: f2 = false, customerChoices: p2, minRemainingCapacity: m2, timeSlotsPerDay: h2 } = t2 ?? {}, [g2, _2] = c([]), [v2, y2] = c([]), [b2, x2] = c(1), [S2, C2] = c(!!n2), [w2, T2] = c(null), [ee2, E2] = c(null), [D2, te2] = c(/* @__PURE__ */ new Set()), [ne2, O2] = c(null), k2 = s(null), re2 = s(null);
|
|
2643
2644
|
a(() => {
|
|
2644
2645
|
if (_2([]), y2([]), x2(1), E2(null), T2(null), te2(/* @__PURE__ */ new Set()), O2(null), C2(!!n2), !n2) return;
|
|
@@ -2680,9 +2681,9 @@ function Pl(e2, t2) {
|
|
|
2680
2681
|
try {
|
|
2681
2682
|
let a3 = await vs({ serviceId: n2, serviceType: r2, date: e3, timeZone: l2, onlyAvailableSlots: f2, locationId: u2, staffId: d2, customerChoices: p2, minRemainingCapacity: m2, fromLocalDate: i2, toLocalDate: o2 });
|
|
2682
2683
|
if (t3) return;
|
|
2683
|
-
let c3 = a3.timeSlots.filter((t4) =>
|
|
2684
|
+
let c3 = a3.timeSlots.filter((t4) => Nl(t4) === e3), h3 = Math.max(0, s2.findIndex((t4) => t4.some((t5) => Nl(t5) === e3)));
|
|
2684
2685
|
s2 = s2.map((t4, n3) => {
|
|
2685
|
-
let r3 = t4.filter((t5) =>
|
|
2686
|
+
let r3 = t4.filter((t5) => Nl(t5) !== e3);
|
|
2686
2687
|
return n3 === h3 ? [...r3, ...c3] : r3;
|
|
2687
2688
|
}), _2(s2), te2((t4) => /* @__PURE__ */ new Set([...t4, e3]));
|
|
2688
2689
|
} catch (e4) {
|
|
@@ -2697,7 +2698,7 @@ function Pl(e2, t2) {
|
|
|
2697
2698
|
t3 = true, k2.current = null, re2.current = null;
|
|
2698
2699
|
};
|
|
2699
2700
|
}, [n2, r2, i2, o2, l2, u2, d2, f2, p2, m2, h2, e2]);
|
|
2700
|
-
let ie2 = [...g2[b2 - 1] ??
|
|
2701
|
+
let ie2 = [...g2[b2 - 1] ?? Pl].sort((e3, t3) => (e3.localStartDate ?? ``).localeCompare(t3.localStartDate ?? ``)), A2 = g2[b2], ae2 = A2 ? A2.length > 0 : v2[b2 - 1] != null, j2 = b2 > 1;
|
|
2701
2702
|
async function oe2() {
|
|
2702
2703
|
ae2 && !S2 && await k2.current?.(b2 + 1);
|
|
2703
2704
|
}
|
|
@@ -2709,67 +2710,67 @@ function Pl(e2, t2) {
|
|
|
2709
2710
|
}
|
|
2710
2711
|
return { isLoadingPage: S2, firstPageSettled: g2.length > 0 || w2 !== null, error: w2, timeZone: ee2, sessions: ie2, pageSize: e2, currentPage: b2, hasNextPage: ae2, hasPreviousPage: j2, nextPage: oe2, previousPage: M2, expandedDates: D2, loadingDate: ne2, loadAllSessionsForDay: se2 };
|
|
2711
2712
|
}
|
|
2712
|
-
var
|
|
2713
|
-
function
|
|
2713
|
+
var Il = (e2) => e2?.onlineBooking?.enabled === true;
|
|
2714
|
+
function Ll(e2, t2) {
|
|
2714
2715
|
return e2 ? e2.anyResource ? t2 ?? `` : e2.staffMemberId : null;
|
|
2715
2716
|
}
|
|
2716
|
-
var Ll = [];
|
|
2717
2717
|
var Rl = [];
|
|
2718
|
-
var zl =
|
|
2719
|
-
var Bl = () => {
|
|
2718
|
+
var zl = [];
|
|
2719
|
+
var Bl = cn.map((e2) => ({ id: e2, gender: e2 }));
|
|
2720
|
+
var Vl = () => {
|
|
2720
2721
|
};
|
|
2721
|
-
var
|
|
2722
|
+
var Hl = async () => {
|
|
2722
2723
|
};
|
|
2723
|
-
var
|
|
2724
|
-
function
|
|
2725
|
-
let e2 = i(
|
|
2724
|
+
var Ul = n(null);
|
|
2725
|
+
function Wl() {
|
|
2726
|
+
let e2 = i(Ul);
|
|
2726
2727
|
if (!e2) throw Error(`useTimeSlotsContext must be used within TimeSlotsContextProvider`);
|
|
2727
2728
|
return e2;
|
|
2728
2729
|
}
|
|
2729
|
-
function
|
|
2730
|
+
function Gl(e2, t2, n2) {
|
|
2730
2731
|
e2 ? t2() : n2();
|
|
2731
2732
|
}
|
|
2732
|
-
var
|
|
2733
|
-
function
|
|
2733
|
+
var Kl = { loginRequired: `rescheduleLoginRequired`, notFound: `rescheduleNotFound`, accessDenied: `rescheduleAccessDenied`, failed: `rescheduleNotFound`, wrongService: `rescheduleNotFound`, notReschedulable: `rescheduleNotReschedulable` };
|
|
2734
|
+
function ql(e2 = 3) {
|
|
2734
2735
|
return Math.min(Math.max(e2, 1), sc);
|
|
2735
2736
|
}
|
|
2736
|
-
function
|
|
2737
|
+
function Jl(e2) {
|
|
2737
2738
|
let { isLoading: n2, bookingsSettingsLoading: r2 } = u();
|
|
2738
2739
|
kc(Cc.TIME_SLOTS, !n2 && !r2);
|
|
2739
|
-
let i2 = Is(), [a2] = c(() =>
|
|
2740
|
-
return p(oc, { children: p(t, { fallback: p(Ic, { nextAvailableSlotsCount:
|
|
2740
|
+
let i2 = Is(), [a2] = c(() => Ml(i2));
|
|
2741
|
+
return p(oc, { children: p(t, { fallback: p(Ic, { nextAvailableSlotsCount: ql(e2.nextAvailableSlotsCount), children: e2.children }), children: p(Xl, { ...e2, configurationPromise: a2 }) }) });
|
|
2741
2742
|
}
|
|
2742
|
-
function
|
|
2743
|
+
function Yl(e2) {
|
|
2743
2744
|
let [t2, n2] = c({ serviceId: e2, key: 0 });
|
|
2744
2745
|
return e2 !== t2.serviceId && n2({ serviceId: e2, key: t2.serviceId ? t2.key + 1 : t2.key }), t2.key;
|
|
2745
2746
|
}
|
|
2746
|
-
function
|
|
2747
|
-
let s2 = nc().isLoading, { searchParams: d2 } = vc(), { reschedule: f2 } = u(), [m2] = c(() => ({ locationId: d2.get(eo.location), staffId: d2.get(eo.resource), timeZone: (f2 ? void 0 : Pr(d2.get(eo.blob))?.timezone) ?? d2.get(eo.timezone) })), [h2, g2] = c(m2.timeZone), _2 =
|
|
2747
|
+
function Xl({ onlyAvailableSlots: e2 = true, nextAvailableSlotsCount: t2 = 3, loadDaysAvailabilityInitially: n2 = false, timeSlotLimitPerDay: r2 = 100, configurationPromise: i2, children: o2 }) {
|
|
2748
|
+
let s2 = nc().isLoading, { searchParams: d2 } = vc(), { reschedule: f2 } = u(), [m2] = c(() => ({ locationId: d2.get(eo.location), staffId: d2.get(eo.resource), timeZone: (f2 ? void 0 : Pr(d2.get(eo.blob))?.timezone) ?? d2.get(eo.timezone) })), [h2, g2] = c(m2.timeZone), _2 = ql(t2), [v2, y2] = c(false);
|
|
2748
2749
|
a(() => y2(true), []);
|
|
2749
2750
|
let b2 = v2 && !s2;
|
|
2750
2751
|
ll(b2);
|
|
2751
|
-
let x2 = js(i2), S2 = l(os, as, () => false), { serviceId: C2 } = u(), w2 =
|
|
2752
|
-
return p(cc, { fallback: p(Lc, { nextAvailableSlotsCount: _2, children: o2 }), feature: Q.timeSlots, children: p(
|
|
2752
|
+
let x2 = js(i2), S2 = l(os, as, () => false), { serviceId: C2 } = u(), w2 = Yl(C2), T2 = Number.isFinite(r2) ? Math.max(1, Math.floor(r2)) : 100;
|
|
2753
|
+
return p(cc, { fallback: p(Lc, { nextAvailableSlotsCount: _2, children: o2 }), feature: Q.timeSlots, children: p(Zl, { onlyAvailableSlots: e2, selectedTimeZone: h2, setSelectedTimeZone: g2, enabled: b2, nextAvailableSlotsCount: _2, loadDaysAvailabilityInitially: n2, timeSlotLimitPerDay: T2, landingLocationId: m2.locationId, landingStaffId: m2.staffId, businessTimeZone: x2.businessTimeZone, staffSelectionStrategy: x2.staffSelectionStrategy, allowGenderSelection: x2.allowGenderSelection, requestedGenderRejected: S2, children: o2 }) }, w2);
|
|
2753
2754
|
}
|
|
2754
|
-
function
|
|
2755
|
-
let { service: x2, serviceId: S2, serviceType: C2, setSlot: w2, clearSlot: T2, setMultiServiceSlot: ee2, clearMultiServiceSlot: E2, draftRevision: D2, navigateToMultiServiceForm: te2, selection: ne2, selectStaffMember: O2, clearSelection: k2, clearStaffMember: re2, withSelectionParam: ie2, staffMembers: A2, serviceOptionsAndVariants: ae2, isLoading: j2, hasError: oe2, multiServiceAppointmentServices: M2 =
|
|
2755
|
+
function Zl({ onlyAvailableSlots: e2, selectedTimeZone: t2, setSelectedTimeZone: n2, enabled: i2, nextAvailableSlotsCount: l2, loadDaysAvailabilityInitially: d2, timeSlotLimitPerDay: f2, landingLocationId: m2, landingStaffId: h2, businessTimeZone: g2, staffSelectionStrategy: _2, allowGenderSelection: v2, requestedGenderRejected: y2, children: b2 }) {
|
|
2756
|
+
let { service: x2, serviceId: S2, serviceType: C2, setSlot: w2, clearSlot: T2, setMultiServiceSlot: ee2, clearMultiServiceSlot: E2, draftRevision: D2, navigateToMultiServiceForm: te2, selection: ne2, selectStaffMember: O2, clearSelection: k2, clearStaffMember: re2, withSelectionParam: ie2, staffMembers: A2, serviceOptionsAndVariants: ae2, isLoading: j2, hasError: oe2, multiServiceAppointmentServices: M2 = zl, reschedule: se2 } = u(), N2 = se2 != null, ce2 = N2 && se2.status !== `ready`, le2 = N2 && se2.status === `loading`, ue2 = N2 ? Kl[se2.status] : void 0, de2 = ce2 ? null : se2?.booking ?? null, fe2 = de2 ? se2.validUntil : null, pe2 = ol(x2) && !Il(x2), P2 = pe2 || ce2 ? null : S2, me2 = vc(), he2 = N2 ? null : me2.searchParams.get(eo.blob), ge2 = o(() => io(Pr(he2)), [he2]), F2 = !S2 && !j2 && !oe2 && (ge2.valid || ge2.reason !== `too-few-services`), _e2 = F2 && ge2.valid && M2.some((e3) => !Il(e3) && ge2.services.some((t3) => t3.serviceId === e3._id)), ve2 = pe2 || _e2, ye2 = F2 && ge2.valid && !_e2 ? ge2.requestKey : null, be2 = o(() => ye2 && ge2.valid ? { services: ge2.services, locationId: ge2.locationId, locationType: ge2.locationType } : null, [ye2]), xe2 = !!P2 || be2 !== null, Se2 = P2 || ye2, Ce2 = i2 && !j2 && !oe2 && !xe2 && !le2, we2 = ic(), Te2 = nc(), { navigate: Ee2, resolvePath: De2 } = go(), [Oe2, ke2] = c(null), [Ae2, je2] = c(false), Me2 = s([]), Ne2 = s(false), Pe2 = r(() => (je2(true), Ne2.current ? Promise.resolve() : new Promise((e3) => {
|
|
2756
2757
|
Me2.current.push(e3);
|
|
2757
2758
|
})), []), Fe2 = i2 ? Intl.DateTimeFormat().resolvedOptions().timeZone : null, Ie2 = Ja(x2), Le2 = s(null), Re2 = oo(ne2), ze2 = s(Re2);
|
|
2758
2759
|
ze2.current = Re2;
|
|
2759
|
-
let Be2 = Re2 && !Re2.anyResource ? Re2.staffMemberId : null, Ve2 = ne2.requestedGender ?? null, I2 = !Xa(C2) && !Za(C2), He2 = I2 && !F2 && bs(ae2), L2 = F2 || I2 && _2 === `CUSTOMER_CANNOT_CHOOSE`, Ue2 = _2 !== void 0, We2 = Go({ allowGenderSelection: v2, staffSelectionStrategy: _2 ?? null }) && I2 && !F2 && !He2, Ge2 = We2 && !y2, Ke2 = o(() => P2 ? Pr(he2)?.services.find((e3) => e3.serviceId === P2) ?? null : null, [he2, P2]), qe2 = (A2 ?? []).map((e3) => e3.staffMemberId).join(`,`), Je2 = Ie2.map((e3) => e3.id).join(`,`), Ye2 = o(() =>
|
|
2760
|
+
let Be2 = Re2 && !Re2.anyResource ? Re2.staffMemberId : null, Ve2 = ne2.requestedGender ?? null, I2 = !Xa(C2) && !Za(C2), He2 = I2 && !F2 && bs(ae2), L2 = F2 || I2 && _2 === `CUSTOMER_CANNOT_CHOOSE`, Ue2 = _2 !== void 0, We2 = Go({ allowGenderSelection: v2, staffSelectionStrategy: _2 ?? null }) && I2 && !F2 && !He2, Ge2 = We2 && !y2, Ke2 = o(() => P2 ? Pr(he2)?.services.find((e3) => e3.serviceId === P2) ?? null : null, [he2, P2]), qe2 = (A2 ?? []).map((e3) => e3.staffMemberId).join(`,`), Je2 = Ie2.map((e3) => e3.id).join(`,`), Ye2 = o(() => _l({ entry: Ke2, appointmentLike: I2, staffChoiceHidden: L2, staffPriced: He2, staffSelectionStrategy: _2, genderAllowed: Ge2, staffMemberIds: qe2.split(`,`), locationIds: Je2.split(`,`) }), [Ke2, I2, L2, He2, _2, Ge2, qe2, Je2]), R2 = Ye2.staff, Xe2 = Ye2.locationId, Ze2 = L2 || R2 !== null, [Qe2, $e2] = c(null), [et2, tt2] = c(m2 !== null || N2), z2 = o(() => x2 ? Os(x2) : [], [x2]), nt2 = R2 && !R2.anyResource ? R2.staffMemberId : null, rt2 = o(() => {
|
|
2760
2761
|
if (!nt2) return z2;
|
|
2761
2762
|
let e3 = z2.find((e4) => e4.staffMemberId === nt2);
|
|
2762
2763
|
return e3 ? [e3] : z2;
|
|
2763
2764
|
}, [z2, nt2]), it2 = de2?.locationId ?? null, at2 = o(() => {
|
|
2764
2765
|
let e3 = Ds(Ie2, rt2);
|
|
2765
2766
|
return !it2 || e3.some((e4) => e4.id === it2) ? e3 : Ie2.filter((t3) => t3.id === it2 || e3.some((e4) => e4.id === t3.id));
|
|
2766
|
-
}, [x2, rt2, it2]), ot2 = (e3) => !!e3 && at2.some((t3) => t3.id === e3), st2 = Qe2 ?? (et2 ? ot2(it2) ? it2 : m2 : null), ct2 = Ie2.length > 1 && at2.length === 1 ? at2[0].id : null, B2 = Xe2 ?? (ot2(st2) ? st2 : ct2), lt2 = o(() => Xe2 ? [] : at2.map((e3) => ({ id: e3.id, name: e3.label })), [at2, Xe2]), ut2 = o(() => new Map(z2.map((e3) => [e3.staffMemberId, e3.locationCoverage])), [z2]), dt2 = r((e3, t3) => ws([{ staffMemberId: e3, locationCoverage: ut2.get(e3) }], t3).length === 1, [ut2]), ft2 = o(() => Ze2 ? [] : (A2 ?? []).filter((e3) => e3.name).map((e3) => ({ id: e3.staffMemberId, name: e3.name ?? ``, gender: null })), [A2, Ze2]), pt2 = o(() => B2 ? ft2.filter((e3) => dt2(e3.id, B2)) : ft2, [ft2, B2, dt2]), mt2 = I2 && !Ue2 ?
|
|
2767
|
+
}, [x2, rt2, it2]), ot2 = (e3) => !!e3 && at2.some((t3) => t3.id === e3), st2 = Qe2 ?? (et2 ? ot2(it2) ? it2 : m2 : null), ct2 = Ie2.length > 1 && at2.length === 1 ? at2[0].id : null, B2 = Xe2 ?? (ot2(st2) ? st2 : ct2), lt2 = o(() => Xe2 ? [] : at2.map((e3) => ({ id: e3.id, name: e3.label })), [at2, Xe2]), ut2 = o(() => new Map(z2.map((e3) => [e3.staffMemberId, e3.locationCoverage])), [z2]), dt2 = r((e3, t3) => ws([{ staffMemberId: e3, locationCoverage: ut2.get(e3) }], t3).length === 1, [ut2]), ft2 = o(() => Ze2 ? [] : (A2 ?? []).filter((e3) => e3.name).map((e3) => ({ id: e3.staffMemberId, name: e3.name ?? ``, gender: null })), [A2, Ze2]), pt2 = o(() => B2 ? ft2.filter((e3) => dt2(e3.id, B2)) : ft2, [ft2, B2, dt2]), mt2 = I2 && !Ue2 ? Rl : pt2, ht2 = I2 && !Ue2 ? 0 : ft2.length, gt2 = Ge2 && ht2 > 1, _t2 = o(() => gt2 ? [...Bl, ...mt2] : mt2, [gt2, mt2]), [vt2, yt2] = c(null), [bt2, xt2] = c(h2 !== null);
|
|
2767
2768
|
bt2 && h2 !== null && B2 !== null && !dt2(h2, B2) && xt2(false);
|
|
2768
2769
|
let St2 = vt2 ?? (bt2 ? h2 : null), V2 = R2 ? R2.anyResource ? null : R2.staffMemberId : St2 !== null && pt2.some((e3) => e3.id === St2) ? St2 : null, Ct2 = Re2?.anyResource ? Ve2 : null, [wt2, Tt2] = c(Ct2), [Et2, Dt2] = c(Ct2);
|
|
2769
2770
|
!y2 && Re2?.anyResource && Ve2 !== Et2 && (Dt2(Ve2), Tt2(Ve2));
|
|
2770
2771
|
let Ot2 = R2 ? Ye2.requestedGender : We2 && ht2 > 1 && V2 === null ? wt2 : null, kt2 = y2 ? null : Ot2, At2 = r((e3) => {
|
|
2771
2772
|
ze2.current = e3, e3 ? e3.anyResource ? k2(kt2 ?? void 0) : O2(e3.staffMemberId) : re2();
|
|
2772
|
-
}, [re2, k2, O2, kt2]), jt2 = r((e3) => At2(e3 ? { anyResource: false, staffMemberId: e3 } : { anyResource: true }), [At2]), Mt2 = (de2?.addOnIds ?? []).filter((e3) => x2?.addOnGroups?.some((t3) => t3.addOnIds?.includes(e3))), Nt2 = de2 && Xa(C2) ? de2.participants : null, Pt2 = I2 ? to(ne2) : null, { addOnIds: Ft2, ...It2 } = Pt2 ?? {}, Lt2 = I2 && de2 ? Mt2.length ? { ...It2, addOnIds: Mt2 } : It2 : Pt2, Rt2 = Lt2 ? $o(Lt2) : void 0, zt2 = JSON.stringify(Ot2 ? { ...Rt2, requestedGender: { gender: Ot2 } } : Rt2 ?? null), Bt2 = o(() => JSON.parse(zt2), [zt2]), Vt2 = R2?.anyResource === true, Ht2 = r((e3) => Vt2 || _2 !== void 0 &&
|
|
2773
|
+
}, [re2, k2, O2, kt2]), jt2 = r((e3) => At2(e3 ? { anyResource: false, staffMemberId: e3 } : { anyResource: true }), [At2]), Mt2 = (de2?.addOnIds ?? []).filter((e3) => x2?.addOnGroups?.some((t3) => t3.addOnIds?.includes(e3))), Nt2 = de2 && Xa(C2) ? de2.participants : null, Pt2 = I2 ? to(ne2) : null, { addOnIds: Ft2, ...It2 } = Pt2 ?? {}, Lt2 = I2 && de2 ? Mt2.length ? { ...It2, addOnIds: Mt2 } : It2 : Pt2, Rt2 = Lt2 ? $o(Lt2) : void 0, zt2 = JSON.stringify(Ot2 ? { ...Rt2, requestedGender: { gender: Ot2 } } : Rt2 ?? null), Bt2 = o(() => JSON.parse(zt2), [zt2]), Vt2 = R2?.anyResource === true, Ht2 = r((e3) => Vt2 || _2 !== void 0 && pl({ isAppointment: I2, staffOnSlotCount: e3, hasStaffFilter: V2 !== null, hasRequestedGender: kt2 !== null, hasStaffPricedVariants: He2, staffSelectionStrategy: _2 }), [Vt2, I2, _2, V2, kt2, He2]), Ut2 = r((e3) => R2 ?? (L2 ? null : e3), [R2, L2]), Wt2 = r((e3) => {
|
|
2773
2774
|
let t3 = e3 === null ? null : _t2.find((t4) => t4.id === e3);
|
|
2774
2775
|
t3 !== void 0 && (xt2(false), yt2(t3 && !t3.gender ? t3.id : null), Tt2(t3?.gender ?? null));
|
|
2775
2776
|
}, [_t2]), Gt2 = r((e3) => {
|
|
@@ -2782,7 +2783,7 @@ function Xl({ onlyAvailableSlots: e2, selectedTimeZone: t2, setSelectedTimeZone:
|
|
|
2782
2783
|
dn2.current = false;
|
|
2783
2784
|
return;
|
|
2784
2785
|
}
|
|
2785
|
-
ke2(null), Le2.current &&
|
|
2786
|
+
ke2(null), Le2.current && Gl(P2, T2, E2), Le2.current = null, fn2.current = null;
|
|
2786
2787
|
}, [U2, be2, H2, B2, V2, Bt2, Nt2, e2, l2, f2, D2]);
|
|
2787
2788
|
let pn2 = r(async () => {
|
|
2788
2789
|
let e3 = await un2();
|
|
@@ -2814,7 +2815,7 @@ function Xl({ onlyAvailableSlots: e2, selectedTimeZone: t2, setSelectedTimeZone:
|
|
|
2814
2815
|
mn2 && Tn2(Sn2());
|
|
2815
2816
|
}
|
|
2816
2817
|
}, [gn2, _n2, mn2, hn2, Tn2, Sn2]);
|
|
2817
|
-
let Dn2 = x2?.schedule?.lastSessionEnd, On2 = I2 || Xa(C2) || Za(C2) && !ul(Dn2, Jt2), kn2 = !!(Ae2 && i2 && !j2 && P2 && H2 && Jt2 !== void 0), An2 = kn2 && P2 && H2 && Jt2 !== void 0 ?
|
|
2818
|
+
let Dn2 = x2?.schedule?.lastSessionEnd, On2 = I2 || Xa(C2) || Za(C2) && !ul(Dn2, Jt2), kn2 = !!(Ae2 && i2 && !j2 && P2 && H2 && Jt2 !== void 0), An2 = kn2 && P2 && H2 && Jt2 !== void 0 ? fl({ serviceId: P2, serviceType: C2, lastSessionEnd: Dn2, timeZone: H2, now: Jt2, onlyAvailableSlots: e2, locationId: B2, staffId: V2, timeSlotLimitPerDay: f2, customerChoices: Bt2, minRemainingCapacity: Nt2 }) : void 0, G2 = Fl(l2, An2), jn2 = Ae2 && P2 && On2 && !(Ae2 && P2 && On2 && (!i2 || j2)) && !H2, Mn2 = ve2 ? `onlineBookingOff` : ue2 ?? (G2.error === null ? jn2 ? `timeZoneMissing` : null : `upcomingSlotsLoadFailed`), Nn2 = U2 !== null, Pn2 = o(() => yl({ sessions: G2.sessions, dayQuery: Nn2, daySlots: on2, staffFilter: V2, appointmentLike: I2, limitPerDay: f2, expandedDates: G2.expandedDates }), [G2.sessions, Nn2, on2, V2, I2, f2, G2.expandedDates]), { slotIdOf: Fn2 } = Pn2, In2 = Ae2 && (An2 ? G2.firstPageSettled : kn2 || i2 && !j2 && !P2 || jn2);
|
|
2818
2819
|
Ne2.current = In2, a(() => {
|
|
2819
2820
|
if (!In2) return;
|
|
2820
2821
|
let e3 = Me2.current;
|
|
@@ -2832,10 +2833,10 @@ function Xl({ onlyAvailableSlots: e2, selectedTimeZone: t2, setSelectedTimeZone:
|
|
|
2832
2833
|
}, [Hn2, P2, C2, M2, N2]), Wn2 = r((e3) => {
|
|
2833
2834
|
if (e3 === null) {
|
|
2834
2835
|
let e4 = Le2.current !== null;
|
|
2835
|
-
Le2.current = null, fn2.current = null, ke2(null), e4 &&
|
|
2836
|
+
Le2.current = null, fn2.current = null, ke2(null), e4 && Gl(P2, T2, E2);
|
|
2836
2837
|
return;
|
|
2837
2838
|
}
|
|
2838
|
-
let t3 =
|
|
2839
|
+
let t3 = bl(Pn2, e3);
|
|
2839
2840
|
if (!t3) return;
|
|
2840
2841
|
if (F2) {
|
|
2841
2842
|
if (!ee2(t3.nestedTimeSlots ?? [], H2 ?? void 0)) return;
|
|
@@ -2843,10 +2844,10 @@ function Xl({ onlyAvailableSlots: e2, selectedTimeZone: t2, setSelectedTimeZone:
|
|
|
2843
2844
|
return;
|
|
2844
2845
|
}
|
|
2845
2846
|
Le2.current = t3, ke2(t3), K2(e3, t3);
|
|
2846
|
-
let n3 =
|
|
2847
|
-
if (w2(ys(t3), { staffId: I2 ? void 0 :
|
|
2847
|
+
let n3 = wl(t3);
|
|
2848
|
+
if (w2(ys(t3), { staffId: I2 ? void 0 : Cl(t3), timezone: H2 ?? void 0, bookable: t3.bookable, staffChoiceRequired: I2 && Ue2 && !L2 && n3.length > 1 && !Ht2(n3.length), rescheduleStaffId: I2 && (_2 !== `CUSTOMER_MAY_CHOOSE` || !Ht2(n3.length)) ? n3[0] : void 0 }), !I2) return;
|
|
2848
2849
|
let r2 = ze2.current, i3;
|
|
2849
|
-
i3 = R2 || (V2 && n3.includes(V2) ? { anyResource: false, staffMemberId: V2 } : kt2 !== null && Ht2(n3.length) ? { anyResource: true } :
|
|
2850
|
+
i3 = R2 || (V2 && n3.includes(V2) ? { anyResource: false, staffMemberId: V2 } : kt2 !== null && Ht2(n3.length) ? { anyResource: true } : ml(n3, Ue2 && Ht2(n3.length))), Ll(i3, kt2) !== Ll(r2, Ve2) && At2(i3);
|
|
2850
2851
|
}, [F2, P2, T2, E2, ee2, w2, Pn2, K2, H2, I2, Ue2, _2, Ht2, R2, V2, kt2, Ve2, At2]), Gn2 = r(() => {
|
|
2851
2852
|
let e3 = Le2.current;
|
|
2852
2853
|
if (!e3 || N2 || !e3.bookable) return;
|
|
@@ -2857,20 +2858,20 @@ function Xl({ onlyAvailableSlots: e2, selectedTimeZone: t2, setSelectedTimeZone:
|
|
|
2857
2858
|
if (!P2) return;
|
|
2858
2859
|
let t3;
|
|
2859
2860
|
if (I2) {
|
|
2860
|
-
let n4 =
|
|
2861
|
+
let n4 = wl(e3), r2 = hl(n4, Ut2(ze2.current), Ht2(n4.length));
|
|
2861
2862
|
t3 = (r2.isComplete ? r2.resourceId : n4[0]) ?? (n4.length ? null : void 0);
|
|
2862
2863
|
}
|
|
2863
2864
|
let n3 = De2(`bookingForm`, { slug: x2?.mainSlug?.name ?? null, serviceId: P2 });
|
|
2864
2865
|
Hn2(Pc({ serviceId: P2, serviceType: C2 ?? void 0, start: e3.localStartDate, end: e3.localEndDate, timeZone: H2 ?? void 0, isEligibleForFlowCompletion: !!n3 })), n3 && Ee2(ie2(n3, { handoff: true, staffId: t3 }));
|
|
2865
|
-
}, [Hn2, F2, te2, H2, P2, C2, x2, I2, Ut2, Ht2, Ee2, De2, ie2, N2]), Kn2 = Oe2 ?
|
|
2866
|
-
return p(
|
|
2866
|
+
}, [Hn2, F2, te2, H2, P2, C2, x2, I2, Ut2, Ht2, Ee2, De2, ie2, N2]), Kn2 = Oe2 ? wl(Oe2) : null, qn2 = Kn2 ? F2 || !I2 || hl(Kn2, Ut2(Re2), Ht2(Kn2.length)).isComplete : false, Jn2 = Kn2 ? Ht2(Kn2.length) : false, Yn2 = o(() => !Oe2 || Ze2 ? [] : Sl(Oe2).map((e3) => ({ staffMemberId: e3.staffMemberId, name: e3.name || null, image: null, isSelected: e3.staffMemberId === Be2 })), [Oe2, Ze2, Be2]), Xn2 = o(() => ({ isMultiService: F2, availabilityRequestKey: Se2, needsServiceChoice: Ce2, isRescheduling: N2, rescheduleValidUntil: rn2, businessTimeZone: g2, canChangeTimeZone: Kt2, setTimeZone: qt2, locationFilterOptions: lt2, selectedLocationFilter: B2, setLocationFilter: Gt2, staffFilterOptions: _t2, selectedStaffFilter: V2, setStaffFilter: Wt2, requestedGender: kt2, genderSelectionAllowed: Ge2, currentTimeSlotsPage: U2 ? 1 : G2.currentPage, hasNextTimeSlotsPage: !U2 && G2.hasNextPage, hasPreviousTimeSlotsPage: !U2 && G2.hasPreviousPage, nextTimeSlotsPage: U2 ? Hl : G2.nextPage, loadUpcomingTimeSlots: Pe2, upcomingTimeSlotsRequested: Ae2, previousTimeSlotsPage: U2 ? Vl : G2.previousPage, timeSlots: Pn2.rows.map((e3) => xl(e3, H2, Fn2, L2)), isLoading: zn2, hasError: Vn2, errorCode: Bn2, selectedDate: an2, daysAvailabilityRange: Xt2, daysAvailability: nn2, daysAvailabilityLoading: Qt2, daysAvailabilityHasError: $t2, selectDate: wn2, setDaysAvailabilityRange: en2, goToNextAvailableDate: En2, nextAvailableSlotsCount: l2, timeZone: H2, staffFromSlots: Yn2, selectedResourceId: Be2, setSelectedResource: jt2, canAutoAssignStaff: Jn2, isComplete: qn2, selectedTimeSlot: Oe2 ? xl(Oe2, H2, Fn2, L2) : null, selectTimeSlot: Wn2, navigateToBookingForm: Gn2, timeSlotLimitPerDay: f2, daysWithMore: Pn2.daysWithMore, loadingDate: G2.loadingDate, loadAllTimeSlotsForDay: G2.loadAllSessionsForDay }), [F2, Se2, Ce2, N2, rn2, g2, H2, Kt2, qt2, G2, Pe2, Ae2, lt2, B2, Gt2, _t2, V2, Wt2, kt2, Ge2, U2, zn2, Bn2, Vn2, Pn2, an2, Xt2, nn2, Qt2, $t2, wn2, en2, En2, l2, Yn2, Be2, jt2, Jn2, qn2, Oe2, Wn2, Gn2, f2, Fn2, L2]);
|
|
2867
|
+
return p(Ul.Provider, { value: Xn2, children: b2 });
|
|
2867
2868
|
}
|
|
2868
|
-
var
|
|
2869
|
+
var Ql = sn(`4936242d-905c-48bf-80ce-5f56d075de4f`);
|
|
2869
2870
|
export {
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2871
|
+
Jl as TimeSlotsContextProvider,
|
|
2872
|
+
Jl as default,
|
|
2873
|
+
Ql as injectAccessTokenGetter,
|
|
2874
|
+
Ul as timeSlotsContext,
|
|
2875
|
+
Wl as useTimeSlotsContext
|
|
2875
2876
|
};
|
|
2876
2877
|
//# sourceMappingURL=context-time-slots.mjs.map
|