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