@wix/bookings 1.0.1781 → 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.
Files changed (63) hide show
  1. package/build/cjs/context-booking-checkout.d.ts +32 -0
  2. package/build/cjs/context-booking-checkout.js +2002 -1762
  3. package/build/cjs/context-booking-checkout.js.map +1 -1
  4. package/build/cjs/context-my-booking.d.ts +2832 -0
  5. package/build/cjs/context-my-booking.js +592 -0
  6. package/build/cjs/context-my-booking.js.map +1 -0
  7. package/build/cjs/context-my-bookings.d.ts +2862 -0
  8. package/build/cjs/context-my-bookings.js +12885 -0
  9. package/build/cjs/context-my-bookings.js.map +1 -0
  10. package/build/cjs/context-service-addons.d.ts +54 -3
  11. package/build/cjs/context-service-addons.js +1065 -578
  12. package/build/cjs/context-service-addons.js.map +1 -1
  13. package/build/cjs/context-service.d.ts +35 -24
  14. package/build/cjs/context-service.js +985 -966
  15. package/build/cjs/context-service.js.map +1 -1
  16. package/build/cjs/context-time-slots.d.ts +44 -98
  17. package/build/cjs/context-time-slots.js +456 -474
  18. package/build/cjs/context-time-slots.js.map +1 -1
  19. package/build/es/context-booking-checkout.d.mts +32 -0
  20. package/build/es/context-booking-checkout.mjs +2002 -1762
  21. package/build/es/context-booking-checkout.mjs.map +1 -1
  22. package/build/es/context-my-booking.d.mts +2832 -0
  23. package/build/es/context-my-booking.mjs +562 -0
  24. package/build/es/context-my-booking.mjs.map +1 -0
  25. package/build/es/context-my-bookings.d.mts +2862 -0
  26. package/build/es/context-my-bookings.mjs +12844 -0
  27. package/build/es/context-my-bookings.mjs.map +1 -0
  28. package/build/es/context-service-addons.d.mts +54 -3
  29. package/build/es/context-service-addons.mjs +1061 -574
  30. package/build/es/context-service-addons.mjs.map +1 -1
  31. package/build/es/context-service.d.mts +35 -24
  32. package/build/es/context-service.mjs +985 -966
  33. package/build/es/context-service.mjs.map +1 -1
  34. package/build/es/context-time-slots.d.mts +44 -98
  35. package/build/es/context-time-slots.mjs +456 -474
  36. package/build/es/context-time-slots.mjs.map +1 -1
  37. package/build/internal/cjs/context-booking-checkout.d.ts +32 -0
  38. package/build/internal/cjs/context-my-booking.d.ts +2832 -0
  39. package/build/internal/cjs/context-my-bookings.d.ts +2862 -0
  40. package/build/internal/cjs/context-service-addons.d.ts +54 -3
  41. package/build/internal/cjs/context-service.d.ts +35 -24
  42. package/build/internal/cjs/context-time-slots.d.ts +44 -98
  43. package/build/internal/es/context-booking-checkout.d.mts +32 -0
  44. package/build/internal/es/context-my-booking.d.mts +2832 -0
  45. package/build/internal/es/context-my-bookings.d.mts +2862 -0
  46. package/build/internal/es/context-service-addons.d.mts +54 -3
  47. package/build/internal/es/context-service.d.mts +35 -24
  48. package/build/internal/es/context-time-slots.d.mts +44 -98
  49. package/context/my-booking/package.json +3 -0
  50. package/context/my-bookings/package.json +3 -0
  51. package/context-runtime/context-booking-checkout/runtime.d.ts +32 -0
  52. package/context-runtime/context-booking-checkout/runtime.js +3 -3
  53. package/context-runtime/context-my-booking/runtime.d.ts +2832 -0
  54. package/context-runtime/context-my-booking/runtime.js +2 -0
  55. package/context-runtime/context-my-bookings/runtime.d.ts +2862 -0
  56. package/context-runtime/context-my-bookings/runtime.js +11 -0
  57. package/context-runtime/context-service/runtime.d.ts +35 -24
  58. package/context-runtime/context-service/runtime.js +3 -3
  59. package/context-runtime/context-service-addons/runtime.d.ts +54 -3
  60. package/context-runtime/context-service-addons/runtime.js +2 -2
  61. package/context-runtime/context-time-slots/runtime.d.ts +44 -98
  62. package/context-runtime/context-time-slots/runtime.js +3 -3
  63. package/package.json +20 -4
