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