mts-booking-library 1.3.7 → 1.3.9
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/journeyBooking.d.ts +3 -2
- package/lib/booking/journeyBooking.js +6 -4
- package/lib/booking/serviceBooking.d.ts +3 -2
- package/lib/booking/serviceBooking.js +6 -4
- package/lib/booking/subscriptionBooking.d.ts +3 -2
- package/lib/booking/subscriptionBooking.js +6 -4
- package/lib/booking/tplBooking.d.ts +3 -2
- package/lib/booking/tplBooking.js +6 -4
- package/lib/types/services/ServiceInfo.d.ts +2 -0
- package/package.json +1 -1
@@ -15,11 +15,12 @@ export declare class JourneyBooking extends Booking {
|
|
15
15
|
* @param {string} sub_key The subscription key for using the APIs
|
16
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
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 {boolean} [restoreState=true] If true, the app will try to restore the state of the booking, reading the cartId from the mts-storage
|
18
19
|
* @param {string} [access_token=undefined] The access token for calling MTS APIs
|
19
20
|
* @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
|
20
21
|
* @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
|
+
constructor(env: MTSEnvs, sub_key: string, debug?: boolean, language?: string, restoreState?: boolean, access_token?: string, sellerId?: number, resellerId?: number);
|
23
24
|
getCart(): JourneyCart | undefined;
|
24
25
|
getStorage(): import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<{
|
25
26
|
cartId: number | undefined;
|
@@ -182,5 +183,5 @@ export declare class JourneyBooking extends Booking {
|
|
182
183
|
useVoucher(voucherCode: string): Promise<ErrorResponse | boolean>;
|
183
184
|
}
|
184
185
|
export declare namespace JourneyBooking {
|
185
|
-
const createBooking: (env: MTSEnvs, sub_key: string, debug: boolean, language: string, access_token?: string, sellerId?: number, resellerId?: number) => Promise<JourneyBooking>;
|
186
|
+
const createBooking: (env: MTSEnvs, sub_key: string, debug: boolean, language: string, restoreState: boolean, access_token?: string, sellerId?: number, resellerId?: number) => Promise<JourneyBooking>;
|
186
187
|
}
|
@@ -86,18 +86,20 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
86
86
|
* @param {string} sub_key The subscription key for using the APIs
|
87
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
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 {boolean} [restoreState=true] If true, the app will try to restore the state of the booking, reading the cartId from the mts-storage
|
89
90
|
* @param {string} [access_token=undefined] The access token for calling MTS APIs
|
90
91
|
* @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
|
91
92
|
* @param {number} [resellerId=undefined] The id of the reseller.
|
92
93
|
*/
|
93
|
-
function JourneyBooking(env, sub_key, debug, language, access_token, sellerId, resellerId) {
|
94
|
+
function JourneyBooking(env, sub_key, debug, language, restoreState, access_token, sellerId, resellerId) {
|
94
95
|
if (debug === void 0) { debug = false; }
|
95
96
|
if (language === void 0) { language = booking_1.Booking.Languages.EN; }
|
97
|
+
if (restoreState === void 0) { restoreState = true; }
|
96
98
|
// Call Booking constructor
|
97
99
|
var _this = _super.call(this, env, sub_key, booking_1.Booking.BookingTypes.MLP, debug, language, access_token, sellerId, resellerId) || this;
|
98
100
|
// Set cartId
|
99
101
|
var cartId = _this.getStorage().getState().cartId;
|
100
|
-
if (cartId) {
|
102
|
+
if (cartId && restoreState) {
|
101
103
|
_this.cartId = cartId;
|
102
104
|
}
|
103
105
|
return _this;
|
@@ -791,12 +793,12 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
791
793
|
exports.JourneyBooking = JourneyBooking;
|
792
794
|
(function (JourneyBooking) {
|
793
795
|
var _this = this;
|
794
|
-
JourneyBooking.createBooking = function (env, sub_key, debug, language, access_token, sellerId, resellerId) { return __awaiter(_this, void 0, void 0, function () {
|
796
|
+
JourneyBooking.createBooking = function (env, sub_key, debug, language, restoreState, access_token, sellerId, resellerId) { return __awaiter(_this, void 0, void 0, function () {
|
795
797
|
var booking, error_1;
|
796
798
|
return __generator(this, function (_a) {
|
797
799
|
switch (_a.label) {
|
798
800
|
case 0:
|
799
|
-
booking = new JourneyBooking(env, sub_key, debug, language, access_token, sellerId, resellerId);
|
801
|
+
booking = new JourneyBooking(env, sub_key, debug, language, restoreState, access_token, sellerId, resellerId);
|
800
802
|
_a.label = 1;
|
801
803
|
case 1:
|
802
804
|
_a.trys.push([1, 4, , 5]);
|
@@ -13,11 +13,12 @@ export declare class ServiceBooking extends Booking {
|
|
13
13
|
* @param {string} sub_key The subscription key for using the APIs
|
14
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
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 {boolean} [restoreState=true] If true, the app will try to restore the state of the booking, reading the cartId from the mts-storage
|
16
17
|
* @param {string} [access_token=undefined] The access token for calling MTS APIs
|
17
18
|
* @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
|
18
19
|
* @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
|
+
constructor(env: MTSEnvs, sub_key: string, debug?: boolean, language?: string, restoreState?: boolean, access_token?: string, sellerId?: number, resellerId?: number);
|
21
22
|
getStorage(): import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<{
|
22
23
|
cartId: number | undefined;
|
23
24
|
} & {
|
@@ -156,5 +157,5 @@ export declare class ServiceBooking extends Booking {
|
|
156
157
|
useVoucher(voucherCode: string): Promise<ErrorResponse | boolean>;
|
157
158
|
}
|
158
159
|
export declare namespace ServiceBooking {
|
159
|
-
const createBooking: (env: MTSEnvs, sub_key: string, debug: boolean, language: string, access_token?: string, sellerId?: number, resellerId?: number) => Promise<ServiceBooking>;
|
160
|
+
const createBooking: (env: MTSEnvs, sub_key: string, debug: boolean, language: string, restoreState: boolean, access_token?: string, sellerId?: number, resellerId?: number) => Promise<ServiceBooking>;
|
160
161
|
}
|
@@ -86,18 +86,20 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
86
86
|
* @param {string} sub_key The subscription key for using the APIs
|
87
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
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 {boolean} [restoreState=true] If true, the app will try to restore the state of the booking, reading the cartId from the mts-storage
|
89
90
|
* @param {string} [access_token=undefined] The access token for calling MTS APIs
|
90
91
|
* @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
|
91
92
|
* @param {number} [resellerId=undefined] The id of the reseller.
|
92
93
|
*/
|
93
|
-
function ServiceBooking(env, sub_key, debug, language, access_token, sellerId, resellerId) {
|
94
|
+
function ServiceBooking(env, sub_key, debug, language, restoreState, access_token, sellerId, resellerId) {
|
94
95
|
if (debug === void 0) { debug = false; }
|
95
96
|
if (language === void 0) { language = booking_1.Booking.Languages.EN; }
|
97
|
+
if (restoreState === void 0) { restoreState = true; }
|
96
98
|
// Call Booking constructor
|
97
99
|
var _this = _super.call(this, env, sub_key, booking_1.Booking.BookingTypes.SERVICE, debug, language, access_token, sellerId, resellerId) || this;
|
98
100
|
// Set cartId
|
99
101
|
var cartId = _this.getStorage().getState().cartId;
|
100
|
-
if (cartId) {
|
102
|
+
if (cartId && restoreState) {
|
101
103
|
_this.cartId = cartId;
|
102
104
|
}
|
103
105
|
return _this;
|
@@ -655,12 +657,12 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
655
657
|
exports.ServiceBooking = ServiceBooking;
|
656
658
|
(function (ServiceBooking) {
|
657
659
|
var _this = this;
|
658
|
-
ServiceBooking.createBooking = function (env, sub_key, debug, language, access_token, sellerId, resellerId) { return __awaiter(_this, void 0, void 0, function () {
|
660
|
+
ServiceBooking.createBooking = function (env, sub_key, debug, language, restoreState, access_token, sellerId, resellerId) { return __awaiter(_this, void 0, void 0, function () {
|
659
661
|
var booking, error_1;
|
660
662
|
return __generator(this, function (_a) {
|
661
663
|
switch (_a.label) {
|
662
664
|
case 0:
|
663
|
-
booking = new ServiceBooking(env, sub_key, debug, language, access_token, sellerId, resellerId);
|
665
|
+
booking = new ServiceBooking(env, sub_key, debug, language, restoreState, access_token, sellerId, resellerId);
|
664
666
|
_a.label = 1;
|
665
667
|
case 1:
|
666
668
|
_a.trys.push([1, 4, , 5]);
|
@@ -14,11 +14,12 @@ export declare class SubscriptionBooking extends Booking {
|
|
14
14
|
* @param {string} sub_key The subscription key for using the APIs
|
15
15
|
* @param {boolean} [debug=false] If true, the app will run in debug mode (meaning that will print requests and responses in the console)
|
16
16
|
* @param {string} [language=Booking.Languages.EN] The language in which the app is running. Can be "it", "en", "fr", "de" or "es"
|
17
|
+
* @param {boolean} [restoreState=true] If true, the app will try to restore the state of the booking, reading the cartId from the mts-storage
|
17
18
|
* @param {string} [access_token=undefined] The access token for calling MTS APIs
|
18
19
|
* @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
|
19
20
|
* @param {number} [resellerId=undefined] The id of the reseller.
|
20
21
|
*/
|
21
|
-
constructor(env: MTSEnvs, sub_key: string, debug?: boolean, language?: string, access_token?: string, sellerId?: number, resellerId?: number);
|
22
|
+
constructor(env: MTSEnvs, sub_key: string, debug?: boolean, language?: string, restoreState?: boolean, access_token?: string, sellerId?: number, resellerId?: number);
|
22
23
|
getStorage(): import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<{
|
23
24
|
cartId: number | undefined;
|
24
25
|
} & {
|
@@ -174,7 +175,7 @@ export declare class SubscriptionBooking extends Booking {
|
|
174
175
|
useVoucher(voucherCode: string): Promise<ErrorResponse | boolean>;
|
175
176
|
}
|
176
177
|
export declare namespace SubscriptionBooking {
|
177
|
-
const createBooking: (env: MTSEnvs, sub_key: string, debug: boolean, language: string, access_token?: string, sellerId?: number, resellerId?: number) => Promise<SubscriptionBooking>;
|
178
|
+
const createBooking: (env: MTSEnvs, sub_key: string, debug: boolean, language: string, restoreState: boolean, access_token?: string, sellerId?: number, resellerId?: number) => Promise<SubscriptionBooking>;
|
178
179
|
enum ValidityTypes {
|
179
180
|
WORKING_WEEK = "WORKING_WEEK",
|
180
181
|
ONE_WEEK = "ONE_WEEK",
|
@@ -86,18 +86,20 @@ var SubscriptionBooking = /** @class */ (function (_super) {
|
|
86
86
|
* @param {string} sub_key The subscription key for using the APIs
|
87
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
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 {boolean} [restoreState=true] If true, the app will try to restore the state of the booking, reading the cartId from the mts-storage
|
89
90
|
* @param {string} [access_token=undefined] The access token for calling MTS APIs
|
90
91
|
* @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
|
91
92
|
* @param {number} [resellerId=undefined] The id of the reseller.
|
92
93
|
*/
|
93
|
-
function SubscriptionBooking(env, sub_key, debug, language, access_token, sellerId, resellerId) {
|
94
|
+
function SubscriptionBooking(env, sub_key, debug, language, restoreState, access_token, sellerId, resellerId) {
|
94
95
|
if (debug === void 0) { debug = false; }
|
95
96
|
if (language === void 0) { language = booking_1.Booking.Languages.EN; }
|
97
|
+
if (restoreState === void 0) { restoreState = true; }
|
96
98
|
// Call Booking constructor
|
97
99
|
var _this = _super.call(this, env, sub_key, booking_1.Booking.BookingTypes.MLP_SUBSCRIPTION, debug, language, access_token, sellerId, resellerId) || this;
|
98
100
|
// Set cartId
|
99
101
|
var cartId = _this.getStorage().getState().cartId;
|
100
|
-
if (cartId) {
|
102
|
+
if (cartId && restoreState) {
|
101
103
|
_this.cartId = cartId;
|
102
104
|
}
|
103
105
|
return _this;
|
@@ -736,12 +738,12 @@ var SubscriptionBooking = /** @class */ (function (_super) {
|
|
736
738
|
exports.SubscriptionBooking = SubscriptionBooking;
|
737
739
|
(function (SubscriptionBooking) {
|
738
740
|
var _this = this;
|
739
|
-
SubscriptionBooking.createBooking = function (env, sub_key, debug, language, access_token, sellerId, resellerId) { return __awaiter(_this, void 0, void 0, function () {
|
741
|
+
SubscriptionBooking.createBooking = function (env, sub_key, debug, language, restoreState, access_token, sellerId, resellerId) { return __awaiter(_this, void 0, void 0, function () {
|
740
742
|
var booking, error_1;
|
741
743
|
return __generator(this, function (_a) {
|
742
744
|
switch (_a.label) {
|
743
745
|
case 0:
|
744
|
-
booking = new SubscriptionBooking(env, sub_key, debug, language, access_token, sellerId, resellerId);
|
746
|
+
booking = new SubscriptionBooking(env, sub_key, debug, language, restoreState, access_token, sellerId, resellerId);
|
745
747
|
_a.label = 1;
|
746
748
|
case 1:
|
747
749
|
_a.trys.push([1, 4, , 5]);
|
@@ -16,11 +16,12 @@ export declare class TplBooking extends Booking {
|
|
16
16
|
* @param {string} sub_key The subscription key for using the APIs
|
17
17
|
* @param {boolean} [debug=false] If true, the app will run in debug mode (meaning that will print requests and responses in the console)
|
18
18
|
* @param {string} [language=Booking.Languages.EN] The language in which the app is running. Can be "it", "en", "fr", "de" or "es"
|
19
|
+
* @param {boolean} [restoreState=true] If true, the app will try to restore the state of the booking, reading the cartId from the mts-storage
|
19
20
|
* @param {string} [access_token=undefined] The access token for calling MTS APIs
|
20
21
|
* @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
|
21
22
|
* @param {number} [resellerId=undefined] The id of the reseller.
|
22
23
|
*/
|
23
|
-
constructor(env: MTSEnvs, sub_key: string, debug?: boolean, language?: string, access_token?: string, sellerId?: number, resellerId?: number);
|
24
|
+
constructor(env: MTSEnvs, sub_key: string, debug?: boolean, language?: string, restoreState?: boolean, access_token?: string, sellerId?: number, resellerId?: number);
|
24
25
|
getStorage(): import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<{
|
25
26
|
cartId: number | undefined;
|
26
27
|
} & {
|
@@ -169,5 +170,5 @@ export declare class TplBooking extends Booking {
|
|
169
170
|
useVoucher(voucherCode: string): Promise<ErrorResponse | boolean>;
|
170
171
|
}
|
171
172
|
export declare namespace TplBooking {
|
172
|
-
const createBooking: (env: MTSEnvs, sub_key: string, debug: boolean, language: string, access_token?: string, sellerId?: number, resellerId?: number) => Promise<TplBooking>;
|
173
|
+
const createBooking: (env: MTSEnvs, sub_key: string, debug: boolean, language: string, restoreState: boolean, access_token?: string, sellerId?: number, resellerId?: number) => Promise<TplBooking>;
|
173
174
|
}
|
@@ -86,18 +86,20 @@ var TplBooking = /** @class */ (function (_super) {
|
|
86
86
|
* @param {string} sub_key The subscription key for using the APIs
|
87
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
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 {boolean} [restoreState=true] If true, the app will try to restore the state of the booking, reading the cartId from the mts-storage
|
89
90
|
* @param {string} [access_token=undefined] The access token for calling MTS APIs
|
90
91
|
* @param {number} [sellerId=undefined] The id of the seller. If not set, it will return the results for all sellers
|
91
92
|
* @param {number} [resellerId=undefined] The id of the reseller.
|
92
93
|
*/
|
93
|
-
function TplBooking(env, sub_key, debug, language, access_token, sellerId, resellerId) {
|
94
|
+
function TplBooking(env, sub_key, debug, language, restoreState, access_token, sellerId, resellerId) {
|
94
95
|
if (debug === void 0) { debug = false; }
|
95
96
|
if (language === void 0) { language = booking_1.Booking.Languages.EN; }
|
97
|
+
if (restoreState === void 0) { restoreState = true; }
|
96
98
|
// Call Booking constructor
|
97
99
|
var _this = _super.call(this, env, sub_key, booking_1.Booking.BookingTypes.TPL, debug, language, access_token, sellerId, resellerId) || this;
|
98
100
|
// Set cartId
|
99
101
|
var cartId = _this.getStorage().getState().cartId;
|
100
|
-
if (cartId) {
|
102
|
+
if (cartId && restoreState) {
|
101
103
|
_this.cartId = cartId;
|
102
104
|
}
|
103
105
|
return _this;
|
@@ -697,12 +699,12 @@ var TplBooking = /** @class */ (function (_super) {
|
|
697
699
|
exports.TplBooking = TplBooking;
|
698
700
|
(function (TplBooking) {
|
699
701
|
var _this = this;
|
700
|
-
TplBooking.createBooking = function (env, sub_key, debug, language, access_token, sellerId, resellerId) { return __awaiter(_this, void 0, void 0, function () {
|
702
|
+
TplBooking.createBooking = function (env, sub_key, debug, language, restoreState, access_token, sellerId, resellerId) { return __awaiter(_this, void 0, void 0, function () {
|
701
703
|
var booking, error_1;
|
702
704
|
return __generator(this, function (_a) {
|
703
705
|
switch (_a.label) {
|
704
706
|
case 0:
|
705
|
-
booking = new TplBooking(env, sub_key, debug, language, access_token, sellerId, resellerId);
|
707
|
+
booking = new TplBooking(env, sub_key, debug, language, restoreState, access_token, sellerId, resellerId);
|
706
708
|
_a.label = 1;
|
707
709
|
case 1:
|
708
710
|
_a.trys.push([1, 4, , 5]);
|
@@ -2,12 +2,14 @@
|
|
2
2
|
* @description Represents information about a service.
|
3
3
|
*
|
4
4
|
* @property {string} sellerName - The name of the seller offering the service.
|
5
|
+
* @property {string} sellerId - The id of the seller offering the service.
|
5
6
|
* @property {string} minimumTotalPrice - The minimum total price for booking the service, meaning the price if all passenger choose the cheapest tariff.
|
6
7
|
* @property {string} bookingProcessMessage - Optional message to be displayed to the user when booking this service.
|
7
8
|
* @property {boolean} isBookable - Indicates whether the service is bookable (true) or not (false).
|
8
9
|
*/
|
9
10
|
export type ServiceInfo = {
|
10
11
|
sellerName: string;
|
12
|
+
sellerId: string;
|
11
13
|
minimumTotalPrice: string;
|
12
14
|
bookingProcessMessage: string;
|
13
15
|
isBookable: boolean;
|