@wix/bookings 1.0.1754 → 1.0.1756

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/_sdk-exports/context-booking-checkout/runtime.d.ts +791 -143
  2. package/_sdk-exports/context-booking-checkout/runtime.js +3 -2
  3. package/_sdk-exports/context-categories/runtime.d.ts +164 -2
  4. package/_sdk-exports/context-categories/runtime.js +2 -1
  5. package/_sdk-exports/context-locations/runtime.d.ts +186 -2
  6. package/_sdk-exports/context-locations/runtime.js +2 -1
  7. package/_sdk-exports/context-service/runtime.d.ts +1540 -144
  8. package/_sdk-exports/context-service/runtime.js +3 -2
  9. package/_sdk-exports/context-service-addons/runtime.d.ts +215 -13
  10. package/_sdk-exports/context-service-addons/runtime.js +2 -1
  11. package/_sdk-exports/context-services/runtime.d.ts +371 -77
  12. package/_sdk-exports/context-services/runtime.js +3 -2
  13. package/_sdk-exports/context-time-slots/runtime.d.ts +854 -72
  14. package/_sdk-exports/context-time-slots/runtime.js +3 -2
  15. package/build/cjs/context-booking-checkout.d.ts +791 -143
  16. package/build/cjs/context-booking-checkout.js +1759 -1640
  17. package/build/cjs/context-booking-checkout.js.map +1 -1
  18. package/build/cjs/context-categories.d.ts +164 -2
  19. package/build/cjs/context-categories.js +116 -114
  20. package/build/cjs/context-categories.js.map +1 -1
  21. package/build/cjs/context-locations.d.ts +186 -2
  22. package/build/cjs/context-locations.js +126 -124
  23. package/build/cjs/context-locations.js.map +1 -1
  24. package/build/cjs/context-service-addons.d.ts +215 -13
  25. package/build/cjs/context-service-addons.js +323 -321
  26. package/build/cjs/context-service-addons.js.map +1 -1
  27. package/build/cjs/context-service.d.ts +1540 -144
  28. package/build/cjs/context-service.js +1622 -1616
  29. package/build/cjs/context-service.js.map +1 -1
  30. package/build/cjs/context-services.d.ts +371 -77
  31. package/build/cjs/context-services.js +460 -458
  32. package/build/cjs/context-services.js.map +1 -1
  33. package/build/cjs/context-time-slots.d.ts +854 -72
  34. package/build/cjs/context-time-slots.js +1033 -1000
  35. package/build/cjs/context-time-slots.js.map +1 -1
  36. package/build/es/context-booking-checkout.d.mts +791 -143
  37. package/build/es/context-booking-checkout.mjs +1778 -1650
  38. package/build/es/context-booking-checkout.mjs.map +1 -1
  39. package/build/es/context-categories.d.mts +164 -2
  40. package/build/es/context-categories.mjs +116 -114
  41. package/build/es/context-categories.mjs.map +1 -1
  42. package/build/es/context-locations.d.mts +186 -2
  43. package/build/es/context-locations.mjs +126 -124
  44. package/build/es/context-locations.mjs.map +1 -1
  45. package/build/es/context-service-addons.d.mts +215 -13
  46. package/build/es/context-service-addons.mjs +323 -321
  47. package/build/es/context-service-addons.mjs.map +1 -1
  48. package/build/es/context-service.d.mts +1540 -144
  49. package/build/es/context-service.mjs +1622 -1616
  50. package/build/es/context-service.mjs.map +1 -1
  51. package/build/es/context-services.d.mts +371 -77
  52. package/build/es/context-services.mjs +460 -458
  53. package/build/es/context-services.mjs.map +1 -1
  54. package/build/es/context-time-slots.d.mts +854 -72
  55. package/build/es/context-time-slots.mjs +1033 -1000
  56. package/build/es/context-time-slots.mjs.map +1 -1
  57. package/build/internal/cjs/context-booking-checkout.d.ts +791 -143
  58. package/build/internal/cjs/context-categories.d.ts +164 -2
  59. package/build/internal/cjs/context-locations.d.ts +186 -2
  60. package/build/internal/cjs/context-service-addons.d.ts +215 -13
  61. package/build/internal/cjs/context-service.d.ts +1540 -144
  62. package/build/internal/cjs/context-services.d.ts +371 -77
  63. package/build/internal/cjs/context-time-slots.d.ts +854 -72
  64. package/build/internal/es/context-booking-checkout.d.mts +791 -143
  65. package/build/internal/es/context-categories.d.mts +164 -2
  66. package/build/internal/es/context-locations.d.mts +186 -2
  67. package/build/internal/es/context-service-addons.d.mts +215 -13
  68. package/build/internal/es/context-service.d.mts +1540 -144
  69. package/build/internal/es/context-services.d.mts +371 -77
  70. package/build/internal/es/context-time-slots.d.mts +854 -72
  71. package/package.json +5 -5
