@wix/auto_sdk_bookings_bookings 1.0.0

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 (111) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +18 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +1 -0
  5. package/build/cjs/index.typings.js +18 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +1 -0
  8. package/build/cjs/meta.js +18 -0
  9. package/build/cjs/meta.js.map +1 -0
  10. package/build/cjs/src/bookings-v2-booking-bookings.context.d.ts +61 -0
  11. package/build/cjs/src/bookings-v2-booking-bookings.context.js +77 -0
  12. package/build/cjs/src/bookings-v2-booking-bookings.context.js.map +1 -0
  13. package/build/cjs/src/bookings-v2-booking-bookings.http.d.ts +507 -0
  14. package/build/cjs/src/bookings-v2-booking-bookings.http.js +1576 -0
  15. package/build/cjs/src/bookings-v2-booking-bookings.http.js.map +1 -0
  16. package/build/cjs/src/bookings-v2-booking-bookings.meta.d.ts +61 -0
  17. package/build/cjs/src/bookings-v2-booking-bookings.meta.js +427 -0
  18. package/build/cjs/src/bookings-v2-booking-bookings.meta.js.map +1 -0
  19. package/build/cjs/src/bookings-v2-booking-bookings.public.d.ts +625 -0
  20. package/build/cjs/src/bookings-v2-booking-bookings.public.js +313 -0
  21. package/build/cjs/src/bookings-v2-booking-bookings.public.js.map +1 -0
  22. package/build/cjs/src/bookings-v2-booking-bookings.types.d.ts +2736 -0
  23. package/build/cjs/src/bookings-v2-booking-bookings.types.js +165 -0
  24. package/build/cjs/src/bookings-v2-booking-bookings.types.js.map +1 -0
  25. package/build/cjs/src/bookings-v2-booking-bookings.universal.d.ts +4014 -0
  26. package/build/cjs/src/bookings-v2-booking-bookings.universal.js +1646 -0
  27. package/build/cjs/src/bookings-v2-booking-bookings.universal.js.map +1 -0
  28. package/build/es/index.d.ts +1 -0
  29. package/build/es/index.js +2 -0
  30. package/build/es/index.js.map +1 -0
  31. package/build/es/index.typings.d.ts +1 -0
  32. package/build/es/index.typings.js +2 -0
  33. package/build/es/index.typings.js.map +1 -0
  34. package/build/es/meta.d.ts +1 -0
  35. package/build/es/meta.js +2 -0
  36. package/build/es/meta.js.map +1 -0
  37. package/build/es/package.json +3 -0
  38. package/build/es/src/bookings-v2-booking-bookings.context.d.ts +61 -0
  39. package/build/es/src/bookings-v2-booking-bookings.context.js +61 -0
  40. package/build/es/src/bookings-v2-booking-bookings.context.js.map +1 -0
  41. package/build/es/src/bookings-v2-booking-bookings.http.d.ts +507 -0
  42. package/build/es/src/bookings-v2-booking-bookings.http.js +1552 -0
  43. package/build/es/src/bookings-v2-booking-bookings.http.js.map +1 -0
  44. package/build/es/src/bookings-v2-booking-bookings.meta.d.ts +61 -0
  45. package/build/es/src/bookings-v2-booking-bookings.meta.js +380 -0
  46. package/build/es/src/bookings-v2-booking-bookings.meta.js.map +1 -0
  47. package/build/es/src/bookings-v2-booking-bookings.public.d.ts +625 -0
  48. package/build/es/src/bookings-v2-booking-bookings.public.js +276 -0
  49. package/build/es/src/bookings-v2-booking-bookings.public.js.map +1 -0
  50. package/build/es/src/bookings-v2-booking-bookings.types.d.ts +2736 -0
  51. package/build/es/src/bookings-v2-booking-bookings.types.js +162 -0
  52. package/build/es/src/bookings-v2-booking-bookings.types.js.map +1 -0
  53. package/build/es/src/bookings-v2-booking-bookings.universal.d.ts +4014 -0
  54. package/build/es/src/bookings-v2-booking-bookings.universal.js +1599 -0
  55. package/build/es/src/bookings-v2-booking-bookings.universal.js.map +1 -0
  56. package/build/internal/cjs/index.d.ts +1 -0
  57. package/build/internal/cjs/index.js +18 -0
  58. package/build/internal/cjs/index.js.map +1 -0
  59. package/build/internal/cjs/index.typings.d.ts +1 -0
  60. package/build/internal/cjs/index.typings.js +18 -0
  61. package/build/internal/cjs/index.typings.js.map +1 -0
  62. package/build/internal/cjs/meta.d.ts +1 -0
  63. package/build/internal/cjs/meta.js +18 -0
  64. package/build/internal/cjs/meta.js.map +1 -0
  65. package/build/internal/cjs/src/bookings-v2-booking-bookings.context.d.ts +61 -0
  66. package/build/internal/cjs/src/bookings-v2-booking-bookings.context.js +77 -0
  67. package/build/internal/cjs/src/bookings-v2-booking-bookings.context.js.map +1 -0
  68. package/build/internal/cjs/src/bookings-v2-booking-bookings.http.d.ts +507 -0
  69. package/build/internal/cjs/src/bookings-v2-booking-bookings.http.js +1576 -0
  70. package/build/internal/cjs/src/bookings-v2-booking-bookings.http.js.map +1 -0
  71. package/build/internal/cjs/src/bookings-v2-booking-bookings.meta.d.ts +61 -0
  72. package/build/internal/cjs/src/bookings-v2-booking-bookings.meta.js +427 -0
  73. package/build/internal/cjs/src/bookings-v2-booking-bookings.meta.js.map +1 -0
  74. package/build/internal/cjs/src/bookings-v2-booking-bookings.public.d.ts +625 -0
  75. package/build/internal/cjs/src/bookings-v2-booking-bookings.public.js +313 -0
  76. package/build/internal/cjs/src/bookings-v2-booking-bookings.public.js.map +1 -0
  77. package/build/internal/cjs/src/bookings-v2-booking-bookings.types.d.ts +2736 -0
  78. package/build/internal/cjs/src/bookings-v2-booking-bookings.types.js +165 -0
  79. package/build/internal/cjs/src/bookings-v2-booking-bookings.types.js.map +1 -0
  80. package/build/internal/cjs/src/bookings-v2-booking-bookings.universal.d.ts +4014 -0
  81. package/build/internal/cjs/src/bookings-v2-booking-bookings.universal.js +1646 -0
  82. package/build/internal/cjs/src/bookings-v2-booking-bookings.universal.js.map +1 -0
  83. package/build/internal/es/index.d.ts +1 -0
  84. package/build/internal/es/index.js +2 -0
  85. package/build/internal/es/index.js.map +1 -0
  86. package/build/internal/es/index.typings.d.ts +1 -0
  87. package/build/internal/es/index.typings.js +2 -0
  88. package/build/internal/es/index.typings.js.map +1 -0
  89. package/build/internal/es/meta.d.ts +1 -0
  90. package/build/internal/es/meta.js +2 -0
  91. package/build/internal/es/meta.js.map +1 -0
  92. package/build/internal/es/src/bookings-v2-booking-bookings.context.d.ts +61 -0
  93. package/build/internal/es/src/bookings-v2-booking-bookings.context.js +61 -0
  94. package/build/internal/es/src/bookings-v2-booking-bookings.context.js.map +1 -0
  95. package/build/internal/es/src/bookings-v2-booking-bookings.http.d.ts +507 -0
  96. package/build/internal/es/src/bookings-v2-booking-bookings.http.js +1552 -0
  97. package/build/internal/es/src/bookings-v2-booking-bookings.http.js.map +1 -0
  98. package/build/internal/es/src/bookings-v2-booking-bookings.meta.d.ts +61 -0
  99. package/build/internal/es/src/bookings-v2-booking-bookings.meta.js +380 -0
  100. package/build/internal/es/src/bookings-v2-booking-bookings.meta.js.map +1 -0
  101. package/build/internal/es/src/bookings-v2-booking-bookings.public.d.ts +625 -0
  102. package/build/internal/es/src/bookings-v2-booking-bookings.public.js +276 -0
  103. package/build/internal/es/src/bookings-v2-booking-bookings.public.js.map +1 -0
  104. package/build/internal/es/src/bookings-v2-booking-bookings.types.d.ts +2736 -0
  105. package/build/internal/es/src/bookings-v2-booking-bookings.types.js +162 -0
  106. package/build/internal/es/src/bookings-v2-booking-bookings.types.js.map +1 -0
  107. package/build/internal/es/src/bookings-v2-booking-bookings.universal.d.ts +4014 -0
  108. package/build/internal/es/src/bookings-v2-booking-bookings.universal.js +1599 -0
  109. package/build/internal/es/src/bookings-v2-booking-bookings.universal.js.map +1 -0
  110. package/meta/package.json +3 -0
  111. package/package.json +52 -0
