@wix/bookings 1.0.1 → 1.0.3

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 (89) hide show
  1. package/build/cjs/index.d.ts +3 -0
  2. package/build/cjs/index.js +4 -1
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/src/bookings-availability-v1-slot-availability.http.d.ts +6 -6
  5. package/build/cjs/src/bookings-availability-v1-slot-availability.http.js +6 -6
  6. package/build/cjs/src/bookings-availability-v1-slot-availability.universal.d.ts +14 -29
  7. package/build/cjs/src/bookings-availability-v1-slot-availability.universal.js +7 -6
  8. package/build/cjs/src/bookings-availability-v1-slot-availability.universal.js.map +1 -1
  9. package/build/cjs/src/bookings-reader-v2-extended-booking.http.d.ts +38 -0
  10. package/build/cjs/src/bookings-reader-v2-extended-booking.http.js +117 -0
  11. package/build/cjs/src/bookings-reader-v2-extended-booking.http.js.map +1 -0
  12. package/build/cjs/src/bookings-reader-v2-extended-booking.public.d.ts +5 -0
  13. package/build/cjs/src/bookings-reader-v2-extended-booking.public.js +22 -0
  14. package/build/cjs/src/bookings-reader-v2-extended-booking.public.js.map +1 -0
  15. package/build/cjs/src/bookings-reader-v2-extended-booking.types.d.ts +730 -0
  16. package/build/cjs/src/bookings-reader-v2-extended-booking.types.js +90 -0
  17. package/build/cjs/src/bookings-reader-v2-extended-booking.types.js.map +1 -0
  18. package/build/cjs/src/bookings-reader-v2-extended-booking.universal.d.ts +786 -0
  19. package/build/cjs/src/bookings-reader-v2-extended-booking.universal.js +226 -0
  20. package/build/cjs/src/bookings-reader-v2-extended-booking.universal.js.map +1 -0
  21. package/build/cjs/src/bookings-v2-booking.http.d.ts +123 -0
  22. package/build/cjs/src/bookings-v2-booking.http.js +305 -0
  23. package/build/cjs/src/bookings-v2-booking.http.js.map +1 -0
  24. package/build/cjs/src/bookings-v2-booking.public.d.ts +9 -0
  25. package/build/cjs/src/bookings-v2-booking.public.js +47 -0
  26. package/build/cjs/src/bookings-v2-booking.public.js.map +1 -0
  27. package/build/cjs/src/bookings-v2-booking.types.d.ts +1594 -0
  28. package/build/cjs/src/bookings-v2-booking.types.js +99 -0
  29. package/build/cjs/src/bookings-v2-booking.types.js.map +1 -0
  30. package/build/cjs/src/bookings-v2-booking.universal.d.ts +1840 -0
  31. package/build/cjs/src/bookings-v2-booking.universal.js +561 -0
  32. package/build/cjs/src/bookings-v2-booking.universal.js.map +1 -0
  33. package/build/cjs/src/bookings-v2-price-info.http.d.ts +56 -0
  34. package/build/cjs/src/bookings-v2-price-info.http.js +164 -0
  35. package/build/cjs/src/bookings-v2-price-info.http.js.map +1 -0
  36. package/build/cjs/src/bookings-v2-price-info.public.d.ts +6 -0
  37. package/build/cjs/src/bookings-v2-price-info.public.js +26 -0
  38. package/build/cjs/src/bookings-v2-price-info.public.js.map +1 -0
  39. package/build/cjs/src/bookings-v2-price-info.types.d.ts +594 -0
  40. package/build/cjs/src/bookings-v2-price-info.types.js +79 -0
  41. package/build/cjs/src/bookings-v2-price-info.types.js.map +1 -0
  42. package/build/cjs/src/bookings-v2-price-info.universal.d.ts +664 -0
  43. package/build/cjs/src/bookings-v2-price-info.universal.js +274 -0
  44. package/build/cjs/src/bookings-v2-price-info.universal.js.map +1 -0
  45. package/build/es/index.d.ts +3 -0
  46. package/build/es/index.js +3 -0
  47. package/build/es/index.js.map +1 -1
  48. package/build/es/src/bookings-availability-v1-slot-availability.http.d.ts +6 -6
  49. package/build/es/src/bookings-availability-v1-slot-availability.http.js +6 -6
  50. package/build/es/src/bookings-availability-v1-slot-availability.universal.d.ts +14 -29
  51. package/build/es/src/bookings-availability-v1-slot-availability.universal.js +7 -6
  52. package/build/es/src/bookings-availability-v1-slot-availability.universal.js.map +1 -1
  53. package/build/es/src/bookings-reader-v2-extended-booking.http.d.ts +38 -0
  54. package/build/es/src/bookings-reader-v2-extended-booking.http.js +113 -0
  55. package/build/es/src/bookings-reader-v2-extended-booking.http.js.map +1 -0
  56. package/build/es/src/bookings-reader-v2-extended-booking.public.d.ts +5 -0
  57. package/build/es/src/bookings-reader-v2-extended-booking.public.js +8 -0
  58. package/build/es/src/bookings-reader-v2-extended-booking.public.js.map +1 -0
  59. package/build/es/src/bookings-reader-v2-extended-booking.types.d.ts +730 -0
  60. package/build/es/src/bookings-reader-v2-extended-booking.types.js +87 -0
  61. package/build/es/src/bookings-reader-v2-extended-booking.types.js.map +1 -0
  62. package/build/es/src/bookings-reader-v2-extended-booking.universal.d.ts +786 -0
  63. package/build/es/src/bookings-reader-v2-extended-booking.universal.js +203 -0
  64. package/build/es/src/bookings-reader-v2-extended-booking.universal.js.map +1 -0
  65. package/build/es/src/bookings-v2-booking.http.d.ts +123 -0
  66. package/build/es/src/bookings-v2-booking.http.js +297 -0
  67. package/build/es/src/bookings-v2-booking.http.js.map +1 -0
  68. package/build/es/src/bookings-v2-booking.public.d.ts +9 -0
  69. package/build/es/src/bookings-v2-booking.public.js +28 -0
  70. package/build/es/src/bookings-v2-booking.public.js.map +1 -0
  71. package/build/es/src/bookings-v2-booking.types.d.ts +1594 -0
  72. package/build/es/src/bookings-v2-booking.types.js +96 -0
  73. package/build/es/src/bookings-v2-booking.types.js.map +1 -0
  74. package/build/es/src/bookings-v2-booking.universal.d.ts +1840 -0
  75. package/build/es/src/bookings-v2-booking.universal.js +534 -0
  76. package/build/es/src/bookings-v2-booking.universal.js.map +1 -0
  77. package/build/es/src/bookings-v2-price-info.http.d.ts +56 -0
  78. package/build/es/src/bookings-v2-price-info.http.js +159 -0
  79. package/build/es/src/bookings-v2-price-info.http.js.map +1 -0
  80. package/build/es/src/bookings-v2-price-info.public.d.ts +6 -0
  81. package/build/es/src/bookings-v2-price-info.public.js +13 -0
  82. package/build/es/src/bookings-v2-price-info.public.js.map +1 -0
  83. package/build/es/src/bookings-v2-price-info.types.d.ts +594 -0
  84. package/build/es/src/bookings-v2-price-info.types.js +76 -0
  85. package/build/es/src/bookings-v2-price-info.types.js.map +1 -0
  86. package/build/es/src/bookings-v2-price-info.universal.d.ts +664 -0
  87. package/build/es/src/bookings-v2-price-info.universal.js +250 -0
  88. package/build/es/src/bookings-v2-price-info.universal.js.map +1 -0
  89. package/package.json +2 -2
