@wix/bookings 1.0.1741 → 1.0.1743

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 (78) hide show
  1. package/_sdk-exports/context-booking-checkout-context/runtime.d.ts +2784 -0
  2. package/_sdk-exports/context-booking-checkout-context/runtime.js +2 -0
  3. package/_sdk-exports/context-categories-context/runtime.d.ts +144 -0
  4. package/_sdk-exports/context-categories-context/runtime.js +1 -0
  5. package/_sdk-exports/context-locations-context/runtime.d.ts +282 -0
  6. package/_sdk-exports/context-locations-context/runtime.js +1 -0
  7. package/_sdk-exports/context-service-addons-context/runtime.d.ts +264 -0
  8. package/_sdk-exports/context-service-addons-context/runtime.js +1 -0
  9. package/_sdk-exports/context-service-context/runtime.d.ts +3667 -0
  10. package/_sdk-exports/context-service-context/runtime.js +2 -0
  11. package/_sdk-exports/context-services-context/runtime.d.ts +2863 -0
  12. package/_sdk-exports/context-services-context/runtime.js +2 -0
  13. package/_sdk-exports/context-time-slots-context/runtime.d.ts +660 -0
  14. package/_sdk-exports/context-time-slots-context/runtime.js +2 -0
  15. package/build/cjs/context-booking-checkout-context.d.ts +2784 -0
  16. package/build/cjs/context-booking-checkout-context.js +3940 -0
  17. package/build/cjs/context-booking-checkout-context.js.map +1 -0
  18. package/build/cjs/context-categories-context.d.ts +144 -0
  19. package/build/cjs/context-categories-context.js +1188 -0
  20. package/build/cjs/context-categories-context.js.map +1 -0
  21. package/build/cjs/context-locations-context.d.ts +282 -0
  22. package/build/cjs/context-locations-context.js +1252 -0
  23. package/build/cjs/context-locations-context.js.map +1 -0
  24. package/build/cjs/context-service-addons-context.d.ts +264 -0
  25. package/build/cjs/context-service-addons-context.js +1324 -0
  26. package/build/cjs/context-service-addons-context.js.map +1 -0
  27. package/build/cjs/context-service-context.d.ts +3667 -0
  28. package/build/cjs/context-service-context.js +5336 -0
  29. package/build/cjs/context-service-context.js.map +1 -0
  30. package/build/cjs/context-services-context.d.ts +2863 -0
  31. package/build/cjs/context-services-context.js +2203 -0
  32. package/build/cjs/context-services-context.js.map +1 -0
  33. package/build/cjs/context-time-slots-context.d.ts +660 -0
  34. package/build/cjs/context-time-slots-context.js +2822 -0
  35. package/build/cjs/context-time-slots-context.js.map +1 -0
  36. package/build/es/context-booking-checkout-context.d.mts +2784 -0
  37. package/build/es/context-booking-checkout-context.mjs +3898 -0
  38. package/build/es/context-booking-checkout-context.mjs.map +1 -0
  39. package/build/es/context-categories-context.d.mts +144 -0
  40. package/build/es/context-categories-context.mjs +1157 -0
  41. package/build/es/context-categories-context.mjs.map +1 -0
  42. package/build/es/context-locations-context.d.mts +282 -0
  43. package/build/es/context-locations-context.mjs +1221 -0
  44. package/build/es/context-locations-context.mjs.map +1 -0
  45. package/build/es/context-service-addons-context.d.mts +264 -0
  46. package/build/es/context-service-addons-context.mjs +1294 -0
  47. package/build/es/context-service-addons-context.mjs.map +1 -0
  48. package/build/es/context-service-context.d.mts +3667 -0
  49. package/build/es/context-service-context.mjs +5304 -0
  50. package/build/es/context-service-context.mjs.map +1 -0
  51. package/build/es/context-services-context.d.mts +2863 -0
  52. package/build/es/context-services-context.mjs +2172 -0
  53. package/build/es/context-services-context.mjs.map +1 -0
  54. package/build/es/context-time-slots-context.d.mts +660 -0
  55. package/build/es/context-time-slots-context.mjs +2792 -0
  56. package/build/es/context-time-slots-context.mjs.map +1 -0
  57. package/build/internal/cjs/context-booking-checkout-context.d.ts +2784 -0
  58. package/build/internal/cjs/context-categories-context.d.ts +144 -0
  59. package/build/internal/cjs/context-locations-context.d.ts +282 -0
  60. package/build/internal/cjs/context-service-addons-context.d.ts +264 -0
  61. package/build/internal/cjs/context-service-context.d.ts +3667 -0
  62. package/build/internal/cjs/context-services-context.d.ts +2863 -0
  63. package/build/internal/cjs/context-time-slots-context.d.ts +660 -0
  64. package/build/internal/es/context-booking-checkout-context.d.mts +2784 -0
  65. package/build/internal/es/context-categories-context.d.mts +144 -0
  66. package/build/internal/es/context-locations-context.d.mts +282 -0
  67. package/build/internal/es/context-service-addons-context.d.mts +264 -0
  68. package/build/internal/es/context-service-context.d.mts +3667 -0
  69. package/build/internal/es/context-services-context.d.mts +2863 -0
  70. package/build/internal/es/context-time-slots-context.d.mts +660 -0
  71. package/context/booking-checkout-context/package.json +3 -0
  72. package/context/categories-context/package.json +3 -0
  73. package/context/locations-context/package.json +3 -0
  74. package/context/service-addons-context/package.json +3 -0
  75. package/context/service-context/package.json +3 -0
  76. package/context/services-context/package.json +3 -0
  77. package/context/time-slots-context/package.json +3 -0
  78. package/package.json +69 -8
