mts-booking-library 1.3.5 → 1.3.7

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.
@@ -22,16 +22,16 @@ export declare abstract class Booking {
22
22
  cartId: number | undefined;
23
23
  bookingDueDate: Date | undefined;
24
24
  /**
25
- * This is the constructor of the Booking class.
26
- * @param {string} env The environment in which the app is running. Can be "DEV", "STAGING" or "PROD"
27
- * @param {string} sub_key The subscription key for using the APIs
28
- * @param {Booking.BookingTypes} bookingType The type of booking. Can be "MLP", "SERVICE" or "MLP_SUBSCRIPTION"
29
- * @param {boolean} [debug=false] If true, the app will run in debug mode (meaning that will print requests and responses in the console)
30
- * @param {string} [language=Booking.Languages.EN] The language in which the app is running. Can be "it", "en", "fr", "de" or "es"
31
- * @param {string} [access_token=undefined] The access token for calling MTS APIs
32
- * @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
33
- * @param {number} [resellerId=undefined] The id of the reseller.
34
- */
25
+ * This is the constructor of the Booking class.
26
+ * @param {string} env The environment in which the app is running. Can be "DEV", "STAGING" or "PROD"
27
+ * @param {string} sub_key The subscription key for using the APIs
28
+ * @param {Booking.BookingTypes} bookingType The type of booking. Can be "MLP", "SERVICE" or "MLP_SUBSCRIPTION"
29
+ * @param {boolean} [debug=false] If true, the app will run in debug mode (meaning that will print requests and responses in the console)
30
+ * @param {string} [language=Booking.Languages.EN] The language in which the app is running. Can be "it", "en", "fr", "de" or "es"
31
+ * @param {string} [access_token=undefined] The access token for calling MTS APIs
32
+ * @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
33
+ * @param {number} [resellerId=undefined] The id of the reseller.
34
+ */
35
35
  constructor(env: MTSEnvs, sub_key: string, bookingType: Booking.BookingTypes, debug?: boolean, language?: string, access_token?: string, sellerId?: number, resellerId?: number);
36
36
  /**
37
37
  * This method allows to update the sellerId. It is mostly important for Linkavel, as we start with sellerId = 0
@@ -55,16 +55,16 @@ var apiCall_1 = require("../utils/apiCall");
55
55
  var processBookingSteps_1 = require("../utils/processBookingSteps");
56
56
  var Booking = /** @class */ (function () {
57
57
  /**
58
- * This is the constructor of the Booking class.
59
- * @param {string} env The environment in which the app is running. Can be "DEV", "STAGING" or "PROD"
60
- * @param {string} sub_key The subscription key for using the APIs
61
- * @param {Booking.BookingTypes} bookingType The type of booking. Can be "MLP", "SERVICE" or "MLP_SUBSCRIPTION"
62
- * @param {boolean} [debug=false] If true, the app will run in debug mode (meaning that will print requests and responses in the console)
63
- * @param {string} [language=Booking.Languages.EN] The language in which the app is running. Can be "it", "en", "fr", "de" or "es"
64
- * @param {string} [access_token=undefined] The access token for calling MTS APIs
65
- * @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
66
- * @param {number} [resellerId=undefined] The id of the reseller.
67
- */
58
+ * This is the constructor of the Booking class.
59
+ * @param {string} env The environment in which the app is running. Can be "DEV", "STAGING" or "PROD"
60
+ * @param {string} sub_key The subscription key for using the APIs
61
+ * @param {Booking.BookingTypes} bookingType The type of booking. Can be "MLP", "SERVICE" or "MLP_SUBSCRIPTION"
62
+ * @param {boolean} [debug=false] If true, the app will run in debug mode (meaning that will print requests and responses in the console)
63
+ * @param {string} [language=Booking.Languages.EN] The language in which the app is running. Can be "it", "en", "fr", "de" or "es"
64
+ * @param {string} [access_token=undefined] The access token for calling MTS APIs
65
+ * @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
66
+ * @param {number} [resellerId=undefined] The id of the reseller.
67
+ */
68
68
  function Booking(env, sub_key, bookingType, debug, language, access_token, sellerId, resellerId) {
69
69
  if (debug === void 0) { debug = false; }
70
70
  if (language === void 0) { language = Booking.Languages.EN; }
@@ -207,7 +207,11 @@ var Booking = /** @class */ (function () {
207
207
  if (!issueStep)
208
208
  throw Error("Booking step: ".concat(Booking.BookingSteps.ISSUE, " not found!"));
209
209
  if (!!issueStep[0]) return [3 /*break*/, 5];
210
- _i = 0, _a = [Booking.BookingSteps.SEATS_SELECTION, Booking.BookingSteps.EXTRAS, Booking.BookingSteps.DISCOUNTS];
210
+ _i = 0, _a = [
211
+ Booking.BookingSteps.SEATS_SELECTION,
212
+ Booking.BookingSteps.EXTRAS,
213
+ Booking.BookingSteps.DISCOUNTS
214
+ ];
211
215
  _c.label = 1;
212
216
  case 1:
213
217
  if (!(_i < _a.length)) return [3 /*break*/, 4];
@@ -231,7 +235,9 @@ var Booking = /** @class */ (function () {
231
235
  url = "".concat(this.config.API_ENDPOINT, "/v3_resources/sellers/").concat(this.sellerId, "/gateways?");
232
236
  // We use directly makeGet because we don't want to add sellerId to the query string (it is already present in the url)
233
237
  return [2 /*return*/, (0, apiCall_1.makeGet)(url).then(function (response) {
234
- return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response;
238
+ return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
239
+ ? response
240
+ : response;
235
241
  })];
236
242
  }
237
243
  });
@@ -259,7 +265,9 @@ var Booking = /** @class */ (function () {
259
265
  searchParams = new URLSearchParams(__assign({ gatewayId: gatewayId.toString() }, (returnUrl && { returnUrl: returnUrl })));
260
266
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/").concat(this.cartId, "/payment?").concat(searchParams);
261
267
  return [2 /*return*/, this.callGetApi(url).then(function (response) {
262
- return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response;
268
+ return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
269
+ ? response
270
+ : response;
263
271
  })];
264
272
  });
265
273
  });
@@ -301,7 +309,11 @@ var Booking = /** @class */ (function () {
301
309
  if (!issueStep)
302
310
  throw Error("Booking step not found!");
303
311
  if (!!issueStep[0]) return [3 /*break*/, 7];
304
- _i = 0, _a = [Booking.BookingSteps.SEATS_SELECTION, Booking.BookingSteps.EXTRAS, Booking.BookingSteps.DISCOUNTS];
312
+ _i = 0, _a = [
313
+ Booking.BookingSteps.SEATS_SELECTION,
314
+ Booking.BookingSteps.EXTRAS,
315
+ Booking.BookingSteps.DISCOUNTS
316
+ ];
305
317
  _c.label = 3;
306
318
  case 3:
307
319
  if (!(_i < _a.length)) return [3 /*break*/, 6];
@@ -325,10 +337,12 @@ var Booking = /** @class */ (function () {
325
337
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/").concat(this.cartId, "/issue");
326
338
  body = {
327
339
  cartId: this.cartId,
328
- paymentMethod: paymentMethodToSet === Payment_1.PaymentMethods.PAY_LATER ? null : paymentMethodToSet,
340
+ paymentMethod: paymentMethodToSet === Payment_1.PaymentMethods.PAY_LATER ? null : paymentMethodToSet
329
341
  };
330
342
  return [2 /*return*/, this.callPostApi(url, body).then(function (response) {
331
- return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response;
343
+ return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
344
+ ? response
345
+ : response;
332
346
  })];
333
347
  }
334
348
  });
@@ -10,15 +10,15 @@ import { Booking } from "./booking";
10
10
  export declare class JourneyBooking extends Booking {
11
11
  private cart?;
12
12
  /**
13
- * This is the constructor of the ServiceBooking class.
14
- * @param {MTSEnvs} env The environment in which the app is running. Can be "DEV", "STAGING" or "PROD"
15
- * @param {string} sub_key The subscription key for using the APIs
16
- * @param {boolean} [debug=false] If true, the app will run in debug mode (meaning that will print requests and responses in the console)
17
- * @param {string} [language=Booking.Languages.EN] The language in which the app is running. Can be "it", "en", "fr", "de" or "es"
18
- * @param {string} [access_token=undefined] The access token for calling MTS APIs
19
- * @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
20
- * @param {number} [resellerId=undefined] The id of the reseller.
21
- */
13
+ * This is the constructor of the ServiceBooking class.
14
+ * @param {MTSEnvs} env The environment in which the app is running. Can be "DEV", "STAGING" or "PROD"
15
+ * @param {string} sub_key The subscription key for using the APIs
16
+ * @param {boolean} [debug=false] If true, the app will run in debug mode (meaning that will print requests and responses in the console)
17
+ * @param {string} [language=Booking.Languages.EN] The language in which the app is running. Can be "it", "en", "fr", "de" or "es"
18
+ * @param {string} [access_token=undefined] The access token for calling MTS APIs
19
+ * @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
20
+ * @param {number} [resellerId=undefined] The id of the reseller.
21
+ */
22
22
  constructor(env: MTSEnvs, sub_key: string, debug?: boolean, language?: string, access_token?: string, sellerId?: number, resellerId?: number);
23
23
  getCart(): JourneyCart | undefined;
24
24
  getStorage(): import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<{
@@ -77,23 +77,23 @@ export declare class JourneyBooking extends Booking {
77
77
  */
78
78
  deleteCart(): Promise<ErrorResponse | any>;
79
79
  /**
80
- * This method returns the possible departures for all journeys (MLP) sold by this seller.
81
- * @returns {string[]} The list of possible departures
82
- */
80
+ * This method returns the possible departures for all journeys (MLP) sold by this seller.
81
+ * @returns {string[]} The list of possible departures
82
+ */
83
83
  getJourneysDepartures(): Promise<ErrorResponse | string[]>;
84
84
  /**
85
- * This method returns the possible destination for the journeys sold by this seller that start at the selected departure.
86
- * @param {string} departureStopName The departure stop name (as returned by {@link getJourneysDepartures})
87
- * @returns {string[]} The list of possible destinations
88
- */
85
+ * This method returns the possible destination for the journeys sold by this seller that start at the selected departure.
86
+ * @param {string} departureStopName The departure stop name (as returned by {@link getJourneysDepartures})
87
+ * @returns {string[]} The list of possible destinations
88
+ */
89
89
  getJourneysDestinations(departureStopName: string): Promise<ErrorResponse | string[]>;
90
90
  /**
91
- * This method returns the journeys that match the given parameters.
92
- * Note that it will always return the journeys for the one-way trip.
93
- * If you want to get the journeys for the round trip, you have to call this method twice (make sure to swap departureStopName and destinationStopName)
94
- * @param {JourneySearch} request an object of type {@link JourneySearch} containing the parameters of the search
95
- * @returns {JourneySearchResult[]} The returned journeys that match the given parameters
96
- */
91
+ * This method returns the journeys that match the given parameters.
92
+ * Note that it will always return the journeys for the one-way trip.
93
+ * If you want to get the journeys for the round trip, you have to call this method twice (make sure to swap departureStopName and destinationStopName)
94
+ * @param {JourneySearch} request an object of type {@link JourneySearch} containing the parameters of the search
95
+ * @returns {JourneySearchResult[]} The returned journeys that match the given parameters
96
+ */
97
97
  getJourneys(request: JourneySearchRequest): Promise<ErrorResponse | JourneySearchResult[]>;
98
98
  createJourneyCart(journeyCart: CreateJourneyCartRequest): Promise<ErrorResponse | JourneyCart>;
99
99
  /**
@@ -81,15 +81,15 @@ var booking_1 = require("./booking");
81
81
  var JourneyBooking = /** @class */ (function (_super) {
82
82
  __extends(JourneyBooking, _super);
83
83
  /**
84
- * This is the constructor of the ServiceBooking class.
85
- * @param {MTSEnvs} env The environment in which the app is running. Can be "DEV", "STAGING" or "PROD"
86
- * @param {string} sub_key The subscription key for using the APIs
87
- * @param {boolean} [debug=false] If true, the app will run in debug mode (meaning that will print requests and responses in the console)
88
- * @param {string} [language=Booking.Languages.EN] The language in which the app is running. Can be "it", "en", "fr", "de" or "es"
89
- * @param {string} [access_token=undefined] The access token for calling MTS APIs
90
- * @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
91
- * @param {number} [resellerId=undefined] The id of the reseller.
92
- */
84
+ * This is the constructor of the ServiceBooking class.
85
+ * @param {MTSEnvs} env The environment in which the app is running. Can be "DEV", "STAGING" or "PROD"
86
+ * @param {string} sub_key The subscription key for using the APIs
87
+ * @param {boolean} [debug=false] If true, the app will run in debug mode (meaning that will print requests and responses in the console)
88
+ * @param {string} [language=Booking.Languages.EN] The language in which the app is running. Can be "it", "en", "fr", "de" or "es"
89
+ * @param {string} [access_token=undefined] The access token for calling MTS APIs
90
+ * @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
91
+ * @param {number} [resellerId=undefined] The id of the reseller.
92
+ */
93
93
  function JourneyBooking(env, sub_key, debug, language, access_token, sellerId, resellerId) {
94
94
  if (debug === void 0) { debug = false; }
95
95
  if (language === void 0) { language = booking_1.Booking.Languages.EN; }
@@ -166,7 +166,7 @@ var JourneyBooking = /** @class */ (function (_super) {
166
166
  return [2 /*return*/, this.callGetApi(url).then(function (response) {
167
167
  if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response)) {
168
168
  _this.resetBooking();
169
- throw new Error(response);
169
+ throw new Error(JSON.stringify(response, null, 2));
170
170
  }
171
171
  // Check that the cart does not have issued tickets
172
172
  if (response.cart.hasIssuedTickets) {
@@ -201,25 +201,27 @@ var JourneyBooking = /** @class */ (function (_super) {
201
201
  });
202
202
  };
203
203
  /**
204
- * This method returns the possible departures for all journeys (MLP) sold by this seller.
205
- * @returns {string[]} The list of possible departures
206
- */
204
+ * This method returns the possible departures for all journeys (MLP) sold by this seller.
205
+ * @returns {string[]} The list of possible departures
206
+ */
207
207
  JourneyBooking.prototype.getJourneysDepartures = function () {
208
208
  return __awaiter(this, void 0, void 0, function () {
209
209
  var url;
210
210
  return __generator(this, function (_a) {
211
211
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/journeys/departures?");
212
212
  return [2 /*return*/, this.callGetApi(url).then(function (response) {
213
- return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response.stops;
213
+ return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
214
+ ? response
215
+ : response.stops;
214
216
  })];
215
217
  });
216
218
  });
217
219
  };
218
220
  /**
219
- * This method returns the possible destination for the journeys sold by this seller that start at the selected departure.
220
- * @param {string} departureStopName The departure stop name (as returned by {@link getJourneysDepartures})
221
- * @returns {string[]} The list of possible destinations
222
- */
221
+ * This method returns the possible destination for the journeys sold by this seller that start at the selected departure.
222
+ * @param {string} departureStopName The departure stop name (as returned by {@link getJourneysDepartures})
223
+ * @returns {string[]} The list of possible destinations
224
+ */
223
225
  JourneyBooking.prototype.getJourneysDestinations = function (departureStopName) {
224
226
  return __awaiter(this, void 0, void 0, function () {
225
227
  var searchParams, url;
@@ -227,18 +229,20 @@ var JourneyBooking = /** @class */ (function (_super) {
227
229
  searchParams = new URLSearchParams({ departureStopName: departureStopName });
228
230
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/journeys/destinations?").concat(searchParams);
229
231
  return [2 /*return*/, this.callGetApi(url).then(function (response) {
230
- return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response.stops;
232
+ return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
233
+ ? response
234
+ : response.stops;
231
235
  })];
232
236
  });
233
237
  });
234
238
  };
235
239
  /**
236
- * This method returns the journeys that match the given parameters.
237
- * Note that it will always return the journeys for the one-way trip.
238
- * If you want to get the journeys for the round trip, you have to call this method twice (make sure to swap departureStopName and destinationStopName)
239
- * @param {JourneySearch} request an object of type {@link JourneySearch} containing the parameters of the search
240
- * @returns {JourneySearchResult[]} The returned journeys that match the given parameters
241
- */
240
+ * This method returns the journeys that match the given parameters.
241
+ * Note that it will always return the journeys for the one-way trip.
242
+ * If you want to get the journeys for the round trip, you have to call this method twice (make sure to swap departureStopName and destinationStopName)
243
+ * @param {JourneySearch} request an object of type {@link JourneySearch} containing the parameters of the search
244
+ * @returns {JourneySearchResult[]} The returned journeys that match the given parameters
245
+ */
242
246
  JourneyBooking.prototype.getJourneys = function (request) {
243
247
  return __awaiter(this, void 0, void 0, function () {
244
248
  var searchParams, url;
@@ -249,7 +253,9 @@ var JourneyBooking = /** @class */ (function (_super) {
249
253
  searchParams = new URLSearchParams(__assign({ departureStopName: request.departureStopName, destinationStopName: request.destinationStopName, passengersNumber: request.passengersNumber.toString(), date: request.date, roundTripDate: request.roundTripDate ? request.roundTripDate : "null", currency: request.currency }, (this.cartId && { cartId: this.cartId.toString() })));
250
254
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/journeys?").concat(searchParams);
251
255
  return [2 /*return*/, this.callGetApi(url).then(function (response) {
252
- return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response.journeys;
256
+ return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
257
+ ? response
258
+ : response.journeys;
253
259
  })];
254
260
  });
255
261
  });
@@ -319,18 +325,20 @@ var JourneyBooking = /** @class */ (function (_super) {
319
325
  ];
320
326
  }));
321
327
  // Parse the return tariffs
322
- passenger.returnTariffs = passenger.returnTariffs ? new Map(Object.entries(passenger.returnTariffs).map(function (_a) {
323
- var tripId = _a[0], tariffs = _a[1];
324
- return [
325
- +tripId,
326
- tariffs
327
- ];
328
- })) : null;
328
+ passenger.returnTariffs = passenger.returnTariffs
329
+ ? new Map(Object.entries(passenger.returnTariffs).map(function (_a) {
330
+ var tripId = _a[0], tariffs = _a[1];
331
+ return [
332
+ +tripId,
333
+ tariffs
334
+ ];
335
+ }))
336
+ : null;
329
337
  });
330
338
  return {
331
339
  buyerDataStatus: response.buyerDataStatus,
332
340
  buyer: response.buyer,
333
- passengers: passengers,
341
+ passengers: passengers
334
342
  };
335
343
  })];
336
344
  });
@@ -435,7 +443,9 @@ var JourneyBooking = /** @class */ (function (_super) {
435
443
  });
436
444
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/journeys/trips/").concat(tripId, "/seats?").concat(searchParams);
437
445
  return [2 /*return*/, this.callGetApi(url).then(function (response) {
438
- return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response.busMatrix;
446
+ return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
447
+ ? response
448
+ : response.busMatrix;
439
449
  })];
440
450
  });
441
451
  });
@@ -460,7 +470,9 @@ var JourneyBooking = /** @class */ (function (_super) {
460
470
  searchParams = new URLSearchParams({ tripId: tripId.toString() });
461
471
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/").concat(this.cart.id, "/seats?").concat(searchParams);
462
472
  return [2 /*return*/, this.callGetApi(url).then(function (response) {
463
- return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response.assignedSeats;
473
+ return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
474
+ ? response
475
+ : response.assignedSeats;
464
476
  })];
465
477
  });
466
478
  });
