@wix/bookings 1.0.1786 → 1.0.1787

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 (51) hide show
  1. package/build/cjs/context-booking-checkout.d.ts +22 -6
  2. package/build/cjs/context-booking-checkout.js +2296 -2253
  3. package/build/cjs/context-booking-checkout.js.map +1 -1
  4. package/build/cjs/context-categories.js +285 -275
  5. package/build/cjs/context-categories.js.map +1 -1
  6. package/build/cjs/context-locations.js +465 -455
  7. package/build/cjs/context-locations.js.map +1 -1
  8. package/build/cjs/context-service-addons.js +964 -917
  9. package/build/cjs/context-service-addons.js.map +1 -1
  10. package/build/cjs/context-service.d.ts +14 -5
  11. package/build/cjs/context-service.js +3514 -3337
  12. package/build/cjs/context-service.js.map +1 -1
  13. package/build/cjs/context-services.js +878 -832
  14. package/build/cjs/context-services.js.map +1 -1
  15. package/build/cjs/context-time-slots.d.ts +10 -0
  16. package/build/cjs/context-time-slots.js +1202 -1159
  17. package/build/cjs/context-time-slots.js.map +1 -1
  18. package/build/es/context-booking-checkout.d.mts +22 -6
  19. package/build/es/context-booking-checkout.mjs +2304 -2261
  20. package/build/es/context-booking-checkout.mjs.map +1 -1
  21. package/build/es/context-categories.mjs +285 -275
  22. package/build/es/context-categories.mjs.map +1 -1
  23. package/build/es/context-locations.mjs +465 -455
  24. package/build/es/context-locations.mjs.map +1 -1
  25. package/build/es/context-service-addons.mjs +971 -924
  26. package/build/es/context-service-addons.mjs.map +1 -1
  27. package/build/es/context-service.d.mts +14 -5
  28. package/build/es/context-service.mjs +3383 -3206
  29. package/build/es/context-service.mjs.map +1 -1
  30. package/build/es/context-services.mjs +878 -832
  31. package/build/es/context-services.mjs.map +1 -1
  32. package/build/es/context-time-slots.d.mts +10 -0
  33. package/build/es/context-time-slots.mjs +1222 -1179
  34. package/build/es/context-time-slots.mjs.map +1 -1
  35. package/build/internal/cjs/context-booking-checkout.d.ts +22 -6
  36. package/build/internal/cjs/context-service.d.ts +14 -5
  37. package/build/internal/cjs/context-time-slots.d.ts +10 -0
  38. package/build/internal/es/context-booking-checkout.d.mts +22 -6
  39. package/build/internal/es/context-service.d.mts +14 -5
  40. package/build/internal/es/context-time-slots.d.mts +10 -0
  41. package/context-runtime/context-booking-checkout/runtime.d.ts +22 -6
  42. package/context-runtime/context-booking-checkout/runtime.js +3 -3
  43. package/context-runtime/context-categories/runtime.js +2 -2
  44. package/context-runtime/context-locations/runtime.js +2 -2
  45. package/context-runtime/context-service/runtime.d.ts +14 -5
  46. package/context-runtime/context-service/runtime.js +3 -3
  47. package/context-runtime/context-service-addons/runtime.js +2 -2
  48. package/context-runtime/context-services/runtime.js +3 -3
  49. package/context-runtime/context-time-slots/runtime.d.ts +10 -0
  50. package/context-runtime/context-time-slots/runtime.js +3 -3
  51. package/package.json +2 -2
@@ -2591,7 +2591,8 @@ declare const PAYMENT_OPTION_KIND: {
2591
2591
  readonly FREE: "FREE"; /** CUSTOM rate: a price description instead of an amount. */
2592
2592
  readonly CUSTOM_PRICE: "CUSTOM_PRICE";
2593
2593
  readonly MEMBERSHIP: "MEMBERSHIP";
2594
- readonly BUY_PLAN: "BUY_PLAN";
2594
+ readonly BUY_PLAN: "BUY_PLAN"; /** SUBSCRIPTION rate: paid online every billing cycle. The service's only row. */
2595
+ readonly SUBSCRIPTION: "SUBSCRIPTION";
2595
2596
  };