@@ -0,0 +1,144 @@
1
+ import React, { ReactNode } from 'react';
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-Bf4TC5aj.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
+ //#region src/lib/picker-filter.d.ts
92
+ /** One field of a panel filter backed by an Items Selection provider (`$in`, or `$eq` after an operator switch). */
93
+ interface PickerRule {
94
+ $in?: string[];
95
+ $eq?: string;
96
+ }
97
+ interface CategoriesPickerFilter {
98
+ categoryId?: PickerRule;
99
+ }
100
+ //#endregion
101
+ //#region src/extensions/contexts/categories-context/categories-context.d.ts
102
+ /** A service category as shown in a category list, with its selected state. */
103
+ interface CategoryItem {
104
+ categoryId: string | null;
105
+ categoryName: string | null;
106
+ isSelected: boolean;
107
+ }
108
+ /** The business service categories, the selected category, the loading and error state, and the actions to change or reload them. */
109
+ interface CategoriesContextValue {
110
+ categories: Category[];
111
+ categoryItems: CategoryItem[];
112
+ selectedCategoryId: string | null;
113
+ selectedCategoryIndex: number;
114
+ selectedCategory: Category | null;
115
+ selectedCategoryName: string | null;
116
+ hasMultipleCategories: boolean;
117
+ isLoading: boolean;
118
+ hasError: boolean;
119
+ refetch: () => void;
120
+ selectCategory: (categoryId: string | null) => void;
121
+ }
122
+ /** Props accepted by {@link CategoriesContextProvider}. */
123
+ interface CategoriesContextProviderProps {
124
+ /** Selected on load when the page URL names no category. */
125
+ initialCategoryId?: string;
126
+ /** Shows only the picked categories. */
127
+ categoriesPicker?: CategoriesPickerFilter;
128
+ /** Bumped by the editor bundle on realtime data-changes; non-zero refetches, bypassing warmup. */
129
+ refreshSignal?: number;
130
+ children: ReactNode;
131
+ }
132
+ declare const categoriesContext: React.Context<CategoriesContextValue | null>;
133
+ declare const CATEGORIES_CONTEXT_MISSING_PROVIDER_ERROR = "useCategoriesContext must be used within CategoriesContextProvider";
134
+ /** Reads the categories state; throws when no CategoriesContextProvider is above. */
135
+ declare function useCategoriesContext(): CategoriesContextValue;
136
+ /** Loads the business service categories and tracks the selected category in the page URL. */
137
+ declare function CategoriesContextProvider({
138
+ initialCategoryId,
139
+ categoriesPicker,
140
+ refreshSignal,
141
+ children
142
+ }: CategoriesContextProviderProps): React.JSX.Element;
143
+
144
+ export { CATEGORIES_CONTEXT_MISSING_PROVIDER_ERROR, CategoriesContextProvider, type CategoriesContextProviderProps, type CategoriesContextValue, type CategoryItem, categoriesContext, CategoriesContextProvider as default, useCategoriesContext };
@@ -0,0 +1,282 @@
1
+ import React, { ReactNode } from 'react';
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-Bf4TC5aj.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
+ //#region src/extensions/contexts/locations-context/locations-context.d.ts
245
+ /** A business location as shown in a location list, with its selected state. */
246
+ interface LocationItem {
247
+ locationId: string | null;
248
+ locationName: string | null;
249
+ isSelected: boolean;
250
+ }
251
+ /** The bookable business locations, whether services also run at other locations, the selected location, the loading and error state, and the actions to change or reload them. */
252
+ interface LocationsContextValue {
253
+ locations: BusinessLocation[];
254
+ locationItems: LocationItem[];
255
+ selectedLocationId: string | null;
256
+ selectedLocationIndex: number;
257
+ selectedLocation: BusinessLocation | null;
258
+ selectedLocationName: string | null;
259
+ hasOtherLocations: boolean;
260
+ hasMultipleLocations: boolean;
261
+ isLoading: boolean;
262
+ hasError: boolean;
263
+ refetch: () => void;
264
+ selectLocation: (locationId: string | null) => void;
265
+ }
266
+ /** Props accepted by {@link LocationsContextProvider}. */
267
+ interface LocationsContextProviderProps {
268
+ /** Selected on load when the page URL names no location. */
269
+ initialLocationId?: string;
270
+ children: ReactNode;
271
+ }
272
+ declare const locationsContext: React.Context<LocationsContextValue | null>;
273
+ declare const LOCATIONS_CONTEXT_MISSING_PROVIDER_ERROR = "useLocationsContext must be used within LocationsContextProvider";
274
+ /** Reads the locations state; throws when no LocationsContextProvider is above. */
275
+ declare function useLocationsContext(): LocationsContextValue;
276
+ /** Loads the business locations that host bookable services, checks for services at other locations, and tracks the selected location in the page URL. */
277
+ declare function LocationsContextProvider({
278
+ initialLocationId,
279
+ children
280
+ }: LocationsContextProviderProps): React.JSX.Element;
281
+
282
+ export { LOCATIONS_CONTEXT_MISSING_PROVIDER_ERROR, type LocationItem, LocationsContextProvider, type LocationsContextProviderProps, type LocationsContextValue, LocationsContextProvider as default, locationsContext, useLocationsContext };
@@ -0,0 +1,264 @@
1
+ import React, { ReactNode } from 'react';
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-Bf4TC5aj.d.mts
69
+ /**
70
+ * Money.
71
+ * Default format to use. Sufficiently compliant with majority of standards: w3c, ISO 4217, ISO 20022, ISO 8583:2003.
72
+ */
73
+ interface Money {
74
+ /**
75
+ * Monetary amount. Decimal string with a period as a decimal separator. For example `25.05`.
76
+ * @format DECIMAL_VALUE
77
+ * @decimalValue options { gt:0, maxScale:2 }
78
+ */
79
+ value?: string;
80
+ /**
81
+ * Currency code in [ISO 4217 format](https://en.wikipedia.org/wiki/ISO_4217). For example, `USD`.
82
+ * @format CURRENCY
83
+ * @readonly
84
+ */
85
+ currency?: string;
86
+ /**
87
+ * Monetary amount. Decimal string in local format. For example, `1 000,30`.
88
+ * @maxLength 50
89
+ */
90
+ formattedValue?: string | null;
91
+ }
92
+ /**
93
+ * A deposit expressed as exactly one of a fixed monetary amount or a percentage of the full service price.
94
+ * Structurally exclusive: at most one of `amount` or `percentage` may be set.
95
+ */
96
+ interface BookedAddOn {
97
+ /**
98
+ * The ID of the add-on.
99
+ * @format GUID
100
+ */
101
+ _id?: string;
102
+ /**
103
+ * The ID of the add-on group.
104
+ * @format GUID
105
+ */
106
+ groupId?: string;
107
+ /**
108
+ * The add-on duration in minutes at the time of booking.
109
+ * Populated for duration-based add-ons.
110
+ * @min 1
111
+ * @max 1440
112
+ * @readonly
113
+ */
114
+ durationInMinutes?: number | null;
115
+ /**
116
+ * The quantity of booked add-ons.
117
+ * For duration-based add-ons, `quantity` is not applicable.
118
+ * If `quantity` is provided as `1` for a duration-based add-on, it will be accepted but the value will be cleared.
119
+ * If any other value is provided, an `INVALID_ARGUMENT` error will be returned with the message: "Invalid AddOn details: either duration or quantity must be set correctly".
120
+ * @min 1
121
+ * @max 1000
122
+ */
123
+ quantity?: number | null;
124
+ /**
125
+ * Add-on `name` at the time of booking.
126
+ * @maxLength 100
127
+ * @readonly
128
+ */
129
+ name?: string | null;
130
+ /**
131
+ * Add-on name translated to the language the customer used during booking.
132
+ * @maxLength 100
133
+ * @readonly
134
+ */
135
+ nameTranslated?: string | null;
136
+ }
137
+ /** Server-computed datetime adjusted to a requested timezone. */
138
+ interface AddOn$2 extends AddOnAddOnInfoOneOf {
139
+ /** Duration in minutes for duration-based add-ons that extend booking service time. */
140
+ durationInMinutes?: number;
141
+ /** Maximum quantity customers can purchase for quantity-based add-ons. */
142
+ maxQuantity?: number;
143
+ /**
144
+ * Add-on ID.
145
+ * @format GUID
146
+ */
147
+ addOnId?: string | null;
148
+ /**
149
+ * Add-on name displayed to customers.
150
+ * @maxLength 100
151
+ */
152
+ name?: string | null;
153
+ /** Add-on price. */
154
+ price?: Money;
155
+ /**
156
+ * Translated add-on name.
157
+ * @maxLength 100
158
+ */
159
+ nameTranslated?: string | null;
160
+ }
161
+ /** @oneof */
162
+ interface AddOnAddOnInfoOneOf {
163
+ /** Duration in minutes for duration-based add-ons that extend booking service time. */
164
+ durationInMinutes?: number;
165
+ /** Maximum quantity customers can purchase for quantity-based add-ons. */
166
+ maxQuantity?: number;
167
+ }
168
+ interface AddOnGroupDetail$1 {
169
+ /**
170
+ * Group ID.
171
+ * @format GUID
172
+ */
173
+ groupId?: string | null;
174
+ /** Maximum number of add-ons customers can select from this group. */
175
+ maxNumberOfAddOns?: number | null;
176
+ /**
177
+ * Group name displayed to customers.
178
+ * @maxLength 100
179
+ */
180
+ groupName?: string | null;
181
+ /**
182
+ * Add-ons linked to this group in display order.
183
+ * @maxSize 7
184
+ */
185
+ addOns?: AddOn$2[];
186
+ /**
187
+ * Instructional prompt displayed to customers. For example, `Choose up to 2 relaxing spa treatments to enhance your experience`. You can also use this field as a group description. For example, `Beginner-friendly rental equipment`.
188
+ * @maxLength 200
189
+ */
190
+ prompt?: string | null;
191
+ /**
192
+ * Translated group name.
193
+ * @maxLength 100
194
+ */
195
+ groupNameTranslated?: string | null;
196
+ /**
197
+ * Instructional translated prompt displayed to customers. For example, `Choose up to 2 relaxing spa treatments to enhance your experience`. You can also use this field as a group description. For example, `Beginner-friendly rental equipment`.
198
+ * @maxLength 200
199
+ */
200
+ promptTranslated?: string | null;
201
+ }
202
+ //#endregion
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`). */
205
+ type AddOn$1 = {
206
+ id: NonNullable<BookedAddOn['_id']>;
207
+ quantity: NonNullable<BookedAddOn['quantity']>;
208
+ };
209
+ //#endregion
210
+ //#region src/api/adapters/service-addons/service-addons.d.ts
211
+ type AddOnGroupDetail = AddOnGroupDetail$1;
212
+ type AddOn = AddOn$2;
213
+ interface AddOnItem {
214
+ addOnId: NonNullable<AddOn['addOnId']> | null;
215
+ addOnName: NonNullable<AddOn['name']> | null;
216
+ addOnPrice: string | null;
217
+ /** Same currency as the service. */
218
+ addOnPriceValue?: number | null;
219
+ /** A free service has none of its own to price its add-ons in. */
220
+ addOnCurrency?: string | null;
221
+ durationInMinutes: NonNullable<AddOn['durationInMinutes']> | null;
222
+ maxQuantity: NonNullable<AddOn['maxQuantity']> | null;
223
+ isSelected: boolean;
224
+ selectedQuantity: number;
225
+ }
226
+ interface AddOnGroupItem {
227
+ groupId: NonNullable<AddOnGroupDetail['groupId']> | null;
228
+ groupName: NonNullable<AddOnGroupDetail['groupName']> | null;
229
+ prompt: NonNullable<AddOnGroupDetail['prompt']> | null;
230
+ /** Max distinct add-ons, not units. */
231
+ maxNumberOfAddOns: NonNullable<AddOnGroupDetail['maxNumberOfAddOns']> | null;
232
+ addOns: AddOnItem[];
233
+ selectedCount: number;
234
+ canSelectMore: boolean;
235
+ }
236
+ //#endregion
237
+ //#region src/extensions/contexts/service-addons-context/service-addons-context.types.d.ts
238
+ /** The add-ons offered for the current service, the visitor's picks, and the actions to change them. */
239
+ interface ServiceAddOnsContextValue {
240
+ addOnGroups: AddOnGroupItem[];
241
+ /** Only picks the catalog offers. */
242
+ selected: AddOn$1[];
243
+ isLoading: boolean;
244
+ hasError: boolean;
245
+ /** No-op turning on when its group (the first offering it) is at maxNumberOfAddOns. */
246
+ toggleAddOn: (addOnId: string) => void;
247
+ /** Clamped to [0, maxQuantity]; 0 removes it. */
248
+ setAddOnQuantity: (addOnId: string, quantity: number) => void;
249
+ }
250
+ /** Props accepted by {@link ServiceAddOnsContextProvider}. */
251
+ interface ServiceAddOnsContextProviderProps {
252
+ children: ReactNode;
253
+ }
254
+ //#endregion
255
+ //#region src/extensions/contexts/service-addons-context/service-addons-context.d.ts
256
+ declare const serviceAddOnsContext: React.Context<ServiceAddOnsContextValue | null>;
257
+ /** Reads the service add-ons state; throws when no ServiceAddOnsContextProvider is above. */
258
+ declare function useServiceAddOnsContext(): ServiceAddOnsContextValue;
259
+ /** Loads the add-ons offered for the service in the surrounding ServiceContextProvider, and reads and changes the visitor's picks stored there. */
260
+ declare function ServiceAddOnsContextProvider({
261
+ children
262
+ }: ServiceAddOnsContextProviderProps): React.JSX.Element;
263
+
264
+ export { type AddOnGroupItem, type AddOnItem, ServiceAddOnsContextProvider, type ServiceAddOnsContextProviderProps, type ServiceAddOnsContextValue, ServiceAddOnsContextProvider as default, serviceAddOnsContext, useServiceAddOnsContext };