@wix/bookings 1.0.14 → 1.0.15

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 (43) hide show
  1. package/build/cjs/index.d.ts +2 -1
  2. package/build/cjs/index.js +3 -2
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/src/bookings-calendar-v1-session.http.d.ts +49 -26
  5. package/build/cjs/src/bookings-calendar-v1-session.http.js +49 -26
  6. package/build/cjs/src/bookings-calendar-v1-session.http.js.map +1 -1
  7. package/build/cjs/src/bookings-calendar-v1-session.universal.d.ts +49 -26
  8. package/build/cjs/src/bookings-calendar-v1-session.universal.js +49 -26
  9. package/build/cjs/src/bookings-calendar-v1-session.universal.js.map +1 -1
  10. package/build/cjs/src/bookings-catalog-v1-service-options-and-variants.http.d.ts +64 -0
  11. package/build/cjs/src/bookings-catalog-v1-service-options-and-variants.http.js +296 -0
  12. package/build/cjs/src/bookings-catalog-v1-service-options-and-variants.http.js.map +1 -0
  13. package/build/cjs/src/bookings-catalog-v1-service-options-and-variants.public.d.ts +11 -0
  14. package/build/cjs/src/bookings-catalog-v1-service-options-and-variants.public.js +69 -0
  15. package/build/cjs/src/bookings-catalog-v1-service-options-and-variants.public.js.map +1 -0
  16. package/build/cjs/src/bookings-catalog-v1-service-options-and-variants.types.d.ts +1831 -0
  17. package/build/cjs/src/bookings-catalog-v1-service-options-and-variants.types.js +197 -0
  18. package/build/cjs/src/bookings-catalog-v1-service-options-and-variants.types.js.map +1 -0
  19. package/build/cjs/src/bookings-catalog-v1-service-options-and-variants.universal.d.ts +1992 -0
  20. package/build/cjs/src/bookings-catalog-v1-service-options-and-variants.universal.js +685 -0
  21. package/build/cjs/src/bookings-catalog-v1-service-options-and-variants.universal.js.map +1 -0
  22. package/build/es/index.d.ts +2 -1
  23. package/build/es/index.js +2 -1
  24. package/build/es/index.js.map +1 -1
  25. package/build/es/src/bookings-calendar-v1-session.http.d.ts +49 -26
  26. package/build/es/src/bookings-calendar-v1-session.http.js +49 -26
  27. package/build/es/src/bookings-calendar-v1-session.http.js.map +1 -1
  28. package/build/es/src/bookings-calendar-v1-session.universal.d.ts +49 -26
  29. package/build/es/src/bookings-calendar-v1-session.universal.js +49 -26
  30. package/build/es/src/bookings-calendar-v1-session.universal.js.map +1 -1
  31. package/build/es/src/bookings-catalog-v1-service-options-and-variants.http.d.ts +64 -0
  32. package/build/es/src/bookings-catalog-v1-service-options-and-variants.http.js +286 -0
  33. package/build/es/src/bookings-catalog-v1-service-options-and-variants.http.js.map +1 -0
  34. package/build/es/src/bookings-catalog-v1-service-options-and-variants.public.d.ts +11 -0
  35. package/build/es/src/bookings-catalog-v1-service-options-and-variants.public.js +38 -0
  36. package/build/es/src/bookings-catalog-v1-service-options-and-variants.public.js.map +1 -0
  37. package/build/es/src/bookings-catalog-v1-service-options-and-variants.types.d.ts +1831 -0
  38. package/build/es/src/bookings-catalog-v1-service-options-and-variants.types.js +194 -0
  39. package/build/es/src/bookings-catalog-v1-service-options-and-variants.types.js.map +1 -0
  40. package/build/es/src/bookings-catalog-v1-service-options-and-variants.universal.d.ts +1992 -0
  41. package/build/es/src/bookings-catalog-v1-service-options-and-variants.universal.js +656 -0
  42. package/build/es/src/bookings-catalog-v1-service-options-and-variants.universal.js.map +1 -0
  43. package/package.json +2 -2
