mts-booking-library 3.0.0 → 3.0.1
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/lib/booking/booking.d.ts +2 -1
- package/lib/booking/journeyBooking.js +7 -9
- package/lib/booking/serviceBooking.d.ts +2 -2
- package/lib/booking/serviceBooking.js +7 -8
- package/lib/booking/subscriptionBooking.js +5 -4
- package/lib/booking/tplBooking.js +4 -4
- package/lib/index.d.ts +2 -2
- package/lib/index.js +1 -3
- package/lib/types/common/Cart.d.ts +64 -54
- package/lib/types/common/Reduction.d.ts +14 -21
- package/lib/types/common/dates.d.ts +8 -0
- package/lib/types/common/dates.js +320 -0
- package/lib/types/journeys/JourneySearch.d.ts +4 -3
- package/lib/types/journeys/JourneySearch.js +8 -2
- package/lib/types/journeys/Stop.d.ts +5 -4
- package/lib/types/journeys/Trip.d.ts +65 -8
- package/lib/types/services/Service.d.ts +10 -4
- package/lib/types/services/ServiceCart.d.ts +4 -8
- package/lib/types/subscriptions/SubscriptionAvailabilities.d.ts +12 -12
- package/lib/types/subscriptions/SubscriptionCart.d.ts +4 -4
- package/lib/utils/utils.d.ts +0 -11
- package/lib/utils/utils.js +1 -49
- package/package.json +3 -3
package/lib/booking/booking.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { GetExtrasForBookingResponse, GetExtrasResponse } from "../types/common/
|
|
|
5
5
|
import { GetPaymentInformationFromGatewayResponse, GetSellerGatewaysResponse, PaymentMethods, IssueCartResponse } from "../types/common/Payment";
|
|
6
6
|
import { GetBuyerPassengersDetailsResponse, GetPersonRequest, Person } from "../types/common/Person";
|
|
7
7
|
import { AddReductionRequest } from "../types/common/Reduction";
|
|
8
|
+
import { DateWithTimeZone } from "../types/common/dates";
|
|
8
9
|
import { ApiCallOptions } from "../utils/apiCall";
|
|
9
10
|
export declare abstract class Booking {
|
|
10
11
|
private sellerId?;
|
|
@@ -23,7 +24,7 @@ export declare abstract class Booking {
|
|
|
23
24
|
*/
|
|
24
25
|
bookingStepsToStatus: processedStepsToStatus;
|
|
25
26
|
cartGuid: string | undefined;
|
|
26
|
-
|
|
27
|
+
bookingDueDateTime: DateWithTimeZone | undefined;
|
|
27
28
|
/**
|
|
28
29
|
* This is the constructor of the Booking class. See {@link Booking.BookingConfig} for more information.
|
|
29
30
|
*/
|
|
@@ -121,7 +121,7 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
|
121
121
|
this.cart = undefined;
|
|
122
122
|
this.cartGuid = undefined;
|
|
123
123
|
this.bookingStepsToStatus = new Map();
|
|
124
|
-
this.
|
|
124
|
+
this.bookingDueDateTime = undefined;
|
|
125
125
|
try {
|
|
126
126
|
this.getStorage().getState().updateCartGuid(undefined);
|
|
127
127
|
}
|
|
@@ -142,12 +142,12 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
|
142
142
|
cart = _a.sent();
|
|
143
143
|
if (!cart)
|
|
144
144
|
return [2 /*return*/];
|
|
145
|
-
if (cart.
|
|
146
|
-
|
|
145
|
+
if (cart.bookingDueDateTime &&
|
|
146
|
+
new Date(cart.bookingDueDateTime.dateTime) > new Date() &&
|
|
147
147
|
!cart.hasIssuedTickets) {
|
|
148
148
|
this.cart = cart;
|
|
149
149
|
this.cartGuid = cart.guid;
|
|
150
|
-
this.
|
|
150
|
+
this.bookingDueDateTime = cart.bookingDueDateTime; // See Booking class
|
|
151
151
|
// Update the sellerId. This is particularly important in Linkavel
|
|
152
152
|
this.updateSellerId(cart.sellerId);
|
|
153
153
|
// Fill the booking process status
|
|
@@ -254,14 +254,12 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
|
254
254
|
JourneyBooking.prototype.getJourneys = function (request, options) {
|
|
255
255
|
return __awaiter(this, void 0, void 0, function () {
|
|
256
256
|
var searchParams, url;
|
|
257
|
-
var _a, _b
|
|
258
|
-
return __generator(this, function (
|
|
257
|
+
var _a, _b;
|
|
258
|
+
return __generator(this, function (_c) {
|
|
259
259
|
if (request.departureStopName === undefined || request.destinationStopName === undefined) {
|
|
260
260
|
throw Error("Fields departureStopName and destinationStopName are required");
|
|
261
261
|
}
|
|
262
|
-
searchParams = new URLSearchParams(__assign(__assign({ departureStopName: request.departureStopName, destinationStopName: request.destinationStopName, passengersNumber: request.passengersNumber.toString(),
|
|
263
|
-
// TODO: delete once it will be removed from APIM
|
|
264
|
-
date: "null" }));
|
|
262
|
+
searchParams = new URLSearchParams(__assign(__assign(__assign({ departureStopName: request.departureStopName, destinationStopName: request.destinationStopName, passengersNumber: request.passengersNumber.toString(), outboundDate: request.outboundDate.dateTime }, (request.returnDate && { returnDate: request.returnDate.dateTime })), { currency: request.currency, outboundTripId: (_b = (_a = request.outboundTripId) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "null" }), (this.cartGuid && { cartGuid: this.cartGuid })));
|
|
265
263
|
url = "".concat(this.config.API_ENDPOINT, "/v3_booking/journeys_v4?").concat(searchParams);
|
|
266
264
|
return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
|
|
267
265
|
return (0, ErrorResponse_1.objectIsMTSErrorResponse)(response)
|
|
@@ -129,10 +129,10 @@ export declare class ServiceBooking extends Booking {
|
|
|
129
129
|
* and/or a specific hour for the tour.
|
|
130
130
|
* You should call this method only if {@link Service.isDateOptional} or {@link Service.isDateRequired} is true for the selected tour.
|
|
131
131
|
* @param serviceId The id of the selected tour (can be retrieved in the object {@link Service} returned by {@link getTours})
|
|
132
|
-
* @param
|
|
132
|
+
* @param dateString The date on which to get the tours, in ISO string format
|
|
133
133
|
* @returns {ServiceTripsResponse} The returned information about the tour (tripId and hour)
|
|
134
134
|
*/
|
|
135
|
-
getServiceTrips(serviceId: number,
|
|
135
|
+
getServiceTrips(serviceId: number, dateString: string, options?: ApiCallOptions): Promise<ErrorResponse | ServiceTripsResponse>;
|
|
136
136
|
/**
|
|
137
137
|
* This method creates a service cart for the given parameters.
|
|
138
138
|
* @returns The created cart
|
|
@@ -121,7 +121,7 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
|
121
121
|
this.cart = undefined;
|
|
122
122
|
this.cartGuid = undefined;
|
|
123
123
|
this.bookingStepsToStatus = new Map();
|
|
124
|
-
this.
|
|
124
|
+
this.bookingDueDateTime = undefined;
|
|
125
125
|
try {
|
|
126
126
|
this.getStorage().getState().updateCartGuid(undefined);
|
|
127
127
|
}
|
|
@@ -142,12 +142,12 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
|
142
142
|
cart = _a.sent();
|
|
143
143
|
if (!cart)
|
|
144
144
|
return [2 /*return*/];
|
|
145
|
-
if (cart.
|
|
146
|
-
|
|
145
|
+
if (cart.bookingDueDateTime &&
|
|
146
|
+
new Date(cart.bookingDueDateTime.dateTime) > new Date() &&
|
|
147
147
|
!cart.hasIssuedTickets) {
|
|
148
148
|
this.cart = cart;
|
|
149
149
|
this.cartGuid = cart.guid;
|
|
150
|
-
this.
|
|
150
|
+
this.bookingDueDateTime = cart.bookingDueDateTime; // See Booking class
|
|
151
151
|
// Update the sellerId. This is particularly important in Linkavel
|
|
152
152
|
this.updateSellerId(cart.sellerId);
|
|
153
153
|
// Fill the booking process status
|
|
@@ -252,17 +252,16 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
|
252
252
|
* and/or a specific hour for the tour.
|
|
253
253
|
* You should call this method only if {@link Service.isDateOptional} or {@link Service.isDateRequired} is true for the selected tour.
|
|
254
254
|
* @param serviceId The id of the selected tour (can be retrieved in the object {@link Service} returned by {@link getTours})
|
|
255
|
-
* @param
|
|
255
|
+
* @param dateString The date on which to get the tours, in ISO string format
|
|
256
256
|
* @returns {ServiceTripsResponse} The returned information about the tour (tripId and hour)
|
|
257
257
|
*/
|
|
258
|
-
ServiceBooking.prototype.getServiceTrips = function (serviceId,
|
|
258
|
+
ServiceBooking.prototype.getServiceTrips = function (serviceId, dateString, options) {
|
|
259
259
|
return __awaiter(this, void 0, void 0, function () {
|
|
260
260
|
var searchParams, url;
|
|
261
261
|
return __generator(this, function (_a) {
|
|
262
262
|
searchParams = new URLSearchParams({
|
|
263
263
|
serviceId: serviceId.toString(),
|
|
264
|
-
|
|
265
|
-
date: "null"
|
|
264
|
+
dateString: dateString
|
|
266
265
|
});
|
|
267
266
|
url = "".concat(this.config.API_ENDPOINT, "/v3_booking/services/trips?").concat(searchParams);
|
|
268
267
|
return [2 /*return*/, this.callGetApi(url, options).then(function (response) {
|
|
@@ -121,7 +121,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
|
|
|
121
121
|
this.cart = undefined;
|
|
122
122
|
this.cartGuid = undefined;
|
|
123
123
|
this.bookingStepsToStatus = new Map();
|
|
124
|
-
this.
|
|
124
|
+
this.bookingDueDateTime = undefined;
|
|
125
125
|
try {
|
|
126
126
|
this.getStorage().getState().updateCartGuid(undefined);
|
|
127
127
|
}
|
|
@@ -142,12 +142,12 @@ var SubscriptionBooking = /** @class */ (function (_super) {
|
|
|
142
142
|
cart = _a.sent();
|
|
143
143
|
if (!cart)
|
|
144
144
|
return [2 /*return*/];
|
|
145
|
-
if (cart.
|
|
146
|
-
|
|
145
|
+
if (cart.bookingDueDateTime &&
|
|
146
|
+
new Date(cart.bookingDueDateTime.dateTime) > new Date() &&
|
|
147
147
|
!cart.hasIssuedTickets) {
|
|
148
148
|
this.cart = cart;
|
|
149
149
|
this.cartGuid = cart.guid;
|
|
150
|
-
this.
|
|
150
|
+
this.bookingDueDateTime = cart.bookingDueDateTime; // See Booking class
|
|
151
151
|
// Update the sellerId. This is particularly important in Linkavel
|
|
152
152
|
this.updateSellerId(cart.sellerId);
|
|
153
153
|
// Fill the booking process status
|
|
@@ -323,6 +323,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
|
|
|
323
323
|
});
|
|
324
324
|
});
|
|
325
325
|
};
|
|
326
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
326
327
|
SubscriptionBooking.prototype.createCart = function (request) {
|
|
327
328
|
return __awaiter(this, void 0, void 0, function () {
|
|
328
329
|
return __generator(this, function (_a) {
|
|
@@ -121,7 +121,7 @@ var TplBooking = /** @class */ (function (_super) {
|
|
|
121
121
|
this.cart = undefined;
|
|
122
122
|
this.cartGuid = undefined;
|
|
123
123
|
this.bookingStepsToStatus = new Map();
|
|
124
|
-
this.
|
|
124
|
+
this.bookingDueDateTime = undefined;
|
|
125
125
|
try {
|
|
126
126
|
this.getStorage().getState().updateCartGuid(undefined);
|
|
127
127
|
}
|
|
@@ -142,12 +142,12 @@ var TplBooking = /** @class */ (function (_super) {
|
|
|
142
142
|
cart = _a.sent();
|
|
143
143
|
if (!cart)
|
|
144
144
|
return [2 /*return*/];
|
|
145
|
-
if (cart.
|
|
146
|
-
|
|
145
|
+
if (cart.bookingDueDateTime &&
|
|
146
|
+
new Date(cart.bookingDueDateTime.dateTime) > new Date() &&
|
|
147
147
|
!cart.hasIssuedTickets) {
|
|
148
148
|
this.cart = cart;
|
|
149
149
|
this.cartGuid = cart.guid;
|
|
150
|
-
this.
|
|
150
|
+
this.bookingDueDateTime = cart.bookingDueDateTime; // See Booking class
|
|
151
151
|
// Update the sellerId. This is particularly important in Linkavel
|
|
152
152
|
this.updateSellerId(cart.sellerId);
|
|
153
153
|
// Fill the booking process status
|
package/lib/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { ServiceBooking } from "./booking/serviceBooking";
|
|
|
4
4
|
export { SubscriptionBooking } from "./booking/subscriptionBooking";
|
|
5
5
|
export { TplBooking } from "./booking/tplBooking";
|
|
6
6
|
export { useMtsBookingState } from "./mtsStorage";
|
|
7
|
-
export {
|
|
7
|
+
export { isNullOrUndefined, isNullOrWhiteSpace } from "./utils/utils";
|
|
8
8
|
export { CreateUpdateCartRequest, CartBooking } from "./types/common/Cart";
|
|
9
9
|
export { Person, DEFAULT_PERSON, initializePerson } from "./types/common/Person";
|
|
10
10
|
export { GetBuyerPassengersDetailsResponse, GetPersonRequest, GetPassenger, EditPassengerRequestType, EditPassengersDetailsRequest } from "./types/common/Person";
|
|
@@ -21,7 +21,7 @@ export { JourneySearchRequest, JourneySearchResult, DEFAULT_JOURNEY_SEARCH } fro
|
|
|
21
21
|
export { Stop } from "./types/journeys/Stop";
|
|
22
22
|
export { Trip, CartTrip, ReductionTrip } from "./types/journeys/Trip";
|
|
23
23
|
export { Line } from "./types/services/Line";
|
|
24
|
-
export { Service,
|
|
24
|
+
export { Service, TripIdAndHour, ServiceTripsResponse, ServiceTrip } from "./types/services/Service";
|
|
25
25
|
export { ServiceCart, ServiceBookingType } from "./types/services/ServiceCart";
|
|
26
26
|
export { ServiceInfo } from "./types/services/ServiceInfo";
|
|
27
27
|
export { GetTariffsResponse } from "./types/tpl/GetTariffsResponse";
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_JOURNEY_SEARCH = exports.SeatStatus = exports.BusCellTypes = exports.objectIsMTSErrorResponse = exports.PaymentMethods = exports.GatewayTypes = exports.ReductionType = exports.initializePerson = exports.DEFAULT_PERSON = exports.isNullOrWhiteSpace = exports.isNullOrUndefined = exports.
|
|
3
|
+
exports.DEFAULT_JOURNEY_SEARCH = exports.SeatStatus = exports.BusCellTypes = exports.objectIsMTSErrorResponse = exports.PaymentMethods = exports.GatewayTypes = exports.ReductionType = exports.initializePerson = exports.DEFAULT_PERSON = exports.isNullOrWhiteSpace = exports.isNullOrUndefined = exports.useMtsBookingState = exports.TplBooking = exports.SubscriptionBooking = exports.ServiceBooking = exports.JourneyBooking = exports.Booking = void 0;
|
|
4
4
|
//#region Export Booking classes
|
|
5
5
|
var booking_1 = require("./booking/booking");
|
|
6
6
|
Object.defineProperty(exports, "Booking", { enumerable: true, get: function () { return booking_1.Booking; } });
|
|
@@ -19,8 +19,6 @@ Object.defineProperty(exports, "useMtsBookingState", { enumerable: true, get: fu
|
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region Export utils
|
|
21
21
|
var utils_1 = require("./utils/utils");
|
|
22
|
-
Object.defineProperty(exports, "getLongFromDate", { enumerable: true, get: function () { return utils_1.getLongFromDate; } });
|
|
23
|
-
Object.defineProperty(exports, "getDateFromLong", { enumerable: true, get: function () { return utils_1.getDateFromLong; } });
|
|
24
22
|
Object.defineProperty(exports, "isNullOrUndefined", { enumerable: true, get: function () { return utils_1.isNullOrUndefined; } });
|
|
25
23
|
Object.defineProperty(exports, "isNullOrWhiteSpace", { enumerable: true, get: function () { return utils_1.isNullOrWhiteSpace; } });
|
|
26
24
|
var Person_1 = require("./types/common/Person");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Booking } from "../../booking/booking";
|
|
2
2
|
import { Reduction } from "./Reduction";
|
|
3
|
-
import { Extra } from "./Extra";
|
|
4
3
|
import { PaymentMethods } from "./Payment";
|
|
4
|
+
import { DateWithTimeZone } from "./dates";
|
|
5
5
|
export declare enum SellingMethod {
|
|
6
6
|
LINKAVEL = "LINKAVEL",
|
|
7
7
|
BACKOFFICE = "BACKOFFICE",
|
|
@@ -26,8 +26,8 @@ export type CreateUpdateCartRequest = {
|
|
|
26
26
|
export type CartBooking = {
|
|
27
27
|
/** A record containing tariff ids as keys and their respective quantities as values. */
|
|
28
28
|
tariffIdToQuantity?: Record<number, number>;
|
|
29
|
-
/** The date of the booking in
|
|
30
|
-
|
|
29
|
+
/** The date of the booking in ISO string format (optional). */
|
|
30
|
+
dateTimeLocalString?: string;
|
|
31
31
|
/** The id of the trip, if necessary. For example, this is used by services that require a specific trip to be selected, or by MLP booking */
|
|
32
32
|
tripId?: number;
|
|
33
33
|
/** The id of the line, if necessary. For example, this is used by Services */
|
|
@@ -52,84 +52,94 @@ export type CartBooking = {
|
|
|
52
52
|
export type Cart = {
|
|
53
53
|
/** The guid of the cart */
|
|
54
54
|
guid: string;
|
|
55
|
-
/** The id of the seller of the tickets in the cart */
|
|
56
|
-
sellerId: number;
|
|
57
|
-
/** The url redirecting to the privacy policy of the seller */
|
|
58
|
-
sellerPrivacyUrl: string;
|
|
59
|
-
/** The url redirecting to the terms and conditions of the seller */
|
|
60
|
-
sellerTermsUrl: string;
|
|
61
|
-
/** The support email of the seller, if any */
|
|
62
|
-
sellerEmailLinkavel: string | null;
|
|
63
55
|
/** The id of the buyer that the cart is for. */
|
|
64
|
-
buyerId: number
|
|
65
|
-
/** If true, the tickets in the cart will be automatically printer after the payment */
|
|
66
|
-
autoPrintOption: boolean;
|
|
67
|
-
/** The ids of the tickets in the cart */
|
|
68
|
-
ticketIds: number[];
|
|
69
|
-
/** The PNRs of the tickets in the cart */
|
|
70
|
-
ticketsPNRs: string[];
|
|
71
|
-
/**
|
|
72
|
-
* A boolean telling whether the cart has issued tickets.
|
|
73
|
-
* Note that if this is the case, the cart will be null because it is not
|
|
74
|
-
* possible to add tickets to an issued cart. Thus, all data should be reset.
|
|
75
|
-
*/
|
|
76
|
-
hasIssuedTickets: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* This data structure describes the steps of the booking process.
|
|
79
|
-
* The keys of this dictionary represent the booking steps. See {@link Booking.BookingSteps}
|
|
80
|
-
* for the list of possible steps.
|
|
81
|
-
* If the key is present, then the booking step shall be displayed. The value
|
|
82
|
-
* is a list of 3 booleans:
|
|
83
|
-
* - The first tells whether it is possible to go to that section. If not, other
|
|
84
|
-
* sections must be completed first.
|
|
85
|
-
* - The second tells whether the section is completed.
|
|
86
|
-
* - The third tells whether the section is required.
|
|
87
|
-
*/
|
|
88
|
-
stepsToStatus: Record<Booking.BookingSteps, [boolean, boolean, boolean]>;
|
|
89
|
-
/** The date and time when the cart expires in YYYYMMDDHHMMSSMMM format */
|
|
90
|
-
bookingDueDateLong: number;
|
|
56
|
+
buyerId: number;
|
|
91
57
|
/**
|
|
92
58
|
* The number of seconds remaining before the cart expires. This should be equivalent
|
|
93
59
|
* `bookingDueDate`
|
|
94
60
|
*/
|
|
95
61
|
bookingDueDateRemainingSeconds: number;
|
|
96
|
-
/** The list of reductions applied to the cart */
|
|
97
|
-
reductions: Reduction[];
|
|
98
|
-
/** The list of extras services of the cart */
|
|
99
|
-
extras: Extra[];
|
|
100
|
-
/** The selling method of the cart (LinkAvel, Backoffice) */
|
|
101
|
-
sellingMethod: SellingMethod;
|
|
102
|
-
/** Whether the cart is not associated with a specific SSN. */
|
|
103
|
-
noSSN: boolean;
|
|
104
|
-
/** The currency of the cart. See {@link Booking.Currencies} */
|
|
105
|
-
currency: Booking.Currencies;
|
|
106
|
-
/**
|
|
107
|
-
* The total value of the cart, meaning the sum of the nominal prices of all tickets.
|
|
108
|
-
* It is expressed in the currency of the cart.
|
|
109
|
-
*/
|
|
110
|
-
totalValue: number;
|
|
111
62
|
/**
|
|
112
63
|
* The total reseller fee of the cart, meaning the sum of the reseller fees of
|
|
113
64
|
* all tickets. It is expressed in the currency of the cart.
|
|
114
65
|
*/
|
|
115
|
-
totalResellerFee
|
|
66
|
+
totalResellerFee: number;
|
|
116
67
|
/**
|
|
117
68
|
* The total credit from change of the cart. This is non zero only during the
|
|
118
69
|
* change process, and represents the credit that the user has from the previous
|
|
119
70
|
* cart. It is expressed in the currency of the cart.
|
|
120
71
|
*/
|
|
121
72
|
totalCreditFromChange: number;
|
|
73
|
+
/** The total amount to pay by buyer */
|
|
74
|
+
totalAmountToPayByBuyer: number;
|
|
122
75
|
/**
|
|
123
76
|
* The total amount to pay of the cart, meaning the amount that the user has to
|
|
124
77
|
* pay to complete the booking. This is what is displayed in the payment page.
|
|
125
78
|
* It is expressed in the currency of the cart.
|
|
126
79
|
*/
|
|
127
80
|
totalAmountToPay: number;
|
|
81
|
+
/** The total amount paid by buyer */
|
|
82
|
+
totalAmountPaidByBuyer: number;
|
|
83
|
+
/** The total services value */
|
|
84
|
+
totalServicesValue: number;
|
|
85
|
+
/** The total actual value */
|
|
86
|
+
totalActualValue: number;
|
|
87
|
+
/**
|
|
88
|
+
* The total value of the cart, meaning the sum of the nominal prices of all tickets.
|
|
89
|
+
* It is expressed in the currency of the cart.
|
|
90
|
+
*/
|
|
91
|
+
totalValue: number;
|
|
92
|
+
/** The currency of the cart. See {@link Booking.Currencies} */
|
|
93
|
+
currency: Booking.Currencies;
|
|
94
|
+
/** The selling method of the cart (LinkAvel, Backoffice) */
|
|
95
|
+
sellingMethod: SellingMethod;
|
|
96
|
+
/** The support email of the seller, if any */
|
|
97
|
+
sellerEmailLinkavel: string;
|
|
98
|
+
/** Whether the cart is not associated with a specific SSN. */
|
|
99
|
+
noSSN: boolean;
|
|
100
|
+
/** If true, the tickets in the cart will be automatically printer after the payment */
|
|
101
|
+
autoPrintOption: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* A boolean telling whether the cart has issued tickets.
|
|
104
|
+
* Note that if this is the case, the cart will be null because it is not
|
|
105
|
+
* possible to add tickets to an issued cart. Thus, all data should be reset.
|
|
106
|
+
*/
|
|
107
|
+
hasIssuedTickets: boolean;
|
|
108
|
+
/** The booking due date as ISO string */
|
|
109
|
+
bookingDueDateTime: DateWithTimeZone;
|
|
110
|
+
/** The ids of the tickets in the cart */
|
|
111
|
+
ticketIds: number[];
|
|
112
|
+
/** The PNRs of the tickets in the cart */
|
|
113
|
+
ticketsPNRs: string[];
|
|
114
|
+
/** The seller IDs */
|
|
115
|
+
sellerIds: number[];
|
|
116
|
+
/** The id of the seller of the tickets in the cart */
|
|
117
|
+
sellerId: number;
|
|
118
|
+
/** The url redirecting to the privacy policy of the seller */
|
|
119
|
+
sellerPrivacyUrl: string;
|
|
120
|
+
/** The url redirecting to the terms and conditions of the seller */
|
|
121
|
+
sellerTermsUrl: string;
|
|
122
|
+
/** The list of reductions applied to the cart */
|
|
123
|
+
reductions: Reduction[];
|
|
124
|
+
/**
|
|
125
|
+
* This data structure describes the steps of the booking process.
|
|
126
|
+
* The keys of this dictionary represent the booking steps. See {@link Booking.BookingSteps}
|
|
127
|
+
* for the list of possible steps.
|
|
128
|
+
* If the key is present, then the booking step shall be displayed. The value
|
|
129
|
+
* is a list of 3 booleans:
|
|
130
|
+
* - The first tells whether it is possible to go to that section. If not, other
|
|
131
|
+
* sections must be completed first.
|
|
132
|
+
* - The second tells whether the section is completed.
|
|
133
|
+
* - The third tells whether the section is required.
|
|
134
|
+
*/
|
|
135
|
+
stepsToStatus: Record<Booking.BookingSteps, [boolean, boolean, boolean]>;
|
|
128
136
|
/**
|
|
129
137
|
* A list of string representing the possible ways to cash in the ticket.
|
|
130
138
|
* The first element of the list is the default cash in method (and the preferred by the seller).
|
|
131
139
|
*/
|
|
132
140
|
cashInMethods: PaymentMethods[];
|
|
141
|
+
/** The cart ID */
|
|
142
|
+
id: number;
|
|
133
143
|
};
|
|
134
144
|
/** The type that {@link Cart.stepsToStatus} assumes once parsed to a map */
|
|
135
145
|
export type processedStepsToStatus = Map<Booking.BookingSteps, [boolean, boolean, boolean]>;
|
|
@@ -4,55 +4,48 @@ export declare enum ReductionType {
|
|
|
4
4
|
WALLET = "WALLET",
|
|
5
5
|
CASH = "CASH"
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* @description This type represents a reduction applied to the cart. Reductions are applied in the booking step `DISCOUNTS`.
|
|
9
|
-
*
|
|
10
|
-
* @property {ReductionType} type The type of the reduction
|
|
11
|
-
* @property {number} tripId The id of the trip to which the reduction is applied
|
|
12
|
-
* @property {string} tripName The name of the trip to which the reduction is applied
|
|
13
|
-
* @property {number} value The value of the reduction
|
|
14
|
-
* @property {boolean} isPercentage If true, the reduction is a percentage. In this case, it is a number from 0 to 1.
|
|
15
|
-
* Otherwise, it is in the currency of the cart.
|
|
16
|
-
* @property {string} [voucherCode=undefined] The voucher code used to apply the reduction
|
|
17
|
-
*/
|
|
18
7
|
export type Reduction = {
|
|
8
|
+
/**
|
|
9
|
+
* The type of the reduction
|
|
10
|
+
* @see ReductionType
|
|
11
|
+
*/
|
|
19
12
|
type: ReductionType;
|
|
13
|
+
/** The id of the trip to which the reduction is applied */
|
|
20
14
|
tripId: number;
|
|
15
|
+
/** The name of the trip to which the reduction is applied */
|
|
21
16
|
tripName: string;
|
|
17
|
+
/** The value of the reduction */
|
|
22
18
|
value: number;
|
|
19
|
+
/** If true, the reduction is a percentage (a number from 0 to 1). Otherwise, it is in the currency of the cart. */
|
|
23
20
|
isPercentage: boolean;
|
|
21
|
+
/** The voucher code used to apply the reduction */
|
|
24
22
|
voucherCode?: string;
|
|
25
23
|
};
|
|
26
24
|
/**
|
|
27
25
|
* @description This type represents a request to add a reduction to the cart
|
|
28
|
-
*
|
|
29
|
-
* @property {number} tripId The id of the trip to which the reduction is applied. If the tripId is 0,
|
|
30
|
-
* then the reduction will be applied to the whole cart
|
|
31
|
-
* @property {number} reduction The value of the reduction
|
|
32
|
-
* @property {boolean} isPercentage If true, the reduction is a percentage. In this case, it is a number from 0 to 1.
|
|
33
|
-
* Otherwise, it is in the currency of the cart (the value must be greater than 0)
|
|
34
26
|
*/
|
|
35
27
|
export type AddReductionRequest = {
|
|
28
|
+
/** The id of the trip to which the reduction is applied. If the tripId is 0, then the reduction will be applied to the whole cart */
|
|
36
29
|
tripId: number;
|
|
30
|
+
/** The value of the reduction */
|
|
37
31
|
reduction: number;
|
|
32
|
+
/** If true, the reduction is a percentage. In this case, it is a number from 0 to 1. Otherwise, it is in the currency of the cart (the value must be greater than 0) */
|
|
38
33
|
isPercentage: boolean;
|
|
39
34
|
};
|
|
40
35
|
/**
|
|
41
36
|
* @description This type represents a response to add a reduction to the cart. It is used in the APIs
|
|
42
37
|
* {@link Booking.addReduction}, {@link Booking.useVoucher} and {@link Booking.useWallet}
|
|
43
|
-
*
|
|
44
|
-
* @property {Reduction} reduction Information about the reduction applied
|
|
45
38
|
*/
|
|
46
39
|
export type ReductionResponse = BaseReductionResponse & {
|
|
40
|
+
/** Information about the reduction applied */
|
|
47
41
|
reduction: Reduction;
|
|
48
42
|
};
|
|
49
43
|
/**
|
|
50
44
|
* @description This type represents a base response to handle reduction in the cart. It is used in the APIs
|
|
51
45
|
* {@link Booking.addReduction}, {@link Booking.removeReduction} {@link Booking.useVoucher}, {@link Booking.useWallet}
|
|
52
46
|
* and {@link Booking.removeWalletReduction}
|
|
53
|
-
*
|
|
54
|
-
* @property {number} totalAmountToPay The total amount to pay after the reduction was applied
|
|
55
47
|
*/
|
|
56
48
|
export type BaseReductionResponse = BaseBookingProcessResponse & {
|
|
49
|
+
/** The total amount to pay after the reduction was applied */
|
|
57
50
|
totalAmountToPay: number;
|
|
58
51
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type DateWithTimeZone = {
|
|
2
|
+
/** The date in ISO string format */
|
|
3
|
+
dateTime: string;
|
|
4
|
+
/** The time zone of the date */
|
|
5
|
+
timeZone: IanaTimeZone | null;
|
|
6
|
+
};
|
|
7
|
+
export type IanaTimeZone = (typeof timeZones)[number];
|
|
8
|
+
export declare const timeZones: readonly ["Pacific/Midway", "Pacific/Pago_Pago", "Pacific/Niue", "Pacific/Rarotonga", "America/Adak", "Pacific/Honolulu", "Pacific/Tahiti", "Pacific/Marquesas", "America/Anchorage", "Pacific/Gambier", "America/Los_Angeles", "America/Tijuana", "America/Vancouver", "Pacific/Pitcairn", "America/Hermosillo", "America/Edmonton", "America/Ciudad_Juarez", "America/Denver", "America/Phoenix", "America/Whitehorse", "America/Belize", "America/Chicago", "America/Guatemala", "America/Managua", "America/Mexico_City", "America/Matamoros", "America/Costa_Rica", "America/El_Salvador", "America/Regina", "America/Tegucigalpa", "America/Winnipeg", "Pacific/Easter", "Pacific/Galapagos", "America/Rio_Branco", "America/Bogota", "America/Havana", "America/Atikokan", "America/Cancun", "America/Cayman", "America/Jamaica", "America/Nassau", "America/New_York", "America/Panama", "America/Port-au-Prince", "America/Grand_Turk", "America/Toronto", "America/Guayaquil", "America/Lima", "America/Manaus", "America/St_Kitts", "America/Blanc-Sablon", "America/Montserrat", "America/Barbados", "America/Port_of_Spain", "America/Martinique", "America/St_Lucia", "America/St_Barthelemy", "America/Halifax", "Atlantic/Bermuda", "America/St_Vincent", "America/Kralendijk", "America/Guadeloupe", "America/Marigot", "America/Aruba", "America/Lower_Princes", "America/Tortola", "America/Dominica", "America/St_Thomas", "America/Grenada", "America/Antigua", "America/Puerto_Rico", "America/Santo_Domingo", "America/Anguilla", "America/Thule", "America/Curacao", "America/La_Paz", "America/Santiago", "America/Guyana", "America/Caracas", "America/St_Johns", "America/Argentina/Buenos_Aires", "America/Sao_Paulo", "Antarctica/Palmer", "America/Punta_Arenas", "Atlantic/Stanley", "America/Cayenne", "America/Asuncion", "America/Miquelon", "America/Paramaribo", "America/Montevideo", "America/Noronha", "America/Nuuk", "Atlantic/South_Georgia", "Atlantic/Azores", "Atlantic/Cape_Verde", "Africa/Abidjan", "Africa/Bamako", "Africa/Bissau", "Africa/Conakry", "Africa/Dakar", "America/Danmarkshavn", "Europe/Isle_of_Man", "Europe/Dublin", "Africa/Freetown", "Atlantic/St_Helena", "Africa/Accra", "Africa/Lome", "Europe/London", "Africa/Monrovia", "Africa/Nouakchott", "Africa/Ouagadougou", "Atlantic/Reykjavik", "Europe/Jersey", "Europe/Guernsey", "Africa/Banjul", "Africa/Sao_Tome", "Antarctica/Troll", "Africa/Casablanca", "Africa/El_Aaiun", "Atlantic/Canary", "Europe/Lisbon", "Atlantic/Faroe", "Africa/Windhoek", "Africa/Algiers", "Europe/Amsterdam", "Europe/Andorra", "Europe/Belgrade", "Europe/Berlin", "Europe/Bratislava", "Europe/Brussels", "Europe/Budapest", "Europe/Copenhagen", "Europe/Gibraltar", "Europe/Ljubljana", "Arctic/Longyearbyen", "Europe/Luxembourg", "Europe/Madrid", "Europe/Monaco", "Europe/Oslo", "Europe/Paris", "Europe/Podgorica", "Europe/Prague", "Europe/Rome", "Europe/San_Marino", "Europe/Malta", "Europe/Sarajevo", "Europe/Skopje", "Europe/Stockholm", "Europe/Tirane", "Africa/Tunis", "Europe/Vaduz", "Europe/Vatican", "Europe/Vienna", "Europe/Warsaw", "Europe/Zagreb", "Europe/Zurich", "Africa/Bangui", "Africa/Malabo", "Africa/Brazzaville", "Africa/Porto-Novo", "Africa/Douala", "Africa/Kinshasa", "Africa/Lagos", "Africa/Libreville", "Africa/Luanda", "Africa/Ndjamena", "Africa/Niamey", "Africa/Bujumbura", "Africa/Gaborone", "Africa/Harare", "Africa/Juba", "Africa/Khartoum", "Africa/Kigali", "Africa/Blantyre", "Africa/Lubumbashi", "Africa/Lusaka", "Africa/Maputo", "Europe/Athens", "Asia/Beirut", "Europe/Bucharest", "Africa/Cairo", "Europe/Chisinau", "Asia/Hebron", "Europe/Helsinki", "Europe/Kaliningrad", "Europe/Kyiv", "Europe/Mariehamn", "Asia/Nicosia", "Europe/Riga", "Europe/Sofia", "Europe/Tallinn", "Africa/Tripoli", "Europe/Vilnius", "Asia/Jerusalem", "Africa/Johannesburg", "Africa/Mbabane", "Africa/Maseru", "Asia/Kuwait", "Asia/Bahrain", "Asia/Baghdad", "Asia/Qatar", "Asia/Riyadh", "Asia/Aden", "Asia/Amman", "Asia/Damascus", "Africa/Addis_Ababa", "Indian/Antananarivo", "Africa/Asmara", "Africa/Dar_es_Salaam", "Africa/Djibouti", "Africa/Kampala", "Indian/Mayotte", "Africa/Mogadishu", "Indian/Comoro", "Africa/Nairobi", "Europe/Minsk", "Europe/Moscow", "Europe/Simferopol", "Antarctica/Syowa", "Europe/Istanbul", "Asia/Tehran", "Asia/Yerevan", "Asia/Baku", "Asia/Tbilisi", "Asia/Dubai", "Asia/Muscat", "Indian/Mauritius", "Indian/Reunion", "Europe/Samara", "Indian/Mahe", "Asia/Kabul", "Indian/Kerguelen", "Asia/Almaty", "Indian/Maldives", "Antarctica/Mawson", "Asia/Karachi", "Asia/Dushanbe", "Asia/Ashgabat", "Asia/Tashkent", "Asia/Yekaterinburg", "Asia/Colombo", "Asia/Kolkata", "Asia/Kathmandu", "Asia/Dhaka", "Asia/Thimphu", "Asia/Urumqi", "Indian/Chagos", "Asia/Bishkek", "Asia/Omsk", "Indian/Cocos", "Asia/Yangon", "Indian/Christmas", "Antarctica/Davis", "Asia/Hovd", "Asia/Bangkok", "Asia/Ho_Chi_Minh", "Asia/Phnom_Penh", "Asia/Vientiane", "Asia/Novosibirsk", "Asia/Jakarta", "Antarctica/Casey", "Australia/Perth", "Asia/Brunei", "Asia/Makassar", "Asia/Macau", "Asia/Shanghai", "Asia/Hong_Kong", "Asia/Irkutsk", "Asia/Kuala_Lumpur", "Asia/Manila", "Asia/Singapore", "Asia/Taipei", "Asia/Ulaanbaatar", "Australia/Eucla", "Asia/Jayapura", "Asia/Tokyo", "Asia/Pyongyang", "Asia/Seoul", "Pacific/Palau", "Asia/Dili", "Asia/Chita", "Australia/Adelaide", "Australia/Darwin", "Australia/Brisbane", "Australia/Sydney", "Pacific/Guam", "Pacific/Saipan", "Pacific/Chuuk", "Antarctica/DumontDUrville", "Pacific/Port_Moresby", "Asia/Vladivostok", "Australia/Lord_Howe", "Pacific/Bougainville", "Pacific/Kosrae", "Pacific/Noumea", "Pacific/Norfolk", "Asia/Sakhalin", "Pacific/Guadalcanal", "Pacific/Efate", "Pacific/Fiji", "Pacific/Tarawa", "Asia/Kamchatka", "Pacific/Majuro", "Pacific/Nauru", "Pacific/Auckland", "Antarctica/McMurdo", "Pacific/Funafuti", "Pacific/Wake", "Pacific/Wallis", "Pacific/Chatham", "Pacific/Kanton", "Pacific/Apia", "Pacific/Fakaofo", "Pacific/Tongatapu", "Pacific/Kiritimati"];
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.timeZones = void 0;
|
|
4
|
+
exports.timeZones = [
|
|
5
|
+
"Pacific/Midway",
|
|
6
|
+
"Pacific/Pago_Pago",
|
|
7
|
+
"Pacific/Niue",
|
|
8
|
+
"Pacific/Rarotonga",
|
|
9
|
+
"America/Adak",
|
|
10
|
+
"Pacific/Honolulu",
|
|
11
|
+
"Pacific/Tahiti",
|
|
12
|
+
"Pacific/Marquesas",
|
|
13
|
+
"America/Anchorage",
|
|
14
|
+
"Pacific/Gambier",
|
|
15
|
+
"America/Los_Angeles",
|
|
16
|
+
"America/Tijuana",
|
|
17
|
+
"America/Vancouver",
|
|
18
|
+
"Pacific/Pitcairn",
|
|
19
|
+
"America/Hermosillo",
|
|
20
|
+
"America/Edmonton",
|
|
21
|
+
"America/Ciudad_Juarez",
|
|
22
|
+
"America/Denver",
|
|
23
|
+
"America/Phoenix",
|
|
24
|
+
"America/Whitehorse",
|
|
25
|
+
"America/Belize",
|
|
26
|
+
"America/Chicago",
|
|
27
|
+
"America/Guatemala",
|
|
28
|
+
"America/Managua",
|
|
29
|
+
"America/Mexico_City",
|
|
30
|
+
"America/Matamoros",
|
|
31
|
+
"America/Costa_Rica",
|
|
32
|
+
"America/El_Salvador",
|
|
33
|
+
"America/Regina",
|
|
34
|
+
"America/Tegucigalpa",
|
|
35
|
+
"America/Winnipeg",
|
|
36
|
+
"Pacific/Easter",
|
|
37
|
+
"Pacific/Galapagos",
|
|
38
|
+
"America/Rio_Branco",
|
|
39
|
+
"America/Bogota",
|
|
40
|
+
"America/Havana",
|
|
41
|
+
"America/Atikokan",
|
|
42
|
+
"America/Cancun",
|
|
43
|
+
"America/Cayman",
|
|
44
|
+
"America/Jamaica",
|
|
45
|
+
"America/Nassau",
|
|
46
|
+
"America/New_York",
|
|
47
|
+
"America/Panama",
|
|
48
|
+
"America/Port-au-Prince",
|
|
49
|
+
"America/Grand_Turk",
|
|
50
|
+
"America/Toronto",
|
|
51
|
+
"America/Guayaquil",
|
|
52
|
+
"America/Lima",
|
|
53
|
+
"America/Manaus",
|
|
54
|
+
"America/St_Kitts",
|
|
55
|
+
"America/Blanc-Sablon",
|
|
56
|
+
"America/Montserrat",
|
|
57
|
+
"America/Barbados",
|
|
58
|
+
"America/Port_of_Spain",
|
|
59
|
+
"America/Martinique",
|
|
60
|
+
"America/St_Lucia",
|
|
61
|
+
"America/St_Barthelemy",
|
|
62
|
+
"America/Halifax",
|
|
63
|
+
"Atlantic/Bermuda",
|
|
64
|
+
"America/St_Vincent",
|
|
65
|
+
"America/Kralendijk",
|
|
66
|
+
"America/Guadeloupe",
|
|
67
|
+
"America/Marigot",
|
|
68
|
+
"America/Aruba",
|
|
69
|
+
"America/Lower_Princes",
|
|
70
|
+
"America/Tortola",
|
|
71
|
+
"America/Dominica",
|
|
72
|
+
"America/St_Thomas",
|
|
73
|
+
"America/Grenada",
|
|
74
|
+
"America/Antigua",
|
|
75
|
+
"America/Puerto_Rico",
|
|
76
|
+
"America/Santo_Domingo",
|
|
77
|
+
"America/Anguilla",
|
|
78
|
+
"America/Thule",
|
|
79
|
+
"America/Curacao",
|
|
80
|
+
"America/La_Paz",
|
|
81
|
+
"America/Santiago",
|
|
82
|
+
"America/Guyana",
|
|
83
|
+
"America/Caracas",
|
|
84
|
+
"America/St_Johns",
|
|
85
|
+
"America/Argentina/Buenos_Aires",
|
|
86
|
+
"America/Sao_Paulo",
|
|
87
|
+
"Antarctica/Palmer",
|
|
88
|
+
"America/Punta_Arenas",
|
|
89
|
+
"Atlantic/Stanley",
|
|
90
|
+
"America/Cayenne",
|
|
91
|
+
"America/Asuncion",
|
|
92
|
+
"America/Miquelon",
|
|
93
|
+
"America/Paramaribo",
|
|
94
|
+
"America/Montevideo",
|
|
95
|
+
"America/Noronha",
|
|
96
|
+
"America/Nuuk",
|
|
97
|
+
"Atlantic/South_Georgia",
|
|
98
|
+
"Atlantic/Azores",
|
|
99
|
+
"Atlantic/Cape_Verde",
|
|
100
|
+
"Africa/Abidjan",
|
|
101
|
+
"Africa/Bamako",
|
|
102
|
+
"Africa/Bissau",
|
|
103
|
+
"Africa/Conakry",
|
|
104
|
+
"Africa/Dakar",
|
|
105
|
+
"America/Danmarkshavn",
|
|
106
|
+
"Europe/Isle_of_Man",
|
|
107
|
+
"Europe/Dublin",
|
|
108
|
+
"Africa/Freetown",
|
|
109
|
+
"Atlantic/St_Helena",
|
|
110
|
+
"Africa/Accra",
|
|
111
|
+
"Africa/Lome",
|
|
112
|
+
"Europe/London",
|
|
113
|
+
"Africa/Monrovia",
|
|
114
|
+
"Africa/Nouakchott",
|
|
115
|
+
"Africa/Ouagadougou",
|
|
116
|
+
"Atlantic/Reykjavik",
|
|
117
|
+
"Europe/Jersey",
|
|
118
|
+
"Europe/Guernsey",
|
|
119
|
+
"Africa/Banjul",
|
|
120
|
+
"Africa/Sao_Tome",
|
|
121
|
+
"Antarctica/Troll",
|
|
122
|
+
"Africa/Casablanca",
|
|
123
|
+
"Africa/El_Aaiun",
|
|
124
|
+
"Atlantic/Canary",
|
|
125
|
+
"Europe/Lisbon",
|
|
126
|
+
"Atlantic/Faroe",
|
|
127
|
+
"Africa/Windhoek",
|
|
128
|
+
"Africa/Algiers",
|
|
129
|
+
"Europe/Amsterdam",
|
|
130
|
+
"Europe/Andorra",
|
|
131
|
+
"Europe/Belgrade",
|
|
132
|
+
"Europe/Berlin",
|
|
133
|
+
"Europe/Bratislava",
|
|
134
|
+
"Europe/Brussels",
|
|
135
|
+
"Europe/Budapest",
|
|
136
|
+
"Europe/Copenhagen",
|
|
137
|
+
"Europe/Gibraltar",
|
|
138
|
+
"Europe/Ljubljana",
|
|
139
|
+
"Arctic/Longyearbyen",
|
|
140
|
+
"Europe/Luxembourg",
|
|
141
|
+
"Europe/Madrid",
|
|
142
|
+
"Europe/Monaco",
|
|
143
|
+
"Europe/Oslo",
|
|
144
|
+
"Europe/Paris",
|
|
145
|
+
"Europe/Podgorica",
|
|
146
|
+
"Europe/Prague",
|
|
147
|
+
"Europe/Rome",
|
|
148
|
+
"Europe/San_Marino",
|
|
149
|
+
"Europe/Malta",
|
|
150
|
+
"Europe/Sarajevo",
|
|
151
|
+
"Europe/Skopje",
|
|
152
|
+
"Europe/Stockholm",
|
|
153
|
+
"Europe/Tirane",
|
|
154
|
+
"Africa/Tunis",
|
|
155
|
+
"Europe/Vaduz",
|
|
156
|
+
"Europe/Vatican",
|
|
157
|
+
"Europe/Vienna",
|
|
158
|
+
"Europe/Warsaw",
|
|
159
|
+
"Europe/Zagreb",
|
|
160
|
+
"Europe/Zurich",
|
|
161
|
+
"Africa/Bangui",
|
|
162
|
+
"Africa/Malabo",
|
|
163
|
+
"Africa/Brazzaville",
|
|
164
|
+
"Africa/Porto-Novo",
|
|
165
|
+
"Africa/Douala",
|
|
166
|
+
"Africa/Kinshasa",
|
|
167
|
+
"Africa/Lagos",
|
|
168
|
+
"Africa/Libreville",
|
|
169
|
+
"Africa/Luanda",
|
|
170
|
+
"Africa/Ndjamena",
|
|
171
|
+
"Africa/Niamey",
|
|
172
|
+
"Africa/Bujumbura",
|
|
173
|
+
"Africa/Gaborone",
|
|
174
|
+
"Africa/Harare",
|
|
175
|
+
"Africa/Juba",
|
|
176
|
+
"Africa/Khartoum",
|
|
177
|
+
"Africa/Kigali",
|
|
178
|
+
"Africa/Blantyre",
|
|
179
|
+
"Africa/Lubumbashi",
|
|
180
|
+
"Africa/Lusaka",
|
|
181
|
+
"Africa/Maputo",
|
|
182
|
+
"Europe/Athens",
|
|
183
|
+
"Asia/Beirut",
|
|
184
|
+
"Europe/Bucharest",
|
|
185
|
+
"Africa/Cairo",
|
|
186
|
+
"Europe/Chisinau",
|
|
187
|
+
"Asia/Hebron",
|
|
188
|
+
"Europe/Helsinki",
|
|
189
|
+
"Europe/Kaliningrad",
|
|
190
|
+
"Europe/Kyiv",
|
|
191
|
+
"Europe/Mariehamn",
|
|
192
|
+
"Asia/Nicosia",
|
|
193
|
+
"Europe/Riga",
|
|
194
|
+
"Europe/Sofia",
|
|
195
|
+
"Europe/Tallinn",
|
|
196
|
+
"Africa/Tripoli",
|
|
197
|
+
"Europe/Vilnius",
|
|
198
|
+
"Asia/Jerusalem",
|
|
199
|
+
"Africa/Johannesburg",
|
|
200
|
+
"Africa/Mbabane",
|
|
201
|
+
"Africa/Maseru",
|
|
202
|
+
"Asia/Kuwait",
|
|
203
|
+
"Asia/Bahrain",
|
|
204
|
+
"Asia/Baghdad",
|
|
205
|
+
"Asia/Qatar",
|
|
206
|
+
"Asia/Riyadh",
|
|
207
|
+
"Asia/Aden",
|
|
208
|
+
"Asia/Amman",
|
|
209
|
+
"Asia/Damascus",
|
|
210
|
+
"Africa/Addis_Ababa",
|
|
211
|
+
"Indian/Antananarivo",
|
|
212
|
+
"Africa/Asmara",
|
|
213
|
+
"Africa/Dar_es_Salaam",
|
|
214
|
+
"Africa/Djibouti",
|
|
215
|
+
"Africa/Kampala",
|
|
216
|
+
"Indian/Mayotte",
|
|
217
|
+
"Africa/Mogadishu",
|
|
218
|
+
"Indian/Comoro",
|
|
219
|
+
"Africa/Nairobi",
|
|
220
|
+
"Europe/Minsk",
|
|
221
|
+
"Europe/Moscow",
|
|
222
|
+
"Europe/Simferopol",
|
|
223
|
+
"Antarctica/Syowa",
|
|
224
|
+
"Europe/Istanbul",
|
|
225
|
+
"Asia/Tehran",
|
|
226
|
+
"Asia/Yerevan",
|
|
227
|
+
"Asia/Baku",
|
|
228
|
+
"Asia/Tbilisi",
|
|
229
|
+
"Asia/Dubai",
|
|
230
|
+
"Asia/Muscat",
|
|
231
|
+
"Indian/Mauritius",
|
|
232
|
+
"Indian/Reunion",
|
|
233
|
+
"Europe/Samara",
|
|
234
|
+
"Indian/Mahe",
|
|
235
|
+
"Asia/Kabul",
|
|
236
|
+
"Indian/Kerguelen",
|
|
237
|
+
"Asia/Almaty",
|
|
238
|
+
"Indian/Maldives",
|
|
239
|
+
"Antarctica/Mawson",
|
|
240
|
+
"Asia/Karachi",
|
|
241
|
+
"Asia/Dushanbe",
|
|
242
|
+
"Asia/Ashgabat",
|
|
243
|
+
"Asia/Tashkent",
|
|
244
|
+
"Asia/Yekaterinburg",
|
|
245
|
+
"Asia/Colombo",
|
|
246
|
+
"Asia/Kolkata",
|
|
247
|
+
"Asia/Kathmandu",
|
|
248
|
+
"Asia/Dhaka",
|
|
249
|
+
"Asia/Thimphu",
|
|
250
|
+
"Asia/Urumqi",
|
|
251
|
+
"Indian/Chagos",
|
|
252
|
+
"Asia/Bishkek",
|
|
253
|
+
"Asia/Omsk",
|
|
254
|
+
"Indian/Cocos",
|
|
255
|
+
"Asia/Yangon",
|
|
256
|
+
"Indian/Christmas",
|
|
257
|
+
"Antarctica/Davis",
|
|
258
|
+
"Asia/Hovd",
|
|
259
|
+
"Asia/Bangkok",
|
|
260
|
+
"Asia/Ho_Chi_Minh",
|
|
261
|
+
"Asia/Phnom_Penh",
|
|
262
|
+
"Asia/Vientiane",
|
|
263
|
+
"Asia/Novosibirsk",
|
|
264
|
+
"Asia/Jakarta",
|
|
265
|
+
"Antarctica/Casey",
|
|
266
|
+
"Australia/Perth",
|
|
267
|
+
"Asia/Brunei",
|
|
268
|
+
"Asia/Makassar",
|
|
269
|
+
"Asia/Macau",
|
|
270
|
+
"Asia/Shanghai",
|
|
271
|
+
"Asia/Hong_Kong",
|
|
272
|
+
"Asia/Irkutsk",
|
|
273
|
+
"Asia/Kuala_Lumpur",
|
|
274
|
+
"Asia/Manila",
|
|
275
|
+
"Asia/Singapore",
|
|
276
|
+
"Asia/Taipei",
|
|
277
|
+
"Asia/Ulaanbaatar",
|
|
278
|
+
"Australia/Eucla",
|
|
279
|
+
"Asia/Jayapura",
|
|
280
|
+
"Asia/Tokyo",
|
|
281
|
+
"Asia/Pyongyang",
|
|
282
|
+
"Asia/Seoul",
|
|
283
|
+
"Pacific/Palau",
|
|
284
|
+
"Asia/Dili",
|
|
285
|
+
"Asia/Chita",
|
|
286
|
+
"Australia/Adelaide",
|
|
287
|
+
"Australia/Darwin",
|
|
288
|
+
"Australia/Brisbane",
|
|
289
|
+
"Australia/Sydney",
|
|
290
|
+
"Pacific/Guam",
|
|
291
|
+
"Pacific/Saipan",
|
|
292
|
+
"Pacific/Chuuk",
|
|
293
|
+
"Antarctica/DumontDUrville",
|
|
294
|
+
"Pacific/Port_Moresby",
|
|
295
|
+
"Asia/Vladivostok",
|
|
296
|
+
"Australia/Lord_Howe",
|
|
297
|
+
"Pacific/Bougainville",
|
|
298
|
+
"Pacific/Kosrae",
|
|
299
|
+
"Pacific/Noumea",
|
|
300
|
+
"Pacific/Norfolk",
|
|
301
|
+
"Asia/Sakhalin",
|
|
302
|
+
"Pacific/Guadalcanal",
|
|
303
|
+
"Pacific/Efate",
|
|
304
|
+
"Pacific/Fiji",
|
|
305
|
+
"Pacific/Tarawa",
|
|
306
|
+
"Asia/Kamchatka",
|
|
307
|
+
"Pacific/Majuro",
|
|
308
|
+
"Pacific/Nauru",
|
|
309
|
+
"Pacific/Auckland",
|
|
310
|
+
"Antarctica/McMurdo",
|
|
311
|
+
"Pacific/Funafuti",
|
|
312
|
+
"Pacific/Wake",
|
|
313
|
+
"Pacific/Wallis",
|
|
314
|
+
"Pacific/Chatham",
|
|
315
|
+
"Pacific/Kanton",
|
|
316
|
+
"Pacific/Apia",
|
|
317
|
+
"Pacific/Fakaofo",
|
|
318
|
+
"Pacific/Tongatapu",
|
|
319
|
+
"Pacific/Kiritimati"
|
|
320
|
+
];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Booking } from "../../booking/booking";
|
|
2
|
+
import { DateWithTimeZone } from "../common/dates";
|
|
2
3
|
import { JourneyInfo } from "./JourneyInfo";
|
|
3
4
|
import { Stop } from "./Stop";
|
|
4
5
|
import { Trip } from "./Trip";
|
|
@@ -6,8 +7,8 @@ export type JourneySearchRequest = {
|
|
|
6
7
|
departureStopName: string | undefined;
|
|
7
8
|
destinationStopName: string | undefined;
|
|
8
9
|
passengersNumber: number;
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
outboundDate: DateWithTimeZone;
|
|
11
|
+
returnDate?: DateWithTimeZone | null;
|
|
11
12
|
currency: Booking.Currencies;
|
|
12
13
|
isRoundTrip: boolean;
|
|
13
14
|
outboundTripId?: number | null;
|
|
@@ -16,5 +17,5 @@ export declare const DEFAULT_JOURNEY_SEARCH: JourneySearchRequest;
|
|
|
16
17
|
export type JourneySearchResult = {
|
|
17
18
|
stops: Stop[];
|
|
18
19
|
info: JourneyInfo;
|
|
19
|
-
|
|
20
|
+
journeyTrips: Trip[];
|
|
20
21
|
};
|
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEFAULT_JOURNEY_SEARCH = void 0;
|
|
4
4
|
var booking_1 = require("../../booking/booking");
|
|
5
|
-
var utils_1 = require("../../utils/utils");
|
|
6
5
|
exports.DEFAULT_JOURNEY_SEARCH = {
|
|
7
6
|
departureStopName: "",
|
|
8
7
|
destinationStopName: "",
|
|
9
8
|
passengersNumber: 1,
|
|
10
|
-
|
|
9
|
+
outboundDate: {
|
|
10
|
+
dateTime: new Date().toISOString(),
|
|
11
|
+
timeZone: "Europe/Rome"
|
|
12
|
+
},
|
|
13
|
+
returnDate: {
|
|
14
|
+
dateTime: new Date().toISOString(),
|
|
15
|
+
timeZone: "Europe/Rome"
|
|
16
|
+
},
|
|
11
17
|
isRoundTrip: false,
|
|
12
18
|
currency: booking_1.Booking.Currencies.EUR
|
|
13
19
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { DateWithTimeZone } from "../common/dates";
|
|
1
2
|
/**
|
|
2
3
|
* @description Represents a stop in a journey.
|
|
3
4
|
*/
|
|
4
5
|
export type Stop = {
|
|
5
6
|
/** The unique identifier for the stop */
|
|
6
7
|
id: number;
|
|
7
|
-
/** The time when the journey departs from this stop in
|
|
8
|
-
|
|
9
|
-
/** The time when the journey arrives at this stop in
|
|
10
|
-
|
|
8
|
+
/** The time when the journey departs from this stop in ISO string format */
|
|
9
|
+
departureDateTime: DateWithTimeZone;
|
|
10
|
+
/** The time when the journey arrives at this stop in ISO string format */
|
|
11
|
+
destinationDateTime: DateWithTimeZone;
|
|
11
12
|
/** The name of the stop */
|
|
12
13
|
name: string;
|
|
13
14
|
/** The address of the stop */
|
|
@@ -1,19 +1,76 @@
|
|
|
1
|
+
import { DateWithTimeZone } from "../common/dates";
|
|
1
2
|
import { TariffsMatrix, TariffType, TermsType } from "../common/Tariffs";
|
|
2
3
|
export type Trip = {
|
|
3
4
|
/** The unique identifier for the trip */
|
|
4
5
|
id: number;
|
|
5
|
-
/** The
|
|
6
|
-
|
|
6
|
+
/** The name of the trip */
|
|
7
|
+
name?: string;
|
|
8
|
+
/** Extension of the trip name */
|
|
9
|
+
nameExtension?: string;
|
|
10
|
+
/** LinkAvel Bus name */
|
|
11
|
+
linkAvelBusName?: string;
|
|
12
|
+
/** Extended name of the trip */
|
|
13
|
+
extendedName?: string;
|
|
14
|
+
/** Whether the trip is tentative */
|
|
15
|
+
tentative?: boolean;
|
|
16
|
+
/** Whether the trip is canceled */
|
|
17
|
+
canceled?: boolean;
|
|
18
|
+
/** Bus ID */
|
|
19
|
+
busId?: number;
|
|
20
|
+
/** Seller ID */
|
|
21
|
+
sellerId?: number;
|
|
22
|
+
/** Route ID */
|
|
23
|
+
routeId?: number;
|
|
24
|
+
/** Route name */
|
|
25
|
+
routeName?: string;
|
|
26
|
+
/** Line ID */
|
|
27
|
+
lineId?: number;
|
|
28
|
+
/** Line name */
|
|
29
|
+
lineName?: string;
|
|
30
|
+
/** Whether it's a service */
|
|
31
|
+
isService?: boolean;
|
|
32
|
+
/** Line type */
|
|
33
|
+
lineType?: string;
|
|
34
|
+
/** Date of the trip */
|
|
35
|
+
date?: string;
|
|
36
|
+
/** Date as string */
|
|
37
|
+
dateString?: string;
|
|
38
|
+
/** Whether the trip is sellable */
|
|
39
|
+
isSellable?: boolean;
|
|
40
|
+
/** Apex related trip ID */
|
|
41
|
+
apexRelatedTripId?: number;
|
|
42
|
+
/** Related trips IDs */
|
|
43
|
+
relatedTripsIds?: number[];
|
|
44
|
+
/** Departure time */
|
|
45
|
+
departureTime?: string;
|
|
46
|
+
/** Destination time */
|
|
47
|
+
destinationTime?: string;
|
|
48
|
+
/** Departure time as ISO string */
|
|
49
|
+
departureDateTime?: DateWithTimeZone;
|
|
50
|
+
/** Destination time as ISO string */
|
|
51
|
+
destinationDateTime?: DateWithTimeZone;
|
|
52
|
+
/** All bus tickets IDs */
|
|
53
|
+
allBusTicketsIds?: number[];
|
|
54
|
+
/** Ongoing route stop ID to bus tickets IDs mapping */
|
|
55
|
+
ongoingRouteStopIdToBusTicketsIds?: Record<string, number[]>;
|
|
56
|
+
/** Destination route stop ID to bus tickets IDs mapping */
|
|
57
|
+
destinationRouteStopIdToBusTicketsIds?: Record<string, number[]>;
|
|
58
|
+
/** Departure route stop ID to bus tickets IDs mapping */
|
|
59
|
+
departureRouteStopIdToBusTicketsIds?: Record<string, number[]>;
|
|
7
60
|
/** The name of the departure stop */
|
|
8
|
-
departureStopName
|
|
61
|
+
departureStopName?: string;
|
|
62
|
+
/** Departure physical agency stop ID */
|
|
63
|
+
departurePhysicalAgencyStopId?: number;
|
|
9
64
|
/** The name of the destination stop */
|
|
10
|
-
destinationStopName
|
|
11
|
-
/**
|
|
12
|
-
|
|
65
|
+
destinationStopName?: string;
|
|
66
|
+
/** Destination physical agency stop ID */
|
|
67
|
+
destinationPhysicalAgencyStopId?: number;
|
|
13
68
|
/** List of the tariffTypes to be found in the tariffsMatrix */
|
|
14
|
-
tariffTypes
|
|
69
|
+
tariffTypes?: TariffType[];
|
|
15
70
|
/** List of the termsTypes to be found in the tariffsMatrix */
|
|
16
|
-
termsTypes
|
|
71
|
+
termsTypes?: TermsType[];
|
|
72
|
+
/** Tariff matrix for this trip */
|
|
73
|
+
tariffsMatrix?: TariffsMatrix;
|
|
17
74
|
};
|
|
18
75
|
/**
|
|
19
76
|
* This type is used to represent a trip for the reduction page. This only makes sense for a JourneyBooking,
|
|
@@ -26,21 +26,27 @@ export type Service = {
|
|
|
26
26
|
isDateRequired: boolean;
|
|
27
27
|
isTripMandatory: boolean;
|
|
28
28
|
};
|
|
29
|
+
export type TripIdAndHour = {
|
|
30
|
+
/** The id of the trip. */
|
|
31
|
+
tripId: number;
|
|
32
|
+
/** The hour of the trip. */
|
|
33
|
+
hour: string;
|
|
34
|
+
};
|
|
29
35
|
export type ServiceTrip = {
|
|
30
36
|
/** The name of the service */
|
|
31
37
|
name: string;
|
|
32
|
-
/** The date and time of the service, if set. */
|
|
33
|
-
|
|
38
|
+
/** The date and time of the service in ISO string format, if set. */
|
|
39
|
+
serviceDate?: string;
|
|
34
40
|
/** The id of the trip, if set. */
|
|
35
41
|
tripId?: number;
|
|
36
42
|
};
|
|
37
43
|
/**
|
|
38
44
|
* @description Represents a response from the service trips endpoint
|
|
39
45
|
* @param {boolean} areThereTrips - Indicates whether there are trips available for the service.
|
|
40
|
-
* @param {
|
|
46
|
+
* @param {TripIdAndHour[]} trips - An array of {@link TripIdAndHour} objects representing the available trips. This can be empty
|
|
41
47
|
* even if `areThereTrips` is true, as the user might be not allowed to select a specific trip.
|
|
42
48
|
*/
|
|
43
49
|
export type ServiceTripsResponse = {
|
|
44
50
|
areThereTrips: boolean;
|
|
45
|
-
trips:
|
|
51
|
+
trips: TripIdAndHour[];
|
|
46
52
|
};
|
|
@@ -5,23 +5,19 @@ import { ServiceTrip } from "./Service";
|
|
|
5
5
|
/**
|
|
6
6
|
* @description Represents a `ServiceCart`, which extends the {@link Cart} type by including additional
|
|
7
7
|
* information about the bookings
|
|
8
|
-
*
|
|
9
|
-
* @property {ServiceBooking[]} bookings - An array of {@link ServiceBookingType} objects representing the bookings associated
|
|
10
|
-
* with this journey cart.
|
|
11
8
|
*/
|
|
12
9
|
export type ServiceCart = Cart & {
|
|
10
|
+
/** An array of {@link ServiceBookingType} objects representing the bookings associated with this journey cart. */
|
|
13
11
|
bookings: ServiceBookingType[];
|
|
14
12
|
};
|
|
15
13
|
/**
|
|
16
14
|
* @description Represents a `ServiceBooking`, which contains information about a service booking.
|
|
17
|
-
*
|
|
18
|
-
* @property {Booking.BookingTypes} type - The type of booking. For services, this is always `Booking.BookingTypes.SERVICE`.
|
|
19
|
-
* @property {TariffSummary[]} summary - An array of {@link TariffSummary} objects representing the tariff summary
|
|
20
|
-
* associated with this journey booking.
|
|
21
|
-
* @property {ServiceTrip} info - An array of {@link ServiceTrip} objects representing the stops associated with this journey booking.
|
|
22
15
|
*/
|
|
23
16
|
export type ServiceBookingType = {
|
|
17
|
+
/** The type of booking. For services, this is always `Booking.BookingTypes.SERVICE`. */
|
|
24
18
|
type: Booking.BookingTypes;
|
|
19
|
+
/** An array of {@link TariffSummary} objects representing the tariff summary associated with this journey booking. */
|
|
25
20
|
summary: TariffSummary[];
|
|
21
|
+
/** Information about the service. */
|
|
26
22
|
info: ServiceTrip;
|
|
27
23
|
};
|
|
@@ -36,14 +36,14 @@ export type GetSubscriptionAvailabilityResponse = {
|
|
|
36
36
|
departureStopName: string;
|
|
37
37
|
/** The name of the destination stop. */
|
|
38
38
|
destinationStopName: string;
|
|
39
|
-
/** The departure time of the outbound trip in
|
|
40
|
-
|
|
41
|
-
/** The destination time of the outbound trip in
|
|
42
|
-
|
|
43
|
-
/** The departure time of the return trip in
|
|
44
|
-
|
|
45
|
-
/** The destination time of the return trip in
|
|
46
|
-
|
|
39
|
+
/** The departure time of the outbound trip in hh:mm format */
|
|
40
|
+
outboundDepartureTimeString: string;
|
|
41
|
+
/** The destination time of the outbound trip in hh:mm format */
|
|
42
|
+
outboundDestinationTimeString: string;
|
|
43
|
+
/** The departure time of the return trip in hh:mm format */
|
|
44
|
+
returnDepartureTimeString: string | null;
|
|
45
|
+
/** The destination time of the return trip in hh:mm format */
|
|
46
|
+
returnDestinationTimeString: string | null;
|
|
47
47
|
/** The list of periods for which the availability of the subscription was checked. */
|
|
48
48
|
periods: SubscriptionCalendarDayPeriodInfo[];
|
|
49
49
|
};
|
|
@@ -54,10 +54,10 @@ export type GetSubscriptionAvailabilityResponse = {
|
|
|
54
54
|
export type SubscriptionCalendarDayPeriodInfo = {
|
|
55
55
|
/** The name of the period (e.g. "July 2023") */
|
|
56
56
|
periodName: string;
|
|
57
|
-
/** The start date of the period in
|
|
58
|
-
|
|
59
|
-
/** The end date of the period in
|
|
60
|
-
|
|
57
|
+
/** The start date of the period in ISO string format */
|
|
58
|
+
dateFrom: string;
|
|
59
|
+
/** The end date of the period in ISO string format */
|
|
60
|
+
dateTo: string;
|
|
61
61
|
/** The price of the subscription for the given period */
|
|
62
62
|
price: number;
|
|
63
63
|
/** Whether this subscription is available in this period */
|
|
@@ -34,10 +34,10 @@ export type CreateSubscriptionCartRequest = {
|
|
|
34
34
|
* @description This is the object that describes which periods should be booked.
|
|
35
35
|
*/
|
|
36
36
|
export type SubscriptionPeriod = {
|
|
37
|
-
/** The start date of the period in
|
|
38
|
-
|
|
39
|
-
/** The end date of the period in
|
|
40
|
-
|
|
37
|
+
/** The start date of the period in ISO string format as returned by {@link SubscriptionBooking.getSubscrptionAvailabilities} */
|
|
38
|
+
dateFrom: string;
|
|
39
|
+
/** The end date of the period in ISO string format as returned by {@link SubscriptionBooking.getSubscrptionAvailabilities} */
|
|
40
|
+
dateTo: string;
|
|
41
41
|
};
|
|
42
42
|
/**
|
|
43
43
|
* @description Represents a `SubscriptionCart`, which extends the {@link Cart} type by including additional information about the bookings.
|
package/lib/utils/utils.d.ts
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param date The date to convert
|
|
3
|
-
* @param onlyDate If true, the function will return a number in the format YYYYMMDD000000000 (all 0 for HH, MM, SS, and MMM).
|
|
4
|
-
* @returns A number in the format YYYYMMDDHHMMSSMMM
|
|
5
|
-
*/
|
|
6
|
-
export declare const getLongFromDate: (date: Date, onlyDate?: boolean) => number;
|
|
7
|
-
/**
|
|
8
|
-
* @param long A number in the format YYYYMMDDHHMMSSMMM (which represents a date)
|
|
9
|
-
* @returns The corresponding Date object
|
|
10
|
-
*/
|
|
11
|
-
export declare const getDateFromLong: (long: number) => Date | null;
|
|
12
1
|
/**
|
|
13
2
|
* This method check where a variable is null or undefined
|
|
14
3
|
* @param value The value to check
|
package/lib/utils/utils.js
CHANGED
|
@@ -1,54 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isNullOrWhiteSpace = exports.isNullOrUndefined =
|
|
4
|
-
/**
|
|
5
|
-
* @param date The date to convert
|
|
6
|
-
* @param onlyDate If true, the function will return a number in the format YYYYMMDD000000000 (all 0 for HH, MM, SS, and MMM).
|
|
7
|
-
* @returns A number in the format YYYYMMDDHHMMSSMMM
|
|
8
|
-
*/
|
|
9
|
-
var getLongFromDate = function (date, onlyDate) {
|
|
10
|
-
if (onlyDate === void 0) { onlyDate = false; }
|
|
11
|
-
try {
|
|
12
|
-
if (onlyDate) {
|
|
13
|
-
return (date.getFullYear() * 10000000000000 +
|
|
14
|
-
(date.getMonth() + 1) * 100000000000 +
|
|
15
|
-
date.getDate() * 1000000000);
|
|
16
|
-
}
|
|
17
|
-
return (date.getFullYear() * 10000000000000 +
|
|
18
|
-
(date.getMonth() + 1) * 100000000000 +
|
|
19
|
-
date.getDate() * 1000000000 +
|
|
20
|
-
date.getHours() * 10000000 +
|
|
21
|
-
date.getMinutes() * 100000 +
|
|
22
|
-
date.getSeconds() * 1000 +
|
|
23
|
-
date.getMilliseconds());
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
throw new Error("Error in MTSBookingLib. Function getLongFromDate. Date: ".concat(date, ". onlyDate: ").concat(onlyDate, ". Error: ").concat(error));
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
exports.getLongFromDate = getLongFromDate;
|
|
30
|
-
/**
|
|
31
|
-
* @param long A number in the format YYYYMMDDHHMMSSMMM (which represents a date)
|
|
32
|
-
* @returns The corresponding Date object
|
|
33
|
-
*/
|
|
34
|
-
var getDateFromLong = function (long) {
|
|
35
|
-
try {
|
|
36
|
-
if (long === 0)
|
|
37
|
-
return null;
|
|
38
|
-
var year = Math.floor(long / 10000000000000);
|
|
39
|
-
var month = Math.floor((long % 10000000000000) / 100000000000);
|
|
40
|
-
var day = Math.floor((long % 100000000000) / 1000000000);
|
|
41
|
-
var hour = Math.floor((long % 1000000000) / 10000000);
|
|
42
|
-
var minute = Math.floor((long % 10000000) / 100000);
|
|
43
|
-
var second = Math.floor((long % 100000) / 1000);
|
|
44
|
-
var millisecond = long % 1000;
|
|
45
|
-
return new Date(Date.UTC(year, month - 1, day, hour, minute, second, millisecond));
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
throw new Error("Error in MTSBookingLib. Function getDateFromLong. DateLong: ".concat(long, ". Error: ").concat(error));
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
exports.getDateFromLong = getDateFromLong;
|
|
3
|
+
exports.isNullOrWhiteSpace = exports.isNullOrUndefined = void 0;
|
|
52
4
|
/**
|
|
53
5
|
* This method check where a variable is null or undefined
|
|
54
6
|
* @param value The value to check
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mts-booking-library",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Library for using MyTicketSolution Booking API",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"build": "tsc",
|
|
9
9
|
"pretest": "tsc --noEmit",
|
|
10
10
|
"test": "jest --config jestconfig.json",
|
|
11
|
-
"prepare": "npm run build",
|
|
11
|
+
"prepare": "npm audit --audit-level=moderate && npm run build",
|
|
12
12
|
"prepublishOnly": "npm run test --runInBand",
|
|
13
13
|
"version": "git add -A src",
|
|
14
14
|
"postversion": "git push && git push --tags",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"author": "Infoservice s.r.l.",
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@react-native-async-storage/async-storage": "~2.2.0",
|
|
46
|
-
"axios": "~1.
|
|
46
|
+
"axios": "~1.13.0",
|
|
47
47
|
"zustand": "~5.0.8"
|
|
48
48
|
}
|
|
49
49
|
}
|