@wix/bookings 1.0.1782 → 1.0.1784
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 +22 -6
|
@@ -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
|
|
@@ -4736,36 +4748,18 @@ interface ServiceContextValue {
|
|
|
4736
4748
|
draftRevision: number;
|
|
4737
4749
|
/**
|
|
4738
4750
|
* Whether the visitor has a promo code to enter at checkout, from the booking preferences in the
|
|
4739
|
-
* page's URL.
|
|
4751
|
+
* page's URL.
|
|
4752
|
+
*
|
|
4753
|
+
* @deprecated Use the Booking Checkout context's `selection.wantsPromoCode`.
|
|
4740
4754
|
*/
|
|
4741
4755
|
wantsPromoCode: boolean;
|
|
4742
4756
|
/**
|
|
4743
4757
|
* Sets whether the visitor has a promo code to enter at checkout, and writes it to the page's
|
|
4744
|
-
* URL, replacing the current history entry.
|
|
4745
|
-
*
|
|
4746
|
-
* 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.
|
|
4747
4760
|
*
|
|
4761
|
+
* @deprecated Use the Booking Checkout context's `setWantsPromoCode()`.
|
|
4748
4762
|
* @param wanted - Whether the visitor has a promo code to enter at checkout.
|
|
4749
|
-
*
|
|
4750
|
-
* @example Let the visitor say they have a promo code
|
|
4751
|
-
* ```tsx
|
|
4752
|
-
* import { useServiceContext } from '@wix/bookings/context/service';
|
|
4753
|
-
*
|
|
4754
|
-
* function PromoCodeCheckbox() {
|
|
4755
|
-
* const { wantsPromoCode, setWantsPromoCode } = useServiceContext();
|
|
4756
|
-
*
|
|
4757
|
-
* return (
|
|
4758
|
-
* <label>
|
|
4759
|
-
* <input
|
|
4760
|
-
* type="checkbox"
|
|
4761
|
-
* checked={wantsPromoCode}
|
|
4762
|
-
* onChange={(event) => setWantsPromoCode(event.target.checked)}
|
|
4763
|
-
* />
|
|
4764
|
-
* I have a promo code
|
|
4765
|
-
* </label>
|
|
4766
|
-
* );
|
|
4767
|
-
* }
|
|
4768
|
-
* ```
|
|
4769
4763
|
*/
|
|
4770
4764
|
setWantsPromoCode: (wanted: boolean) => void;
|
|
4771
4765
|
/**
|
|
@@ -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
|
|
@@ -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
|