2596
2597
  type PaymentOptionKind = (typeof PAYMENT_OPTION_KIND)[keyof typeof PAYMENT_OPTION_KIND];
2597
2598
  //#endregion
@@ -2743,6 +2744,7 @@ interface PaymentOption {
2743
2744
  * - `'CUSTOM_PRICE'`: The service has a price description instead of an amount, in `priceText`.
2744
2745
  * - `'MEMBERSHIP'`: Pay with a membership the visitor has, in `membership`.
2745
2746
  * - `'BUY_PLAN'`: Buy a plan and pay with it, in `purchasablePlan`.
2747
+ * - `'SUBSCRIPTION'`: Pay online every billing cycle. `amount` is what each cycle costs.
2746
2748
  */
2747
2749
  kind: PaymentOptionKind;
2748
2750
  /**
@@ -2757,7 +2759,8 @@ interface PaymentOption {
2757
2759
  * Amount to pay with the option, with its currency. Format it for the visitor's locale before you
2758
2760
  * show it.
2759
2761
  *
2760
- * `null` for a free service, a custom price, a membership, and a plan to buy.
2762
+ * `null` for a free service, a custom price, a membership, and a plan to buy. For a
2763
+ * `'SUBSCRIPTION'` option, the amount of each billing cycle.
2761
2764
  */
2762
2765
  amount: Money | null;
2763
2766
  /**
@@ -2886,6 +2889,11 @@ interface BookingPayment {
2886
2889
  depositSelected: boolean | null;
2887
2890
  /** The plan bought in the same cart that pays this entry. */
2888
2891
  purchase?: PlanPurchase | null;
2892
+ /**
2893
+ * Whether the entry is paid by subscription, every billing cycle. Its card is taken on the
2894
+ * checkout page, so the booking always goes there.
2895
+ */
2896
+ subscription?: boolean;
2889
2897
  }