@@ -279,7 +279,7 @@ interface NestedTimeSlot {
279
279
  * You can use it to offer customers different prices for a service,
280
280
  * depending on which choices they book.
281
281
  */
282
- interface ServiceOptionsAndVariants$1 {
282
+ interface ServiceOptionsAndVariants {
283
283
  /**
284
284
  * ID of the `serviceOptionsAndVariants` object.
285
285
  * @format GUID
@@ -362,6 +362,11 @@ declare enum ServiceOptionType$1 {
362
362
  * @documentationMaturity preview
363
363
  */
364
364
  NUMBER_OF_PARTICIPANTS = "NUMBER_OF_PARTICIPANTS",
365
+ /**
366
+ * The price is resolved by the business location the service is booked at.
367
+ * @documentationMaturity preview
368
+ */
369
+ LOCATION = "LOCATION",
365
370
  /**
366
371
  * The price is resolved from pricing tiers based on the booking duration range.
367
372
  * @documentationMaturity preview
@@ -369,7 +374,7 @@ declare enum ServiceOptionType$1 {
369
374
  DURATION_RANGE = "DURATION_RANGE"
370
375
  }
371
376
  /** @enumType */
372
- type ServiceOptionTypeWithLiterals = ServiceOptionType$1 | 'UNKNOWN' | 'CUSTOM' | 'STAFF_MEMBER' | 'DURATION' | 'DATE_TIME' | 'NUMBER_OF_PARTICIPANTS' | 'DURATION_RANGE';
377
+ type ServiceOptionTypeWithLiterals = ServiceOptionType$1 | 'UNKNOWN' | 'CUSTOM' | 'STAFF_MEMBER' | 'DURATION' | 'DATE_TIME' | 'NUMBER_OF_PARTICIPANTS' | 'LOCATION' | 'DURATION_RANGE';
373
378
  interface CustomServiceOption {
374
379
  /**
375
380
  * Name of the service option. For example, `Age group`, `Location`, `Equipment`,
@@ -430,6 +435,14 @@ interface ServiceChoice$1 extends ServiceChoiceChoiceOneOf$1 {
430
435
  dateTime?: DateTimeRule$1;
431
436
  /** A rule resolving the price by the number of participants. Available only for `NUMBER_OF_PARTICIPANTS` options. */
432
437
  participantRange?: ParticipantsRange$1;
438
+ /**
439
+ * ID of the business location the price applies to.
440
+ *
441
+ * Limited to business locations. Custom and customer locations aren't supported.
442
+ * Available only for `LOCATION` options.
443
+ * @format GUID
444
+ */
445
+ businessLocationId?: string;
433
446
  /**
434
447
  * A duration range tier resolving the price by how long the booking is.
435
448
  * Available only for `DURATION_RANGE` options.
@@ -461,6 +474,14 @@ interface ServiceChoiceChoiceOneOf$1 {
461
474
  dateTime?: DateTimeRule$1;
462
475
  /** A rule resolving the price by the number of participants. Available only for `NUMBER_OF_PARTICIPANTS` options. */
463
476
  participantRange?: ParticipantsRange$1;
477
+ /**
478
+ * ID of the business location the price applies to.
479
+ *
480
+ * Limited to business locations. Custom and customer locations aren't supported.
481
+ * Available only for `LOCATION` options.
482
+ * @format GUID
483
+ */
484
+ businessLocationId?: string;
464
485
  /**
465
486
  * A duration range tier resolving the price by how long the booking is.
466
487
  * Available only for `DURATION_RANGE` options.
@@ -710,9 +731,9 @@ interface ExtendedFields$2 {
710
731
  namespaces?: Record<string, Record<string, any>>;
711
732
  }
712
733
  //#endregion
713
- //#region ../../node_modules/@wix/auto_sdk_bookings_services/build/es/bookings-services-v2-service-services.universal-Bf4TC5aj.d.mts
734
+ //#region ../../node_modules/@wix/auto_sdk_bookings_services/build/es/bookings-services-v2-service-services.universal-p5eQUd5f.d.mts
714
735
  /** The `service` object represents an offering that a business provides to its customers. */
715
- interface Service$1 {
736
+ interface Service {
716
737
  /**
717
738
  * Service ID.
718
739
  * @format GUID
@@ -1085,6 +1106,12 @@ interface FixedPayment {
1085
1106
  * Default: `false`.
1086
1107
  */
1087
1108
  fullUpfrontPaymentAllowed?: boolean | null;
1109
+ /**
1110
+ * The deposit required to book the service, expressed as either a fixed amount or a percentage of the price.
1111
+ *
1112
+ * Used only when `paymentOptions.deposit` is `true`.
1113
+ */
1114
+ depositDetails?: DepositDetails;
1088
1115
  }
1089
1116
  /**
1090
1117
  * Money.
@@ -1113,6 +1140,35 @@ interface Money {
1113
1140
  * A deposit expressed as exactly one of a fixed monetary amount or a percentage of the full service price.
1114
1141
  * Structurally exclusive: at most one of `amount` or `percentage` may be set.
1115
1142
  */
1143
+ interface DepositDetails extends DepositDetailsValueOneOf {
1144
+ /** The deposit as a fixed monetary amount. */
1145
+ amount?: Money;
1146
+ /**
1147
+ * The deposit as a percentage of the full service price, for example `20` for 20% or `20.5` for 20.5%.
1148
+ * Resolved to a concrete amount when the customer books.
1149
+ *
1150
+ * Min: `0.01` percent
1151
+ * Max: `99.99` percent
1152
+ * @format DECIMAL_VALUE
1153
+ * @decimalValue options { gte:0.01, lte:99.99, maxScale:2 }
1154
+ */
1155
+ percentage?: string | null;
1156
+ }
1157
+ /** @oneof */
1158
+ interface DepositDetailsValueOneOf {
1159
+ /** The deposit as a fixed monetary amount. */
1160
+ amount?: Money;
1161
+ /**
1162
+ * The deposit as a percentage of the full service price, for example `20` for 20% or `20.5` for 20.5%.
1163
+ * Resolved to a concrete amount when the customer books.
1164
+ *
1165
+ * Min: `0.01` percent
1166
+ * Max: `99.99` percent
1167
+ * @format DECIMAL_VALUE
1168
+ * @decimalValue options { gte:0.01, lte:99.99, maxScale:2 }
1169
+ */
1170
+ percentage?: string | null;
1171
+ }
1116
1172
  interface CustomPayment {
1117
1173
  /**
1118
1174
  * A custom description explaining to the customer how to pay for the service.
@@ -1147,6 +1203,12 @@ interface VariedPayment {
1147
1203
  * Default: `false`.
1148
1204
  */
1149
1205
  fullUpfrontPaymentAllowed?: boolean | null;
1206
+ /**
1207
+ * The deposit required to book the service, expressed as either a fixed amount or a percentage of the price.
1208
+ *
1209
+ * Used only when `paymentOptions.deposit` is `true`.
1210
+ */
1211
+ depositDetails?: DepositDetails;
1150
1212
  }
1151
1213
  interface SubscriptionPayment {
1152
1214
  /**
@@ -1756,6 +1818,7 @@ interface CancellationFeePolicy {
1756
1818
  */
1757
1819
  autoCollectFeeEnabled?: boolean | null;
1758
1820
  }
1821
+ /** What happens to the plan credit when the customer cancels a booking paid with a pricing plan. */
1759
1822
  interface CancellationWindow extends CancellationWindowFeeOneOf {
1760
1823
  /** Amount to be charged as a cancellation fee. */
1761
1824
  amount?: Money;
@@ -1964,12 +2027,7 @@ interface DailyConfig {
1964
2027
  */
1965
2028
  maxDurationInDays?: number;
1966
2029
  }
1967
- /**
1968
- * Controls how a service's own working hours combine with the working hours of its assigned
1969
- * staff members and required resources. The hours themselves are not held here. They are the
1970
- * `WORKING_HOURS` events on the service's schedule (`schedule.id`), and this message controls
1971
- * only how they combine with the resources working hours.
1972
- */
2030
+ /** Times of day at which each bookable day of a daily service starts and ends. */
1973
2031
  interface StaffMember {
1974
2032
  /**
1975
2033
  * ID of the [resource](https://dev.wix.com/docs/api-reference/business-solutions/bookings/resources/resources-v2/introduction) associated with the staff member providing the service.
@@ -1991,6 +2049,14 @@ interface StaffMember {
1991
2049
  * @readonly
1992
2050
  */
1993
2051
  mainMedia?: StaffMediaItem;
2052
+ /**
2053
+ * Business locations where the staff member is available, based on their working hours.
2054
+ * Returned only when both `STAFF_MEMBER_DETAILS` and `STAFF_WORKING_HOURS_LOCATIONS` are passed in `conditionalFields`.
2055
+ * Can be omitted for a staff member who has no working hours. Treat a missing value the same as `availableAtAllLocations` set to `false` with an empty `locationIds`.
2056
+ * When the working hours data can't be retrieved, the entire request fails.
2057
+ * @readonly
2058
+ */
2059
+ workingHoursLocationCoverage?: WorkingHoursLocationCoverage;
1994
2060
  }
1995
2061
  interface StaffMediaItem extends StaffMediaItemItemOneOf {
1996
2062
  /** Details of the image associated with the staff, such as URL and size. */
@@ -2002,24 +2068,29 @@ interface StaffMediaItemItemOneOf {
2002
2068
  image?: string;
2003
2069
  }
2004
2070
  /**
2005
- * Working hours location coverage derived from Calendar v3 WORKING_HOURS events
2006
- * (`NONE` and `MASTER` recurrence types). The server paginates through Calendar results
2007
- * (100 events per page) until all matching events are collected.
2071
+ * Business locations where a staff member is available, based on their current and upcoming working hours.
2008
2072
  *
2009
- * Coverage states when enrichment is requested:
2010
- * + `available_at_all_locations = true`: Staff applies to every business location. Set when the staff
2011
- * uses default business working hours, or has any WORKING_HOURS event without a location ID
2012
- * (including when mixed with location-specific events).
2013
- * + `available_at_all_locations = false` with non-empty `location_ids`: Staff has location-specific
2014
- * WORKING_HOURS only. Show the staff member only when the selected location is in `location_ids`.
2015
- * + `available_at_all_locations = false` with empty `location_ids`: Staff has working-hours schedules
2016
- * but no applicable location coverage was found.
2017
- *
2018
- * Recommended client filter:
2019
- * `availableAtAllLocations || locationIds.includes(selectedLocationId)`
2020
- *
2021
- * Omitted when `STAFF_WORKING_HOURS_LOCATIONS` is not requested.
2073
+ * Coverage has 3 possible states:
2074
+ * + `availableAtAllLocations` is `true`: The staff member is available at every business location. This is the case when the staff member uses the business's default working hours, or when at least one of their working hours isn't limited to a specific location.
2075
+ * + `availableAtAllLocations` is `false` and `locationIds` isn't empty: The staff member is available at the business locations listed in `locationIds`.
2076
+ * + `availableAtAllLocations` is `false` and `locationIds` is empty: The staff member has no current or upcoming working hours, so they aren't available at any business location.
2077
+ * To check whether a staff member is available at a specific location, use `availableAtAllLocations || locationIds.includes(locationId)`.
2022
2078
  */
2079
+ interface WorkingHoursLocationCoverage {
2080
+ /**
2081
+ * Whether the staff member is available at every business location.
2082
+ * @readonly
2083
+ */
2084
+ availableAtAllLocations?: boolean | null;
2085
+ /**
2086
+ * IDs of the business locations where the staff member has location-specific working hours.
2087
+ * Empty when `availableAtAllLocations` is `true`.
2088
+ * @format GUID
2089
+ * @readonly
2090
+ * @maxSize 100
2091
+ */
2092
+ locationIds?: string[];
2093
+ }
2023
2094
  interface StaffMemberDetails {
2024
2095
  /**
2025
2096
  * Staff members providing the service. For appointments only.
@@ -2119,73 +2190,117 @@ interface ExtendedFields$1 {
2119
2190
  namespaces?: Record<string, Record<string, any>>;
2120
2191
  }
2121
2192
  /**
2122
- * The SEO schema object contains data about different types of meta tags. It makes sure that the information about your page is presented properly to search engines.
2123
- * The search engines use this information for ranking purposes, or to display snippets in the search results.
2124
- * This data will override other sources of tags (for example patterns) and will be included in the <head> section of the HTML document, while not being displayed on the page itself.
2193
+ * The SEO data for a single page or dynamic item, in the shape stored today.
2194
+ *
2195
+ * FROZEN. Existing server code maps onto this message field by field, so its
2196
+ * field set must never change (see the file header). New writers use
2197
+ * `SeoSchemaV2`.
2198
+ *
2199
+ * These tags are rendered into the <head> of the HTML document and are not
2200
+ * visible on the page itself. They override every other source of tags
2201
+ * (site defaults, vertical presets, patterns) for this page.
2125
2202
  */
2126
2203
  interface SeoSchema {
2127
- /** SEO tag information. */
2204
+ /**
2205
+ * The tags rendered into <head>, in no particular order. Render order is
2206
+ * decided by the renderer, not by position in this list.
2207
+ *
2208
+ * No maxSize: this list is already populated by data written years ago, and
2209
+ * a bound added now could reject a page that is already stored.
2210
+ */
2128
2211
  tags?: Tag[];
2129
- /** SEO general settings. */
2212
+ /** Page-level SEO settings that are not themselves tags. */
2130
2213
  settings?: Settings;
2131
2214
  }
2215
+ /** A keyword term the user is targeting. */
2132
2216
  interface Keyword {
2133
- /** Keyword value. */
2217
+ /**
2218
+ * The term itself, e.g. "trail running shoes".
2219
+ *
2220
+ * No maxLength, for the same reason as the legacy tag fields: keywords are
2221
+ * already stored, and a bound added now could reject a record written
2222
+ * before the bound existed. The flynt `missing-string-validations` warning
2223
+ * on this field is accepted deliberately.
2224
+ */
2134
2225
  term?: string;
2135
- /** Whether the keyword is the main focus keyword. */
2226
+ /** Whether this is the page's primary focus keyword. At most one per page. */
2136
2227
  isMain?: boolean;
2137
2228
  /**
2138
- * The source that added the keyword terms to the SEO settings.
2229
+ * Which surface added the term, e.g. a panel or a suggestion flow. Used for
2230
+ * attribution in BI. Opaque to the renderer.
2139
2231
  * @maxLength 1000
2140
2232
  */
2141
2233
  origin?: string | null;
2142
2234
  }
2235
+ /**
2236
+ * One tag in the page's <head>.
2237
+ *
2238
+ * Not deprecated, and with no removal date, deliberately: stored data is
2239
+ * never migrated, so this shape stays valid input forever. `seo-renderer`
2240
+ * normalizes both shapes on READ.
2241
+ */
2143
2242
  interface Tag {
2144
2243
  /**
2145
- * SEO tag type.
2146
- *
2147
- *
2148
- * Supported values: `title`, `meta`, `script`, `link`.
2244
+ * Legacy. Was a free-form string: "title" | "meta" | "script" | "link".
2245
+ * The typed replacement is the `kind` oneof on `SeoSchemaV2.Tag`, which makes
2246
+ * the invalid combinations unrepresentable rather than merely discouraged.
2149
2247
  *
2150
- * Which of these an API actually accepts depends on where the tag is being set: this
2151
- * list is not a blanket guarantee across every API that reuses this message. Site SEO
2152
- * Tags in particular accepts only `meta` (see `SiteSeoTags.tags`) and rejects
2153
- * `title`/`script`/`link` with a validation error even though they appear here —
2154
- * check the field description of the specific `tags`-typed field you're writing to
2155
- * for the types it actually supports and the error it returns.
2248
+ * Which of these an API actually accepts depends on where the tag is being
2249
+ * set: this list is not a blanket guarantee across every API that reuses
2250
+ * this message. Site SEO Tags in particular accepts only `meta` (see
2251
+ * `SiteSeoTags.tags`) and rejects `title`/`script`/`link` with a validation
2252
+ * error even though they appear here — check the field description of the
2253
+ * specific `tags`-typed field you are writing to.
2156
2254
  *
2157
2255
  * Limitation: `title` and `script` (e.g. a `script` tag with `props.type`
2158
- * `"application/ld+json"` carrying structured data) are supported only when
2159
- * `custom` is unset or `false`. Setting `custom: true` on a `title` or `script`
2160
- * tag is rejected with `TAG_TYPE_NOT_ALLOWED`, because `custom: true` routes the
2161
- * write through the site's Advanced/Custom Tags list. To write structured data,
2162
- * omit `custom` (or set it to `false`).
2256
+ * "application/ld+json" carrying structured data) are supported only when
2257
+ * `custom` is unset or `false`. Setting `custom: true` on a `title` or
2258
+ * `script` tag is rejected with `TAG_TYPE_NOT_ALLOWED`, because
2259
+ * `custom: true` routes the write through the site's Advanced/Custom Tags
2260
+ * list. To write structured data, omit `custom` (or set it to `false`).
2261
+ *
2262
+ * No length limit: this field holds data written years ago by writers we
2263
+ * are not migrating. A constraint here could reject a record that is
2264
+ * already stored, which is exactly the promise this design makes.
2163
2265
  */
2164
2266
  type?: string;
2165
2267
  /**
2166
- * A `{"key": "value"}` pair object where each SEO tag property (`"name"`, `"content"`, `"rel"`, `"href"`) contains a value.
2167
- * For example: `{"name": "description", "content": "the description itself"}`.
2268
+ * Legacy. Was an untyped bag of HTML attributes.
2269
+ * Typed replacement: `SeoSchemaV2.TitleTag` / `MetaTag` / `LinkTag`.
2168
2270
  */
2169
2271
  props?: Record<string, any> | null;
2170
- /** SEO tag metadata. For example, `{"height": 300, "width": 240}`. */
2272
+ /**
2273
+ * Legacy. Was an untyped bag of 16 mixed-purpose keys. In `SeoSchemaV2`
2274
+ * its contents are split by purpose: per-page structured-data state moves to
2275
+ * StructuredDataTag, authorship to `written_by`, and render-time preset
2276
+ * logic (variants, enabledByExperiment, removeSchemaIf*) moved out of the
2277
+ * stored document entirely — it belongs to the preset definition, not to the
2278
+ * page. See the design log for the full key-by-key mapping.
2279
+ */
2171
2280
  meta?: Record<string, any> | null;
2172
- /** SEO tag inner content. For example, `<title> inner content </title>`. */
2281
+ /**
2282
+ * Legacy. Was the tag's inner content, doubling as the JSON-LD payload
2283
+ * for script tags. Typed replacement: `SeoSchemaV2.TitleTag.text` and
2284
+ * `StructuredDataTag.json_ld`.
2285
+ * No length limit, for the same reason as `type` above.
2286
+ */
2173
2287
  children?: string;
2174
2288
  /**
2175
2289
  * Whether the tag is a [custom tag](https://support.wix.com/en/article/adding-additional-meta-tags-to-your-sites-pages) —
2176
2290
  * i.e. an entry from the site's Advanced/Custom Tags list.
2177
2291
  *
2178
- * Setting this to `true` on a write restricts which `type` values are accepted
2179
- * — the same restriction the Advanced/Custom Tags UI enforces. `title` and
2180
- * `script` tags (including JSON-LD structured data) must be sent with `custom`
2181
- * omitted or `false`; sending them with `custom: true` is rejected with
2182
- * `TAG_TYPE_NOT_ALLOWED`.
2292
+ * Setting this to `true` on a write restricts which `type` values are
2293
+ * accepted — the same restriction the Advanced/Custom Tags UI enforces.
2294
+ * `title` and `script` tags (including JSON-LD structured data) must be sent
2295
+ * with `custom` omitted or `false`; sending them with `custom: true` is
2296
+ * rejected with `TAG_TYPE_NOT_ALLOWED`.
2183
2297
  *
2184
- * Note this is a separate restriction from Site SEO Tags' own type restriction on
2185
- * `SiteSeoTags.tags`: even with `custom` unset, Site SEO Tags rejects `script` (e.g.
2186
- * for site-wide structured data) unconditionally. There is currently no way to set
2187
- * site-wide, every-page structured data through any of these APIs — write a per-page
2188
- * `script` tag through the Item SEO Tags API instead.
2298
+ * Note this is a separate restriction from Site SEO Tags' own type
2299
+ * restriction on `SiteSeoTags.tags`: even with `custom` unset, Site SEO Tags
2300
+ * rejects `script` (e.g. for site-wide structured data) unconditionally.
2301
+ * There is currently no way to set site-wide, every-page structured data
2302
+ * through any of these APIs — write a per-page `script` tag through the Item
2303
+ * SEO Tags API instead.
2189
2304
  *
2190
2305
  * This flag is scoped to that feature only. It is NOT an indicator of whether a standard tag
2191
2306
  * (`title`, `description`, Open Graph, etc.) reflects a manually configured value versus a computed
@@ -2198,22 +2313,39 @@ interface Tag {
2198
2313
  * or Wix Studio pages, so even genuine Advanced/Custom Tags saved on those pages are missing from the
2199
2314
  * response entirely — there, `false` means this API could not tell, not that no custom tag exists.
2200
2315
  * Pass `seoData` explicitly to resolve against a known set of tags.
2316
+ *
2317
+ * `SeoSchemaV2.Tag` expresses this as `written_by = USER_CUSTOM`.
2201
2318
  */
2202
2319
  custom?: boolean;
2203
- /** Whether the tag is disabled. If the tag is disabled, people can't find your page when searching for this phrase in search engines. */
2320
+ /**
2321
+ * Whether the tag is excluded from the rendered <head>.
2322
+ *
2323
+ * A disabled tag is still stored, so the user can re-enable it and so a
2324
+ * pattern-provided tag stays suppressed on this page. Default false.
2325
+ */
2204
2326
  disabled?: boolean;
2205
2327
  }
2328
+ /** Page-level SEO settings that are not tags. */
2206
2329
  interface Settings {
2207
2330
  /**
2208
- * Whether the [automatical redirect visits](https://support.wix.com/en/article/customizing-your-pages-seo-settings-in-the-seo-panel) from the old URL to the new one is enabled.
2331
+ * Whether to suppress the automatic redirect from this page's previous URL to
2332
+ * its current one after a slug change.
2209
2333
  *
2210
- *
2211
- * Default: `false` (automatical redirect is enabled).
2334
+ * Default false, meaning the redirect IS created. The field is named for the
2335
+ * exception rather than the rule, which reads backwards; kept as-is because
2336
+ * renaming a stored boolean is not worth the migration.
2212
2337
  */
2213
2338
  preventAutoRedirect?: boolean;
2214
2339
  /**
2215
- * User-selected keyword terms for a specific page.
2216
- * @maxSize 5
2340
+ * Keyword terms the user is targeting for this page. Used by the SEO
2341
+ * assistant and checklist; never rendered into <head>.
2342
+ *
2343
+ * 20 is a sanity bound, not the product limit. v1 declared 5 — the number
2344
+ * the panel happens to allow today — which is exactly the mistake we are
2345
+ * fixing for structured data. A product decision to allow 8 should not need
2346
+ * a proto release, so the panel owns that number and the proto only stops
2347
+ * something absurd.
2348
+ * @maxSize 20
2217
2349
  */
2218
2350
  keywords?: Keyword[];
2219
2351
  }
@@ -2554,7 +2686,6 @@ declare enum BasedOn {
2554
2686
  type BasedOnWithLiterals = BasedOn | 'BUSINESS_TIME_ZONE' | 'CUSTOMER_TIME_ZONE';
2555
2687
  //#endregion
2556
2688
  //#region src/api/adapters/service/service.d.ts
2557
- type Service = Service$1;
2558
2689
  //#endregion
2559
2690
  //#region src/domains/states/service-cta-states.d.ts
2560
2691
  declare const SERVICE_CTA_STATES: {
@@ -2597,7 +2728,7 @@ type AddOn = {
2597
2728
  type ServicePreference = {
2598
2729
  serviceId: NonNullable<V2Slot['serviceId']>;
2599
2730
  slug?: NonNullable<Slug['name']>;
2600
- serviceType?: Service$1['type']; /** ISO local datetimes — per service (services in a bundle can start at different times). */
2731
+ serviceType?: Service['type']; /** ISO local datetimes — per service (services in a bundle can start at different times). */
2601
2732
  slotStart?: V2Slot['startDate'];
2602
2733
  slotEnd?: V2Slot['endDate'];
2603
2734
  eventId?: V2Slot['eventId'];
@@ -2625,10 +2756,20 @@ interface BookingPreferences {
2625
2756
  }
2626
2757
  //#endregion
2627
2758
  //#region src/domains/url-builder/service-selection-url.d.ts
2628
- type CourseNavigationTarget = 'servicePage' | 'bookingForm';
2629
- type ClassAppointmentNavigationTarget = 'servicePage' | 'bookingCalendar' | 'bookingForm';
2759
+ /** Page a course's booking button goes to. */
2760
+ type CourseNavigationTarget = /** The service page. */'servicePage' /** The booking form, to book the whole course. */ | 'bookingForm';
2761
+ /** Page a class's or an appointment's booking button goes to. */
2762
+ type ClassAppointmentNavigationTarget = /** The service page. */'servicePage' /** The booking calendar, to choose a time slot. */ | 'bookingCalendar'
2763
+ /**
2764
+ * The booking form, to book the selected time slot. Use it where the visitor already selected a
2765
+ * slot, such as on the booking calendar. Without a selected slot, there's no navigation.
2766
+ */
2767
+ | 'bookingForm';
2768
+ /** Pages to go to next, for each service type. */
2630
2769
  interface ServiceSelectionNavigationConfig {
2770
+ /** Page to go to for a course. */
2631
2771
  courseNavigationTarget: CourseNavigationTarget;
2772
+ /** Page to go to for a class or an appointment. */
2632
2773
  classAppointmentNavigationTarget: ClassAppointmentNavigationTarget;
2633
2774
  }
2634
2775
  //#endregion
@@ -2652,16 +2793,20 @@ declare const BI_REFERRAL_INFO: {
2652
2793
  type BiReferralInfo = (typeof BI_REFERRAL_INFO)[keyof typeof BI_REFERRAL_INFO];
2653
2794
  //#endregion
2654
2795
  //#region src/hooks/use-bi-logger/use-bi-logger.d.ts
2796
+ /** Analytics event to report. */
2655
2797
  interface BiEvent {
2798
+ /** ID of the event's source. */
2656
2799
  src: number;
2800
+ /** Event ID. */
2657
2801
  evid: number;
2802
+ /** Endpoint that the event is sent to. */
2658
2803
  endpoint: string;
2804
+ /** Event's fields, by field name. */
2659
2805
  params: Record<string, unknown>;
2660
2806
  }
2661
2807
  declare const useBiLogger: (widgetName: BiWidgetName) => (event: BiEvent) => void;
2662
2808
  //#endregion
2663
2809
  //#region src/api/adapters/service-options-and-variants/service-options-and-variants.d.ts
2664
- type ServiceOptionsAndVariants = ServiceOptionsAndVariants$1;
2665
2810
  //#endregion
2666
2811
  //#region ../../node_modules/@wix/auto_sdk_calendar_events/build/es/index.typings.d.mts
2667
2812
  /**
@@ -3330,53 +3475,157 @@ interface ExtendedFields {
3330
3475
  }
3331
3476
  //#endregion
3332
3477
  //#region src/domains/offered-days/offered-days.d.ts
3478
+ /** Day of the week that a service's sessions recur on. */
3333
3479
  interface OfferedDay {
3480
+ /** Day of the week, in uppercase English. For example, `MONDAY`. */
3334
3481
  day: string;
3335
3482
  }
3336
3483
  //#endregion
3337
3484
  //#region src/domains/pricing-options/pricing-options.d.ts
3338
- /**
3339
- * `LOCATION` (variable price per business location) is `@internal` in the SDK's public typings
3340
- * but comes over the wire, so it is spelled out beside the generated literals.
3341
- */
3342
- type ServiceOptionType = ServiceOptionTypeWithLiterals | 'LOCATION';
3485
+ type ServiceOptionType = ServiceOptionTypeWithLiterals;
3343
3486
  interface PricingOptionChoice {
3487
+ /**
3488
+ * Key of the choice, to pass to `setVariant()` or `setVariantCounts()`. The key is:
3489
+ * - For a staff member option: the staff member's ID.
3490
+ * - For other options: the choice's ID.
3491
+ * - For an older custom choice with no ID: its value.
3492
+ *
3493
+ * `null` when the choice has none of these.
3494
+ */
3344
3495
  choiceId: string | null;
3496
+ /**
3497
+ * Choice's name to show. It's the custom value, the staff member's name, the business location's
3498
+ * name, or the duration's name or formatted length.
3499
+ *
3500
+ * `null` when there's none.
3501
+ */
3345
3502
  label: string | null;
3346
- /** Localized, e.g. "€110". */
3503
+ /**
3504
+ * Choice's price, formatted for the site's locale. For example, `€110`.
3505
+ *
3506
+ * `null` when the choice has no price.
3507
+ */
3347
3508
  price: string | null;
3348
- /** Raw amount from the SDK, for totals math; convert at the use site. */
3509
+ /**
3510
+ * Choice's price, as a number in a string, for calculations.
3511
+ *
3512
+ * `null` when the choice has no price.
3513
+ */
3349
3514
  priceAmount?: string | null;
3515
+ /**
3516
+ * Duration of the choice in minutes, for a duration option.
3517
+ *
3518
+ * `null` for other options.
3519
+ */
3350
3520
  durationMinutes?: number | null;
3351
- /** `label` falls back to a formatted duration, losing whether a name was set. */
3521
+ /**
3522
+ * Name the business gave the duration, for a duration option. `label` shows the formatted
3523
+ * duration when there's no name.
3524
+ *
3525
+ * `null` when the duration has no name, and for other options.
3526
+ */
3352
3527
  durationName?: string | null;
3353
- /** `LOCATION` options only: the business location this choice prices. */
3528
+ /**
3529
+ * ID of the business location the choice prices, when the price depends on the location.
3530
+ *
3531
+ * `null` for other choices.
3532
+ */
3354
3533
  businessLocationId?: string | null;
3355
3534
  }
3356
3535
  interface PricingOption {
3536
+ /**
3537
+ * ID of the service's option.
3538
+ *
3539
+ * `null` when the option has no ID.
3540
+ */
3357
3541
  optionId: string | null;
3542
+ /**
3543
+ * Type of option, which decides what the choices are. For more about options, see the
3544
+ * [Service Options and Variants
3545
+ * API](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/service-options-and-variants/introduction).
3546
+ * Supported values:
3547
+ * - `'UNKNOWN'`: There's no information about the option type.
3548
+ * - `'CUSTOM'`: Choices the business defined, such as an age group.
3549
+ * - `'STAFF_MEMBER'`: 1 choice for each staff member.
3550
+ * - `'DURATION'`: 1 choice for each duration.
3551
+ * - `'DATE_TIME'`: The price depends on when the service is booked, so the visitor doesn't
3552
+ * choose.
3553
+ * - `'NUMBER_OF_PARTICIPANTS'`: The price depends on the number of participants.
3554
+ * - `'DURATION_RANGE'`: The price depends on the booking's duration range.
3555
+ *
3556
+ * `null` when the option has no type.
3557
+ */
3358
3558
  type: ServiceOptionType | null;
3359
- /** `STAFF_MEMBER` options have none; `null` means the caller supplies a generic heading. */
3559
+ /**
3560
+ * Option's name, for a custom option or a duration option.
3561
+ *
3562
+ * `null` when the option has no name, such as a staff member option. Show your own heading then.
3563
+ */
3360
3564
  name: string | null;
3565
+ /** Choices that the visitor selects from, one for each of the service's variants. */
3361
3566
  choices: PricingOptionChoice[];
3362
3567
  }
3363
3568
  //#endregion
3364
3569
  //#region src/domains/service-price/format-service-price.d.ts
3570
+ /** Service's price details. Amounts are formatted for the site's locale. */
3365
3571
  interface ServicePriceData {
3572
+ /**
3573
+ * Service's rate type. Supported values:
3574
+ * - `'FIXED'`: 1 price.
3575
+ * - `'VARIED'`: The price depends on the visitor's choices.
3576
+ * - `'CUSTOM'`: A description of the price instead of an amount.
3577
+ * - `'NO_FEE'`: No charge.
3578
+ * - `'SUBSCRIPTION'`: A recurring payment.
3579
+ *
3580
+ * `null` when the service has no payment details.
3581
+ */
3366
3582
  rateType: RateTypeWithLiterals | null;
3583
+ /**
3584
+ * Service's price, by `rateType`:
3585
+ * - `'FIXED'`: The price.
3586
+ * - `'VARIED'`: The lowest price.
3587
+ * - `'CUSTOM'`: The business's description of the price.
3588
+ * - `'SUBSCRIPTION'`: The amount for each billing cycle.
3589
+ *
3590
+ * `null` for other rate types, or when the service has no payment details.
3591
+ */
3367
3592
  price: string | null;
3593
+ /**
3594
+ * Price after the service's discount.
3595
+ *
3596
+ * `null` when there's no discount, `rateType` isn't `'FIXED'`, or the discounted price isn't
3597
+ * known until checkout.
3598
+ */
3368
3599
  priceAfterDiscount: string | null;
3600
+ /**
3601
+ * Name of the service's discount.
3602
+ *
3603
+ * `null` when there's no discount.
3604
+ */
3369
3605
  discountName: string | null;
3606
+ /**
3607
+ * Whether the service has a discount whose price isn't known until checkout. `true` when
3608
+ * `discountName` is set and `priceAfterDiscount` is `null`.
3609
+ */
3370
3610
  calculatedAtCheckout: boolean;
3611
+ /**
3612
+ * Billing frequency of the subscription, such as `'MONTHLY'`.
3613
+ *
3614
+ * `null` when the service has no subscription.
3615
+ */
3371
3616
  subscriptionFrequency: FrequencyTypeWithLiterals | null;
3617
+ /**
3618
+ * Whether the service is free. A service is free when its rate type is `'NO_FEE'` or it has a
3619
+ * fixed price of 0, and it isn't paid for with a pricing plan.
3620
+ */
3372
3621
  isFree: boolean;
3373
3622
  }
3374
3623
  //#endregion
3375
3624
  //#region src/domains/service-locations/service-locations.d.ts
3376
3625
  /** Where a service takes place. */
3377
3626
  interface ServiceLocationItem {
3378
- /** `business`: one of the business locations. `custom`: an address. `customer`: the customer's place. */
3379
- type: 'business' | 'custom' | 'customer';
3627
+ /** Kind of location. */
3628
+ type: /** One of the business's locations. */'business' /** An address that the business entered for the service. */ | 'custom' /** The customer's place. `text` is `null`, so label it in your own words. */ | 'customer';
3380
3629
  /** The business location's name or the address. Null for the customer's place: label it in your own words. */
3381
3630
  text: string | null;
3382
3631
  }
@@ -3391,9 +3640,34 @@ declare const AVAILABILITY_STATES: {
3391
3640
  readonly NO_UPCOMING_SESSIONS: "noUpcomingSessions";
3392
3641
  };
3393
3642
  type AvailabilityState = (typeof AVAILABILITY_STATES)[keyof typeof AVAILABILITY_STATES];
3643
+ /** Whether visitors can book a service online now, and which availability message applies. */
3394
3644
  interface ServiceBookability {
3645
+ /**
3646
+ * Availability message that applies to the service. Supported values:
3647
+ * - `'available'`: No message. The service can be booked, or online booking is turned off.
3648
+ * - `'fullyBooked'`: The course has no spots left.
3649
+ * - `'bookingNotOpenYet'`: Booking for the course hasn't opened yet. See `bookingOpensAt`.
3650
+ * - `'bookingClosed'`: It's too late to book the course.
3651
+ * - `'courseInProgress'`: The course has started, and it can still be booked.
3652
+ * - `'noUpcomingSessions'`: The class or course has no sessions left.
3653
+ *
3654
+ * To decide whether the service can be booked, use `isAvailableForBooking`.
3655
+ */
3395
3656
  state: AvailabilityState;
3657
+ /**
3658
+ * Whether visitors can book the service online now. A service can be booked when online booking
3659
+ * is turned on for it, and:
3660
+ * - An appointment: always.
3661
+ * - A class: it has a session that hasn't ended.
3662
+ * - A course: it has spots left, its sessions haven't ended, and booking is open.
3663
+ */
3396
3664
  isAvailableForBooking: boolean;
3665
+ /**
3666
+ * When booking a course opens. It's the start of the course's first session, minus how early the
3667
+ * course can be booked. With no such limit, it's the start of the first session.
3668
+ *
3669
+ * `null` when the service isn't a course, or the course has no sessions.
3670
+ */
3397
3671
  bookingOpensAt: Date | null;
3398
3672
  }
3399
3673
  //#endregion
@@ -3401,8 +3675,7 @@ interface ServiceBookability {
3401
3675
  /**
3402
3676
  * Where a staff member has working hours, derived server-side from their WORKING_HOURS
3403
3677
  * calendar events. Returned only when `STAFF_WORKING_HOURS_LOCATIONS` is requested (see
3404
- * `SERVICE_CONDITIONAL_FIELDS`); the public `@wix/bookings` typings don't declare it yet, so
3405
- * it's read through this narrow shape.
3678
+ * `SERVICE_CONDITIONAL_FIELDS`).
3406
3679
  */
3407
3680
  interface StaffLocationCoverage {
3408
3681
  availableAtAllLocations: boolean;
@@ -3418,8 +3691,19 @@ interface StaffMemberItem {
3418
3691
  }
3419
3692
  //#endregion
3420
3693
  //#region src/domains/course-availability/course-availability.d.ts
3694
+ /** Capacity of a course. */
3421
3695
  interface CourseAvailability {
3696
+ /**
3697
+ * Maximum number of participants in the course.
3698
+ *
3699
+ * `null` when it isn't known.
3700
+ */
3422
3701
  totalCapacity: number | null;
3702
+ /**
3703
+ * Number of spots left in the course. 0 or less when the course is full.
3704
+ *
3705
+ * `null` when it isn't known.
3706
+ */
3423
3707
  remainingCapacity: number | null;
3424
3708
  }
3425
3709
  //#endregion
@@ -3442,17 +3726,31 @@ type SetAddOnQuantity = (addOnId: string, quantity: number) => void;
3442
3726
  /** Staff picked with the slot stays in `resources`. */
3443
3727
  type SlotSelection = Pick<ServicePreference, 'slotStart' | 'slotEnd' | 'eventId' | 'scheduleId' | 'sessionId' | 'locationId' | 'locationType'>;
3444
3728
  interface SlotPickDetails {
3445
- /** `null` = explicit "any available" (slot lists several); omitted keeps the current staff. */
3729
+ /**
3730
+ * ID of the time slot's staff member. `null` for any available staff member, when the time slot
3731
+ * has several.
3732
+ *
3733
+ * Leave it out to keep the current staff choice.
3734
+ */
3446
3735
  staffId?: string | null;
3447
- /** Zone of the slot's local times; written as the blob's `timezone`. */
3736
+ /**
3737
+ * [IANA time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) of the time
3738
+ * slot's local date-times. The booking preferences keep it.
3739
+ */
3448
3740
  timezone?: string;
3449
- /** `false` for a waitlist slot, which reports no slot selection (34) on Book. */
3741
+ /**
3742
+ * Whether the slot can be booked directly. `false` for a waitlist slot, which reports no slot
3743
+ * selection analytics event when it's booked.
3744
+ */
3450
3745
  bookable?: boolean;
3451
- /** The slot's staff can't be left to the server, so a named staff member must be chosen. */
3746
+ /**
3747
+ * Whether the visitor must choose a specific staff member for the time slot, rather than any
3748
+ * available staff member.
3749
+ */
3452
3750
  staffChoiceRequired?: boolean;
3453
3751
  /**
3454
- * The slot's first staff member, whom a reschedule books without a named pick unless the
3455
- * visitor may choose "any" (OOI rescheduleBooking).
3752
+ * ID of the slot's first staff member. A reschedule books this staff member when none is
3753
+ * selected, unless the visitor can choose any available staff member.
3456
3754
  */
3457
3755
  rescheduleStaffId?: string;
3458
3756
  }
@@ -3462,7 +3760,22 @@ type SetSlot = (slot: SlotSelection, details?: SlotPickDetails) => void;
3462
3760
  * entry and the live timezone. `staffId` (null = "any") leaves the selection.
3463
3761
  */
3464
3762
  type WithSelectionParam = (path: string, opts?: {
3763
+ /**
3764
+ * Whether to carry only this service's selection, for a page that books the service, such as
3765
+ * the booking form.
3766
+ *
3767
+ * When it's `false`, the selection is merged into the page's current booking preferences, and
3768
+ * other services' selections stay.
3769
+ *
3770
+ * Default: `false`
3771
+ */
3465
3772
  handoff?: boolean;
3773
+ /**
3774
+ * ID of a staff member to put in the booking preferences instead of the selected one. The
3775
+ * selection itself doesn't change.
3776
+ *
3777
+ * `null` sets any available staff member in the booking preferences.
3778
+ */
3466
3779
  staffId?: string | null;
3467
3780
  }) => string;
3468
3781
  /** Location and staff go back to the choices made before the calendar. */
@@ -3480,29 +3793,86 @@ type ClearMultiServiceSlot = () => void;
3480
3793
  //#region src/api/adapters/bookings-settings/bookings-settings.d.ts
3481
3794
  /** A policy, not an IANA zone: the real zone needs the business zone from site properties. */
3482
3795
  type DisplayTimeZonePolicy = {
3796
+ /**
3797
+ * Time zone the site shows times in by default.
3798
+ *
3799
+ * Supported values:
3800
+ * - `'BUSINESS_TIME_ZONE'`: The business's time zone.
3801
+ * - `'CUSTOMER_TIME_ZONE'`: The time zone of the visitor's browser.
3802
+ */
3483
3803
  basedOn: BasedOnWithLiterals;
3804
+ /**
3805
+ * Whether visitors can switch between the business's time zone and their own when they view
3806
+ * times.
3807
+ */
3484
3808
  customerCanChange: boolean;
3485
3809
  };
3810
+ /**
3811
+ * The business's booking settings that affect how the site shows services and times.
3812
+ *
3813
+ * When loading the settings fails, holds the defaults: times in the business's time zone, which
3814
+ * visitors can't change, and multi-service appointments turned off.
3815
+ */
3486
3816
  interface ExposedBookingsSettings {
3817
+ /** Policy for the time zone the site shows times in. */
3487
3818
  displayTimeZonePolicy: DisplayTimeZonePolicy;
3819
+ /** Whether visitors can book more than 1 service in a single appointment. */
3488
3820
  multiServiceAppointmentsEnabled: boolean;
3489
3821
  }
3490
3822
  //#endregion
3491
3823
  //#region src/extensions/contexts/services-context/services-context.d.ts
3492
3824
  /** Raw data only; the nested service-context derives display values. Not for direct binding. */
3493
3825
  interface ServiceItem {
3826
+ /**
3827
+ * Service ID.
3828
+ *
3829
+ * `null` for the sample services shown in the editor.
3830
+ */
3494
3831
  serviceId: string | null;
3832
+ /**
3833
+ * Number that increases each time the services reload because a service changed while the site
3834
+ * is open in the editor.
3835
+ *
3836
+ * Always `0` on the live site.
3837
+ */
3495
3838
  refreshSignal: number;
3839
+ /**
3840
+ * The service, as the
3841
+ * [Services
3842
+ * API](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction)
3843
+ * returns it.
3844
+ */
3496
3845
  service: Service;
3846
+ /**
3847
+ * Calendar events that define the sessions of a class or course, from today on: the events that
3848
+ * repeat on a schedule, and the sessions added one at a time. To get an event's details, use the
3849
+ * [Events
3850
+ * API](https://dev.wix.com/docs/api-reference/business-management/calendar/events-v3/introduction).
3851
+ *
3852
+ * Times are in the time zone that `bookingsSettings.displayTimeZonePolicy` sets.
3853
+ *
3854
+ * The events load after the service shows, so the array is empty until they arrive. Always empty
3855
+ * for an appointment or a service with no schedule, and when loading the events fails.
3856
+ */
3497
3857
  masterEvents: Event[];
3498
- /** Null when not VARIED, not loaded yet, or failed (a failed refetch keeps the last value). */
3858
+ /**
3859
+ * Service's options and variants, which set the prices of its choices, as the [Service Options
3860
+ * and Variants
3861
+ * API](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/service-options-and-variants/introduction)
3862
+ * returns them.
3863
+ *
3864
+ * `null` for a service without varied pricing, while they load, and when they fail to load. When
3865
+ * reloading them fails, it keeps the ones that loaded before.
3866
+ */
3499
3867
  serviceOptionsAndVariants: ServiceOptionsAndVariants | null;
3868
+ /** The business's booking settings. The same object as the context's `bookingsSettings`. */
3500
3869
  bookingsSettings: ExposedBookingsSettings;
3501
3870
  /**
3502
- * The service page, resolved like every in-app link to it (custom URL structure first). Read by
3503
- * the gallery converter (data-conversions), which has no site services to resolve it itself.
3504
- * Runtime-only: not declared in the manifest, so it is not a bindable field (the full item rides
3505
- * through regardless). Null when the page can't be resolved (no slug, no service page section).
3871
+ * Link to the service's page. Its `target` is `'_self'`, and its `href` follows the site's custom
3872
+ * URL structure for service pages, when the site has one.
3873
+ *
3874
+ * `null` when there's no link to build, such as when the site has no service page or the service
3875
+ * has no slug.
3506
3876
  */
3507
3877
  servicePageLink: Link | null;
3508
3878
  }
@@ -3510,173 +3880,1199 @@ interface ServiceItem {
3510
3880
  //#region src/domains/reschedule/reschedule.d.ts
3511
3881
  /** The booking being moved, as the calendar needs it. */
3512
3882
  interface RescheduledBooking {
3883
+ /** Booking ID. */
3513
3884
  bookingId: string;
3885
+ /**
3886
+ * Booking's revision, which moving the booking requires.
3887
+ *
3888
+ * `null` when the booking has none.
3889
+ */
3514
3890
  revision: string | null;
3891
+ /**
3892
+ * ID of the booked service.
3893
+ *
3894
+ * `null` when the booking doesn't name one.
3895
+ */
3515
3896
  serviceId: string | null;
3516
- kind: 'appointment' | 'class' | 'other';
3517
- /** When the booking starts now (before the move), as an ISO instant. */
3897
+ /** Kind of booking. */
3898
+ kind: /** An appointment. */'appointment' /** A class session. */ | 'class' /** Any other kind of booking. `rescheduleBooking()` can't move it to another time slot. */ | 'other';
3899
+ /**
3900
+ * Start date and time of the booking before it's moved, in ISO 8601 format in UTC.
3901
+ *
3902
+ * `null` when the booking has no valid start date.
3903
+ */
3518
3904
  startDate: string | null;
3905
+ /** Number of participants in the booking. */
3519
3906
  participants: number;
3907
+ /** IDs of the add-ons booked with the booking. Empty when there are none. */
3520
3908
  addOnIds: string[];
3909
+ /**
3910
+ * ID of the booking's location.
3911
+ *
3912
+ * `null` when the booking's location has no ID.
3913
+ */
3521
3914
  locationId: string | null;
3522
- /** A customer's own address, which the new slot keeps (OOI copyClientsLocation). */
3915
+ /**
3916
+ * Custom address of the booking's location, which the moved booking keeps. An empty string when
3917
+ * the custom address has no text.
3918
+ *
3919
+ * `null` when the booking's location isn't a custom address, and when the visitor opened the
3920
+ * reschedule from a link with a token instead of as a logged-in member.
3921
+ */
3523
3922
  customAddress: string | null;
3524
3923
  }
3525
3924
  /**
3526
3925
  * `loading` until the booking is read. The rest but `ready` block the calendar: nothing is
3527
3926
  * listed or booked, and time-slots-context reports why.
3528
3927
  */
3529
- type RescheduleStatus = 'loading' | 'ready' | 'loginRequired' | 'notFound' | 'accessDenied' | 'failed' | 'wrongService' | 'notReschedulable';
3928
+ type RescheduleStatus = /** The booking is loading, or the visitor is asked to log in first. */'loading' /** The booking loaded, and it can move to a time slot of this service. */ | 'ready' /** The visitor didn't log in, so their booking can't be read. */ | 'loginRequired' /** The booking wasn't found. */ | 'notFound' /** The visitor isn't allowed to read the booking. */ | 'accessDenied' /** The booking couldn't be read. */ | 'failed' /** The booking is for a different service than the context's. */ | 'wrongService' /** The booking isn't an appointment or a class, so `rescheduleBooking()` can't move it. */ | 'notReschedulable';
3530
3929
  interface Reschedule {
3930
+ /** Status of the reschedule. */
3531
3931
  status: RescheduleStatus;
3932
+ /**
3933
+ * Booking to reschedule.
3934
+ *
3935
+ * `null` while it loads, or when it can't be read.
3936
+ */
3532
3937
  booking: RescheduledBooking | null;
3533
- /** The plan the booking was paid with expires then (an instant); null without one. */
3938
+ /**
3939
+ * Date and time that the plan the booking was paid with expires, in ISO 8601 format in UTC. The
3940
+ * booking can't move to a time slot that starts after it.
3941
+ *
3942
+ * `null` when the booking wasn't paid with a plan, the plan doesn't expire, or the expiration
3943
+ * couldn't be read.
3944
+ */
3534
3945
  validUntil: string | null;
3535
3946
  }
3536
3947
  //#endregion
3537
3948
  //#region src/api/adapters/booking/reschedule-booking.d.ts
3538
3949
  /** Who and where the moved booking is with, as the server assigned them. */
3539
3950
  interface RescheduledSlot {
3951
+ /**
3952
+ * Name of the staff member that the moved booking is with.
3953
+ *
3954
+ * `null` when there's none.
3955
+ */
3540
3956
  staffName: string | null;
3957
+ /**
3958
+ * Name or address of the moved booking's location.
3959
+ *
3960
+ * `null` when there's none.
3961
+ */
3541
3962
  locationName: string | null;
3542
3963
  }
3543
3964
  //#endregion
3544
3965
  //#region src/extensions/contexts/service-context/service-context.d.ts
3545
3966
  /** A bookable service with its display values, the visitor's booking selection and the actions to change it, plus multi-service appointment and reschedule state. */
3546
3967
  interface ServiceContextValue {
3968
+ /**
3969
+ * Service's full data, as the [Services V2
3970
+ * API](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction)
3971
+ * returns it.
3972
+ *
3973
+ * `null` when there's no service to show. That's the case:
3974
+ * - While the service loads.
3975
+ * - When the service fails to load.
3976
+ * - When nothing names a service.
3977
+ * - For a multi-service appointment.
3978
+ */
3547
3979
  service: Service | null;
3980
+ /**
3981
+ * Service's name.
3982
+ *
3983
+ * `null` when there's no service to show.
3984
+ */
3548
3985
  serviceName: string | null;
3986
+ /**
3987
+ * Service's description.
3988
+ *
3989
+ * `null` when the service has none, or there's no service to show.
3990
+ */
3549
3991
  serviceDescription: string | null;
3992
+ /**
3993
+ * Service's tagline, a short description.
3994
+ *
3995
+ * `null` when the service has none, or there's no service to show.
3996
+ */
3550
3997
  serviceTagLine: string | null;
3998
+ /**
3999
+ * Service's default duration, formatted for `locale` with short units. For example, `1 hr 30
4000
+ * min`.
4001
+ *
4002
+ * `null` when the service has no default duration, or there's no service to show.
4003
+ */
3551
4004
  serviceDefaultDuration: string | null;
4005
+ /**
4006
+ * Service's main image, as an `Image` from `@wix/editor-react-types`. A placeholder image when
4007
+ * the service has none.
4008
+ *
4009
+ * `null` when there's no service to show.
4010
+ */
3552
4011
  serviceImage: Image | null;
4012
+ /**
4013
+ * Slug of the service, the part of its service page URL that names it.
4014
+ *
4015
+ * `null` when there's no service to show.
4016
+ */
3553
4017
  serviceSlug: string | null;
4018
+ /**
4019
+ * Link to the service's page. Its `target` is `'_self'`, and its `href` follows the site's custom
4020
+ * URL structure for service pages, when the site has one.
4021
+ *
4022
+ * `null` when the site has no service page, or there's no service to show.
4023
+ */
3554
4024
  servicePageLink: Link | null;
4025
+ /**
4026
+ * Service ID.
4027
+ *
4028
+ * `null` when there's no service to show.
4029
+ */
3555
4030
  serviceId: string | null;
4031
+ /**
4032
+ * Service type. Supported values: `'APPOINTMENT'`, `'CLASS'`, and `'COURSE'`.
4033
+ *
4034
+ * `null` when there's no service to show.
4035
+ */
3556
4036
  serviceType: string | null;
4037
+ /** Service's price. */
3557
4038
  servicePrice: ServicePriceData;
4039
+ /** Whether the service has varied pricing, where the price depends on the visitor's choices, such as a duration or a staff member. */
3558
4040
  isVariedService: boolean;
3559
- /** Null when not VARIED, not loaded yet, or failed (a failed refetch keeps the last value). */
4041
+ /**
4042
+ * Service's options and variants, which set the prices of its choices, as the [Service Options
4043
+ * and Variants
4044
+ * API](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/service-options-and-variants/introduction)
4045
+ * returns them.
4046
+ *
4047
+ * `null` for a service without varied pricing, while they load, and when they fail to load. When
4048
+ * reloading them fails, it keeps the ones that loaded before.
4049
+ */
3560
4050
  serviceOptionsAndVariants: ServiceOptionsAndVariants | null;
3561
- /** `serviceOptionsAndVariants` as the modal's pricing option; null as above. */
4051
+ /**
4052
+ * Service's variants as 1 option with its choices, ready to show the visitor.
4053
+ *
4054
+ * `null` when `serviceOptionsAndVariants` is `null` or has no option.
4055
+ */
3562
4056
  pricingOption: PricingOption | null;
3563
- /** Includes empty and failed variant responses. */
4057
+ /**
4058
+ * Whether the service's options and variants are loading.
4059
+ *
4060
+ * `false` for a service without varied pricing, and once they load or fail to load.
4061
+ */
3564
4062
  isLoadingServiceOptionsAndVariants: boolean;
4063
+ /** Whether the service has add-ons that the visitor can book with it. */
3565
4064
  hasAddOns: boolean;
4065
+ /** Whether video conferencing is turned on for the service. */
3566
4066
  isConferenceEnabled: boolean;
4067
+ /**
4068
+ * Days of the week that the service's sessions recur on. A day appears once for each recurring
4069
+ * session on it.
4070
+ *
4071
+ * Empty for an appointment, for a service with no recurring sessions, and while the sessions
4072
+ * load.
4073
+ */
3567
4074
  offeredDays: OfferedDay[];
4075
+ /**
4076
+ * Capacity of a course.
4077
+ *
4078
+ * `null` when the service isn't a course, the course has ended, or its capacity isn't known.
4079
+ */
3568
4080
  courseAvailability: CourseAvailability | null;
4081
+ /**
4082
+ * Date of the service's first session, as `YYYY-MM-DD` in `displayTimeZone`. Set for any service
4083
+ * whose schedule has a first session, not only a course.
4084
+ *
4085
+ * `null` when the schedule has no first session, or there's no service to show.
4086
+ */
3569
4087
  courseStartDate: string | null;
4088
+ /**
4089
+ * Date of the service's last session, as `YYYY-MM-DD` in `displayTimeZone`. Set for any service
4090
+ * whose schedule has a last session, not only a course.
4091
+ *
4092
+ * `null` when the schedule has no last session, or there's no service to show.
4093
+ */
3570
4094
  courseEndDate: string | null;
4095
+ /**
4096
+ * Staff members who provide the service. Each item has:
4097
+ * - `staffMemberId`: Staff member ID.
4098
+ * - `name`: Staff member's name, or `null`.
4099
+ * - `image`: Staff member's image.
4100
+ *
4101
+ * Currently, `image` is always `null`.
4102
+ *
4103
+ * Empty when the service has no staff members, or there's no service to show.
4104
+ */
3571
4105
  staffMembers: ServiceItemStaffMember[];
4106
+ /**
4107
+ * Service's cover image, as an `Image` from `@wix/editor-react-types`.
4108
+ *
4109
+ * `undefined` when the service has no cover image, or there's no service to show. There's no
4110
+ * placeholder image. To check whether the service has a cover image, call `hasCoverImage()`.
4111
+ */
3572
4112
  coverImage: Image | undefined;
4113
+ /**
4114
+ * Images in the service's gallery, ready for a gallery element. Each item is a `VisualMedia` from
4115
+ * `@wix/editor-react-types`, with `type` set to `'image'`, `src` set to the image's
4116
+ * `wix:image://` URI, and the image's `width` and `height`. Items have no title or alt text.
4117
+ *
4118
+ * Empty when the service has no gallery images, or there's no service to show.
4119
+ */
3573
4120
  gallery: VisualMedia[];
4121
+ /**
4122
+ * Locations where the service takes place.
4123
+ *
4124
+ * Empty when the service has none, or there's no service to show.
4125
+ */
3574
4126
  serviceLocations: ServiceLocationItem[];
4127
+ /**
4128
+ * Description of the service's booking policy, as the business wrote it.
4129
+ *
4130
+ * `null` when the policy has no description, the description is turned off, or there's no
4131
+ * service to show.
4132
+ */
3575
4133
  policyDescription: string | null;
4134
+ /** Whether visitors can book the service online now, and which availability message applies. */
3576
4135
  serviceBookability: ServiceBookability;
4136
+ /**
4137
+ * [IANA time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) that
4138
+ * `courseStartDate` and `courseEndDate` are in.
4139
+ *
4140
+ * `'UTC'` when no time zone is known, such as while the service loads.
4141
+ */
3577
4142
  displayTimeZone: string;
4143
+ /**
4144
+ * Checks whether visitors can book the service online now.
4145
+ *
4146
+ * A service can be booked when online booking is turned on for it, and:
4147
+ * - An appointment: always.
4148
+ * - A class: it has a session that hasn't ended.
4149
+ * - A course: it has spots left, its sessions haven't ended, and booking is open.
4150
+ *
4151
+ * @returns `true` when the service can be booked online now. Same as
4152
+ * `serviceBookability.isAvailableForBooking`.
4153
+ *
4154
+ * `false` while the service loads, or when there's no service to show.
4155
+ *
4156
+ * @example Disable the booking button when the service can't be booked
4157
+ * ```tsx
4158
+ * import { useServiceContext } from '@wix/bookings/context/service';
4159
+ *
4160
+ * function BookButton() {
4161
+ * const { isAvailableForBooking, navigateToNextPage } = useServiceContext();
4162
+ *
4163
+ * return (
4164
+ * <button disabled={!isAvailableForBooking()} onClick={() => navigateToNextPage()}>
4165
+ * Book now
4166
+ * </button>
4167
+ * );
4168
+ * }
4169
+ * ```
4170
+ */
3578
4171
  isAvailableForBooking: () => boolean;
4172
+ /**
4173
+ * Checks whether the service has a booking policy description to show.
4174
+ *
4175
+ * @returns `true` when `policyDescription` isn't empty.
4176
+ *
4177
+ * @example Show the booking policy only when there's one
4178
+ * ```tsx
4179
+ * import { useServiceContext } from '@wix/bookings/context/service';
4180
+ *
4181
+ * function BookingPolicy() {
4182
+ * const { hasPolicyDescription, policyDescription } = useServiceContext();
4183
+ *
4184
+ * if (!hasPolicyDescription()) return null;
4185
+ *
4186
+ * return (
4187
+ * <section>
4188
+ * <h3>Booking policy</h3>
4189
+ * <p>{policyDescription}</p>
4190
+ * </section>
4191
+ * );
4192
+ * }
4193
+ * ```
4194
+ */
3579
4195
  hasPolicyDescription: () => boolean;
4196
+ /**
4197
+ * Checks whether the service has a cover image.
4198
+ *
4199
+ * @returns `true` when `coverImage` is set.
4200
+ *
4201
+ * @example Show a header only when the service has a cover image
4202
+ * ```tsx
4203
+ * import { useServiceContext } from '@wix/bookings/context/service';
4204
+ *
4205
+ * function ServiceHeader() {
4206
+ * const { hasCoverImage, serviceName } = useServiceContext();
4207
+ *
4208
+ * return (
4209
+ * <header className={hasCoverImage() ? 'header-with-cover' : 'header-plain'}>
4210
+ * <h1>{serviceName}</h1>
4211
+ * </header>
4212
+ * );
4213
+ * }
4214
+ * ```
4215
+ */
3580
4216
  hasCoverImage: () => boolean;
4217
+ /**
4218
+ * Checks whether the service has gallery images.
4219
+ *
4220
+ * @returns `true` when `gallery` has at least 1 image.
4221
+ *
4222
+ * @example Show a gallery only when the service has images
4223
+ * ```tsx
4224
+ * import { useServiceContext } from '@wix/bookings/context/service';
4225
+ *
4226
+ * function ServiceGallery() {
4227
+ * const { hasGalleryImages, gallery } = useServiceContext();
4228
+ *
4229
+ * if (!hasGalleryImages()) return null;
4230
+ *
4231
+ * return <p>{gallery.length} photos</p>;
4232
+ * }
4233
+ * ```
4234
+ */
3581
4235
  hasGalleryImages: () => boolean;
4236
+ /**
4237
+ * Checks whether an appointment's length depends on the visitor's choices, such as a duration
4238
+ * option or an add-on that adds time. When it does, the appointment's time slots aren't known
4239
+ * until the visitor makes those choices.
4240
+ *
4241
+ * @returns `true` when the appointment's length depends on the visitor's choices.
4242
+ *
4243
+ * `false` when it doesn't, or there's no service to show.
4244
+ *
4245
+ * @example Ask the visitor to choose options before showing times
4246
+ * ```tsx
4247
+ * import { useServiceContext } from '@wix/bookings/context/service';
4248
+ *
4249
+ * function UpcomingTimesTitle() {
4250
+ * const { isVariantDuration, openPreferences, navigateToNextPage } = useServiceContext();
4251
+ *
4252
+ * if (isVariantDuration()) {
4253
+ * return (
4254
+ * <button onClick={() => openPreferences().catch(() => navigateToNextPage())}>
4255
+ * Choose options to see times
4256
+ * </button>
4257
+ * );
4258
+ * }
4259
+ *
4260
+ * return <h3>Upcoming times</h3>;
4261
+ * }
4262
+ * ```
4263
+ */
3582
4264
  isVariantDuration: () => boolean;
4265
+ /**
4266
+ * Whether the service is loading. While it loads, the other properties hold empty values.
4267
+ */
3583
4268
  isLoading: boolean;
4269
+ /**
4270
+ * Whether the service failed to load. When it did, the other properties hold empty values.
4271
+ */
3584
4272
  hasError: boolean;
4273
+ /**
4274
+ * Site's locale, which the context formats prices and durations with, as a
4275
+ * [BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag).
4276
+ */
3585
4277
  locale: string;
4278
+ /**
4279
+ * Selects a staff member for the visitor's booking.
4280
+ *
4281
+ * The selection stays in the context, in `selection`, until `navigateToNextPage()` carries it to
4282
+ * the next page. It isn't written to the page's URL. Selecting a staff member removes a gender
4283
+ * that `clearSelection()` set.
4284
+ *
4285
+ * When each of the service's variants prices 1 staff member, the function also selects that
4286
+ * staff member's variant.
4287
+ *
4288
+ * @param staffMemberId - ID of the staff member to select. Use a `staffMemberId` from
4289
+ * `staffMembers`.
4290
+ *
4291
+ * @example Let the visitor choose a staff member
4292
+ * ```tsx
4293
+ * import { useServiceContext } from '@wix/bookings/context/service';
4294
+ *
4295
+ * function StaffPicker() {
4296
+ * const { staffMembers, selectStaffMember, clearSelection } = useServiceContext();
4297
+ *
4298
+ * return (
4299
+ * <select
4300
+ * defaultValue=""
4301
+ * onChange={(event) =>
4302
+ * event.target.value ? selectStaffMember(event.target.value) : clearSelection()
4303
+ * }
4304
+ * >
4305
+ * <option value="">Any staff member</option>
4306
+ * {staffMembers.map((member) => (
4307
+ * <option key={member.staffMemberId} value={member.staffMemberId}>
4308
+ * {member.name}
4309
+ * </option>
4310
+ * ))}
4311
+ * </select>
4312
+ * );
4313
+ * }
4314
+ * ```
4315
+ */
3586
4316
  selectStaffMember: SelectStaffMember;
4317
+ /**
4318
+ * Selects any available staff member for the visitor's booking, optionally of 1 gender.
4319
+ *
4320
+ * Despite its name, the function changes only the staff choice. The rest of the selection stays.
4321
+ * The staff choice stays in the context, in `selection`, until `navigateToNextPage()` carries it
4322
+ * to the next page.
4323
+ *
4324
+ * When each of the service's variants prices 1 staff member, the function also clears the
4325
+ * selected variant.
4326
+ *
4327
+ * @param requestedGender - Gender to limit the staff members to. Supported values:
4328
+ * `'ANY_FEMALE'` and `'ANY_MALE'`.
4329
+ *
4330
+ * Default: A staff member of any gender.
4331
+ *
4332
+ * @example Let the visitor ask for a female staff member
4333
+ * ```tsx
4334
+ * import { useServiceContext } from '@wix/bookings/context/service';
4335
+ *
4336
+ * function StaffGenderChoice() {
4337
+ * const { clearSelection } = useServiceContext();
4338
+ *
4339
+ * return (
4340
+ * <div>
4341
+ * <button onClick={() => clearSelection()}>Any staff member</button>
4342
+ * <button onClick={() => clearSelection('ANY_FEMALE')}>Any female staff member</button>
4343
+ * </div>
4344
+ * );
4345
+ * }
4346
+ * ```
4347
+ */
3587
4348
  clearSelection: ClearSelection;
3588
- /** Sets staff to neither a member nor "any". */
4349
+ /**
4350
+ * Clears the staff choice, so neither a staff member nor any available staff member is selected.
4351
+ *
4352
+ * @example Reset the staff choice
4353
+ * ```tsx
4354
+ * import { useServiceContext } from '@wix/bookings/context/service';
4355
+ *
4356
+ * function ResetStaffButton() {
4357
+ * const { clearStaffMember } = useServiceContext();
4358
+ *
4359
+ * return <button onClick={() => clearStaffMember()}>Reset staff choice</button>;
4360
+ * }
4361
+ * ```
4362
+ */
3589
4363
  clearStaffMember: ClearStaffMember;
3590
4364
  /**
3591
- * Seeded from the `b=` blob. The calendar's picks change it without writing `b=`: the Service CTA
3592
- * writes it into the next page's URL.
4365
+ * Visitor's selection for the service, such as the time slot, location, staff member, variant
4366
+ * choices, and add-ons. It starts from the booking preferences in the page's URL.
4367
+ *
4368
+ * The booking preferences are the booking choices that the page's URL keeps in its `b` query
4369
+ * parameter, so they carry from page to page: the services the visitor selected, with their time
4370
+ * slots and choices.
4371
+ *
4372
+ * `setSlot()` and `selectStaffMember()` change it without changing the URL, and
4373
+ * `navigateToNextPage()` carries it to the next page.
3593
4374
  */
3594
4375
  selection: ServicePreference;
3595
4376
  /**
3596
- * The zone `selection`'s slot times are local to — the one a pick reports, else the displayed
3597
- * one. `b=` carries it only once the CTA writes the pick, so a reader on the calendar has it
3598
- * from here alone.
4377
+ * [IANA time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) of the time
4378
+ * slot in `selection`. It's the time zone sent with the time slot when it was selected.
4379
+ *
4380
+ * Before a time slot is selected, it's the visitor's time zone, when the site shows times in the
4381
+ * visitor's time zone.
4382
+ *
4383
+ * `undefined` when neither applies, meaning the business's time zone, and while the site's
4384
+ * booking settings load.
3599
4385
  */
3600
4386
  selectionTimezone: string | undefined;
3601
- /** Empty clears. No participant count, so the booking form shows no count field for it. */
4387
+ /**
4388
+ * Selects the visitor's variant choices, and writes them to the page's URL, replacing the current
4389
+ * history entry.
4390
+ *
4391
+ * Choices selected this way have no participant count, so the booking form shows no participant
4392
+ * count field for them.
4393
+ *
4394
+ * @param choices - Keys of the variant choices to select. Use `choiceId` values from
4395
+ * `pricingOption.choices`.
4396
+ *
4397
+ * An empty array clears the variant choices.
4398
+ *
4399
+ * @example Let the visitor choose a variant
4400
+ * ```tsx
4401
+ * import { useServiceContext } from '@wix/bookings/context/service';
4402
+ *
4403
+ * function VariantPicker() {
4404
+ * const { pricingOption, setVariant } = useServiceContext();
4405
+ *
4406
+ * if (!pricingOption) return null;
4407
+ *
4408
+ * return (
4409
+ * <select
4410
+ * defaultValue=""
4411
+ * onChange={(event) => setVariant(event.target.value ? [event.target.value] : [])}
4412
+ * >
4413
+ * <option value="">{pricingOption.name ?? 'Choose an option'}</option>
4414
+ * {pricingOption.choices.map((choice) => (
4415
+ * <option key={choice.choiceId} value={choice.choiceId ?? ''}>
4416
+ * {choice.label} {choice.price}
4417
+ * </option>
4418
+ * ))}
4419
+ * </select>
4420
+ * );
4421
+ * }
4422
+ * ```
4423
+ */
3602
4424
  setVariant: SetVariant;
3603
4425
  /**
3604
- * 0 removes. Clamped to the participant limits, decreases first so a swap isn't lost to the cap.
3605
- * Unknown choices are ignored and dropped from the selection; no-op before variants load.
4426
+ * Sets how many participants to book for each variant choice, and writes the counts to the page's
4427
+ * URL, replacing the current history entry.
4428
+ *
4429
+ * The function limits each count to the service's participant limits, and applies decreases first
4430
+ * so a swap isn't lost to the limit. It ignores unknown choices and drops them from the
4431
+ * selection.
4432
+ * It does nothing before the variants load.
4433
+ *
4434
+ * @param counts - Number of participants for each variant choice, keyed by the choice's
4435
+ * `choiceId` from `pricingOption.choices`. A count of 0 removes the choice.
4436
+ *
4437
+ * @example Let the visitor set participants per variant
4438
+ * ```tsx
4439
+ * import { useServiceContext } from '@wix/bookings/context/service';
4440
+ *
4441
+ * function ParticipantCounts() {
4442
+ * const { pricingOption, selection, setVariantCounts } = useServiceContext();
4443
+ *
4444
+ * const countOf = (choiceId: string) =>
4445
+ * selection.selectedVariants?.find((variant) => variant.choices?.[0] === choiceId)
4446
+ * ?.numberOfParticipants ?? 0;
4447
+ *
4448
+ * return (
4449
+ * <div>
4450
+ * {pricingOption?.choices.map(({ choiceId, label }) =>
4451
+ * choiceId ? (
4452
+ * <label key={choiceId}>
4453
+ * {label}
4454
+ * <input
4455
+ * type="number"
4456
+ * min={0}
4457
+ * value={countOf(choiceId)}
4458
+ * onChange={(event) =>
4459
+ * setVariantCounts({ [choiceId]: Number(event.target.value) })
4460
+ * }
4461
+ * />
4462
+ * </label>
4463
+ * ) : null,
4464
+ * )}
4465
+ * </div>
4466
+ * );
4467
+ * }
4468
+ * ```
3606
4469
  */
3607
4470
  setVariantCounts: SetVariantCounts;
3608
- /** Across all variants; the cap the setters apply. */
4471
+ /**
4472
+ * Maximum number of participants in 1 booking of the service, from its booking policy.
4473
+ * `setVariantCounts()` limits the counts to it.
4474
+ *
4475
+ * `1` when the policy doesn't set one.
4476
+ */
3609
4477
  maxParticipantsPerBooking: number;
4478
+ /**
4479
+ * Adds an add-on to the visitor's booking, or removes it when it's already added. Writes the
4480
+ * change to the page's URL, replacing the current history entry.
4481
+ *
4482
+ * An add-on added this way has a quantity of 1.
4483
+ *
4484
+ * @param addOnId - ID of the add-on to add or remove. Use the ID of one of the service's add-ons,
4485
+ * such as from the Service Add-Ons context.
4486
+ *
4487
+ * @example Add or remove an add-on with a checkbox
4488
+ * ```tsx
4489
+ * import { useServiceContext } from '@wix/bookings/context/service';
4490
+ *
4491
+ * function AddOnCheckbox({ addOnId, label }: { addOnId: string; label: string }) {
4492
+ * const { selection, toggleAddOn } = useServiceContext();
4493
+ * const isAdded = selection.addOns?.some((addOn) => addOn.id === addOnId) ?? false;
4494
+ *
4495
+ * return (
4496
+ * <label>
4497
+ * <input type="checkbox" checked={isAdded} onChange={() => toggleAddOn(addOnId)} />
4498
+ * {label}
4499
+ * </label>
4500
+ * );
4501
+ * }
4502
+ * ```
4503
+ */
3610
4504
  toggleAddOn: ToggleAddOn;
3611
- /** 0 removes. */
4505
+ /**
4506
+ * Sets the quantity of an add-on in the visitor's booking, adding the add-on when it isn't added
4507
+ * yet. Writes the change to the page's URL, replacing the current history entry.
4508
+ *
4509
+ * @param addOnId - ID of the add-on. Use the ID of one of the service's add-ons, such as from the
4510
+ * Service Add-Ons context.
4511
+ *
4512
+ * @param quantity - Quantity of the add-on to book. 0 or less removes the add-on.
4513
+ *
4514
+ * @example Let the visitor choose an add-on's quantity
4515
+ * ```tsx
4516
+ * import { useServiceContext } from '@wix/bookings/context/service';
4517
+ *
4518
+ * function AddOnQuantity({ addOnId }: { addOnId: string }) {
4519
+ * const { setAddOnQuantity } = useServiceContext();
4520
+ *
4521
+ * return (
4522
+ * <input
4523
+ * type="number"
4524
+ * min={0}
4525
+ * defaultValue={0}
4526
+ * onChange={(event) => setAddOnQuantity(addOnId, Number(event.target.value))}
4527
+ * />
4528
+ * );
4529
+ * }
4530
+ * ```
4531
+ */
3612
4532
  setAddOnQuantity: SetAddOnQuantity;
4533
+ /**
4534
+ * Selects a time slot for the visitor's booking.
4535
+ *
4536
+ * The selection stays in the context, in `selection`, until `navigateToNextPage()` carries it to
4537
+ * the next page. It isn't written to the page's URL, so **Back**, a refresh, or a shared link
4538
+ * doesn't keep a selection the visitor didn't confirm.
4539
+ *
4540
+ * @param slot - Time slot to select. It has `slotStart` and `slotEnd`, as local date-times in
4541
+ * [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format with no offset, such as
4542
+ * `2026-11-02T10:00:00`, and the slot's `eventId`, `scheduleId`, `sessionId`, `locationId`, and
4543
+ * `locationType` where it has them. `locationType` is `'BUSINESS'`, `'CUSTOM'`, or `'CUSTOMER'`.
4544
+ *
4545
+ * Fields that the slot leaves out are cleared from the selection.
4546
+ *
4547
+ * To book the time slot, pass all the fields the slot has. The booking form can't book a time
4548
+ * slot without its `scheduleId` or `sessionId`, and a class's time slot also needs its
4549
+ * `eventId`. To get time slots with these fields, use the
4550
+ * [Time Slots API](https://dev.wix.com/docs/api-reference/business-solutions/bookings/time-slots/introduction).
4551
+ *
4552
+ * @param details - More about the slot, such as its staff member and time zone.
4553
+ *
4554
+ * @example Select a time slot and go to the booking form
4555
+ * ```tsx
4556
+ * import type { availabilityTimeSlots } from '@wix/bookings';
4557
+ * import { useServiceContext } from '@wix/bookings/context/service';
4558
+ *
4559
+ * function TimeSlotButton({ slot }: { slot: availabilityTimeSlots.TimeSlot }) {
4560
+ * const { setSlot, navigateToNextPage } = useServiceContext();
4561
+ *
4562
+ * const bookSlot = () => {
4563
+ * setSlot(
4564
+ * {
4565
+ * slotStart: slot.localStartDate,
4566
+ * slotEnd: slot.localEndDate,
4567
+ * eventId: slot.eventInfo?.eventId,
4568
+ * scheduleId: slot.scheduleId ?? undefined,
4569
+ * locationId: slot.location?._id ?? undefined,
4570
+ * locationType: slot.location?.locationType ?? undefined,
4571
+ * },
4572
+ * { timezone: 'America/New_York' },
4573
+ * );
4574
+ * navigateToNextPage({
4575
+ * courseNavigationTarget: 'bookingForm',
4576
+ * classAppointmentNavigationTarget: 'bookingForm',
4577
+ * });
4578
+ * };
4579
+ *
4580
+ * return <button onClick={bookSlot}>{slot.localStartDate?.slice(11, 16)}</button>;
4581
+ * }
4582
+ * ```
4583
+ */
3613
4584
  setSlot: SetSlot;
4585
+ /**
4586
+ * Clears the selected time slot from the visitor's booking.
4587
+ *
4588
+ * The location and the staff choice go back to the ones in the page's URL, which the visitor
4589
+ * made before selecting a time slot. For a service priced by staff member, so do the variant
4590
+ * choices.
4591
+ *
4592
+ * @example Let the visitor choose another time
4593
+ * ```tsx
4594
+ * import { useServiceContext } from '@wix/bookings/context/service';
4595
+ *
4596
+ * function ChangeTimeButton() {
4597
+ * const { selection, clearSlot } = useServiceContext();
4598
+ *
4599
+ * if (!selection.slotStart) return null;
4600
+ *
4601
+ * return <button onClick={() => clearSlot()}>Choose another time</button>;
4602
+ * }
4603
+ * ```
4604
+ */
3614
4605
  clearSlot: ClearSlot;
3615
- /** A Multi-Service Appointment's picked time, held like {@link setSlot}'s until the CTA. */
4606
+ /**
4607
+ * Selects a time slot for a multi-service appointment, with 1 part for each service.
4608
+ *
4609
+ * Part `i` of the slot goes to the appointment's service `i`. Each service's location, staff,
4610
+ * variants, and add-ons stay, except a requested staff gender that availability rejected during
4611
+ * this visit, which is dropped. Like `setSlot()`, the selected slot stays in the context until
4612
+ * `navigateToNextPage()` carries it to the booking form.
4613
+ *
4614
+ * The function selects nothing when:
4615
+ * - The parts don't match the appointment's services in number, order, or service ID.
4616
+ * - A part has no start or end.
4617
+ * - The page's URL has no booking preferences.
4618
+ *
4619
+ * @param nestedTimeSlots - Parts of the slot, one for each service in the appointment, in the
4620
+ * same order as `multiServiceAppointmentServices`. Each part has the service's `serviceId`, the
4621
+ * part's `localStartDate` and `localEndDate`, as local date-times in [ISO
4622
+ * 8601](https://en.wikipedia.org/wiki/ISO_8601) format with no offset, and its `scheduleId`.
4623
+ *
4624
+ * @param timezone - [IANA time
4625
+ * zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
4626
+ * of the parts' local dates. Without it, the booking preferences keep their time zone.
4627
+ *
4628
+ * @returns `true` when the slot is selected, `false` when it isn't.
4629
+ *
4630
+ * @example Select a multi-service appointment's time slot
4631
+ * ```tsx
4632
+ * import { useState } from 'react';
4633
+ * import { useServiceContext } from '@wix/bookings/context/service';
4634
+ *
4635
+ * type SlotPart = {
4636
+ * serviceId: string;
4637
+ * localStartDate: string;
4638
+ * localEndDate: string;
4639
+ * scheduleId: string;
4640
+ * };
4641
+ *
4642
+ * function MultiServiceSlotButton({ parts, label }: { parts: SlotPart[]; label: string }) {
4643
+ * const { setMultiServiceSlot } = useServiceContext();
4644
+ * const [failed, setFailed] = useState(false);
4645
+ *
4646
+ * return (
4647
+ * <div>
4648
+ * <button onClick={() => setFailed(!setMultiServiceSlot(parts, 'America/New_York'))}>
4649
+ * {label}
4650
+ * </button>
4651
+ * {failed && <p>This time doesn't match your services. Choose another time.</p>}
4652
+ * </div>
4653
+ * );
4654
+ * }
4655
+ * ```
4656
+ */
3616
4657
  setMultiServiceSlot: SetMultiServiceSlot;
4658
+ /**
4659
+ * Clears the selected time slot from every service in a multi-service appointment. The selected
4660
+ * locations stay.
4661
+ *
4662
+ * @example Clear a multi-service appointment's time slot
4663
+ * ```tsx
4664
+ * import { useServiceContext } from '@wix/bookings/context/service';
4665
+ *
4666
+ * function ClearAppointmentTime() {
4667
+ * const { isMultiServiceAppointment, clearMultiServiceSlot } = useServiceContext();
4668
+ *
4669
+ * if (!isMultiServiceAppointment) return null;
4670
+ *
4671
+ * return <button onClick={() => clearMultiServiceSlot()}>Choose another time</button>;
4672
+ * }
4673
+ * ```
4674
+ */
3617
4675
  clearMultiServiceSlot: ClearMultiServiceSlot;
3618
4676
  /**
3619
- * Goes up each time the drafts start over from a `b=` changed from outside, so the calendar
3620
- * drops its picked time.
4677
+ * Number that goes up each time the booking preferences in the page's URL change from outside the
4678
+ * context, such as from the booking preferences popup. The context then starts `selection` over
4679
+ * from the URL.
4680
+ *
4681
+ * Compare it to reset state you keep about the selected time slot.
3621
4682
  */
3622
4683
  draftRevision: number;
3623
- /** The visitor ticked "I have a promo code" in the Booking Summary (`b=`). */
4684
+ /**
4685
+ * Whether the visitor has a promo code to enter at checkout, from the booking preferences in the
4686
+ * page's URL. To change it, call `setWantsPromoCode()`.
4687
+ */
3624
4688
  wantsPromoCode: boolean;
3625
- /** Writes the tick into `b=` in place; no-op without a decodable blob. */
4689
+ /**
4690
+ * Sets whether the visitor has a promo code to enter at checkout, and writes it to the page's
4691
+ * URL, replacing the current history entry.
4692
+ *
4693
+ * The function does nothing when the page's URL has no booking preferences.
4694
+ *
4695
+ * @param wanted - Whether the visitor has a promo code to enter at checkout.
4696
+ *
4697
+ * @example Let the visitor say they have a promo code
4698
+ * ```tsx
4699
+ * import { useServiceContext } from '@wix/bookings/context/service';
4700
+ *
4701
+ * function PromoCodeCheckbox() {
4702
+ * const { wantsPromoCode, setWantsPromoCode } = useServiceContext();
4703
+ *
4704
+ * return (
4705
+ * <label>
4706
+ * <input
4707
+ * type="checkbox"
4708
+ * checked={wantsPromoCode}
4709
+ * onChange={(event) => setWantsPromoCode(event.target.checked)}
4710
+ * />
4711
+ * I have a promo code
4712
+ * </label>
4713
+ * );
4714
+ * }
4715
+ * ```
4716
+ */
3626
4717
  setWantsPromoCode: (wanted: boolean) => void;
3627
- /** Adds the live selection as `b=` to a destination path. */
4718
+ /**
4719
+ * Adds the visitor's selection to a page path, as the booking preferences in the path's `b` query
4720
+ * parameter.
4721
+ *
4722
+ * Use it to build your own link that carries the selection. It doesn't change the selection, and
4723
+ * doesn't navigate. When `setSlot()` set a time zone, the booking preferences use it.
4724
+ *
4725
+ * @param path - Path of the page, which can have its own query and hash.
4726
+ *
4727
+ * @param opts - How to add the selection.
4728
+ *
4729
+ * @returns Path, query, and hash of `path`, with the `b` query parameter added. The origin of a
4730
+ * full URL is dropped.
4731
+ *
4732
+ * @example Link to a page with the visitor's selection
4733
+ * ```tsx
4734
+ * import { useServiceContext } from '@wix/bookings/context/service';
4735
+ *
4736
+ * function CalendarLink({ calendarPath }: { calendarPath: string }) {
4737
+ * const { withSelectionParam } = useServiceContext();
4738
+ *
4739
+ * return <a href={withSelectionParam(calendarPath)}>See available times</a>;
4740
+ * }
4741
+ * ```
4742
+ */
3628
4743
  withSelectionParam: WithSelectionParam;
4744
+ /**
4745
+ * Kind of booking button to show for the service. Supported values:
4746
+ * - `'book'`: A button that books the service.
4747
+ * - `'requestToBook'`: A button that requests a booking, because the business approves each
4748
+ * booking manually.
4749
+ * - `'viewCourse'`: A button that shows the course, because the course is full or it's too late
4750
+ * to book it.
4751
+ */
3629
4752
  serviceCtaState: ServiceCtaState;
4753
+ /**
4754
+ * Navigates the visitor to the next step of booking the service, carrying their selection.
4755
+ *
4756
+ * The next page depends on `config` and the service type. A course whose `serviceCtaState` is
4757
+ * `'viewCourse'` always goes to the service page. For a multi-service appointment, the next page
4758
+ * is the booking form, once every service has a selected time slot.
4759
+ *
4760
+ * The function doesn't navigate when:
4761
+ * - A navigation it started hasn't settled yet. See `isNavigating`.
4762
+ * - The context is in reschedule mode. To move the booking, call `rescheduleBooking()`.
4763
+ * - The next page is the booking form, and no time slot is selected for a class or an
4764
+ * appointment.
4765
+ * - The site has no page for the next step.
4766
+ *
4767
+ * The booking form gets only this service's selection. Other pages get the selection merged into
4768
+ * the page's current booking preferences.
4769
+ *
4770
+ * @param config - Pages to go to for each service type.
4771
+ *
4772
+ * Default: the service page for every service type.
4773
+ *
4774
+ * @param referralInfo - Where the visitor started the navigation, sent with the click's analytics
4775
+ * events. Supported values: `'widget_button'`, `'widget_more_info_label'`, and `'explore_plans'`.
4776
+ *
4777
+ * Default: `'widget_button'`.
4778
+ *
4779
+ * @example Go to the next booking step from a service page
4780
+ * ```tsx
4781
+ * import { useServiceContext } from '@wix/bookings/context/service';
4782
+ *
4783
+ * function BookNowButton() {
4784
+ * const { isAvailableForBooking, isNavigating, navigateToNextPage } = useServiceContext();
4785
+ *
4786
+ * return (
4787
+ * <button
4788
+ * disabled={!isAvailableForBooking() || isNavigating}
4789
+ * onClick={() =>
4790
+ * navigateToNextPage({
4791
+ * courseNavigationTarget: 'bookingForm',
4792
+ * classAppointmentNavigationTarget: 'bookingCalendar',
4793
+ * })
4794
+ * }
4795
+ * >
4796
+ * Book now
4797
+ * </button>
4798
+ * );
4799
+ * }
4800
+ * ```
4801
+ */
3630
4802
  navigateToNextPage: (config?: ServiceSelectionNavigationConfig, referralInfo?: BiReferralInfo) => void;
3631
4803
  /**
3632
- * A Multi-Service Appointment's step of navigateToNextPage, reporting the slot selections
3633
- * through `reportBi`, so the calendar's Next reports them as the calendar.
4804
+ * Navigates the visitor to the booking form for a multi-service appointment, once every service
4805
+ * has a selected time slot.
4806
+ *
4807
+ * It does what `navigateToNextPage()` does for a multi-service appointment, but reports each
4808
+ * service's slot selection analytics event through the `reportBi` function you pass, instead of
4809
+ * the context's own reporting. Unlike `navigateToNextPage()`, it also navigates in reschedule
4810
+ * mode.
4811
+ *
4812
+ * The function doesn't navigate when:
4813
+ * - A navigation it started hasn't settled yet. See `isNavigating`.
4814
+ * - A service in the appointment has no selected time slot.
4815
+ * - The site has no booking form page.
4816
+ *
4817
+ * @param reportBi - Function that reports an analytics event. It's called once for each service
4818
+ * in the appointment.
4819
+ *
4820
+ * @example Go to the booking form with your own analytics
4821
+ * ```tsx
4822
+ * import { useServiceContext } from '@wix/bookings/context/service';
4823
+ *
4824
+ * type AnalyticsEvent = {
4825
+ * src: number;
4826
+ * evid: number;
4827
+ * endpoint: string;
4828
+ * params: Record<string, unknown>;
4829
+ * };
4830
+ *
4831
+ * function NextButton({ reportEvent }: { reportEvent: (event: AnalyticsEvent) => void }) {
4832
+ * const { isMultiServiceAppointment, navigateToMultiServiceForm } = useServiceContext();
4833
+ *
4834
+ * if (!isMultiServiceAppointment) return null;
4835
+ *
4836
+ * return <button onClick={() => navigateToMultiServiceForm(reportEvent)}>Next</button>;
4837
+ * }
4838
+ * ```
3634
4839
  */
3635
4840
  navigateToMultiServiceForm: (reportBi: ReportBi) => void;
4841
+ /**
4842
+ * Retrieves the URL of the page that `navigateToNextPage()` navigates to, without navigating.
4843
+ *
4844
+ * For a single service, the URL doesn't carry the visitor's selection, so use it for a link's
4845
+ * `href`, and navigate with `navigateToNextPage()`. For a multi-service appointment, the URL is
4846
+ * the booking form's, with the selection.
4847
+ *
4848
+ * In reschedule mode, the function still returns the URL, but `navigateToNextPage()` doesn't
4849
+ * navigate.
4850
+ *
4851
+ * @param config - Pages to go to for each service type.
4852
+ *
4853
+ * Default: the service page for every service type.
4854
+ *
4855
+ * @returns URL of the next page.
4856
+ *
4857
+ * `null` when there's nowhere to go yet:
4858
+ * - The next page is the booking form, and no time slot is selected for a class or an
4859
+ * appointment.
4860
+ * - A service in a multi-service appointment has no selected time slot.
4861
+ * - The site has no page for the next step.
4862
+ *
4863
+ * @example Render the booking button as a link
4864
+ * ```tsx
4865
+ * import { useServiceContext } from '@wix/bookings/context/service';
4866
+ *
4867
+ * function BookLink() {
4868
+ * const { resolveNextPageHref, navigateToNextPage } = useServiceContext();
4869
+ * const href = resolveNextPageHref();
4870
+ *
4871
+ * if (!href) return null;
4872
+ *
4873
+ * return (
4874
+ * <a
4875
+ * href={href}
4876
+ * onClick={(event) => {
4877
+ * event.preventDefault();
4878
+ * navigateToNextPage();
4879
+ * }}
4880
+ * >
4881
+ * View service
4882
+ * </a>
4883
+ * );
4884
+ * }
4885
+ * ```
4886
+ */
3636
4887
  resolveNextPageHref: (config?: ServiceSelectionNavigationConfig) => string | null;
3637
- /** True from navigateToNextPage() until the navigation settles; further calls do nothing. */
4888
+ /**
4889
+ * Whether a navigation that a function of the context started hasn't settled yet, such as one
4890
+ * from `navigateToNextPage()`. While it's `true`, `navigateToNextPage()` and
4891
+ * `navigateToMultiServiceForm()` do nothing.
4892
+ */
3638
4893
  isNavigating: boolean;
3639
- /** Opens the preferences Lightbox; rejects if it can't, so the caller can fall back. */
4894
+ /**
4895
+ * Opens the site's booking preferences popup for the service, where the visitor makes the choices
4896
+ * the service needs before booking.
4897
+ *
4898
+ * The popup starts from the selection in the page's URL, not from selections held in the context,
4899
+ * such as a time slot's staff member.
4900
+ *
4901
+ * Rejects when the site has no booking preferences popup, or the popup can't be opened, so you
4902
+ * can fall back, such as to `navigateToNextPage()`.
4903
+ *
4904
+ * @returns Promise that rejects when the popup can't be opened.
4905
+ *
4906
+ * @example Open the preferences popup, and fall back to the next page
4907
+ * ```tsx
4908
+ * import { useServiceContext } from '@wix/bookings/context/service';
4909
+ *
4910
+ * function ChooseOptionsButton() {
4911
+ * const { openPreferences, navigateToNextPage } = useServiceContext();
4912
+ *
4913
+ * return (
4914
+ * <button onClick={() => openPreferences().catch(() => navigateToNextPage())}>
4915
+ * Choose options
4916
+ * </button>
4917
+ * );
4918
+ * }
4919
+ * ```
4920
+ */
3640
4921
  openPreferences: () => Promise<void>;
4922
+ /**
4923
+ * Whether the business lets visitors book several services as 1 appointment.
4924
+ *
4925
+ * `false` while `bookingsSettingsLoading` is `true`.
4926
+ */
3641
4927
  multiServiceAppointmentsEnabled: boolean;
3642
- /** 2+ services in the Booking Preferences, so no single service loads. */
4928
+ /**
4929
+ * Whether the booking preferences in the page's URL hold more than 1 service, to book as a
4930
+ * multi-service appointment. When it's `true`, no single service loads: `service` is `null`, and
4931
+ * the appointment's services are in `multiServiceAppointmentServices`.
4932
+ */
3643
4933
  isMultiServiceAppointment: boolean;
3644
- /** One per Booking Preferences entry, in order (may repeat). Empty if none or failed. */
4934
+ /**
4935
+ * Services in the multi-service appointment, one for each service in the booking preferences in
4936
+ * the page's URL, in the same order. A service can appear more than once.
4937
+ *
4938
+ * Empty when the booking isn't a multi-service appointment, and when the services fail to load.
4939
+ */
3645
4940
  multiServiceAppointmentServices: Service[];
3646
- /** VARIED services only, by service id. */
4941
+ /**
4942
+ * Visitor's selection for each service in the multi-service appointment, in the same order as
4943
+ * `multiServiceAppointmentServices`. It's the selection made on this page, or otherwise the one
4944
+ * in the booking preferences in the page's URL.
4945
+ *
4946
+ * Empty when the booking isn't a multi-service appointment. For a single service, use
4947
+ * `selection`.
4948
+ */
4949
+ multiServiceAppointmentSelections: ServicePreference[];
4950
+ /**
4951
+ * Options and variants of the multi-service appointment's services with varied pricing, by
4952
+ * service ID.
4953
+ *
4954
+ * Empty while they load, when they fail to load, and when the booking isn't a multi-service
4955
+ * appointment.
4956
+ */
3647
4957
  multiServiceAppointmentOptionsAndVariants: Record<string, ServiceOptionsAndVariants>;
3648
- multiServiceAppointmentVariantsStatus: 'loading' | 'ready' | 'error';
4958
+ /** Loading status of the variants of a multi-service appointment's services that the visitor chose variants for. */
4959
+ multiServiceAppointmentVariantsStatus: /** The variants are loading. */'loading' /** The variants loaded, or no service needs them. */ | 'ready' /** The variants of at least 1 service failed to load. */ | 'error';
4960
+ /**
4961
+ * Whether the business's booking settings are still loading. While they load,
4962
+ * `multiServiceAppointmentsEnabled` is `false`.
4963
+ */
3649
4964
  bookingsSettingsLoading: boolean;
3650
4965
  /**
3651
- * Reschedule mode: the URL names a booking (`bookingId`) or a token. Set on the server render
3652
- * too, from the URL; the booking itself loads in the browser.
4966
+ * Booking to reschedule and its status, when the page's URL names a booking to reschedule.
4967
+ *
4968
+ * `null` when the page isn't rescheduling a booking.
3653
4969
  */
3654
4970
  reschedule: Reschedule | null;
3655
4971
  /**
3656
- * Moves the booking to the picked time, then returns to `rescheduleRedirectUrl`, else My
3657
- * Bookings. `succeeded`: moved with nowhere to go (or the manage-booking page, or a failed
3658
- * return), so the caller confirms it in place, as OOI.
4972
+ * Moves the booking being rescheduled to the selected time slot.
4973
+ *
4974
+ * After the booking moves, the function navigates the visitor to the reschedule's return URL,
4975
+ * when the page's URL has an `http` or `https` return URL. Otherwise, it navigates to the site's
4976
+ * My Bookings page.
4977
+ *
4978
+ * The booking doesn't move when:
4979
+ * - The context isn't in reschedule mode, or `reschedule.status` isn't `'ready'`.
4980
+ * - `canRescheduleToPick` is `false`.
4981
+ * - The reschedule request fails.
4982
+ *
4983
+ * @returns Promise that resolves with the result. Its `outcome` is:
4984
+ * - `'navigated'`: The booking moved, and the function navigated the visitor to the next page.
4985
+ * - `'succeeded'`: The booking moved, and the visitor stays on the page, so confirm the move
4986
+ * there. The result also has the moved booking's `staffName` and `locationName`. This happens
4987
+ * when the visitor came from the manage booking page, there's nowhere to go, or the navigation
4988
+ * failed.
4989
+ * - `'failed'`: The booking didn't move.
4990
+ *
4991
+ * @example Confirm a reschedule
4992
+ * ```tsx
4993
+ * import { useState } from 'react';
4994
+ * import { useServiceContext } from '@wix/bookings/context/service';
4995
+ *
4996
+ * function ConfirmRescheduleButton() {
4997
+ * const { canRescheduleToPick, rescheduleBooking } = useServiceContext();
4998
+ * const [message, setMessage] = useState('');
4999
+ *
5000
+ * const confirm = async () => {
5001
+ * const result = await rescheduleBooking();
5002
+ * if (result.outcome === 'succeeded') {
5003
+ * setMessage(`Your booking moved. You're booked with ${result.staffName ?? 'us'}.`);
5004
+ * }
5005
+ * if (result.outcome === 'failed') {
5006
+ * setMessage("Couldn't move your booking. Choose another time and try again.");
5007
+ * }
5008
+ * };
5009
+ *
5010
+ * return (
5011
+ * <div>
5012
+ * <button disabled={!canRescheduleToPick} onClick={confirm}>Confirm new time</button>
5013
+ * <p>{message}</p>
5014
+ * </div>
5015
+ * );
5016
+ * }
5017
+ * ```
3659
5018
  */
3660
5019
  rescheduleBooking: () => Promise<RescheduleResult>;
3661
- /** The success dialog's way out, as OOI's: the home page. */
5020
+ /**
5021
+ * Navigates the visitor to the site's home page, such as from a message that confirms a
5022
+ * reschedule.
5023
+ *
5024
+ * @example Leave the page after a reschedule
5025
+ * ```tsx
5026
+ * import { useServiceContext } from '@wix/bookings/context/service';
5027
+ *
5028
+ * function RescheduleDone() {
5029
+ * const { goHomeAfterReschedule } = useServiceContext();
5030
+ *
5031
+ * return (
5032
+ * <div>
5033
+ * <p>Your booking moved.</p>
5034
+ * <button onClick={() => goHomeAfterReschedule()}>Go to home page</button>
5035
+ * </div>
5036
+ * );
5037
+ * }
5038
+ * ```
5039
+ */
3662
5040
  goHomeAfterReschedule: () => void;
3663
5041
  /**
3664
- * The booking can move to the picked time: it is bookable, its staff is settled, and the
3665
- * booking's pricing plan covers it.
5042
+ * Whether the booking being rescheduled can move to the selected time slot.
5043
+ *
5044
+ * It's `true` when all of these apply:
5045
+ * - The time slot can be booked.
5046
+ * - A staff member is selected, when the time slot needs 1.
5047
+ * - The time slot starts before the plan the booking was paid with expires.
5048
+ *
5049
+ * `false` when no time slot is selected.
3666
5050
  */
3667
5051
  canRescheduleToPick: boolean;
3668
5052
  }
5053
+ /** Result of `rescheduleBooking()`. */
3669
5054
  type RescheduleResult = {
3670
- outcome: 'navigated' | 'failed';
5055
+ /** Result of the reschedule. */outcome: /** The booking moved, and `rescheduleBooking()` navigated the visitor to the next page. */'navigated' /** The booking didn't move. */ | 'failed';
3671
5056
  } | ({
3672
- outcome: 'succeeded';
5057
+ /** Result of the reschedule. The booking moved, and the visitor stays on the page. */outcome: 'succeeded';
3673
5058
  } & RescheduledSlot);
3674
5059
  type ReportBi = ReturnType<typeof useBiLogger>;
3675
5060
  declare const serviceContext: React.Context<ServiceContextValue | null>;
3676
5061
  declare const SERVICE_CONTEXT_MISSING_PROVIDER_ERROR = "useServiceContext must be used within ServiceContextProvider";
3677
- /** Reads the service state; returns null instead of throwing when `optional` is true and no provider is above. */
5062
+ /**
5063
+ * The `useServiceContext()` hook provides access to a bookable service's details, prices, media,
5064
+ * locations, and availability, and to the visitor's booking selection for it. Use it to show a
5065
+ * service, let visitors choose what to book, and send them to the next step of booking it. When you
5066
+ * pass `true` to the hook, it returns `null` where the context isn't available.
5067
+ */
3678
5068
  declare function useServiceContext(optional: true): ServiceContextValue | null;
3679
- /** Reads the service state; throws when no ServiceContextProvider is above. */
5069
+ /**
5070
+ * The `useServiceContext()` hook provides access to a bookable service's details, prices, media,
5071
+ * locations, and availability, and to the visitor's booking selection for it. Use it to show a
5072
+ * service, let visitors choose what to book, and send them to the next step of booking it.
5073
+ *
5074
+ * It throws an error where the context isn't available.
5075
+ */
3680
5076
  declare function useServiceContext(optional?: false): ServiceContextValue;
3681
5077
  /** `multi`: 2+ services in the Booking Preferences. `none`: nothing asked for, not an error. */
3682
5078
  type ServiceTarget = {