@@ -135,7 +135,7 @@ interface BookedAddOn {
135
135
  nameTranslated?: string | null;
136
136
  }
137
137
  /** Server-computed datetime adjusted to a requested timezone. */
138
- interface AddOn extends AddOnAddOnInfoOneOf {
138
+ interface AddOn$2 extends AddOnAddOnInfoOneOf {
139
139
  /** Duration in minutes for duration-based add-ons that extend booking service time. */
140
140
  durationInMinutes?: number;
141
141
  /** Maximum quantity customers can purchase for quantity-based add-ons. */
@@ -165,7 +165,7 @@ interface AddOnAddOnInfoOneOf {
165
165
  /** Maximum quantity customers can purchase for quantity-based add-ons. */
166
166
  maxQuantity?: number;
167
167
  }
168
- interface AddOnGroupDetail {
168
+ interface AddOnGroupDetail$1 {
169
169
  /**
170
170
  * Group ID.
171
171
  * @format GUID
@@ -182,7 +182,7 @@ interface AddOnGroupDetail {
182
182
  * Add-ons linked to this group in display order.
183
183
  * @maxSize 7
184
184
  */
185
- addOns?: AddOn[];
185
+ addOns?: AddOn$2[];
186
186
  /**
187
187
  * Instructional prompt displayed to customers. For example, `Choose up to 2 relaxing spa treatments to enhance your experience`. You can also use this field as a group description. For example, `Beginner-friendly rental equipment`.
188
188
  * @maxLength 200
@@ -207,7 +207,52 @@ type AddOn$1 = {
207
207
  quantity: NonNullable<BookedAddOn['quantity']>;
208
208
  };
209
209
  //#endregion
210
+ //#region ../../node_modules/@wix/editor-react-types/dist/image.d.ts
211
+ type Point = {
212
+ x: number;
213
+ y: number;
214
+ };
215
+ type Crop = Point & {
216
+ width: number;
217
+ height: number;
218
+ };
219
+ /**
220
+ * An image from Wix Media.
221
+ *
222
+ * @example
223
+ * ```tsx
224
+ * import type { Image } from '@wix/editor-react-types';
225
+ *
226
+ * interface MyComponentProps {
227
+ * image?: Image;
228
+ * }
229
+ *
230
+ * const MyComponent = ({ image }: MyComponentProps) => (
231
+ * <img src={image?.url} alt={image?.alt} />
232
+ * );
233
+ * ```
234
+ */
235
+ type Image = {
236
+ /** The image URI. */uri?: string; /** The image URL. */
237
+ url: string; /** The image file name. */
238
+ name?: string; /** The image height in pixels. */
239
+ height?: number; /** The image width in pixels. */
240
+ width?: number; /** Whether the image is animated (e.g. GIF). */
241
+ animated?: boolean; /** The crop region applied to the image. */
242
+ crop?: Crop; /** The image quality, as a percentage from 0 to 100. */
243
+ quality?: number; /** The image alt text for accessibility. */
244
+ alt?: string;
245
+ };
246
+ //#endregion
210
247
  //#region src/api/adapters/service-addons/service-addons.d.ts
248
+ type AddOn = AddOn$2 & {
249
+ mainMedia?: {
250
+ image?: string | null;
251
+ } | null;
252
+ };
253
+ type AddOnGroupDetail = Omit<AddOnGroupDetail$1, 'addOns'> & {
254
+ addOns?: AddOn[];
255
+ };
211
256
  /** An add-on the service offers, and whether the site visitor selected it. */
212
257
  interface AddOnItem {
213
258
  /**
@@ -251,6 +296,12 @@ interface AddOnItem {
251
296
  * `setAddOnQuantity()` limits its quantity to `1`.
252
297
  */
253
298
  maxQuantity: NonNullable<AddOn['maxQuantity']> | null;
299
+ /**
300
+ * Add-on's image, with its size in pixels.
301
+ *
302
+ * `null` when the add-on has no image.
303
+ */
304
+ addOnImage?: Image | null;
254
305
  /** Whether the site visitor selected the add-on. */
255
306
  isSelected: boolean;
256
307
  /**
@@ -4186,6 +4186,9 @@ interface ServiceContextValue {
4186
4186
  * - A class: it has a session that hasn't ended.
4187
4187
  * - A course: it has spots left, its sessions haven't ended, and booking is open.
4188
4188
  *
4189
+ * In the editor, bind a booking button's visibility condition to it to hide the button when
4190
+ * the service can't be booked.
4191
+ *
4189
4192
  * @returns `true` when the service can be booked online now. Same as
4190
4193
  * `serviceBookability.isAvailableForBooking`.
4191
4194
  *
@@ -4210,6 +4213,9 @@ interface ServiceContextValue {
4210
4213
  /**
4211
4214
  * Checks whether the service has a booking policy description to show.
4212
4215
  *
4216
+ * In the editor, bind the policy text's visibility condition to it to hide the text when
4217
+ * there's no policy.
4218
+ *
4213
4219
  * @returns `true` when `policyDescription` isn't empty.
4214
4220
  *
4215
4221
  * @example Show the booking policy only when there's one
@@ -4234,6 +4240,9 @@ interface ServiceContextValue {
4234
4240
  /**
4235
4241
  * Checks whether the service has a cover image.
4236
4242
  *
4243
+ * In the editor, bind a header's visibility condition to it to hide the header when there's
4244
+ * no cover image.
4245
+ *
4237
4246
  * @returns `true` when `coverImage` is set.
4238
4247
  *
4239
4248
  * @example Show a header only when the service has a cover image
@@ -4255,6 +4264,9 @@ interface ServiceContextValue {
4255
4264
  /**
4256
4265
  * Checks whether the service has gallery images.
4257
4266
  *
4267
+ * In the editor, bind a gallery's visibility condition to it to hide the gallery when there are
4268
+ * no images.
4269
+ *
4258
4270
  * @returns `true` when `gallery` has at least 1 image.
4259
4271
  *
4260
4272
  * @example Show a gallery only when the service has images
@@ -4411,6 +4423,21 @@ interface ServiceContextValue {
4411
4423
  * `navigateToNextPage()` carries it to the next page.
4412
4424
  */
4413
4425
  selection: ServicePreference;
4426
+ /**
4427
+ * Whether the time slot in `selection` is a full class session whose waitlist is open. Such a
4428
+ * slot can't be booked on the site yet: `navigateToNextPage()` doesn't take it to the booking
4429
+ * form, and a button that books it should offer the waitlist instead.
4430
+ *
4431
+ * `false` when no time slot is selected, or the selected one can be booked.
4432
+ */
4433
+ isWaitlistSlotSelected: boolean;
4434
+ /**
4435
+ * ID of the site (its meta site ID), as the host reports it. Builders use it for links that
4436
+ * name the site, such as the waitlist dialog's link to the site in the Wix app.
4437
+ *
4438
+ * `''` while the host hasn't provided it, such as an unsaved site in the editor.
4439
+ */
4440
+ siteId: string;
4414
4441
  /**
4415
4442
  * [IANA time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) of the time
4416
4443
  * slot in `selection`. It's the time zone sent with the time slot when it was selected.
@@ -4721,36 +4748,18 @@ interface ServiceContextValue {
4721
4748
  draftRevision: number;
4722
4749
  /**
4723
4750
  * Whether the visitor has a promo code to enter at checkout, from the booking preferences in the
4724
- * page's URL. To change it, call `setWantsPromoCode()`.
4751
+ * page's URL.
4752
+ *
4753
+ * @deprecated Use the Booking Checkout context's `selection.wantsPromoCode`.
4725
4754
  */
4726
4755
  wantsPromoCode: boolean;
4727
4756
  /**
4728
4757
  * Sets whether the visitor has a promo code to enter at checkout, and writes it to the page's
4729
- * URL, replacing the current history entry.
4730
- *
4731
- * The function does nothing when the page's URL has no booking preferences.
4758
+ * URL, replacing the current history entry. The function does nothing when the page's URL has no
4759
+ * booking preferences.
4732
4760
  *
4761
+ * @deprecated Use the Booking Checkout context's `setWantsPromoCode()`.
4733
4762
  * @param wanted - Whether the visitor has a promo code to enter at checkout.
4734
- *
4735
- * @example Let the visitor say they have a promo code
4736
- * ```tsx
4737
- * import { useServiceContext } from '@wix/bookings/context/service';
4738
- *
4739
- * function PromoCodeCheckbox() {
4740
- * const { wantsPromoCode, setWantsPromoCode } = useServiceContext();
4741
- *
4742
- * return (
4743
- * <label>
4744
- * <input
4745
- * type="checkbox"
4746
- * checked={wantsPromoCode}
4747
- * onChange={(event) => setWantsPromoCode(event.target.checked)}
4748
- * />
4749
- * I have a promo code
4750
- * </label>
4751
- * );
4752
- * }
4753
- * ```
4754
4763
  */
4755
4764
  setWantsPromoCode: (wanted: boolean) => void;
4756
4765
  /**
@@ -4800,6 +4809,8 @@ interface ServiceContextValue {
4800
4809
  * - The context is in reschedule mode. To move the booking, call `rescheduleBooking()`.
4801
4810
  * - The next page is the booking form, and no time slot is selected for a class or an
4802
4811
  * appointment.
4812
+ * - The next page is the booking form, and the selected time slot is a full class session with
4813
+ * an open waitlist. See `isWaitlistSlotSelected`.
4803
4814
  * - The site has no page for the next step.
4804
4815
  *
4805
4816
  * The booking form gets only this service's selection. Other pages get the selection merged into
@@ -449,7 +449,7 @@ type NextAvailableDateOutcome =
449
449
  * pricing plan, it's also the outcome when the first bookable date is after the plan's last
450
450
  * date.
451
451
  */
452
- | 'none' /** The search failed. `timeSlotsErrorCode` is `'timeSlotsLoadFailed'`. */ | 'error'
452
+ | 'none' /** The search failed. `errorCode` is `'timeSlotsLoadFailed'`. */ | 'error'
453
453
  /**
454
454
  * The search stopped before it ended, because a component called `selectDate()`, or because
455
455
  * the context was still loading its settings or failed to load.
@@ -619,7 +619,7 @@ interface TimeSlotsContextValue extends TimeSlotsContextFields {
619
619
  */
620
620
  readonly timeSlots: ReadonlyArray<TimeSlotItem>;
621
621
  /**
622
- * Whether `timeSlots` is loading, or waiting to load. The same as `timeSlotsLoading`.
622
+ * Whether `timeSlots` is loading, or waiting to load.
623
623
  *
624
624
  * It's `true`:
625
625
  * - Before the context loads in the visitor's browser.
@@ -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. Calling it again has no
742
- * effect, so every component that shows the upcoming time slots can call it. After the first
743
- * call, the list reloads when the time zone or a filter changes. When the service changes, the
744
- * context starts over and the components inside it mount again, so they call it again.
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 } = useTimeSlotsContext();
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
- /** Whether a component called `loadUpcomingTimeSlots()`. */
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
@@ -902,7 +919,9 @@ interface TimeSlotsContextValue extends TimeSlotsContextFields {
902
919
  /**
903
920
  * Sends the visitor to the booking form to book the selected time slot.
904
921
  *
905
- * Ignored when no time slot is selected, and while rescheduling a booking.
922
+ * Ignored when no time slot is selected, while rescheduling a booking, and when the selected
923
+ * time slot can't be booked, such as a full class session with an open waitlist (`bookable` is
924
+ * `false`): offer the session's waitlist instead.
906
925
  *
907
926
  * For an appointment whose staff choice is still open, the visitor books the time slot's first
908
927
  * staff member. If your component lets the visitor select a staff member, check `isComplete`
@@ -934,13 +953,6 @@ interface TimeSlotsContextValue extends TimeSlotsContextFields {
934
953
  * `null` while the context's settings load, and when the context fails to load.
935
954
  */
936
955
  readonly timeSlotLimitPerDay: number | null;
937
- /**
938
- * Dates in the upcoming time slots that show all their time slots, after
939
- * `loadAllTimeSlotsForDay()`. Each is a local date in `YYYY-MM-DD` format.
940
- *
941
- * Empty again when the upcoming time slots reload.
942
- */
943
- readonly expandedDates: ReadonlySet<LocalDate>;
944
956
  /**
945
957
  * Dates in the upcoming time slots that have more time slots than `timeSlotLimitPerDay` shows.
946
958
  * To show all of a date's time slots, call `loadAllTimeSlotsForDay()`.
@@ -953,9 +965,10 @@ interface TimeSlotsContextValue extends TimeSlotsContextFields {
953
965
  * limit.
954
966
  *
955
967
  * Call it for a date in `daysWithMore`. While the day loads, `loadingDate` is that date. Then
956
- * the date is in `expandedDates`, and `timeSlots` shows the day without the limit.
968
+ * the date leaves `daysWithMore`, and `timeSlots` shows the day without the limit until the
969
+ * upcoming time slots reload.
957
970
  *
958
- * Ignored while a page or another day is loading, and for a date in `expandedDates`.
971
+ * Ignored while a page or another day is loading, and for a date that already shows in full.
959
972
  *
960
973
  * When the day fails to load, `errorCode` is `'upcomingSlotsLoadFailed'`.
961
974
  *
@@ -993,8 +1006,7 @@ interface TimeSlotsContextFields {
993
1006
  * - `'unavailable'`: The date has time slots, and none is bookable.
994
1007
  * - `'none'`: The date has no time slots to show.
995
1008
  *
996
- * Empty until it first loads. To load it, call `setDaysAvailabilityRange()`,
997
- * `nextDaysAvailabilityRange()`, or `previousDaysAvailabilityRange()`.
1009
+ * Empty until it first loads. To load it, call `setDaysAvailabilityRange()`.
998
1010
  *
999
1011
  * Dates before today are `'none'`. When the context's settings show only available time slots,
1000
1012
  * which they do by default, a date with only full time slots is `'none'`. While rescheduling a
@@ -1005,15 +1017,11 @@ interface TimeSlotsContextFields {
1005
1017
  readonly daysAvailabilityLoading: boolean;
1006
1018
  /** The day availability failed to load. */
1007
1019
  readonly daysAvailabilityHasError: boolean;
1008
- /** Whether `timeSlots` is loading. The same as `isLoading`. */
1009
- readonly timeSlotsLoading: boolean;
1010
- /** The same as `errorCode`. */
1011
- readonly timeSlotsErrorCode: TimeSlotsErrorCode | null;
1012
1020
  /**
1013
1021
  * Selects a date and replaces `timeSlots` with that date's time slots.
1014
1022
  *
1015
- * While they load, `timeSlotsLoading` is `true`. When they fail to load, `timeSlotsErrorCode`
1016
- * is `'timeSlotsLoadFailed'`. Today's time slots start from the current time. Selecting the
1023
+ * While they load, `isLoading` is `true`. When they fail to load, `errorCode` is
1024
+ * `'timeSlotsLoadFailed'`. Today's time slots start from the current time. Selecting the
1017
1025
  * selected date again reloads its time slots.
1018
1026
  *
1019
1027
  * Ignored for a malformed date, a date before today, and a course, which has no time slots per
@@ -1025,18 +1033,18 @@ interface TimeSlotsContextFields {
1025
1033
  *
1026
1034
  * @param date - Date to select, as a local date in `YYYY-MM-DD` format.
1027
1035
  * @returns Promise that resolves once the date is selected, before its time slots load. To
1028
- * know when they load, use `timeSlotsLoading`.
1036
+ * know when they load, use `isLoading`.
1029
1037
  * @example Select a date with a date input
1030
1038
  * ```tsx
1031
1039
  * import { useTimeSlotsContext } from '@wix/bookings/context/time-slots';
1032
1040
  *
1033
1041
  * function DateInput() {
1034
- * const { selectedDate, timeSlots, timeSlotsLoading, selectDate } = useTimeSlotsContext();
1042
+ * const { selectedDate, timeSlots, isLoading, selectDate } = useTimeSlotsContext();
1035
1043
  *
1036
1044
  * return (
1037
1045
  * <div>
1038
1046
  * <input type="date" value={selectedDate ?? ''} onChange={(event) => selectDate(event.target.value)} />
1039
- * {selectedDate && <p>{timeSlotsLoading ? 'Loading times...' : `${timeSlots.length} times`}</p>}
1047
+ * {selectedDate && <p>{isLoading ? 'Loading times...' : `${timeSlots.length} times`}</p>}
1040
1048
  * </div>
1041
1049
  * );
1042
1050
  * }
@@ -1052,8 +1060,7 @@ interface TimeSlotsContextFields {
1052
1060
  *
1053
1061
  * Ignored for a malformed range, and a range that ends before it starts.
1054
1062
  *
1055
- * @param range - Dates to cover, including both ends. A range that's a calendar month moves by
1056
- * month with `nextDaysAvailabilityRange()` and `previousDaysAvailabilityRange()`.
1063
+ * @param range - Dates to cover, including both ends.
1057
1064
  * @returns Promise that resolves once the range is set, before its availability loads.
1058
1065
  * @example Show the next 7 days' availability
1059
1066
  * ```tsx
@@ -1085,64 +1092,12 @@ interface TimeSlotsContextFields {
1085
1092
  * ```
1086
1093
  */
1087
1094
  readonly setDaysAvailabilityRange: (range: LocalDateRange) => Promise<void>;
1088
- /**
1089
- * Moves `daysAvailabilityRange` forward and loads the new dates' availability.
1090
- *
1091
- * A range that's a calendar month moves to the next month. Any other range moves forward by
1092
- * its own length. Does nothing to the range while `daysAvailabilityRange` is `null`.
1093
- *
1094
- * @returns Promise that resolves once the range moves, before its availability loads.
1095
- * @example Move to the next month
1096
- * ```tsx
1097
- * import { useTimeSlotsContext } from '@wix/bookings/context/time-slots';
1098
- *
1099
- * function NextMonthButton() {
1100
- * const { daysAvailabilityRange, daysAvailabilityLoading, nextDaysAvailabilityRange } =
1101
- * useTimeSlotsContext();
1102
- *
1103
- * if (!daysAvailabilityRange) return null;
1104
- *
1105
- * return (
1106
- * <button disabled={daysAvailabilityLoading} onClick={() => nextDaysAvailabilityRange()}>
1107
- * Next month
1108
- * </button>
1109
- * );
1110
- * }
1111
- * ```
1112
- */
1113
- readonly nextDaysAvailabilityRange: () => Promise<void>;
1114
- /**
1115
- * Moves `daysAvailabilityRange` back and loads the new dates' availability.
1116
- *
1117
- * A range that's a calendar month moves to the previous month. Any other range moves back by
1118
- * its own length. Does nothing to the range while `daysAvailabilityRange` is `null`.
1119
- *
1120
- * @returns Promise that resolves once the range moves, before its availability loads.
1121
- * @example Move to the previous month
1122
- * ```tsx
1123
- * import { useTimeSlotsContext } from '@wix/bookings/context/time-slots';
1124
- *
1125
- * function PreviousMonthButton() {
1126
- * const { daysAvailabilityRange, daysAvailabilityLoading, previousDaysAvailabilityRange } =
1127
- * useTimeSlotsContext();
1128
- *
1129
- * if (!daysAvailabilityRange) return null;
1130
- *
1131
- * return (
1132
- * <button disabled={daysAvailabilityLoading} onClick={() => previousDaysAvailabilityRange()}>
1133
- * Previous month
1134
- * </button>
1135
- * );
1136
- * }
1137
- * ```
1138
- */
1139
- readonly previousDaysAvailabilityRange: () => Promise<void>;
1140
1095
  /**
1141
1096
  * Selects the first date with a bookable time slot, starting from the selected date, or from
1142
1097
  * today when no date is selected.
1143
1098
  *
1144
1099
  * When that date is outside `daysAvailabilityRange`, the range moves to the date's month. While
1145
- * it searches, `timeSlotsLoading` is `true`.
1100
+ * it searches, `isLoading` is `true`.
1146
1101
  *
1147
1102
  * You can call it before the context loads, such as when your component mounts. The search
1148
1103
  * waits until the service and the time zone are known. Calling `selectDate()` before the
@@ -1188,18 +1143,10 @@ interface TimeSlotsContextFields {
1188
1143
  * 2 or more services that the visitor selected.
1189
1144
  *
1190
1145
  * `false` while the Service context loads, and when it fails to load. `true` even when the
1191
- * appointment isn't valid. To check that there's availability to request, use
1192
- * `hasValidSchedulingInput`.
1146
+ * appointment isn't valid. To check that there's availability to request, check that
1147
+ * `availabilityRequestKey` isn't `null`.
1193
1148
  */
1194
1149
  readonly isMultiService: boolean;
1195
- /**
1196
- * Whether the context has a service or a valid multi-service appointment to request
1197
- * availability for.
1198
- *
1199
- * `false` when the service can't be booked online, and while a booking to reschedule loads or
1200
- * can't be rescheduled.
1201
- */
1202
- readonly hasValidSchedulingInput: boolean;
1203
1150
  /**
1204
1151
  * Key that changes whenever the availability request's target changes: the service, or a
1205
1152
  * multi-service appointment's services, staff members, choices, or location. Selecting a time
@@ -1208,7 +1155,8 @@ interface TimeSlotsContextFields {
1208
1155
  * A multi-service appointment can change while your component stays on the page. To reset
1209
1156
  * state you keep about a search, such as a "no availability" message, compare this key.
1210
1157
  *
1211
- * `null` when `hasValidSchedulingInput` is `false`.
1158
+ * `null` when there's no service or valid multi-service appointment to request availability
1159
+ * for, such as when the service can't be booked online.
1212
1160
  */
1213
1161
  readonly availabilityRequestKey: string | null;
1214
1162
  /**
@@ -1420,8 +1368,6 @@ interface TimeSlotsContextFields {
1420
1368
  * For a multi-service appointment, a selected time slot is enough.
1421
1369
  */
1422
1370
  readonly isComplete: boolean;
1423
- /** Whether the selected time slot is confirmed to still be available. Always `false`. */
1424
- readonly isSelectionValidated: boolean;
1425
1371
  /** The calendar moves an existing booking (`bookingId` or `token` in its URL). */
1426
1372
  readonly isRescheduling: boolean;
1427
1373
  /**
@@ -0,0 +1,3 @@
1
+ {
2
+ "main": "../../build/cjs/context-my-booking.js"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "main": "../../build/cjs/context-my-bookings.js"
3
+ }
@@ -3531,6 +3531,38 @@ interface BookingCheckoutState {
3531
3531
  * ```
3532
3532
  */
3533
3533
  setParticipants: (count: number) => void;
3534
+ /**
3535
+ * Sets whether the visitor has a promo code to enter at checkout, in `selection.wantsPromoCode`,
3536
+ * and writes it to the page's URL, replacing the current history entry.
3537
+ *
3538
+ * When it's `true` and a priced service is paid in person, `createBooking()` sends the visitor to
3539
+ * the checkout page to enter the code. It doesn't change what's booked, so it keeps
3540
+ * `selectedPaymentOptions`, `createError`, and `addToCartError`.
3541
+ *
3542
+ * The function does nothing when `selection` is `null`.
3543
+ *
3544
+ * @param wanted Whether the visitor has a promo code to enter at checkout.
3545
+ * @example Let the visitor say they have a promo code
3546
+ * ```tsx
3547
+ * import { useBookingCheckoutContext } from '@wix/bookings/context/booking-checkout';
3548
+ *
3549
+ * function PromoCodeCheckbox() {
3550
+ * const { selection, setWantsPromoCode } = useBookingCheckoutContext();
3551
+ *
3552
+ * return (
3553
+ * <label>
3554
+ * <input
3555
+ * type="checkbox"
3556
+ * checked={selection?.wantsPromoCode === true}
3557
+ * onChange={(event) => setWantsPromoCode(event.target.checked)}
3558
+ * />
3559
+ * I have a promo code
3560
+ * </label>
3561
+ * );
3562
+ * }
3563
+ * ```
3564
+ */
3565
+ setWantsPromoCode: (wanted: boolean) => void;
3534
3566
  }
3535
3567
  //#endregion
3536
3568
  //#region src/extensions/contexts/booking-checkout-context/booking-checkout-context.d.ts