2890
2898
  interface CreateBookingInput {
2891
2899
  /**
@@ -3134,13 +3142,21 @@ type CreateBookingOutcome = {
3134
3142
  interface BookingCheckoutState {
3135
3143
  /**
3136
3144
  * The services the visitor selected, with their time slots and choices, read from the page URL's
3137
- * `b` query parameter. The Service and Time Slots contexts write that parameter when they send the
3138
- * visitor to the Booking Form page. To build a link that carries the selection yourself, use the
3139
- * Service context's `withSelectionParam()`. The parameter's format is internal and can change.
3145
+ * `bookingSelection` query parameter. The Service and Time Slots contexts write that parameter when
3146
+ * they send the visitor to the Booking Form page. To build a link that carries the selection
3147
+ * yourself, use the Service context's `withSelectionParam()`. The parameter's format is internal
3148
+ * and can change.
3140
3149
  *
3141
- * `null` when the URL has no selection, or it holds no service.
3150
+ * `null` when the URL has no selection, or it holds no service, and while `isSelectionPending` is
3151
+ * `true`.
3142
3152
  */
3143
3153
  selection: BookingPreferences | null;
3154
+ /**
3155
+ * Whether the booking preferences in the page's URL are still unread. The page's first render
3156
+ * ignores them, so its server HTML is the same for every visitor; they apply right after. While
3157
+ * `true`, show a loading state rather than "nothing selected".
3158
+ */
3159
+ isSelectionPending: boolean;
3144
3160
  /**
3145
3161
  * Whether the selection has everything a booking needs and a booking form is registered. Every
3146
3162
  * service needs a service type, a time slot with a time zone, and a schedule or session ID. A
@@ -3788,8 +3788,8 @@ interface SlotPickDetails {
3788
3788
  }
3789
3789
  type SetSlot = (slot: SlotSelection, details?: SlotPickDetails) => void;
3790
3790
  /**
3791
- * Appends this service's selection as `b=`. `handoff` (booking form) keeps only this service's
3792
- * entry and the live timezone. `staffId` (null = "any") leaves the selection.
3791
+ * Appends this service's selection as `bookingSelection=`. `handoff` (booking form) keeps only this
3792
+ * service's entry and the live timezone. `staffId` (null = "any") leaves the selection.
3793
3793
  */
3794
3794
  type WithSelectionParam = (path: string, opts?: {
3795
3795
  /**
@@ -4415,7 +4415,7 @@ interface ServiceContextValue {
4415
4415
  * Visitor's selection for the service, such as the time slot, location, staff member, variant
4416
4416
  * choices, and add-ons. It starts from the booking preferences in the page's URL.
4417
4417
  *
4418
- * The booking preferences are the booking choices that the page's URL keeps in its `b` query
4418
+ * The booking preferences are the booking choices that the page's URL keeps in its `bookingSelection` query
4419
4419
  * parameter, so they carry from page to page: the services the visitor selected, with their time
4420
4420
  * slots and choices.
4421
4421
  *
@@ -4423,6 +4423,12 @@ interface ServiceContextValue {
4423
4423
  * `navigateToNextPage()` carries it to the next page.
4424
4424
  */
4425
4425
  selection: ServicePreference;
4426
+ /**
4427
+ * Whether `selection` is still waiting for the booking preferences in the page's URL. The page's
4428
+ * first render ignores them, so its server HTML is the same for every visitor; they apply right
4429
+ * after. While `true`, `selection` is empty: show a loading state rather than "nothing selected".
4430
+ */
4431
+ isSelectionPending: boolean;
4426
4432
  /**
4427
4433
  * Whether the time slot in `selection` is a full class session whose waitlist is open. Such a
4428
4434
  * slot can't be booked on the site yet: `navigateToNextPage()` doesn't take it to the booking
@@ -4763,17 +4769,20 @@ interface ServiceContextValue {
4763
4769
  */
4764
4770
  setWantsPromoCode: (wanted: boolean) => void;
4765
4771
  /**
4766
- * Adds the visitor's selection to a page path, as the booking preferences in the path's `b` query
4772
+ * Adds the visitor's selection to a page path, as the booking preferences in the path's `bookingSelection` query
4767
4773
  * parameter.
4768
4774
  *
4769
4775
  * Use it to build your own link that carries the selection. It doesn't change the selection, and
4770
4776
  * doesn't navigate. When `setSlot()` set a time zone, the booking preferences use it.
4771
4777
  *
4778
+ * While `isSelectionPending` is `true`, the link doesn't carry what the page's URL selected, so a
4779
+ * link rendered on the server is the same for every visitor. It updates once the selection is read.
4780
+ *
4772
4781
  * @param path - Path of the page, which can have its own query and hash.
4773
4782
  *
4774
4783
  * @param opts - How to add the selection.
4775
4784
  *
4776
- * @returns Path, query, and hash of `path`, with the `b` query parameter added. The origin of a
4785
+ * @returns Path, query, and hash of `path`, with the `bookingSelection` query parameter added. The origin of a
4777
4786
  * full URL is dropped.
4778
4787
  *
4779
4788
  * @example Link to a page with the visitor's selection
@@ -1147,6 +1147,16 @@ interface TimeSlotsContextFields {
1147
1147
  * `availabilityRequestKey` isn't `null`.
1148
1148
  */
1149
1149
  readonly isMultiService: boolean;
1150
+ /**
1151
+ * Whether the choices the visitor made before the calendar, kept in the page URL, are still
1152
+ * waiting to apply. The page's first render ignores them, so its server HTML is the same for
1153
+ * every visitor; they apply right after.
1154
+ *
1155
+ * While `true`, `staffFilterOptions` and `locationFilterOptions` list everything the service
1156
+ * offers, even a choice those preferences will fix. Show a loading state rather than a filter
1157
+ * that may disappear.
1158
+ */
1159
+ readonly isSelectionPending: boolean;
1150
1160
  /**
1151
1161
  * Key that changes whenever the availability request's target changes: the service, or a
1152
1162
  * multi-service appointment's services, staff members, choices, or location. Selecting a time
@@ -2591,7 +2591,8 @@ declare const PAYMENT_OPTION_KIND: {
2591
2591
  readonly FREE: "FREE"; /** CUSTOM rate: a price description instead of an amount. */
2592
2592
  readonly CUSTOM_PRICE: "CUSTOM_PRICE";
2593
2593
  readonly MEMBERSHIP: "MEMBERSHIP";
2594
- readonly BUY_PLAN: "BUY_PLAN";
2594
+ readonly BUY_PLAN: "BUY_PLAN"; /** SUBSCRIPTION rate: paid online every billing cycle. The service's only row. */
2595
+ readonly SUBSCRIPTION: "SUBSCRIPTION";
2595
2596
  };
2596
2597
  type PaymentOptionKind = (typeof PAYMENT_OPTION_KIND)[keyof typeof PAYMENT_OPTION_KIND];
2597
2598
  //#endregion
@@ -2743,6 +2744,7 @@ interface PaymentOption {
2743
2744
  * - `'CUSTOM_PRICE'`: The service has a price description instead of an amount, in `priceText`.
2744
2745
  * - `'MEMBERSHIP'`: Pay with a membership the visitor has, in `membership`.
2745
2746
  * - `'BUY_PLAN'`: Buy a plan and pay with it, in `purchasablePlan`.
2747
+ * - `'SUBSCRIPTION'`: Pay online every billing cycle. `amount` is what each cycle costs.
2746
2748
  */
2747
2749
  kind: PaymentOptionKind;
2748
2750
  /**
@@ -2757,7 +2759,8 @@ interface PaymentOption {
2757
2759
  * Amount to pay with the option, with its currency. Format it for the visitor's locale before you
2758
2760
  * show it.
2759
2761
  *
2760
- * `null` for a free service, a custom price, a membership, and a plan to buy.
2762
+ * `null` for a free service, a custom price, a membership, and a plan to buy. For a
2763
+ * `'SUBSCRIPTION'` option, the amount of each billing cycle.
2761
2764
  */
2762
2765
  amount: Money | null;
2763
2766
  /**
@@ -2886,6 +2889,11 @@ interface BookingPayment {
2886
2889
  depositSelected: boolean | null;
2887
2890
  /** The plan bought in the same cart that pays this entry. */
2888
2891
  purchase?: PlanPurchase | null;
2892
+ /**
2893
+ * Whether the entry is paid by subscription, every billing cycle. Its card is taken on the
2894
+ * checkout page, so the booking always goes there.
2895
+ */
2896
+ subscription?: boolean;
2889
2897
  }
2890
2898
  interface CreateBookingInput {
2891
2899
  /**
@@ -3134,13 +3142,21 @@ type CreateBookingOutcome = {
3134
3142
  interface BookingCheckoutState {
3135
3143
  /**
3136
3144
  * The services the visitor selected, with their time slots and choices, read from the page URL's
3137
- * `b` query parameter. The Service and Time Slots contexts write that parameter when they send the
3138
- * visitor to the Booking Form page. To build a link that carries the selection yourself, use the
3139
- * Service context's `withSelectionParam()`. The parameter's format is internal and can change.
3145
+ * `bookingSelection` query parameter. The Service and Time Slots contexts write that parameter when
3146
+ * they send the visitor to the Booking Form page. To build a link that carries the selection
3147
+ * yourself, use the Service context's `withSelectionParam()`. The parameter's format is internal
3148
+ * and can change.
3140
3149
  *
3141
- * `null` when the URL has no selection, or it holds no service.
3150
+ * `null` when the URL has no selection, or it holds no service, and while `isSelectionPending` is
3151
+ * `true`.
3142
3152
  */
3143
3153
  selection: BookingPreferences | null;
3154
+ /**
3155
+ * Whether the booking preferences in the page's URL are still unread. The page's first render
3156
+ * ignores them, so its server HTML is the same for every visitor; they apply right after. While
3157
+ * `true`, show a loading state rather than "nothing selected".
3158
+ */
3159
+ isSelectionPending: boolean;
3144
3160
  /**
3145
3161
  * Whether the selection has everything a booking needs and a booking form is registered. Every
3146
3162
  * service needs a service type, a time slot with a time zone, and a schedule or session ID. A
@@ -3788,8 +3788,8 @@ interface SlotPickDetails {
3788
3788
  }
3789
3789
  type SetSlot = (slot: SlotSelection, details?: SlotPickDetails) => void;
3790
3790
  /**
3791
- * Appends this service's selection as `b=`. `handoff` (booking form) keeps only this service's
3792
- * entry and the live timezone. `staffId` (null = "any") leaves the selection.
3791
+ * Appends this service's selection as `bookingSelection=`. `handoff` (booking form) keeps only this
3792
+ * service's entry and the live timezone. `staffId` (null = "any") leaves the selection.
3793
3793
  */
3794
3794
  type WithSelectionParam = (path: string, opts?: {
3795
3795
  /**
@@ -4415,7 +4415,7 @@ interface ServiceContextValue {
4415
4415
  * Visitor's selection for the service, such as the time slot, location, staff member, variant
4416
4416
  * choices, and add-ons. It starts from the booking preferences in the page's URL.
4417
4417
  *
4418
- * The booking preferences are the booking choices that the page's URL keeps in its `b` query
4418
+ * The booking preferences are the booking choices that the page's URL keeps in its `bookingSelection` query
4419
4419
  * parameter, so they carry from page to page: the services the visitor selected, with their time
4420
4420
  * slots and choices.
4421
4421
  *
@@ -4423,6 +4423,12 @@ interface ServiceContextValue {
4423
4423
  * `navigateToNextPage()` carries it to the next page.
4424
4424
  */
4425
4425
  selection: ServicePreference;
4426
+ /**
4427
+ * Whether `selection` is still waiting for the booking preferences in the page's URL. The page's
4428
+ * first render ignores them, so its server HTML is the same for every visitor; they apply right
4429
+ * after. While `true`, `selection` is empty: show a loading state rather than "nothing selected".
4430
+ */
4431
+ isSelectionPending: boolean;
4426
4432
  /**
4427
4433
  * Whether the time slot in `selection` is a full class session whose waitlist is open. Such a
4428
4434
  * slot can't be booked on the site yet: `navigateToNextPage()` doesn't take it to the booking
@@ -4763,17 +4769,20 @@ interface ServiceContextValue {
4763
4769
  */
4764
4770
  setWantsPromoCode: (wanted: boolean) => void;
4765
4771
  /**
4766
- * Adds the visitor's selection to a page path, as the booking preferences in the path's `b` query
4772
+ * Adds the visitor's selection to a page path, as the booking preferences in the path's `bookingSelection` query
4767
4773
  * parameter.
4768
4774
  *
4769
4775
  * Use it to build your own link that carries the selection. It doesn't change the selection, and
4770
4776
  * doesn't navigate. When `setSlot()` set a time zone, the booking preferences use it.
4771
4777
  *
4778
+ * While `isSelectionPending` is `true`, the link doesn't carry what the page's URL selected, so a
4779
+ * link rendered on the server is the same for every visitor. It updates once the selection is read.
4780
+ *
4772
4781
  * @param path - Path of the page, which can have its own query and hash.
4773
4782
  *
4774
4783
  * @param opts - How to add the selection.
4775
4784
  *
4776
- * @returns Path, query, and hash of `path`, with the `b` query parameter added. The origin of a
4785
+ * @returns Path, query, and hash of `path`, with the `bookingSelection` query parameter added. The origin of a
4777
4786
  * full URL is dropped.
4778
4787
  *
4779
4788
  * @example Link to a page with the visitor's selection
@@ -1147,6 +1147,16 @@ interface TimeSlotsContextFields {
1147
1147
  * `availabilityRequestKey` isn't `null`.
1148
1148
  */
1149
1149
  readonly isMultiService: boolean;
1150
+ /**
1151
+ * Whether the choices the visitor made before the calendar, kept in the page URL, are still
1152
+ * waiting to apply. The page's first render ignores them, so its server HTML is the same for
1153
+ * every visitor; they apply right after.
1154
+ *
1155
+ * While `true`, `staffFilterOptions` and `locationFilterOptions` list everything the service
1156
+ * offers, even a choice those preferences will fix. Show a loading state rather than a filter
1157
+ * that may disappear.
1158
+ */
1159
+ readonly isSelectionPending: boolean;
1150
1160
  /**
1151
1161
  * Key that changes whenever the availability request's target changes: the service, or a
1152
1162
  * multi-service appointment's services, staff members, choices, or location. Selecting a time
@@ -2591,7 +2591,8 @@ declare const PAYMENT_OPTION_KIND: {
2591
2591
  readonly FREE: "FREE"; /** CUSTOM rate: a price description instead of an amount. */
2592
2592
  readonly CUSTOM_PRICE: "CUSTOM_PRICE";
2593
2593
  readonly MEMBERSHIP: "MEMBERSHIP";
2594
- readonly BUY_PLAN: "BUY_PLAN";
2594
+ readonly BUY_PLAN: "BUY_PLAN"; /** SUBSCRIPTION rate: paid online every billing cycle. The service's only row. */
2595
+ readonly SUBSCRIPTION: "SUBSCRIPTION";
2595
2596
  };
2596
2597
  type PaymentOptionKind = (typeof PAYMENT_OPTION_KIND)[keyof typeof PAYMENT_OPTION_KIND];
2597
2598
  //#endregion
@@ -2743,6 +2744,7 @@ interface PaymentOption {
2743
2744
  * - `'CUSTOM_PRICE'`: The service has a price description instead of an amount, in `priceText`.
2744
2745
  * - `'MEMBERSHIP'`: Pay with a membership the visitor has, in `membership`.
2745
2746
  * - `'BUY_PLAN'`: Buy a plan and pay with it, in `purchasablePlan`.
2747
+ * - `'SUBSCRIPTION'`: Pay online every billing cycle. `amount` is what each cycle costs.
2746
2748
  */
2747
2749
  kind: PaymentOptionKind;
2748
2750
  /**
@@ -2757,7 +2759,8 @@ interface PaymentOption {
2757
2759
  * Amount to pay with the option, with its currency. Format it for the visitor's locale before you
2758
2760
  * show it.
2759
2761
  *
2760
- * `null` for a free service, a custom price, a membership, and a plan to buy.
2762
+ * `null` for a free service, a custom price, a membership, and a plan to buy. For a
2763
+ * `'SUBSCRIPTION'` option, the amount of each billing cycle.
2761
2764
  */
2762
2765
  amount: Money | null;
2763
2766
  /**
@@ -2886,6 +2889,11 @@ interface BookingPayment {
2886
2889
  depositSelected: boolean | null;
2887
2890
  /** The plan bought in the same cart that pays this entry. */
2888
2891
  purchase?: PlanPurchase | null;
2892
+ /**
2893
+ * Whether the entry is paid by subscription, every billing cycle. Its card is taken on the
2894
+ * checkout page, so the booking always goes there.
2895
+ */
2896
+ subscription?: boolean;
2889
2897
  }
2890
2898
  interface CreateBookingInput {
2891
2899
  /**
@@ -3134,13 +3142,21 @@ type CreateBookingOutcome = {
3134
3142
  interface BookingCheckoutState {
3135
3143
  /**
3136
3144
  * The services the visitor selected, with their time slots and choices, read from the page URL's
3137
- * `b` query parameter. The Service and Time Slots contexts write that parameter when they send the
3138
- * visitor to the Booking Form page. To build a link that carries the selection yourself, use the
3139
- * Service context's `withSelectionParam()`. The parameter's format is internal and can change.
3145
+ * `bookingSelection` query parameter. The Service and Time Slots contexts write that parameter when
3146
+ * they send the visitor to the Booking Form page. To build a link that carries the selection
3147
+ * yourself, use the Service context's `withSelectionParam()`. The parameter's format is internal
3148
+ * and can change.
3140
3149
  *
3141
- * `null` when the URL has no selection, or it holds no service.
3150
+ * `null` when the URL has no selection, or it holds no service, and while `isSelectionPending` is
3151
+ * `true`.
3142
3152
  */
3143
3153
  selection: BookingPreferences | null;
3154
+ /**
3155
+ * Whether the booking preferences in the page's URL are still unread. The page's first render
3156
+ * ignores them, so its server HTML is the same for every visitor; they apply right after. While
3157
+ * `true`, show a loading state rather than "nothing selected".
3158
+ */
3159
+ isSelectionPending: boolean;
3144
3160
  /**
3145
3161
  * Whether the selection has everything a booking needs and a booking form is registered. Every
3146
3162
  * service needs a service type, a time slot with a time zone, and a schedule or session ID. A