@wix/bookings 1.0.1776 → 1.0.1778

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.
Files changed (71) hide show
  1. package/build/cjs/context-booking-checkout.d.ts +243 -108
  2. package/build/cjs/context-booking-checkout.js +177 -183
  3. package/build/cjs/context-booking-checkout.js.map +1 -1
  4. package/build/cjs/context-categories.d.ts +16 -143
  5. package/build/cjs/context-categories.js +412 -412
  6. package/build/cjs/context-categories.js.map +1 -1
  7. package/build/cjs/context-locations.d.ts +16 -287
  8. package/build/cjs/context-locations.js +336 -336
  9. package/build/cjs/context-locations.js.map +1 -1
  10. package/build/cjs/context-service-addons.d.ts +2 -2
  11. package/build/cjs/context-service-addons.js +1 -1
  12. package/build/cjs/context-service-addons.js.map +1 -1
  13. package/build/cjs/context-service.d.ts +71 -33
  14. package/build/cjs/context-service.js +98 -96
  15. package/build/cjs/context-service.js.map +1 -1
  16. package/build/cjs/context-services.js +1 -1
  17. package/build/cjs/context-services.js.map +1 -1
  18. package/build/cjs/context-time-slots.d.ts +10 -0
  19. package/build/cjs/context-time-slots.js +2 -2
  20. package/build/cjs/context-time-slots.js.map +1 -1
  21. package/build/es/context-booking-checkout.d.mts +243 -108
  22. package/build/es/context-booking-checkout.mjs +177 -180
  23. package/build/es/context-booking-checkout.mjs.map +1 -1
  24. package/build/es/context-categories.d.mts +16 -143
  25. package/build/es/context-categories.mjs +412 -412
  26. package/build/es/context-categories.mjs.map +1 -1
  27. package/build/es/context-locations.d.mts +16 -287
  28. package/build/es/context-locations.mjs +336 -336
  29. package/build/es/context-locations.mjs.map +1 -1
  30. package/build/es/context-service-addons.d.mts +2 -2
  31. package/build/es/context-service-addons.mjs +1 -1
  32. package/build/es/context-service-addons.mjs.map +1 -1
  33. package/build/es/context-service.d.mts +71 -33
  34. package/build/es/context-service.mjs +98 -96
  35. package/build/es/context-service.mjs.map +1 -1
  36. package/build/es/context-services.mjs +1 -1
  37. package/build/es/context-services.mjs.map +1 -1
  38. package/build/es/context-time-slots.d.mts +10 -0
  39. package/build/es/context-time-slots.mjs +2 -2
  40. package/build/es/context-time-slots.mjs.map +1 -1
  41. package/build/internal/cjs/context-booking-checkout.d.ts +243 -108
  42. package/build/internal/cjs/context-categories.d.ts +16 -143
  43. package/build/internal/cjs/context-locations.d.ts +16 -287
  44. package/build/internal/cjs/context-service-addons.d.ts +2 -2
  45. package/build/internal/cjs/context-service.d.ts +71 -33
  46. package/build/internal/cjs/context-time-slots.d.ts +10 -0
  47. package/build/internal/es/context-booking-checkout.d.mts +243 -108
  48. package/build/internal/es/context-categories.d.mts +16 -143
  49. package/build/internal/es/context-locations.d.mts +16 -287
  50. package/build/internal/es/context-service-addons.d.mts +2 -2
  51. package/build/internal/es/context-service.d.mts +71 -33
  52. package/build/internal/es/context-time-slots.d.mts +10 -0
  53. package/{_sdk-exports → context-runtime}/context-booking-checkout/runtime.d.ts +243 -108
  54. package/context-runtime/context-booking-checkout/runtime.js +3 -0
  55. package/{_sdk-exports → context-runtime}/context-categories/runtime.d.ts +16 -143
  56. package/context-runtime/context-categories/runtime.js +2 -0
  57. package/context-runtime/context-locations/runtime.d.ts +195 -0
  58. package/context-runtime/context-locations/runtime.js +2 -0
  59. package/{_sdk-exports → context-runtime}/context-service/runtime.d.ts +71 -33
  60. package/{_sdk-exports → context-runtime}/context-service/runtime.js +3 -3
  61. package/{_sdk-exports → context-runtime}/context-service-addons/runtime.d.ts +2 -2
  62. package/{_sdk-exports → context-runtime}/context-time-slots/runtime.d.ts +10 -0
  63. package/{_sdk-exports → context-runtime}/context-time-slots/runtime.js +2 -2
  64. package/package.json +8 -8
  65. package/_sdk-exports/context-booking-checkout/runtime.js +0 -3
  66. package/_sdk-exports/context-categories/runtime.js +0 -2
  67. package/_sdk-exports/context-locations/runtime.d.ts +0 -466
  68. package/_sdk-exports/context-locations/runtime.js +0 -2
  69. /package/{_sdk-exports → context-runtime}/context-service-addons/runtime.js +0 -0
  70. /package/{_sdk-exports → context-runtime}/context-services/runtime.d.ts +0 -0
  71. /package/{_sdk-exports → context-runtime}/context-services/runtime.js +0 -0
