@wix/bookings 1.0.1776 → 1.0.1778

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/build/cjs/context-booking-checkout.d.ts +243 -108
  2. package/build/cjs/context-booking-checkout.js +177 -183
  3. package/build/cjs/context-booking-checkout.js.map +1 -1
  4. package/build/cjs/context-categories.d.ts +16 -143
  5. package/build/cjs/context-categories.js +412 -412
  6. package/build/cjs/context-categories.js.map +1 -1
  7. package/build/cjs/context-locations.d.ts +16 -287
  8. package/build/cjs/context-locations.js +336 -336
  9. package/build/cjs/context-locations.js.map +1 -1
  10. package/build/cjs/context-service-addons.d.ts +2 -2
  11. package/build/cjs/context-service-addons.js +1 -1
  12. package/build/cjs/context-service-addons.js.map +1 -1
  13. package/build/cjs/context-service.d.ts +71 -33
  14. package/build/cjs/context-service.js +98 -96
  15. package/build/cjs/context-service.js.map +1 -1
  16. package/build/cjs/context-services.js +1 -1
  17. package/build/cjs/context-services.js.map +1 -1
  18. package/build/cjs/context-time-slots.d.ts +10 -0
  19. package/build/cjs/context-time-slots.js +2 -2
  20. package/build/cjs/context-time-slots.js.map +1 -1
  21. package/build/es/context-booking-checkout.d.mts +243 -108
  22. package/build/es/context-booking-checkout.mjs +177 -180
  23. package/build/es/context-booking-checkout.mjs.map +1 -1
  24. package/build/es/context-categories.d.mts +16 -143
  25. package/build/es/context-categories.mjs +412 -412
  26. package/build/es/context-categories.mjs.map +1 -1
  27. package/build/es/context-locations.d.mts +16 -287
  28. package/build/es/context-locations.mjs +336 -336
  29. package/build/es/context-locations.mjs.map +1 -1
  30. package/build/es/context-service-addons.d.mts +2 -2
  31. package/build/es/context-service-addons.mjs +1 -1
  32. package/build/es/context-service-addons.mjs.map +1 -1
  33. package/build/es/context-service.d.mts +71 -33
  34. package/build/es/context-service.mjs +98 -96
  35. package/build/es/context-service.mjs.map +1 -1
  36. package/build/es/context-services.mjs +1 -1
  37. package/build/es/context-services.mjs.map +1 -1
  38. package/build/es/context-time-slots.d.mts +10 -0
  39. package/build/es/context-time-slots.mjs +2 -2
  40. package/build/es/context-time-slots.mjs.map +1 -1
  41. package/build/internal/cjs/context-booking-checkout.d.ts +243 -108
  42. package/build/internal/cjs/context-categories.d.ts +16 -143
  43. package/build/internal/cjs/context-locations.d.ts +16 -287
  44. package/build/internal/cjs/context-service-addons.d.ts +2 -2
  45. package/build/internal/cjs/context-service.d.ts +71 -33
  46. package/build/internal/cjs/context-time-slots.d.ts +10 -0
  47. package/build/internal/es/context-booking-checkout.d.mts +243 -108
  48. package/build/internal/es/context-categories.d.mts +16 -143
  49. package/build/internal/es/context-locations.d.mts +16 -287
  50. package/build/internal/es/context-service-addons.d.mts +2 -2
  51. package/build/internal/es/context-service.d.mts +71 -33
  52. package/build/internal/es/context-time-slots.d.mts +10 -0
  53. package/{_sdk-exports → context-runtime}/context-booking-checkout/runtime.d.ts +243 -108
  54. package/context-runtime/context-booking-checkout/runtime.js +3 -0
  55. package/{_sdk-exports → context-runtime}/context-categories/runtime.d.ts +16 -143
  56. package/context-runtime/context-categories/runtime.js +2 -0
  57. package/context-runtime/context-locations/runtime.d.ts +195 -0
  58. package/context-runtime/context-locations/runtime.js +2 -0
  59. package/{_sdk-exports → context-runtime}/context-service/runtime.d.ts +71 -33
  60. package/{_sdk-exports → context-runtime}/context-service/runtime.js +3 -3
  61. package/{_sdk-exports → context-runtime}/context-service-addons/runtime.d.ts +2 -2
  62. package/{_sdk-exports → context-runtime}/context-time-slots/runtime.d.ts +10 -0
  63. package/{_sdk-exports → context-runtime}/context-time-slots/runtime.js +2 -2
  64. package/package.json +8 -8
  65. package/_sdk-exports/context-booking-checkout/runtime.js +0 -3
  66. package/_sdk-exports/context-categories/runtime.js +0 -2
  67. package/_sdk-exports/context-locations/runtime.d.ts +0 -466
  68. package/_sdk-exports/context-locations/runtime.js +0 -2
  69. /package/{_sdk-exports → context-runtime}/context-service-addons/runtime.js +0 -0
  70. /package/{_sdk-exports → context-runtime}/context-services/runtime.d.ts +0 -0
  71. /package/{_sdk-exports → context-runtime}/context-services/runtime.js +0 -0
