@wix/bookings 1.0.1754 → 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.
Files changed (46) hide show
  1. package/_sdk-exports/context-booking-checkout/runtime.d.ts +750 -143
  2. package/_sdk-exports/context-booking-checkout/runtime.js +2 -2
  3. package/_sdk-exports/context-categories/runtime.d.ts +164 -2
  4. package/_sdk-exports/context-locations/runtime.d.ts +186 -2
  5. package/_sdk-exports/context-service/runtime.d.ts +1499 -144
  6. package/_sdk-exports/context-service/runtime.js +2 -2
  7. package/_sdk-exports/context-service-addons/runtime.d.ts +215 -13
  8. package/_sdk-exports/context-services/runtime.d.ts +330 -77
  9. package/_sdk-exports/context-time-slots/runtime.d.ts +841 -72
  10. package/build/cjs/context-booking-checkout.d.ts +750 -143
  11. package/build/cjs/context-booking-checkout.js +1823 -1706
  12. package/build/cjs/context-booking-checkout.js.map +1 -1
  13. package/build/cjs/context-categories.d.ts +164 -2
  14. package/build/cjs/context-locations.d.ts +186 -2
  15. package/build/cjs/context-service-addons.d.ts +215 -13
  16. package/build/cjs/context-service.d.ts +1499 -144
  17. package/build/cjs/context-service.js +1234 -1230
  18. package/build/cjs/context-service.js.map +1 -1
  19. package/build/cjs/context-services.d.ts +330 -77
  20. package/build/cjs/context-time-slots.d.ts +841 -72
  21. package/build/es/context-booking-checkout.d.mts +750 -143
  22. package/build/es/context-booking-checkout.mjs +1835 -1709
  23. package/build/es/context-booking-checkout.mjs.map +1 -1
  24. package/build/es/context-categories.d.mts +164 -2
  25. package/build/es/context-locations.d.mts +186 -2
  26. package/build/es/context-service-addons.d.mts +215 -13
  27. package/build/es/context-service.d.mts +1499 -144
  28. package/build/es/context-service.mjs +1234 -1230
  29. package/build/es/context-service.mjs.map +1 -1
  30. package/build/es/context-services.d.mts +330 -77
  31. package/build/es/context-time-slots.d.mts +841 -72
  32. package/build/internal/cjs/context-booking-checkout.d.ts +750 -143
  33. package/build/internal/cjs/context-categories.d.ts +164 -2
  34. package/build/internal/cjs/context-locations.d.ts +186 -2
  35. package/build/internal/cjs/context-service-addons.d.ts +215 -13
  36. package/build/internal/cjs/context-service.d.ts +1499 -144
  37. package/build/internal/cjs/context-services.d.ts +330 -77
  38. package/build/internal/cjs/context-time-slots.d.ts +841 -72
  39. package/build/internal/es/context-booking-checkout.d.mts +750 -143
  40. package/build/internal/es/context-categories.d.mts +164 -2
  41. package/build/internal/es/context-locations.d.mts +186 -2
  42. package/build/internal/es/context-service-addons.d.mts +215 -13
  43. package/build/internal/es/context-service.d.mts +1499 -144
  44. package/build/internal/es/context-services.d.mts +330 -77
  45. package/build/internal/es/context-time-slots.d.mts +841 -72
  46. package/package.json +5 -5