@@ -513,7 +525,9 @@ var JourneyBooking = /** @class */ (function (_super) {
513
525
  }
514
526
  url = "".concat(this.config.API_ENDPOINT, "/v3_booking/carts/").concat(this.cart.id, "/payment/reduction/trips?");
515
527
  return [2 /*return*/, this.callGetApi(url).then(function (response) {
516
- return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response) ? response : response.trips;
528
+ return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
529
+ ? response
530
+ : response.trips;
517
531
  })];
518
532
  });
519
533
  });
@@ -607,9 +621,11 @@ var JourneyBooking = /** @class */ (function (_super) {
607
621
  // Update the booking process status
608
622
  _this.bookingStepsToStatus = (0, processBookingSteps_1.processBookingSteps)(reductionResponse.stepsToStatus);
609
623
  // Update the cart
610
- _this.cart = __assign(__assign({}, _this.cart), { totalAmountToPay: reductionResponse.totalAmountToPay, reductions: (_c = (_b = (_a = _this.cart) === null || _a === void 0 ? void 0 : _a.reductions) === null || _b === void 0 ? void 0 : _b.filter(function (reduction) { return reduction.type === Reduction_1.ReductionType.WALLET ||
611
- reduction.type === Reduction_1.ReductionType.VOUCHER ||
612
- (reduction.type === Reduction_1.ReductionType.CASH && reduction.tripId !== tripId); })) !== null && _c !== void 0 ? _c : [] });
624
+ _this.cart = __assign(__assign({}, _this.cart), { totalAmountToPay: reductionResponse.totalAmountToPay, reductions: (_c = (_b = (_a = _this.cart) === null || _a === void 0 ? void 0 : _a.reductions) === null || _b === void 0 ? void 0 : _b.filter(function (reduction) {
625
+ return reduction.type === Reduction_1.ReductionType.WALLET ||
626
+ reduction.type === Reduction_1.ReductionType.VOUCHER ||
627
+ (reduction.type === Reduction_1.ReductionType.CASH && reduction.tripId !== tripId);
628
+ })) !== null && _c !== void 0 ? _c : [] });
613
629
  return true;
614
630
  })];