@@ -1,93 +1,5 @@
1
1
  import React, { ReactNode } from 'react';
2
2
 
3
- //#region ../../node_modules/type-fest/source/observable-like.d.ts
4
- declare global {
5
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
6
- interface SymbolConstructor {
7
- readonly observable: symbol;
8
- }
9
- }
10
- /**
11
- @remarks
12
- The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
13
- As well, some guidance on making an `Observable` to not include `closed` property.
14
- @see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130
15
- @see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85
16
- @see https://github.com/benlesh/symbol-observable#making-an-object-observable
17
-
18
- @category Observable
19
- */
20
- //#endregion
21
- //#region ../../node_modules/@wix/sdk-types/internal/build/index.d.ts
22
- declare global {
23
- interface ContextualClient {}
24
- }
25
- /**
26
- * Creates concrete types from SDK descriptors when a contextual client is
27
- * available.
28
- *
29
- * For a REST descriptor the built (bound) API is intersected with the original
30
- * descriptor, matching what `contextualizeRESTModuleV2` returns at runtime — a
31
- * value callable as the bound API and still usable as a descriptor. Keeping the
32
- * descriptor half lets contextual modules be passed to descriptor-constrained
33
- * helpers such as `elevate` from `@wix/sdk/context` (FEDINF-14092).
34
- *
35
- * The `& T` is scoped to REST descriptors — the only shape codegen wraps in
36
- * `MaybeContext` — so `BuildDescriptors` (used by `createClient().use`) is left
37
- * unchanged and stays bound-only. The fix lives here rather than in `elevate`,
38
- * which is kept strict on purpose (see #941) so it still rejects bound-only
39
- * functions that are unsafe through `createRESTModule`.
40
- */
41
- declare global {
42
- /**
43
- * A global interface to set the exposure toggle for the SDK.
44
- * @example
45
- * ```ts
46
- * declare global {
47
- * interface SDKExposureToggle {
48
- * alpha: true;
49
- * }
50
- * }
51
- */
52
- interface SDKExposureToggle {}
53
- }
54
- declare global {
55
- /**
56
- * A global interface to set the type mode for the SDK.
57
- * @example
58
- * ```ts
59
- * declare global {
60
- * interface SDKTypeMode {
61
- * strict: true;
62
- * }
63
- * }
64
- */
65
- interface SDKTypeMode {}
66
- }
67
- //#endregion
68
- //#region ../../node_modules/@wix/auto_sdk_bookings_services/build/es/bookings-services-v2-service-services.universal-p5eQUd5f.d.mts
69
- interface V2Category {
70
- /**
71
- * Category ID.
72
- * @format GUID
73
- */
74
- _id?: string;
75
- /**
76
- * Category name.
77
- * @maxLength 500
78
- * @readonly
79
- */
80
- name?: string | null;
81
- /**
82
- * Order of a category within a category list.
83
- * @readonly
84
- */
85
- sortOrder?: number | null;
86
- }
87
- //#endregion
88
- //#region src/api/adapters/category/category.d.ts
89
- type Category = V2Category;
90
- //#endregion
91
3
  //#region src/lib/picker-filter.d.ts