@@ -0,0 +1,534 @@
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 } from '@wix/metro-runtime/velo';
11
+ import * as ambassadorWixBookingsV2Booking from './bookings-v2-booking.http';
12
+ let __verbose = false;
13
+ function __log(...args) {
14
+ __verbose && console.log(...args);
15
+ }
16
+ function __inspect(obj) {
17
+ return obj;
18
+ }
19
+ export const __debug = {
20
+ verboseLogging: {
21
+ on: () => (__verbose = true),
22
+ off: () => (__verbose = false),
23
+ },
24
+ };
25
+ const _toVeloEntity = '$';
26
+ const _fromVeloEntity = '$';
27
+ export var LocationType;
28
+ (function (LocationType) {
29
+ LocationType["UNDEFINED"] = "UNDEFINED";
30
+ LocationType["OWNER_BUSINESS"] = "OWNER_BUSINESS";
31
+ LocationType["OWNER_CUSTOM"] = "OWNER_CUSTOM";
32
+ LocationType["CUSTOM"] = "CUSTOM";
33
+ })(LocationType || (LocationType = {}));
34
+ export var ValueType;
35
+ (function (ValueType) {
36
+ /** Short text. This is the default value type. */
37
+ ValueType["SHORT_TEXT"] = "SHORT_TEXT";
38
+ /** Long text */
39
+ ValueType["LONG_TEXT"] = "LONG_TEXT";
40
+ /** a text that represent the check box value: if selected the value is "true", otherwise "false". */
41
+ ValueType["CHECK_BOX"] = "CHECK_BOX";
42
+ })(ValueType || (ValueType = {}));
43
+ /** Booking status. */
44
+ export var BookingStatus;
45
+ (function (BookingStatus) {
46
+ BookingStatus["CREATED"] = "CREATED";
47
+ BookingStatus["CONFIRMED"] = "CONFIRMED";
48
+ BookingStatus["CANCELED"] = "CANCELED";
49
+ BookingStatus["PENDING"] = "PENDING";
50
+ BookingStatus["DECLINED"] = "DECLINED";
51
+ BookingStatus["WAITING_LIST"] = "WAITING_LIST";
52
+ })(BookingStatus || (BookingStatus = {}));
53
+ /**
54
+ * Payment status.
55
+ * Automatically updated when using eCom checkout APIs.
56
+ */
57
+ export var PaymentStatus;
58
+ (function (PaymentStatus) {
59
+ PaymentStatus["UNDEFINED"] = "UNDEFINED";
60
+ PaymentStatus["NOT_PAID"] = "NOT_PAID";
61
+ PaymentStatus["PAID"] = "PAID";
62
+ /** not supported yet. */
63
+ PaymentStatus["PARTIALLY_PAID"] = "PARTIALLY_PAID";
64
+ /** not supported yet */
65
+ PaymentStatus["REFUNDED"] = "REFUNDED";
66
+ })(PaymentStatus || (PaymentStatus = {}));
67
+ /**
68
+ * The selected payment option.
69
+ * One of the payment options offered by the service.
70
+ * This field is be set when the user selects an option during booking.
71
+ * If left undefined, the payment option is resolved by the service configuration on checkout.
72
+ */
73
+ export var SelectedPaymentOption;
74
+ (function (SelectedPaymentOption) {
75
+ SelectedPaymentOption["UNDEFINED"] = "UNDEFINED";
76
+ SelectedPaymentOption["OFFLINE"] = "OFFLINE";
77
+ SelectedPaymentOption["ONLINE"] = "ONLINE";
78
+ SelectedPaymentOption["MEMBERSHIP"] = "MEMBERSHIP";
79
+ /** Payment can only be done using a membership and must be manually redeemed in the dashboard by the site owner. */
80
+ SelectedPaymentOption["MEMBERSHIP_OFFLINE"] = "MEMBERSHIP_OFFLINE";
81
+ })(SelectedPaymentOption || (SelectedPaymentOption = {}));
82
+ export var Platform;
83
+ (function (Platform) {
84
+ Platform["UNDEFINED_PLATFORM"] = "UNDEFINED_PLATFORM";
85
+ Platform["WEB"] = "WEB";
86
+ Platform["MOBILE_APP"] = "MOBILE_APP";
87
+ })(Platform || (Platform = {}));
88
+ export var Actor;
89
+ (function (Actor) {
90
+ Actor["UNDEFINED_ACTOR"] = "UNDEFINED_ACTOR";
91
+ Actor["BUSINESS"] = "BUSINESS";
92
+ Actor["CUSTOMER"] = "CUSTOMER";
93
+ })(Actor || (Actor = {}));
94
+ export var IdentificationDataIdentityType;
95
+ (function (IdentificationDataIdentityType) {
96
+ IdentificationDataIdentityType["UNKNOWN"] = "UNKNOWN";
97
+ IdentificationDataIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
98
+ IdentificationDataIdentityType["MEMBER"] = "MEMBER";
99
+ IdentificationDataIdentityType["WIX_USER"] = "WIX_USER";
100
+ IdentificationDataIdentityType["APP"] = "APP";
101
+ })(IdentificationDataIdentityType || (IdentificationDataIdentityType = {}));
102
+ export var LocationLocationType;
103
+ (function (LocationLocationType) {
104
+ LocationLocationType["UNDEFINED"] = "UNDEFINED";
105
+ LocationLocationType["OWNER_BUSINESS"] = "OWNER_BUSINESS";
106
+ LocationLocationType["OWNER_CUSTOM"] = "OWNER_CUSTOM";
107
+ LocationLocationType["CUSTOM"] = "CUSTOM";
108
+ })(LocationLocationType || (LocationLocationType = {}));
109
+ export var SortOrder;
110
+ (function (SortOrder) {
111
+ SortOrder["ASC"] = "ASC";
112
+ SortOrder["DESC"] = "DESC";
113
+ })(SortOrder || (SortOrder = {}));
114
+ export var IdentityType;
115
+ (function (IdentityType) {
116
+ IdentityType["UNKNOWN"] = "UNKNOWN";
117
+ IdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
118
+ IdentityType["MEMBER"] = "MEMBER";
119
+ IdentityType["WIX_USER"] = "WIX_USER";
120
+ IdentityType["APP"] = "APP";
121
+ })(IdentityType || (IdentityType = {}));
122
+ const _cancelBookingRequest = {};
123
+ const _cancelBookingResponse = {};
124
+ const _confirmBookingRequest = {};
125
+ const _confirmBookingResponse = {};
126
+ const _declineBookingRequest = {};
127
+ const _declineBookingResponse = {};
128
+ const _rescheduleBookingRequest = {};
129
+ const _rescheduleBookingResponse = {};
130
+ const _updateNumberOfParticipantsRequest = {};
131
+ const _updateNumberOfParticipantsResponse = {};
132
+ /**
133
+ * Reschedules a booking to a different slot or session.
134
+ *
135
+ *
136
+ * You can only reschedule bookings for appointments or classes, you can't
137
+ * reschedule course bookings.
138
+ *
139
+ * The old session is removed from the calendar and the new session is
140
+ * added.
141
+ *
142
+ * If you reschedule a booking for a class session the new session must be an
143
+ * existing session for the same class.
144
+ *
145
+ * You can pass a `participantNotification.message` to notify the customer of
146
+ * the rescheduling. You also need to pass `participantNotification.notifyParticipants`
147
+ * as `true` to actually send the message.
148
+ *
149
+ * In case the service has
150
+ * variants, you can call this endpoint to update the booking's `totalParticipants` or `participantsChoices`.
151
+ * If you provide `participantsChoices`, all of the provided choices must exist for
152
+ * the service. Otherwise, the call returns an `INVALID_SERVICE_CHOICES` error.
153
+ * If you omit `participantsChoices` in the request, the existing choices are
154
+ * kept and not replaced with an empty object.
155
+ *
156
+ * <!-- INTERNAL PERMISSION COMMENT:
157
+ * You need to have the `BOOKINGS.NUMBER_OF_PARTICIPANTS_UPDATE` permission
158
+ * to reschedule bookings including `participantsInfo`.
159
+ * <!--END: INTERNAL PERMISSION COMMENT-->
160
+ *
161
+ * In case you want to reschedule a booking on behalf of a customer, we recommend
162
+ * to pass `flowControlSettings.ignoreReschedulePolicy` as `false`. This
163
+ * ensures that the rescheduling is validated against the service's rescheduling
164
+ * policy.
165
+ * @param bookingId - Id of the booking to reschedule.
166
+ * @param slot - Information about the new slot.
167
+ * @public
168
+ * @documentationMaturity preview
169
+ * @requiredField bookingId
170
+ * @requiredField options.revision
171
+ * @requiredField slot
172
+ * @param options - An object representing the available options for rescheduling a booking.
173
+ */
174
+ export function rescheduleBooking(bookingId, slot, options) {
175
+ var _a, _b, _c;
176
+ return __awaiter(this, arguments, void 0, function* () {
177
+ const requestTransformation = {
178
+ bookingId: '$[0]',
179
+ slot: '$[1]',
180
+ revision: '$[2].revision',
181
+ participantNotification: '$[2].participantNotification',
182
+ flowControlSettings: '$[2].flowControlSettings',
183
+ totalParticipants: '$[2].totalParticipants',
184
+ participantsChoices: '$[2].participantsChoices',
185
+ };
186
+ const responseTransformation = '$';
187
+ // @ts-ignore
188
+ const { httpClient, sideEffects } = arguments[3];
189
+ const { toAmbassadorRequest } = serializer({
190
+ rootSchema: _rescheduleBookingRequest,
191
+ depSchemas: {},
192
+ fqdnTransformation: {
193
+ paths: [],
194
+ transformation: _fromVeloEntity,
195
+ },
196
+ customTransformation: requestTransformation,
197
+ });
198
+ const { fromJSON } = serializer({
199
+ rootSchema: _rescheduleBookingResponse,
200
+ depSchemas: {},
201
+ fqdnTransformation: {
202
+ paths: [...['booking']],
203
+ transformation: _toVeloEntity,
204
+ },
205
+ customTransformation: responseTransformation,
206
+ });
207
+ const payload = toAmbassadorRequest([bookingId, slot, options]);
208
+ const reqOpts = ambassadorWixBookingsV2Booking.rescheduleBooking(payload);
209
+ __log(`"RescheduleBooking" sending request with: ${__inspect(reqOpts)}`);
210
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
211
+ try {
212
+ const result = yield httpClient.request(reqOpts);
213
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
214
+ return fromJSON(result.data);
215
+ }
216
+ catch (err) {
217
+ const transformedError = transformError(err, requestTransformation, [
218
+ 'bookingId',
219
+ 'slot',
220
+ 'options',
221
+ ]);
222
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
223
+ throw transformedError;
224
+ }
225
+ });
226
+ }
227
+ /**
228
+ * Confirms a booking request and changes the booking status to `CONFIRMED`.
229
+ *
230
+ *
231
+ * Calling this method doesn't check whether a slot or schedule is still
232
+ * available at this time.
233
+ *
234
+ * You can only confirm bookings for services that require the owner's manual
235
+ * approval for bookings and that have a status of `PENDING`.
236
+ *
237
+ * For appointment services the slot may become unavailable, depending on the
238
+ * [service's](https://support.wix.com/en/article/creating-the-right-booking-service-for-your-business)
239
+ * `policy.bookingApprovalPolicy.requestsAffectsAvailability`.
240
+ *
241
+ * Calling this method also changes the
242
+ * [session's](https://www.wix.com/velo/reference/wix-bookings-backend/sessions/getsession)
243
+ * `participants.approvalStatus` to `APPROVED`.
244
+ *
245
+ * You can pass a `participantNotification.message` to notify the customer of
246
+ * the confirmation. You also need to pass `participantNotification.notifyParticipants`
247
+ * as `true` to actually send the message.
248
+ *
249
+ * Bookings are automatically confirmed when the
250
+ * service is configured to automatically confirm
251
+ * bookings and the [eCommerce order](https://www.wix.com/velo/reference/wix-ecom-backend/orders)
252
+ * has been approved. The slot's or schedule's availability is checked just
253
+ * before confirming the booking as part of the automatic flow.
254
+ * @param bookingId - ID of the booking to confirm.
255
+ * @param revision - Revision number, which increments by 1 each time the booking is updated.
256
+ * To prevent conflicting changes, the current revision must be passed when
257
+ * managing the booking.
258
+ * @public
259
+ * @documentationMaturity preview
260
+ * @requiredField bookingId
261
+ * @requiredField revision
262
+ * @param options - An object representing the available options for canceling a booking.
263
+ */
264
+ export function confirmBooking(bookingId, revision, options) {
265
+ var _a, _b, _c;
266
+ return __awaiter(this, arguments, void 0, function* () {
267
+ const requestTransformation = {
268
+ bookingId: '$[0]',
269
+ revision: '$[1]',
270
+ participantNotification: '$[2].participantNotification',
271
+ };
272
+ const responseTransformation = '$';
273
+ // @ts-ignore
274
+ const { httpClient, sideEffects } = arguments[3];
275
+ const { toAmbassadorRequest } = serializer({
276
+ rootSchema: _confirmBookingRequest,
277
+ depSchemas: {},
278
+ fqdnTransformation: {
279
+ paths: [],
280
+ transformation: _fromVeloEntity,
281
+ },
282
+ customTransformation: requestTransformation,
283
+ });
284
+ const { fromJSON } = serializer({
285
+ rootSchema: _confirmBookingResponse,
286
+ depSchemas: {},
287
+ fqdnTransformation: {
288
+ paths: [...['booking']],
289
+ transformation: _toVeloEntity,
290
+ },
291
+ customTransformation: responseTransformation,
292
+ });
293
+ const payload = toAmbassadorRequest([bookingId, revision, options]);
294
+ const reqOpts = ambassadorWixBookingsV2Booking.bookingsConfirmBooking(payload);
295
+ __log(`"ConfirmBooking" sending request with: ${__inspect(reqOpts)}`);
296
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
297
+ try {
298
+ const result = yield httpClient.request(reqOpts);
299
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
300
+ return fromJSON(result.data);
301
+ }
302
+ catch (err) {
303
+ const transformedError = transformError(err, requestTransformation, [
304
+ 'bookingId',
305
+ 'revision',
306
+ 'options',
307
+ ]);
308
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
309
+ throw transformedError;
310
+ }
311
+ });
312
+ }
313
+ /**
314
+ * Declines a `PENDING` booking request and changes the booking status to
315
+ * `DECLINED`.
316
+ *
317
+ * Calling this method also changes the
318
+ * [session's](https://www.wix.com/velo/reference/wix-bookings-backend/sessions/getsession)
319
+ * `participants.approvalStatus` to `DECLINED`.
320
+ *
321
+ * You can only decline bookings for services that require the owner's manual
322
+ * approval for bookings and that have a status of `PENDING`.
323
+ *
324
+ * You can pass a `participantNotification.message` to notify the customer of
325
+ * the decline. You also need to pass `participantNotification.notifyParticipants`
326
+ * as `true` to actually send the message.
327
+ * @param bookingId - ID of the booking to decline.
328
+ * @param revision - Revision number, which increments by 1 each time the booking is updated.
329
+ * To prevent conflicting changes, the current revision must be passed when
330
+ * managing the booking.
331
+ * @public
332
+ * @documentationMaturity preview
333
+ * @requiredField bookingId
334
+ * @requiredField revision
335
+ * @param options - An object representing the available options for declining a booking.
336
+ */
337
+ export function declineBooking(bookingId, revision, options) {
338
+ var _a, _b, _c;
339
+ return __awaiter(this, arguments, void 0, function* () {
340
+ const requestTransformation = {
341
+ bookingId: '$[0]',
342
+ revision: '$[1]',
343
+ participantNotification: '$[2].participantNotification',
344
+ };
345
+ const responseTransformation = '$';
346
+ // @ts-ignore
347
+ const { httpClient, sideEffects } = arguments[3];
348
+ const { toAmbassadorRequest } = serializer({
349
+ rootSchema: _declineBookingRequest,
350
+ depSchemas: {},
351
+ fqdnTransformation: {
352
+ paths: [],
353
+ transformation: _fromVeloEntity,
354
+ },
355
+ customTransformation: requestTransformation,
356
+ });
357
+ const { fromJSON } = serializer({
358
+ rootSchema: _declineBookingResponse,
359
+ depSchemas: {},
360
+ fqdnTransformation: {
361
+ paths: [...['booking']],
362
+ transformation: _toVeloEntity,
363
+ },
364
+ customTransformation: responseTransformation,
365
+ });
366
+ const payload = toAmbassadorRequest([bookingId, revision, options]);
367
+ const reqOpts = ambassadorWixBookingsV2Booking.bookingsDeclineBooking(payload);
368
+ __log(`"DeclineBooking" sending request with: ${__inspect(reqOpts)}`);
369
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
370
+ try {
371
+ const result = yield httpClient.request(reqOpts);
372
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
373
+ return fromJSON(result.data);
374
+ }
375
+ catch (err) {
376
+ const transformedError = transformError(err, requestTransformation, [
377
+ 'bookingId',
378
+ 'revision',
379
+ 'options',
380
+ ]);
381
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
382
+ throw transformedError;
383
+ }
384
+ });
385
+ }
386
+ /**
387
+ * Cancels a booking.
388
+ *
389
+ *
390
+ * The booking status changes to `CANCELED`.
391
+ *
392
+ * If the booking was for an appointment, the corresponding session is
393
+ * deleted from the business calendar.
394
+ *
395
+ * If the booking was for a class or course, the participants are removed
396
+ * from the class session or the course. But the course or class session
397
+ * remains on the business calendar.
398
+ *
399
+ * You can pass a `participantNotification.message` to notify the customer of
400
+ * the cancelation. You also need to pass `participantNotification.notifyParticipants`
401
+ * as `true` to actually send the message.
402
+ *
403
+ * In case you want to cancel a booking on behalf of a customer, we recommend
404
+ * to pass `flowControlSettings.ignoreCancellationPolicy` as `false`. This
405
+ * ensures that the cancelation is validated against the service's cancelation
406
+ * policy.
407
+ * @param bookingId - ID of the booking to cancel.
408
+ * @public
409
+ * @documentationMaturity preview
410
+ * @requiredField bookingId
411
+ * @requiredField options.revision
412
+ * @param options - An object representing the available options for canceling a booking.
413
+ */
414
+ export function cancelBooking(bookingId, options) {
415
+ var _a, _b, _c;
416
+ return __awaiter(this, arguments, void 0, function* () {
417
+ const requestTransformation = {
418
+ bookingId: '$[0]',
419
+ participantNotification: '$[1].participantNotification',
420
+ flowControlSettings: '$[1].flowControlSettings',
421
+ revision: '$[1].revision',
422
+ };
423
+ const responseTransformation = '$';
424
+ // @ts-ignore
425
+ const { httpClient, sideEffects } = arguments[2];
426
+ const { toAmbassadorRequest } = serializer({
427
+ rootSchema: _cancelBookingRequest,
428
+ depSchemas: {},
429
+ fqdnTransformation: {
430
+ paths: [],
431
+ transformation: _fromVeloEntity,
432
+ },
433
+ customTransformation: requestTransformation,
434
+ });
435
+ const { fromJSON } = serializer({
436
+ rootSchema: _cancelBookingResponse,
437
+ depSchemas: {},
438
+ fqdnTransformation: {
439
+ paths: [...['booking']],
440
+ transformation: _toVeloEntity,
441
+ },
442
+ customTransformation: responseTransformation,
443
+ });
444
+ const payload = toAmbassadorRequest([bookingId, options]);
445
+ const reqOpts = ambassadorWixBookingsV2Booking.bookingsCancelBooking(payload);
446
+ __log(`"CancelBooking" sending request with: ${__inspect(reqOpts)}`);
447
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
448
+ try {
449
+ const result = yield httpClient.request(reqOpts);
450
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
451
+ return fromJSON(result.data);
452
+ }
453
+ catch (err) {
454
+ const transformedError = transformError(err, requestTransformation, [
455
+ 'bookingId',
456
+ 'options',
457
+ ]);
458
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
459
+ throw transformedError;
460
+ }
461
+ });
462
+ }
463
+ /**
464
+ * Updates the number of participants for a booking.
465
+ *
466
+ *
467
+ * You can only update the number of participants for class and course
468
+ * bookings, you can't update it for appointment bookings.
469
+ *
470
+ * Calling this method also changes the
471
+ * [session's](https://www.wix.com/velo/reference/wix-bookings-backend/sessions/getsession)
472
+ * `totalNumberOfParticipants`.
473
+ *
474
+ * When updating the number of participants for a booking you must pass either
475
+ * `participantsChoices` or `totalParticipants`. If you pass `participantsChoices`
476
+ * for services that have variants,
477
+ * all of the provided choices must exist for the service. Otherwise, the
478
+ * call returns an `INVALID_SERVICE_CHOICES` error.
479
+ * @param bookingId - ID of the booking to update the number of participants for.
480
+ * @public
481
+ * @documentationMaturity preview
482
+ * @requiredField bookingId
483
+ * @requiredField options.revision
484
+ */
485
+ export function updateNumberOfParticipants(bookingId, options) {
486
+ var _a, _b, _c;
487
+ return __awaiter(this, arguments, void 0, function* () {
488
+ const requestTransformation = {
489
+ bookingId: '$[0]',
490
+ revision: '$[1].revision',
491
+ totalParticipants: '$[1].totalParticipants',
492
+ participantsChoices: '$[1].participantsChoices',
493
+ };
494
+ const responseTransformation = '$';
495
+ // @ts-ignore
496
+ const { httpClient, sideEffects } = arguments[2];
497
+ const { toAmbassadorRequest } = serializer({
498
+ rootSchema: _updateNumberOfParticipantsRequest,
499
+ depSchemas: {},
500
+ fqdnTransformation: {
501
+ paths: [],
502
+ transformation: _fromVeloEntity,
503
+ },
504
+ customTransformation: requestTransformation,
505
+ });
506
+ const { fromJSON } = serializer({
507
+ rootSchema: _updateNumberOfParticipantsResponse,
508
+ depSchemas: {},
509
+ fqdnTransformation: {
510
+ paths: [...['booking']],
511
+ transformation: _toVeloEntity,
512
+ },
513
+ customTransformation: responseTransformation,
514
+ });
515
+ const payload = toAmbassadorRequest([bookingId, options]);
516
+ const reqOpts = ambassadorWixBookingsV2Booking.bookingsUpdateNumberOfParticipants(payload);
517
+ __log(`"UpdateNumberOfParticipants" sending request with: ${__inspect(reqOpts)}`);
518
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
519
+ try {
520
+ const result = yield httpClient.request(reqOpts);
521
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
522
+ return fromJSON(result.data);
523
+ }
524
+ catch (err) {
525
+ const transformedError = transformError(err, requestTransformation, [
526
+ 'bookingId',
527
+ 'options',
528
+ ]);
529
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
530
+ throw transformedError;
531
+ }
532
+ });
533
+ }
534
+ //# sourceMappingURL=bookings-v2-booking.universal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bookings-v2-booking.universal.js","sourceRoot":"","sources":["../../../src/bookings-v2-booking.universal.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,KAAK,8BAA8B,MAAM,4BAA4B,CAAC;AAE7E,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,SAAS,KAAK,CAAC,GAAG,IAAW;IAC3B,SAAS,IAAI,OAAO,CAAC,GAAG,CAA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B,MAAM,gBAAgB,GAAG,cAAc,CAAC,GAAG,EAAE,qBAAqB,EAAE;gBAClE,WAAW;gBACX,SAAS;aACV,CAAC,CAAC;YACH,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,+CAApB,WAAW,EAAY,GAAG,CAAC,CAAC;YAE5B,MAAM,gBAAgB,CAAC;SACxB;;CACF"}
@@ -0,0 +1,56 @@
1
+ import { RequestOptionsFactory } from '@wix/sdk-types';
2
+ import { CalculatePriceRequest, CalculatePriceResponse, PreviewPriceRequest, PreviewPriceResponse } from './bookings-v2-price-info.types';
3
+ /**
4
+ * Previews the base price for a set of line items belonging to the same service,
5
+ * before a booking is actually created.
6
+ *
7
+ * The returned price preview information about each line
8
+ * item's price and sums up each line item's price.
9
+ *
10
+ * The previewed price is not the actual price that will be used to charge the customer.
11
+ * `Preview Price` only estimates the base price by adding up the price
12
+ * of each line item before
13
+ * the booking is actually created.
14
+ *
15
+ * Use [`Calculate Price`](https://example.com) to get the base price
16
+ * after the booking is created.
17
+ *
18
+ * Passing line items that belong to different services results in an error.
19
+ *
20
+ * ## Calculating the previewed price
21
+ *
22
+ * Wix Bookings has its own default pricing logic for previewing the price. You must
23
+ * pass the `serviceId` in the [`slot`](https://example.com/)
24
+ * or [`schedule`](https://example.com/) object to `Preview Price`.
25
+ *
26
+ * You cannot call `Preview Price` if you have customized Bookings pricing logic using the
27
+ * [Bookings Pricing Provider SPI](https://example.com/). Calling `Preview Price` if custom pricing
28
+ * logic has been implemented for the site results in an error.
29
+ */
30
+ export declare function previewPrice(payload: PreviewPriceRequest): RequestOptionsFactory<PreviewPriceResponse>;
31
+ /**
32
+ * Calculates the base price of a booking.
33
+ *
34
+ *
35
+ * You can call `Calculate Price` after a booking is created. The returned calculated price includes information about each line
36
+ * item's price and the booking's total price.
37
+ *
38
+ * You can use [`Preview Price`](https://example.com) to get the base price
39
+ * before a booking is created.
40
+ *
41
+ * The calculated price is the base price that will be used as a basis for charging the customer.
42
+ * During checkout, additional taxes
43
+ * and fees might be added to this base price.
44
+ *
45
+ * ## Calculating the price
46
+ *
47
+ * Wix Bookings has its own default pricing logic for calculating the price. When
48
+ * using Wix Bookings' default pricing logic, you must pass the `serviceId` in the [`slot`](https://example.com/)
49
+ * or [`schedule`](https://example.com/) object to `Calculate Price`.
50
+ *
51
+ * Alternatively you can customize the pricing logic using the
52
+ * [Bookings Pricing Provider SPI](https://example.com/).
53
+ * If you integrate with a pricing provider, the customized pricing logic becomes
54
+ * the default logic.
55
+ */
56
+ export declare function calculatePrice(payload: CalculatePriceRequest): RequestOptionsFactory<CalculatePriceResponse>;