@wix/bookings 1.0.1 → 1.0.2
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.
- package/build/cjs/index.d.ts +4 -1
- package/build/cjs/index.js +5 -2
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/src/bookings-availability-v1-slot-availability.http.d.ts +6 -6
- package/build/cjs/src/bookings-availability-v1-slot-availability.http.js +6 -6
- package/build/cjs/src/bookings-availability-v1-slot-availability.universal.d.ts +14 -29
- package/build/cjs/src/bookings-availability-v1-slot-availability.universal.js +7 -6
- package/build/cjs/src/bookings-availability-v1-slot-availability.universal.js.map +1 -1
- package/build/cjs/src/bookings-reader-v2-extended-booking.http.d.ts +38 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.http.js +117 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.http.js.map +1 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.public.d.ts +5 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.public.js +22 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.public.js.map +1 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.types.d.ts +730 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.types.js +90 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.types.js.map +1 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.universal.d.ts +786 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.universal.js +226 -0
- package/build/cjs/src/bookings-reader-v2-extended-booking.universal.js.map +1 -0
- package/build/cjs/src/bookings-v2-booking.http.d.ts +123 -0
- package/build/cjs/src/bookings-v2-booking.http.js +305 -0
- package/build/cjs/src/bookings-v2-booking.http.js.map +1 -0
- package/build/cjs/src/bookings-v2-booking.public.d.ts +9 -0
- package/build/cjs/src/bookings-v2-booking.public.js +47 -0
- package/build/cjs/src/bookings-v2-booking.public.js.map +1 -0
- package/build/cjs/src/bookings-v2-booking.types.d.ts +1594 -0
- package/build/cjs/src/bookings-v2-booking.types.js +99 -0
- package/build/cjs/src/bookings-v2-booking.types.js.map +1 -0
- package/build/cjs/src/bookings-v2-booking.universal.d.ts +1840 -0
- package/build/cjs/src/bookings-v2-booking.universal.js +561 -0
- package/build/cjs/src/bookings-v2-booking.universal.js.map +1 -0
- package/build/cjs/src/bookings-v2-price-info.http.d.ts +56 -0
- package/build/cjs/src/bookings-v2-price-info.http.js +164 -0
- package/build/cjs/src/bookings-v2-price-info.http.js.map +1 -0
- package/build/cjs/src/bookings-v2-price-info.public.d.ts +6 -0
- package/build/cjs/src/bookings-v2-price-info.public.js +26 -0
- package/build/cjs/src/bookings-v2-price-info.public.js.map +1 -0
- package/build/cjs/src/bookings-v2-price-info.types.d.ts +594 -0
- package/build/cjs/src/bookings-v2-price-info.types.js +79 -0
- package/build/cjs/src/bookings-v2-price-info.types.js.map +1 -0
- package/build/cjs/src/bookings-v2-price-info.universal.d.ts +664 -0
- package/build/cjs/src/bookings-v2-price-info.universal.js +274 -0
- package/build/cjs/src/bookings-v2-price-info.universal.js.map +1 -0
- package/build/es/index.d.ts +4 -1
- package/build/es/index.js +4 -1
- package/build/es/index.js.map +1 -1
- package/build/es/src/bookings-availability-v1-slot-availability.http.d.ts +6 -6
- package/build/es/src/bookings-availability-v1-slot-availability.http.js +6 -6
- package/build/es/src/bookings-availability-v1-slot-availability.universal.d.ts +14 -29
- package/build/es/src/bookings-availability-v1-slot-availability.universal.js +7 -6
- package/build/es/src/bookings-availability-v1-slot-availability.universal.js.map +1 -1
- package/build/es/src/bookings-reader-v2-extended-booking.http.d.ts +38 -0
- package/build/es/src/bookings-reader-v2-extended-booking.http.js +113 -0
- package/build/es/src/bookings-reader-v2-extended-booking.http.js.map +1 -0
- package/build/es/src/bookings-reader-v2-extended-booking.public.d.ts +5 -0
- package/build/es/src/bookings-reader-v2-extended-booking.public.js +8 -0
- package/build/es/src/bookings-reader-v2-extended-booking.public.js.map +1 -0
- package/build/es/src/bookings-reader-v2-extended-booking.types.d.ts +730 -0
- package/build/es/src/bookings-reader-v2-extended-booking.types.js +87 -0
- package/build/es/src/bookings-reader-v2-extended-booking.types.js.map +1 -0
- package/build/es/src/bookings-reader-v2-extended-booking.universal.d.ts +786 -0
- package/build/es/src/bookings-reader-v2-extended-booking.universal.js +203 -0
- package/build/es/src/bookings-reader-v2-extended-booking.universal.js.map +1 -0
- package/build/es/src/bookings-v2-booking.http.d.ts +123 -0
- package/build/es/src/bookings-v2-booking.http.js +297 -0
- package/build/es/src/bookings-v2-booking.http.js.map +1 -0
- package/build/es/src/bookings-v2-booking.public.d.ts +9 -0
- package/build/es/src/bookings-v2-booking.public.js +28 -0
- package/build/es/src/bookings-v2-booking.public.js.map +1 -0
- package/build/es/src/bookings-v2-booking.types.d.ts +1594 -0
- package/build/es/src/bookings-v2-booking.types.js +96 -0
- package/build/es/src/bookings-v2-booking.types.js.map +1 -0
- package/build/es/src/bookings-v2-booking.universal.d.ts +1840 -0
- package/build/es/src/bookings-v2-booking.universal.js +534 -0
- package/build/es/src/bookings-v2-booking.universal.js.map +1 -0
- package/build/es/src/bookings-v2-price-info.http.d.ts +56 -0
- package/build/es/src/bookings-v2-price-info.http.js +159 -0
- package/build/es/src/bookings-v2-price-info.http.js.map +1 -0
- package/build/es/src/bookings-v2-price-info.public.d.ts +6 -0
- package/build/es/src/bookings-v2-price-info.public.js +13 -0
- package/build/es/src/bookings-v2-price-info.public.js.map +1 -0
- package/build/es/src/bookings-v2-price-info.types.d.ts +594 -0
- package/build/es/src/bookings-v2-price-info.types.js +76 -0
- package/build/es/src/bookings-v2-price-info.types.js.map +1 -0
- package/build/es/src/bookings-v2-price-info.universal.d.ts +664 -0
- package/build/es/src/bookings-v2-price-info.universal.js +250 -0
- package/build/es/src/bookings-v2-price-info.universal.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.queryExtendedBookings = exports.SortOrder = exports.IdentityType = exports.Actor = exports.Platform = exports.SelectedPaymentOption = exports.PaymentStatus = exports.BookingStatus = exports.ValueType = exports.LocationType = exports.AttendanceStatus = exports.__debug = void 0;
|
|
32
|
+
const velo_1 = require("@wix/metro-runtime/velo");
|
|
33
|
+
const ambassadorWixBookingsReaderV2ExtendedBooking = __importStar(require("./bookings-reader-v2-extended-booking.http"));
|
|
34
|
+
let __verbose = false;
|
|
35
|
+
function __log(...args) {
|
|
36
|
+
__verbose && console.log(...args);
|
|
37
|
+
}
|
|
38
|
+
function __inspect(obj) {
|
|
39
|
+
return obj;
|
|
40
|
+
}
|
|
41
|
+
exports.__debug = {
|
|
42
|
+
verboseLogging: {
|
|
43
|
+
on: () => (__verbose = true),
|
|
44
|
+
off: () => (__verbose = false),
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
const _toVeloEntity = '$';
|
|
48
|
+
const _fromVeloEntity = '$';
|
|
49
|
+
var AttendanceStatus;
|
|
50
|
+
(function (AttendanceStatus) {
|
|
51
|
+
AttendanceStatus["NOT_SET"] = "NOT_SET";
|
|
52
|
+
AttendanceStatus["ATTENDED"] = "ATTENDED";
|
|
53
|
+
AttendanceStatus["NOT_ATTENDED"] = "NOT_ATTENDED";
|
|
54
|
+
})(AttendanceStatus = exports.AttendanceStatus || (exports.AttendanceStatus = {}));
|
|
55
|
+
var LocationType;
|
|
56
|
+
(function (LocationType) {
|
|
57
|
+
LocationType["UNDEFINED"] = "UNDEFINED";
|
|
58
|
+
LocationType["OWNER_BUSINESS"] = "OWNER_BUSINESS";
|
|
59
|
+
LocationType["OWNER_CUSTOM"] = "OWNER_CUSTOM";
|
|
60
|
+
LocationType["CUSTOM"] = "CUSTOM";
|
|
61
|
+
})(LocationType = exports.LocationType || (exports.LocationType = {}));
|
|
62
|
+
var ValueType;
|
|
63
|
+
(function (ValueType) {
|
|
64
|
+
/** Short text. This is the default value type. */
|
|
65
|
+
ValueType["SHORT_TEXT"] = "SHORT_TEXT";
|
|
66
|
+
/** Long text */
|
|
67
|
+
ValueType["LONG_TEXT"] = "LONG_TEXT";
|
|
68
|
+
/** a text that represent the check box value: if selected the value is "true", otherwise "false". */
|
|
69
|
+
ValueType["CHECK_BOX"] = "CHECK_BOX";
|
|
70
|
+
})(ValueType = exports.ValueType || (exports.ValueType = {}));
|
|
71
|
+
/** Booking status. */
|
|
72
|
+
var BookingStatus;
|
|
73
|
+
(function (BookingStatus) {
|
|
74
|
+
BookingStatus["CREATED"] = "CREATED";
|
|
75
|
+
BookingStatus["CONFIRMED"] = "CONFIRMED";
|
|
76
|
+
BookingStatus["CANCELED"] = "CANCELED";
|
|
77
|
+
BookingStatus["PENDING"] = "PENDING";
|
|
78
|
+
BookingStatus["DECLINED"] = "DECLINED";
|
|
79
|
+
BookingStatus["WAITING_LIST"] = "WAITING_LIST";
|
|
80
|
+
})(BookingStatus = exports.BookingStatus || (exports.BookingStatus = {}));
|
|
81
|
+
/**
|
|
82
|
+
* Payment status.
|
|
83
|
+
* Automatically updated when using eCom checkout APIs.
|
|
84
|
+
*/
|
|
85
|
+
var PaymentStatus;
|
|
86
|
+
(function (PaymentStatus) {
|
|
87
|
+
PaymentStatus["UNDEFINED"] = "UNDEFINED";
|
|
88
|
+
PaymentStatus["NOT_PAID"] = "NOT_PAID";
|
|
89
|
+
PaymentStatus["PAID"] = "PAID";
|
|
90
|
+
/** not supported yet. */
|
|
91
|
+
PaymentStatus["PARTIALLY_PAID"] = "PARTIALLY_PAID";
|
|
92
|
+
/** not supported yet */
|
|
93
|
+
PaymentStatus["REFUNDED"] = "REFUNDED";
|
|
94
|
+
})(PaymentStatus = exports.PaymentStatus || (exports.PaymentStatus = {}));
|
|
95
|
+
/**
|
|
96
|
+
* The selected payment option.
|
|
97
|
+
* One of the payment options offered by the service.
|
|
98
|
+
* This field is be set when the user selects an option during booking.
|
|
99
|
+
* If left undefined, the payment option is resolved by the service configuration on checkout.
|
|
100
|
+
*/
|
|
101
|
+
var SelectedPaymentOption;
|
|
102
|
+
(function (SelectedPaymentOption) {
|
|
103
|
+
SelectedPaymentOption["UNDEFINED"] = "UNDEFINED";
|
|
104
|
+
SelectedPaymentOption["OFFLINE"] = "OFFLINE";
|
|
105
|
+
SelectedPaymentOption["ONLINE"] = "ONLINE";
|
|
106
|
+
SelectedPaymentOption["MEMBERSHIP"] = "MEMBERSHIP";
|
|
107
|
+
/** Payment can only be done using a membership and must be manually redeemed in the dashboard by the site owner. */
|
|
108
|
+
SelectedPaymentOption["MEMBERSHIP_OFFLINE"] = "MEMBERSHIP_OFFLINE";
|
|
109
|
+
})(SelectedPaymentOption = exports.SelectedPaymentOption || (exports.SelectedPaymentOption = {}));
|
|
110
|
+
var Platform;
|
|
111
|
+
(function (Platform) {
|
|
112
|
+
Platform["UNDEFINED_PLATFORM"] = "UNDEFINED_PLATFORM";
|
|
113
|
+
Platform["WEB"] = "WEB";
|
|
114
|
+
Platform["MOBILE_APP"] = "MOBILE_APP";
|
|
115
|
+
})(Platform = exports.Platform || (exports.Platform = {}));
|
|
116
|
+
var Actor;
|
|
117
|
+
(function (Actor) {
|
|
118
|
+
Actor["UNDEFINED_ACTOR"] = "UNDEFINED_ACTOR";
|
|
119
|
+
Actor["BUSINESS"] = "BUSINESS";
|
|
120
|
+
Actor["CUSTOMER"] = "CUSTOMER";
|
|
121
|
+
})(Actor = exports.Actor || (exports.Actor = {}));
|
|
122
|
+
var IdentityType;
|
|
123
|
+
(function (IdentityType) {
|
|
124
|
+
IdentityType["UNKNOWN"] = "UNKNOWN";
|
|
125
|
+
IdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
|
|
126
|
+
IdentityType["MEMBER"] = "MEMBER";
|
|
127
|
+
IdentityType["WIX_USER"] = "WIX_USER";
|
|
128
|
+
IdentityType["APP"] = "APP";
|
|
129
|
+
})(IdentityType = exports.IdentityType || (exports.IdentityType = {}));
|
|
130
|
+
var SortOrder;
|
|
131
|
+
(function (SortOrder) {
|
|
132
|
+
SortOrder["ASC"] = "ASC";
|
|
133
|
+
SortOrder["DESC"] = "DESC";
|
|
134
|
+
})(SortOrder = exports.SortOrder || (exports.SortOrder = {}));
|
|
135
|
+
const _queryExtendedBookingsRequest = {};
|
|
136
|
+
const _queryExtendedBookingsResponse = {};
|
|
137
|
+
/**
|
|
138
|
+
* Retrieves a list of bookings, given the provided paging, filtering, and sorting.
|
|
139
|
+
*
|
|
140
|
+
* Up to 100 bookings can be returned per request.
|
|
141
|
+
*
|
|
142
|
+
* Query Extended Bookings runs with these defaults, which you can override:
|
|
143
|
+
*
|
|
144
|
+
* - `createdDate` sorted in `DESC` order
|
|
145
|
+
* - `cursorPaging.limit` is `50`
|
|
146
|
+
*
|
|
147
|
+
*
|
|
148
|
+
* You can retrieve information about which actions the customer can perform
|
|
149
|
+
* for the bookings. To do so, pass `withBookingAllowedActions` as `true`.
|
|
150
|
+
*
|
|
151
|
+
*
|
|
152
|
+
* For field support see
|
|
153
|
+
* [supported filters](https://dev.wix.com/api/rest/wix-bookings/bookings-reader-v2/supported-filters)
|
|
154
|
+
* for more information.
|
|
155
|
+
*
|
|
156
|
+
* You can only specify a filter only once per query. If a filter is provided
|
|
157
|
+
* more than once, only the first occurrence affects the returned bookings.
|
|
158
|
+
*
|
|
159
|
+
* When using filters for dates, you must use [UTC time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).
|
|
160
|
+
*
|
|
161
|
+
* Bookings that are part of a schedule don't have a `sessionId`. Therefore you
|
|
162
|
+
* must use the `sessionId` filter that isn't part of the `query` object to
|
|
163
|
+
* filter bookings for courses.
|
|
164
|
+
*
|
|
165
|
+
* To learn about working with _Query_ endpoints, see
|
|
166
|
+
* [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language),
|
|
167
|
+
* [Sorting and Paging](https://dev.wix.com/api/rest/getting-started/sorting-and-paging),
|
|
168
|
+
* and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection).
|
|
169
|
+
*
|
|
170
|
+
* When calling Query Extended Bookings, the retrieved data may not contain your most recent changes.
|
|
171
|
+
* @param query - Information about filters, paging, and sorting.
|
|
172
|
+
* __Note__: `fields` and `fieldsets` aren't supported.
|
|
173
|
+
* @public
|
|
174
|
+
* @documentationMaturity preview
|
|
175
|
+
* @requiredField query
|
|
176
|
+
*/
|
|
177
|
+
function queryExtendedBookings(query, options) {
|
|
178
|
+
var _a, _b, _c;
|
|
179
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
180
|
+
const requestTransformation = {
|
|
181
|
+
query: '$[0]',
|
|
182
|
+
withBookingAllowedActions: '$[1].withBookingAllowedActions',
|
|
183
|
+
withBookingAttendanceInfo: '$[1].withBookingAttendanceInfo',
|
|
184
|
+
};
|
|
185
|
+
const responseTransformation = '$';
|
|
186
|
+
// @ts-ignore
|
|
187
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
188
|
+
const { toAmbassadorRequest } = velo_1.serializer({
|
|
189
|
+
rootSchema: _queryExtendedBookingsRequest,
|
|
190
|
+
depSchemas: {},
|
|
191
|
+
fqdnTransformation: {
|
|
192
|
+
paths: [],
|
|
193
|
+
transformation: _fromVeloEntity,
|
|
194
|
+
},
|
|
195
|
+
customTransformation: requestTransformation,
|
|
196
|
+
});
|
|
197
|
+
const { fromJSON } = velo_1.serializer({
|
|
198
|
+
rootSchema: _queryExtendedBookingsResponse,
|
|
199
|
+
depSchemas: {},
|
|
200
|
+
fqdnTransformation: {
|
|
201
|
+
paths: [...['Array#extendedBookings']],
|
|
202
|
+
transformation: _toVeloEntity,
|
|
203
|
+
},
|
|
204
|
+
customTransformation: responseTransformation,
|
|
205
|
+
});
|
|
206
|
+
const payload = toAmbassadorRequest([query, options]);
|
|
207
|
+
const reqOpts = ambassadorWixBookingsReaderV2ExtendedBooking.queryExtendedBookings(payload);
|
|
208
|
+
__log(`"QueryExtendedBookings" sending request with: ${__inspect(reqOpts)}`);
|
|
209
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
210
|
+
try {
|
|
211
|
+
const result = yield httpClient.request(reqOpts);
|
|
212
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
213
|
+
return fromJSON(result.data);
|
|
214
|
+
}
|
|
215
|
+
catch (err) {
|
|
216
|
+
const transformedError = velo_1.transformError(err, requestTransformation, [
|
|
217
|
+
'query',
|
|
218
|
+
'options',
|
|
219
|
+
]);
|
|
220
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
221
|
+
throw transformedError;
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
exports.queryExtendedBookings = queryExtendedBookings;
|
|
226
|
+
//# sourceMappingURL=bookings-reader-v2-extended-booking.universal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookings-reader-v2-extended-booking.universal.js","sourceRoot":"","sources":["../../../src/bookings-reader-v2-extended-booking.universal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAqE;AAErE,yHAA2G;AAE3G,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,SAAS,KAAK,CAAC,GAAG,IAAW;IAC3B,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,SAAS,CAAC,GAAQ;IACzB,OAAO,GAAG,CAAC;AACb,CAAC;AAEY,QAAA,OAAO,GAAG;IACrB,cAAc,EAAE;QACd,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC;QAC5B,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,KAAK,CAAC;KAC/B;CACF,CAAC;AACF,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,eAAe,GAAG,GAAG,CAAC;AAkB5B,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,yCAAqB,CAAA;IACrB,iDAA6B,CAAA;AAC/B,CA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GAAG,iBAAU,CAAC;YAC9B,UAAU,EAAE,8BAA8B;YAC1C,UAAU,EAAE,EAAE;YACd,kBAAkB,EAAE;gBAClB,KAAK,EAAE,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;gBACtC,cAAc,EAAE,aAAa;aAC9B;YACD,oBAAoB,EAAE,sBAAsB;SAC7C,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,mBAAmB,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;QAEtD,MAAM,OAAO,GACX,4CAA4C,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAE9E,KAAK,CAAC,iDAAiD,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAE7E,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,UAAU,+CAAvB,WAAW,CAAgB,CAAC;QAC5B,IAAI;YACF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACjD,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,SAAS,+CAAtB,WAAW,EAAc,MAAM,CAAC,CAAC;YAEjC,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAQ,CAAC;SACrC;QAAC,OAAO,GAAQ,EAAE;YACjB,MAAM,gBAAgB,GAAG,qBAAc,CAAC,GAAG,EAAE,qBAAqB,EAAE;gBAClE,OAAO;gBACP,SAAS;aACV,CAAC,CAAC;YACH,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,+CAApB,WAAW,EAAY,GAAG,CAAC,CAAC;YAE5B,MAAM,gBAAgB,CAAC;SACxB;;CACF;AA3DD,sDA2DC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { RequestOptionsFactory } from '@wix/sdk-types';
|
|
2
|
+
import { CancelBookingRequest, CancelBookingResponse, ConfirmBookingRequest, ConfirmBookingResponse, DeclineBookingRequest, DeclineBookingResponse, RescheduleBookingRequest, RescheduleBookingResponse, UpdateNumberOfParticipantsRequest, UpdateNumberOfParticipantsResponse } from './bookings-v2-booking.types';
|
|
3
|
+
/**
|
|
4
|
+
* Reschedules a booking to a different slot or session.
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* You can only reschedule bookings for appointments or classes, you can't
|
|
8
|
+
* reschedule course bookings.
|
|
9
|
+
*
|
|
10
|
+
* The old session is removed from the calendar and the new session is
|
|
11
|
+
* added.
|
|
12
|
+
*
|
|
13
|
+
* If you reschedule a booking for a class session the new session must be an
|
|
14
|
+
* existing session for the same class.
|
|
15
|
+
*
|
|
16
|
+
* You can pass a `participantNotification.message` to notify the customer of
|
|
17
|
+
* the rescheduling. You also need to pass `participantNotification.notifyParticipants`
|
|
18
|
+
* as `true` to actually send the message.
|
|
19
|
+
*
|
|
20
|
+
* In case the service has
|
|
21
|
+
* variants, you can call this endpoint to update the booking's `totalParticipants` or `participantsChoices`.
|
|
22
|
+
* If you provide `participantsChoices`, all of the provided choices must exist for
|
|
23
|
+
* the service. Otherwise, the call returns an `INVALID_SERVICE_CHOICES` error.
|
|
24
|
+
* If you omit `participantsChoices` in the request, the existing choices are
|
|
25
|
+
* kept and not replaced with an empty object.
|
|
26
|
+
*
|
|
27
|
+
* <!-- INTERNAL PERMISSION COMMENT:
|
|
28
|
+
* You need to have the `BOOKINGS.NUMBER_OF_PARTICIPANTS_UPDATE` permission
|
|
29
|
+
* to reschedule bookings including `participantsInfo`.
|
|
30
|
+
* <!--END: INTERNAL PERMISSION COMMENT-->
|
|
31
|
+
*
|
|
32
|
+
* In case you want to reschedule a booking on behalf of a customer, we recommend
|
|
33
|
+
* to pass `flowControlSettings.ignoreReschedulePolicy` as `false`. This
|
|
34
|
+
* ensures that the rescheduling is validated against the service's rescheduling
|
|
35
|
+
* policy.
|
|
36
|
+
*/
|
|
37
|
+
export declare function rescheduleBooking(payload: RescheduleBookingRequest): RequestOptionsFactory<RescheduleBookingResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Confirms a booking request and changes the booking status to `CONFIRMED`.
|
|
40
|
+
*
|
|
41
|
+
*
|
|
42
|
+
* Calling this method doesn't check whether a slot or schedule is still
|
|
43
|
+
* available at this time.
|
|
44
|
+
*
|
|
45
|
+
* You can only confirm bookings for services that require the owner's manual
|
|
46
|
+
* approval for bookings and that have a status of `PENDING`.
|
|
47
|
+
*
|
|
48
|
+
* For appointment services the slot may become unavailable, depending on the
|
|
49
|
+
* [service's](https://support.wix.com/en/article/creating-the-right-booking-service-for-your-business)
|
|
50
|
+
* `policy.bookingApprovalPolicy.requestsAffectsAvailability`.
|
|
51
|
+
*
|
|
52
|
+
* Calling this method also changes the
|
|
53
|
+
* [session's](https://www.wix.com/velo/reference/wix-bookings-backend/sessions/getsession)
|
|
54
|
+
* `participants.approvalStatus` to `APPROVED`.
|
|
55
|
+
*
|
|
56
|
+
* You can pass a `participantNotification.message` to notify the customer of
|
|
57
|
+
* the confirmation. You also need to pass `participantNotification.notifyParticipants`
|
|
58
|
+
* as `true` to actually send the message.
|
|
59
|
+
*
|
|
60
|
+
* Bookings are automatically confirmed when the
|
|
61
|
+
* service is configured to automatically confirm
|
|
62
|
+
* bookings and the [eCommerce order](https://www.wix.com/velo/reference/wix-ecom-backend/orders)
|
|
63
|
+
* has been approved. The slot's or schedule's availability is checked just
|
|
64
|
+
* before confirming the booking as part of the automatic flow.
|
|
65
|
+
*/
|
|
66
|
+
export declare function bookingsConfirmBooking(payload: ConfirmBookingRequest): RequestOptionsFactory<ConfirmBookingResponse>;
|
|
67
|
+
/**
|
|
68
|
+
* Declines a `PENDING` booking request and changes the booking status to
|
|
69
|
+
* `DECLINED`.
|
|
70
|
+
*
|
|
71
|
+
* Calling this method also changes the
|
|
72
|
+
* [session's](https://www.wix.com/velo/reference/wix-bookings-backend/sessions/getsession)
|
|
73
|
+
* `participants.approvalStatus` to `DECLINED`.
|
|
74
|
+
*
|
|
75
|
+
* You can only decline bookings for services that require the owner's manual
|
|
76
|
+
* approval for bookings and that have a status of `PENDING`.
|
|
77
|
+
*
|
|
78
|
+
* You can pass a `participantNotification.message` to notify the customer of
|
|
79
|
+
* the decline. You also need to pass `participantNotification.notifyParticipants`
|
|
80
|
+
* as `true` to actually send the message.
|
|
81
|
+
*/
|
|
82
|
+
export declare function bookingsDeclineBooking(payload: DeclineBookingRequest): RequestOptionsFactory<DeclineBookingResponse>;
|
|
83
|
+
/**
|
|
84
|
+
* Cancels a booking.
|
|
85
|
+
*
|
|
86
|
+
*
|
|
87
|
+
* The booking status changes to `CANCELED`.
|
|
88
|
+
*
|
|
89
|
+
* If the booking was for an appointment, the corresponding session is
|
|
90
|
+
* deleted from the business calendar.
|
|
91
|
+
*
|
|
92
|
+
* If the booking was for a class or course, the participants are removed
|
|
93
|
+
* from the class session or the course. But the course or class session
|
|
94
|
+
* remains on the business calendar.
|
|
95
|
+
*
|
|
96
|
+
* You can pass a `participantNotification.message` to notify the customer of
|
|
97
|
+
* the cancelation. You also need to pass `participantNotification.notifyParticipants`
|
|
98
|
+
* as `true` to actually send the message.
|
|
99
|
+
*
|
|
100
|
+
* In case you want to cancel a booking on behalf of a customer, we recommend
|
|
101
|
+
* to pass `flowControlSettings.ignoreCancellationPolicy` as `false`. This
|
|
102
|
+
* ensures that the cancelation is validated against the service's cancelation
|
|
103
|
+
* policy.
|
|
104
|
+
*/
|
|
105
|
+
export declare function bookingsCancelBooking(payload: CancelBookingRequest): RequestOptionsFactory<CancelBookingResponse>;
|
|
106
|
+
/**
|
|
107
|
+
* Updates the number of participants for a booking.
|
|
108
|
+
*
|
|
109
|
+
*
|
|
110
|
+
* You can only update the number of participants for class and course
|
|
111
|
+
* bookings, you can't update it for appointment bookings.
|
|
112
|
+
*
|
|
113
|
+
* Calling this method also changes the
|
|
114
|
+
* [session's](https://www.wix.com/velo/reference/wix-bookings-backend/sessions/getsession)
|
|
115
|
+
* `totalNumberOfParticipants`.
|
|
116
|
+
*
|
|
117
|
+
* When updating the number of participants for a booking you must pass either
|
|
118
|
+
* `participantsChoices` or `totalParticipants`. If you pass `participantsChoices`
|
|
119
|
+
* for services that have variants,
|
|
120
|
+
* all of the provided choices must exist for the service. Otherwise, the
|
|
121
|
+
* call returns an `INVALID_SERVICE_CHOICES` error.
|
|
122
|
+
*/
|
|
123
|
+
export declare function bookingsUpdateNumberOfParticipants(payload: UpdateNumberOfParticipantsRequest): RequestOptionsFactory<UpdateNumberOfParticipantsResponse>;
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bookingsUpdateNumberOfParticipants = exports.bookingsCancelBooking = exports.bookingsDeclineBooking = exports.bookingsConfirmBooking = exports.rescheduleBooking = void 0;
|
|
4
|
+
const ambassador_1 = require("@wix/metro-runtime/ambassador");
|
|
5
|
+
const metro_runtime_1 = require("@wix/metro-runtime");
|
|
6
|
+
const _address = { geocode: '_addressLocation' };
|
|
7
|
+
const _addressLocation = {
|
|
8
|
+
latitude: 'google.protobuf.DoubleValue',
|
|
9
|
+
longitude: 'google.protobuf.DoubleValue',
|
|
10
|
+
};
|
|
11
|
+
const _booking = {
|
|
12
|
+
createdDate: 'google.protobuf.Timestamp',
|
|
13
|
+
startDate: 'google.protobuf.Timestamp',
|
|
14
|
+
endDate: 'google.protobuf.Timestamp',
|
|
15
|
+
updatedDate: 'google.protobuf.Timestamp',
|
|
16
|
+
contactDetails: '_contactDetails',
|
|
17
|
+
};
|
|
18
|
+
const _cancelBookingRequest = {};
|
|
19
|
+
const _cancelBookingResponse = { booking: '_booking' };
|
|
20
|
+
const _confirmBookingRequest = {};
|
|
21
|
+
const _confirmBookingResponse = { booking: '_booking' };
|
|
22
|
+
const _contactDetails = { fullAddress: '_address' };
|
|
23
|
+
const _declineBookingRequest = {};
|
|
24
|
+
const _declineBookingResponse = { booking: '_booking' };
|
|
25
|
+
const _rescheduleBookingRequest = {};
|
|
26
|
+
const _rescheduleBookingResponse = { booking: '_booking' };
|
|
27
|
+
const _updateNumberOfParticipantsRequest = {};
|
|
28
|
+
const _updateNumberOfParticipantsResponse = { booking: '_booking' };
|
|
29
|
+
function resolveComWixpressBookingsBookingsV2BookingsUrl(opts) {
|
|
30
|
+
const domainToMappings = {
|
|
31
|
+
_: [
|
|
32
|
+
{
|
|
33
|
+
srcPath: '/_api/bookings-service/v2/bookings',
|
|
34
|
+
destPath: '/v2/bookings',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
'manage._base_domain_': [
|
|
38
|
+
{
|
|
39
|
+
srcPath: '/_api/bookings-service/v2/bookings',
|
|
40
|
+
destPath: '/v2/bookings',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
srcPath: '/_api/bookings-service/v2/bulk/bookings',
|
|
44
|
+
destPath: '/v2/bulk/bookings',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
'www.wixapis.com': [
|
|
48
|
+
{
|
|
49
|
+
srcPath: '/_api/bookings-service/v2/bookings',
|
|
50
|
+
destPath: '/v2/bookings',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
srcPath: '/bookings/v2/bookings',
|
|
54
|
+
destPath: '/v2/bookings',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
srcPath: '/bookings/v2/bulk/bookings',
|
|
58
|
+
destPath: '/v2/bulk/bookings',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
return metro_runtime_1.resolveUrl(Object.assign(opts, { domainToMappings }));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Reschedules a booking to a different slot or session.
|
|
66
|
+
*
|
|
67
|
+
*
|
|
68
|
+
* You can only reschedule bookings for appointments or classes, you can't
|
|
69
|
+
* reschedule course bookings.
|
|
70
|
+
*
|
|
71
|
+
* The old session is removed from the calendar and the new session is
|
|
72
|
+
* added.
|
|
73
|
+
*
|
|
74
|
+
* If you reschedule a booking for a class session the new session must be an
|
|
75
|
+
* existing session for the same class.
|
|
76
|
+
*
|
|
77
|
+
* You can pass a `participantNotification.message` to notify the customer of
|
|
78
|
+
* the rescheduling. You also need to pass `participantNotification.notifyParticipants`
|
|
79
|
+
* as `true` to actually send the message.
|
|
80
|
+
*
|
|
81
|
+
* In case the service has
|
|
82
|
+
* variants, you can call this endpoint to update the booking's `totalParticipants` or `participantsChoices`.
|
|
83
|
+
* If you provide `participantsChoices`, all of the provided choices must exist for
|
|
84
|
+
* the service. Otherwise, the call returns an `INVALID_SERVICE_CHOICES` error.
|
|
85
|
+
* If you omit `participantsChoices` in the request, the existing choices are
|
|
86
|
+
* kept and not replaced with an empty object.
|
|
87
|
+
*
|
|
88
|
+
* <!-- INTERNAL PERMISSION COMMENT:
|
|
89
|
+
* You need to have the `BOOKINGS.NUMBER_OF_PARTICIPANTS_UPDATE` permission
|
|
90
|
+
* to reschedule bookings including `participantsInfo`.
|
|
91
|
+
* <!--END: INTERNAL PERMISSION COMMENT-->
|
|
92
|
+
*
|
|
93
|
+
* In case you want to reschedule a booking on behalf of a customer, we recommend
|
|
94
|
+
* to pass `flowControlSettings.ignoreReschedulePolicy` as `false`. This
|
|
95
|
+
* ensures that the rescheduling is validated against the service's rescheduling
|
|
96
|
+
* policy.
|
|
97
|
+
*/
|
|
98
|
+
function rescheduleBooking(payload) {
|
|
99
|
+
const { toJSON: toReq, fromJSON: fromReq } = ambassador_1.serializer(_rescheduleBookingRequest, {});
|
|
100
|
+
const { fromJSON: fromRes } = ambassador_1.serializer(_rescheduleBookingResponse, {
|
|
101
|
+
_address,
|
|
102
|
+
_addressLocation,
|
|
103
|
+
_booking,
|
|
104
|
+
_contactDetails,
|
|
105
|
+
});
|
|
106
|
+
function __rescheduleBooking({ host }) {
|
|
107
|
+
const serializedData = toReq(payload);
|
|
108
|
+
const metadata = {
|
|
109
|
+
method: 'POST',
|
|
110
|
+
url: resolveComWixpressBookingsBookingsV2BookingsUrl({
|
|
111
|
+
protoPath: '/v2/bookings/{bookingId}/reschedule',
|
|
112
|
+
data: serializedData,
|
|
113
|
+
host,
|
|
114
|
+
}),
|
|
115
|
+
data: serializedData,
|
|
116
|
+
transformResponse: fromRes,
|
|
117
|
+
};
|
|
118
|
+
return metadata;
|
|
119
|
+
}
|
|
120
|
+
__rescheduleBooking.fromReq = fromReq;
|
|
121
|
+
return __rescheduleBooking;
|
|
122
|
+
}
|
|
123
|
+
exports.rescheduleBooking = rescheduleBooking;
|
|
124
|
+
/**
|
|
125
|
+
* Confirms a booking request and changes the booking status to `CONFIRMED`.
|
|
126
|
+
*
|
|
127
|
+
*
|
|
128
|
+
* Calling this method doesn't check whether a slot or schedule is still
|
|
129
|
+
* available at this time.
|
|
130
|
+
*
|
|
131
|
+
* You can only confirm bookings for services that require the owner's manual
|
|
132
|
+
* approval for bookings and that have a status of `PENDING`.
|
|
133
|
+
*
|
|
134
|
+
* For appointment services the slot may become unavailable, depending on the
|
|
135
|
+
* [service's](https://support.wix.com/en/article/creating-the-right-booking-service-for-your-business)
|
|
136
|
+
* `policy.bookingApprovalPolicy.requestsAffectsAvailability`.
|
|
137
|
+
*
|
|
138
|
+
* Calling this method also changes the
|
|
139
|
+
* [session's](https://www.wix.com/velo/reference/wix-bookings-backend/sessions/getsession)
|
|
140
|
+
* `participants.approvalStatus` to `APPROVED`.
|
|
141
|
+
*
|
|
142
|
+
* You can pass a `participantNotification.message` to notify the customer of
|
|
143
|
+
* the confirmation. You also need to pass `participantNotification.notifyParticipants`
|
|
144
|
+
* as `true` to actually send the message.
|
|
145
|
+
*
|
|
146
|
+
* Bookings are automatically confirmed when the
|
|
147
|
+
* service is configured to automatically confirm
|
|
148
|
+
* bookings and the [eCommerce order](https://www.wix.com/velo/reference/wix-ecom-backend/orders)
|
|
149
|
+
* has been approved. The slot's or schedule's availability is checked just
|
|
150
|
+
* before confirming the booking as part of the automatic flow.
|
|
151
|
+
*/
|
|
152
|
+
function bookingsConfirmBooking(payload) {
|
|
153
|
+
const { toJSON: toReq, fromJSON: fromReq } = ambassador_1.serializer(_confirmBookingRequest, {});
|
|
154
|
+
const { fromJSON: fromRes } = ambassador_1.serializer(_confirmBookingResponse, {
|
|
155
|
+
_address,
|
|
156
|
+
_addressLocation,
|
|
157
|
+
_booking,
|
|
158
|
+
_contactDetails,
|
|
159
|
+
});
|
|
160
|
+
function __bookingsConfirmBooking({ host }) {
|
|
161
|
+
const serializedData = toReq(payload);
|
|
162
|
+
const metadata = {
|
|
163
|
+
method: 'POST',
|
|
164
|
+
url: resolveComWixpressBookingsBookingsV2BookingsUrl({
|
|
165
|
+
protoPath: '/v2/bookings/{bookingId}/confirm',
|
|
166
|
+
data: serializedData,
|
|
167
|
+
host,
|
|
168
|
+
}),
|
|
169
|
+
data: serializedData,
|
|
170
|
+
transformResponse: fromRes,
|
|
171
|
+
};
|
|
172
|
+
return metadata;
|
|
173
|
+
}
|
|
174
|
+
__bookingsConfirmBooking.fromReq = fromReq;
|
|
175
|
+
return __bookingsConfirmBooking;
|
|
176
|
+
}
|
|
177
|
+
exports.bookingsConfirmBooking = bookingsConfirmBooking;
|
|
178
|
+
/**
|
|
179
|
+
* Declines a `PENDING` booking request and changes the booking status to
|
|
180
|
+
* `DECLINED`.
|
|
181
|
+
*
|
|
182
|
+
* Calling this method also changes the
|
|
183
|
+
* [session's](https://www.wix.com/velo/reference/wix-bookings-backend/sessions/getsession)
|
|
184
|
+
* `participants.approvalStatus` to `DECLINED`.
|
|
185
|
+
*
|
|
186
|
+
* You can only decline bookings for services that require the owner's manual
|
|
187
|
+
* approval for bookings and that have a status of `PENDING`.
|
|
188
|
+
*
|
|
189
|
+
* You can pass a `participantNotification.message` to notify the customer of
|
|
190
|
+
* the decline. You also need to pass `participantNotification.notifyParticipants`
|
|
191
|
+
* as `true` to actually send the message.
|
|
192
|
+
*/
|
|
193
|
+
function bookingsDeclineBooking(payload) {
|
|
194
|
+
const { toJSON: toReq, fromJSON: fromReq } = ambassador_1.serializer(_declineBookingRequest, {});
|
|
195
|
+
const { fromJSON: fromRes } = ambassador_1.serializer(_declineBookingResponse, {
|
|
196
|
+
_address,
|
|
197
|
+
_addressLocation,
|
|
198
|
+
_booking,
|
|
199
|
+
_contactDetails,
|
|
200
|
+
});
|
|
201
|
+
function __bookingsDeclineBooking({ host }) {
|
|
202
|
+
const serializedData = toReq(payload);
|
|
203
|
+
const metadata = {
|
|
204
|
+
method: 'POST',
|
|
205
|
+
url: resolveComWixpressBookingsBookingsV2BookingsUrl({
|
|
206
|
+
protoPath: '/v2/bookings/{bookingId}/decline',
|
|
207
|
+
data: serializedData,
|
|
208
|
+
host,
|
|
209
|
+
}),
|
|
210
|
+
data: serializedData,
|
|
211
|
+
transformResponse: fromRes,
|
|
212
|
+
};
|
|
213
|
+
return metadata;
|
|
214
|
+
}
|
|
215
|
+
__bookingsDeclineBooking.fromReq = fromReq;
|
|
216
|
+
return __bookingsDeclineBooking;
|
|
217
|
+
}
|
|
218
|
+
exports.bookingsDeclineBooking = bookingsDeclineBooking;
|
|
219
|
+
/**
|
|
220
|
+
* Cancels a booking.
|
|
221
|
+
*
|
|
222
|
+
*
|
|
223
|
+
* The booking status changes to `CANCELED`.
|
|
224
|
+
*
|
|
225
|
+
* If the booking was for an appointment, the corresponding session is
|
|
226
|
+
* deleted from the business calendar.
|
|
227
|
+
*
|
|
228
|
+
* If the booking was for a class or course, the participants are removed
|
|
229
|
+
* from the class session or the course. But the course or class session
|
|
230
|
+
* remains on the business calendar.
|
|
231
|
+
*
|
|
232
|
+
* You can pass a `participantNotification.message` to notify the customer of
|
|
233
|
+
* the cancelation. You also need to pass `participantNotification.notifyParticipants`
|
|
234
|
+
* as `true` to actually send the message.
|
|
235
|
+
*
|
|
236
|
+
* In case you want to cancel a booking on behalf of a customer, we recommend
|
|
237
|
+
* to pass `flowControlSettings.ignoreCancellationPolicy` as `false`. This
|
|
238
|
+
* ensures that the cancelation is validated against the service's cancelation
|
|
239
|
+
* policy.
|
|
240
|
+
*/
|
|
241
|
+
function bookingsCancelBooking(payload) {
|
|
242
|
+
const { toJSON: toReq, fromJSON: fromReq } = ambassador_1.serializer(_cancelBookingRequest, {});
|
|
243
|
+
const { fromJSON: fromRes } = ambassador_1.serializer(_cancelBookingResponse, {
|
|
244
|
+
_address,
|
|
245
|
+
_addressLocation,
|
|
246
|
+
_booking,
|
|
247
|
+
_contactDetails,
|
|
248
|
+
});
|
|
249
|
+
function __bookingsCancelBooking({ host }) {
|
|
250
|
+
const serializedData = toReq(payload);
|
|
251
|
+
const metadata = {
|
|
252
|
+
method: 'POST',
|
|
253
|
+
url: resolveComWixpressBookingsBookingsV2BookingsUrl({
|
|
254
|
+
protoPath: '/v2/bookings/{bookingId}/cancel',
|
|
255
|
+
data: serializedData,
|
|
256
|
+
host,
|
|
257
|
+
}),
|
|
258
|
+
data: serializedData,
|
|
259
|
+
transformResponse: fromRes,
|
|
260
|
+
};
|
|
261
|
+
return metadata;
|
|
262
|
+
}
|
|
263
|
+
__bookingsCancelBooking.fromReq = fromReq;
|
|
264
|
+
return __bookingsCancelBooking;
|
|
265
|
+
}
|
|
266
|
+
exports.bookingsCancelBooking = bookingsCancelBooking;
|
|
267
|
+
/**
|
|
268
|
+
* Updates the number of participants for a booking.
|
|
269
|
+
*
|
|
270
|
+
*
|
|
271
|
+
* You can only update the number of participants for class and course
|
|
272
|
+
* bookings, you can't update it for appointment bookings.
|
|
273
|
+
*
|
|
274
|
+
* Calling this method also changes the
|
|
275
|
+
* [session's](https://www.wix.com/velo/reference/wix-bookings-backend/sessions/getsession)
|
|
276
|
+
* `totalNumberOfParticipants`.
|
|
277
|
+
*
|
|
278
|
+
* When updating the number of participants for a booking you must pass either
|
|
279
|
+
* `participantsChoices` or `totalParticipants`. If you pass `participantsChoices`
|
|
280
|
+
* for services that have variants,
|
|
281
|
+
* all of the provided choices must exist for the service. Otherwise, the
|
|
282
|
+
* call returns an `INVALID_SERVICE_CHOICES` error.
|
|
283
|
+
*/
|
|
284
|
+
function bookingsUpdateNumberOfParticipants(payload) {
|
|
285
|
+
const { toJSON: toReq, fromJSON: fromReq } = ambassador_1.serializer(_updateNumberOfParticipantsRequest, {});
|
|
286
|
+
const { fromJSON: fromRes } = ambassador_1.serializer(_updateNumberOfParticipantsResponse, { _address, _addressLocation, _booking, _contactDetails });
|
|
287
|
+
function __bookingsUpdateNumberOfParticipants({ host }) {
|
|
288
|
+
const serializedData = toReq(payload);
|
|
289
|
+
const metadata = {
|
|
290
|
+
method: 'POST',
|
|
291
|
+
url: resolveComWixpressBookingsBookingsV2BookingsUrl({
|
|
292
|
+
protoPath: '/v2/bookings/{bookingId}/update_number_of_participants',
|
|
293
|
+
data: serializedData,
|
|
294
|
+
host,
|
|
295
|
+
}),
|
|
296
|
+
data: serializedData,
|
|
297
|
+
transformResponse: fromRes,
|
|
298
|
+
};
|
|
299
|
+
return metadata;
|
|
300
|
+
}
|
|
301
|
+
__bookingsUpdateNumberOfParticipants.fromReq = fromReq;
|
|
302
|
+
return __bookingsUpdateNumberOfParticipants;
|
|
303
|
+
}
|
|
304
|
+
exports.bookingsUpdateNumberOfParticipants = bookingsUpdateNumberOfParticipants;
|
|
305
|
+
//# sourceMappingURL=bookings-v2-booking.http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookings-v2-booking.http.js","sourceRoot":"","sources":["../../../src/bookings-v2-booking.http.ts"],"names":[],"mappings":";;;AAAA,8DAA2D;AAC3D,sDAAgD;AAgBhD,MAAM,QAAQ,GAAG,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AACjD,MAAM,gBAAgB,GAAG;IACvB,QAAQ,EAAE,6BAA6B;IACvC,SAAS,EAAE,6BAA6B;CACzC,CAAC;AACF,MAAM,QAAQ,GAAG;IACf,WAAW,EAAE,2BAA2B;IACxC,SAAS,EAAE,2BAA2B;IACtC,OAAO,EAAE,2BAA2B;IACpC,WAAW,EAAE,2BAA2B;IACxC,cAAc,EAAE,iBAAiB;CAClC,CAAC;AACF,MAAM,qBAAqB,GAAG,EAAE,CAAC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