@xsolla/payment-client-core 0.2.106 → 0.2.107
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/esm2022/lib/core/exceptions-handling/elk/elk-logger.service.mjs +1 -1
- package/esm2022/lib/core/exceptions-handling/logger/log-handler.interface.mjs +1 -1
- package/esm2022/lib/core/exceptions-handling/logger/logger.service.mjs +5 -1
- package/esm2022/lib/core/exceptions-handling/messages/index.mjs +3 -0
- package/esm2022/lib/core/exceptions-handling/messages/message-tags.enum.mjs +6 -0
- package/esm2022/lib/core/exceptions-handling/messages/tagged-message.class.mjs +16 -0
- package/esm2022/lib/core/performance/performance.service.mjs +8 -5
- package/esm2022/lib/core/web-socket/centrifugo-web-socket.service.mjs +3 -4
- package/esm2022/lib/core/web-socket/nchan-web-socket.service.mjs +19 -10
- package/esm2022/public-api.mjs +2 -1
- package/fesm2022/xsolla-payment-client-core.mjs +49 -16
- package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/exceptions-handling/elk/elk-logger.service.d.ts +4 -1
- package/lib/core/exceptions-handling/logger/log-handler.interface.d.ts +2 -0
- package/lib/core/exceptions-handling/logger/logger.service.d.ts +2 -0
- package/lib/core/exceptions-handling/messages/index.d.ts +2 -0
- package/lib/core/exceptions-handling/messages/message-tags.enum.d.ts +4 -0
- package/lib/core/exceptions-handling/messages/tagged-message.class.d.ts +9 -0
- package/lib/core/performance/performance.service.d.ts +1 -1
- package/lib/core/web-socket/nchan-web-socket.service.d.ts +3 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/xsolla-payment-client-core-0.2.107.tgz +0 -0
- package/xsolla-payment-client-core-0.2.106.tgz +0 -0
|
@@ -929,6 +929,10 @@ class LoggerService {
|
|
|
929
929
|
this.elkLoggerService.handleError(error);
|
|
930
930
|
this.handlers.forEach((handler) => handler.handleError(error));
|
|
931
931
|
}
|
|
932
|
+
info(info) {
|
|
933
|
+
this.elkLoggerService.log(info.message, info.tags, info.extra);
|
|
934
|
+
this.handlers.forEach((handler) => handler.handleInfo?.(info));
|
|
935
|
+
}
|
|
932
936
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LoggerService, deps: [{ token: ElkLoggerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
933
937
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LoggerService, providedIn: 'root' }); }
|
|
934
938
|
}
|
|
@@ -6085,19 +6089,41 @@ var WebSocketClientType;
|
|
|
6085
6089
|
WebSocketClientType["centrifugo"] = "centrifugo";
|
|
6086
6090
|
})(WebSocketClientType || (WebSocketClientType = {}));
|
|
6087
6091
|
|
|
6092
|
+
var MessageTags;
|
|
6093
|
+
(function (MessageTags) {
|
|
6094
|
+
MessageTags["WS"] = "webSocket";
|
|
6095
|
+
MessageTags["HEADLESS_UI"] = "headlessUi";
|
|
6096
|
+
})(MessageTags || (MessageTags = {}));
|
|
6097
|
+
|
|
6098
|
+
class TaggedMessage {
|
|
6099
|
+
constructor(message, tags, extra) {
|
|
6100
|
+
this.name = 'TaggedMessage';
|
|
6101
|
+
this.tags = [];
|
|
6102
|
+
this.parentTag = MessageTags.HEADLESS_UI;
|
|
6103
|
+
this.message = message;
|
|
6104
|
+
this.tags = [this.parentTag];
|
|
6105
|
+
if (tags) {
|
|
6106
|
+
const newTags = tags.filter((t, i, arr) => !this.tags.includes(t) && arr.indexOf(t) === i);
|
|
6107
|
+
this.tags = [...this.tags, ...newTags];
|
|
6108
|
+
}
|
|
6109
|
+
this.extra = extra || {};
|
|
6110
|
+
}
|
|
6111
|
+
}
|
|
6112
|
+
|
|
6088
6113
|
class NchanWebSocketService {
|
|
6089
|
-
|
|
6114
|
+
static { this.reconnectionTimeoutIncrementFactor = 2; }
|
|
6115
|
+
static { this.timeoutsMs = {
|
|
6116
|
+
reconnection: 1500,
|
|
6117
|
+
reconnectionMaxDeviation: 1500,
|
|
6118
|
+
}; }
|
|
6119
|
+
constructor(loggerService) {
|
|
6120
|
+
this.loggerService = loggerService;
|
|
6090
6121
|
this.type = WebSocketClientType.nchan;
|
|
6091
6122
|
this.openPromise = null;
|
|
6092
6123
|
this.reconnectionTimerId = null;
|
|
6093
6124
|
this.incomingMessages$ = new Subject();
|
|
6094
6125
|
this.successfulReconnectionEventsProxy$ = new Subject();
|
|
6095
6126
|
}
|
|
6096
|
-
static { this.reconnectionTimeoutIncrementFactor = 2; }
|
|
6097
|
-
static { this.timeoutsMs = {
|
|
6098
|
-
reconnection: 1500,
|
|
6099
|
-
reconnectionMaxDeviation: 1500,
|
|
6100
|
-
}; }
|
|
6101
6127
|
async open(url) {
|
|
6102
6128
|
if (url === this.url) {
|
|
6103
6129
|
this.close();
|
|
@@ -6166,7 +6192,13 @@ class NchanWebSocketService {
|
|
|
6166
6192
|
/* istanbul ignore next */
|
|
6167
6193
|
async createConnection() {
|
|
6168
6194
|
this.connection = new WebSocket(this.url);
|
|
6169
|
-
this.connection.onmessage =
|
|
6195
|
+
this.connection.onmessage = (event) => {
|
|
6196
|
+
const message = event.data;
|
|
6197
|
+
this.loggerService.info(new TaggedMessage(`websocket message received: ${message}`, [
|
|
6198
|
+
MessageTags.WS,
|
|
6199
|
+
]));
|
|
6200
|
+
this.incomingMessages$.next(event);
|
|
6201
|
+
};
|
|
6170
6202
|
return new Promise((resolve, reject) => {
|
|
6171
6203
|
this.connection.onopen = () => {
|
|
6172
6204
|
clearTimeout(this.openConnectionTimerId);
|
|
@@ -6199,7 +6231,7 @@ class NchanWebSocketService {
|
|
|
6199
6231
|
}
|
|
6200
6232
|
this.successfulReconnectionEventsProxy$.next();
|
|
6201
6233
|
}
|
|
6202
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NchanWebSocketService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
6234
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NchanWebSocketService, deps: [{ token: LoggerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
6203
6235
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NchanWebSocketService, providedIn: 'root' }); }
|
|
6204
6236
|
}
|
|
6205
6237
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NchanWebSocketService, decorators: [{
|
|
@@ -6207,7 +6239,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
6207
6239
|
args: [{
|
|
6208
6240
|
providedIn: 'root',
|
|
6209
6241
|
}]
|
|
6210
|
-
}] });
|
|
6242
|
+
}], ctorParameters: () => [{ type: LoggerService }] });
|
|
6211
6243
|
|
|
6212
6244
|
class WsError extends TaggedError {
|
|
6213
6245
|
constructor(message, channelName, tags) {
|
|
@@ -6337,9 +6369,7 @@ class CentrifugoWebSocketService {
|
|
|
6337
6369
|
})
|
|
6338
6370
|
.on('publication', (ctx) => {
|
|
6339
6371
|
const message = ctx.data;
|
|
6340
|
-
this.loggerService.
|
|
6341
|
-
channel: websocketChannel,
|
|
6342
|
-
}));
|
|
6372
|
+
this.loggerService.info(new TaggedMessage(`websocket message received: ${message}`, [MessageTags.WS], { channel: websocketChannel }));
|
|
6343
6373
|
this.incomingMessages$.next(ctx);
|
|
6344
6374
|
})
|
|
6345
6375
|
.on('error', (ctx) => {
|
|
@@ -8442,6 +8472,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
8442
8472
|
}] }] });
|
|
8443
8473
|
|
|
8444
8474
|
class PerformanceService {
|
|
8475
|
+
get resourcesPerformance() {
|
|
8476
|
+
return this.window.performance?.getEntriesByType('resource');
|
|
8477
|
+
}
|
|
8445
8478
|
get network() {
|
|
8446
8479
|
return this.navigationPerformance?.responseEnd;
|
|
8447
8480
|
}
|
|
@@ -8458,7 +8491,6 @@ class PerformanceService {
|
|
|
8458
8491
|
this.window = window;
|
|
8459
8492
|
this.zone = zone;
|
|
8460
8493
|
this.navigationPerformance = this.window.performance?.getEntriesByType('navigation')?.[0];
|
|
8461
|
-
this.resourcesPerformance = this.window.performance?.getEntriesByType('resource');
|
|
8462
8494
|
}
|
|
8463
8495
|
init() {
|
|
8464
8496
|
if (!this.window?.performance) {
|
|
@@ -8473,12 +8505,13 @@ class PerformanceService {
|
|
|
8473
8505
|
if (!this.navigationPerformance || !this.resourcesPerformance) {
|
|
8474
8506
|
return null;
|
|
8475
8507
|
}
|
|
8476
|
-
const utilsTiming = this.resourcesPerformance.find((performance) => performance.name.includes(`${defaultApiUrl}utils`)
|
|
8508
|
+
const utilsTiming = this.resourcesPerformance.find((performance) => performance.name.includes(`${defaultApiUrl}utils`) ||
|
|
8509
|
+
performance.name.includes(`${sandboxApiUrl}utils`));
|
|
8477
8510
|
if (!utilsTiming) {
|
|
8478
8511
|
return null;
|
|
8479
8512
|
}
|
|
8480
8513
|
return {
|
|
8481
|
-
duration: utilsTiming.
|
|
8514
|
+
duration: utilsTiming.responseEnd - utilsTiming.fetchStart,
|
|
8482
8515
|
timeReserve: this.navigationPerformance.domComplete - utilsTiming.responseEnd,
|
|
8483
8516
|
utilsDuration: utilsTiming.duration,
|
|
8484
8517
|
};
|
|
@@ -10673,5 +10706,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
10673
10706
|
* Generated bundle index. Do not edit.
|
|
10674
10707
|
*/
|
|
10675
10708
|
|
|
10676
|
-
export { ApplePayCartService, ApplePayService, CoreLibraryModule, CoreLibraryService, CreditCardTypes, ErrorTags, FieldNames, GooglePayService, PaymentSystemProcessingService, TaggedError, userBehaviourEventTypes };
|
|
10709
|
+
export { ApplePayCartService, ApplePayService, CoreLibraryModule, CoreLibraryService, CreditCardTypes, ErrorTags, FieldNames, GooglePayService, MessageTags, PaymentSystemProcessingService, TaggedError, TaggedMessage, userBehaviourEventTypes };
|
|
10677
10710
|
//# sourceMappingURL=xsolla-payment-client-core.mjs.map
|