92
4
  /** One field of a panel filter backed by an Items Selection provider (`$in`, or `$eq` after an operator switch). */
93
5
  interface PickerRule {
@@ -117,14 +29,18 @@ interface CategoryItem {
117
29
  /**
118
30
  * Whether the category is selected, meaning its ID is in the page URL's `category` query
119
31
  * parameter.
32
+ *
33
+ * Use it to mark the selected option in a category filter. When no item is selected, no
34
+ * category is selected, such as for an "All services" option.
120
35
  */
121
36
  isSelected: boolean;
122
37
  }
123
38
  /** The business service categories, the selected category, the loading and error state, and the actions to change or reload them. */
124
39
  interface CategoriesContextValue {
125
40
  /**
126
- * Service categories, sorted by their sort order. Each category holds its details, such as its
127
- * ID, name, and sort order. To manage categories, use the
41
+ * Service categories, each with its ID, name, and whether it's selected, sorted by their sort
42
+ * order. Use them to render a list of categories that site visitors select from. To manage
43
+ * categories, use the
128
44
  * [Categories V2
129
45
  * API](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/categories-v2/introduction).
130
46
  *
@@ -132,50 +48,10 @@ interface CategoriesContextValue {
132
48
  * categories, it holds only the picked categories.
133
49
  *
134
50
  * Empty while the categories load, and when they fail to load.
135
- *
136
- * Don't change the array or its items, for example by sorting the array in place. Every
137
- * component that uses the context gets the same array.
138
- */
139
- categories: Category[];
140
- /**
141
- * Service categories as list items, each with its ID, name, and whether it's selected. Use them
142
- * to render a list of categories that site visitors select from.
143
- *
144
- * Holds the same categories as `categories`, in the same order.
145
51
  */
146
52
  categoryItems: CategoryItem[];
147
53
  /**
148
- * ID of the selected category, from the page URL's `category` query parameter.
149
- *
150
- * It already holds the URL's category while the categories load, before `categories` fills. It
151
- * can hold an ID that isn't in `categories`, such as an ID from an outdated link.
152
- * `selectedCategory` is then `null`.
153
- *
154
- * `null` when no category is selected.
155
- */
156
- selectedCategoryId: string | null;
157
- /**
158
- * Position of the selected category in `categories`, starting at `0`.
159
- *
160
- * `-1` when no category is selected, when `selectedCategoryId` isn't in `categories`, and while
161
- * the categories load.
162
- */
163
- selectedCategoryIndex: number;
164
- /**
165
- * Selected category, with its details, such as its ID, name, and sort order.
166
- *
167
- * `null` when no category is selected, when `selectedCategoryId` isn't in `categories`, and
168
- * while the categories load.
169
- */
170
- selectedCategory: Category | null;
171
- /**
172
- * Name of the selected category.
173
- *
174
- * `null` when `selectedCategory` is `null`, or when the category has no name.
175
- */
176
- selectedCategoryName: string | null;
177
- /**
178
- * Whether `categories` holds multiple categories with an ID. Use it to hide a category filter
54
+ * Whether `categoryItems` holds multiple categories with an ID. Use it to hide a category filter
179
55
  * when there's nothing to choose between.
180
56
  *
181
57
  * `false` while the categories load, and when they fail to load.
@@ -185,14 +61,14 @@ interface CategoriesContextValue {
185
61
  * Whether the categories are loading. It's `true` during the first load, and while `refetch()`
186
62
  * reloads them.
187
63
  *
188
- * While it's `true`, `categories` and `categoryItems` are empty, and `selectCategory()` does
64
+ * While it's `true`, `categoryItems` is empty, and `selectCategory()` does
189
65
  * nothing.
190
66
  */
191
67
  isLoading: boolean;
192
68
  /**
193
69
  * Whether the categories failed to load.
194
70
  *
195
- * When it's `true`, `categories` and `categoryItems` are empty. To try again, call `refetch()`.
71
+ * When it's `true`, `categoryItems` is empty. To try again, call `refetch()`.
196
72
  *
197
73
  * It's also `true`, with the same empty values, after a component under the context fails to
198
74
  * render. Then it stays `true` until the page reloads: `refetch()` doesn't clear it, and
@@ -202,7 +78,7 @@ interface CategoriesContextValue {
202
78
  /**
203
79
  * Reloads the service categories.
204
80
  *
205
- * While they reload, `isLoading` is `true`, and `categories` and `categoryItems` are empty. The
81
+ * While they reload, `isLoading` is `true`, and `categoryItems` is empty. The
206
82
  * selected category doesn't change.
207
83
  *
208
84
  * Use it to try again after the categories fail to load, when `hasError` is `true`. It doesn't
@@ -232,16 +108,15 @@ interface CategoriesContextValue {
232
108
  /**
233
109
  * Selects a category, or clears the selection.
234
110
  *
235
- * Selecting a category sets the page URL's `category` query parameter, which updates
236
- * `selectedCategoryId` and the other properties about the selected category. When it changes
237
- * the selection, `selectCategory()`:
111
+ * Selecting a category sets the page URL's `category` query parameter, which updates each
112
+ * item's `isSelected`. When it changes the selection, `selectCategory()`:
238
113
  * - Adds an entry to the browser history, so the browser's Back button returns to the previous
239
114
  * selection.
240
115
  * - Removes the URL's `page` query parameter, so a list of services on the page starts again
241
116
  * from its first page.
242
117
  * - Keeps the page's scroll position.
243
118
  *
244
- * It doesn't check that the ID is in `categories`.
119
+ * It doesn't check that the ID is in `categoryItems`.
245
120
  *
246
121
  * Does nothing while `isLoading` is `true`.
247
122
  *
@@ -253,11 +128,12 @@ interface CategoriesContextValue {
253
128
  * import { useCategoriesContext } from '@wix/bookings/context/categories';
254
129
  *
255
130
  * function CategoryDropdown() {
256
- * const { categoryItems, selectedCategoryId, selectCategory } = useCategoriesContext();
131
+ * const { categoryItems, selectCategory } = useCategoriesContext();
132
+ * const selected = categoryItems.find((item) => item.isSelected);
257
133
  *
258
134
  * return (
259
135
  * <select
260
- * value={selectedCategoryId ?? ''}
136
+ * value={selected?.categoryId ?? ''}
261
137
  * onChange={(event) => selectCategory(event.target.value || null)}
262
138
  * >
263
139
  * <option value="">All services</option>
@@ -277,8 +153,6 @@ interface CategoriesContextValue {
277
153
  }
278
154
  /** Props accepted by {@link CategoriesContextProvider}. */
279
155
  interface CategoriesContextProviderProps {
280
- /** Selected on load when the page URL names no category. */
281
- initialCategoryId?: string;
282
156
  /** Shows only the picked categories. */
283
157
  categoriesPicker?: CategoriesPickerFilter;
284
158
  /** Bumped by the editor bundle on realtime data-changes; non-zero refetches, bypassing warmup. */
@@ -297,7 +171,6 @@ declare const CATEGORIES_CONTEXT_MISSING_PROVIDER_ERROR = "useCategoriesContext
297
171
  declare function useCategoriesContext(): CategoriesContextValue;
298
172
  /** Loads the business service categories and tracks the selected category in the page URL. */
299
173
  declare function CategoriesContextProvider({
300
- initialCategoryId,
301
174
  categoriesPicker,
302
175
  refreshSignal,
303
176
  children
@@ -1,246 +1,5 @@
1
1
  import React, { ReactNode } from 'react';
2
2
 
3
- //#region ../../node_modules/type-fest/source/observable-like.d.ts
4
- declare global {
5
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
6
- interface SymbolConstructor {
7
- readonly observable: symbol;
8
- }
9
- }
10
- /**
11
- @remarks
12
- The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
13
- As well, some guidance on making an `Observable` to not include `closed` property.
14
- @see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130
15
- @see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85
16
- @see https://github.com/benlesh/symbol-observable#making-an-object-observable
17
-
18
- @category Observable
19
- */
20
- //#endregion
21
- //#region ../../node_modules/@wix/sdk-types/internal/build/index.d.ts
22
- declare global {
23
- interface ContextualClient {}
24
- }
25
- /**
26
- * Creates concrete types from SDK descriptors when a contextual client is
27
- * available.
28
- *
29
- * For a REST descriptor the built (bound) API is intersected with the original
30
- * descriptor, matching what `contextualizeRESTModuleV2` returns at runtime — a
31
- * value callable as the bound API and still usable as a descriptor. Keeping the
32
- * descriptor half lets contextual modules be passed to descriptor-constrained
33
- * helpers such as `elevate` from `@wix/sdk/context` (FEDINF-14092).
34
- *
35
- * The `& T` is scoped to REST descriptors — the only shape codegen wraps in
36
- * `MaybeContext` — so `BuildDescriptors` (used by `createClient().use`) is left
37
- * unchanged and stays bound-only. The fix lives here rather than in `elevate`,
38
- * which is kept strict on purpose (see #941) so it still rejects bound-only
39
- * functions that are unsafe through `createRESTModule`.
40
- */
41
- declare global {
42
- /**
43
- * A global interface to set the exposure toggle for the SDK.
44
- * @example
45
- * ```ts
46
- * declare global {
47
- * interface SDKExposureToggle {
48
- * alpha: true;
49
- * }
50
- * }
51
- */
52
- interface SDKExposureToggle {}
53
- }
54
- declare global {
55
- /**
56
- * A global interface to set the type mode for the SDK.
57
- * @example
58
- * ```ts
59
- * declare global {
60
- * interface SDKTypeMode {
61
- * strict: true;
62
- * }
63
- * }
64
- */
65
- interface SDKTypeMode {}
66
- }
67
- //#endregion
68
- //#region ../../node_modules/@wix/auto_sdk_bookings_services/build/es/bookings-services-v2-service-services.universal-p5eQUd5f.d.mts
69
- interface V2Location extends V2LocationOptionsOneOf {
70
- /** Information about business locations. Required when `type` is `BUSINESS`. */
71
- business?: BusinessLocationOptions;
72
- /** Information about custom locations. Required when `type` is `CUSTOM`. */
73
- custom?: CustomLocationOptions;
74
- /**
75
- * Location ID.
76
- * @format GUID
77
- * @readonly
78
- */
79
- _id?: string;
80
- /**
81
- * Location type.
82
- *
83
- * Default: `CUSTOM`
84
- */
85
- type?: LocationTypeEnumLocationTypeWithLiterals;
86
- /**
87
- * Location address. Empty for `{"type": "CUSTOMER"}`.
88
- * @readonly
89
- */
90
- calculatedAddress?: CommonAddress;
91
- }
92
- /** @oneof */
93
- interface V2LocationOptionsOneOf {
94
- /** Information about business locations. Required when `type` is `BUSINESS`. */
95
- business?: BusinessLocationOptions;
96
- /** Information about custom locations. Required when `type` is `CUSTOM`. */
97
- custom?: CustomLocationOptions;
98
- }
99
- declare enum LocationTypeEnumLocationType {
100
- /** Location set by the business that is not a standard business [location](https://dev.wix.com/docs/api-reference/business-management/locations/introduction). */
101
- CUSTOM = "CUSTOM",
102
- /** Business [location](https://dev.wix.com/docs/api-reference/business-management/locations/introduction). */
103
- BUSINESS = "BUSINESS",
104
- /**
105
- * The customer specifies any address when booking. Available only for
106
- * appointment-based services.
107
- */
108
- CUSTOMER = "CUSTOMER"
109
- }
110
- /** @enumType */
111
- type LocationTypeEnumLocationTypeWithLiterals = LocationTypeEnumLocationType | 'CUSTOM' | 'BUSINESS' | 'CUSTOMER';
112
- interface CommonAddress extends CommonAddressStreetOneOf {
113
- /** Street name and number. */
114
- streetAddress?: CommonStreetAddress;
115
- /** @maxLength 255 */
116
- addressLine1?: string | null;
117
- /**
118
- * 2-letter country code in an [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format.
119
- * @format COUNTRY
120
- */
121
- country?: string | null;
122
- /**
123
- * Code for a subdivision (such as state, prefecture, or province) in [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) format.
124
- * @maxLength 255
125
- */
126
- subdivision?: string | null;
127
- /**
128
- * City name.
129
- * @maxLength 255
130
- */
131
- city?: string | null;
132
- /**
133
- * Postal or zip code.
134
- * @maxLength 255
135
- */
136
- postalCode?: string | null;
137
- /**
138
- * Full address of the location.
139
- * @maxLength 512
140
- */
141
- formatted?: string | null;
142
- }
143
- /** @oneof */
144
- interface CommonAddressStreetOneOf {
145
- /** Street name and number. */
146
- streetAddress?: CommonStreetAddress;
147
- /** @maxLength 255 */
148
- addressLine?: string | null;
149
- }
150
- /** Street address. Includes street name, number, and apartment number in separate fields. */
151
- interface CommonStreetAddress {
152
- /**
153
- * Street number.
154
- * @maxLength 255
155
- */
156
- number?: string;
157
- /**
158
- * Street name.
159
- * @maxLength 255
160
- */
161
- name?: string;
162
- /**
163
- * Apartment number.
164
- * @maxLength 255
165
- */
166
- apt?: string;
167
- }
168
- interface BusinessLocationOptions {
169
- /**
170
- * ID of the business [location](https://dev.wix.com/docs/api-reference/business-management/locations/introduction).
171
- * When setting a business location, specify only the location ID. Other location details are overwritten.
172
- * @format GUID
173
- */
174
- _id?: string;
175
- /**
176
- * Business location name.
177
- * @readonly
178
- * @maxLength 150
179
- */
180
- name?: string;
181
- /**
182
- * Whether this is the default location. There can only be a single default location per site.
183
- * @readonly
184
- */
185
- default?: boolean | null;
186
- /**
187
- * Business location address.
188
- * @readonly
189
- */
190
- address?: CommonAddress;
191
- /**
192
- * Business location email.
193
- * @format EMAIL
194
- * @readonly
195
- */
196
- email?: string | null;
197
- /**
198
- * Business location phone.
199
- * @format PHONE
200
- * @readonly
201
- */
202
- phone?: string | null;
203
- }
204
- interface CustomLocationOptions {
205
- /**
206
- * ID of the custom location.
207
- * @format GUID
208
- * @readonly
209
- */
210
- _id?: string;
211
- /** Address of the custom location. */
212
- address?: CommonAddress;
213
- }
214
- /**
215
- * `BookingPolicy` is the main entity of `BookingPolicyService` and specifies a set of rules for booking a service
216
- * by visitors and members.
217
- *
218
- * Each `BookingPolicy` consists of a number of sub-policies. When the Bookings App is provisioned to a meta site then a
219
- * default `BookingPolicy` will be created with defaults for each of these sub-policies. This also applies when a request
220
- * is received to create a new `BookingPolicy` and one or more of these sub-policies are not provided.
221
- *
222
- * Sub-policies are defined in separate objects as specified below.
223
- *
224
- * - The `LimitEarlyBookingPolicy` object defines the policy for limiting early bookings.
225
- * - The `LimitLateBookingPolicy` object defines the policy for limiting late bookings.
226
- * - The `BookAfterStartPolicy` object defines the policy for booking after the start of the schedule.
227
- * - The `CancellationPolicy` object defines the policy for canceling a booked entity.
228
- * - The `ReschedulePolicy` object defines the policy for rescheduling booked entity.
229
- * - The `WaitlistPolicy` object defines the policy for a waitlist.
230
- * - The `ParticipantsPolicy` object defines the policy regarding the participants per booking.
231
- * - The `ResourcesPolicy` object defines the policy regarding the resources per booking.
232
- * - The `CancellationFeePolicy` object defines the policy regarding cancellation fees.
233
- * - The `SaveCreditCardPolicy` object defines the policy for saving credit card details.
234
- *
235
- * By default each sub-policy is disabled. A more detailed specification of the default settings of each sub-policy
236
- * can be found in the description of the corresponding object.
237
- *
238
- * Partial updates are supported on the main entity level, however in order to update a sub-policy the client needs to provide the whole sub-policy object.
239
- */
240
- //#endregion
241
- //#region src/api/adapters/location/location.d.ts
242
- type BusinessLocation = V2Location;
243
- //#endregion
244
3
  //#region src/extensions/contexts/locations-context/locations-context.d.ts
245
4
  /** A business location as shown in a location list, with its selected state. */
246
5
  interface LocationItem {
@@ -270,18 +29,8 @@ interface LocationItem {
270
29
  interface LocationsContextValue {
271
30
  /**
272
31
  * Business locations where the site's visible Wix Bookings services take place, sorted by name.
273
- *
274
- * Each item is a service location object from the
275
- * [Services V2
276
- * API](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction).
277
- * Its `business` field holds the location's ID and name. To render a list of the locations, use
278
- * `locationItems`, which holds the same locations in the same order.
279
- *
280
- * Empty while `isLoading` is `true`, and when the locations fail to load.
281
- */
282
- locations: BusinessLocation[];
283
- /**
284
- * Locations to list, an item for each location in `locations`, in the same order.
32
+ * Each item holds the location's ID, name, and whether it's selected. Use them to render a list
33
+ * of locations that site visitors select from.
285
34
  *
286
35
  * Empty while `isLoading` is `true`, and when the locations fail to load.
287
36
  */
@@ -289,35 +38,18 @@ interface LocationsContextValue {
289
38
  /**
290
39
  * ID of the selected location, from the `location` query parameter in the page URL.
291
40
  *
292
- * When the page opens with the parameter, it's set right away, even while `isLoading` is
293
- * `true`. It changes after each call to `selectLocation()`. It isn't checked against
294
- * `locations`, so it can be an ID that matches no location. It's `'OTHER_LOCATIONS'` when the
41
+ * Use it to mark the selected option in a location filter. It's `'OTHER_LOCATIONS'` when the
295
42
  * services at custom addresses or at customers' locations are selected, as `hasOtherLocations`
296
- * describes.
43
+ * describes. That option has no item in `locationItems`.
44
+ *
45
+ * When the page opens with the parameter, it's set right away, even while `isLoading` is
46
+ * `true`. It changes after each call to `selectLocation()`. When the parameter holds an ID the
47
+ * business doesn't have, such as from an outdated link, the context removes it from the URL
48
+ * after the locations load.
297
49
  *
298
50
  * `null` when no location is selected.
299
51
  */
300
52
  selectedLocationId: string | null;
301
- /**
302
- * Index in `locations` of the selected location.
303
- *
304
- * `-1` when no location in `locations` is selected. For example, when no location is selected,
305
- * when `'OTHER_LOCATIONS'` is selected, or while `isLoading` is `true`.
306
- */
307
- selectedLocationIndex: number;
308
- /**
309
- * Item in `locations` whose ID is `selectedLocationId`.
310
- *
311
- * `null` when no location in `locations` is selected. For example, when no location is
312
- * selected, when `'OTHER_LOCATIONS'` is selected, or while `isLoading` is `true`.
313
- */
314
- selectedLocation: BusinessLocation | null;
315
- /**
316
- * Name of the selected location.
317
- *
318
- * `null` when `selectedLocation` is `null`, or when the location has no name.
319
- */
320
- selectedLocationName: string | null;
321
53
  /**
322
54
  * Whether any of the site's visible Wix Bookings services takes place at a custom address or at
323
55
  * the customer's location.
@@ -331,7 +63,7 @@ interface LocationsContextValue {
331
63
  /**
332
64
  * Whether site visitors have more than 1 location to choose from.
333
65
  *
334
- * `true` when there are at least 2 choices: each location in `locations` that has an ID, plus
66
+ * `true` when there are at least 2 choices: each item in `locationItems` that has an ID, plus
335
67
  * 1 more when `hasOtherLocations` is `true`. Use it to hide a location filter that has
336
68
  * nothing to filter.
337
69
  *
@@ -342,15 +74,15 @@ interface LocationsContextValue {
342
74
  * Whether the locations are loading.
343
75
  *
344
76
  * `true` while the locations load when the page opens, and while `refetch()` loads them again.
345
- * Meanwhile, `locations` and `locationItems` are empty, the values that depend on them are
346
- * `null`, `false`, or `-1`, and `selectLocation()` does nothing. `selectedLocationId` already
77
+ * Meanwhile, `locationItems` is empty, `hasOtherLocations` and `hasMultipleLocations` are
78
+ * `false`, and `selectLocation()` does nothing. `selectedLocationId` already
347
79
  * holds the location from the page URL.
348
80
  */
349
81
  isLoading: boolean;
350
82
  /**
351
83
  * Whether the locations failed to load.
352
84
  *
353
- * When it's `true`, `isLoading` is `false`, `locations` and `locationItems` are empty, and
85
+ * When it's `true`, `isLoading` is `false`, `locationItems` is empty, and
354
86
  * `hasOtherLocations` and `hasMultipleLocations` are `false`. To try again, call `refetch()`.
355
87
  *
356
88
  * It's also `true`, with the same empty values, after a component under the context fails to
@@ -361,7 +93,7 @@ interface LocationsContextValue {
361
93
  /**
362
94
  * Loads the locations again.
363
95
  *
364
- * While they load, `isLoading` is `true`, `locations` and `locationItems` are empty, and
96
+ * While they load, `isLoading` is `true`, `locationItems` is empty, and
365
97
  * `selectLocation()` does nothing. The selected location stays the same, because it's kept in
366
98
  * the page URL.
367
99
  *
@@ -395,14 +127,14 @@ interface LocationsContextValue {
395
127
  * It sets the `location` query parameter in the page URL and keeps the URL's other parameters,
396
128
  * except `page`, which it removes so a paged list starts again from its first page. It adds an
397
129
  * entry to the browser history and doesn't scroll to the top of the page. `selectedLocationId`
398
- * and the other selection values then update. A Services context on the same page reads the
130
+ * and each item's `isSelected` then update. A Services context on the same page reads the
399
131
  * same parameter, so it lists the services at the new selection.
400
132
  *
401
133
  * Does nothing while `isLoading` is `true`, or after a component under the context fails to
402
134
  * render.
403
135
  *
404
136
  * @param locationId - ID of the location to select, such as an item's `locationId` from
405
- * `locationItems`. It isn't checked against `locations`.
137
+ * `locationItems`. It isn't checked against `locationItems`.
406
138
  *
407
139
  * To select the services at a custom address or at the customer's location, pass
408
140
  * `'OTHER_LOCATIONS'`. Offer that option only when `hasOtherLocations` is `true`.
@@ -442,8 +174,6 @@ interface LocationsContextValue {
442
174
  }
443
175
  /** Props accepted by {@link LocationsContextProvider}. */
444
176
  interface LocationsContextProviderProps {
445
- /** Selected on load when the page URL names no location. */
446
- initialLocationId?: string;
447
177
  children: ReactNode;
448
178
  }
449
179
  declare const locationsContext: React.Context<LocationsContextValue | null>;
@@ -459,7 +189,6 @@ declare const LOCATIONS_CONTEXT_MISSING_PROVIDER_ERROR = "useLocationsContext mu
459
189
  declare function useLocationsContext(): LocationsContextValue;
460
190
  /** Loads the business locations that host bookable services, checks for services at other locations, and tracks the selected location in the page URL. */
461
191
  declare function LocationsContextProvider({
462
- initialLocationId,
463
192
  children
464
193
  }: LocationsContextProviderProps): React.JSX.Element;
465
194
 
@@ -201,9 +201,9 @@ interface AddOnGroupDetail {
201
201
  }
202
202
  //#endregion
203
203
  //#region ../bookings-flow-data/dist/types.d.ts
204
- /** A chosen add-on with its quantity — maps SDK `BookedAddOn` fields to flow names (`id` ↔ `_id`). */
204
+ /** An add-on the visitor chose, with its quantity. */
205
205
  type AddOn$1 = {
206
- id: NonNullable<BookedAddOn['_id']>;
206
+ /** ID of the add-on. */id: NonNullable<BookedAddOn['_id']>; /** Number of the add-on to book. */
207
207
  quantity: NonNullable<BookedAddOn['quantity']>;
208
208
  };
209
209
  //#endregion