@@ -2696,62 +2696,94 @@ declare const SERVICE_CTA_STATES: {
2696
2696
  type ServiceCtaState = (typeof SERVICE_CTA_STATES)[keyof typeof SERVICE_CTA_STATES];
2697
2697
  //#endregion
2698
2698
  //#region ../bookings-flow-data/dist/types.d.ts
2699
- /** Whether the Booking Preferences hold one service or a Multi-Service Appointment. Derived,
2700
- * not chosen: the bookings-uou writer sets it from the service count on every encode (2+
2701
- * services is `multi`). Readers should count `services` rather than read it. */
2702
- type BookingMode = 'single' | 'multi';
2703
- /** A committed resource selection for one resource *type* (staff, room, equipment…).
2704
- * Carried as ids — the server accepts ids via `resourceSelections`, so the full resource
2705
- * object (name, schedule) is never needed in the contract.
2699
+ /**
2700
+ * Whether the selection holds 1 service or several services booked together. Supported values:
2701
+ * - `'single'`: 1 service.
2702
+ * - `'multi'`: 2 or more services, booked together as a multi-service appointment.
2706
2703
  *
2707
- * Not `bookings.ResourceSelection` (API shape is `resourceTypeId` + `selectionMethod`). */
2704
+ * It follows the number of entries in `services`, so count those instead of reading it.
2705
+ */
2706
+ type BookingMode = 'single' | 'multi';
2707
+ /** Resources the visitor chose for 1 resource type, such as a staff member or a room. */
2708
2708
  interface ResourceSelection {
2709
+ /** ID of the resource type, such as the staff member resource type. */
2709
2710
  type: string;
2711
+ /** IDs of the chosen resources of this type. */
2710
2712
  ids: string[];
2711
- /** The user picked "any available" rather than a specific resource of this type. */
2713
+ /** Whether the visitor chose any available resource of this type, instead of a specific one. */
2712
2714
  anyResource?: boolean;
2713
2715
  }
2714
- /** A chosen service variant (dynamic pricing): participant count and/or option choices. */
2716
+ /** A variant the visitor chose for a service with variants: a number of participants, option choices, or both. */
2715
2717
  type SelectedVariant = Pick<ServiceChoices, 'numberOfParticipants'> & {
2716
- /** Selected option values (wire carries string ids / custom values, not full `ServiceChoice` objects). */choices?: string[];
2718
+ /** The chosen option values: a choice ID, or the text of a custom choice. */choices?: string[];
2717
2719
  };
2718
2720
  /** Genders a visitor can narrow "any staff member" to, in display order. Same literals as the
2719
2721
  * availability API's `requestedGender.gender`, single- and multi-service alike. */
2720
2722
  declare const REQUESTED_GENDERS: readonly ["ANY_FEMALE", "ANY_MALE"];
2721
2723
  type RequestedGender = (typeof REQUESTED_GENDERS)[number];
2722
- /** A chosen add-on with its quantity — maps SDK `BookedAddOn` fields to flow names (`id` ↔ `_id`). */
2724
+ /** An add-on the visitor chose, with its quantity. */
2723
2725
  type AddOn = {
2724
- id: NonNullable<BookedAddOn['_id']>;
2726
+ /** ID of the add-on. */id: NonNullable<BookedAddOn['_id']>; /** Number of the add-on to book. */
2725
2727
  quantity: NonNullable<BookedAddOn['quantity']>;
2726
2728
  };
2727
- /** One service's committed selections. Slot/schedule fields align with `bookings.V2Slot`. */
2729
+ /** What the visitor chose for 1 service: the service, its time slot, and their choices. */
2728
2730
  type ServicePreference = {
2729
- serviceId: NonNullable<V2Slot['serviceId']>;
2731
+ /** ID of the service. */serviceId: NonNullable<V2Slot['serviceId']>; /** Slug of the service, as in its page URL. */
2730
2732
  slug?: NonNullable<Slug['name']>;
2731
- serviceType?: Service['type']; /** ISO local datetimes — per service (services in a bundle can start at different times). */
2732
- slotStart?: V2Slot['startDate'];
2733
- slotEnd?: V2Slot['endDate'];
2734
- eventId?: V2Slot['eventId'];
2735
- scheduleId?: V2Slot['scheduleId']; /** Needed to rehydrate class sessions in the OOI form. */
2736
- sessionId?: V2Slot['sessionId']; /** Id only — maps to `SlotLocation._id` / location refetch at the destination. */
2737
- locationId?: NonNullable<SlotLocation['_id']>; /** Availability naming (`BUSINESS` | `CUSTOM` | `CUSTOMER`); the booking step translates it to the bookings enum. */
2738
- locationType?: 'BUSINESS' | 'CUSTOM' | 'CUSTOMER';
2739
- resources?: ResourceSelection[];
2740
- selectedVariants?: SelectedVariant[];
2741
- addOns?: AddOn[]; /** The duration variant choice's id, sent to availability as `customerChoices.durationChoiceId`. */
2742
- durationChoiceId?: string;
2743
- /** A chosen duration in minutes, sent as `customerChoices.durationInMinutes`. With add-ons the
2744
- * API requires it to equal the service duration plus theirs, so writers usually omit it. */
2745
- durationInMinutes?: number; /** Narrows "any staff member" to a gender, sent as `customerChoices.requestedGender`. */
2733
+ /**
2734
+ * Type of the service. Supported values:
2735
+ * - `'APPOINTMENT'`: An appointment, booked by time slot.
2736
+ * - `'CLASS'`: A class session.
2737
+ * - `'COURSE'`: A course, booked as a whole by its schedule.
2738
+ */
2739
+ serviceType?: Service['type'];
2740
+ /**
2741
+ * Start of the time slot, as a local date and time without an offset, such as
2742
+ * `'2026-10-08T10:00:00'`. It's in the selection's `timezone`. Each service has its own, because
2743
+ * services booked together can start at different times. Absent for a course.
2744
+ */
2745
+ slotStart?: V2Slot['startDate']; /** End of the time slot, in the same format as `slotStart`. Absent for a course. */
2746
+ slotEnd?: V2Slot['endDate']; /** ID of the calendar event of a class session. */
2747
+ eventId?: V2Slot['eventId']; /** ID of the schedule the slot belongs to. For a course, the course's schedule. */
2748
+ scheduleId?: V2Slot['scheduleId']; /** ID of the class session. */
2749
+ sessionId?: V2Slot['sessionId']; /** ID of the business location of the slot. */
2750
+ locationId?: NonNullable<SlotLocation['_id']>;
2751
+ /**
2752
+ * Where the service takes place. Supported values:
2753
+ * - `'BUSINESS'`: At one of the business's locations, in `locationId`.
2754
+ * - `'CUSTOM'`: At an address the business set for the service.
2755
+ * - `'CUSTOMER'`: At the customer's address.
2756
+ */
2757
+ locationType?: 'BUSINESS' | 'CUSTOM' | 'CUSTOMER'; /** Resources the visitor chose, such as a staff member, by resource type. */
2758
+ resources?: ResourceSelection[]; /** Variants the visitor chose, for a service with variants. */
2759
+ selectedVariants?: SelectedVariant[]; /** Add-ons the visitor chose. */
2760
+ addOns?: AddOn[]; /** ID of the duration choice the visitor chose, for a service with a choice of durations. */
2761
+ durationChoiceId?: string; /** Duration the visitor chose, in minutes. */
2762
+ durationInMinutes?: number;
2763
+ /**
2764
+ * Gender the visitor asked for when they chose any available staff member. Supported values:
2765
+ * `'ANY_FEMALE'`, `'ANY_MALE'`.
2766
+ */
2746
2767
  requestedGender?: RequestedGender;
2747
2768
  };
2748
- /** One accumulating object; each destination builder projects the slice it needs. */
2769
+ /** What the visitor selected to book: the services, their time slots, and their choices. */
2749
2770
  interface BookingPreferences {
2771
+ /** Whether the selection holds 1 service or several. Count `services` instead of reading it. */
2750
2772
  mode: BookingMode;
2773
+ /**
2774
+ * Time zone of the slots' local dates and times, as an IANA name such as `'Europe/London'`.
2775
+ * Can be absent when the selection has no time slot, such as a course.
2776
+ */
2751
2777
  timezone?: V2Slot['timezone'];
2778
+ /** The selected services, in booking order. */
2752
2779
  services: ServicePreference[];
2753
- /** The visitor ticked "I have a coupon" in the Booking Summary, so checkout must not be skipped.
2754
- * Absent means unticked; writers omit `false`. */
2780
+ /**
2781
+ * Whether the visitor asked to enter a promo code, in the booking summary. When it's `true`, a
2782
+ * priced booking paid in person goes through the checkout page, where the visitor enters the
2783
+ * code.
2784
+ *
2785
+ * Default: `false`
2786
+ */
2755
2787
  wantsPromoCode?: boolean;
2756
2788
  }
2757
2789
  //#endregion
@@ -3943,6 +3975,12 @@ interface Reschedule {
3943
3975
  * couldn't be read.
3944
3976
  */
3945
3977
  validUntil: string | null;
3978
+ /**
3979
+ * Name of the plan that the booking was paid with, in the site's language when it's translated.
3980
+ *
3981
+ * `null` when the booking wasn't paid with a plan, or the plan couldn't be read.
3982
+ */
3983
+ planName: string | null;
3946
3984
  }
3947
3985
  //#endregion
3948
3986
  //#region src/api/adapters/booking/reschedule-booking.d.ts
@@ -20,17 +20,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // context-service.ts
21
21
  var context_service_exports = {};
22
22
  __export(context_service_exports, {
23
- SERVICE_CONTEXT_MISSING_PROVIDER_ERROR: () => Fx,
24
- ServiceContextProvider: () => sS,
25
- default: () => sS,
26
- injectAccessTokenGetter: () => cS,
27
- resolveServiceTarget: () => Lx,
28
- serviceContext: () => Px,
29
- useServiceContext: () => Ix
23
+ SERVICE_CONTEXT_MISSING_PROVIDER_ERROR: () => Lx,
24
+ ServiceContextProvider: () => lS,
25
+ default: () => lS,
26
+ injectAccessTokenGetter: () => uS,
27
+ resolveServiceTarget: () => zx,
28
+ serviceContext: () => Ix,
29
+ useServiceContext: () => Rx
30
30
  });
31
31
  module.exports = __toCommonJS(context_service_exports);
32
32
 
33
- // _sdk-exports/context-service/runtime.js
33
+ // context-runtime/context-service/runtime.js
34
34
  var import_react = require("react");
35
35
  var import_services_manager_react = require("@wix/services-manager-react");
36
36
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -4752,7 +4752,7 @@ function Xh(e5) {
4752
4752
  }
4753
4753
  function Zh(e5) {
4754
4754
  let t2 = e5(Kh);
4755
- return { open: ({ slug: e6 }, n2) => t2.open({ slug: e6, context: n2 }), close: () => t2.close(), getContext: () => t2.getContext() };
4755
+ return { open: ({ slug: e6 }, n2) => t2.open({ slug: e6, payload: n2 }), close: () => t2.close(), getContext: () => t2.getPayload() };
4756
4756
  }
4757
4757
  function Qh() {
4758
4758
  let e5 = ds();
@@ -6034,7 +6034,7 @@ function ex({ bookingsSettings: e5, children: n2 }) {
6034
6034
  return e5 ? (0, import_jsx_runtime.jsx)(Kb.Provider, { value: { isLoading: false, ...e5 }, children: n2 }) : (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(Kb.Provider, { value: Gb, children: n2 }), children: (0, import_jsx_runtime.jsx)($b, { settingsPromise: i2, children: n2 }) });
6035
6035
  }
6036
6036
  function tx({ isLoading: e5, hasError: t2, bookingsSettingsLoading: n2, rescheduleRequest: r2 = null, editingSurface: i2 = false, children: a2 }) {
6037
- let o2 = r2 ? { status: `loading`, booking: null, validUntil: null } : null, s2 = { service: null, serviceName: null, serviceDescription: null, serviceTagLine: null, serviceDefaultDuration: null, serviceImage: null, serviceSlug: null, servicePageLink: null, serviceId: null, serviceType: null, servicePrice: Lh, isVariedService: false, serviceOptionsAndVariants: null, pricingOption: null, isLoadingServiceOptionsAndVariants: e5, hasAddOns: false, isConferenceEnabled: false, offeredDays: [], courseAvailability: null, courseStartDate: null, courseEndDate: null, staffMembers: [], coverImage: void 0, gallery: [], serviceLocations: [], policyDescription: null, serviceBookability: { state: vh.AVAILABLE, isAvailableForBooking: false, bookingOpensAt: null }, displayTimeZone: `UTC`, isAvailableForBooking: () => false, hasPolicyDescription: () => false, hasCoverImage: () => false, hasGalleryImages: () => false, isVariantDuration: () => false, isLoading: e5, hasError: t2, locale: `en-US`, selectStaffMember: () => {
6037
+ let o2 = r2 ? { status: `loading`, booking: null, validUntil: null, planName: null } : null, s2 = { service: null, serviceName: null, serviceDescription: null, serviceTagLine: null, serviceDefaultDuration: null, serviceImage: null, serviceSlug: null, servicePageLink: null, serviceId: null, serviceType: null, servicePrice: Lh, isVariedService: false, serviceOptionsAndVariants: null, pricingOption: null, isLoadingServiceOptionsAndVariants: e5, hasAddOns: false, isConferenceEnabled: false, offeredDays: [], courseAvailability: null, courseStartDate: null, courseEndDate: null, staffMembers: [], coverImage: void 0, gallery: [], serviceLocations: [], policyDescription: null, serviceBookability: { state: vh.AVAILABLE, isAvailableForBooking: false, bookingOpensAt: null }, displayTimeZone: `UTC`, isAvailableForBooking: () => false, hasPolicyDescription: () => false, hasCoverImage: () => false, hasGalleryImages: () => false, isVariantDuration: () => false, isLoading: e5, hasError: t2, locale: `en-US`, selectStaffMember: () => {
6038
6038
  }, clearSelection: () => {
6039
6039
  }, clearStaffMember: () => {
6040
6040
  }, selection: cv(``), selectionTimezone: void 0, setVariant: () => {
@@ -6049,7 +6049,7 @@ function tx({ isLoading: e5, hasError: t2, bookingsSettingsLoading: n2, reschedu
6049
6049
  }, navigateToMultiServiceForm: () => {
6050
6050
  }, resolveNextPageHref: () => null, isNavigating: false, editingSurface: i2, openPreferences: () => Promise.resolve(), multiServiceAppointmentsEnabled: false, isMultiServiceAppointment: false, multiServiceAppointmentServices: [], multiServiceAppointmentSelections: [], multiServiceAppointmentOptionsAndVariants: {}, multiServiceAppointmentVariantsStatus: `ready`, bookingsSettingsLoading: n2, reschedule: o2, rescheduleBooking: async () => ({ outcome: `failed` }), goHomeAfterReschedule: () => {
6051
6051
  }, canRescheduleToPick: false };
6052
- return (0, import_jsx_runtime.jsx)(Px.Provider, { value: s2, children: a2 });
6052
+ return (0, import_jsx_runtime.jsx)(Ix.Provider, { value: s2, children: a2 });
6053
6053
  }
6054
6054
  function nx({ rescheduleRequest: e5, editingSurface: t2, children: n2 }) {
6055
6055
  return (0, import_jsx_runtime.jsx)(Xb, { children: (0, import_jsx_runtime.jsx)(tx, { isLoading: true, hasError: false, bookingsSettingsLoading: true, rescheduleRequest: e5, editingSurface: t2, children: n2 }) });
@@ -6123,15 +6123,16 @@ function yx(e5) {
6123
6123
  async function bx({ booking: e5, slot: t2, token: n2 }) {
6124
6124
  return yx(n2 ? (await qf(n2, t2, { revision: e5.revision || `1` })).booking : (await Yf(e5.bookingId, t2, { revision: e5.revision ?? `` })).booking);
6125
6125
  }
6126
- async function xx(e5) {
6126
+ var xx = { validUntil: null, planName: null };
6127
+ async function Sx(e5) {
6127
6128
  try {
6128
- let t2 = (await Sc({ filter: { _id: e5 }, cursorPaging: { limit: 1 } }, { withEcomTransactions: true })).extendedBookings?.[0]?.transactions?.chargedMembershipPaymentDetails?.expirationDate;
6129
- return t2 ? new Date(t2).toISOString() : null;
6129
+ let t2 = (await Sc({ filter: { _id: e5 }, cursorPaging: { limit: 1 } }, { withEcomTransactions: true })).extendedBookings?.[0]?.transactions?.chargedMembershipPaymentDetails;
6130
+ return t2 ? { validUntil: t2.expirationDate ? new Date(t2.expirationDate).toISOString() : null, planName: t2.name?.translated || t2.name?.original || null } : xx;
6130
6131
  } catch (e6) {
6131
- return Jo(e6, { feature: Ko.reschedule, action: `fetch-plan-valid-until`, level: `warning` }), null;
6132
+ return Jo(e6, { feature: Ko.reschedule, action: `fetch-plan-valid-until`, level: `warning` }), xx;
6132
6133
  }
6133
6134
  }
6134
- function Sx() {
6135
+ function Cx() {
6135
6136
  let e5 = ds();
6136
6137
  return (0, import_react.useCallback)(() => {
6137
6138
  if (!e5) return null;
@@ -6142,25 +6143,25 @@ function Sx() {
6142
6143
  }
6143
6144
  }, [e5]);
6144
6145
  }
6145
- var Cx = Zo(`@wix/viewer-service-site-members`);
6146
- function wx() {
6146
+ var wx = Zo(`@wix/viewer-service-site-members`);
6147
+ function Tx() {
6147
6148
  try {
6148
6149
  return (0, import_services_manager_react.useGetService)();
6149
6150
  } catch {
6150
6151
  return null;
6151
6152
  }
6152
6153
  }
6153
- function Tx(e5) {
6154
+ function Ex(e5) {
6154
6155
  try {
6155
- return e5 ? e5(Cx) : null;
6156
+ return e5 ? e5(wx) : null;
6156
6157
  } catch {
6157
6158
  return null;
6158
6159
  }
6159
6160
  }
6160
- function Ex() {
6161
- return Tx(wx());
6161
+ function Dx() {
6162
+ return Ex(Tx());
6162
6163
  }
6163
- function Dx(e5) {
6164
+ function Ox(e5) {
6164
6165
  if (!e5) return null;
6165
6166
  try {
6166
6167
  let t2 = new URL(e5);
@@ -6169,94 +6170,95 @@ function Dx(e5) {
6169
6170
  return null;
6170
6171
  }
6171
6172
  }
6172
- function Ox(e5, { bookable: t2, staffChoiceRequired: n2, timezone: r2, validUntil: i2 }) {
6173
+ function kx(e5, { bookable: t2, staffChoiceRequired: n2, timezone: r2, validUntil: i2 }) {
6173
6174
  if (!Nv(e5) || !t2) return false;
6174
6175
  let a2 = vv(e5);
6175
6176
  if (n2 && (!a2 || a2.anyResource)) return false;
6176
6177
  let o2 = e5.slotStart ? em(e5.slotStart, r2) : null;
6177
6178
  return !i2 || !o2 || o2.getTime() <= Date.parse(i2);
6178
6179
  }
6179
- var kx = { status: `loading`, booking: null, validUntil: null };
6180
- async function Ax(e5) {
6180
+ var Ax = { validUntil: null, planName: null };
6181
+ var jx = { status: `loading`, booking: null, ...Ax };
6182
+ async function Mx(e5) {
6181
6183
  return e5.getMemberDetails ? !!await e5.getMemberDetails().catch(() => null) : !!e5.isInitiallyLoggedIn;
6182
6184
  }
6183
- async function jx(e5, t2) {
6185
+ async function Nx(e5, t2) {
6184
6186
  let { bookingId: n2, token: r2 } = e5;
6185
- if (!r2 && !(t2 && await Ax(t2)) && !(t2 && await t2.promptLogin({ mode: `login` }).then(() => true, () => false))) return { status: `loginRequired`, booking: null, validUntil: null };
6187
+ if (!r2 && !(t2 && await Mx(t2)) && !(t2 && await t2.promptLogin({ mode: `login` }).then(() => true, () => false))) return { status: `loginRequired`, booking: null, ...Ax };
6186
6188
  try {
6187
- let [t3, i2] = await Promise.all([vx(e5), n2 && !r2 ? xx(n2) : null]);
6188
- return { status: `ready`, booking: t3, validUntil: i2 };
6189
+ let [t3, i2] = await Promise.all([vx(e5), n2 && !r2 ? Sx(n2) : Ax]);
6190
+ return { status: `ready`, booking: t3, validUntil: i2.validUntil, planName: i2.planName };
6189
6191
  } catch (e6) {
6190
- return Jo(e6, { feature: Ko.reschedule, action: `fetch-booking` }), { status: e6 instanceof fx ? e6.reason : `failed`, booking: null, validUntil: null };
6192
+ return Jo(e6, { feature: Ko.reschedule, action: `fetch-booking` }), { status: e6 instanceof fx ? e6.reason : `failed`, booking: null, ...Ax };
6191
6193
  }
6192
6194
  }
6193
- var Mx = /* @__PURE__ */ new Map();
6194
- function Nx(e5, t2, n2) {
6195
- let r2 = `${e5.bookingId ?? ``}|${e5.token ?? ``}`, i2 = Mx.get(r2) ?? { load: jx(e5, t2), users: 0 };
6196
- return i2.users += 1, Mx.set(r2, i2), i2.load.then(n2), () => {
6197
- --i2.users, i2.users === 0 && Mx.get(r2) === i2 && Mx.delete(r2);
6195
+ var Px = /* @__PURE__ */ new Map();
6196
+ function Fx(e5, t2, n2) {
6197
+ let r2 = `${e5.bookingId ?? ``}|${e5.token ?? ``}`, i2 = Px.get(r2) ?? { load: Nx(e5, t2), users: 0 };
6198
+ return i2.users += 1, Px.set(r2, i2), i2.load.then(n2), () => {
6199
+ --i2.users, i2.users === 0 && Px.get(r2) === i2 && Px.delete(r2);
6198
6200
  };
6199
6201
  }
6200
- var Px = (0, import_react.createContext)(null);
6201
- var Fx = `useServiceContext must be used within ServiceContextProvider`;
6202
- function Ix(e5 = false) {
6203
- let t2 = (0, import_react.useContext)(Px);
6204
- if (!t2 && !e5) throw Error(Fx);
6202
+ var Ix = (0, import_react.createContext)(null);
6203
+ var Lx = `useServiceContext must be used within ServiceContextProvider`;
6204
+ function Rx(e5 = false) {
6205
+ let t2 = (0, import_react.useContext)(Ix);
6206
+ if (!t2 && !e5) throw Error(Lx);
6205
6207
  return t2;
6206
6208
  }
6207
- function Lx(e5, t2, n2) {
6209
+ function zx(e5, t2, n2) {
6208
6210
  if (e5) return { by: `slug`, value: e5 };
6209
6211
  let r2 = t2?.services ?? [];
6210
6212
  return iv(t2) ? { by: `multi`, serviceIds: r2.map(({ serviceId: e6 }) => e6) } : r2.length === 1 ? { by: `id`, value: r2[0].serviceId } : n2 ? { by: `id`, value: n2 } : { by: `none` };
6211
6213
  }
6212
- var Rx = (e5) => void 0;
6213
- var zx = (e5, t2) => rv(t2.get(Rp.blob))?.services.find((t3) => t3.serviceId === e5);
6214
- var Bx = (e5, t2) => {
6215
- let n2 = zx(e5, t2) ?? cv(e5), r2 = Rx(e5);
6214
+ var Bx = (e5) => void 0;
6215
+ var Vx = (e5, t2) => rv(t2.get(Rp.blob))?.services.find((t3) => t3.serviceId === e5);
6216
+ var Hx = (e5, t2) => {
6217
+ let n2 = Vx(e5, t2) ?? cv(e5), r2 = Bx(e5);
6216
6218
  return r2 === void 0 ? n2 : yv(n2, r2);
6217
6219
  };
6218
- var Vx = (e5, t2) => {
6219
- let n2 = Bx(e5, t2), r2 = t2.get(Rp.resource), i2 = Rx(e5) !== void 0 || !!zx(e5, t2);
6220
+ var Ux = (e5, t2) => {
6221
+ let n2 = Hx(e5, t2), r2 = t2.get(Rp.resource), i2 = Bx(e5) !== void 0 || !!Vx(e5, t2);
6220
6222
  return r2 && !i2 ? yv(n2, r2) : n2;
6221
6223
  };
6222
- function Hx(e5, t2) {
6224
+ function Wx(e5, t2) {
6223
6225
  return !e5 || !t2 || !e5.services.every(Nv) ? null : fv(t2, e5);
6224
6226
  }
6225
- var Ux = [];
6226
- function Wx(e5) {
6227
+ var Gx = [];
6228
+ function Kx(e5) {
6227
6229
  return { min: 1, max: e5?.bookingPolicy?.participantsPolicy?.maxParticipantsPerBooking || 1 };
6228
6230
  }
6229
- function Gx(e5, { previous: t2, others: n2 }, { min: r2, max: i2 }) {
6231
+ function qx(e5, { previous: t2, others: n2 }, { min: r2, max: i2 }) {
6230
6232
  let a2 = Math.max(0, Math.floor(e5)), o2 = Math.max(t2, i2 - n2), s2 = Math.min(a2, o2);
6231
6233
  return s2 > 0 && n2 + s2 < r2 ? Math.min(r2 - n2, o2) : s2;
6232
6234
  }
6233
- function Kx({ serviceCtaState: e5, courseAvailability: t2, serviceBookability: n2 }) {
6235
+ function Jx({ serviceCtaState: e5, courseAvailability: t2, serviceBookability: n2 }) {
6234
6236
  return `${e5}|${t2?.totalCapacity ?? `-`}|${t2?.remainingCapacity ?? `-`}|${t2 === null}|${n2.state}|${n2.isAvailableForBooking}`;
6235
6237
  }
6236
- var qx = (e5) => ({ service: e5, hasError: false });
6237
- var Jx = () => ({ service: null, hasError: true });
6238
- var Yx = { service: null, hasError: false };
6239
- var Xx = (e5) => ({ ...Yx, isMultiServiceAppointment: true, multiServiceAppointmentServices: e5 });
6240
- var Zx = () => ({ ...Jx(), isMultiServiceAppointment: true });
6241
- var Qx = [];
6242
- var $x = [];
6243
- var eS = {};
6244
- function tS({ servicePromise: e5, refreshSignal: n2, injected: r2, rescheduleRequest: i2 = null, editingSurface: a2 = false, bookingsSettings: o2, children: s2 }) {
6245
- return (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(nx, { rescheduleRequest: i2, editingSurface: a2, children: s2 }), children: (0, import_jsx_runtime.jsx)(ex, { bookingsSettings: o2, children: (0, import_jsx_runtime.jsx)(Xo, { fallback: (0, import_jsx_runtime.jsx)(rx, { rescheduleRequest: i2, editingSurface: a2, children: s2 }), feature: Ko.service, children: (0, import_jsx_runtime.jsx)(aS, { servicePromise: e5, refreshSignal: n2, injected: r2, rescheduleRequest: i2, editingSurface: a2, children: s2 }) }) }) });
6246
- }
6247
- var nS = (e5) => e5 ?? void 0;
6248
- var rS = () => void 0;
6249
- function iS(e5, t2) {
6238
+ var Yx = (e5) => ({ service: e5, hasError: false });
6239
+ var Xx = () => ({ service: null, hasError: true });
6240
+ var Zx = { service: null, hasError: false };
6241
+ var Qx = (e5) => ({ ...Zx, isMultiServiceAppointment: true, multiServiceAppointmentServices: e5 });
6242
+ var $x = () => ({ ...Xx(), isMultiServiceAppointment: true });
6243
+ var eS = [];
6244
+ var tS = [];
6245
+ var nS = {};
6246
+ function rS({ servicePromise: e5, refreshSignal: n2, injected: r2, rescheduleRequest: i2 = null, editingSurface: a2 = false, bookingsSettings: o2, children: s2 }) {
6247
+ return (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(nx, { rescheduleRequest: i2, editingSurface: a2, children: s2 }), children: (0, import_jsx_runtime.jsx)(ex, { bookingsSettings: o2, children: (0, import_jsx_runtime.jsx)(Xo, { fallback: (0, import_jsx_runtime.jsx)(rx, { rescheduleRequest: i2, editingSurface: a2, children: s2 }), feature: Ko.service, children: (0, import_jsx_runtime.jsx)(sS, { servicePromise: e5, refreshSignal: n2, injected: r2, rescheduleRequest: i2, editingSurface: a2, children: s2 }) }) }) });
6248
+ }
6249
+ var iS = (e5) => e5 ?? void 0;
6250
+ var aS = () => void 0;
6251
+ function oS(e5, t2) {
6250
6252
  Jo(e5, { feature: Ko.service, action: `fetch-service-variants`, level: `warning`, contexts: { service: { serviceId: t2 } } });
6251
6253
  }
6252
- function aS({ servicePromise: e5, refreshSignal: t2 = 0, injected: n2, rescheduleRequest: a2 = null, editingSurface: u2 = false, children: d2 }) {
6253
- let f2 = n2 ? null : e5 ? ms(e5) : null, m2 = n2?.service ?? f2?.service ?? null, h2 = f2?.hasError ?? false, g2 = f2?.isMultiServiceAppointment ?? false, _2 = f2?.multiServiceAppointmentServices ?? Qx, v2 = Jv(), y2 = Xv(), { navigate: b2, navigateToHref: x2, resolvePath: ee2, toHref: S2, getBookingFormPath: C2 } = Bb(), w2 = Sx(), T2 = Jp(zp.SERVICE), { getParsedUrl: E2, pushUrl: te2, searchParams: ne2 } = cs(), D2 = (0, import_react.useRef)(E2);
6254
+ function sS({ servicePromise: e5, refreshSignal: t2 = 0, injected: n2, rescheduleRequest: a2 = null, editingSurface: u2 = false, children: d2 }) {
6255
+ let f2 = n2 ? null : e5 ? ms(e5) : null, m2 = n2?.service ?? f2?.service ?? null, h2 = f2?.hasError ?? false, g2 = f2?.isMultiServiceAppointment ?? false, _2 = f2?.multiServiceAppointmentServices ?? eS, v2 = Jv(), y2 = Xv(), { navigate: b2, navigateToHref: x2, resolvePath: ee2, toHref: S2, getBookingFormPath: C2 } = Bb(), w2 = Cx(), T2 = Jp(zp.SERVICE), { getParsedUrl: E2, pushUrl: te2, searchParams: ne2 } = cs(), D2 = (0, import_react.useRef)(E2);
6254
6256
  D2.current = E2;
6255
6257
  let re2 = (0, import_react.useRef)(te2);
6256
6258
  re2.current = te2;
6257
6259
  let O2 = ey(), k2 = (0, import_react.useRef)(O2);
6258
6260
  k2.current = O2;
6259
- let [A2, ie2] = (0, import_react.useState)(kx), ae2 = Ex(), oe2 = (e6, t3) => a2 ? cv(e6) : Bx(e6, t3), se2 = (0, import_react.useRef)(oe2);
6261
+ let [A2, ie2] = (0, import_react.useState)(jx), ae2 = Dx(), oe2 = (e6, t3) => a2 ? cv(e6) : Hx(e6, t3), se2 = (0, import_react.useRef)(oe2);
6260
6262
  se2.current = oe2;
6261
6263
  let [ce2, le2] = (0, import_react.useState)(() => oe2(m2?._id ?? ``, E2().searchParams)), j2 = (0, import_react.useRef)(ce2), ue2 = (0, import_react.useRef)(void 0), de2 = (0, import_react.useRef)(true), fe2 = (0, import_react.useRef)(false), pe2 = (0, import_react.useRef)(null), [me2, he2] = (0, import_react.useState)(null), ge2 = (0, import_react.useRef)(me2), [_e2, ve2] = (0, import_react.useState)(0), M2 = m2?._id ?? null, ye2 = (0, import_react.useMemo)(() => {
6262
6264
  if (!a2) return null;
@@ -6268,25 +6270,25 @@ function aS({ servicePromise: e5, refreshSignal: t2 = 0, injected: n2, reschedul
6268
6270
  if (!m2) return null;
6269
6271
  let e6 = ee2(`servicePage`, { slug: m2.mainSlug?.name ?? null, serviceId: m2._id ?? null });
6270
6272
  return e6 ? { href: S2(e6), target: `_self` } : null;
6271
- }, [m2, ee2, S2]), [Ce2, we2] = (0, import_react.useState)(Ux), Te2 = n2 ? n2.masterEvents : Ce2, Ee2 = Qb(), De2 = Jb(), Oe2 = De2.isLoading, ke2 = !De2.isLoading && De2.multiServiceAppointmentsEnabled;
6273
+ }, [m2, ee2, S2]), [Ce2, we2] = (0, import_react.useState)(Gx), Te2 = n2 ? n2.masterEvents : Ce2, Ee2 = Qb(), De2 = Jb(), Oe2 = De2.isLoading, ke2 = !De2.isLoading && De2.multiServiceAppointmentsEnabled;
6272
6274
  (0, import_react.useEffect)(() => {
6273
6275
  if (!a2 || Oe2) return;
6274
- let e6 = false, t3 = Nx(a2, ae2, (t4) => {
6276
+ let e6 = false, t3 = Fx(a2, ae2, (t4) => {
6275
6277
  e6 || ie2(t4);
6276
6278
  });
6277
6279
  return () => {
6278
6280
  e6 = true, t3();
6279
6281
  };
6280
6282
  }, [a2, Oe2, ae2]);
6281
- let Ae2 = !n2 && !!m2 && _p(m2), je2 = Ae2 && M2 ? ay(y2, M2, t2) : null, Me2 = (typeof window > `u` && je2 && M2 && O2.scope && !Oe2 ? ms(_s(vy({ key: je2, warmupData: O2, fetchData: () => ym(M2).catch((e6) => (iS(e6, M2), null)) }), nS, rS)) : void 0) ?? (je2 ? fy(je2) : void 0), [Ne2, Pe2] = (0, import_react.useState)(() => Me2 ?? null), [Fe2, Ie2] = (0, import_react.useState)(() => Me2 ? je2 : null), Le2 = je2 !== null && Fe2 !== je2, Re2 = n2 ? n2.serviceOptionsAndVariants : Ae2 ? Ne2 : null;
6283
+ let Ae2 = !n2 && !!m2 && _p(m2), je2 = Ae2 && M2 ? ay(y2, M2, t2) : null, Me2 = (typeof window > `u` && je2 && M2 && O2.scope && !Oe2 ? ms(_s(vy({ key: je2, warmupData: O2, fetchData: () => ym(M2).catch((e6) => (oS(e6, M2), null)) }), iS, aS)) : void 0) ?? (je2 ? fy(je2) : void 0), [Ne2, Pe2] = (0, import_react.useState)(() => Me2 ?? null), [Fe2, Ie2] = (0, import_react.useState)(() => Me2 ? je2 : null), Le2 = je2 !== null && Fe2 !== je2, Re2 = n2 ? n2.serviceOptionsAndVariants : Ae2 ? Ne2 : null;
6282
6284
  (0, import_react.useEffect)(() => {
6283
6285
  if (n2) return;
6284
6286
  let e6 = be2 && !mp(xe2) ? be2 : null;
6285
- if ((!e6 || Oe2) && we2((e7) => e7.length === 0 ? e7 : Ux), Oe2) return;
6287
+ if ((!e6 || Oe2) && we2((e7) => e7.length === 0 ? e7 : Gx), Oe2) return;
6286
6288
  let i2 = Ae2 ? M2 : null;
6287
6289
  if (!e6 && !i2) return;
6288
- let a3 = false, o2 = e6 ? _m([e6], Ee2).catch(() => Ux) : Promise.resolve(Ux), s2 = i2 ? vy({ key: ay(y2, i2, t2), warmupData: k2.current, fetchData: () => ym(i2) }).catch((e7) => {
6289
- iS(e7, i2);
6290
+ let a3 = false, o2 = e6 ? _m([e6], Ee2).catch(() => Gx) : Promise.resolve(Gx), s2 = i2 ? vy({ key: ay(y2, i2, t2), warmupData: k2.current, fetchData: () => ym(i2) }).catch((e7) => {
6291
+ oS(e7, i2);
6290
6292
  }) : Promise.resolve(void 0);
6291
6293
  return Promise.all([o2, s2]).then(([e7, t3]) => {
6292
6294
  a3 || (0, import_react.startTransition)(() => {
@@ -6299,7 +6301,7 @@ function aS({ servicePromise: e5, refreshSignal: t2 = 0, injected: n2, reschedul
6299
6301
  let ze2 = a2 ? null : ne2.get(Rp.blob), Be2 = (0, import_react.useMemo)(() => JSON.stringify([...new Set((rv(ze2)?.services ?? []).filter((e6) => Sv(e6).length > 0).map(({ serviceId: e6 }) => e6))].sort()), [ze2]), Ve2 = (0, import_react.useMemo)(() => {
6300
6302
  let e6 = new Set(JSON.parse(Be2));
6301
6303
  return [...new Set(_2.filter(_p).flatMap(({ _id: t3 }) => t3 && e6.has(t3) ? [t3] : []))];
6302
- }, [_2, Be2]), He2 = (0, import_react.useMemo)(() => ({ serviceIds: Ve2, refreshSignal: t2, language: y2 }), [Ve2, t2, y2]), [Ue2, We2] = (0, import_react.useState)(null), N2 = Ue2?.request === He2 ? Ue2 : null, P2 = N2?.data ?? eS, F2 = Ve2.length === 0 ? `ready` : Oe2 || !N2 ? `loading` : N2.data && Ve2.every((e6) => N2.data?.[e6]) ? `ready` : `error`;
6304
+ }, [_2, Be2]), He2 = (0, import_react.useMemo)(() => ({ serviceIds: Ve2, refreshSignal: t2, language: y2 }), [Ve2, t2, y2]), [Ue2, We2] = (0, import_react.useState)(null), N2 = Ue2?.request === He2 ? Ue2 : null, P2 = N2?.data ?? nS, F2 = Ve2.length === 0 ? `ready` : Oe2 || !N2 ? `loading` : N2.data && Ve2.every((e6) => N2.data?.[e6]) ? `ready` : `error`;
6303
6305
  (0, import_react.useEffect)(() => {
6304
6306
  let { serviceIds: e6, refreshSignal: t3, language: n3 } = He2;
6305
6307
  if (Oe2 || e6.length === 0) return;
@@ -6310,7 +6312,7 @@ function aS({ servicePromise: e5, refreshSignal: t2 = 0, injected: n2, reschedul
6310
6312
  i2 = true;
6311
6313
  };
6312
6314
  }, [Oe2, He2]);
6313
- let Ge2 = Hh({ service: m2, masterEvents: Te2, locale: v2, timeZone: Ee2, now: ty() }), Ke2 = Kx(Ge2), qe2 = (0, import_react.useMemo)(() => Ge2, [m2, Te2, v2, Ee2, Ke2]), Je2 = (0, import_react.useRef)(null);
6315
+ let Ge2 = Hh({ service: m2, masterEvents: Te2, locale: v2, timeZone: Ee2, now: ty() }), Ke2 = Jx(Ge2), qe2 = (0, import_react.useMemo)(() => Ge2, [m2, Te2, v2, Ee2, Ke2]), Je2 = (0, import_react.useRef)(null);
6314
6316
  (0, import_react.useEffect)(() => {
6315
6317
  if (Je2.current !== null) {
6316
6318
  let e6 = se2.current(m2?._id ?? ``, D2.current().searchParams);
@@ -6332,20 +6334,20 @@ function aS({ servicePromise: e5, refreshSignal: t2 = 0, injected: n2, reschedul
6332
6334
  j2.current = t3, le2(t3);
6333
6335
  }, []), $e2 = (0, import_react.useCallback)((e6) => {
6334
6336
  Qe2(e6);
6335
- let t3 = D2.current(), n3 = e6(Bx(M2 ?? ``, t3.searchParams)), r2 = ov(`${t3.pathname}${t3.search}${t3.hash}`, { currentUrl: t3, entries: [_v(n3, Xe2.current)], policy: `inPlace` }), i2 = new URL(r2, t3);
6337
+ let t3 = D2.current(), n3 = e6(Hx(M2 ?? ``, t3.searchParams)), r2 = ov(`${t3.pathname}${t3.search}${t3.hash}`, { currentUrl: t3, entries: [_v(n3, Xe2.current)], policy: `inPlace` }), i2 = new URL(r2, t3);
6336
6338
  Ye2.current = i2.searchParams.get(Rp.blob), re2.current(i2, { disableScrollToTop: true, skipHistory: true });
6337
6339
  }, [Qe2, M2]), et2 = rv(ze2)?.wantsPromoCode === true, I2 = (0, import_react.useCallback)((e6) => {
6338
6340
  let t3 = D2.current(), n3 = rv(t3.searchParams.get(Rp.blob));
6339
6341
  if (!n3) return;
6340
6342
  let r2 = new URL(fv(`${t3.pathname}${t3.search}${t3.hash}`, hv(n3, e6)), t3);
6341
6343
  Ye2.current = r2.searchParams.get(Rp.blob), re2.current(r2, { disableScrollToTop: true, skipHistory: true });
6342
- }, []), L2 = Om(Re2), tt2 = (0, import_react.useCallback)((e6, t3) => L2 ? Cv(e6, t3 ? [t3] : []) : e6, [L2]), R2 = (0, import_react.useCallback)((e6) => Qe2((t3) => tt2(yv(t3, e6), e6)), [Qe2, tt2]), nt2 = (0, import_react.useCallback)(() => Qe2((e6) => tt2(xv(e6), null)), [Qe2, tt2]), rt2 = (0, import_react.useCallback)((e6) => Qe2((t3) => tt2(bv(t3, e6), null)), [Qe2, tt2]), it2 = (0, import_react.useCallback)((e6) => $e2((t3) => Cv(t3, e6)), [$e2]), at2 = (0, import_react.useMemo)(() => Wx(m2), [m2]), ot2 = (0, import_react.useMemo)(() => km(Re2, { locale: v2, staffMembers: m2 ? Am(m2) : [], businessLocations: fp(m2) }), [Re2, v2, m2]), st2 = (0, import_react.useMemo)(() => new Set(km(Re2, { locale: v2 })?.choices.flatMap((e6) => e6.choiceId ? [e6.choiceId] : []) ?? []), [Re2, v2]), ct2 = (0, import_react.useCallback)((e6) => {
6344
+ }, []), L2 = Om(Re2), tt2 = (0, import_react.useCallback)((e6, t3) => L2 ? Cv(e6, t3 ? [t3] : []) : e6, [L2]), R2 = (0, import_react.useCallback)((e6) => Qe2((t3) => tt2(yv(t3, e6), e6)), [Qe2, tt2]), nt2 = (0, import_react.useCallback)(() => Qe2((e6) => tt2(xv(e6), null)), [Qe2, tt2]), rt2 = (0, import_react.useCallback)((e6) => Qe2((t3) => tt2(bv(t3, e6), null)), [Qe2, tt2]), it2 = (0, import_react.useCallback)((e6) => $e2((t3) => Cv(t3, e6)), [$e2]), at2 = (0, import_react.useMemo)(() => Kx(m2), [m2]), ot2 = (0, import_react.useMemo)(() => km(Re2, { locale: v2, staffMembers: m2 ? Am(m2) : [], businessLocations: fp(m2) }), [Re2, v2, m2]), st2 = (0, import_react.useMemo)(() => new Set(km(Re2, { locale: v2 })?.choices.flatMap((e6) => e6.choiceId ? [e6.choiceId] : []) ?? []), [Re2, v2]), ct2 = (0, import_react.useCallback)((e6) => {
6343
6345
  let t3 = Object.entries(e6).filter(([e7, t4]) => st2.has(e7) && Number.isFinite(t4));
6344
6346
  if (!t3.length) return;
6345
6347
  let n3 = (e7) => {
6346
6348
  let n4 = Dv(e7, st2), r2 = ([e8, t4]) => t4 <= wv(n4, e8), i2 = [...t3.filter(r2), ...t3.filter((e8) => !r2(e8))];
6347
6349
  for (let [e8, t4] of i2) {
6348
- let r3 = wv(n4, e8), i3 = Gx(t4, { previous: r3, others: Tv(n4) - r3 }, at2);
6350
+ let r3 = wv(n4, e8), i3 = qx(t4, { previous: r3, others: Tv(n4) - r3 }, at2);
6349
6351
  i3 !== r3 && (n4 = Ev(n4, e8, i3));
6350
6352
  }
6351
6353
  return n4;
@@ -6370,7 +6372,7 @@ function aS({ servicePromise: e5, refreshSignal: t2 = 0, injected: n2, reschedul
6370
6372
  return n3 ? (ge2.current = n3, he2(n3), true) : false;
6371
6373
  }, []), mt2 = (0, import_react.useCallback)((e6, t3) => pt2((n3) => Lv(n3, e6, t3, jp())), [pt2]), ht2 = (0, import_react.useCallback)(() => {
6372
6374
  pt2(zv);
6373
- }, [pt2]), gt2 = qe2.serviceCtaState, _t2 = (0, import_react.useMemo)(() => g2 ? (me2 ?? rv(ze2))?.services ?? $x : $x, [g2, me2, ze2]), vt2 = (0, import_react.useMemo)(() => g2 ? Hx(me2 ?? rv(ze2), C2()) : null, [g2, me2, ze2, C2]), yt2 = (0, import_react.useCallback)((e6) => {
6375
+ }, [pt2]), gt2 = qe2.serviceCtaState, _t2 = (0, import_react.useMemo)(() => g2 ? (me2 ?? rv(ze2))?.services ?? tS : tS, [g2, me2, ze2]), vt2 = (0, import_react.useMemo)(() => g2 ? Wx(me2 ?? rv(ze2), C2()) : null, [g2, me2, ze2, C2]), yt2 = (0, import_react.useCallback)((e6) => {
6374
6376
  if (g2) return vt2 ? S2(vt2) : null;
6375
6377
  let t3 = jb({ actionState: gt2, serviceType: m2?.type ?? null, config: e6 ?? Ab });
6376
6378
  if (Mb(t3, m2?.type ?? null, ce2)) return null;
@@ -6388,9 +6390,9 @@ function aS({ servicePromise: e5, refreshSignal: t2 = 0, injected: n2, reschedul
6388
6390
  }, (e7) => {
6389
6391
  Jo(e7, { feature: Ko.serviceCta, action: `navigateToNextPage` }), wt2();
6390
6392
  });
6391
- }, [b2, wt2, S2]), Et2 = (0, import_react.useCallback)(() => bt2.open(Jh(Hv({ service: m2, pricingOption: ot2 ?? void 0, selection: Vx(M2 ?? ``, D2.current().searchParams), multiServiceAppointmentsEnabled: ke2 }))), [bt2, m2, ot2, M2, ke2]), Dt2 = (0, import_react.useCallback)((e6) => {
6393
+ }, [b2, wt2, S2]), Et2 = (0, import_react.useCallback)(() => bt2.open(Jh(Hv({ service: m2, pricingOption: ot2 ?? void 0, selection: Ux(M2 ?? ``, D2.current().searchParams), multiServiceAppointmentsEnabled: ke2 }))), [bt2, m2, ot2, M2, ke2]), Dt2 = (0, import_react.useCallback)((e6) => {
6392
6394
  if (Ct2.current) return;
6393
- let t3 = ge2.current ?? rv(D2.current().searchParams.get(Rp.blob)), n3 = Hx(t3, C2());
6395
+ let t3 = ge2.current ?? rv(D2.current().searchParams.get(Rp.blob)), n3 = Wx(t3, C2());
6394
6396
  if (n3) {
6395
6397
  for (let n4 of t3?.services ?? []) e6(tm({ serviceId: n4.serviceId, serviceType: n4.serviceType ?? _2.find(({ _id: e7 }) => e7 === n4.serviceId)?.type ?? void 0, start: n4.slotStart, end: n4.slotEnd, timeZone: t3?.timezone ?? void 0, isEligibleForFlowCompletion: true }));
6396
6398
  Tt2(n3);
@@ -6416,7 +6418,7 @@ function aS({ servicePromise: e5, refreshSignal: t2 = 0, injected: n2, reschedul
6416
6418
  At2.current = kt2;
6417
6419
  let jt2 = (0, import_react.useCallback)(async () => {
6418
6420
  let e6 = ye2?.status === `ready` ? ye2.booking : null;
6419
- if (!ye2 || !a2 || !e6 || !Ox(j2.current, At2.current())) return { outcome: `failed` };
6421
+ if (!ye2 || !a2 || !e6 || !kx(j2.current, At2.current())) return { outcome: `failed` };
6420
6422
  T2(Qp({ component: Gp.RESCHEDULE_DIALOG, element: Kp.CONFIRM_BUTTON })), T2(Lp({ action: Wp, pageName: Kp.CONFIRM_BUTTON, referralInfo: D2.current().searchParams.get(Rp.referral) ?? void 0 }));
6421
6423
  let t3 = _v(j2.current, Xe2.current), n3;
6422
6424
  try {
@@ -6427,31 +6429,31 @@ function aS({ servicePromise: e5, refreshSignal: t2 = 0, injected: n2, reschedul
6427
6429
  T2(Zp({ bookingId: e6.bookingId }));
6428
6430
  let r2 = { outcome: `succeeded`, ...n3 };
6429
6431
  if (a2.fromManageBookingPage) return r2;
6430
- let i2 = Dx(a2.redirectUrl), o2 = i2 ? null : w2();
6432
+ let i2 = Ox(a2.redirectUrl), o2 = i2 ? null : w2();
6431
6433
  if (!i2 && !o2) return r2;
6432
6434
  try {
6433
6435
  return i2 ? await x2({ href: i2 }) : o2 && await b2(o2), { outcome: `navigated` };
6434
6436
  } catch (e7) {
6435
6437
  return Jo(e7, { feature: Ko.reschedule, action: `return-after-reschedule` }), r2;
6436
6438
  }
6437
- }, [ye2, a2, w2, b2, x2, T2]), Mt2 = Ox(ce2, kt2()), Nt2 = (0, import_react.useCallback)(() => {
6439
+ }, [ye2, a2, w2, b2, x2, T2]), Mt2 = kx(ce2, kt2()), Nt2 = (0, import_react.useCallback)(() => {
6438
6440
  T2(Lp({ component: Kp.GO_TO_HOMEPAGE_BUTTON, action: Wp, pageName: qp })), b2(`/`).catch((e6) => Jo(e6, { feature: Ko.reschedule, action: `go-home` }));
6439
6441
  }, [b2, T2]), { serviceBookability: Pt2, policyDescription: Ft2, coverImage: It2 } = qe2, Lt2 = (0, import_react.useCallback)(() => Pt2.isAvailableForBooking, [Pt2]), Rt2 = (0, import_react.useCallback)(() => !!Ft2, [Ft2]), zt2 = (0, import_react.useCallback)(() => !!It2, [It2]), Bt2 = (0, import_react.useCallback)(() => fh(m2), [m2]), Vt2 = (0, import_react.useCallback)(() => !!m2 && Gh(m2), [m2]), Ht2 = (0, import_react.useMemo)(() => ({ ...qe2, service: m2, servicePageLink: Se2, serviceOptionsAndVariants: Re2, pricingOption: ot2, isLoadingServiceOptionsAndVariants: Le2, isAvailableForBooking: Lt2, hasPolicyDescription: Rt2, hasCoverImage: zt2, hasGalleryImages: Bt2, isVariantDuration: Vt2, isLoading: false, hasError: h2, locale: v2, selectStaffMember: R2, clearSelection: rt2, clearStaffMember: nt2, selection: ce2, selectionTimezone: ue2.current ?? Ee2, setVariant: it2, setVariantCounts: ct2, maxParticipantsPerBooking: at2.max, toggleAddOn: lt2, setAddOnQuantity: ut2, setSlot: dt2, clearSlot: ft2, setMultiServiceSlot: mt2, clearMultiServiceSlot: ht2, draftRevision: _e2, wantsPromoCode: et2, setWantsPromoCode: I2, withSelectionParam: Ze2, navigateToNextPage: Ot2, navigateToMultiServiceForm: Dt2, resolveNextPageHref: yt2, isNavigating: xt2, editingSurface: u2, openPreferences: Et2, multiServiceAppointmentsEnabled: ke2, isMultiServiceAppointment: g2, multiServiceAppointmentServices: _2, multiServiceAppointmentSelections: _t2, multiServiceAppointmentOptionsAndVariants: P2, multiServiceAppointmentVariantsStatus: F2, bookingsSettingsLoading: Oe2, reschedule: ye2, rescheduleBooking: jt2, goHomeAfterReschedule: Nt2, canRescheduleToPick: Mt2 }), [qe2, m2, Se2, Re2, ot2, Le2, Lt2, Rt2, zt2, Bt2, Vt2, h2, v2, R2, rt2, nt2, ce2, Ee2, it2, ct2, at2.max, lt2, ut2, dt2, ft2, mt2, ht2, _e2, et2, I2, Ze2, Ot2, Dt2, yt2, xt2, u2, Et2, ke2, g2, _2, _t2, P2, F2, Oe2, ye2, jt2, Nt2, Mt2]);
6440
- return (0, import_jsx_runtime.jsx)(Px.Provider, { value: Ht2, children: d2 });
6442
+ return (0, import_jsx_runtime.jsx)(Ix.Provider, { value: Ht2, children: d2 });
6441
6443
  }
6442
- function oS({ routerSlug: e5, initialServiceId: t2, refreshSignal: n2, editingSurface: r2, children: i2 }) {
6444
+ function cS({ routerSlug: e5, initialServiceId: t2, refreshSignal: n2, editingSurface: r2, children: i2 }) {
6443
6445
  Yp(zp.SERVICE);
6444
6446
  let a2 = ey(), o2 = Xv(), { getParsedUrl: s2 } = cs(), [c2] = (0, import_react.useState)(() => r2 ? null : ux(s2().searchParams)), [u2] = (0, import_react.useState)(() => {
6445
- let r3 = Lx(e5, c2 ? null : Hb(s2().searchParams), t2);
6446
- return r3.by === `none` ? hs(Yx) : r3.by === `multi` ? _s(vy({ key: iy(o2, r3.serviceIds), refresh: n2 !== 0, warmupData: a2, fetchData: () => Yo(`service-context-load-multi-service`, { feature: Ko.service }, wp(r3.serviceIds)) }), Xx, Zx) : _s(vy({ key: ry(o2, r3.by, r3.value), refresh: n2 !== 0, warmupData: a2, fetchData: () => Yo(`service-context-load`, { feature: Ko.service }, r3.by === `slug` ? Sp(r3.value) : Cp(r3.value)) }), qx, Jx);
6447
+ let r3 = zx(e5, c2 ? null : Hb(s2().searchParams), t2);
6448
+ return r3.by === `none` ? hs(Zx) : r3.by === `multi` ? _s(vy({ key: iy(o2, r3.serviceIds), refresh: n2 !== 0, warmupData: a2, fetchData: () => Yo(`service-context-load-multi-service`, { feature: Ko.service }, wp(r3.serviceIds)) }), Qx, $x) : _s(vy({ key: ry(o2, r3.by, r3.value), refresh: n2 !== 0, warmupData: a2, fetchData: () => Yo(`service-context-load`, { feature: Ko.service }, r3.by === `slug` ? Sp(r3.value) : Cp(r3.value)) }), Yx, Xx);
6447
6449
  });
6448
- return (0, import_jsx_runtime.jsx)(tS, { servicePromise: u2, refreshSignal: n2, rescheduleRequest: c2, editingSurface: r2, children: i2 });
6450
+ return (0, import_jsx_runtime.jsx)(rS, { servicePromise: u2, refreshSignal: n2, rescheduleRequest: c2, editingSurface: r2, children: i2 });
6449
6451
  }
6450
- function sS({ serviceData: e5, servicePicker: t2, refreshSignal: n2 = 0, editingSurface: r2 = false, children: i2 }) {
6451
- let { pathname: a2 } = cs(), o2 = ps(), c2 = Xv(), l2 = t2?.serviceId?.$eq, u2 = e5?.service ?? null, d2 = (0, import_react.useMemo)(() => u2 ? { service: u2, masterEvents: e5?.masterEvents ?? Ux, serviceOptionsAndVariants: e5?.serviceOptionsAndVariants ?? null, bookingsSettings: e5?.bookingsSettings } : null, [u2, e5?.masterEvents, e5?.serviceOptionsAndVariants, e5?.bookingsSettings]);
6452
- return d2 ? (0, import_jsx_runtime.jsx)(tS, { injected: d2, bookingsSettings: d2.bookingsSettings, editingSurface: r2, children: i2 }, `injected:${n2}`) : e5 ? (0, import_jsx_runtime.jsx)(tS, { bookingsSettings: e5.bookingsSettings, editingSurface: r2, children: i2 }) : (0, import_jsx_runtime.jsx)(oS, { routerSlug: o2, initialServiceId: l2, refreshSignal: n2, editingSurface: r2, children: i2 }, `fetch:${a2}:${o2 ?? ``}:${l2 ?? ``}:${n2}:${r2}:${c2}`);
6452
+ function lS({ serviceData: e5, servicePicker: t2, refreshSignal: n2 = 0, editingSurface: r2 = false, children: i2 }) {
6453
+ let { pathname: a2 } = cs(), o2 = ps(), c2 = Xv(), l2 = t2?.serviceId?.$eq, u2 = e5?.service ?? null, d2 = (0, import_react.useMemo)(() => u2 ? { service: u2, masterEvents: e5?.masterEvents ?? Gx, serviceOptionsAndVariants: e5?.serviceOptionsAndVariants ?? null, bookingsSettings: e5?.bookingsSettings } : null, [u2, e5?.masterEvents, e5?.serviceOptionsAndVariants, e5?.bookingsSettings]);
6454
+ return d2 ? (0, import_jsx_runtime.jsx)(rS, { injected: d2, bookingsSettings: d2.bookingsSettings, editingSurface: r2, children: i2 }, `injected:${n2}`) : e5 ? (0, import_jsx_runtime.jsx)(rS, { bookingsSettings: e5.bookingsSettings, editingSurface: r2, children: i2 }) : (0, import_jsx_runtime.jsx)(cS, { routerSlug: o2, initialServiceId: l2, refreshSignal: n2, editingSurface: r2, children: i2 }, `fetch:${a2}:${o2 ?? ``}:${l2 ?? ``}:${n2}:${r2}:${c2}`);
6453
6455
  }
6454
- var cS = ma(`426941a1-1d08-4cf4-ae61-e433e800cde5`);
6456
+ var uS = ma(`426941a1-1d08-4cf4-ae61-e433e800cde5`);
6455
6457
  // Annotate the CommonJS export names for ESM import in node:
6456
6458
  0 && (module.exports = {
6457
6459
  SERVICE_CONTEXT_MISSING_PROVIDER_ERROR,