615
631
  });
@@ -637,7 +653,11 @@ var JourneyBooking = /** @class */ (function (_super) {
637
653
  if (!issueStep)
638
654
  throw Error("Booking step: ".concat(booking_1.Booking.BookingSteps.ISSUE, " not found!"));
639
655
  if (!!issueStep[0]) return [3 /*break*/, 5];
640
- _i = 0, _a = [booking_1.Booking.BookingSteps.SEATS_SELECTION, booking_1.Booking.BookingSteps.EXTRAS, booking_1.Booking.BookingSteps.DISCOUNTS];
656
+ _i = 0, _a = [
657
+ booking_1.Booking.BookingSteps.SEATS_SELECTION,
658
+ booking_1.Booking.BookingSteps.EXTRAS,
659
+ booking_1.Booking.BookingSteps.DISCOUNTS
660
+ ];
641
661
  _c.label = 1;
642
662
  case 1:
643
663
  if (!(_i < _a.length)) return [3 /*break*/, 4];
@@ -8,15 +8,15 @@ import { Booking } from "./booking";
8
8
  export declare class ServiceBooking extends Booking {
9
9
  private cart?;
10
10
  /**
11
- * This is the constructor of the ServiceBooking class.
12
- * @param {MTSEnvs} env The environment in which the app is running. Can be "DEV", "STAGING" or "PROD"
13
- * @param {string} sub_key The subscription key for using the APIs
14
- * @param {boolean} [debug=false] If true, the app will run in debug mode (meaning that will print requests and responses in the console)
15
- * @param {string} [language=Booking.Languages.EN] The language in which the app is running. Can be "it", "en", "fr", "de" or "es"
16
- * @param {string} [access_token=undefined] The access token for calling MTS APIs
17
- * @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
18
- * @param {number} [resellerId=undefined] The id of the reseller.
19
- */
11
+ * This is the constructor of the ServiceBooking class.
12
+ * @param {MTSEnvs} env The environment in which the app is running. Can be "DEV", "STAGING" or "PROD"
13
+ * @param {string} sub_key The subscription key for using the APIs
14
+ * @param {boolean} [debug=false] If true, the app will run in debug mode (meaning that will print requests and responses in the console)
15
+ * @param {string} [language=Booking.Languages.EN] The language in which the app is running. Can be "it", "en", "fr", "de" or "es"
16
+ * @param {string} [access_token=undefined] The access token for calling MTS APIs
17
+ * @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
18
+ * @param {number} [resellerId=undefined] The id of the reseller.
19
+ */
20
20
  constructor(env: MTSEnvs, sub_key: string, debug?: boolean, language?: string, access_token?: string, sellerId?: number, resellerId?: number);
21
21
  getStorage(): import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<{
22
22
  cartId: number | undefined;
@@ -69,33 +69,33 @@ export declare class ServiceBooking extends Booking {
69
69
  fetchAndSetCart(cartId: number): Promise<void>;
70
70
  fetchCart(cartId: number): Promise<ServiceCart>;
71
71
  /**
72
- * This method allows to delete a cart, thus allowing the user to exit from the booking process.
73
- * @returns An {@link ErrorResponse} object in case of error, nothing otherwise. Note that also in case of error, all
74
- * data will be deleted.
75
- */
72
+ * This method allows to delete a cart, thus allowing the user to exit from the booking process.
73
+ * @returns An {@link ErrorResponse} object in case of error, nothing otherwise. Note that also in case of error, all
74
+ * data will be deleted.
75
+ */
76
76
  deleteCart(): Promise<ErrorResponse | any>;
77
77
  /**
78
- * This method returns the list of cities in which the seller offers tours.
79
- * If the sellerId is not set or it is 0, it will return the list of cities for all sellers.
80
- * @returns {string[]} The list of possible cities
81
- */
78
+ * This method returns the list of cities in which the seller offers tours.
79
+ * If the sellerId is not set or it is 0, it will return the list of cities for all sellers.
80
+ * @returns {string[]} The list of possible cities
81
+ */
82
82
  getServiceCities(): Promise<ErrorResponse | string[]>;
83
83
  /**
84
- * This method returns the tours sold by this seller in the given city.
85
- * If the sellerId is not set or it is 0, it will return the tours in the given city for all sellers.
86
- * @param {string} [cityName=undefined] The name of the selected city (as returned by {@link getTourCities})
87
- * @param {Booking.Currencies} currency The currency in which the prices should be returned
88
- * @returns {Tour[]} The returned tours
89
- */
84
+ * This method returns the tours sold by this seller in the given city.
85
+ * If the sellerId is not set or it is 0, it will return the tours in the given city for all sellers.
86
+ * @param {string} [cityName=undefined] The name of the selected city (as returned by {@link getTourCities})
87
+ * @param {Booking.Currencies} currency The currency in which the prices should be returned
88
+ * @returns {Tour[]} The returned tours
89
+ */
90
90
  getServices(currency: Booking.Currencies, cityName?: string): Promise<ErrorResponse | Service[]>;
91
91
  /**
92
- * This method returns the tours available for the given date. This method can be used if the seller wants the user to book a specific date
93
- * and/or a specific hour for the tour.
94
- * You should call this method only if {@link Service.isDateOptional} or {@link Service.isDateRequired} is true for the selected tour.
95
- * @param {number} serviceId The id of the selected tour (can be retrieved in the object {@link Service} returned by {@link getTours})
96
- * @param {string} date The date on which to get the tours, in ISO string format
97
- * @returns {ServiceTripsResponse} The returned information about the tour (tripId and hour)
98
- */
92
+ * This method returns the tours available for the given date. This method can be used if the seller wants the user to book a specific date
93
+ * and/or a specific hour for the tour.
94
+ * You should call this method only if {@link Service.isDateOptional} or {@link Service.isDateRequired} is true for the selected tour.
95
+ * @param {number} serviceId The id of the selected tour (can be retrieved in the object {@link Service} returned by {@link getTours})
96
+ * @param {string} date The date on which to get the tours, in ISO string format
97
+ * @returns {ServiceTripsResponse} The returned information about the tour (tripId and hour)
98
+ */
99
99
  getServiceTrips(serviceId: number, date: string): Promise<ErrorResponse | ServiceTripsResponse>;
100
100
  createServiceCart(serviceCart: CreateServiceCartRequest): Promise<ErrorResponse | ServiceCart>;
101
101
  /**