@@ -0,0 +1,656 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { serializer, transformError, resolveQueryFieldsTransformationPaths, } from '@wix/metro-runtime/velo';
11
+ import * as ambassadorWixBookingsCatalogV1ServiceOptionsAndVariants from './bookings-catalog-v1-service-options-and-variants.http';
12
+ // @ts-ignore
13
+ import { wrapWithQueryBuilder } from '@wix/motion-edm-autogen-query-wrapper';
14
+ let __verbose = false;
15
+ function __log(...args) {
16
+ __verbose && console.log(...args);
17
+ }
18
+ function __inspect(obj) {
19
+ return obj;
20
+ }
21
+ export const __debug = {
22
+ verboseLogging: {
23
+ on: () => (__verbose = true),
24
+ off: () => (__verbose = false),
25
+ },
26
+ };
27
+ const _toVeloEntity = '$';
28
+ const _fromVeloEntity = '$';
29
+ export var ServiceOptionType;
30
+ (function (ServiceOptionType) {
31
+ ServiceOptionType["UNKNOWN"] = "UNKNOWN";
32
+ ServiceOptionType["CUSTOM"] = "CUSTOM";
33
+ ServiceOptionType["STAFF_MEMBER"] = "STAFF_MEMBER";
34
+ })(ServiceOptionType || (ServiceOptionType = {}));
35
+ export var SortOrder;
36
+ (function (SortOrder) {
37
+ SortOrder["ASC"] = "ASC";
38
+ SortOrder["DESC"] = "DESC";
39
+ })(SortOrder || (SortOrder = {}));
40
+ export var Day;
41
+ (function (Day) {
42
+ /** Undefined. */
43
+ Day["UNDEFINED"] = "UNDEFINED";
44
+ /** Monday. */
45
+ Day["MON"] = "MON";
46
+ /** Tuesday. */
47
+ Day["TUE"] = "TUE";
48
+ /** Wednesday. */
49
+ Day["WED"] = "WED";
50
+ /** Thursday. */
51
+ Day["THU"] = "THU";
52
+ /** Friday. */
53
+ Day["FRI"] = "FRI";
54
+ /** Saturday. */
55
+ Day["SAT"] = "SAT";
56
+ /** Sunday. */
57
+ Day["SUN"] = "SUN";
58
+ })(Day || (Day = {}));
59
+ export var Transparency;
60
+ (function (Transparency) {
61
+ Transparency["UNDEFINED"] = "UNDEFINED";
62
+ /** The schedule can have available slots during the session. */
63
+ Transparency["FREE"] = "FREE";
64
+ /** The schedule cannot have available slots during the session. Default value. */
65
+ Transparency["BUSY"] = "BUSY";
66
+ })(Transparency || (Transparency = {}));
67
+ export var RecurringIntervalType;
68
+ (function (RecurringIntervalType) {
69
+ /** The default value. Sessions for this interval will be of type EVENT. */
70
+ RecurringIntervalType["UNDEFINED"] = "UNDEFINED";
71
+ /** A recurring interval of events */
72
+ RecurringIntervalType["EVENT"] = "EVENT";
73
+ /** Deprecated */
74
+ RecurringIntervalType["TIME_AVAILABILITY"] = "TIME_AVAILABILITY";
75
+ /** A recurring interval for availability */
76
+ RecurringIntervalType["AVAILABILITY"] = "AVAILABILITY";
77
+ })(RecurringIntervalType || (RecurringIntervalType = {}));
78
+ export var LocationType;
79
+ (function (LocationType) {
80
+ LocationType["UNDEFINED"] = "UNDEFINED";
81
+ LocationType["OWNER_BUSINESS"] = "OWNER_BUSINESS";
82
+ LocationType["OWNER_CUSTOM"] = "OWNER_CUSTOM";
83
+ LocationType["CUSTOM"] = "CUSTOM";
84
+ })(LocationType || (LocationType = {}));
85
+ /** For future use */
86
+ export var LocationStatus;
87
+ (function (LocationStatus) {
88
+ LocationStatus["ACTIVE"] = "ACTIVE";
89
+ LocationStatus["INACTIVE"] = "INACTIVE";
90
+ })(LocationStatus || (LocationStatus = {}));
91
+ /** For future use */
92
+ export var LocationsLocationType;
93
+ (function (LocationsLocationType) {
94
+ LocationsLocationType["UNKNOWN"] = "UNKNOWN";
95
+ LocationsLocationType["BRANCH"] = "BRANCH";
96
+ LocationsLocationType["OFFICES"] = "OFFICES";
97
+ LocationsLocationType["RECEPTION"] = "RECEPTION";
98
+ LocationsLocationType["HEADQUARTERS"] = "HEADQUARTERS";
99
+ })(LocationsLocationType || (LocationsLocationType = {}));
100
+ /** Enumerates the days of the week. */
101
+ export var DayOfWeek;
102
+ (function (DayOfWeek) {
103
+ DayOfWeek["MONDAY"] = "MONDAY";
104
+ DayOfWeek["TUESDAY"] = "TUESDAY";
105
+ DayOfWeek["WEDNESDAY"] = "WEDNESDAY";
106
+ DayOfWeek["THURSDAY"] = "THURSDAY";
107
+ DayOfWeek["FRIDAY"] = "FRIDAY";
108
+ DayOfWeek["SATURDAY"] = "SATURDAY";
109
+ DayOfWeek["SUNDAY"] = "SUNDAY";
110
+ })(DayOfWeek || (DayOfWeek = {}));
111
+ export var ApprovalStatus;
112
+ (function (ApprovalStatus) {
113
+ /** Default. */
114
+ ApprovalStatus["UNDEFINED"] = "UNDEFINED";
115
+ /** Pending business approval. */
116
+ ApprovalStatus["PENDING"] = "PENDING";
117
+ /** Approved by the business. */
118
+ ApprovalStatus["APPROVED"] = "APPROVED";
119
+ /** Declined by the business. */
120
+ ApprovalStatus["DECLINED"] = "DECLINED";
121
+ })(ApprovalStatus || (ApprovalStatus = {}));
122
+ export var ScheduleStatus;
123
+ (function (ScheduleStatus) {
124
+ ScheduleStatus["UNDEFINED"] = "UNDEFINED";
125
+ /** The default value when the schedule is created. */
126
+ ScheduleStatus["CREATED"] = "CREATED";
127
+ /** The schedule has been canceled. */
128
+ ScheduleStatus["CANCELLED"] = "CANCELLED";
129
+ })(ScheduleStatus || (ScheduleStatus = {}));
130
+ export var ConferenceType;
131
+ (function (ConferenceType) {
132
+ ConferenceType["UNDEFINED"] = "UNDEFINED";
133
+ /** API-generated online meeting. */
134
+ ConferenceType["ONLINE_MEETING_PROVIDER"] = "ONLINE_MEETING_PROVIDER";
135
+ /** User-defined meeting. */
136
+ ConferenceType["CUSTOM"] = "CUSTOM";
137
+ })(ConferenceType || (ConferenceType = {}));
138
+ export var ResourceStatus;
139
+ (function (ResourceStatus) {
140
+ ResourceStatus["UNDEFINED"] = "UNDEFINED";
141
+ /** Default status. */
142
+ ResourceStatus["CREATED"] = "CREATED";
143
+ /** The resource was deleted. */
144
+ ResourceStatus["DELETED"] = "DELETED";
145
+ /** The resource was updated. */
146
+ ResourceStatus["UPDATED"] = "UPDATED";
147
+ })(ResourceStatus || (ResourceStatus = {}));
148
+ export var Event;
149
+ (function (Event) {
150
+ Event["UNDEFINED"] = "UNDEFINED";
151
+ Event["Updated"] = "Updated";
152
+ Event["Deleted"] = "Deleted";
153
+ Event["Created"] = "Created";
154
+ Event["Schedule_Updated"] = "Schedule_Updated";
155
+ })(Event || (Event = {}));
156
+ export var ServiceStatus;
157
+ (function (ServiceStatus) {
158
+ /** The default service status. */
159
+ ServiceStatus["CREATED"] = "CREATED";
160
+ /** The service is deleted. */
161
+ ServiceStatus["DELETED"] = "DELETED";
162
+ })(ServiceStatus || (ServiceStatus = {}));
163
+ export var ServiceNotificationEvent;
164
+ (function (ServiceNotificationEvent) {
165
+ ServiceNotificationEvent["Unspecified"] = "Unspecified";
166
+ ServiceNotificationEvent["Updated"] = "Updated";
167
+ ServiceNotificationEvent["Deleted"] = "Deleted";
168
+ ServiceNotificationEvent["Created"] = "Created";
169
+ })(ServiceNotificationEvent || (ServiceNotificationEvent = {}));
170
+ export var CalendarType;
171
+ (function (CalendarType) {
172
+ CalendarType["UNDEFINED"] = "UNDEFINED";
173
+ CalendarType["GOOGLE"] = "GOOGLE";
174
+ CalendarType["I_CAL"] = "I_CAL";
175
+ /** Use `MICROSOFT` instead. */
176
+ CalendarType["OUTLOOK"] = "OUTLOOK";
177
+ /** Use `MICROSOFT` instead. */
178
+ CalendarType["OFFICE_365"] = "OFFICE_365";
179
+ CalendarType["MICROSOFT"] = "MICROSOFT";
180
+ CalendarType["OTHER"] = "OTHER";
181
+ })(CalendarType || (CalendarType = {}));
182
+ export var Status;
183
+ (function (Status) {
184
+ Status["UNDEFINED"] = "UNDEFINED";
185
+ /** The session is confirmed. Default status. */
186
+ Status["CONFIRMED"] = "CONFIRMED";
187
+ /**
188
+ * The session is cancelled.
189
+ * A cancelled session can be the cancellation of a recurring session that should no longer be displayed or a deleted single session.
190
+ * The ListSessions returns cancelled sessions only if 'includeDelete' flag is set to true.
191
+ */
192
+ Status["CANCELLED"] = "CANCELLED";
193
+ })(Status || (Status = {}));
194
+ export var SessionType;
195
+ (function (SessionType) {
196
+ SessionType["UNDEFINED"] = "UNDEFINED";
197
+ /**
198
+ * The session creates an event on the calendar for the owner of the schedule that the session belongs to.
199
+ * Default type.
200
+ */
201
+ SessionType["EVENT"] = "EVENT";
202
+ /** The session represents a resource's available working hours. */
203
+ SessionType["WORKING_HOURS"] = "WORKING_HOURS";
204
+ /** Deprecated. please use WORKING_HOURS */
205
+ SessionType["TIME_AVAILABILITY"] = "TIME_AVAILABILITY";
206
+ /** Deprecated. The session represents a resource's available hours. please use WORKING_HOURS */
207
+ SessionType["AVAILABILITY"] = "AVAILABILITY";
208
+ })(SessionType || (SessionType = {}));
209
+ /** Where the extra text should be displayed: before, after or instead of the actual address. */
210
+ export var PlacementType;
211
+ (function (PlacementType) {
212
+ PlacementType["BEFORE"] = "BEFORE";
213
+ PlacementType["AFTER"] = "AFTER";
214
+ PlacementType["REPLACE"] = "REPLACE";
215
+ })(PlacementType || (PlacementType = {}));
216
+ export var ResolutionMethod;
217
+ (function (ResolutionMethod) {
218
+ ResolutionMethod["QUERY_PARAM"] = "QUERY_PARAM";
219
+ ResolutionMethod["SUBDOMAIN"] = "SUBDOMAIN";
220
+ ResolutionMethod["SUBDIRECTORY"] = "SUBDIRECTORY";
221
+ })(ResolutionMethod || (ResolutionMethod = {}));
222
+ const _cloneServiceOptionsAndVariantsRequest = {};
223
+ const _cloneServiceOptionsAndVariantsResponse = {};
224
+ const _createServiceOptionsAndVariantsRequest = {};
225
+ const _createServiceOptionsAndVariantsResponse = {};
226
+ const _deleteServiceOptionsAndVariantsRequest = {};
227
+ const _deleteServiceOptionsAndVariantsResponse = {};
228
+ const _getServiceOptionsAndVariantsByServiceIdRequest = {};
229
+ const _getServiceOptionsAndVariantsByServiceIdResponse = {};
230
+ const _getServiceOptionsAndVariantsRequest = {};
231
+ const _getServiceOptionsAndVariantsResponse = {};
232
+ const _queryServiceOptionsAndVariantsRequest = {};
233
+ const _queryServiceOptionsAndVariantsResponse = {};
234
+ const _updateServiceOptionsAndVariantsRequest = {};
235
+ const _updateServiceOptionsAndVariantsResponse = {};
236
+ /**
237
+ * Creates options and variants for a service. Note that only a single
238
+ * `serviceOptionsAndVariants` object is supported per service.
239
+ *
240
+ *
241
+ * Currently, only a single option is supported per `serviceOptionsAndVariants` object.
242
+ *
243
+ * Before creating the `serviceOptionsAndVariants` object you need to calculate
244
+ * all variants, since you must pass them in the `variants` array of the
245
+ * request. Variants aren't automatically calculated from the options. Currently,
246
+ * services are limited to a single option. Therefore, the variants
247
+ * array is equal to the list of all choices for custom options,
248
+ * or all staff members providing the service for staff member based options.
249
+ * @param serviceOptionsAndVariants - Service options and variants to create.
250
+ * @public
251
+ * @documentationMaturity preview
252
+ * @requiredField serviceOptionsAndVariants
253
+ * @requiredField serviceOptionsAndVariants.options
254
+ * @requiredField serviceOptionsAndVariants.serviceId
255
+ * @requiredField serviceOptionsAndVariants.variants
256
+ */
257
+ export function createServiceOptionsAndVariants(serviceOptionsAndVariants) {
258
+ var _a, _b, _c;
259
+ return __awaiter(this, arguments, void 0, function* () {
260
+ const requestTransformation = { serviceOptionsAndVariants: '$[0]' };
261
+ const responseTransformation = '$';
262
+ // @ts-ignore
263
+ const { httpClient, sideEffects } = arguments[1];
264
+ const { toAmbassadorRequest } = serializer({
265
+ rootSchema: _createServiceOptionsAndVariantsRequest,
266
+ depSchemas: {},
267
+ fqdnTransformation: {
268
+ paths: [...['serviceOptionsAndVariants']],
269
+ transformation: _fromVeloEntity,
270
+ },
271
+ customTransformation: requestTransformation,
272
+ });
273
+ const { fromJSON } = serializer({
274
+ rootSchema: _createServiceOptionsAndVariantsResponse,
275
+ depSchemas: {},
276
+ fqdnTransformation: {
277
+ paths: [...['serviceOptionsAndVariants']],
278
+ transformation: _toVeloEntity,
279
+ },
280
+ customTransformation: responseTransformation,
281
+ });
282
+ const payload = toAmbassadorRequest([serviceOptionsAndVariants]);
283
+ const reqOpts = ambassadorWixBookingsCatalogV1ServiceOptionsAndVariants.createServiceOptionsAndVariants(payload);
284
+ __log(`"CreateServiceOptionsAndVariants" sending request with: ${__inspect(reqOpts)}`);
285
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
286
+ try {
287
+ const result = yield httpClient.request(reqOpts);
288
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
289
+ return fromJSON(result.data);
290
+ }
291
+ catch (err) {
292
+ const transformedError = transformError(err, requestTransformation, [
293
+ 'serviceOptionsAndVariants',
294
+ ]);
295
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
296
+ throw transformedError;
297
+ }
298
+ });
299
+ }
300
+ /**
301
+ * Clones a `serviceOptionsAndVariants` object. This endpoint can be called, for example, when duplicating a service.
302
+ * The result is a deep clone in which all Service Options and Service Variants are duplicated. Each Service Option
303
+ * in the clone will have a newly generated ID that is copied to all Service Choices of the Service Variants in the
304
+ * clone. The clone will reference the service provided in the request by `target_service_id`.
305
+ * @param cloneFromId - ID of the `serviceOptionsAndVariants` object to clone.
306
+ * @param targetServiceId - ID of the service that will be set for the cloned `serviceOptionsAndVariants`
307
+ * @public
308
+ * @documentationMaturity preview
309
+ * @requiredField cloneFromId
310
+ * @requiredField targetServiceId
311
+ */
312
+ export function cloneServiceOptionsAndVariants(cloneFromId, targetServiceId) {
313
+ var _a, _b, _c;
314
+ return __awaiter(this, arguments, void 0, function* () {
315
+ const requestTransformation = {
316
+ cloneFromId: '$[0]',
317
+ targetServiceId: '$[1]',
318
+ };
319
+ const responseTransformation = '$';
320
+ // @ts-ignore
321
+ const { httpClient, sideEffects } = arguments[2];
322
+ const { toAmbassadorRequest } = serializer({
323
+ rootSchema: _cloneServiceOptionsAndVariantsRequest,
324
+ depSchemas: {},
325
+ fqdnTransformation: {
326
+ paths: [],
327
+ transformation: _fromVeloEntity,
328
+ },
329
+ customTransformation: requestTransformation,
330
+ });
331
+ const { fromJSON } = serializer({
332
+ rootSchema: _cloneServiceOptionsAndVariantsResponse,
333
+ depSchemas: {},
334
+ fqdnTransformation: {
335
+ paths: [...['serviceOptionsAndVariants']],
336
+ transformation: _toVeloEntity,
337
+ },
338
+ customTransformation: responseTransformation,
339
+ });
340
+ const payload = toAmbassadorRequest([cloneFromId, targetServiceId]);
341
+ const reqOpts = ambassadorWixBookingsCatalogV1ServiceOptionsAndVariants.cloneServiceOptionsAndVariants(payload);
342
+ __log(`"CloneServiceOptionsAndVariants" sending request with: ${__inspect(reqOpts)}`);
343
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
344
+ try {
345
+ const result = yield httpClient.request(reqOpts);
346
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
347
+ return fromJSON(result.data);
348
+ }
349
+ catch (err) {
350
+ const transformedError = transformError(err, requestTransformation, [
351
+ 'cloneFromId',
352
+ 'targetServiceId',
353
+ ]);
354
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
355
+ throw transformedError;
356
+ }
357
+ });
358
+ }
359
+ /**
360
+ * Retrieves a `serviceOptionsAndVariants` object.
361
+ * @param serviceOptionsAndVariantsId - ID of the `serviceOptionsAndVariants` object to retrieve.
362
+ * @public
363
+ * @documentationMaturity preview
364
+ * @requiredField serviceOptionsAndVariantsId
365
+ * @returns Retrieved `serviceOptionsAndVariants` object.
366
+ */
367
+ export function getServiceOptionsAndVariants(serviceOptionsAndVariantsId) {
368
+ var _a, _b, _c;
369
+ return __awaiter(this, arguments, void 0, function* () {
370
+ const requestTransformation = { serviceOptionsAndVariantsId: '$[0]' };
371
+ const responseTransformation = '$.serviceOptionsAndVariants';
372
+ // @ts-ignore
373
+ const { httpClient, sideEffects } = arguments[1];
374
+ const { toAmbassadorRequest } = serializer({
375
+ rootSchema: _getServiceOptionsAndVariantsRequest,
376
+ depSchemas: {},
377
+ fqdnTransformation: {
378
+ paths: [],
379
+ transformation: _fromVeloEntity,
380
+ },
381
+ customTransformation: requestTransformation,
382
+ });
383
+ const { fromJSON } = serializer({
384
+ rootSchema: _getServiceOptionsAndVariantsResponse,
385
+ depSchemas: {},
386
+ fqdnTransformation: {
387
+ paths: [...['serviceOptionsAndVariants']],
388
+ transformation: _toVeloEntity,
389
+ },
390
+ customTransformation: responseTransformation,
391
+ });
392
+ const payload = toAmbassadorRequest([serviceOptionsAndVariantsId]);
393
+ const reqOpts = ambassadorWixBookingsCatalogV1ServiceOptionsAndVariants.getServiceOptionsAndVariants(payload);
394
+ __log(`"GetServiceOptionsAndVariants" sending request with: ${__inspect(reqOpts)}`);
395
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
396
+ try {
397
+ const result = yield httpClient.request(reqOpts);
398
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
399
+ return fromJSON(result.data);
400
+ }
401
+ catch (err) {
402
+ const transformedError = transformError(err, requestTransformation, [
403
+ 'serviceOptionsAndVariantsId',
404
+ ]);
405
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
406
+ throw transformedError;
407
+ }
408
+ });
409
+ }
410
+ /**
411
+ * Retrieves a service's options and variants by `service_id`.
412
+ * @param serviceId - ID of the service to retrieve options and variants for.
413
+ * @public
414
+ * @documentationMaturity preview
415
+ * @requiredField serviceId
416
+ */
417
+ export function getServiceOptionsAndVariantsByServiceId(serviceId) {
418
+ var _a, _b, _c;
419
+ return __awaiter(this, arguments, void 0, function* () {
420
+ const requestTransformation = { serviceId: '$[0]' };
421
+ const responseTransformation = '$';
422
+ // @ts-ignore
423
+ const { httpClient, sideEffects } = arguments[1];
424
+ const { toAmbassadorRequest } = serializer({
425
+ rootSchema: _getServiceOptionsAndVariantsByServiceIdRequest,
426
+ depSchemas: {},
427
+ fqdnTransformation: {
428
+ paths: [],
429
+ transformation: _fromVeloEntity,
430
+ },
431
+ customTransformation: requestTransformation,
432
+ });
433
+ const { fromJSON } = serializer({
434
+ rootSchema: _getServiceOptionsAndVariantsByServiceIdResponse,
435
+ depSchemas: {},
436
+ fqdnTransformation: {
437
+ paths: [...['serviceVariants']],
438
+ transformation: _toVeloEntity,
439
+ },
440
+ customTransformation: responseTransformation,
441
+ });
442
+ const payload = toAmbassadorRequest([serviceId]);
443
+ const reqOpts = ambassadorWixBookingsCatalogV1ServiceOptionsAndVariants.getServiceOptionsAndVariantsByServiceId(payload);
444
+ __log(`"GetServiceOptionsAndVariantsByServiceId" sending request with: ${__inspect(reqOpts)}`);
445
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
446
+ try {
447
+ const result = yield httpClient.request(reqOpts);
448
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
449
+ return fromJSON(result.data);
450
+ }
451
+ catch (err) {
452
+ const transformedError = transformError(err, requestTransformation, [
453
+ 'serviceId',
454
+ ]);
455
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
456
+ throw transformedError;
457
+ }
458
+ });
459
+ }
460
+ /**
461
+ * Updates the specified fields of the `serviceOptionsAndVariants` object.
462
+ *
463
+ * Currently, only a single option is supported per `serviceOptionsAndVariants` object.
464
+ *
465
+ * If you want to update `variants`, you must pass the full list of supported variants.
466
+ *
467
+ * If you want to update `options`, you must pass the full list of supported options.
468
+ * @param _id - ID of the `serviceOptionsAndVariants` object.
469
+ * @public
470
+ * @documentationMaturity preview
471
+ * @requiredField _id
472
+ * @requiredField serviceOptionsAndVariants
473
+ * @requiredField serviceOptionsAndVariants.revision
474
+ * @returns Updated `serviceOptionsAndVariants` object.
475
+ */
476
+ export function updateServiceOptionsAndVariants(_id, serviceOptionsAndVariants, options) {
477
+ var _a, _b, _c;
478
+ return __awaiter(this, arguments, void 0, function* () {
479
+ const requestTransformation = {
480
+ serviceOptionsAndVariants: { '*': '$[1]', id: '$[0]' },
481
+ mask: '$[2].mask',
482
+ };
483
+ const responseTransformation = '$.serviceOptionsAndVariants';
484
+ // @ts-ignore
485
+ const { httpClient, sideEffects } = arguments[3];
486
+ const { toAmbassadorRequest } = serializer({
487
+ rootSchema: _updateServiceOptionsAndVariantsRequest,
488
+ depSchemas: {},
489
+ fqdnTransformation: {
490
+ paths: [...['serviceOptionsAndVariants']],
491
+ transformation: _fromVeloEntity,
492
+ },
493
+ customTransformation: requestTransformation,
494
+ });
495
+ const { fromJSON } = serializer({
496
+ rootSchema: _updateServiceOptionsAndVariantsResponse,
497
+ depSchemas: {},
498
+ fqdnTransformation: {
499
+ paths: [...['serviceOptionsAndVariants']],
500
+ transformation: _toVeloEntity,
501
+ },
502
+ customTransformation: responseTransformation,
503
+ });
504
+ const payload = toAmbassadorRequest([
505
+ _id,
506
+ serviceOptionsAndVariants,
507
+ options,
508
+ ]);
509
+ const reqOpts = ambassadorWixBookingsCatalogV1ServiceOptionsAndVariants.updateServiceOptionsAndVariants(payload);
510
+ __log(`"UpdateServiceOptionsAndVariants" sending request with: ${__inspect(reqOpts)}`);
511
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
512
+ try {
513
+ const result = yield httpClient.request(reqOpts);
514
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
515
+ return fromJSON(result.data);
516
+ }
517
+ catch (err) {
518
+ const transformedError = transformError(err, requestTransformation, [
519
+ '_id',
520
+ 'serviceOptionsAndVariants',
521
+ 'options',
522
+ ]);
523
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
524
+ throw transformedError;
525
+ }
526
+ });
527
+ }
528
+ /**
529
+ * Deletes a `serviceOptionsAndVariants` object.
530
+ *
531
+ *
532
+ * Since each service has only a single `serviceOptionsAndVariants` object, the
533
+ * service won't have any supported options and variants any longer. Instead
534
+ * the standard Wix Bookings service price calculation will be used.
535
+ * @param serviceOptionsAndVariantsId - ID of the `serviceOptionsAndVariants` object to delete.
536
+ * @public
537
+ * @documentationMaturity preview
538
+ * @requiredField serviceOptionsAndVariantsId
539
+ */
540
+ export function deleteServiceOptionsAndVariants(serviceOptionsAndVariantsId, options) {
541
+ var _a, _b, _c;
542
+ return __awaiter(this, arguments, void 0, function* () {
543
+ const requestTransformation = {
544
+ serviceOptionsAndVariantsId: '$[0]',
545
+ revision: '$[1].revision',
546
+ };
547
+ const responseTransformation = '$';
548
+ // @ts-ignore
549
+ const { httpClient, sideEffects } = arguments[2];
550
+ const { toAmbassadorRequest } = serializer({
551
+ rootSchema: _deleteServiceOptionsAndVariantsRequest,
552
+ depSchemas: {},
553
+ fqdnTransformation: {
554
+ paths: [],
555
+ transformation: _fromVeloEntity,
556
+ },
557
+ customTransformation: requestTransformation,
558
+ });
559
+ const { fromJSON } = serializer({
560
+ rootSchema: _deleteServiceOptionsAndVariantsResponse,
561
+ depSchemas: {},
562
+ fqdnTransformation: {
563
+ paths: [],
564
+ transformation: _toVeloEntity,
565
+ },
566
+ customTransformation: responseTransformation,
567
+ });
568
+ const payload = toAmbassadorRequest([serviceOptionsAndVariantsId, options]);
569
+ const reqOpts = ambassadorWixBookingsCatalogV1ServiceOptionsAndVariants.deleteServiceOptionsAndVariants(payload);
570
+ __log(`"DeleteServiceOptionsAndVariants" sending request with: ${__inspect(reqOpts)}`);
571
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
572
+ try {
573
+ const result = yield httpClient.request(reqOpts);
574
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
575
+ return fromJSON(result.data);
576
+ }
577
+ catch (err) {
578
+ const transformedError = transformError(err, requestTransformation, [
579
+ 'serviceOptionsAndVariantsId',
580
+ 'options',
581
+ ]);
582
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
583
+ throw transformedError;
584
+ }
585
+ });
586
+ }
587
+ /**
588
+ * Retrieves a list of `serviceOptionsAndVariants`, given the provided paging, filtering, and sorting.
589
+ *
590
+ * Query Service Options And Variants runs with these defaults, which you can override:
591
+ *
592
+ * - `id` is sorted in `ASC` order
593
+ * - `cursorPaging.limit` is `100`
594
+ *
595
+ * For a detailed list of supported filtering operations see
596
+ * [supported filters](https://dev.wix.com/api/rest/wix-bookings/service-variants/supported-filters).
597
+ *
598
+ * To learn about working with _Query_ endpoints, see
599
+ * [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language),
600
+ * [Sorting and Paging](https://dev.wix.com/api/rest/getting-started/pagination),
601
+ * and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection).
602
+ * @public
603
+ * @documentationMaturity preview
604
+ */
605
+ export function queryServiceOptionsAndVariants() {
606
+ const requestTransformation = { '*': '$[1]', query: '$[0]' };
607
+ const responseTransformation = {
608
+ items: '$.serviceOptionsAndVariantsList',
609
+ pagingMetadata: '$.metadata',
610
+ };
611
+ // @ts-ignore
612
+ const { httpClient, sideEffects } = arguments[0];
613
+ const { toAmbassadorRequest } = serializer({
614
+ rootSchema: _queryServiceOptionsAndVariantsRequest,
615
+ depSchemas: {},
616
+ fqdnTransformation: {
617
+ paths: [],
618
+ transformation: _fromVeloEntity,
619
+ },
620
+ customTransformation: requestTransformation,
621
+ });
622
+ const { fromJSON } = serializer({
623
+ rootSchema: _queryServiceOptionsAndVariantsResponse,
624
+ depSchemas: {},
625
+ fqdnTransformation: {
626
+ paths: [...['Array#serviceOptionsAndVariantsList']],
627
+ transformation: _toVeloEntity,
628
+ },
629
+ customTransformation: responseTransformation,
630
+ });
631
+ return wrapWithQueryBuilder({
632
+ func: (payload) => __awaiter(this, void 0, void 0, function* () {
633
+ var _a, _b, _c;
634
+ const reqOpts = ambassadorWixBookingsCatalogV1ServiceOptionsAndVariants.queryServiceOptionsAndVariants(payload);
635
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
636
+ try {
637
+ const result = yield httpClient.request(reqOpts);
638
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
639
+ return result;
640
+ }
641
+ catch (err) {
642
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
643
+ throw err;
644
+ }
645
+ }),
646
+ requestTransformer: (...args) => toAmbassadorRequest(args),
647
+ responseTransformer: ({ data }) => fromJSON(data),
648
+ errorTransformer: (err) => {
649
+ const transformedError = transformError(err, requestTransformation);
650
+ throw transformedError;
651
+ },
652
+ pagingMethod: 'CURSOR',
653
+ transformationPaths: resolveQueryFieldsTransformationPaths(_toVeloEntity),
654
+ })({ cursorWithEmptyFilterAndSort: true });
655
+ }
656
+ //# sourceMappingURL=bookings-catalog-v1-service-options-and-variants.universal.js.map