@xsolla/payment-client-core 0.3.4 → 0.3.6
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/payment/actions/analytics/analytics-payload-creator.map.mjs +3 -0
- package/esm2022/lib/core/payment/actions/analytics/analytics-payload-creator.type.mjs +2 -0
- package/esm2022/lib/core/payment/actions/analytics/status-updated-analytics-payload-creator.mjs +13 -0
- package/esm2022/lib/core/payment/actions/next-action.service.mjs +7 -2
- package/esm2022/lib/core/payment/status/listen-status/listen-status.service.mjs +12 -2
- package/esm2022/lib/core/payment/status/status.service.mjs +7 -2
- package/esm2022/lib/core/payment/status/websocket-status/websocket-status.service.mjs +4 -1
- package/esm2022/lib/core/payment/three-ds/dfp-collect/dfp-collect.service.mjs +8 -12
- package/esm2022/lib/core/web-socket/centrifugo-web-socket.service.mjs +4 -1
- package/esm2022/lib/core/web-socket/nchan-web-socket.service.mjs +7 -1
- package/esm2022/lib/core/web-socket/web-socket.interface.mjs +1 -1
- package/fesm2022/xsolla-payment-client-core.mjs +56 -14
- package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/payment/actions/analytics/analytics-payload-creator.map.d.ts +2 -0
- package/lib/core/payment/actions/analytics/analytics-payload-creator.type.d.ts +3 -0
- package/lib/core/payment/actions/analytics/status-updated-analytics-payload-creator.d.ts +2 -0
- package/lib/core/payment/status/listen-status/listen-status.service.d.ts +3 -0
- package/lib/core/payment/status/status.service.d.ts +1 -0
- package/lib/core/payment/status/websocket-status/websocket-status.service.d.ts +1 -0
- package/lib/core/web-socket/centrifugo-web-socket.service.d.ts +1 -0
- package/lib/core/web-socket/nchan-web-socket.service.d.ts +1 -0
- package/lib/core/web-socket/web-socket.interface.d.ts +1 -0
- package/package.json +1 -1
- package/xsolla-payment-client-core-0.3.6.tgz +0 -0
- package/xsolla-payment-client-core-0.3.4.tgz +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2ViLXNvY2tldC5pbnRlcmZhY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9zcmMvbGliL2NvcmUvd2ViLXNvY2tldC93ZWItc29ja2V0LmludGVyZmFjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgT2JzZXJ2YWJsZSwgU3Vic2NyaXB0aW9uIH0gZnJvbSAncnhqcyc7XG5pbXBvcnQgeyBXZWJTb2NrZXRDbGllbnRUeXBlIH0gZnJvbSAnLi93ZWItc29ja2V0LWNsaWVudC10eXBlLmVudW0nO1xuXG5leHBvcnQgaW50ZXJmYWNlIFdlYlNvY2tldENsaWVudCB7XG4gIHR5cGU6IFdlYlNvY2tldENsaWVudFR5cGU7XG4gIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tZXhwbGljaXQtYW55XG4gIG9wZW4odXJsPzogc3RyaW5nLCBjaGFubmVsPzogc3RyaW5nKTogUHJvbWlzZTxhbnk+
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2ViLXNvY2tldC5pbnRlcmZhY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9zcmMvbGliL2NvcmUvd2ViLXNvY2tldC93ZWItc29ja2V0LmludGVyZmFjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgT2JzZXJ2YWJsZSwgU3Vic2NyaXB0aW9uIH0gZnJvbSAncnhqcyc7XG5pbXBvcnQgeyBXZWJTb2NrZXRDbGllbnRUeXBlIH0gZnJvbSAnLi93ZWItc29ja2V0LWNsaWVudC10eXBlLmVudW0nO1xuXG5leHBvcnQgaW50ZXJmYWNlIFdlYlNvY2tldENsaWVudCB7XG4gIHR5cGU6IFdlYlNvY2tldENsaWVudFR5cGU7XG4gIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tZXhwbGljaXQtYW55XG4gIG9wZW4odXJsPzogc3RyaW5nLCBjaGFubmVsPzogc3RyaW5nKTogUHJvbWlzZTxhbnk+O1xuICBjbG9zZSgpOiB2b2lkO1xuICBpc09wZW5lZCgpOiBib29sZWFuO1xuICBnZXQgbWVzc2FnZXMkKCk6IE9ic2VydmFibGU8c3RyaW5nPjtcbiAgc3Vic2NyaWJlT25TdWNjZXNzZnVsUmVjb25uZWN0aW9uKG5leHQ/OiAoKSA9PiB2b2lkKTogU3Vic2NyaXB0aW9uO1xufVxuIl19
|
|
@@ -2502,6 +2502,21 @@ const flowUpdateNextActions = [
|
|
|
2502
2502
|
ServerErrorActionCreator,
|
|
2503
2503
|
];
|
|
2504
2504
|
|
|
2505
|
+
const statusUpdatedAnalyticsPayloadCreator = (nextAction) => {
|
|
2506
|
+
if (nextAction.type !== 'status_updated')
|
|
2507
|
+
return null;
|
|
2508
|
+
const { statusState, group, isSuccess, isCanceled } = nextAction.data;
|
|
2509
|
+
return {
|
|
2510
|
+
value: nextAction.type,
|
|
2511
|
+
extraValue: statusState,
|
|
2512
|
+
dimension1: group,
|
|
2513
|
+
dimension2: isSuccess ? 'successful' : null,
|
|
2514
|
+
dimension3: isCanceled ? 'canceled' : null,
|
|
2515
|
+
};
|
|
2516
|
+
};
|
|
2517
|
+
|
|
2518
|
+
const analyticsPayloadCreatorMap = new Map([['status_updated', statusUpdatedAnalyticsPayloadCreator]]);
|
|
2519
|
+
|
|
2505
2520
|
const oneTimeAnalyticsEvents = new Set([]);
|
|
2506
2521
|
|
|
2507
2522
|
var EventParameterType;
|
|
@@ -2852,7 +2867,11 @@ class NextActionService {
|
|
|
2852
2867
|
return actionType;
|
|
2853
2868
|
}
|
|
2854
2869
|
logNextAction(nextAction) {
|
|
2855
|
-
|
|
2870
|
+
const analyticsPayloadCreator = analyticsPayloadCreatorMap.get(nextAction.type);
|
|
2871
|
+
const payload = analyticsPayloadCreator?.(nextAction) ?? {
|
|
2872
|
+
value: nextAction.type,
|
|
2873
|
+
};
|
|
2874
|
+
this.userBehaviourAnalyticsService.send(UserBehaviourEventName.nextAction, 'manual', payload);
|
|
2856
2875
|
}
|
|
2857
2876
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NextActionService, deps: [{ token: nextActionsToken }, { token: i0.Injector }, { token: ShowErrorsActionCreator }, { token: UserBehaviourAnalyticsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2858
2877
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NextActionService, providedIn: 'root' }); }
|
|
@@ -6250,6 +6269,9 @@ class NchanWebSocketService {
|
|
|
6250
6269
|
if (url === this.url) {
|
|
6251
6270
|
this.close();
|
|
6252
6271
|
}
|
|
6272
|
+
if (this.openPromise && this.url && url !== this.url && !this.isClosed()) {
|
|
6273
|
+
this.close();
|
|
6274
|
+
}
|
|
6253
6275
|
if (this.openPromise && !this.isClosed()) {
|
|
6254
6276
|
return this.openPromise;
|
|
6255
6277
|
}
|
|
@@ -6283,6 +6305,9 @@ class NchanWebSocketService {
|
|
|
6283
6305
|
.asObservable()
|
|
6284
6306
|
.subscribe(next);
|
|
6285
6307
|
}
|
|
6308
|
+
isOpened() {
|
|
6309
|
+
return !this.isClosed();
|
|
6310
|
+
}
|
|
6286
6311
|
isClosed() {
|
|
6287
6312
|
if (!this.connection) {
|
|
6288
6313
|
return true;
|
|
@@ -6411,6 +6436,9 @@ class CentrifugoWebSocketService {
|
|
|
6411
6436
|
this.url = '';
|
|
6412
6437
|
this.channel = '';
|
|
6413
6438
|
}
|
|
6439
|
+
isOpened() {
|
|
6440
|
+
return this.isConnectionOpen || this.isConnecting;
|
|
6441
|
+
}
|
|
6414
6442
|
get messages$() {
|
|
6415
6443
|
return (this.incomingMessages$
|
|
6416
6444
|
.asObservable()
|
|
@@ -6597,6 +6625,9 @@ class WebsocketStatusService {
|
|
|
6597
6625
|
get statusChanged$() {
|
|
6598
6626
|
return this.statusChangedSubject.asObservable();
|
|
6599
6627
|
}
|
|
6628
|
+
get isOpened() {
|
|
6629
|
+
return this.webSocketClient?.isOpened() ?? false;
|
|
6630
|
+
}
|
|
6600
6631
|
constructor(webSocketFactory) {
|
|
6601
6632
|
this.webSocketFactory = webSocketFactory;
|
|
6602
6633
|
this.reinsuranceCheckStatus = {
|
|
@@ -6678,6 +6709,8 @@ class ListenStatusService {
|
|
|
6678
6709
|
this.statusUpdatedSubject = new Subject();
|
|
6679
6710
|
this.statusDoneSubject = new Subject();
|
|
6680
6711
|
this.destroy$ = new Subject();
|
|
6712
|
+
this.listenInvoice = null;
|
|
6713
|
+
this.websocketInvoice = null;
|
|
6681
6714
|
}
|
|
6682
6715
|
listen(invoice) {
|
|
6683
6716
|
if (this.isListening) {
|
|
@@ -6685,6 +6718,7 @@ class ListenStatusService {
|
|
|
6685
6718
|
}
|
|
6686
6719
|
this.destroy$ = new Subject();
|
|
6687
6720
|
this.isListening = true;
|
|
6721
|
+
this.listenInvoice = invoice;
|
|
6688
6722
|
this.subscribeStatusUpdate(invoice);
|
|
6689
6723
|
this.subscribeCheckStatusUpdate();
|
|
6690
6724
|
this.subscribeWebsocketEvent();
|
|
@@ -6697,6 +6731,9 @@ class ListenStatusService {
|
|
|
6697
6731
|
this.destroy$.next();
|
|
6698
6732
|
this.destroy$.complete();
|
|
6699
6733
|
}
|
|
6734
|
+
isListeningInvoice(invoice) {
|
|
6735
|
+
return this.isListening && this.listenInvoice === invoice;
|
|
6736
|
+
}
|
|
6700
6737
|
subscribeStatusUpdate(invoice) {
|
|
6701
6738
|
this.statusService.response$
|
|
6702
6739
|
.pipe(filter$1((statusResponse) => {
|
|
@@ -6733,7 +6770,11 @@ class ListenStatusService {
|
|
|
6733
6770
|
});
|
|
6734
6771
|
}
|
|
6735
6772
|
if (statusSettings.needWebSocket) {
|
|
6736
|
-
this.
|
|
6773
|
+
if (!this.websocketStatusService.isOpened ||
|
|
6774
|
+
this.websocketInvoice !== invoice) {
|
|
6775
|
+
this.websocketInvoice = invoice;
|
|
6776
|
+
this.openWebsocket(statusSettings);
|
|
6777
|
+
}
|
|
6737
6778
|
return;
|
|
6738
6779
|
}
|
|
6739
6780
|
this.stopListening();
|
|
@@ -6955,6 +6996,7 @@ class StatusService {
|
|
|
6955
6996
|
this.nextActionService = nextActionService;
|
|
6956
6997
|
this.savePaymentMethodStatusService = savePaymentMethodStatusService;
|
|
6957
6998
|
this.statusUpdatedActionCreator = statusUpdatedActionCreator;
|
|
6999
|
+
this.listenStatusSubscription = null;
|
|
6958
7000
|
}
|
|
6959
7001
|
async getStatus(params) {
|
|
6960
7002
|
const isSavePaymentMethodMode = params?.isSavePaymentAccount === "1" /* XpsBoolean.true */;
|
|
@@ -6991,8 +7033,12 @@ class StatusService {
|
|
|
6991
7033
|
return params;
|
|
6992
7034
|
}
|
|
6993
7035
|
startWaitingStatusUpdates(invoice) {
|
|
7036
|
+
if (this.listenStatusService.isListeningInvoice(invoice)) {
|
|
7037
|
+
return;
|
|
7038
|
+
}
|
|
6994
7039
|
this.listenStatusService.listen(invoice);
|
|
6995
|
-
this.
|
|
7040
|
+
this.listenStatusSubscription?.unsubscribe();
|
|
7041
|
+
this.listenStatusSubscription = this.listenStatusService.statusUpdated$
|
|
6996
7042
|
.pipe(skip(1))
|
|
6997
7043
|
.subscribe(({ statusResponse }) => {
|
|
6998
7044
|
this.financeDetailsService.emitWithStatus(statusResponse.status);
|
|
@@ -7270,11 +7316,10 @@ class DfpCollectService {
|
|
|
7270
7316
|
* This method create invisible iframe with required params and after that it submit form in iframe
|
|
7271
7317
|
* */
|
|
7272
7318
|
openIframeWithPostRequest(threeDsForm, isNeedNotifyAfterLoad) {
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
}
|
|
7319
|
+
this.window.document.getElementById(this.iframeName)?.remove();
|
|
7320
|
+
this.window.document.getElementById(this.formName)?.remove();
|
|
7321
|
+
this.createIframe(isNeedNotifyAfterLoad, threeDsForm.threeDSTrXid);
|
|
7322
|
+
this.postFormToIframe(threeDsForm.threeDSMethod, threeDsForm.threeDSMethodData);
|
|
7278
7323
|
}
|
|
7279
7324
|
/*
|
|
7280
7325
|
* isNeedNotifyAfterLoad is need to send notification of dft to server
|
|
@@ -7301,14 +7346,11 @@ class DfpCollectService {
|
|
|
7301
7346
|
}
|
|
7302
7347
|
}
|
|
7303
7348
|
/*
|
|
7304
|
-
* This method will submit form in our iframe
|
|
7349
|
+
* This method will submit form in our iframe
|
|
7305
7350
|
* */
|
|
7306
7351
|
postFormToIframe(url, threeDsMethod) {
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
form = this.createForm();
|
|
7310
|
-
this.window.document.body.appendChild(form);
|
|
7311
|
-
}
|
|
7352
|
+
const form = this.createForm();
|
|
7353
|
+
this.window.document.body.appendChild(form);
|
|
7312
7354
|
form.setAttribute('action', url);
|
|
7313
7355
|
form.setAttribute('target', this.iframeName);
|
|
7314
7356
|
form.appendChild(this.createInput('threeDSMethodData', threeDsMethod));
|