mts-booking-library 2.3.0 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/booking/booking.d.ts +5 -1
- package/lib/booking/booking.js +11 -9
- package/lib/booking/journeyBooking.d.ts +2 -2
- package/lib/booking/journeyBooking.js +6 -2
- package/lib/booking/serviceBooking.d.ts +2 -2
- package/lib/booking/serviceBooking.js +6 -2
- package/lib/booking/subscriptionBooking.d.ts +2 -2
- package/lib/booking/subscriptionBooking.js +6 -2
- package/lib/booking/tplBooking.d.ts +2 -2
- package/lib/booking/tplBooking.js +6 -2
- package/lib/config.d.ts +3 -1
- package/lib/config.js +4 -1
- package/lib/mtsStorage.js +1 -2
- package/package.json +1 -1
package/lib/booking/booking.d.ts
CHANGED
@@ -27,7 +27,7 @@ export declare abstract class Booking {
|
|
27
27
|
/**
|
28
28
|
* This is the constructor of the Booking class. See {@link Booking.BookingConfig} for more information.
|
29
29
|
*/
|
30
|
-
constructor({ env, subKey, bookingType, debug, language, sessionId, accessToken, sellerId, resellerId, dbType }: Omit<Booking.BookingConfig, "restoreState">);
|
30
|
+
constructor({ env, subKey, bookingType, debug, language, sessionId, accessToken, sellerId, resellerId, appVersion, os, dbType }: Omit<Booking.BookingConfig, "restoreState">);
|
31
31
|
/**
|
32
32
|
* This method allows to update the sellerId. It is mostly important for Linkavel, as we start with sellerId = 0
|
33
33
|
* but then it changes to the actual sellerId once the cart is created.
|
@@ -168,5 +168,9 @@ export declare namespace Booking {
|
|
168
168
|
resellerId?: number;
|
169
169
|
/** The type of the database, only for DEV environment */
|
170
170
|
dbType?: string | undefined;
|
171
|
+
/** If this library is used from the MTS App, this is the installed app version */
|
172
|
+
appVersion?: string;
|
173
|
+
/** If this library is used from the MTS App, this is the operating system (android or ios) */
|
174
|
+
os?: string;
|
171
175
|
};
|
172
176
|
}
|
package/lib/booking/booking.js
CHANGED
@@ -59,7 +59,7 @@ var Booking = /** @class */ (function () {
|
|
59
59
|
* This is the constructor of the Booking class. See {@link Booking.BookingConfig} for more information.
|
60
60
|
*/
|
61
61
|
function Booking(_a) {
|
62
|
-
var env = _a.env, subKey = _a.subKey, bookingType = _a.bookingType, debug = _a.debug, language = _a.language, sessionId = _a.sessionId, accessToken = _a.accessToken, sellerId = _a.sellerId, resellerId = _a.resellerId, dbType = _a.dbType;
|
62
|
+
var env = _a.env, subKey = _a.subKey, bookingType = _a.bookingType, debug = _a.debug, language = _a.language, sessionId = _a.sessionId, accessToken = _a.accessToken, sellerId = _a.sellerId, resellerId = _a.resellerId, appVersion = _a.appVersion, os = _a.os, dbType = _a.dbType;
|
63
63
|
this.language = Booking.Languages.EN;
|
64
64
|
this.selectedCurrency = Booking.Currencies.EUR;
|
65
65
|
/**
|
@@ -78,6 +78,8 @@ var Booking = /** @class */ (function () {
|
|
78
78
|
OCP_SUBSCRIPTION_KEY: subKey,
|
79
79
|
DEBUG: debug,
|
80
80
|
ACCESS_TOKEN: accessToken,
|
81
|
+
APP_VERSION: appVersion,
|
82
|
+
OS: os,
|
81
83
|
DB_TYPE: dbType,
|
82
84
|
SESSION_ID: sessionId
|
83
85
|
});
|
@@ -111,34 +113,34 @@ var Booking = /** @class */ (function () {
|
|
111
113
|
};
|
112
114
|
Booking.prototype.callGetApi = function (url, options) {
|
113
115
|
var _a, _b, _c, _d;
|
116
|
+
var config = (0, config_1.getConfig)();
|
114
117
|
// Add sellerId, resellerId and language to the query string.
|
115
118
|
// If the last character of the url is a question mark (meaning that the query string is empty), don't add the "&" character.
|
116
119
|
// Otherwise, add it (as we are adding some parameters to the query string)
|
117
|
-
var completeUrl = "".concat(url).concat(url.slice(-1) === "?" ? "" : "&").concat(new URLSearchParams(__assign({ sellerId: (_b = (_a = this.sellerId) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "0", resellerId: (_d = (_c = this.resellerId) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : "0", language: this.language }, (
|
118
|
-
(0, config_1.getConfig)().DB_TYPE && { databaseType: (0, config_1.getConfig)().DB_TYPE }))));
|
120
|
+
var completeUrl = "".concat(url).concat(url.slice(-1) === "?" ? "" : "&").concat(new URLSearchParams(__assign(__assign(__assign({ sellerId: (_b = (_a = this.sellerId) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "0", resellerId: (_d = (_c = this.resellerId) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : "0", language: this.language }, (config.OS && { os: config.OS })), (config.APP_VERSION && { version: config.APP_VERSION })), (config.ENV === config_1.MTSEnvs.DEV && config.DB_TYPE && { databaseType: config.DB_TYPE }))));
|
119
121
|
return (0, apiCall_1.makeGet)(completeUrl, options);
|
120
122
|
};
|
121
123
|
Booking.prototype.callPostApi = function (url, body, options) {
|
122
124
|
var _a, _b, _c, _d;
|
125
|
+
var config = (0, config_1.getConfig)();
|
123
126
|
// Add sellerId, resellerId and language to the query string
|
124
|
-
var completeBody = __assign(__assign(__assign({}, body), { sellerId: (_b = (_a = this.sellerId) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : 0, resellerId: (_d = (_c = this.resellerId) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : 0, language: this.language }), (
|
125
|
-
(0, config_1.getConfig)().DB_TYPE && { databaseType: (0, config_1.getConfig)().DB_TYPE }));
|
127
|
+
var completeBody = __assign(__assign(__assign(__assign(__assign({}, body), { sellerId: (_b = (_a = this.sellerId) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : 0, resellerId: (_d = (_c = this.resellerId) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : 0, language: this.language }), (config.OS && { os: config.OS })), (config.APP_VERSION && { version: config.APP_VERSION })), (config.ENV === config_1.MTSEnvs.DEV && config.DB_TYPE && { databaseType: config.DB_TYPE }));
|
126
128
|
return (0, apiCall_1.makePost)(url, completeBody, options);
|
127
129
|
};
|
128
130
|
Booking.prototype.callPutApi = function (url, body, options) {
|
129
131
|
var _a, _b, _c, _d;
|
132
|
+
var config = (0, config_1.getConfig)();
|
130
133
|
// Add sellerId, resellerId and language to the query string
|
131
|
-
var completeBody = __assign(__assign(__assign({}, body), { sellerId: (_b = (_a = this.sellerId) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : 0, resellerId: (_d = (_c = this.resellerId) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : 0, language: this.language }), (
|
132
|
-
(0, config_1.getConfig)().DB_TYPE && { databaseType: (0, config_1.getConfig)().DB_TYPE }));
|
134
|
+
var completeBody = __assign(__assign(__assign(__assign(__assign({}, body), { sellerId: (_b = (_a = this.sellerId) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : 0, resellerId: (_d = (_c = this.resellerId) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : 0, language: this.language }), (config.OS && { os: config.OS })), (config.APP_VERSION && { version: config.APP_VERSION })), (config.ENV === config_1.MTSEnvs.DEV && config.DB_TYPE && { databaseType: config.DB_TYPE }));
|
133
135
|
return (0, apiCall_1.makePut)(url, completeBody, options);
|
134
136
|
};
|
135
137
|
Booking.prototype.callDeleteApi = function (url, options) {
|
136
138
|
var _a, _b, _c, _d;
|
139
|
+
var config = (0, config_1.getConfig)();
|
137
140
|
// Add sellerId, resellerId and language to the query string.
|
138
141
|
// If the last character of the url is a question mark (meaning that the query string is empty), don't add the "&" character.
|
139
142
|
// Otherwise, add it (as we are adding some parameters to the query string)
|
140
|
-
var completeUrl = "".concat(url).concat(url.slice(-1) === "?" ? "" : "&").concat(new URLSearchParams(__assign({ sellerId: (_b = (_a = this.sellerId) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "0", resellerId: (_d = (_c = this.resellerId) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : "0", language: this.language }, (
|
141
|
-
(0, config_1.getConfig)().DB_TYPE && { databaseType: (0, config_1.getConfig)().DB_TYPE }))));
|
143
|
+
var completeUrl = "".concat(url).concat(url.slice(-1) === "?" ? "" : "&").concat(new URLSearchParams(__assign(__assign(__assign({ sellerId: (_b = (_a = this.sellerId) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "0", resellerId: (_d = (_c = this.resellerId) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : "0", language: this.language }, (config.OS && { os: config.OS })), (config.APP_VERSION && { version: config.APP_VERSION })), (config.ENV === config_1.MTSEnvs.DEV && config.DB_TYPE && { databaseType: config.DB_TYPE }))));
|
142
144
|
return (0, apiCall_1.makeDelete)(completeUrl, options);
|
143
145
|
};
|
144
146
|
Booking.prototype.getBookingStepsToStatus = function () {
|
@@ -13,7 +13,7 @@ export declare class JourneyBooking extends Booking {
|
|
13
13
|
/**
|
14
14
|
* This is the constructor of the JourneyBooking class. See {@link Booking.BookingConfig} for more information.
|
15
15
|
*/
|
16
|
-
constructor({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, dbType }: Omit<Booking.BookingConfig, "bookingType">);
|
16
|
+
constructor({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, appVersion, os, dbType }: Omit<Booking.BookingConfig, "bookingType">);
|
17
17
|
getCart(): JourneyCart | undefined;
|
18
18
|
getStorage(): import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<{
|
19
19
|
cartGuid: string | undefined;
|
@@ -173,5 +173,5 @@ export declare class JourneyBooking extends Booking {
|
|
173
173
|
useVoucher(voucherCode: string, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
|
174
174
|
}
|
175
175
|
export declare namespace JourneyBooking {
|
176
|
-
const createBooking: ({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, dbType }: Omit<Booking.BookingConfig, "bookingType">) => Promise<JourneyBooking>;
|
176
|
+
const createBooking: ({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, appVersion, os, dbType }: Omit<Booking.BookingConfig, "bookingType">) => Promise<JourneyBooking>;
|
177
177
|
}
|
@@ -85,7 +85,7 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
85
85
|
* This is the constructor of the JourneyBooking class. See {@link Booking.BookingConfig} for more information.
|
86
86
|
*/
|
87
87
|
function JourneyBooking(_a) {
|
88
|
-
var env = _a.env, subKey = _a.subKey, debug = _a.debug, language = _a.language, sessionId = _a.sessionId, restoreState = _a.restoreState, accessToken = _a.accessToken, sellerId = _a.sellerId, resellerId = _a.resellerId, dbType = _a.dbType;
|
88
|
+
var env = _a.env, subKey = _a.subKey, debug = _a.debug, language = _a.language, sessionId = _a.sessionId, restoreState = _a.restoreState, accessToken = _a.accessToken, sellerId = _a.sellerId, resellerId = _a.resellerId, appVersion = _a.appVersion, os = _a.os, dbType = _a.dbType;
|
89
89
|
// Call Booking constructor
|
90
90
|
var _this = _super.call(this, {
|
91
91
|
env: env,
|
@@ -97,6 +97,8 @@ var JourneyBooking = /** @class */ (function (_super) {
|
|
97
97
|
sessionId: sessionId,
|
98
98
|
sellerId: sellerId,
|
99
99
|
resellerId: resellerId,
|
100
|
+
appVersion: appVersion,
|
101
|
+
os: os,
|
100
102
|
dbType: dbType
|
101
103
|
}) || this;
|
102
104
|
// Set cartGuid
|
@@ -816,7 +818,7 @@ exports.JourneyBooking = JourneyBooking;
|
|
816
818
|
var _this = this;
|
817
819
|
JourneyBooking.createBooking = function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
818
820
|
var booking, error_1;
|
819
|
-
var env = _b.env, subKey = _b.subKey, debug = _b.debug, language = _b.language, sessionId = _b.sessionId, restoreState = _b.restoreState, accessToken = _b.accessToken, sellerId = _b.sellerId, resellerId = _b.resellerId, dbType = _b.dbType;
|
821
|
+
var env = _b.env, subKey = _b.subKey, debug = _b.debug, language = _b.language, sessionId = _b.sessionId, restoreState = _b.restoreState, accessToken = _b.accessToken, sellerId = _b.sellerId, resellerId = _b.resellerId, appVersion = _b.appVersion, os = _b.os, dbType = _b.dbType;
|
820
822
|
return __generator(this, function (_c) {
|
821
823
|
switch (_c.label) {
|
822
824
|
case 0:
|
@@ -830,6 +832,8 @@ exports.JourneyBooking = JourneyBooking;
|
|
830
832
|
sessionId: sessionId,
|
831
833
|
sellerId: sellerId,
|
832
834
|
resellerId: resellerId,
|
835
|
+
appVersion: appVersion,
|
836
|
+
os: os,
|
833
837
|
dbType: dbType
|
834
838
|
});
|
835
839
|
_c.label = 1;
|
@@ -11,7 +11,7 @@ export declare class ServiceBooking extends Booking {
|
|
11
11
|
/**
|
12
12
|
* This is the constructor of the ServiceBooking class. See {@link Booking.BookingConfig} for more information.
|
13
13
|
*/
|
14
|
-
constructor({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, dbType }: Omit<Booking.BookingConfig, "bookingType">);
|
14
|
+
constructor({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, appVersion, os, dbType }: Omit<Booking.BookingConfig, "bookingType">);
|
15
15
|
getStorage(): import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<{
|
16
16
|
cartGuid: string | undefined;
|
17
17
|
} & {
|
@@ -147,5 +147,5 @@ export declare class ServiceBooking extends Booking {
|
|
147
147
|
useVoucher(voucherCode: string, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
|
148
148
|
}
|
149
149
|
export declare namespace ServiceBooking {
|
150
|
-
const createBooking: ({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, dbType }: Omit<Booking.BookingConfig, "bookingType">) => Promise<ServiceBooking>;
|
150
|
+
const createBooking: ({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, appVersion, os, dbType }: Omit<Booking.BookingConfig, "bookingType">) => Promise<ServiceBooking>;
|
151
151
|
}
|
@@ -85,7 +85,7 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
85
85
|
* This is the constructor of the ServiceBooking class. See {@link Booking.BookingConfig} for more information.
|
86
86
|
*/
|
87
87
|
function ServiceBooking(_a) {
|
88
|
-
var env = _a.env, subKey = _a.subKey, debug = _a.debug, language = _a.language, sessionId = _a.sessionId, restoreState = _a.restoreState, accessToken = _a.accessToken, sellerId = _a.sellerId, resellerId = _a.resellerId, dbType = _a.dbType;
|
88
|
+
var env = _a.env, subKey = _a.subKey, debug = _a.debug, language = _a.language, sessionId = _a.sessionId, restoreState = _a.restoreState, accessToken = _a.accessToken, sellerId = _a.sellerId, resellerId = _a.resellerId, appVersion = _a.appVersion, os = _a.os, dbType = _a.dbType;
|
89
89
|
// Call Booking constructor
|
90
90
|
var _this = _super.call(this, {
|
91
91
|
env: env,
|
@@ -97,6 +97,8 @@ var ServiceBooking = /** @class */ (function (_super) {
|
|
97
97
|
sessionId: sessionId,
|
98
98
|
sellerId: sellerId,
|
99
99
|
resellerId: resellerId,
|
100
|
+
appVersion: appVersion,
|
101
|
+
os: os,
|
100
102
|
dbType: dbType
|
101
103
|
}) || this;
|
102
104
|
// Set cartGuid
|
@@ -679,7 +681,7 @@ exports.ServiceBooking = ServiceBooking;
|
|
679
681
|
var _this = this;
|
680
682
|
ServiceBooking.createBooking = function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
681
683
|
var booking, error_1;
|
682
|
-
var env = _b.env, subKey = _b.subKey, debug = _b.debug, language = _b.language, sessionId = _b.sessionId, restoreState = _b.restoreState, accessToken = _b.accessToken, sellerId = _b.sellerId, resellerId = _b.resellerId, dbType = _b.dbType;
|
684
|
+
var env = _b.env, subKey = _b.subKey, debug = _b.debug, language = _b.language, sessionId = _b.sessionId, restoreState = _b.restoreState, accessToken = _b.accessToken, sellerId = _b.sellerId, resellerId = _b.resellerId, appVersion = _b.appVersion, os = _b.os, dbType = _b.dbType;
|
683
685
|
return __generator(this, function (_c) {
|
684
686
|
switch (_c.label) {
|
685
687
|
case 0:
|
@@ -693,6 +695,8 @@ exports.ServiceBooking = ServiceBooking;
|
|
693
695
|
sessionId: sessionId,
|
694
696
|
sellerId: sellerId,
|
695
697
|
resellerId: resellerId,
|
698
|
+
appVersion: appVersion,
|
699
|
+
os: os,
|
696
700
|
dbType: dbType
|
697
701
|
});
|
698
702
|
_c.label = 1;
|
@@ -12,7 +12,7 @@ export declare class SubscriptionBooking extends Booking {
|
|
12
12
|
/**
|
13
13
|
* This is the constructor of the ServiceBooking class. See {@link Booking.BookingConfig} for more information.
|
14
14
|
*/
|
15
|
-
constructor({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, dbType }: Omit<Booking.BookingConfig, "bookingType">);
|
15
|
+
constructor({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, appVersion, os, dbType }: Omit<Booking.BookingConfig, "bookingType">);
|
16
16
|
getStorage(): import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<{
|
17
17
|
cartGuid: string | undefined;
|
18
18
|
} & {
|
@@ -159,7 +159,7 @@ export declare class SubscriptionBooking extends Booking {
|
|
159
159
|
useVoucher(voucherCode: string, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
|
160
160
|
}
|
161
161
|
export declare namespace SubscriptionBooking {
|
162
|
-
const createBooking: ({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, dbType }: Omit<Booking.BookingConfig, "bookingType">) => Promise<SubscriptionBooking>;
|
162
|
+
const createBooking: ({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, appVersion, os, dbType }: Omit<Booking.BookingConfig, "bookingType">) => Promise<SubscriptionBooking>;
|
163
163
|
enum ValidityTypes {
|
164
164
|
WORKING_WEEK = "WORKING_WEEK",
|
165
165
|
ONE_WEEK = "ONE_WEEK",
|
@@ -85,7 +85,7 @@ var SubscriptionBooking = /** @class */ (function (_super) {
|
|
85
85
|
* This is the constructor of the ServiceBooking class. See {@link Booking.BookingConfig} for more information.
|
86
86
|
*/
|
87
87
|
function SubscriptionBooking(_a) {
|
88
|
-
var env = _a.env, subKey = _a.subKey, debug = _a.debug, language = _a.language, sessionId = _a.sessionId, restoreState = _a.restoreState, accessToken = _a.accessToken, sellerId = _a.sellerId, resellerId = _a.resellerId, dbType = _a.dbType;
|
88
|
+
var env = _a.env, subKey = _a.subKey, debug = _a.debug, language = _a.language, sessionId = _a.sessionId, restoreState = _a.restoreState, accessToken = _a.accessToken, sellerId = _a.sellerId, resellerId = _a.resellerId, appVersion = _a.appVersion, os = _a.os, dbType = _a.dbType;
|
89
89
|
// Call Booking constructor
|
90
90
|
var _this = _super.call(this, {
|
91
91
|
env: env,
|
@@ -97,6 +97,8 @@ var SubscriptionBooking = /** @class */ (function (_super) {
|
|
97
97
|
sessionId: sessionId,
|
98
98
|
sellerId: sellerId,
|
99
99
|
resellerId: resellerId,
|
100
|
+
appVersion: appVersion,
|
101
|
+
os: os,
|
100
102
|
dbType: dbType
|
101
103
|
}) || this;
|
102
104
|
// Set cartGuid
|
@@ -728,7 +730,7 @@ exports.SubscriptionBooking = SubscriptionBooking;
|
|
728
730
|
var _this = this;
|
729
731
|
SubscriptionBooking.createBooking = function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
730
732
|
var booking, error_1;
|
731
|
-
var env = _b.env, subKey = _b.subKey, debug = _b.debug, language = _b.language, sessionId = _b.sessionId, restoreState = _b.restoreState, accessToken = _b.accessToken, sellerId = _b.sellerId, resellerId = _b.resellerId, dbType = _b.dbType;
|
733
|
+
var env = _b.env, subKey = _b.subKey, debug = _b.debug, language = _b.language, sessionId = _b.sessionId, restoreState = _b.restoreState, accessToken = _b.accessToken, sellerId = _b.sellerId, resellerId = _b.resellerId, appVersion = _b.appVersion, os = _b.os, dbType = _b.dbType;
|
732
734
|
return __generator(this, function (_c) {
|
733
735
|
switch (_c.label) {
|
734
736
|
case 0:
|
@@ -742,6 +744,8 @@ exports.SubscriptionBooking = SubscriptionBooking;
|
|
742
744
|
sessionId: sessionId,
|
743
745
|
sellerId: sellerId,
|
744
746
|
resellerId: resellerId,
|
747
|
+
appVersion: appVersion,
|
748
|
+
os: os,
|
745
749
|
dbType: dbType
|
746
750
|
});
|
747
751
|
_c.label = 1;
|
@@ -14,7 +14,7 @@ export declare class TplBooking extends Booking {
|
|
14
14
|
/**
|
15
15
|
* This is the constructor of the TplBooking class. See {@link Booking.BookingConfig} for more information.
|
16
16
|
*/
|
17
|
-
constructor({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, dbType }: Omit<Booking.BookingConfig, "bookingType">);
|
17
|
+
constructor({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, appVersion, os, dbType }: Omit<Booking.BookingConfig, "bookingType">);
|
18
18
|
getStorage(): import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<{
|
19
19
|
cartGuid: string | undefined;
|
20
20
|
} & {
|
@@ -161,5 +161,5 @@ export declare class TplBooking extends Booking {
|
|
161
161
|
useVoucher(voucherCode: string, options?: ApiCallOptions): Promise<ErrorResponse | boolean>;
|
162
162
|
}
|
163
163
|
export declare namespace TplBooking {
|
164
|
-
const createBooking: ({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, dbType }: Omit<Booking.BookingConfig, "bookingType">) => Promise<TplBooking>;
|
164
|
+
const createBooking: ({ env, subKey, debug, language, sessionId, restoreState, accessToken, sellerId, resellerId, appVersion, os, dbType }: Omit<Booking.BookingConfig, "bookingType">) => Promise<TplBooking>;
|
165
165
|
}
|
@@ -85,7 +85,7 @@ var TplBooking = /** @class */ (function (_super) {
|
|
85
85
|
* This is the constructor of the TplBooking class. See {@link Booking.BookingConfig} for more information.
|
86
86
|
*/
|
87
87
|
function TplBooking(_a) {
|
88
|
-
var env = _a.env, subKey = _a.subKey, debug = _a.debug, language = _a.language, sessionId = _a.sessionId, restoreState = _a.restoreState, accessToken = _a.accessToken, sellerId = _a.sellerId, resellerId = _a.resellerId, dbType = _a.dbType;
|
88
|
+
var env = _a.env, subKey = _a.subKey, debug = _a.debug, language = _a.language, sessionId = _a.sessionId, restoreState = _a.restoreState, accessToken = _a.accessToken, sellerId = _a.sellerId, resellerId = _a.resellerId, appVersion = _a.appVersion, os = _a.os, dbType = _a.dbType;
|
89
89
|
// Call Booking constructor
|
90
90
|
var _this = _super.call(this, {
|
91
91
|
env: env,
|
@@ -97,6 +97,8 @@ var TplBooking = /** @class */ (function (_super) {
|
|
97
97
|
sessionId: sessionId,
|
98
98
|
sellerId: sellerId,
|
99
99
|
resellerId: resellerId,
|
100
|
+
appVersion: appVersion,
|
101
|
+
os: os,
|
100
102
|
dbType: dbType
|
101
103
|
}) || this;
|
102
104
|
// Set cartGuid
|
@@ -744,7 +746,7 @@ exports.TplBooking = TplBooking;
|
|
744
746
|
var _this = this;
|
745
747
|
TplBooking.createBooking = function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
746
748
|
var booking, error_1;
|
747
|
-
var env = _b.env, subKey = _b.subKey, debug = _b.debug, language = _b.language, sessionId = _b.sessionId, restoreState = _b.restoreState, accessToken = _b.accessToken, sellerId = _b.sellerId, resellerId = _b.resellerId, dbType = _b.dbType;
|
749
|
+
var env = _b.env, subKey = _b.subKey, debug = _b.debug, language = _b.language, sessionId = _b.sessionId, restoreState = _b.restoreState, accessToken = _b.accessToken, sellerId = _b.sellerId, resellerId = _b.resellerId, appVersion = _b.appVersion, os = _b.os, dbType = _b.dbType;
|
748
750
|
return __generator(this, function (_c) {
|
749
751
|
switch (_c.label) {
|
750
752
|
case 0:
|
@@ -758,6 +760,8 @@ exports.TplBooking = TplBooking;
|
|
758
760
|
sessionId: sessionId,
|
759
761
|
sellerId: sellerId,
|
760
762
|
resellerId: resellerId,
|
763
|
+
appVersion: appVersion,
|
764
|
+
os: os,
|
761
765
|
dbType: dbType
|
762
766
|
});
|
763
767
|
_c.label = 1;
|
package/lib/config.d.ts
CHANGED
@@ -10,8 +10,10 @@ export type MTSConfig = {
|
|
10
10
|
OCP_SUBSCRIPTION_KEY: string;
|
11
11
|
ACCESS_TOKEN: string | undefined;
|
12
12
|
DEBUG: boolean;
|
13
|
+
APP_VERSION?: string;
|
14
|
+
OS?: string;
|
13
15
|
DB_TYPE?: string | undefined;
|
14
16
|
SESSION_ID?: number | undefined;
|
15
17
|
};
|
16
|
-
export declare const setConfig: ({ ENV, OCP_SUBSCRIPTION_KEY, DEBUG, ACCESS_TOKEN, DB_TYPE, SESSION_ID }: Omit<MTSConfig, "API_ENDPOINT">) => MTSConfig;
|
18
|
+
export declare const setConfig: ({ ENV, OCP_SUBSCRIPTION_KEY, DEBUG, ACCESS_TOKEN, APP_VERSION, OS, DB_TYPE, SESSION_ID }: Omit<MTSConfig, "API_ENDPOINT">) => MTSConfig;
|
17
19
|
export declare const getConfig: () => MTSConfig;
|
package/lib/config.js
CHANGED
@@ -16,7 +16,7 @@ var config = {
|
|
16
16
|
DEBUG: false
|
17
17
|
};
|
18
18
|
var setConfig = function (_a) {
|
19
|
-
var ENV = _a.ENV, OCP_SUBSCRIPTION_KEY = _a.OCP_SUBSCRIPTION_KEY, DEBUG = _a.DEBUG, ACCESS_TOKEN = _a.ACCESS_TOKEN, DB_TYPE = _a.DB_TYPE, SESSION_ID = _a.SESSION_ID;
|
19
|
+
var ENV = _a.ENV, OCP_SUBSCRIPTION_KEY = _a.OCP_SUBSCRIPTION_KEY, DEBUG = _a.DEBUG, ACCESS_TOKEN = _a.ACCESS_TOKEN, APP_VERSION = _a.APP_VERSION, OS = _a.OS, DB_TYPE = _a.DB_TYPE, SESSION_ID = _a.SESSION_ID;
|
20
20
|
config.DB_TYPE = undefined;
|
21
21
|
// First, set the environment
|
22
22
|
config.ENV = ENV.toUpperCase();
|
@@ -41,6 +41,9 @@ var setConfig = function (_a) {
|
|
41
41
|
// Set debug
|
42
42
|
config.DEBUG = DEBUG;
|
43
43
|
config.SESSION_ID = SESSION_ID;
|
44
|
+
// Set app variables
|
45
|
+
config.OS = OS;
|
46
|
+
config.APP_VERSION = APP_VERSION;
|
44
47
|
return config;
|
45
48
|
};
|
46
49
|
exports.setConfig = setConfig;
|
package/lib/mtsStorage.js
CHANGED
@@ -44,8 +44,7 @@ var useMtsBookingState = function () {
|
|
44
44
|
exports.useMtsBookingState = useMtsBookingState;
|
45
45
|
var useTestState = function () {
|
46
46
|
if (typeof localStorage === "undefined" || localStorage === null) {
|
47
|
-
|
48
|
-
global.localStorage = new LocalStorage("./scratch");
|
47
|
+
throw new Error("localStorage is not available");
|
49
48
|
}
|
50
49
|
return useMtsBookingLocalState;
|
51
50
|
};
|