@wix/auto_sdk_bookings_bookings 1.0.17 → 1.0.19

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