@@ -72,7 +72,7 @@ declare global {
72
72
  * You can use it to offer customers different prices for a service,
73
73
  * depending on which choices they book.
74
74
  */
75
- interface ServiceOptionsAndVariants$1 {
75
+ interface ServiceOptionsAndVariants {
76
76
  /**
77
77
  * ID of the `serviceOptionsAndVariants` object.
78
78
  * @format GUID
@@ -155,6 +155,11 @@ declare enum ServiceOptionType {
155
155
  * @documentationMaturity preview
156
156
  */
157
157
  NUMBER_OF_PARTICIPANTS = "NUMBER_OF_PARTICIPANTS",
158
+ /**
159
+ * The price is resolved by the business location the service is booked at.
160
+ * @documentationMaturity preview
161
+ */
162
+ LOCATION = "LOCATION",
158
163
  /**
159
164
  * The price is resolved from pricing tiers based on the booking duration range.
160
165
  * @documentationMaturity preview
@@ -162,7 +167,7 @@ declare enum ServiceOptionType {
162
167
  DURATION_RANGE = "DURATION_RANGE"
163
168
  }
164
169
  /** @enumType */
165
- type ServiceOptionTypeWithLiterals = ServiceOptionType | 'UNKNOWN' | 'CUSTOM' | 'STAFF_MEMBER' | 'DURATION' | 'DATE_TIME' | 'NUMBER_OF_PARTICIPANTS' | 'DURATION_RANGE';
170
+ type ServiceOptionTypeWithLiterals = ServiceOptionType | 'UNKNOWN' | 'CUSTOM' | 'STAFF_MEMBER' | 'DURATION' | 'DATE_TIME' | 'NUMBER_OF_PARTICIPANTS' | 'LOCATION' | 'DURATION_RANGE';
166
171
  interface CustomServiceOption {
167
172
  /**
168
173
  * Name of the service option. For example, `Age group`, `Location`, `Equipment`,
@@ -223,6 +228,14 @@ interface ServiceChoice$1 extends ServiceChoiceChoiceOneOf$1 {
223
228
  dateTime?: DateTimeRule$1;
224
229
  /** A rule resolving the price by the number of participants. Available only for `NUMBER_OF_PARTICIPANTS` options. */
225
230
  participantRange?: ParticipantsRange$1;
231
+ /**
232
+ * ID of the business location the price applies to.
233
+ *
234
+ * Limited to business locations. Custom and customer locations aren't supported.
235
+ * Available only for `LOCATION` options.
236
+ * @format GUID
237
+ */
238
+ businessLocationId?: string;
226
239
  /**
227
240
  * A duration range tier resolving the price by how long the booking is.
228
241
  * Available only for `DURATION_RANGE` options.
@@ -254,6 +267,14 @@ interface ServiceChoiceChoiceOneOf$1 {
254
267
  dateTime?: DateTimeRule$1;
255
268
  /** A rule resolving the price by the number of participants. Available only for `NUMBER_OF_PARTICIPANTS` options. */
256
269
  participantRange?: ParticipantsRange$1;
270
+ /**
271
+ * ID of the business location the price applies to.
272
+ *
273
+ * Limited to business locations. Custom and customer locations aren't supported.
274
+ * Available only for `LOCATION` options.
275
+ * @format GUID
276
+ */
277
+ businessLocationId?: string;
257
278
  /**
258
279
  * A duration range tier resolving the price by how long the booking is.
259
280
  * Available only for `DURATION_RANGE` options.
@@ -503,9 +524,9 @@ interface ExtendedFields$1 {
503
524
  namespaces?: Record<string, Record<string, any>>;
504
525
  }
505
526
  //#endregion
506
- //#region ../../node_modules/@wix/auto_sdk_bookings_services/build/es/bookings-services-v2-service-services.universal-Bf4TC5aj.d.mts
527
+ //#region ../../node_modules/@wix/auto_sdk_bookings_services/build/es/bookings-services-v2-service-services.universal-oLBaHt-W.d.mts
507
528
  /** The `service` object represents an offering that a business provides to its customers. */
508
- interface Service$2 {
529
+ interface Service {
509
530
  /**
510
531
  * Service ID.
511
532
  * @format GUID
@@ -1549,6 +1570,7 @@ interface CancellationFeePolicy {
1549
1570
  */
1550
1571
  autoCollectFeeEnabled?: boolean | null;
1551
1572
  }
1573
+ /** What happens to the plan credit when the customer cancels a booking paid with a pricing plan. */
1552
1574
  interface CancellationWindow extends CancellationWindowFeeOneOf {
1553
1575
  /** Amount to be charged as a cancellation fee. */
1554
1576
  amount?: Money$1;
@@ -1757,12 +1779,7 @@ interface DailyConfig {
1757
1779
  */
1758
1780
  maxDurationInDays?: number;
1759
1781
  }
1760
- /**
1761
- * Controls how a service's own working hours combine with the working hours of its assigned
1762
- * staff members and required resources. The hours themselves are not held here. They are the
1763
- * `WORKING_HOURS` events on the service's schedule (`schedule.id`), and this message controls
1764
- * only how they combine with the resources working hours.
1765
- */
1782
+ /** Times of day at which each bookable day of a daily service starts and ends. */
1766
1783
  interface StaffMember {
1767
1784
  /**
1768
1785
  * 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.
@@ -1784,6 +1801,14 @@ interface StaffMember {
1784
1801
  * @readonly
1785
1802
  */
1786
1803
  mainMedia?: StaffMediaItem;
1804
+ /**
1805
+ * Business locations where the staff member is available, based on their working hours.
1806
+ * Returned only when both `STAFF_MEMBER_DETAILS` and `STAFF_WORKING_HOURS_LOCATIONS` are passed in `conditionalFields`.
1807
+ * 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`.
1808
+ * When the working hours data can't be retrieved, the entire request fails.
1809
+ * @readonly
1810
+ */
1811
+ workingHoursLocationCoverage?: WorkingHoursLocationCoverage;
1787
1812
  }
1788
1813
  interface StaffMediaItem extends StaffMediaItemItemOneOf {
1789
1814
  /** Details of the image associated with the staff, such as URL and size. */
@@ -1795,24 +1820,29 @@ interface StaffMediaItemItemOneOf {
1795
1820
  image?: string;
1796
1821
  }
1797
1822
  /**
1798
- * Working hours location coverage derived from Calendar v3 WORKING_HOURS events
1799
- * (`NONE` and `MASTER` recurrence types). The server paginates through Calendar results
1800
- * (100 events per page) until all matching events are collected.
1801
- *
1802
- * Coverage states when enrichment is requested:
1803
- * + `available_at_all_locations = true`: Staff applies to every business location. Set when the staff
1804
- * uses default business working hours, or has any WORKING_HOURS event without a location ID
1805
- * (including when mixed with location-specific events).
1806
- * + `available_at_all_locations = false` with non-empty `location_ids`: Staff has location-specific
1807
- * WORKING_HOURS only. Show the staff member only when the selected location is in `location_ids`.
1808
- * + `available_at_all_locations = false` with empty `location_ids`: Staff has working-hours schedules
1809
- * but no applicable location coverage was found.
1810
- *
1811
- * Recommended client filter:
1812
- * `availableAtAllLocations || locationIds.includes(selectedLocationId)`
1823
+ * Business locations where a staff member is available, based on their current and upcoming working hours.
1813
1824
  *
1814
- * Omitted when `STAFF_WORKING_HOURS_LOCATIONS` is not requested.
1825
+ * Coverage has 3 possible states:
1826
+ * + `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.
1827
+ * + `availableAtAllLocations` is `false` and `locationIds` isn't empty: The staff member is available at the business locations listed in `locationIds`.
1828
+ * + `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.
1829
+ * To check whether a staff member is available at a specific location, use `availableAtAllLocations || locationIds.includes(locationId)`.
1815
1830
  */
1831
+ interface WorkingHoursLocationCoverage {
1832
+ /**
1833
+ * Whether the staff member is available at every business location.
1834
+ * @readonly
1835
+ */
1836
+ availableAtAllLocations?: boolean | null;
1837
+ /**
1838
+ * IDs of the business locations where the staff member has location-specific working hours.
1839
+ * Empty when `availableAtAllLocations` is `true`.
1840
+ * @format GUID
1841
+ * @readonly
1842
+ * @maxSize 100
1843
+ */
1844
+ locationIds?: string[];
1845
+ }
1816
1846
  interface StaffMemberDetails {
1817
1847
  /**
1818
1848
  * Staff members providing the service. For appointments only.
@@ -1912,73 +1942,117 @@ interface ExtendedFields {
1912
1942
  namespaces?: Record<string, Record<string, any>>;
1913
1943
  }
1914
1944
  /**
1915
- * The SEO schema object contains data about different types of meta tags. It makes sure that the information about your page is presented properly to search engines.
1916
- * The search engines use this information for ranking purposes, or to display snippets in the search results.
1917
- * This data will override other sources of tags (for example patterns) and will be included in the <head> section of the HTML document, while not being displayed on the page itself.
1945
+ * The SEO data for a single page or dynamic item, in the shape stored today.
1946
+ *
1947
+ * FROZEN. Existing server code maps onto this message field by field, so its
1948
+ * field set must never change (see the file header). New writers use
1949
+ * `SeoSchemaV2`.
1950
+ *
1951
+ * These tags are rendered into the <head> of the HTML document and are not
1952
+ * visible on the page itself. They override every other source of tags
1953
+ * (site defaults, vertical presets, patterns) for this page.
1918
1954
  */
1919
1955
  interface SeoSchema {
1920
- /** SEO tag information. */
1956
+ /**
1957
+ * The tags rendered into <head>, in no particular order. Render order is
1958
+ * decided by the renderer, not by position in this list.
1959
+ *
1960
+ * No maxSize: this list is already populated by data written years ago, and
1961
+ * a bound added now could reject a page that is already stored.
1962
+ */
1921
1963
  tags?: Tag[];
1922
- /** SEO general settings. */
1964
+ /** Page-level SEO settings that are not themselves tags. */
1923
1965
  settings?: Settings;
1924
1966
  }
1967
+ /** A keyword term the user is targeting. */
1925
1968
  interface Keyword {
1926
- /** Keyword value. */
1969
+ /**
1970
+ * The term itself, e.g. "trail running shoes".
1971
+ *
1972
+ * No maxLength, for the same reason as the legacy tag fields: keywords are
1973
+ * already stored, and a bound added now could reject a record written
1974
+ * before the bound existed. The flynt `missing-string-validations` warning
1975
+ * on this field is accepted deliberately.
1976
+ */
1927
1977
  term?: string;
1928
- /** Whether the keyword is the main focus keyword. */
1978
+ /** Whether this is the page's primary focus keyword. At most one per page. */
1929
1979
  isMain?: boolean;
1930
1980
  /**
1931
- * The source that added the keyword terms to the SEO settings.
1981
+ * Which surface added the term, e.g. a panel or a suggestion flow. Used for
1982
+ * attribution in BI. Opaque to the renderer.
1932
1983
  * @maxLength 1000
1933
1984
  */
1934
1985
  origin?: string | null;
1935
1986
  }
1987
+ /**
1988
+ * One tag in the page's <head>.
1989
+ *
1990
+ * Not deprecated, and with no removal date, deliberately: stored data is
1991
+ * never migrated, so this shape stays valid input forever. `seo-renderer`
1992
+ * normalizes both shapes on READ.
1993
+ */
1936
1994
  interface Tag {
1937
1995
  /**
1938
- * SEO tag type.
1996
+ * Legacy. Was a free-form string: "title" | "meta" | "script" | "link".
1997
+ * The typed replacement is the `kind` oneof on `SeoSchemaV2.Tag`, which makes
1998
+ * the invalid combinations unrepresentable rather than merely discouraged.
1939
1999
  *
1940
- *
1941
- * Supported values: `title`, `meta`, `script`, `link`.
1942
- *
1943
- * Which of these an API actually accepts depends on where the tag is being set: this
1944
- * list is not a blanket guarantee across every API that reuses this message. Site SEO
1945
- * Tags in particular accepts only `meta` (see `SiteSeoTags.tags`) and rejects
1946
- * `title`/`script`/`link` with a validation error even though they appear here —
1947
- * check the field description of the specific `tags`-typed field you're writing to
1948
- * for the types it actually supports and the error it returns.
2000
+ * Which of these an API actually accepts depends on where the tag is being
2001
+ * set: this list is not a blanket guarantee across every API that reuses
2002
+ * this message. Site SEO Tags in particular accepts only `meta` (see
2003
+ * `SiteSeoTags.tags`) and rejects `title`/`script`/`link` with a validation
2004
+ * error even though they appear here — check the field description of the
2005
+ * specific `tags`-typed field you are writing to.
1949
2006
  *
1950
2007
  * Limitation: `title` and `script` (e.g. a `script` tag with `props.type`
1951
- * `"application/ld+json"` carrying structured data) are supported only when
1952
- * `custom` is unset or `false`. Setting `custom: true` on a `title` or `script`
1953
- * tag is rejected with `TAG_TYPE_NOT_ALLOWED`, because `custom: true` routes the
1954
- * write through the site's Advanced/Custom Tags list. To write structured data,
1955
- * omit `custom` (or set it to `false`).
2008
+ * "application/ld+json" carrying structured data) are supported only when
2009
+ * `custom` is unset or `false`. Setting `custom: true` on a `title` or
2010
+ * `script` tag is rejected with `TAG_TYPE_NOT_ALLOWED`, because
2011
+ * `custom: true` routes the write through the site's Advanced/Custom Tags
2012
+ * list. To write structured data, omit `custom` (or set it to `false`).
2013
+ *
2014
+ * No length limit: this field holds data written years ago by writers we
2015
+ * are not migrating. A constraint here could reject a record that is
2016
+ * already stored, which is exactly the promise this design makes.
1956
2017
  */
1957
2018
  type?: string;
1958
2019
  /**
1959
- * A `{"key": "value"}` pair object where each SEO tag property (`"name"`, `"content"`, `"rel"`, `"href"`) contains a value.
1960
- * For example: `{"name": "description", "content": "the description itself"}`.
2020
+ * Legacy. Was an untyped bag of HTML attributes.
2021
+ * Typed replacement: `SeoSchemaV2.TitleTag` / `MetaTag` / `LinkTag`.
1961
2022
  */
1962
2023
  props?: Record<string, any> | null;
1963
- /** SEO tag metadata. For example, `{"height": 300, "width": 240}`. */
2024
+ /**
2025
+ * Legacy. Was an untyped bag of 16 mixed-purpose keys. In `SeoSchemaV2`
2026
+ * its contents are split by purpose: per-page structured-data state moves to
2027
+ * StructuredDataTag, authorship to `written_by`, and render-time preset
2028
+ * logic (variants, enabledByExperiment, removeSchemaIf*) moved out of the
2029
+ * stored document entirely — it belongs to the preset definition, not to the
2030
+ * page. See the design log for the full key-by-key mapping.
2031
+ */
1964
2032
  meta?: Record<string, any> | null;
1965
- /** SEO tag inner content. For example, `<title> inner content </title>`. */
2033
+ /**
2034
+ * Legacy. Was the tag's inner content, doubling as the JSON-LD payload
2035
+ * for script tags. Typed replacement: `SeoSchemaV2.TitleTag.text` and
2036
+ * `StructuredDataTag.json_ld`.
2037
+ * No length limit, for the same reason as `type` above.
2038
+ */
1966
2039
  children?: string;
1967
2040
  /**
1968
2041
  * Whether the tag is a [custom tag](https://support.wix.com/en/article/adding-additional-meta-tags-to-your-sites-pages) —
1969
2042
  * i.e. an entry from the site's Advanced/Custom Tags list.
1970
2043
  *
1971
- * Setting this to `true` on a write restricts which `type` values are accepted
1972
- * — the same restriction the Advanced/Custom Tags UI enforces. `title` and
1973
- * `script` tags (including JSON-LD structured data) must be sent with `custom`
1974
- * omitted or `false`; sending them with `custom: true` is rejected with
1975
- * `TAG_TYPE_NOT_ALLOWED`.
2044
+ * Setting this to `true` on a write restricts which `type` values are
2045
+ * accepted — the same restriction the Advanced/Custom Tags UI enforces.
2046
+ * `title` and `script` tags (including JSON-LD structured data) must be sent
2047
+ * with `custom` omitted or `false`; sending them with `custom: true` is
2048
+ * rejected with `TAG_TYPE_NOT_ALLOWED`.
1976
2049
  *
1977
- * Note this is a separate restriction from Site SEO Tags' own type restriction on
1978
- * `SiteSeoTags.tags`: even with `custom` unset, Site SEO Tags rejects `script` (e.g.
1979
- * for site-wide structured data) unconditionally. There is currently no way to set
1980
- * site-wide, every-page structured data through any of these APIs — write a per-page
1981
- * `script` tag through the Item SEO Tags API instead.
2050
+ * Note this is a separate restriction from Site SEO Tags' own type
2051
+ * restriction on `SiteSeoTags.tags`: even with `custom` unset, Site SEO Tags
2052
+ * rejects `script` (e.g. for site-wide structured data) unconditionally.
2053
+ * There is currently no way to set site-wide, every-page structured data
2054
+ * through any of these APIs — write a per-page `script` tag through the Item
2055
+ * SEO Tags API instead.
1982
2056
  *
1983
2057
  * This flag is scoped to that feature only. It is NOT an indicator of whether a standard tag
1984
2058
  * (`title`, `description`, Open Graph, etc.) reflects a manually configured value versus a computed
@@ -1991,22 +2065,39 @@ interface Tag {
1991
2065
  * or Wix Studio pages, so even genuine Advanced/Custom Tags saved on those pages are missing from the
1992
2066
  * response entirely — there, `false` means this API could not tell, not that no custom tag exists.
1993
2067
  * Pass `seoData` explicitly to resolve against a known set of tags.
2068
+ *
2069
+ * `SeoSchemaV2.Tag` expresses this as `written_by = USER_CUSTOM`.
1994
2070
  */
1995
2071
  custom?: boolean;
1996
- /** Whether the tag is disabled. If the tag is disabled, people can't find your page when searching for this phrase in search engines. */
2072
+ /**
2073
+ * Whether the tag is excluded from the rendered <head>.
2074
+ *
2075
+ * A disabled tag is still stored, so the user can re-enable it and so a
2076
+ * pattern-provided tag stays suppressed on this page. Default false.
2077
+ */
1997
2078
  disabled?: boolean;
1998
2079
  }
2080
+ /** Page-level SEO settings that are not tags. */
1999
2081
  interface Settings {
2000
2082
  /**
2001
- * Whether the [automatical redirect visits](https://support.wix.com/en/article/customizing-your-pages-seo-settings-in-the-seo-panel) from the old URL to the new one is enabled.
2002
- *
2083
+ * Whether to suppress the automatic redirect from this page's previous URL to
2084
+ * its current one after a slug change.
2003
2085
  *
2004
- * Default: `false` (automatical redirect is enabled).
2086
+ * Default false, meaning the redirect IS created. The field is named for the
2087
+ * exception rather than the rule, which reads backwards; kept as-is because
2088
+ * renaming a stored boolean is not worth the migration.
2005
2089
  */
2006
2090
  preventAutoRedirect?: boolean;
2007
2091
  /**
2008
- * User-selected keyword terms for a specific page.
2009
- * @maxSize 5
2092
+ * Keyword terms the user is targeting for this page. Used by the SEO
2093
+ * assistant and checklist; never rendered into <head>.
2094
+ *
2095
+ * 20 is a sanity bound, not the product limit. v1 declared 5 — the number
2096
+ * the panel happens to allow today — which is exactly the mistake we are
2097
+ * fixing for structured data. A product decision to allow 8 should not need
2098
+ * a proto release, so the panel owns that number and the proto only stops
2099
+ * something absurd.
2100
+ * @maxSize 20
2010
2101
  */
2011
2102
  keywords?: Keyword[];
2012
2103
  }
@@ -2369,7 +2460,7 @@ type AddOn = {
2369
2460
  type ServicePreference = {
2370
2461
  serviceId: NonNullable<V2Slot['serviceId']>;
2371
2462
  slug?: NonNullable<Slug['name']>;
2372
- serviceType?: Service$2['type']; /** ISO local datetimes — per service (services in a bundle can start at different times). */
2463
+ serviceType?: Service['type']; /** ISO local datetimes — per service (services in a bundle can start at different times). */
2373
2464
  slotStart?: V2Slot['startDate'];
2374
2465
  slotEnd?: V2Slot['endDate'];
2375
2466
  eventId?: V2Slot['eventId'];
@@ -2397,7 +2488,7 @@ interface BookingPreferences {
2397
2488
  }
2398
2489
  //#endregion
2399
2490
  //#region src/api/adapters/service/service.d.ts
2400
- type Service$1 = Service$2;
2491
+ type Service$1 = Service;
2401
2492
  //#endregion
2402
2493
  //#region src/domains/payment-options/consts.d.ts
2403
2494
  /**
@@ -2508,140 +2599,281 @@ declare enum PurchaseFlow {
2508
2599
  type PurchaseFlowWithLiterals = PurchaseFlow | 'MANUAL' | 'ONLINE';
2509
2600
  //#endregion
2510
2601
  //#region src/domains/payment-options/from-plans.d.ts
2511
- /** A plan in eCom's catalog: Pricing Plans' own `options` carry the pricing variant. */
2602
+ /** A plan in the eCommerce catalog: the plan's `options` carry the pricing variant. */
2512
2603
  interface PlanCatalogReference {
2604
+ /** ID of the app that sells the plan. */
2513
2605
  appId: string;
2606
+ /** ID of the plan in the app's catalog. */
2514
2607
  catalogItemId: string;
2608
+ /** Plan's options, such as its pricing variant. Absent for a plan with 1 price. */
2515
2609
  options?: Options | null;
2516
2610
  }
2517
2611
  interface PlanPurchase {
2612
+ /** Plan's item in the catalog. */
2518
2613
  catalogReference: PlanCatalogReference;
2614
+ /** ID of the plan's benefit that covers the booked service. */
2519
2615
  benefitId: string;
2616
+ /** Plan's price, as a number in a string. */
2520
2617
  price: string;
2521
2618
  /** Pricing Plans' page for a plan that needs a start date or a form before purchase. */
2522
2619
  infoCollectionUrl?: string | null;
2523
2620
  }
2524
- /** What a limited plan grants, as legacy's row subtitle says it. */
2621
+ /** What a plan includes for the booked service. */
2525
2622
  interface PlanBenefit {
2526
- /** Sessions or credits granted; null when the SPI leaves it out. */
2623
+ /** Number of sessions or credits the plan includes. `null` when it isn't known. */
2527
2624
  total: number | null;
2625
+ /** Whether `total` is a number of sessions, rather than credits. */
2528
2626
  isSessionBased: boolean;
2529
- /** Credits one booking of this service costs; null for a session plan. */
2627
+ /**
2628
+ * Number of credits 1 booking of the service uses.
2629
+ *
2630
+ * `null` for a plan that counts sessions, and when it isn't known.
2631
+ */
2530
2632
  redemptionCost: number | null;
2531
2633
  }
2532
2634
  //#endregion
2533
2635
  //#region src/domains/payment-options/from-service.d.ts
2534
- type Service = Service$2;
2535
2636
  type Payment = NonNullable<Service['payment']>;
2536
2637
  type Money = NonNullable<NonNullable<Payment['fixed']>['price']>;
2537
2638
  interface MembershipRowData {
2639
+ /** ID of the membership. */
2538
2640
  membershipId: string;
2641
+ /** ID of the app the membership belongs to. */
2539
2642
  appId: string;
2643
+ /** Membership's name. */
2540
2644
  label: string;
2541
- /** `null` is unlimited, `0` is a spent plan. */
2645
+ /**
2646
+ * Number of credits or sessions left in the membership. `0` when none are left.
2647
+ *
2648
+ * `null` when the membership is unlimited.
2649
+ */
2542
2650
  creditRemain: number | null;
2651
+ /** Number of credits the booking uses from the membership. */
2543
2652
  creditCost: number;
2653
+ /** Whether the membership counts sessions instead of credits. */
2544
2654
  isSessionBased: boolean;
2655
+ /** Number of credits or sessions the membership includes. `null` when it has no total. */
2545
2656
  total: number | null;
2657
+ /** Date the membership expires. `null` when it doesn't expire. */
2546
2658
  expirationDate: string | null;
2547
2659
  }
2548
2660
  interface PaymentOption$1 {
2661
+ /** Option ID. For a membership option, the membership's ID. */
2549
2662
  id: string;
2663
+ /**
2664
+ * Kind of option. Supported values:
2665
+ * - `'ONLINE'`: Pay online.
2666
+ * - `'DEPOSIT'`: Pay a deposit online now, and the rest in person.
2667
+ * - `'FULL_AMOUNT'`: Pay the full amount online, when a deposit is also offered.
2668
+ * - `'OFFLINE'`: Pay in person.
2669
+ * - `'FREE'`: The service is free.
2670
+ * - `'CUSTOM_PRICE'`: The service has a price description instead of an amount, in `priceText`.
2671
+ * - `'MEMBERSHIP'`: Pay with a membership the visitor has, in `membership`.
2672
+ * - `'BUY_PLAN'`: Buy a plan and pay with it, in `purchasablePlan`.
2673
+ */
2550
2674
  kind: PaymentOptionKind;
2675
+ /**
2676
+ * How the option is paid. Supported values:
2677
+ * - `'ONLINE'`: Online.
2678
+ * - `'OFFLINE'`: In person, or nothing to pay online, as for a free service or a custom price.
2679
+ *
2680
+ * `null` for a membership option or a plan to buy.
2681
+ */
2551
2682
  paymentMethod: PaymentMethod | null;
2552
- /** Raw `Money`: the caller formats it with a locale. `null` for free or custom-price rows. */
2683
+ /**
2684
+ * Amount to pay with the option, with its currency. Format it for the visitor's locale before you
2685
+ * show it.
2686
+ *
2687
+ * `null` for a free service, a custom price, a membership, and a plan to buy.
2688
+ */
2553
2689
  amount: Money | null;
2554
- /** `amount` is the lowest variant price: reads "From $30". */
2690
+ /**
2691
+ * Whether `amount` is the service's lowest price, because the price depends on the visitor's
2692
+ * choices. Show it as a starting price, such as "From $30".
2693
+ */
2555
2694
  isFromPrice: boolean;
2556
- /** Discounted service amount. Payment rows keep displaying their original `amount`. */
2695
+ /**
2696
+ * Amount after the service's discount, with its currency. Show it beside `amount`, which stays
2697
+ * the price before the discount.
2698
+ *
2699
+ * `null` when there's no discount, the service doesn't have a fixed price, the option is a
2700
+ * deposit, or the option isn't a payment for the service.
2701
+ */
2557
2702
  amountAfterDiscount: Money | null;
2558
- /** Shown below the payment label, including when a discounted price is available. */
2703
+ /**
2704
+ * Name of the service's discount, to show with the option. It's set even when
2705
+ * `amountAfterDiscount` is `null`.
2706
+ *
2707
+ * `null` when the service has no discount, for `'FREE'` and `'CUSTOM_PRICE'` options, and for
2708
+ * options that aren't a payment for the service.
2709
+ */
2559
2710
  discountName: string | null;
2560
- /** Custom-price row only. */
2711
+ /**
2712
+ * Business's description of the price, for a `'CUSTOM_PRICE'` option. `null` for other kinds of
2713
+ * option.
2714
+ */
2561
2715
  priceText: string | null;
2716
+ /** Whether the visitor can't choose the option. */
2562
2717
  disabled: boolean;
2718
+ /**
2719
+ * Text that says why the visitor can't choose the option. `null` when there's none.
2720
+ *
2721
+ * A membership option that can't be chosen gives its reason in `membershipDisabledReason`
2722
+ * instead.
2723
+ */
2563
2724
  disabledReason: string | null;
2564
- membershipDisabledReason?: 'INSUFFICIENT_CREDITS' | 'MULTIPLE_PARTICIPANTS';
2725
+ /** Why the visitor can't choose a membership option. Absent when they can. */
2726
+ membershipDisabledReason?: /** The membership doesn't have enough credits or sessions left for the booking. */'INSUFFICIENT_CREDITS' /** The membership has no credit limit, and pays for 1 participant only. */ | 'MULTIPLE_PARTICIPANTS';
2727
+ /** Title of a plan to buy: the plan's name. `null` for other kinds of option. */
2565
2728
  titleText: string | null;
2729
+ /** Description of a plan to buy. `null` for other kinds of option, or when the plan has none. */
2566
2730
  detailText: string | null;
2731
+ /** Price text of a plan to buy. `null` for other kinds of option, or when the plan has none. */
2567
2732
  suffixText: string | null;
2733
+ /** Membership that pays for the booking, for a membership option. `null` for other kinds of option. */
2568
2734
  membership: MembershipRowData | null;
2735
+ /** Plan to buy, for a `'BUY_PLAN'` option. Absent for other kinds of option. */
2569
2736
  purchasablePlan?: PlanPurchase;
2570
- /** A plan to buy: what it grants, for its subtitle. */
2737
+ /**
2738
+ * What a plan to buy includes, for a `'BUY_PLAN'` option.
2739
+ *
2740
+ * `null` for a plan with no limit on how often it can be used. Absent for other kinds of option.
2741
+ */
2571
2742
  planBenefit?: PlanBenefit | null;
2572
2743
  }
2573
2744
  //#endregion
2574
2745
  //#region src/domains/payment-options/to-booking.d.ts
2575
2746
  interface SelectedMembership {
2747
+ /** ID of the visitor's membership. */
2576
2748
  membershipId: string;
2749
+ /** ID of the app the membership belongs to. */
2577
2750
  appId: string;
2578
- /** Service the plan was quoted for; other basket services must not be charged to it. */
2751
+ /**
2752
+ * ID of the service the membership pays for. It doesn't pay for other services in the selection.
2753
+ */
2579
2754
  serviceId: string;
2580
2755
  }
2581
2756
  //#endregion
2582
2757
  //#region src/api/adapters/pricing/preview-price.d.ts
2583
- /** One `participantsChoices.serviceChoices` entry of the booking. */
2758
+ /** Participants to book with 1 price choice. */
2584
2759
  interface ParticipantsServiceChoice {
2760
+ /** Number of participants to book with the price choice. */
2585
2761
  numberOfParticipants?: number;
2762
+ /**
2763
+ * Price choice to book the participants with: the participant range or the date and time rule
2764
+ * that prices them.
2765
+ */
2586
2766
  choices: Array<{
2587
- choiceId?: string;
2767
+ /** ID of the choice. */choiceId?: string; /** ID of the option the choice belongs to. */
2588
2768
  optionId?: string;
2589
2769
  }>;
2590
2770
  }
2591
2771
  /** The count's previewed price, in the service's currency: the response carries none. */
2592
2772
  interface ParticipantsPrice {
2593
- /** `calculatedPrice`: what legacy's payment summary shows and its totals line item charges. */
2773
+ /** Total price for the participants. */
2594
2774
  total: number;
2595
- /** The matched range's `pricePerParticipant`; absent unless a single range prices them all. */
2775
+ /** Price per participant. Absent unless a single price choice prices all the participants. */
2596
2776
  perParticipant?: number;
2597
2777
  }
2598
2778
  //#endregion
2599
2779
  //#region src/domains/booking-checkout/to-booking-entity.d.ts
2600
- type ServiceOptionsAndVariants = ServiceOptionsAndVariants$1;
2601
2780
  interface ContactDetailsInput {
2781
+ /** Visitor's first name. */
2602
2782
  firstName: string;
2783
+ /** Visitor's last name. */
2603
2784
  lastName: string;
2785
+ /** Visitor's email address. */
2604
2786
  email: string;
2605
- /** Omitted when invalid: eCom rejects it. */
2787
+ /**
2788
+ * Visitor's phone number. Leave it out when it isn't valid, because the cart doesn't accept it.
2789
+ */
2606
2790
  phone?: string;
2607
2791
  }
2608
2792
  type PaymentOption = BookingPaymentOption;
2609
2793
  type OfferedAddOnGroup = Pick<NonNullable<Service$1['addOnGroups']>[number], '_id' | 'addOnIds'>;
2610
2794
  interface BookingPayment {
2795
+ /**
2796
+ * How the visitor pays for the booking. Supported values:
2797
+ * - `'ONLINE'`: Online, at checkout.
2798
+ * - `'OFFLINE'`: In person.
2799
+ * - `'MEMBERSHIP'`: With a plan the visitor has, or buys in the same checkout. Set the plan in
2800
+ * `membership`, `memberships`, or `purchase`. Without one, the booking is paid online.
2801
+ */
2611
2802
  paymentOption: PaymentOption;
2612
2803
  /** Deposit (`true`) or full amount (`false`). */
2613
2804
  depositSelected: boolean | null;
2614
- /** The plan bought in the same cart that pays this entry (Plan & Book). */
2805
+ /** The plan bought in the same cart that pays this entry. */
2615
2806
  purchase?: PlanPurchase | null;
2616
2807
  }
2617
2808
  interface CreateBookingInput {
2809
+ /**
2810
+ * Visitor's contact details, for the cart and the order.
2811
+ *
2812
+ * The booking takes them only when there's no `formSubmission`, which then holds the contact.
2813
+ */
2618
2814
  contactDetails: ContactDetailsInput;
2619
- /** One per Booking Preferences entry, in order: each MSA booking pays its own way. */
2815
+ /**
2816
+ * One per entry in `selection.services`, in the same order: each booking of a multi-service
2817
+ * appointment pays its own way.
2818
+ */
2620
2819
  payments: BookingPayment[];
2820
+ /**
2821
+ * Plan the visitor pays with.
2822
+ *
2823
+ * Ignored when `memberships` is set, and for a service other than the plan's `serviceId`.
2824
+ */
2621
2825
  membership?: SelectedMembership | null;
2622
- /** Aligned to Booking Preferences, so repeated services may use different plans. */
2826
+ /**
2827
+ * One per entry in `selection.services`, in the same order, so a service selected twice can use a
2828
+ * different plan each time.
2829
+ */
2623
2830
  memberships?: Array<SelectedMembership | null>;
2831
+ /**
2832
+ * Visitor's answers to the service's booking form, by field key. Sent with the booking.
2833
+ *
2834
+ * When it's set, the booking takes the visitor's contact details from it instead of
2835
+ * `contactDetails`.
2836
+ */
2624
2837
  formSubmission?: Record<string, unknown>;
2625
- /** By service id. A service not listed books no add-ons. */
2838
+ /**
2839
+ * Add-on groups each service offers, by service ID. The booking includes only the selected
2840
+ * add-ons that one of these groups holds, so a service that isn't listed is booked with no
2841
+ * add-ons.
2842
+ */
2626
2843
  offeredAddOnGroups?: Record<string, OfferedAddOnGroup[]>;
2627
- /** By service id, as an id-less custom choice is keyed by its text, which two services can share. */
2844
+ /**
2845
+ * Options and variants of each service, by service ID. The booking uses them to book the variant
2846
+ * choices selected for a service.
2847
+ */
2628
2848
  optionsAndVariantsByService?: Record<string, ServiceOptionsAndVariants>;
2629
- /** Participants for an entry without variants; 1 when absent. Set by the checkout context. */
2849
+ /**
2850
+ * Number of participants for a service with no variant choices.
2851
+ *
2852
+ * The context sets it from `participants` when the visitor submits, so leave it out.
2853
+ *
2854
+ * Default: `1`
2855
+ */
2630
2856
  totalParticipants?: number;
2631
2857
  /**
2632
- * Rule-based pricing: the choices previewPrice returns — the range the count falls in, or the
2633
- * rule the booked slot matches — booked in place of `totalParticipants`, as legacy's previewed
2634
- * selectedVariants. Set by the checkout context.
2858
+ * Price choices to book the participants with, for a service priced by rules: the participant
2859
+ * range the number of participants falls in, or the date and time rule the booked time slot
2860
+ * matches. When it's set, the booking uses it instead of `totalParticipants`.
2861
+ *
2862
+ * The context sets it from `previewParticipants()` when the visitor submits, so leave it out.
2635
2863
  */
2636
2864
  participantsChoices?: ParticipantsServiceChoice[];
2637
- /** A service charges a cancellation fee or saves the card: only eCom's checkout page takes the card. */
2865
+ /**
2866
+ * Whether the visitor must go through the checkout page, because a service charges a cancellation
2867
+ * fee or saves the visitor's card. When it's `true`, `createBooking()` sends the visitor to the
2868
+ * checkout page even when there's nothing to pay now.
2869
+ */
2638
2870
  requiresCheckoutPage?: boolean;
2639
2871
  }
2640
2872
  //#endregion
2641
2873
  //#region src/lib/navigation.d.ts
2642
2874
  type OwnerLink = {
2643
- href: string;
2644
- target?: '_self' | '_blank';
2875
+ /** URL to go to. */href: string; /** Where the link opens. */
2876
+ target?: /** In the current tab. */'_self' /** In a new tab. The visitor stays on the page in the current tab. */ | '_blank';
2645
2877
  };
2646
2878
  //#endregion
2647
2879
  //#region src/domains/plan-and-book/flow.d.ts
@@ -2659,58 +2891,112 @@ declare const PLAN_AND_BOOK_ROUTE: {
2659
2891
  };
2660
2892
  type PlanAndBookRoute = (typeof PLAN_AND_BOOK_ROUTE)[keyof typeof PLAN_AND_BOOK_ROUTE];
2661
2893
  interface PlanAndBookFlow {
2894
+ /**
2895
+ * Call to action the submit button shows. Supported values:
2896
+ * - `'BOOK'`: Book the selection.
2897
+ * - `'BUY_PLAN_AND_BOOK'`: Buy a plan and book with it, in the same checkout.
2898
+ * - `'BUY_PLAN'`: Buy a plan first. The visitor comes back to book.
2899
+ */
2662
2900
  cta: PlanAndBookCta;
2901
+ /**
2902
+ * Where `createBooking()` sends the visitor. Supported values:
2903
+ * - `'CHECKOUT'`: The checkout page, or the Thank You page when there's nothing to pay now.
2904
+ * - `'INLINE_CART'`: The checkout page, with the plan and the bookings in the same cart.
2905
+ * - `'DETAILS_PAGE'`: A page that collects what the plan needs before purchase, such as a start
2906
+ * date, then the checkout page.
2907
+ * - `'PRICING_PLANS'`: A page to buy the plan. Nothing is booked.
2908
+ */
2663
2909
  route: PlanAndBookRoute;
2664
2910
  }
2665
2911
  //#endregion
2666
2912
  //#region src/domains/booking-checkout/checkout-error.d.ts
2667
- /** A failed Book or Add to Cart, read off the backend's applicationError. */
2913
+ /** Why a `createBooking()` or `addToCart()` call failed. */
2668
2914
  interface CheckoutError {
2669
- /** applicationError.code, or UNKNOWN_CHECKOUT_ERROR without one. */
2915
+ /** Error code from the server, such as `'SLOT_NOT_AVAILABLE'`, or `'UNKNOWN'` without one. */
2670
2916
  code: string;
2671
- /** The first violation's text, which eCom sends with VIOLATIONS_WITH_ERROR_SEVERITY. */
2917
+ /** The first violation's text, sent with the `'VIOLATIONS_WITH_ERROR_SEVERITY'` code. */
2672
2918
  violation?: string;
2673
2919
  }
2674
2920
  //#endregion
2675
2921
  //#region src/extensions/contexts/booking-checkout-context/use-booking-checkout.d.ts
2676
2922
  interface BookingFormHandle {
2677
- /** The selection overlaps a cart appointment of the same staff member. */
2923
+ /**
2924
+ * Whether the selection overlaps an appointment with the same staff member in the visitor's cart.
2925
+ */
2678
2926
  hasCartConflict?: boolean;
2679
- /** Shows errors inline; resolves false when the form can't be submitted. */
2927
+ /**
2928
+ * Validates the form and shows any errors in it.
2929
+ *
2930
+ * The context calls it when the visitor submits, before it creates anything.
2931
+ *
2932
+ * @returns `true` when the form can be submitted.
2933
+ */
2680
2934
  validate: () => Promise<boolean>;
2935
+ /**
2936
+ * Returns the visitor's booking details: their contact details, how they pay, and their answers
2937
+ * to the form.
2938
+ *
2939
+ * The context calls it when the visitor submits, after `validate()` resolves `true`.
2940
+ *
2941
+ * @returns Details to create the booking with.
2942
+ */
2681
2943
  getInput: () => CreateBookingInput;
2682
2944
  /**
2683
- * Rule-based pricing only: the choices to book — the range the count falls in, or the rule the
2684
- * booked slot matches — as legacy previews them. Null books the plain count.
2945
+ * Retrieves the price choices to book a number of participants with, for a service priced by
2946
+ * rules: the participant range the number falls in, or the date and time rule the booked time
2947
+ * slot matches. Leave it out for other services.
2948
+ *
2949
+ * The context calls it when the visitor submits a booking of 1 service.
2950
+ *
2951
+ * @param count Number of participants to price.
2952
+ * @returns Price choices to book the participants with, or `null` to book the number of
2953
+ * participants without them.
2685
2954
  */
2686
2955
  previewParticipants?: (count: number) => Promise<ParticipantsServiceChoice[] | null>;
2687
- /** The form's BI defaults under the legacy click-next (659) fields, read at click time. Never throws. */
2956
+ /**
2957
+ * Returns the form's analytics parameters, which the context reports when the visitor submits.
2958
+ *
2959
+ * When it throws, the context reports the submit without them.
2960
+ *
2961
+ * @returns Parameters to add to the submit's analytics event, by parameter name.
2962
+ */
2688
2963
  getBiParams?: () => Record<string, unknown>;
2689
2964
  }
2690
2965
  /** What the Booking Form tells the widgets beside it, once it is usable and the cart is read. */
2691
2966
  interface FormFacts {
2692
2967
  /** How the visitor pays each booked service. */
2693
2968
  payments: {
2694
- serviceId: string | null;
2695
- paymentOption: BookingPaymentOption;
2969
+ /** ID of the booked service, or `null` when it isn't known. */serviceId: string | null;
2970
+ /**
2971
+ * How the visitor pays for the service. Supported values:
2972
+ * - `'ONLINE'`: Online.
2973
+ * - `'OFFLINE'`: In person.
2974
+ * - `'MEMBERSHIP'`: With a plan.
2975
+ */
2976
+ paymentOption: BookingPaymentOption; /** Whether the service has a price above 0. */
2696
2977
  hasPrice: boolean;
2697
2978
  }[];
2698
- /** Bookings lines only, as in OOI's `isServiceInCart`. */
2979
+ /** Whether the visitor's cart holds bookings. Other items in the cart don't count. */
2699
2980
  hasBookingsInCart: boolean;
2700
- /** Rule-based pricing only: the previewed price of the picked count and slot. */
2981
+ /**
2982
+ * Price of the selected number of participants and time slot, for a service priced by rules, such
2983
+ * as by the number of participants. Absent for other services.
2984
+ */
2701
2985
  participantsPrice?: PreviewedParticipantsPrice;
2702
2986
  }
2703
2987
  /** `failed` too when the preview has no price; `count` is the count it prices. */
2704
2988
  type PreviewedParticipantsPrice = {
2705
- status: 'loading';
2989
+ /** The price is loading. */status: 'loading';
2706
2990
  } | {
2707
- status: 'failed';
2991
+ /** The preview failed or returned no price. */status: 'failed';
2708
2992
  } | ({
2709
- status: 'loaded';
2993
+ /** The price is loaded. */status: 'loaded'; /** Number of participants the price is for. */
2710
2994
  count: number;
2711
2995
  } & ParticipantsPrice);
2712
2996
  interface BookingCheckoutResult {
2997
+ /** IDs of the bookings created. */
2713
2998
  bookingIds: string[];
2999
+ /** ID of the cart that holds the bookings. */
2714
3000
  cartId: string;
2715
3001
  }
2716
3002
  /** Where addToCart() sends the visitor once the items are in the cart. `stay` leaves them on the page. */
@@ -2720,56 +3006,364 @@ type AddToCartDestination = 'cart' | 'home' | 'stay' | OwnerLink;
2720
3006
  * form is invalid, a run is in flight or the selection changed before it failed.
2721
3007
  */
2722
3008
  type AddToCartOutcome = {
2723
- error: CheckoutError;
3009
+ /** Why adding the bookings to the cart failed. */error: CheckoutError;
2724
3010
  } | {
2725
- bookingIds: string[];
3011
+ /** IDs of the bookings added to the cart. */bookingIds: string[];
3012
+ /**
3013
+ * Whether the visitor is being sent to another page. `false` when they stay on this page,
3014
+ * such as with `'stay'`, a link that opens in a new tab, or the side cart.
3015
+ */
2726
3016
  leavesPage: boolean;
2727
3017
  } | null;
2728
3018
  /** The failure, for the clicked button to show; null when nothing failed, nothing ran or the selection changed before it failed. */
2729
3019
  type CreateBookingOutcome = {
2730
- error: CheckoutError;
3020
+ /** Why creating the booking failed. */error: CheckoutError;
2731
3021
  } | null;
2732
3022
  interface BookingCheckoutState {
2733
- /** Null when the page has no usable `b=`. */
3023
+ /**
3024
+ * Booking preferences from the page URL's `b` query parameter: the services the visitor selected,
3025
+ * with their time slots and choices.
3026
+ *
3027
+ * `null` when the URL has no booking preferences, or they hold no service.
3028
+ */
2734
3029
  selection: BookingPreferences | null;
2735
- /** Every entry passes canBookSelection and a booking form is registered. */
3030
+ /** Whether every service in the selection can be booked and a booking form is registered. */
2736
3031
  canBook: boolean;
2737
- /** The button the visitor sees and where createBooking sends them, from the selected rows. */
3032
+ /**
3033
+ * What the submit button offers and where `createBooking()` sends the visitor, based on the
3034
+ * payment options in `selectedPaymentOptions`.
3035
+ */
2738
3036
  planAndBookFlow: PlanAndBookFlow;
2739
- /** Null without resolved payment choices for the current selection. */
3037
+ /**
3038
+ * Payment option the visitor chose for each booked service, as the booking form published them
3039
+ * with `registerPaymentOptions()`.
3040
+ *
3041
+ * `null` until the form publishes them for the current selection, and while they load.
3042
+ */
2740
3043
  selectedPaymentOptions: Array<PaymentOption$1 | null> | null;
3044
+ /**
3045
+ * Whether the booking form is loading the payment options for the current selection.
3046
+ *
3047
+ * While it's `true`, `selectedPaymentOptions` is `null`.
3048
+ */
2741
3049
  isLoadingPaymentOptions: boolean;
2742
- /** Publish prices independently of form validation; null means payment options are loading. */
3050
+ /**
3051
+ * Publishes the payment option the visitor chose for each booked service. It doesn't wait for
3052
+ * the form to be valid.
3053
+ *
3054
+ * It sets `selectedPaymentOptions` and `planAndBookFlow`. Options published for an earlier
3055
+ * selection don't apply: when the selection changes, `selectedPaymentOptions` is `null` until
3056
+ * the form publishes again.
3057
+ *
3058
+ * @param options Payment option the visitor chose for each booked service, with `null` for a
3059
+ * service with none chosen. Pass `null` while the options are loading, which sets
3060
+ * `isLoadingPaymentOptions` to `true`.
3061
+ * @param isPlanAndBookBlocked Whether a plan the visitor buys must be bought before booking,
3062
+ * instead of in the same checkout as the booking. When it's `true` and an option buys a plan,
3063
+ * `planAndBookFlow` sends the visitor to buy the plan first. Set it to `true` when a service
3064
+ * charges a cancellation fee or saves the visitor's card, or when more than 1 participant is
3065
+ * booked.
3066
+ * @returns Function that clears these payment options, unless a later call replaced them. Call it
3067
+ * when your component unmounts.
3068
+ * @example Publish the visitor's payment choices
3069
+ * ```tsx
3070
+ * import { useEffect } from 'react';
3071
+ * import { useBookingCheckoutContext } from '@wix/bookings/context/booking-checkout';
3072
+ *
3073
+ * // useMyPaymentChoices() and MyPaymentChoices are your own hook and component.
3074
+ * // isPlanAndBookBlocked is true when a service charges a cancellation fee or saves the
3075
+ * // visitor's card, or when more than 1 participant is booked.
3076
+ * function PaymentChoices() {
3077
+ * const { registerPaymentOptions } = useBookingCheckoutContext();
3078
+ * const { chosenOptions, isLoading, isPlanAndBookBlocked } = useMyPaymentChoices();
3079
+ *
3080
+ * useEffect(
3081
+ * () => registerPaymentOptions(isLoading ? null : chosenOptions, isPlanAndBookBlocked),
3082
+ * [registerPaymentOptions, chosenOptions, isLoading, isPlanAndBookBlocked],
3083
+ * );
3084
+ *
3085
+ * return <MyPaymentChoices />;
3086
+ * }
3087
+ * ```
3088
+ */
2743
3089
  registerPaymentOptions: (options: Array<PaymentOption$1 | null> | null, isPlanAndBookBlocked: boolean) => () => void;
2744
- /** From the registered form. */
3090
+ /**
3091
+ * Whether the selection overlaps an appointment with the same staff member in the visitor's cart,
3092
+ * as the registered form reports it. While it's `true`, `addToCart()` does nothing.
3093
+ *
3094
+ * `false` while no form is registered.
3095
+ */
2745
3096
  hasCartConflict: boolean;
2746
- /** The form registers on mount and passes null on unmount. */
3097
+ /**
3098
+ * Registers the booking form that `createBooking()` and `addToCart()` submit. Register the form
3099
+ * when it mounts, and pass `null` when it unmounts.
3100
+ *
3101
+ * `createBooking()` and `addToCart()` validate the registered form and read the visitor's
3102
+ * details from it. While no form is registered, `canBook` is `false` and both do nothing.
3103
+ * Registering a form replaces the one registered before.
3104
+ *
3105
+ * `hasCartConflict` is read from the form when it's registered, so register the form again when
3106
+ * its `hasCartConflict` changes.
3107
+ *
3108
+ * @param form Form to register, or `null` to remove the registered form.
3109
+ * @example Register a contact form
3110
+ * ```tsx
3111
+ * import { useEffect, useRef, useState } from 'react';
3112
+ * import { useBookingCheckoutContext } from '@wix/bookings/context/booking-checkout';
3113
+ *
3114
+ * // MyContactFields is your own component for the contact fields.
3115
+ * function ContactForm() {
3116
+ * const { selection, registerForm } = useBookingCheckoutContext();
3117
+ * const [contact, setContact] = useState({ firstName: '', lastName: '', email: '' });
3118
+ * const latest = useRef({ contact, selection });
3119
+ * latest.current = { contact, selection };
3120
+ *
3121
+ * useEffect(() => {
3122
+ * registerForm({
3123
+ * validate: async () => latest.current.contact.email.includes('@'),
3124
+ * getInput: () => ({
3125
+ * contactDetails: latest.current.contact,
3126
+ * payments: (latest.current.selection?.services ?? []).map(() => ({
3127
+ * paymentOption: 'OFFLINE',
3128
+ * depositSelected: null,
3129
+ * })),
3130
+ * }),
3131
+ * });
3132
+ * return () => registerForm(null);
3133
+ * }, [registerForm]);
3134
+ *
3135
+ * return <MyContactFields value={contact} onChange={setContact} />;
3136
+ * }
3137
+ * ```
3138
+ */
2747
3139
  registerForm: (form: BookingFormHandle | null) => void;
2748
- /** Published by the form; null until it is usable. */
3140
+ /**
3141
+ * Facts the booking form published with `publishFormFacts()` for the widgets beside it, such as
3142
+ * how the visitor pays for each booked service.
3143
+ *
3144
+ * `null` until the form publishes them, and after it clears them.
3145
+ */
2749
3146
  formFacts: FormFacts | null;
2750
- /** The form publishes its facts for the widgets beside it (Booking Summary); null on unmount. */
3147
+ /**
3148
+ * Publishes the booking form's facts for the widgets beside it, such as a booking summary. Pass
3149
+ * `null` when the form unmounts.
3150
+ *
3151
+ * It sets `formFacts`. Facts equal to the current ones leave `formFacts` unchanged, so the form
3152
+ * can publish on every render.
3153
+ *
3154
+ * `createBooking()` reads the published payments to decide whether a visitor who wants to enter
3155
+ * a promo code goes through the checkout page.
3156
+ *
3157
+ * @param facts Facts to publish, or `null` to clear `formFacts`.
3158
+ * @example Publish the form's facts once it's ready
3159
+ * ```tsx
3160
+ * import { useEffect } from 'react';
3161
+ * import { useBookingCheckoutContext } from '@wix/bookings/context/booking-checkout';
3162
+ *
3163
+ * // useMyFormState() and MyFormFields are your own hook and form fields.
3164
+ * function MyBookingForm() {
3165
+ * const { publishFormFacts } = useBookingCheckoutContext();
3166
+ * const { isReady, payments, hasBookingsInCart } = useMyFormState();
3167
+ *
3168
+ * useEffect(() => {
3169
+ * publishFormFacts(isReady ? { payments, hasBookingsInCart } : null);
3170
+ * }, [publishFormFacts, isReady, payments, hasBookingsInCart]);
3171
+ * useEffect(() => () => publishFormFacts(null), [publishFormFacts]);
3172
+ *
3173
+ * return <MyFormFields />;
3174
+ * }
3175
+ * ```
3176
+ */
2751
3177
  publishFormFacts: (facts: FormFacts | null) => void;
2752
- /** The form shows legacy's empty state in place of itself, so Book and Add to Cart hide, as legacy's did with it. */
3178
+ /** Whether the booking form shows an empty state instead of its fields. Hide Book and Add to Cart buttons while it's `true`. */
2753
3179
  isFormEmptyState: boolean;
2754
- /** The form publishes it while its empty state shows; false on unmount. */
3180
+ /**
3181
+ * Publishes whether the booking form shows its empty state instead of its fields. Pass `false`
3182
+ * when the form unmounts.
3183
+ *
3184
+ * It sets `isFormEmptyState`.
3185
+ *
3186
+ * @param isEmptyState Whether the form shows its empty state instead of its fields.
3187
+ * @example Show an empty state when nothing is selected
3188
+ * ```tsx
3189
+ * import { useEffect } from 'react';
3190
+ * import { useBookingCheckoutContext } from '@wix/bookings/context/booking-checkout';
3191
+ *
3192
+ * // MyBookingFields is your own form component.
3193
+ * function BookingDetailsForm() {
3194
+ * const { selection, publishFormEmptyState } = useBookingCheckoutContext();
3195
+ * const isEmpty = selection === null;
3196
+ *
3197
+ * useEffect(() => {
3198
+ * publishFormEmptyState(isEmpty);
3199
+ * return () => publishFormEmptyState(false);
3200
+ * }, [isEmpty, publishFormEmptyState]);
3201
+ *
3202
+ * return isEmpty ? <p>Choose a service to book.</p> : <MyBookingFields />;
3203
+ * }
3204
+ * ```
3205
+ */
2755
3206
  publishFormEmptyState: (isEmptyState: boolean) => void;
2756
- /** Validates, creates the booking(s) and cart, then places the order or goes to checkout. One run at a time. */
3207
+ /**
3208
+ * Validates the registered form, creates the bookings and a cart for them, and then either places
3209
+ * the order or sends the visitor to the checkout page.
3210
+ *
3211
+ * When a plan has to be bought first, as `planAndBookFlow` says, it sends the visitor to buy the
3212
+ * plan instead. Only 1 `createBooking()` or `addToCart()` call runs at a time.
3213
+ *
3214
+ * @returns An object with the failure in `error` when creating the booking fails. The same
3215
+ * failure is in `createError`.
3216
+ *
3217
+ * `null` in all other cases:
3218
+ * - The visitor is sent to the next page: the checkout page, the Thank You page, a page that
3219
+ * collects a plan's details, or a page to buy a plan.
3220
+ * - Nothing runs, because `canBook` is `false`, the form isn't valid, or another
3221
+ * `createBooking()` or `addToCart()` call is in progress.
3222
+ * - The selection or the participant count changed before the call failed.
3223
+ * @example Add a Book button that shows failures
3224
+ * ```tsx
3225
+ * import { useBookingCheckoutContext } from '@wix/bookings/context/booking-checkout';
3226
+ *
3227
+ * function BookButton() {
3228
+ * const { canBook, isCreating, createBooking, createError } = useBookingCheckoutContext();
3229
+ *
3230
+ * return (
3231
+ * <div>
3232
+ * <button disabled={!canBook || isCreating} onClick={() => createBooking()}>
3233
+ * {isCreating ? 'Booking...' : 'Book now'}
3234
+ * </button>
3235
+ * {createError && <p role="alert">We couldn't book this. Try again.</p>}
3236
+ * </div>
3237
+ * );
3238
+ * }
3239
+ * ```
3240
+ */
2757
3241
  createBooking: () => Promise<CreateBookingOutcome>;
2758
- /** Stays true on success while the checkout or thank-you page loads. */
3242
+ /**
3243
+ * Whether a `createBooking()` call is creating the booking. It turns `true` once the form is
3244
+ * valid, and stays `true` after a successful call while the next page loads.
3245
+ *
3246
+ * When the visitor goes to a page to buy a plan, it turns `false` again after the call starts
3247
+ * the navigation, before that page loads.
3248
+ */
2759
3249
  isCreating: boolean;
2760
- /** The last failure; cleared by the next Book or Add to Cart, a changed selection or participant count. */
3250
+ /**
3251
+ * Why the last `createBooking()` call failed.
3252
+ *
3253
+ * `null` when it didn't fail. The next `createBooking()` or `addToCart()` call clears it, and so
3254
+ * does a change to the selection or to the number of participants.
3255
+ */
2761
3256
  createError: CheckoutError | null;
2762
- /** Validates the form, creates the booking(s), adds them to the visitor's current cart and goes to `destination` (the cart page by default). Shares the guard with createBooking. */
3257
+ /**
3258
+ * Validates the registered form, creates the bookings, adds them to the visitor's current cart,
3259
+ * and sends the visitor to `destination`.
3260
+ *
3261
+ * Only 1 `addToCart()` or `createBooking()` call runs at a time.
3262
+ *
3263
+ * @param destination Where to send the visitor once the bookings are in the cart. Supported
3264
+ * values:
3265
+ * - `'cart'`: The site's Cart page. When the site has no Cart page, the side cart opens over this
3266
+ * page if the site has one, and the visitor stays on this page.
3267
+ * - `'home'`: The site's home page.
3268
+ * - `'stay'`: The visitor stays on this page.
3269
+ * - A link object: The link's `href`, in a new tab when its `target` is `'_blank'`.
3270
+ *
3271
+ * Default: `'cart'`
3272
+ * @returns An object with the IDs of the bookings added to the cart and `leavesPage`, when the
3273
+ * bookings are added. An object with the failure in `error` when adding them fails, with the same
3274
+ * failure in `addToCartError`. When the cart already holds bookings at a different business
3275
+ * location, the failure's `code` is `'CART_IS_ALREADY_ASSOCIATED_WITH_DIFFERENT_LOCATION'` and
3276
+ * nothing is booked.
3277
+ *
3278
+ * `null` when nothing runs because `canBook` is `false`, the form has a cart conflict,
3279
+ * `planAndBookFlow.cta` isn't `'BOOK'`, the form isn't valid, or another `createBooking()` or
3280
+ * `addToCart()` call is in progress. Also `null` when the selection or the participant count
3281
+ * changed before the call failed.
3282
+ * @example Add the booking to the cart and keep the visitor on the page
3283
+ * ```tsx
3284
+ * import { useState } from 'react';
3285
+ * import { useBookingCheckoutContext } from '@wix/bookings/context/booking-checkout';
3286
+ *
3287
+ * function AddToCartButton() {
3288
+ * const { canBook, hasCartConflict, isAddingToCart, addToCart } = useBookingCheckoutContext();
3289
+ * const [isAdded, setIsAdded] = useState(false);
3290
+ *
3291
+ * const handleClick = async () => {
3292
+ * const outcome = await addToCart('stay');
3293
+ * setIsAdded(outcome !== null && 'bookingIds' in outcome);
3294
+ * };
3295
+ *
3296
+ * return (
3297
+ * <div>
3298
+ * <button disabled={!canBook || hasCartConflict || isAddingToCart} onClick={handleClick}>
3299
+ * Add to cart
3300
+ * </button>
3301
+ * {isAdded && <p>Added to your cart.</p>}
3302
+ * </div>
3303
+ * );
3304
+ * }
3305
+ * ```
3306
+ */
2763
3307
  addToCart: (destination?: AddToCartDestination) => Promise<AddToCartOutcome>;
2764
- /** True from the click until a failure or a `stay`; stays true on success while the next page loads. */
3308
+ /**
3309
+ * Whether an `addToCart()` call is adding the bookings to the cart. It turns `true` once the form
3310
+ * is valid, and stays `true` after a successful call while the visitor goes to another page.
3311
+ *
3312
+ * `false` again after a failure, and after a successful call that leaves the visitor on this
3313
+ * page, such as with the `'stay'` destination.
3314
+ */
2765
3315
  isAddingToCart: boolean;
2766
- /** As createError, for Add to Cart. */
3316
+ /**
3317
+ * Why the last `addToCart()` call failed.
3318
+ *
3319
+ * `null` when it didn't fail. The next `createBooking()` or `addToCart()` call clears it, and so
3320
+ * does a change to the selection or to the number of participants.
3321
+ */
2767
3322
  addToCartError: CheckoutError | null;
2768
- /** Participants for a single service without variants; 1 by default. Booked as totalParticipants. */
3323
+ /**
3324
+ * Number of participants to book when the selected service's variants don't set the count, such
3325
+ * as a single service with no variants.
3326
+ *
3327
+ * Default: `1`
3328
+ */
2769
3329
  participants: number;
2770
- /** Takes an integer of at least 1 (anything else books 1). Uncapped: as legacy, a max that drops later leaves it. */
3330
+ /**
3331
+ * Sets the number of participants to book, in `participants`.
3332
+ *
3333
+ * A count that isn't a number of at least 1 sets 1, and a fraction is rounded down. The count
3334
+ * isn't capped, and it stays as set when a limit, such as the slot's open spots, drops later.
3335
+ *
3336
+ * Changing the count clears `createError` and `addToCartError`.
3337
+ *
3338
+ * @param count Number of participants.
3339
+ * @example Add a participants field
3340
+ * ```tsx
3341
+ * import { useBookingCheckoutContext } from '@wix/bookings/context/booking-checkout';
3342
+ *
3343
+ * function ParticipantsField() {
3344
+ * const { participants, setParticipants } = useBookingCheckoutContext();
3345
+ *
3346
+ * return (
3347
+ * <label>
3348
+ * Participants
3349
+ * <input
3350
+ * type="number"
3351
+ * min={1}
3352
+ * value={participants}
3353
+ * onChange={(event) => setParticipants(Number(event.target.value))}
3354
+ * />
3355
+ * </label>
3356
+ * );
3357
+ * }
3358
+ * ```
3359
+ */
2771
3360
  setParticipants: (count: number) => void;
2772
- /** For QA in the console. */
3361
+ /**
3362
+ * IDs of the bookings and the cart from the last `createBooking()` or `addToCart()` call that put
3363
+ * the bookings in a cart.
3364
+ *
3365
+ * `null` before such a call.
3366
+ */
2773
3367
  lastResult: BookingCheckoutResult | null;
2774
3368
  }
2775
3369
  declare function canBookSelection(selection: BookingPreferences | null): boolean;
@@ -2779,9 +3373,22 @@ declare function canBookSelection(selection: BookingPreferences | null): boolean
2779
3373
  type BookingCheckoutContextValue = BookingCheckoutState;
2780
3374
  declare const bookingCheckoutContext: React.Context<BookingCheckoutState | null>;
2781
3375
  declare const BOOKING_CHECKOUT_CONTEXT_MISSING_PROVIDER_ERROR = "useBookingCheckoutContext must be used within BookingCheckoutContextProvider";
2782
- /** Reads the booking checkout state; returns null instead of throwing when `optional` is true and no provider is above. */
3376
+ /**
3377
+ * The `useBookingCheckoutContext()` hook provides access to the booking a visitor is about to make,
3378
+ * including the services and times they selected, how they pay, and the number of participants. Use
3379
+ * it to send the booking to checkout, add it to the visitor's cart, and connect a booking form to
3380
+ * the buttons and summary beside it. When you pass `true` to the hook, it returns `null` where the
3381
+ * context isn't available.
3382
+ */
2783
3383
  declare function useBookingCheckoutContext(optional: true): BookingCheckoutContextValue | null;
2784
- /** Reads the booking checkout state; throws when no BookingCheckoutContextProvider is above. */
3384
+ /**
3385
+ * The `useBookingCheckoutContext()` hook provides access to the booking a visitor is about to make,
3386
+ * including the services and times they selected, how they pay, and the number of participants. Use
3387
+ * it to send the booking to checkout, add it to the visitor's cart, and connect a booking form to
3388
+ * the buttons and summary beside it.
3389
+ *
3390
+ * It throws an error where the context isn't available.
3391
+ */
2785
3392
  declare function useBookingCheckoutContext(optional?: false): BookingCheckoutContextValue;
2786
3393
  /** Props accepted by {@link BookingCheckoutContextProvider}. */
2787
3394
  interface BookingCheckoutContextProviderProps {