mts-booking-library 2.3.3 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/booking/journeyBooking.js +3 -5
- package/lib/booking/serviceBooking.js +2 -5
- package/lib/booking/subscriptionBooking.d.ts +2 -1
- package/lib/booking/subscriptionBooking.js +4 -5
- package/lib/booking/tplBooking.js +2 -5
- package/lib/types/common/Person.d.ts +36 -15
- package/lib/types/common/Person.js +11 -1
- package/package.json +3 -3
@@ -395,11 +395,9 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
395
395
|
}))
|
396
396
|
: null;
|
397
397
|
});
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
passengers: passengers
|
402
|
-
};
|
398
|
+
// Return the response
|
399
|
+
var res = __assign(__assign({}, response), { passengers: passengers });
|
400
|
+
return res;
|
403
401
|
})];
|
404
402
|
});
|
405
403
|
});
|
@@ -373,11 +373,8 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
373
373
|
// Check for errors
|
374
374
|
if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response))
|
375
375
|
return response;
|
376
|
-
|
377
|
-
|
378
|
-
buyer: response.buyer,
|
379
|
-
passengers: []
|
380
|
-
};
|
376
|
+
// Return the response
|
377
|
+
return __assign(__assign({}, response), { passengers: [] });
|
381
378
|
})];
|
382
379
|
});
|
383
380
|
});
|
@@ -169,6 +169,7 @@ export declare namespace SubscriptionBooking {
|
|
169
169
|
CALENDAR_MONTH = "CALENDAR_MONTH",
|
170
170
|
CALENDAR_SIX_MONTHS = "CALENDAR_SIX_MONTHS",
|
171
171
|
ONE_YEAR = "ONE_YEAR",
|
172
|
-
CALENDAR_YEAR = "CALENDAR_YEAR"
|
172
|
+
CALENDAR_YEAR = "CALENDAR_YEAR",
|
173
|
+
FIVE_SECONDS = "FIVE_SECONDS"
|
173
174
|
}
|
174
175
|
}
|
@@ -421,11 +421,9 @@ var SubscriptionBooking = /** @class */ (function (_super) {
|
|
421
421
|
}))
|
422
422
|
: null;
|
423
423
|
});
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
passengers: passengers
|
428
|
-
};
|
424
|
+
// Return the response
|
425
|
+
var res = __assign(__assign({}, response), { passengers: passengers });
|
426
|
+
return res;
|
429
427
|
})];
|
430
428
|
});
|
431
429
|
});
|
@@ -782,5 +780,6 @@ exports.SubscriptionBooking = SubscriptionBooking;
|
|
782
780
|
ValidityTypes["CALENDAR_SIX_MONTHS"] = "CALENDAR_SIX_MONTHS";
|
783
781
|
ValidityTypes["ONE_YEAR"] = "ONE_YEAR";
|
784
782
|
ValidityTypes["CALENDAR_YEAR"] = "CALENDAR_YEAR";
|
783
|
+
ValidityTypes["FIVE_SECONDS"] = "FIVE_SECONDS";
|
785
784
|
})(ValidityTypes = SubscriptionBooking.ValidityTypes || (SubscriptionBooking.ValidityTypes = {}));
|
786
785
|
})(SubscriptionBooking || (exports.SubscriptionBooking = SubscriptionBooking = {}));
|
@@ -426,11 +426,8 @@ var TplBooking = /** @class */ (function (_super) {
|
|
426
426
|
// Check for errors
|
427
427
|
if ((0, ErrorResponse_1.objectIsMTSErrorResponse)(response))
|
428
428
|
return response;
|
429
|
-
|
430
|
-
|
431
|
-
buyer: response.buyer,
|
432
|
-
passengers: null
|
433
|
-
};
|
429
|
+
// Return the response
|
430
|
+
return response;
|
434
431
|
})];
|
435
432
|
});
|
436
433
|
});
|
@@ -35,23 +35,30 @@ export type GetPersonRequest = {
|
|
35
35
|
personCode?: string;
|
36
36
|
phoneNumber?: string;
|
37
37
|
};
|
38
|
-
/**
|
39
|
-
* @description Represents a passenger in the response of the {@link Booking.getPassengersDetails} method. This type extends the {@link Person} type
|
40
|
-
* with the `outboundTariffs` and `returnTariffs` properties.
|
41
|
-
*
|
42
|
-
* @property {string} outboundNotes - The notes for the outbound trip.
|
43
|
-
* @property { Map<number, PassengerTariff>} outboundTariffs - A map containing the outbound tariffs for this passenger. The key is the trip id.
|
44
|
-
* For every trip, the first element the value is the suggested tariff. The other elements are the other tariffs, so that the user can adjust
|
45
|
-
* the tariff for the passenger.
|
46
|
-
* @property {string} returnNotes - The notes for the return trip.
|
47
|
-
* @property { Map<number, PassengerTariff>} returnTariffs - Same of `outboundTariffs`, but for the return trip.
|
48
|
-
*/
|
38
|
+
/** @description Represents a passenger in the response of the {@link Booking.getPassengersDetails} method. */
|
49
39
|
export type GetPassenger = Person & {
|
40
|
+
/** The notes for the outbound trip. */
|
50
41
|
outboundNotes: string | null;
|
42
|
+
/**
|
43
|
+
* A map containing the outbound tariffs for this passenger. The key is the trip id.
|
44
|
+
* For every trip, the first element the value is the suggested tariff. The other elements are the other tariffs, so that the user can adjust
|
45
|
+
* the tariff for the passenger.
|
46
|
+
* */
|
51
47
|
outboundTariffs: Map<number, PassengerTariff[]>;
|
48
|
+
/** The notes for the return trip. */
|
52
49
|
returnNotes: string | null;
|
50
|
+
/** Same of `outboundTariffs`, but for the return trip. */
|
53
51
|
returnTariffs: Map<number, PassengerTariff[]> | null;
|
52
|
+
/** Whether the passenger name and last name are required, optional or cannot be specified. */
|
53
|
+
passengerNameLastNameOption: PersonDataFieldStatus;
|
54
|
+
/** Whether the passenger email is required, optional or cannot be specified. */
|
55
|
+
passengerEmailOption: PersonDataFieldStatus;
|
56
|
+
/** Whether the passenger phone number is reuqired, optional or cannot be specified. */
|
57
|
+
passengerPhoneNumberOption: PersonDataFieldStatus;
|
58
|
+
/** Whether the passenger social security number is reuqired, optional or cannot be specified. */
|
59
|
+
passengerSSNOption: PersonDataFieldStatus;
|
54
60
|
};
|
61
|
+
/** @deprecated Use PersonDataFieldStatus */
|
55
62
|
export declare enum BuyerDataStatus {
|
56
63
|
/** The buyer data are optional. PersonDetails form shall be displayed, but the user can skip it. */
|
57
64
|
OPTIONAL = 0,
|
@@ -60,14 +67,28 @@ export declare enum BuyerDataStatus {
|
|
60
67
|
/** The buyer data cannot be specified. PersonDetails form shall not be displayed. */
|
61
68
|
CANNOT_BE_SPECIFIED = 2
|
62
69
|
}
|
63
|
-
|
64
|
-
|
65
|
-
|
70
|
+
export declare enum PersonDataFieldStatus {
|
71
|
+
/** The field (e.g. the buyer's email) is optional. The input shall be displayed, but the user can skip it. */
|
72
|
+
OPTIONAL = "OPTIONAL",
|
73
|
+
/** The field (e.g. the buyer's email) is required. the input shall be displayed and the user cannot skip it. */
|
74
|
+
REQUIRED = "REQUIRED",
|
75
|
+
/** The field (e.g. the buyer's email) cannot be specified. The input shall not be displayed. */
|
76
|
+
CANNOT_BE_SPECIFIED = "CANNOT_BE_SPECIFIED"
|
77
|
+
}
|
78
|
+
/** Represents the response of the {@link getBuyerPassengersDetails} method. */
|
66
79
|
export type GetBuyerPassengersDetailsResponse = {
|
67
|
-
/** Whether the form for the buyer data is required, optional or cannot be specified. */
|
80
|
+
/** @deprecated Whether the form for the buyer data is required, optional or cannot be specified. */
|
68
81
|
buyerDataStatus: BuyerDataStatus;
|
69
82
|
/** The {@link Person} object representing the buyer. */
|
70
83
|
buyer: PersonDetails | null;
|
84
|
+
/** Whether the buyer name and last name are required, optional or cannot be specified. */
|
85
|
+
buyerNameLastNameOption: PersonDataFieldStatus;
|
86
|
+
/** Whether the buyer email is required, optional or cannot be specified. */
|
87
|
+
buyerEmailOption: PersonDataFieldStatus;
|
88
|
+
/** Whether the buyer phone number is reuqired, optional or cannot be specified. */
|
89
|
+
buyerPhoneNumberOption: PersonDataFieldStatus;
|
90
|
+
/** Whether the buyer social security number is reuqired, optional or cannot be specified. */
|
91
|
+
buyerSSNOption: PersonDataFieldStatus;
|
71
92
|
/** An array of {@link GetPassenger} objects representing the passengers. */
|
72
93
|
passengers: GetPassenger[] | null;
|
73
94
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.BuyerDataStatus = exports.initializePerson = exports.DEFAULT_PERSON = void 0;
|
3
|
+
exports.PersonDataFieldStatus = exports.BuyerDataStatus = exports.initializePerson = exports.DEFAULT_PERSON = void 0;
|
4
4
|
exports.DEFAULT_PERSON = {
|
5
5
|
id: 0,
|
6
6
|
personCode: "",
|
@@ -16,6 +16,7 @@ var initializePerson = function (person) {
|
|
16
16
|
return person;
|
17
17
|
};
|
18
18
|
exports.initializePerson = initializePerson;
|
19
|
+
/** @deprecated Use PersonDataFieldStatus */
|
19
20
|
var BuyerDataStatus;
|
20
21
|
(function (BuyerDataStatus) {
|
21
22
|
/** The buyer data are optional. PersonDetails form shall be displayed, but the user can skip it. */
|
@@ -25,3 +26,12 @@ var BuyerDataStatus;
|
|
25
26
|
/** The buyer data cannot be specified. PersonDetails form shall not be displayed. */
|
26
27
|
BuyerDataStatus[BuyerDataStatus["CANNOT_BE_SPECIFIED"] = 2] = "CANNOT_BE_SPECIFIED";
|
27
28
|
})(BuyerDataStatus || (exports.BuyerDataStatus = BuyerDataStatus = {}));
|
29
|
+
var PersonDataFieldStatus;
|
30
|
+
(function (PersonDataFieldStatus) {
|
31
|
+
/** The field (e.g. the buyer's email) is optional. The input shall be displayed, but the user can skip it. */
|
32
|
+
PersonDataFieldStatus["OPTIONAL"] = "OPTIONAL";
|
33
|
+
/** The field (e.g. the buyer's email) is required. the input shall be displayed and the user cannot skip it. */
|
34
|
+
PersonDataFieldStatus["REQUIRED"] = "REQUIRED";
|
35
|
+
/** The field (e.g. the buyer's email) cannot be specified. The input shall not be displayed. */
|
36
|
+
PersonDataFieldStatus["CANNOT_BE_SPECIFIED"] = "CANNOT_BE_SPECIFIED";
|
37
|
+
})(PersonDataFieldStatus || (exports.PersonDataFieldStatus = PersonDataFieldStatus = {}));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mts-booking-library",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.4.0",
|
4
4
|
"description": "Library for using MyTicketSolution Booking API",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"types": "lib/index.d.ts",
|
@@ -22,7 +22,7 @@
|
|
22
22
|
"node-localstorage": "^3.0.5",
|
23
23
|
"prettier": "^3.3.3",
|
24
24
|
"ts-jest": "^29.2.5",
|
25
|
-
"typescript": "^5.
|
25
|
+
"typescript": "^5.7.2"
|
26
26
|
},
|
27
27
|
"files": [
|
28
28
|
"lib/**/*"
|
@@ -33,7 +33,7 @@
|
|
33
33
|
],
|
34
34
|
"author": "Infoservice s.r.l.",
|
35
35
|
"dependencies": {
|
36
|
-
"@react-native-async-storage/async-storage": "^2.
|
36
|
+
"@react-native-async-storage/async-storage": "^2.1.0",
|
37
37
|
"axios": "^1.7.7",
|
38
38
|
"zustand": "^4.5.5"
|
39
39
|
}
|