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