@@ -0,0 +1,1599 @@
1
+ import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
2
+ import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
3
+ import * as ambassadorWixBookingsV2Booking from './bookings-v2-booking-bookings.http.js';
4
+ /**
5
+ * A multi-service booking is considered available if all individual bookings are available as returned from List Multi Service Availability Time Slots.
6
+ * Currently, `SEPARATE_BOOKINGS` and `PARALLEL_BOOKINGS` are not supported.
7
+ * Multi-service booking is available if each of its bookings is available separately.
8
+ * For `SEQUENTIAL_BOOKINGS`, see `List Multi Service Availability Time Slots` documentation.
9
+ */
10
+ export var MultiServiceBookingType;
11
+ (function (MultiServiceBookingType) {
12
+ MultiServiceBookingType["SEQUENTIAL_BOOKINGS"] = "SEQUENTIAL_BOOKINGS";
13
+ MultiServiceBookingType["SEPARATE_BOOKINGS"] = "SEPARATE_BOOKINGS";
14
+ MultiServiceBookingType["PARALLEL_BOOKINGS"] = "PARALLEL_BOOKINGS";
15
+ })(MultiServiceBookingType || (MultiServiceBookingType = {}));
16
+ export var LocationType;
17
+ (function (LocationType) {
18
+ LocationType["UNDEFINED"] = "UNDEFINED";
19
+ LocationType["OWNER_BUSINESS"] = "OWNER_BUSINESS";
20
+ LocationType["OWNER_CUSTOM"] = "OWNER_CUSTOM";
21
+ LocationType["CUSTOM"] = "CUSTOM";
22
+ })(LocationType || (LocationType = {}));
23
+ export var ValueType;
24
+ (function (ValueType) {
25
+ /** Short text. This is the default value type. */
26
+ ValueType["SHORT_TEXT"] = "SHORT_TEXT";
27
+ /** Long text. */
28
+ ValueType["LONG_TEXT"] = "LONG_TEXT";
29
+ /** A text that represents the check box value. If selected the value is `true`, otherwise `false`. */
30
+ ValueType["CHECK_BOX"] = "CHECK_BOX";
31
+ })(ValueType || (ValueType = {}));
32
+ /** Booking status. */
33
+ export var BookingStatus;
34
+ (function (BookingStatus) {
35
+ /**
36
+ * The booking was created, but the customer hasn't completed the related
37
+ * eCommerce order yet.
38
+ */
39
+ BookingStatus["CREATED"] = "CREATED";
40
+ /**
41
+ * The merchant has confirmed the booking and it appears in the
42
+ * business calendar. Merchants can set up their services
43
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction))
44
+ * to automatically confirm all `PENDING` bookings.
45
+ */
46
+ BookingStatus["CONFIRMED"] = "CONFIRMED";
47
+ /**
48
+ * The customer has canceled the booking. Depending on the relevant service's
49
+ * policy snapshot
50
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/booking-policy-snapshots/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/policies/booking-policy-snapshots/introduction))
51
+ * they may have to pay a cancellation fee
52
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/booking-fees/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/booking-fees/introduction)).
53
+ */
54
+ BookingStatus["CANCELED"] = "CANCELED";
55
+ /**
56
+ * The merchant must manually confirm the booking before it appears
57
+ * in the business calendar.
58
+ */
59
+ BookingStatus["PENDING"] = "PENDING";
60
+ /** The merchant has declined the booking before the customer was charged. */
61
+ BookingStatus["DECLINED"] = "DECLINED";
62
+ /**
63
+ * The booking is on a waitlist.
64
+ * Currently, you can't call Register to Waitlist
65
+ * ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/waitlist/register-to-waitlist))
66
+ * for course or appointment bookings, even though this is supported in live sites.
67
+ * You can call Register to Waitlist only for class session bookings.
68
+ */
69
+ BookingStatus["WAITING_LIST"] = "WAITING_LIST";
70
+ })(BookingStatus || (BookingStatus = {}));
71
+ /**
72
+ * Payment status.
73
+ * Automatically updated when using eCommerce checkout APIs.
74
+ */
75
+ export var PaymentStatus;
76
+ (function (PaymentStatus) {
77
+ /** Undefined payment status. */
78
+ PaymentStatus["UNDEFINED"] = "UNDEFINED";
79
+ /** The booking isn't paid. */
80
+ PaymentStatus["NOT_PAID"] = "NOT_PAID";
81
+ /** The booking is fully paid. */
82
+ PaymentStatus["PAID"] = "PAID";
83
+ /** The booking is partially paid. */
84
+ PaymentStatus["PARTIALLY_PAID"] = "PARTIALLY_PAID";
85
+ /** The booking is refunded. */
86
+ PaymentStatus["REFUNDED"] = "REFUNDED";
87
+ /** The booking is free of charge. */
88
+ PaymentStatus["EXEMPT"] = "EXEMPT";
89
+ })(PaymentStatus || (PaymentStatus = {}));
90
+ /**
91
+ * Selected payment option.
92
+ *
93
+ * One of the payment options offered by the service.
94
+ * This field is set when the user selects an option during booking.
95
+ * If left undefined, the payment option is resolved by the service configuration on checkout.
96
+ */
97
+ export var SelectedPaymentOption;
98
+ (function (SelectedPaymentOption) {
99
+ /** Undefined payment option. */
100
+ SelectedPaymentOption["UNDEFINED"] = "UNDEFINED";
101
+ /** Offline payment. */
102
+ SelectedPaymentOption["OFFLINE"] = "OFFLINE";
103
+ /** Online payment. */
104
+ SelectedPaymentOption["ONLINE"] = "ONLINE";
105
+ /** Payment using a Wix Pricing Plan. */
106
+ SelectedPaymentOption["MEMBERSHIP"] = "MEMBERSHIP";
107
+ /**
108
+ * Customers can pay only in person with a Wix Pricing Plan, while the Wix user
109
+ * must manually redeem the pricing plan in the dashboard.
110
+ */
111
+ SelectedPaymentOption["MEMBERSHIP_OFFLINE"] = "MEMBERSHIP_OFFLINE";
112
+ })(SelectedPaymentOption || (SelectedPaymentOption = {}));
113
+ export var Platform;
114
+ (function (Platform) {
115
+ Platform["UNDEFINED_PLATFORM"] = "UNDEFINED_PLATFORM";
116
+ Platform["WEB"] = "WEB";
117
+ Platform["MOBILE_APP"] = "MOBILE_APP";
118
+ })(Platform || (Platform = {}));
119
+ export var Actor;
120
+ (function (Actor) {
121
+ Actor["UNDEFINED_ACTOR"] = "UNDEFINED_ACTOR";
122
+ Actor["BUSINESS"] = "BUSINESS";
123
+ Actor["CUSTOMER"] = "CUSTOMER";
124
+ })(Actor || (Actor = {}));
125
+ export var IdentificationDataIdentityType;
126
+ (function (IdentificationDataIdentityType) {
127
+ IdentificationDataIdentityType["UNKNOWN"] = "UNKNOWN";
128
+ IdentificationDataIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
129
+ IdentificationDataIdentityType["MEMBER"] = "MEMBER";
130
+ IdentificationDataIdentityType["WIX_USER"] = "WIX_USER";
131
+ IdentificationDataIdentityType["APP"] = "APP";
132
+ })(IdentificationDataIdentityType || (IdentificationDataIdentityType = {}));
133
+ export var WebhookIdentityType;
134
+ (function (WebhookIdentityType) {
135
+ WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
136
+ WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
137
+ WebhookIdentityType["MEMBER"] = "MEMBER";
138
+ WebhookIdentityType["WIX_USER"] = "WIX_USER";
139
+ WebhookIdentityType["APP"] = "APP";
140
+ })(WebhookIdentityType || (WebhookIdentityType = {}));
141
+ export var LocationLocationType;
142
+ (function (LocationLocationType) {
143
+ /** Undefined location type. */
144
+ LocationLocationType["UNDEFINED"] = "UNDEFINED";
145
+ /** The business address as set in the site’s general settings. */
146
+ LocationLocationType["OWNER_BUSINESS"] = "OWNER_BUSINESS";
147
+ /** The address set when creating the service. */
148
+ LocationLocationType["OWNER_CUSTOM"] = "OWNER_CUSTOM";
149
+ /** The address set for the individual session. */
150
+ LocationLocationType["CUSTOM"] = "CUSTOM";
151
+ })(LocationLocationType || (LocationLocationType = {}));
152
+ export var IdentityType;
153
+ (function (IdentityType) {
154
+ IdentityType["UNKNOWN"] = "UNKNOWN";
155
+ IdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
156
+ IdentityType["MEMBER"] = "MEMBER";
157
+ IdentityType["WIX_USER"] = "WIX_USER";
158
+ IdentityType["APP"] = "APP";
159
+ })(IdentityType || (IdentityType = {}));
160
+ export var SortOrder;
161
+ (function (SortOrder) {
162
+ SortOrder["ASC"] = "ASC";
163
+ SortOrder["DESC"] = "DESC";
164
+ })(SortOrder || (SortOrder = {}));
165
+ /**
166
+ * Creates a multi-service booking.
167
+ *
168
+ *
169
+ * See Create Booking for more information.
170
+ * @param bookings - Single-service bookings to combine in a multi-service booking.
171
+ * @public
172
+ * @documentationMaturity preview
173
+ * @requiredField bookings
174
+ * @requiredField bookings.additionalFields._id
175
+ * @requiredField bookings.bookedEntity
176
+ * @requiredField bookings.bookedEntity.slot
177
+ * @requiredField bookings.bookedEntity.slot.endDate
178
+ * @requiredField bookings.bookedEntity.slot.location.locationType
179
+ * @requiredField bookings.bookedEntity.slot.scheduleId
180
+ * @requiredField bookings.bookedEntity.slot.startDate
181
+ * @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_CREATE
182
+ * @permissionScope Manage Bookings
183
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
184
+ * @permissionScope Manage Bookings - all permissions
185
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
186
+ * @applicableIdentity APP
187
+ * @applicableIdentity VISITOR
188
+ * @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.CreateMultiServiceBooking
189
+ */
190
+ export async function createMultiServiceBooking(bookings, options) {
191
+ // @ts-ignore
192
+ const { httpClient, sideEffects } = arguments[2];
193
+ const payload = renameKeysFromSDKRequestToRESTRequest({
194
+ bookings: bookings,
195
+ participantNotification: options?.participantNotification,
196
+ sendSmsReminder: options?.sendSmsReminder,
197
+ flowControlSettings: options?.flowControlSettings,
198
+ returnFullEntity: options?.returnFullEntity,
199
+ multiServiceBookingType: options?.multiServiceBookingType,
200
+ });
201
+ const reqOpts = ambassadorWixBookingsV2Booking.createMultiServiceBooking(payload);
202
+ sideEffects?.onSiteCall?.();
203
+ try {
204
+ const result = await httpClient.request(reqOpts);
205
+ sideEffects?.onSuccess?.(result);
206
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
207
+ }
208
+ catch (err) {
209
+ const transformedError = sdkTransformError(err, {
210
+ spreadPathsToArguments: {},
211
+ explicitPathsToArguments: {
212
+ bookings: '$[0]',
213
+ participantNotification: '$[1].participantNotification',
214
+ sendSmsReminder: '$[1].sendSmsReminder',
215
+ flowControlSettings: '$[1].flowControlSettings',
216
+ returnFullEntity: '$[1].returnFullEntity',
217
+ multiServiceBookingType: '$[1].multiServiceBookingType',
218
+ },
219
+ singleArgumentUnchanged: false,
220
+ }, ['bookings', 'options']);
221
+ sideEffects?.onError?.(err);
222
+ throw transformedError;
223
+ }
224
+ }
225
+ /**
226
+ * Reschedules a multi-service booking.
227
+ *
228
+ *
229
+ * The call fails if at least 1 individual booking can't be rescheduled due
230
+ * the service being unavailable or a rescheduling policy violation.
231
+ *
232
+ *
233
+ * See Reschedule Booking for more information.
234
+ * @param multiServiceBookingId - ID of the multi service booking to reschedule.
235
+ * @param rescheduleBookingsInfo - Information about the single-service bookings to reschedule.
236
+ * @public
237
+ * @documentationMaturity preview
238
+ * @requiredField multiServiceBookingId
239
+ * @requiredField rescheduleBookingsInfo
240
+ * @requiredField rescheduleBookingsInfo.bookingId
241
+ * @requiredField rescheduleBookingsInfo.revision
242
+ * @requiredField rescheduleBookingsInfo.slot
243
+ * @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_RESCHEDULE
244
+ * @permissionScope Manage Bookings
245
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
246
+ * @permissionScope Manage Bookings - all permissions
247
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
248
+ * @applicableIdentity APP
249
+ * @applicableIdentity MEMBER
250
+ * @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.RescheduleMultiServiceBooking
251
+ */
252
+ export async function rescheduleMultiServiceBooking(multiServiceBookingId, rescheduleBookingsInfo, options) {
253
+ // @ts-ignore
254
+ const { httpClient, sideEffects } = arguments[3];
255
+ const payload = renameKeysFromSDKRequestToRESTRequest({
256
+ multiServiceBookingId: multiServiceBookingId,
257
+ rescheduleBookingsInfo: rescheduleBookingsInfo,
258
+ participantNotification: options?.participantNotification,
259
+ flowControlSettings: options?.flowControlSettings,
260
+ returnFullEntity: options?.returnFullEntity,
261
+ });
262
+ const reqOpts = ambassadorWixBookingsV2Booking.rescheduleMultiServiceBooking(payload);
263
+ sideEffects?.onSiteCall?.();
264
+ try {
265
+ const result = await httpClient.request(reqOpts);
266
+ sideEffects?.onSuccess?.(result);
267
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
268
+ }
269
+ catch (err) {
270
+ const transformedError = sdkTransformError(err, {
271
+ spreadPathsToArguments: {},
272
+ explicitPathsToArguments: {
273
+ multiServiceBookingId: '$[0]',
274
+ rescheduleBookingsInfo: '$[1]',
275
+ participantNotification: '$[2].participantNotification',
276
+ flowControlSettings: '$[2].flowControlSettings',
277
+ returnFullEntity: '$[2].returnFullEntity',
278
+ },
279
+ singleArgumentUnchanged: false,
280
+ }, ['multiServiceBookingId', 'rescheduleBookingsInfo', 'options']);
281
+ sideEffects?.onError?.(err);
282
+ throw transformedError;
283
+ }
284
+ }
285
+ /**
286
+ * Retrieves a multi-service booking's availability.
287
+ *
288
+ *
289
+ * Use List Multi Service Availability Time Slots to check availability for a
290
+ * `SEQUENTIAL_BOOKINGS` multi-service booking.
291
+ * @param multiServiceBookingId - ID of the multi-service booking to retrieve.
292
+ * @public
293
+ * @documentationMaturity preview
294
+ * @requiredField multiServiceBookingId
295
+ * @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_GET_AVAILABILITY
296
+ * @permissionScope Read Bookings - Public Data
297
+ * @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
298
+ * @permissionScope Manage Bookings Services and Settings
299
+ * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
300
+ * @permissionScope Manage Bookings
301
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
302
+ * @permissionScope Read Bookings - Including Participants
303
+ * @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
304
+ * @permissionScope Read Bookings - all read permissions
305
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
306
+ * @permissionScope Read Bookings Calendar Availability
307
+ * @permissionScopeId SCOPE.DC-BOOKINGS.READ-CALENDAR
308
+ * @permissionScope Manage Bookings - all permissions
309
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
310
+ * @applicableIdentity APP
311
+ * @applicableIdentity VISITOR
312
+ * @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.GetMultiServiceBookingAvailability
313
+ */
314
+ export async function getMultiServiceBookingAvailability(multiServiceBookingId) {
315
+ // @ts-ignore
316
+ const { httpClient, sideEffects } = arguments[1];
317
+ const payload = renameKeysFromSDKRequestToRESTRequest({
318
+ multiServiceBookingId: multiServiceBookingId,
319
+ });
320
+ const reqOpts = ambassadorWixBookingsV2Booking.getMultiServiceBookingAvailability(payload);
321
+ sideEffects?.onSiteCall?.();
322
+ try {
323
+ const result = await httpClient.request(reqOpts);
324
+ sideEffects?.onSuccess?.(result);
325
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
326
+ }
327
+ catch (err) {
328
+ const transformedError = sdkTransformError(err, {
329
+ spreadPathsToArguments: {},
330
+ explicitPathsToArguments: { multiServiceBookingId: '$[0]' },
331
+ singleArgumentUnchanged: false,
332
+ }, ['multiServiceBookingId']);
333
+ sideEffects?.onError?.(err);
334
+ throw transformedError;
335
+ }
336
+ }
337
+ /**
338
+ * Cancels a multi-service booking and thus all its individual bookings.
339
+ * @param multiServiceBookingId - ID of the multi-service booking to cancel.
340
+ * @public
341
+ * @documentationMaturity preview
342
+ * @requiredField multiServiceBookingId
343
+ * @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_CANCEL
344
+ * @permissionScope Manage Bookings
345
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
346
+ * @permissionScope Manage Bookings - all permissions
347
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
348
+ * @applicableIdentity APP
349
+ * @applicableIdentity MEMBER
350
+ * @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.CancelMultiServiceBooking
351
+ */
352
+ export async function cancelMultiServiceBooking(multiServiceBookingId, options) {
353
+ // @ts-ignore
354
+ const { httpClient, sideEffects } = arguments[2];
355
+ const payload = renameKeysFromSDKRequestToRESTRequest({
356
+ multiServiceBookingId: multiServiceBookingId,
357
+ participantNotification: options?.participantNotification,
358
+ flowControlSettings: options?.flowControlSettings,
359
+ returnFullEntity: options?.returnFullEntity,
360
+ });
361
+ const reqOpts = ambassadorWixBookingsV2Booking.cancelMultiServiceBooking(payload);
362
+ sideEffects?.onSiteCall?.();
363
+ try {
364
+ const result = await httpClient.request(reqOpts);
365
+ sideEffects?.onSuccess?.(result);
366
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
367
+ }
368
+ catch (err) {
369
+ const transformedError = sdkTransformError(err, {
370
+ spreadPathsToArguments: {},
371
+ explicitPathsToArguments: {
372
+ multiServiceBookingId: '$[0]',
373
+ participantNotification: '$[1].participantNotification',
374
+ flowControlSettings: '$[1].flowControlSettings',
375
+ returnFullEntity: '$[1].returnFullEntity',
376
+ },
377
+ singleArgumentUnchanged: false,
378
+ }, ['multiServiceBookingId', 'options']);
379
+ sideEffects?.onError?.(err);
380
+ throw transformedError;
381
+ }
382
+ }
383
+ /**
384
+ * Updates the status of a multi-service booking to `PENDING`.
385
+ *
386
+ *
387
+ * Also updates the status of each of individual bookings within the multi-service booking to `PENDING`.
388
+ *
389
+ * The call fails if the status for at least a single individual booking can't be updated.
390
+ *
391
+ * See Mark Booking as Pending for more information.
392
+ * @param multiServiceBookingId - ID of the multi-service booking to mark as `PENDING`.
393
+ * @public
394
+ * @documentationMaturity preview
395
+ * @requiredField multiServiceBookingId
396
+ * @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_MARK_AS_PENDING
397
+ * @permissionScope Manage Bookings
398
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
399
+ * @permissionScope Manage Bookings - all permissions
400
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
401
+ * @applicableIdentity APP
402
+ * @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.MarkMultiServiceBookingAsPending
403
+ */
404
+ export async function markMultiServiceBookingAsPending(multiServiceBookingId, options) {
405
+ // @ts-ignore
406
+ const { httpClient, sideEffects } = arguments[2];
407
+ const payload = renameKeysFromSDKRequestToRESTRequest({
408
+ multiServiceBookingId: multiServiceBookingId,
409
+ markAsPendingBookingsInfo: options?.markAsPendingBookingsInfo,
410
+ participantNotification: options?.participantNotification,
411
+ sendSmsReminder: options?.sendSmsReminder,
412
+ doubleBooked: options?.doubleBooked,
413
+ returnFullEntity: options?.returnFullEntity,
414
+ flowControlSettings: options?.flowControlSettings,
415
+ });
416
+ const reqOpts = ambassadorWixBookingsV2Booking.markMultiServiceBookingAsPending(payload);
417
+ sideEffects?.onSiteCall?.();
418
+ try {
419
+ const result = await httpClient.request(reqOpts);
420
+ sideEffects?.onSuccess?.(result);
421
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
422
+ }
423
+ catch (err) {
424
+ const transformedError = sdkTransformError(err, {
425
+ spreadPathsToArguments: {},
426
+ explicitPathsToArguments: {
427
+ multiServiceBookingId: '$[0]',
428
+ markAsPendingBookingsInfo: '$[1].markAsPendingBookingsInfo',
429
+ participantNotification: '$[1].participantNotification',
430
+ sendSmsReminder: '$[1].sendSmsReminder',
431
+ doubleBooked: '$[1].doubleBooked',
432
+ returnFullEntity: '$[1].returnFullEntity',
433
+ flowControlSettings: '$[1].flowControlSettings',
434
+ },
435
+ singleArgumentUnchanged: false,
436
+ }, ['multiServiceBookingId', 'options']);
437
+ sideEffects?.onError?.(err);
438
+ throw transformedError;
439
+ }
440
+ }
441
+ /**
442
+ * Updates the status of a multi-service booking to `CONFIRMED`.
443
+ *
444
+ *
445
+ * Also updates the status of each of individual bookings within the multi-service booking to `CONFIRMED`.
446
+ *
447
+ * The call fails if the status for at least a single individual booking can't be updated.
448
+ *
449
+ * See Confirm Booking for more information.
450
+ * @param multiServiceBookingId - ID of the multi-service booking to confirm its related bookings.
451
+ * @public
452
+ * @documentationMaturity preview
453
+ * @requiredField multiServiceBookingId
454
+ * @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_CONFIRM
455
+ * @permissionScope Manage Bookings
456
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
457
+ * @permissionScope Manage Bookings - all permissions
458
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
459
+ * @applicableIdentity APP
460
+ * @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.ConfirmMultiServiceBooking
461
+ */
462
+ export async function confirmMultiServiceBooking(multiServiceBookingId, options) {
463
+ // @ts-ignore
464
+ const { httpClient, sideEffects } = arguments[2];
465
+ const payload = renameKeysFromSDKRequestToRESTRequest({
466
+ multiServiceBookingId: multiServiceBookingId,
467
+ confirmBookingsInfo: options?.confirmBookingsInfo,
468
+ participantNotification: options?.participantNotification,
469
+ sendSmsReminder: options?.sendSmsReminder,
470
+ doubleBooked: options?.doubleBooked,
471
+ returnFullEntity: options?.returnFullEntity,
472
+ flowControlSettings: options?.flowControlSettings,
473
+ });
474
+ const reqOpts = ambassadorWixBookingsV2Booking.confirmMultiServiceBooking(payload);
475
+ sideEffects?.onSiteCall?.();
476
+ try {
477
+ const result = await httpClient.request(reqOpts);
478
+ sideEffects?.onSuccess?.(result);
479
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
480
+ }
481
+ catch (err) {
482
+ const transformedError = sdkTransformError(err, {
483
+ spreadPathsToArguments: {},
484
+ explicitPathsToArguments: {
485
+ multiServiceBookingId: '$[0]',
486
+ confirmBookingsInfo: '$[1].confirmBookingsInfo',
487
+ participantNotification: '$[1].participantNotification',
488
+ sendSmsReminder: '$[1].sendSmsReminder',
489
+ doubleBooked: '$[1].doubleBooked',
490
+ returnFullEntity: '$[1].returnFullEntity',
491
+ flowControlSettings: '$[1].flowControlSettings',
492
+ },
493
+ singleArgumentUnchanged: false,
494
+ }, ['multiServiceBookingId', 'options']);
495
+ sideEffects?.onError?.(err);
496
+ throw transformedError;
497
+ }
498
+ }
499
+ /**
500
+ * Updates the status of a multi-service booking to `DECLINED`.
501
+ *
502
+ *
503
+ * Also updates the status of each of individual bookings within the multi-service booking to `DECLINED`.
504
+ *
505
+ * The call fails if the status for at least a single individual booking can't be updated.
506
+ *
507
+ * See Decline Booking for more information.
508
+ * @param multiServiceBookingId - ID of the multi service booking to decline.
509
+ * @public
510
+ * @documentationMaturity preview
511
+ * @requiredField multiServiceBookingId
512
+ * @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_DECLINE
513
+ * @permissionScope Manage Bookings
514
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
515
+ * @permissionScope Manage Bookings - all permissions
516
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
517
+ * @applicableIdentity APP
518
+ * @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.DeclineMultiServiceBooking
519
+ */
520
+ export async function declineMultiServiceBooking(multiServiceBookingId, options) {
521
+ // @ts-ignore
522
+ const { httpClient, sideEffects } = arguments[2];
523
+ const payload = renameKeysFromSDKRequestToRESTRequest({
524
+ multiServiceBookingId: multiServiceBookingId,
525
+ declineBookingsInfo: options?.declineBookingsInfo,
526
+ participantNotification: options?.participantNotification,
527
+ doubleBooked: options?.doubleBooked,
528
+ returnFullEntity: options?.returnFullEntity,
529
+ flowControlSettings: options?.flowControlSettings,
530
+ });
531
+ const reqOpts = ambassadorWixBookingsV2Booking.declineMultiServiceBooking(payload);
532
+ sideEffects?.onSiteCall?.();
533
+ try {
534
+ const result = await httpClient.request(reqOpts);
535
+ sideEffects?.onSuccess?.(result);
536
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
537
+ }
538
+ catch (err) {
539
+ const transformedError = sdkTransformError(err, {
540
+ spreadPathsToArguments: {},
541
+ explicitPathsToArguments: {
542
+ multiServiceBookingId: '$[0]',
543
+ declineBookingsInfo: '$[1].declineBookingsInfo',
544
+ participantNotification: '$[1].participantNotification',
545
+ doubleBooked: '$[1].doubleBooked',
546
+ returnFullEntity: '$[1].returnFullEntity',
547
+ flowControlSettings: '$[1].flowControlSettings',
548
+ },
549
+ singleArgumentUnchanged: false,
550
+ }, ['multiServiceBookingId', 'options']);
551
+ sideEffects?.onError?.(err);
552
+ throw transformedError;
553
+ }
554
+ }
555
+ /**
556
+ * Retrieves the allowed actions for a list of multi-service bookings.
557
+ * @param multiServiceBookingIds - IDs of the multi-service bookings to retrieve allowed actions for.
558
+ * @public
559
+ * @documentationMaturity preview
560
+ * @requiredField multiServiceBookingIds
561
+ * @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_GET_ALLOWED_ACTIONS
562
+ * @permissionScope Read Bookings - Public Data
563
+ * @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
564
+ * @permissionScope Manage Bookings
565
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
566
+ * @permissionScope Read Bookings - Including Participants
567
+ * @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
568
+ * @permissionScope Read Bookings - all read permissions
569
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
570
+ * @permissionScope Manage Bookings - all permissions
571
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
572
+ * @applicableIdentity APP
573
+ * @applicableIdentity VISITOR
574
+ * @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.BulkGetMultiServiceBookingAllowedActions
575
+ */
576
+ export async function bulkGetMultiServiceBookingAllowedActions(multiServiceBookingIds) {
577
+ // @ts-ignore
578
+ const { httpClient, sideEffects } = arguments[1];
579
+ const payload = renameKeysFromSDKRequestToRESTRequest({
580
+ multiServiceBookingIds: multiServiceBookingIds,
581
+ });
582
+ const reqOpts = ambassadorWixBookingsV2Booking.bulkGetMultiServiceBookingAllowedActions(payload);
583
+ sideEffects?.onSiteCall?.();
584
+ try {
585
+ const result = await httpClient.request(reqOpts);
586
+ sideEffects?.onSuccess?.(result);
587
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
588
+ }
589
+ catch (err) {
590
+ const transformedError = sdkTransformError(err, {
591
+ spreadPathsToArguments: {},
592
+ explicitPathsToArguments: { multiServiceBookingIds: '$[0]' },
593
+ singleArgumentUnchanged: false,
594
+ }, ['multiServiceBookingIds']);
595
+ sideEffects?.onError?.(err);
596
+ throw transformedError;
597
+ }
598
+ }
599
+ /**
600
+ * Retrieves all single-service bookings belonging to a multi-service booking.
601
+ *
602
+ *
603
+ * If you call as an [identity](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities)
604
+ * who has permissions to read only part of the bookings,
605
+ * only the permitted bookings are retrieved. The returned total number of
606
+ * bookings includes also the bookings for which you don't have permissions.
607
+ * @param multiServiceBookingId - ID of the multi-service booking.
608
+ * @public
609
+ * @documentationMaturity preview
610
+ * @requiredField multiServiceBookingId
611
+ * @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_READ
612
+ * @permissionScope Read Bookings - Public Data
613
+ * @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
614
+ * @permissionScope Manage Bookings
615
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
616
+ * @permissionScope Read Bookings - Including Participants
617
+ * @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
618
+ * @permissionScope Read Bookings - all read permissions
619
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
620
+ * @permissionScope Read Bookings Calendar Availability
621
+ * @permissionScopeId SCOPE.DC-BOOKINGS.READ-CALENDAR
622
+ * @permissionScope Manage Bookings - all permissions
623
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
624
+ * @applicableIdentity APP
625
+ * @returns Retrieved multi-service booking.
626
+ * @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.GetMultiServiceBooking
627
+ */
628
+ export async function getMultiServiceBooking(multiServiceBookingId) {
629
+ // @ts-ignore
630
+ const { httpClient, sideEffects } = arguments[1];
631
+ const payload = renameKeysFromSDKRequestToRESTRequest({
632
+ multiServiceBookingId: multiServiceBookingId,
633
+ });
634
+ const reqOpts = ambassadorWixBookingsV2Booking.getMultiServiceBooking(payload);
635
+ sideEffects?.onSiteCall?.();
636
+ try {
637
+ const result = await httpClient.request(reqOpts);
638
+ sideEffects?.onSuccess?.(result);
639
+ return renameKeysFromRESTResponseToSDKResponse(result.data)
640
+ ?.multiServiceBooking;
641
+ }
642
+ catch (err) {
643
+ const transformedError = sdkTransformError(err, {
644
+ spreadPathsToArguments: {},
645
+ explicitPathsToArguments: { multiServiceBookingId: '$[0]' },
646
+ singleArgumentUnchanged: false,
647
+ }, ['multiServiceBookingId']);
648
+ sideEffects?.onError?.(err);
649
+ throw transformedError;
650
+ }
651
+ }
652
+ /**
653
+ * Adds a list of single-service bookings to a multi-service booking.
654
+ *
655
+ *
656
+ * The call fails, if at least 1 of the specified booking is already part of a
657
+ * multi-service booking.
658
+ * @param multiServiceBookingId - ID of the multi-service booking.
659
+ * @public
660
+ * @documentationMaturity preview
661
+ * @requiredField multiServiceBookingId
662
+ * @requiredField options.bookings
663
+ * @requiredField options.bookings.bookingId
664
+ * @requiredField options.bookings.revision
665
+ * @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_ADD_BOOKINGS
666
+ * @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.AddBookingsToMultiServiceBooking
667
+ */
668
+ export async function addBookingsToMultiServiceBooking(multiServiceBookingId, options) {
669
+ // @ts-ignore
670
+ const { httpClient, sideEffects } = arguments[2];
671
+ const payload = renameKeysFromSDKRequestToRESTRequest({
672
+ multiServiceBookingId: multiServiceBookingId,
673
+ bookings: options?.bookings,
674
+ returnFullEntity: options?.returnFullEntity,
675
+ });
676
+ const reqOpts = ambassadorWixBookingsV2Booking.addBookingsToMultiServiceBooking(payload);
677
+ sideEffects?.onSiteCall?.();
678
+ try {
679
+ const result = await httpClient.request(reqOpts);
680
+ sideEffects?.onSuccess?.(result);
681
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
682
+ }
683
+ catch (err) {
684
+ const transformedError = sdkTransformError(err, {
685
+ spreadPathsToArguments: {},
686
+ explicitPathsToArguments: {
687
+ multiServiceBookingId: '$[0]',
688
+ bookings: '$[1].bookings',
689
+ returnFullEntity: '$[1].returnFullEntity',
690
+ },
691
+ singleArgumentUnchanged: false,
692
+ }, ['multiServiceBookingId', 'options']);
693
+ sideEffects?.onError?.(err);
694
+ throw transformedError;
695
+ }
696
+ }
697
+ /**
698
+ * Removes single-service bookings from a multi-service booking and returns the
699
+ * removed bookings.
700
+ *
701
+ *
702
+ * If you specify an empty `bookings` array, all single-service bookings for which
703
+ * the call's [identity](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities)
704
+ * has read permissions are removed from the multi-service booking.
705
+ *
706
+ * If the call would create a multi-service booking including only 1 single-service
707
+ * booking, the multi-service booking is also deleted.
708
+ * @param multiServiceBookingId - ID of the multi-service booking.
709
+ * @public
710
+ * @documentationMaturity preview
711
+ * @requiredField multiServiceBookingId
712
+ * @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_REMOVE_BOOKINGS
713
+ * @permissionScope Manage Bookings
714
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
715
+ * @permissionScope Manage Bookings - all permissions
716
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
717
+ * @applicableIdentity APP
718
+ * @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.RemoveBookingsFromMultiServiceBooking
719
+ */
720
+ export async function removeBookingsFromMultiServiceBooking(multiServiceBookingId, options) {
721
+ // @ts-ignore
722
+ const { httpClient, sideEffects } = arguments[2];
723
+ const payload = renameKeysFromSDKRequestToRESTRequest({
724
+ multiServiceBookingId: multiServiceBookingId,
725
+ bookings: options?.bookings,
726
+ returnFullEntity: options?.returnFullEntity,
727
+ });
728
+ const reqOpts = ambassadorWixBookingsV2Booking.removeBookingsFromMultiServiceBooking(payload);
729
+ sideEffects?.onSiteCall?.();
730
+ try {
731
+ const result = await httpClient.request(reqOpts);
732
+ sideEffects?.onSuccess?.(result);
733
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
734
+ }
735
+ catch (err) {
736
+ const transformedError = sdkTransformError(err, {
737
+ spreadPathsToArguments: {},
738
+ explicitPathsToArguments: {
739
+ multiServiceBookingId: '$[0]',
740
+ bookings: '$[1].bookings',
741
+ returnFullEntity: '$[1].returnFullEntity',
742
+ },
743
+ singleArgumentUnchanged: false,
744
+ }, ['multiServiceBookingId', 'options']);
745
+ sideEffects?.onError?.(err);
746
+ throw transformedError;
747
+ }
748
+ }
749
+ /**
750
+ * Creates a booking.
751
+ *
752
+ *
753
+ * ## Appointment booking
754
+ *
755
+ * For appointment-based services, specify the relevant `slot` in
756
+ * `bookedEntity.slot`. We recommend specifying the complete
757
+ * `availabilityEntries.slot` returned in Query Availability
758
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/availability-calendar/query-availability) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/time-slots/availability-calendar/query-availability))
759
+ * in your call's request to avoid failed calls due to unavailability.
760
+ *
761
+ * ## Class session booking
762
+ *
763
+ * For class services, specify the relevant event ID
764
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/calendar/events/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/calendar/events-v3/introduction))
765
+ * as `bookedEntity.slot.eventId`.
766
+ * We recommend retrieving the event ID from Query Availability's
767
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/availability-calendar/query-availability) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/time-slots/availability-calendar/query-availability))
768
+ * `availabilityEntries.slot.eventId` to avoid failed calls due to unavailability.
769
+ * Specifying an event ID leads to automatic calculations of `slot.startDate`, `slot.endDate`,
770
+ * `slot.timezone`, `slot.resource`, and `slot.location`. All manually specified
771
+ * values are overridden.
772
+ *
773
+ * ## Course booking
774
+ *
775
+ * For course services, specify the course's schedule ID in `bookedEntity.schedule.scheduleId`.
776
+ * We recommend following [this sample flow](https://dev.wix.com/docs/rest/business-solutions/bookings/sample-booking-flows#book-a-course)
777
+ * to minimize failed calls due to unavailability.
778
+ *
779
+ * ## Related resources
780
+ *
781
+ * Specifying a `resource` triggers an availability check, resulting in a failed
782
+ * call if the resource is unavailable. Omitting a resource allows Wix Bookings
783
+ * to assign a resource belonging to the relevant type randomly when the merchant
784
+ * confirms the booking.
785
+ *
786
+ * ## Participant information
787
+ *
788
+ * You must specify either `participantsChoices` or `totalParticipants`.
789
+ * The call fails if the specified `participantsChoices` aren't among the supported
790
+ * service options and variants
791
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/service-options-and-variants/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/service-options-and-variants/introduction)).
792
+ *
793
+ * ## Notify customers
794
+ *
795
+ * You can specify a `participantNotification.message` for the customer that's send
796
+ * immediately. Ensure `participantNotification.notifyParticipants` is set to `true`
797
+ * to send the message.
798
+ *
799
+ * If you specify `{"sendSmsReminder": true}`, the customer receives an SMS 24 hours
800
+ * before the session starts. The phone number is taken from `contactDetails.phone`.
801
+ *
802
+ * ## Booking status
803
+ *
804
+ * Bookings default to the `CREATED` status, not affecting the business calendar
805
+ * or resource availability. You can specify a different status when the calling
806
+ * [identity](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities)
807
+ * has `Manage Bookings` permissions.
808
+ *
809
+ * ## Payment options
810
+ *
811
+ * The specified `selectedPaymentOption` indicates how the customer intends to
812
+ * pay, allowing for later changes to a different method supported by the service.
813
+ *
814
+ * ## Payment status
815
+ *
816
+ * A booking is initially created with `{"paymentStatus": "UNDEFINED"}` regardless
817
+ * of the payment status specified in Create Booking. If a customer uses an eCommerce
818
+ * checkout ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/orders/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/checkout/introduction)),
819
+ * Wix Bookings automatically syncs the booking's payment status from
820
+ * the corresponding eCommerce order ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/checkout/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/introduction)).
821
+ *
822
+ * If a booking doesn't have a corresponding eCommerce order, for example, since
823
+ * the customer didn't use the eCommerce checkout, you can update the booking's
824
+ * payment status with Confirm Or Decline Booking
825
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/bookings/confirm-or-decline-booking) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/bookings-writer-v2/confirm-or-decline-booking)).
826
+ *
827
+ * ## Booking form data
828
+ *
829
+ * When customers sign up for a service, they must fill out the booking form.
830
+ * To create a booking with a completed booking form, specify the relevant data in
831
+ * `formSubmission`. Ensure the values of the corresponding fields in
832
+ * `booking.contactDetails` and `formSubmission` are identical. If these values
833
+ * don't match, Create Booking fails. Therefore, we recommend specifying
834
+ * only `booking.contactDetails.contactId` when providing `formSubmission`.
835
+ *
836
+ * ## Admin overwrites
837
+ *
838
+ * There are small but important differences when you specify special
839
+ * `flowControlSettings`:
840
+ *
841
+ * - `{"skipAvailabilityValidation": true}`: The call succeeds
842
+ * regardless of availability. If you don't specify any resource, the call
843
+ * succeeds even if no resource of the relevant type is available.
844
+ * - `{"skipBusinessConfirmation": true}`: Automatically confirms `PENDING`
845
+ * bookings that require manual confirmation.
846
+ * - `{"skipSelectedPaymentOptionValidation": true}`: Allows customers to pay
847
+ * with payment methods that aren't supported for the service.
848
+ *
849
+ * When using special `flowControlSettings`, ensure you have sufficient
850
+ * permissions. If you encounter failed calls due to insufficient permissions,
851
+ * consider the following options:
852
+ *
853
+ * - **App developers** can use a higher
854
+ * [permission](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/about-permissions),
855
+ * such as `MANAGE BOOKINGS - ALL PERMISSIONS`.
856
+ * - **Site developers** can utilize
857
+ * [elevation](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/authorization/elevation).
858
+ *
859
+ * Granting additional permissions and using elevation permits method calls that
860
+ * would typically fail due to authorization checks. Therefore, you should use
861
+ * them intentionally and securely.
862
+ * @param booking - The booking to create.
863
+ * @public
864
+ * @requiredField booking
865
+ * @requiredField booking.additionalFields._id
866
+ * @requiredField booking.bookedEntity
867
+ * @permissionId BOOKINGS.BOOKING_CREATE
868
+ * @permissionScope Manage Bookings
869
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
870
+ * @permissionScope Manage Bookings - all permissions
871
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
872
+ * @applicableIdentity APP
873
+ * @applicableIdentity VISITOR
874
+ * @fqn com.wixpress.bookings.bookings.v2.Bookings.CreateBooking
875
+ */
876
+ export async function createBooking(booking, options) {
877
+ // @ts-ignore
878
+ const { httpClient, sideEffects } = arguments[2];
879
+ const payload = renameKeysFromSDKRequestToRESTRequest({
880
+ booking: booking,
881
+ participantNotification: options?.participantNotification,
882
+ sendSmsReminder: options?.sendSmsReminder,
883
+ flowControlSettings: options?.flowControlSettings,
884
+ });
885
+ const reqOpts = ambassadorWixBookingsV2Booking.createBooking(payload);
886
+ sideEffects?.onSiteCall?.();
887
+ try {
888
+ const result = await httpClient.request(reqOpts);
889
+ sideEffects?.onSuccess?.(result);
890
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
891
+ }
892
+ catch (err) {
893
+ const transformedError = sdkTransformError(err, {
894
+ spreadPathsToArguments: {},
895
+ explicitPathsToArguments: {
896
+ booking: '$[0]',
897
+ participantNotification: '$[1].participantNotification',
898
+ sendSmsReminder: '$[1].sendSmsReminder',
899
+ flowControlSettings: '$[1].flowControlSettings',
900
+ },
901
+ singleArgumentUnchanged: false,
902
+ }, ['booking', 'options']);
903
+ sideEffects?.onError?.(err);
904
+ throw transformedError;
905
+ }
906
+ }
907
+ /**
908
+ * Creates up to 8 bookings.
909
+ *
910
+ *
911
+ * See Create Booking ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/bookings/create-booking) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/bookings-writer-v2/create-booking))
912
+ * for more information.
913
+ *
914
+ * If any of the specified bookings is missing a required field the entire call
915
+ * fails.
916
+ *
917
+ * If you specify 1 or more unavailable bookings, the call succeeds
918
+ * while the unavailable bookings aren't created. Instead, they're counted as
919
+ * failures in the returned `bulkActionMetadata`.
920
+ * @param createBookingsInfo - Bookings to create.
921
+ *
922
+ * Max: 8 bookings
923
+ * @public
924
+ * @requiredField createBookingsInfo
925
+ * @requiredField createBookingsInfo.booking
926
+ * @requiredField createBookingsInfo.booking.additionalFields._id
927
+ * @requiredField createBookingsInfo.booking.bookedEntity
928
+ * @permissionId BOOKINGS.BOOKING_CREATE
929
+ * @permissionScope Manage Bookings
930
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
931
+ * @permissionScope Manage Bookings - all permissions
932
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
933
+ * @applicableIdentity APP
934
+ * @applicableIdentity VISITOR
935
+ * @fqn com.wixpress.bookings.bookings.v2.Bookings.BulkCreateBooking
936
+ */
937
+ export async function bulkCreateBooking(createBookingsInfo, options) {
938
+ // @ts-ignore
939
+ const { httpClient, sideEffects } = arguments[2];
940
+ const payload = renameKeysFromSDKRequestToRESTRequest({
941
+ createBookingsInfo: createBookingsInfo,
942
+ returnFullEntity: options?.returnFullEntity,
943
+ });
944
+ const reqOpts = ambassadorWixBookingsV2Booking.bulkCreateBooking(payload);
945
+ sideEffects?.onSiteCall?.();
946
+ try {
947
+ const result = await httpClient.request(reqOpts);
948
+ sideEffects?.onSuccess?.(result);
949
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
950
+ }
951
+ catch (err) {
952
+ const transformedError = sdkTransformError(err, {
953
+ spreadPathsToArguments: {},
954
+ explicitPathsToArguments: {
955
+ createBookingsInfo: '$[0]',
956
+ returnFullEntity: '$[1].returnFullEntity',
957
+ },
958
+ singleArgumentUnchanged: false,
959
+ }, ['createBookingsInfo', 'options']);
960
+ sideEffects?.onError?.(err);
961
+ throw transformedError;
962
+ }
963
+ }
964
+ /**
965
+ * Reschedules an appointment booking to a different slot or a class booking to
966
+ * a different session.
967
+ *
968
+ *
969
+ * ## Course booking limitation
970
+ *
971
+ * You can't reschedule course bookings.
972
+ *
973
+ * ## Appointment sessions
974
+ *
975
+ * For appointments, the old session is removed from the business calendar
976
+ * while a new session is added. We recommend calling Query Availability
977
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/availability-calendar/query-availability) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/time-slots/availability-calendar/query-availability))
978
+ * first and specifying the entire retrieved `slot`.
979
+ *
980
+ * ## Class sessions
981
+ *
982
+ * For classes, the new session must be an existing session belonging to the
983
+ * same class. We recommend retrieving `availabilityEntries.slot.eventId`
984
+ * from Query Availability
985
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/availability-calendar/query-availability) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/time-slots/availability-calendar/query-availability))
986
+ * to avoid failed Reschedule Booking calls due to unavailability. Specify
987
+ * only `slot.eventId` instead of the entire `slot` object.
988
+ *
989
+ * ## Notify customers
990
+ *
991
+ * You can specify a `participantNotification.message` for the customer. To send
992
+ * the message, you must also specify `participantNotification.notifyParticipants`
993
+ * as `true`.
994
+ *
995
+ * ## Admin overwrites
996
+ *
997
+ * There are small but important differences when you specify special
998
+ * `flowControlSettings`:
999
+ *
1000
+ * - `{"ignoreReschedulePolicy": true}`: The call succeeds even if the
1001
+ * service's `reschedulePolicy` doesn't allow it.
1002
+ * - `{"skipAvailabilityValidation": true}`: The call succeeds even if
1003
+ * the specified session, slot, or resource isn't available. If you don't
1004
+ * specify any resource, the call succeeds even if no resource of the relevant
1005
+ * type is available.
1006
+ * - `{"skipBusinessConfirmation": true}`: Any `PENDING` booking is
1007
+ * automatically confirmed even if the services requires the merchants's
1008
+ * manual confirmation.
1009
+ *
1010
+ * When using special `flowControlSettings`, ensure you have sufficient
1011
+ * permissions. If you encounter failed calls due to insufficient permissions,
1012
+ * consider the following options:
1013
+ *
1014
+ * - **App developers** can use a higher
1015
+ * [permission](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/about-permissions),
1016
+ * such as `MANAGE BOOKINGS - ALL PERMISSIONS`.
1017
+ * - **Site developers** can utilize
1018
+ * [elevation](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/authorization/elevation).
1019
+ *
1020
+ * Granting additional permissions and using elevation permits method calls that
1021
+ * would typically fail due to authorization checks. Therefore, you should use
1022
+ * them intentionally and securely.
1023
+ * @param bookingId - ID of the booking to reschedule.
1024
+ * @param slot - New slot of the booking.
1025
+ * @public
1026
+ * @requiredField bookingId
1027
+ * @requiredField options.revision
1028
+ * @requiredField slot
1029
+ * @param options - An object representing the available options for rescheduling a booking.
1030
+ * @permissionId BOOKINGS.BOOKING_RESCHEDULE
1031
+ * @permissionScope Manage Bookings
1032
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
1033
+ * @permissionScope Manage Bookings - all permissions
1034
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
1035
+ * @applicableIdentity APP
1036
+ * @applicableIdentity MEMBER
1037
+ * @fqn com.wixpress.bookings.bookings.v2.Bookings.RescheduleBooking
1038
+ */
1039
+ export async function rescheduleBooking(bookingId, slot, options) {
1040
+ // @ts-ignore
1041
+ const { httpClient, sideEffects } = arguments[3];
1042
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1043
+ bookingId: bookingId,
1044
+ slot: slot,
1045
+ revision: options?.revision,
1046
+ participantNotification: options?.participantNotification,
1047
+ flowControlSettings: options?.flowControlSettings,
1048
+ totalParticipants: options?.totalParticipants,
1049
+ participantsChoices: options?.participantsChoices,
1050
+ });
1051
+ const reqOpts = ambassadorWixBookingsV2Booking.rescheduleBooking(payload);
1052
+ sideEffects?.onSiteCall?.();
1053
+ try {
1054
+ const result = await httpClient.request(reqOpts);
1055
+ sideEffects?.onSuccess?.(result);
1056
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
1057
+ }
1058
+ catch (err) {
1059
+ const transformedError = sdkTransformError(err, {
1060
+ spreadPathsToArguments: {},
1061
+ explicitPathsToArguments: {
1062
+ bookingId: '$[0]',
1063
+ slot: '$[1]',
1064
+ revision: '$[2].revision',
1065
+ participantNotification: '$[2].participantNotification',
1066
+ flowControlSettings: '$[2].flowControlSettings',
1067
+ totalParticipants: '$[2].totalParticipants',
1068
+ participantsChoices: '$[2].participantsChoices',
1069
+ },
1070
+ singleArgumentUnchanged: false,
1071
+ }, ['bookingId', 'slot', 'options']);
1072
+ sideEffects?.onError?.(err);
1073
+ throw transformedError;
1074
+ }
1075
+ }
1076
+ /**
1077
+ * Updates the booking status to `CONFIRMED` and updates the relevant session's
1078
+ * `participants.approvalStatus` to `APPROVED` without checking whether the relevant
1079
+ * slot or schedule is still available.
1080
+ *
1081
+ * ## eCommerce checkout restriction
1082
+ *
1083
+ * Call this method only when using a custom checkout page. Don't
1084
+ * call it when using a Wix eCommerce checkout
1085
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/orders/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/checkout/introduction)).
1086
+ * In such cases, Wix automatically updates the booking status based on
1087
+ * the `paymentStatus` of the corresponding Wix eCommerce order
1088
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/checkout/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/introduction)).
1089
+ *
1090
+ * ## When to call Confirm Or Decline Booking instead
1091
+ *
1092
+ * Confirm Booking doesn't check whether a slot or schedule is still available. For
1093
+ * these checks you can call Confirm or Decline Booking
1094
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/bookings/confirm-or-decline-booking) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/bookings-writer-v2/confirm-or-decline-booking)).
1095
+ *
1096
+ * ## Original status validation
1097
+ *
1098
+ * You can only confirm bookings with a status of `PENDING`, `CREATED`, or
1099
+ * `WAITING_LIST`.
1100
+ *
1101
+ * ## Double bookings
1102
+ *
1103
+ * Confirm Booking doesn't check whether a slot or schedule is still available.
1104
+ * You can specify
1105
+ *
1106
+ * ```json
1107
+ * {
1108
+ * "flowControlSettings": {
1109
+ * "checkAvailabilityValidation": true
1110
+ * },
1111
+ * "doubleBooked": true
1112
+ * }
1113
+ * ```
1114
+ * to forcefully set the booking's `doubleBooked` flag to `true`, regardless of
1115
+ * a potential double booking conflict. You must call with `Manage Bookings`
1116
+ * permissions to do so. For the default flow control settings
1117
+ * `{"checkAvailabilityValidation": false}`, the specified `doubleBooked` value
1118
+ * is ignored.
1119
+ *
1120
+ * ## Payment status
1121
+ *
1122
+ * Also updates the booking's `paymentStatus`, if you specify a new payment
1123
+ * status.
1124
+ *
1125
+ * ## Notify customers
1126
+ *
1127
+ * You can specify a `participantNotification.message` for the customer. To send
1128
+ * the message, you must also specify `participantNotification.notifyParticipants`
1129
+ * as `true`.
1130
+ * @param bookingId - ID of the booking to confirm.
1131
+ * @param revision - Revision number, which increments by 1 each time the booking is updated.
1132
+ * To prevent conflicting changes, the current revision must be passed when
1133
+ * updating the booking.
1134
+ * @public
1135
+ * @requiredField bookingId
1136
+ * @requiredField revision
1137
+ * @param options - An object representing the available options for canceling a booking.
1138
+ * @permissionId BOOKINGS.BOOKING_CONFIRM
1139
+ * @permissionScope Manage Bookings
1140
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
1141
+ * @permissionScope Manage Bookings - all permissions
1142
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
1143
+ * @applicableIdentity APP
1144
+ * @fqn com.wixpress.bookings.bookings.v2.Bookings.ConfirmBooking
1145
+ */
1146
+ export async function confirmBooking(bookingId, revision, options) {
1147
+ // @ts-ignore
1148
+ const { httpClient, sideEffects } = arguments[3];
1149
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1150
+ bookingId: bookingId,
1151
+ revision: revision,
1152
+ participantNotification: options?.participantNotification,
1153
+ sendSmsReminder: options?.sendSmsReminder,
1154
+ paymentStatus: options?.paymentStatus,
1155
+ doubleBooked: options?.doubleBooked,
1156
+ flowControlSettings: options?.flowControlSettings,
1157
+ });
1158
+ const reqOpts = ambassadorWixBookingsV2Booking.bookingsConfirmBooking(payload);
1159
+ sideEffects?.onSiteCall?.();
1160
+ try {
1161
+ const result = await httpClient.request(reqOpts);
1162
+ sideEffects?.onSuccess?.(result);
1163
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
1164
+ }
1165
+ catch (err) {
1166
+ const transformedError = sdkTransformError(err, {
1167
+ spreadPathsToArguments: {},
1168
+ explicitPathsToArguments: {
1169
+ bookingId: '$[0]',
1170
+ revision: '$[1]',
1171
+ participantNotification: '$[2].participantNotification',
1172
+ sendSmsReminder: '$[2].sendSmsReminder',
1173
+ paymentStatus: '$[2].paymentStatus',
1174
+ doubleBooked: '$[2].doubleBooked',
1175
+ flowControlSettings: '$[2].flowControlSettings',
1176
+ },
1177
+ singleArgumentUnchanged: false,
1178
+ }, ['bookingId', 'revision', 'options']);
1179
+ sideEffects?.onError?.(err);
1180
+ throw transformedError;
1181
+ }
1182
+ }
1183
+ /**
1184
+ * Updates the extended fields for a booking.
1185
+ *
1186
+ *
1187
+ * If you specify an extended field `namespace` that doesn't exist yet, it's
1188
+ * created.
1189
+ *
1190
+ * Learn more about [extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/about-backend-extensions#schema-plugin-extensions).
1191
+ * @public
1192
+ * @requiredField _id
1193
+ * @requiredField namespace
1194
+ * @requiredField options
1195
+ * @requiredField options.namespaceData
1196
+ * @param _id - ID of the booking for which to update extended fields.
1197
+ * @param namespace - [Namespace](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-reading-and-writing-schema-plugin-fields#namespaces) of the app for which to update extended fields.
1198
+ * @param options - Options for updating the booking's extended fields.
1199
+ * @permissionId BOOKINGS.BOOKING_UPDATE_EXTENDED_FIELDS
1200
+ * @permissionScope Manage Bookings
1201
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
1202
+ * @permissionScope Manage Bookings - all permissions
1203
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
1204
+ * @applicableIdentity APP
1205
+ * @fqn com.wixpress.bookings.bookings.v2.Bookings.UpdateExtendedFields
1206
+ */
1207
+ export async function updateExtendedFields(_id, namespace, options) {
1208
+ // @ts-ignore
1209
+ const { httpClient, sideEffects } = arguments[3];
1210
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1211
+ id: _id,
1212
+ namespace: namespace,
1213
+ namespaceData: options?.namespaceData,
1214
+ });
1215
+ const reqOpts = ambassadorWixBookingsV2Booking.updateExtendedFields(payload);
1216
+ sideEffects?.onSiteCall?.();
1217
+ try {
1218
+ const result = await httpClient.request(reqOpts);
1219
+ sideEffects?.onSuccess?.(result);
1220
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
1221
+ }
1222
+ catch (err) {
1223
+ const transformedError = sdkTransformError(err, {
1224
+ spreadPathsToArguments: {},
1225
+ explicitPathsToArguments: {
1226
+ id: '$[0]',
1227
+ namespace: '$[1]',
1228
+ namespaceData: '$[2].namespaceData',
1229
+ },
1230
+ singleArgumentUnchanged: false,
1231
+ }, ['_id', 'namespace', 'options']);
1232
+ sideEffects?.onError?.(err);
1233
+ throw transformedError;
1234
+ }
1235
+ }
1236
+ /**
1237
+ * Updates the booking status to `DECLINED` and updates the relevant session's
1238
+ * `participants.approvalStatus` to `DECLINED` without checking whether the relevant
1239
+ * slot or schedule is still available.
1240
+ *
1241
+ *
1242
+ * ## eCommerce checkout restriction
1243
+ *
1244
+ * Call this method only when using a custom checkout page. Don't
1245
+ * call it when using a Wix eCommerce checkout
1246
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/orders/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/checkout/introduction)).
1247
+ * In such cases, Wix automatically updates the booking status based on
1248
+ * the `paymentStatus` of the corresponding Wix eCommerce order
1249
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/checkout/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/introduction)).
1250
+ *
1251
+ * ## When to call Confirm Or Decline Booking instead
1252
+ *
1253
+ * The method doesn't check whether a slot or schedule is still available. For
1254
+ * these checks you can call Confirm or Decline Booking
1255
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/bookings/confirm-or-decline-booking) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/bookings-writer-v2/confirm-or-decline-booking)).
1256
+ *
1257
+ * ## Original status validation
1258
+ *
1259
+ * You can only decline bookings with a `status` of `PENDING`, `CREATED`, or
1260
+ * `WAITING_LIST`.
1261
+ *
1262
+ * ## Payment status
1263
+ *
1264
+ * Also updates the booking's `paymentStatus`, if you specify a new payment
1265
+ * status.
1266
+ *
1267
+ * ## Notify customers
1268
+ *
1269
+ * You can specify a `participantNotification.message` for the customer. To send
1270
+ * the message, you must also specify `participantNotification.notifyParticipants`
1271
+ * as `true`.
1272
+ * @param bookingId - ID of the booking to decline.
1273
+ * @param revision - Revision number, which increments by 1 each time the booking is updated.
1274
+ *
1275
+ * To prevent conflicting changes, the current revision must be specified when
1276
+ * declining the booking.
1277
+ * @public
1278
+ * @requiredField bookingId
1279
+ * @requiredField revision
1280
+ * @param options - An object representing the available options for declining a booking.
1281
+ * @permissionId BOOKINGS.BOOKING_DECLINE
1282
+ * @permissionScope Manage Bookings
1283
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
1284
+ * @permissionScope Manage Bookings - all permissions
1285
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
1286
+ * @applicableIdentity APP
1287
+ * @fqn com.wixpress.bookings.bookings.v2.Bookings.DeclineBooking
1288
+ */
1289
+ export async function declineBooking(bookingId, revision, options) {
1290
+ // @ts-ignore
1291
+ const { httpClient, sideEffects } = arguments[3];
1292
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1293
+ bookingId: bookingId,
1294
+ revision: revision,
1295
+ participantNotification: options?.participantNotification,
1296
+ paymentStatus: options?.paymentStatus,
1297
+ doubleBooked: options?.doubleBooked,
1298
+ flowControlSettings: options?.flowControlSettings,
1299
+ });
1300
+ const reqOpts = ambassadorWixBookingsV2Booking.bookingsDeclineBooking(payload);
1301
+ sideEffects?.onSiteCall?.();
1302
+ try {
1303
+ const result = await httpClient.request(reqOpts);
1304
+ sideEffects?.onSuccess?.(result);
1305
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
1306
+ }
1307
+ catch (err) {
1308
+ const transformedError = sdkTransformError(err, {
1309
+ spreadPathsToArguments: {},
1310
+ explicitPathsToArguments: {
1311
+ bookingId: '$[0]',
1312
+ revision: '$[1]',
1313
+ participantNotification: '$[2].participantNotification',
1314
+ paymentStatus: '$[2].paymentStatus',
1315
+ doubleBooked: '$[2].doubleBooked',
1316
+ flowControlSettings: '$[2].flowControlSettings',
1317
+ },
1318
+ singleArgumentUnchanged: false,
1319
+ }, ['bookingId', 'revision', 'options']);
1320
+ sideEffects?.onError?.(err);
1321
+ throw transformedError;
1322
+ }
1323
+ }
1324
+ /**
1325
+ * Updates the booking status to `CANCELED`.
1326
+ *
1327
+ *
1328
+ * ## Appointments
1329
+ *
1330
+ * For appointments, the corresponding event is removed from the Bookings
1331
+ * calendar.
1332
+ *
1333
+ * ## Class and course bookings
1334
+ *
1335
+ * For class or course bookings, the relevant participants are removed
1336
+ * from the class session or the course. However, the class session or course
1337
+ * remain on the business calendar.
1338
+ *
1339
+ * ## Notify customers
1340
+ *
1341
+ * You can specify a `participantNotification.message` for the customer. To send
1342
+ * the message, you must also specify `participantNotification.notifyParticipants`
1343
+ * as `true`.
1344
+ *
1345
+ * ## Admin overwrites
1346
+ *
1347
+ * There are small but important differences when you specify special
1348
+ * `flowControlSettings`:
1349
+ *
1350
+ * - `{"ignoreCancellationPolicy": true}`: The call succeeds even if the
1351
+ * service's `cancellationPolicy` doesn't allow it.
1352
+ * - `{"withRefund": true}`: The customer is refunded even if the service's
1353
+ * `refundPolicy` doesn't allow it.
1354
+ * - `{"waiveCancellationFee": true}`: The customer doesn't have to pay
1355
+ * the cancellation fee, even if the service's `cancellationPolicy` requires it.
1356
+ *
1357
+ * When using special `flowControlSettings`, ensure you have sufficient
1358
+ * permissions. If you encounter failed calls due to insufficient permissions,
1359
+ * consider the following options:
1360
+ *
1361
+ * - **App developers** can use a higher
1362
+ * [permission](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/about-permissions),
1363
+ * such as `MANAGE BOOKINGS - ALL PERMISSIONS`.
1364
+ * - **Site developers** can utilize
1365
+ * [elevation](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/authorization/elevation).
1366
+ *
1367
+ * Granting additional permissions and using elevation permits method calls that
1368
+ * would typically fail due to authorization checks. Therefore, you should use
1369
+ * them intentionally and securely.
1370
+ * @param bookingId - ID of the booking to cancel.
1371
+ * @public
1372
+ * @requiredField bookingId
1373
+ * @requiredField options.revision
1374
+ * @param options - An object representing the available options for canceling a booking.
1375
+ * @permissionId BOOKINGS.BOOKING_CANCEL
1376
+ * @permissionScope Manage Bookings
1377
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
1378
+ * @permissionScope Manage Bookings - all permissions
1379
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
1380
+ * @applicableIdentity APP
1381
+ * @applicableIdentity MEMBER
1382
+ * @fqn com.wixpress.bookings.bookings.v2.Bookings.CancelBooking
1383
+ */
1384
+ export async function cancelBooking(bookingId, options) {
1385
+ // @ts-ignore
1386
+ const { httpClient, sideEffects } = arguments[2];
1387
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1388
+ bookingId: bookingId,
1389
+ participantNotification: options?.participantNotification,
1390
+ flowControlSettings: options?.flowControlSettings,
1391
+ revision: options?.revision,
1392
+ });
1393
+ const reqOpts = ambassadorWixBookingsV2Booking.bookingsCancelBooking(payload);
1394
+ sideEffects?.onSiteCall?.();
1395
+ try {
1396
+ const result = await httpClient.request(reqOpts);
1397
+ sideEffects?.onSuccess?.(result);
1398
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
1399
+ }
1400
+ catch (err) {
1401
+ const transformedError = sdkTransformError(err, {
1402
+ spreadPathsToArguments: {},
1403
+ explicitPathsToArguments: {
1404
+ bookingId: '$[0]',
1405
+ participantNotification: '$[1].participantNotification',
1406
+ flowControlSettings: '$[1].flowControlSettings',
1407
+ revision: '$[1].revision',
1408
+ },
1409
+ singleArgumentUnchanged: false,
1410
+ }, ['bookingId', 'options']);
1411
+ sideEffects?.onError?.(err);
1412
+ throw transformedError;
1413
+ }
1414
+ }
1415
+ /**
1416
+ * Updates the number of participants for a class or course booking and changes
1417
+ * the `totalNumberOfParticipants` for the relevant sessions.
1418
+ *
1419
+ *
1420
+ * ## Appointment limitation
1421
+ *
1422
+ * You can't update the number of participants for appointment bookings.
1423
+ *
1424
+ * ## Participant information
1425
+ *
1426
+ * You must specify either `participantsChoices` or `totalParticipants`.
1427
+ * The call fails if the specified `participantsChoices` aren't among the
1428
+ * supported service options and variants
1429
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/service-options-and-variants/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/service-options-and-variants/introduction)).
1430
+ * @param bookingId - ID of the booking to update the number of participants for.
1431
+ * @public
1432
+ * @requiredField bookingId
1433
+ * @requiredField options.revision
1434
+ * @permissionId BOOKINGS.NUMBER_OF_PARTICIPANTS_UPDATE
1435
+ * @permissionScope Manage Bookings
1436
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
1437
+ * @permissionScope Manage Bookings - all permissions
1438
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
1439
+ * @applicableIdentity APP
1440
+ * @fqn com.wixpress.bookings.bookings.v2.Bookings.UpdateNumberOfParticipants
1441
+ */
1442
+ export async function updateNumberOfParticipants(bookingId, options) {
1443
+ // @ts-ignore
1444
+ const { httpClient, sideEffects } = arguments[2];
1445
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1446
+ bookingId: bookingId,
1447
+ revision: options?.revision,
1448
+ totalParticipants: options?.totalParticipants,
1449
+ participantsChoices: options?.participantsChoices,
1450
+ });
1451
+ const reqOpts = ambassadorWixBookingsV2Booking.bookingsUpdateNumberOfParticipants(payload);
1452
+ sideEffects?.onSiteCall?.();
1453
+ try {
1454
+ const result = await httpClient.request(reqOpts);
1455
+ sideEffects?.onSuccess?.(result);
1456
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
1457
+ }
1458
+ catch (err) {
1459
+ const transformedError = sdkTransformError(err, {
1460
+ spreadPathsToArguments: {},
1461
+ explicitPathsToArguments: {
1462
+ bookingId: '$[0]',
1463
+ revision: '$[1].revision',
1464
+ totalParticipants: '$[1].totalParticipants',
1465
+ participantsChoices: '$[1].participantsChoices',
1466
+ },
1467
+ singleArgumentUnchanged: false,
1468
+ }, ['bookingId', 'options']);
1469
+ sideEffects?.onError?.(err);
1470
+ throw transformedError;
1471
+ }
1472
+ }
1473
+ /**
1474
+ * Updates the booking `status` to `CONFIRMED`, `PENDING`, or `DECLINED` based
1475
+ * on the `paymentStatus` you provide, double booking conflicts, and whether
1476
+ * the service requires business approval.
1477
+ *
1478
+ * ## eCommerce checkout restriction
1479
+ *
1480
+ * Call this method only when using a custom checkout page. Don't
1481
+ * call it when using a Wix eCommerce checkout
1482
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/orders/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/checkout/introduction)).
1483
+ * In such cases, Wix automatically updates the booking status based on
1484
+ * the `paymentStatus` of the corresponding Wix eCommerce order
1485
+ * ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/checkout/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/introduction)).
1486
+ *
1487
+ * ## New booking status
1488
+ *
1489
+ * The booking `status` is set to `DECLINED` if both of the following conditions
1490
+ * are met:
1491
+ * + You provide `UNDEFINED`, `NOT_PAID`, `REFUNDED`, or `EXEMPT` as payment status.
1492
+ * + There is a double booking conflict.
1493
+ *
1494
+ * If only one or none of these conditions is met, `status` is set to `PENDING`
1495
+ * or `CONFIRMED` depending on whether the service requires business approval.
1496
+ *
1497
+ * ## Double bookings
1498
+ *
1499
+ * If there is a double booking conflict, but the booking has already been at least
1500
+ * partially paid, the method still marks the booking as `PENDING` or `CONFIRMED`.
1501
+ * Then, it also sets `doubleBooked` to `true`.
1502
+ *
1503
+ * ## Admin overwrites
1504
+ *
1505
+ * There are small but important differences in confirmation behavior if the
1506
+ * booking was created with special `flowControlSettings`:
1507
+ * + If the booking's `flowControlSettings.skipAvailabilityValidation` was set to
1508
+ * `true`, the booking is never declined regardless of double booking conflicts.
1509
+ * Instead, it's marked `CONFIRMED` or `PENDING`, depending on whether the
1510
+ * service requires business approval.
1511
+ * + If the booking's `flowControlSettings.skipBusinessConfirmation` was set to
1512
+ * `true`, the booking skips `PENDING` status and is marked `CONFIRMED`
1513
+ * immediately.
1514
+ * @param bookingId - ID of the booking to confirm or decline.
1515
+ * @public
1516
+ * @requiredField bookingId
1517
+ * @permissionId BOOKINGS.BOOKING_CONFIRM_OR_DECLINE
1518
+ * @permissionScope Manage Bookings
1519
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
1520
+ * @permissionScope Manage Bookings - all permissions
1521
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
1522
+ * @applicableIdentity APP
1523
+ * @fqn com.wixpress.bookings.confirmator.v2.Confirmator.ConfirmOrDeclineBooking
1524
+ */
1525
+ export async function confirmOrDeclineBooking(bookingId, options) {
1526
+ // @ts-ignore
1527
+ const { httpClient, sideEffects } = arguments[2];
1528
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1529
+ bookingId: bookingId,
1530
+ paymentStatus: options?.paymentStatus,
1531
+ });
1532
+ const reqOpts = ambassadorWixBookingsV2Booking.confirmOrDeclineBooking(payload);
1533
+ sideEffects?.onSiteCall?.();
1534
+ try {
1535
+ const result = await httpClient.request(reqOpts);
1536
+ sideEffects?.onSuccess?.(result);
1537
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
1538
+ }
1539
+ catch (err) {
1540
+ const transformedError = sdkTransformError(err, {
1541
+ spreadPathsToArguments: {},
1542
+ explicitPathsToArguments: {
1543
+ bookingId: '$[0]',
1544
+ paymentStatus: '$[1].paymentStatus',
1545
+ },
1546
+ singleArgumentUnchanged: false,
1547
+ }, ['bookingId', 'options']);
1548
+ sideEffects?.onError?.(err);
1549
+ throw transformedError;
1550
+ }
1551
+ }
1552
+ /**
1553
+ * Confirms or declines up to 300 bookings.
1554
+ *
1555
+ *
1556
+ * See Confirm Or Decline Booking
1557
+ * ([SDK](https://dev.wix.com/docs/velo/api-reference/wix-bookings-v2/bookings/confirm-or-decline-booking) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/bookings-writer-v2/confirm-or-decline-booking))
1558
+ * for details about when a booking is confirmed or declined.
1559
+ * @param details - Bookings to confirm or decline.
1560
+ * @public
1561
+ * @documentationMaturity preview
1562
+ * @requiredField details
1563
+ * @requiredField details.bookingId
1564
+ * @permissionId BOOKINGS.BOOKING_CONFIRM_OR_DECLINE
1565
+ * @permissionScope Manage Bookings
1566
+ * @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
1567
+ * @permissionScope Manage Bookings - all permissions
1568
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
1569
+ * @applicableIdentity APP
1570
+ * @fqn com.wixpress.bookings.confirmator.v2.Confirmator.BulkConfirmOrDeclineBooking
1571
+ */
1572
+ export async function bulkConfirmOrDeclineBooking(details, options) {
1573
+ // @ts-ignore
1574
+ const { httpClient, sideEffects } = arguments[2];
1575
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1576
+ details: details,
1577
+ returnEntity: options?.returnEntity,
1578
+ });
1579
+ const reqOpts = ambassadorWixBookingsV2Booking.bulkConfirmOrDeclineBooking(payload);
1580
+ sideEffects?.onSiteCall?.();
1581
+ try {
1582
+ const result = await httpClient.request(reqOpts);
1583
+ sideEffects?.onSuccess?.(result);
1584
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
1585
+ }
1586
+ catch (err) {
1587
+ const transformedError = sdkTransformError(err, {
1588
+ spreadPathsToArguments: {},
1589
+ explicitPathsToArguments: {
1590
+ details: '$[0]',
1591
+ returnEntity: '$[1].returnEntity',
1592
+ },
1593
+ singleArgumentUnchanged: false,
1594
+ }, ['details', 'options']);
1595
+ sideEffects?.onError?.(err);
1596
+ throw transformedError;
1597
+ }
1598
+ }
1599
+ //# sourceMappingURL=bookings-v2-booking-bookings.universal.js.map