@xsolla/payment-client-core 0.5.0 → 0.5.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/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay-cart/apple-pay-cart.service.mjs +17 -9
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay.service.mjs +20 -10
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/external-window-communication/external-window-communication.service.mjs +19 -8
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/braintree.handler.mjs +40 -15
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/checkout.handler.mjs +32 -13
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/session-handler.abstract.mjs +8 -1
- package/esm2022/lib/core/sdk-payment-systems/google-pay/google-pay.service.mjs +14 -8
- package/esm2022/lib/core/sdk-payment-systems/google-pay/payment/google-pay-checkout-payment.service.mjs +21 -9
- package/esm2022/lib/core/user-behaviour-analytics/event-builder/event-builder.service.mjs +2 -1
- package/esm2022/lib/core/user-behaviour-analytics/event-builder/user-behaviour-event.interface.mjs +1 -1
- package/esm2022/lib/core/user-behaviour-analytics/user-behaviour-analytics.interface.mjs +1 -1
- package/esm2022/lib/version.mjs +2 -2
- package/fesm2022/xsolla-payment-client-core.mjs +154 -55
- package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/sdk-payment-systems/apple-pay/apple-pay-cart/apple-pay-cart.service.d.ts +4 -3
- package/lib/core/sdk-payment-systems/apple-pay/apple-pay.service.d.ts +4 -3
- package/lib/core/sdk-payment-systems/apple-pay/external-window-communication/external-window-communication.service.d.ts +4 -3
- package/lib/core/sdk-payment-systems/apple-pay/session-handlers/braintree.handler.d.ts +1 -3
- package/lib/core/sdk-payment-systems/apple-pay/session-handlers/checkout.handler.d.ts +1 -3
- package/lib/core/sdk-payment-systems/apple-pay/session-handlers/session-handler.abstract.d.ts +4 -0
- package/lib/core/sdk-payment-systems/google-pay/google-pay.service.d.ts +4 -3
- package/lib/core/sdk-payment-systems/google-pay/payment/google-pay-checkout-payment.service.d.ts +5 -3
- package/lib/core/user-behaviour-analytics/event-builder/user-behaviour-event.interface.d.ts +1 -0
- package/lib/core/user-behaviour-analytics/user-behaviour-analytics.interface.d.ts +12 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -5,18 +5,19 @@ import { UpdatedPrice } from '../updated-price.interface';
|
|
|
5
5
|
import { ShippingAddress } from '../shipping-address.interface';
|
|
6
6
|
import { XpsResponse } from '../../../payment/xps-response.interface';
|
|
7
7
|
import { SummaryFinanceDetailsAdapterService } from '../../../payment/finance-details/summary/summary-finance-details-adapter.service';
|
|
8
|
-
import {
|
|
8
|
+
import { AnalyticsEventPayload } from '../../../user-behaviour-analytics/user-behaviour-analytics.interface';
|
|
9
9
|
import * as i0 from "@angular/core";
|
|
10
10
|
export declare class ApplePayCartService {
|
|
11
|
-
private readonly userBehaviourAnalyticsService;
|
|
12
11
|
private readonly summaryFinanceDetailsAdapterService;
|
|
13
12
|
private readonly cartSuccessfulRecalculated;
|
|
14
13
|
private readonly cartErrorRecalculated;
|
|
15
14
|
private readonly cartRecalculationRequest;
|
|
15
|
+
private readonly analyticsEvent;
|
|
16
16
|
get cartSuccessfulRecalculated$(): Observable<UpdatedPrice>;
|
|
17
17
|
get cartErrorRecalculated$(): Observable<ApplePayError>;
|
|
18
18
|
get cartRecalculationRequest$(): Observable<ShippingAddress>;
|
|
19
|
-
|
|
19
|
+
get analyticsEvent$(): Observable<AnalyticsEventPayload>;
|
|
20
|
+
constructor(summaryFinanceDetailsAdapterService: SummaryFinanceDetailsAdapterService);
|
|
20
21
|
recalculateCartTaxes(shippingContact: ApplePayShippingContact): void;
|
|
21
22
|
buildShippingContactUpdate(paymentParams: ApplePayParams, updatedPrice: UpdatedPrice): ApplePayShippingContactUpdate;
|
|
22
23
|
sendSuccessfulRecalculatedCart(xpsResponse: XpsResponse): void;
|
|
@@ -20,7 +20,7 @@ import { ShippingAddress } from './shipping-address.interface';
|
|
|
20
20
|
import { ApplePayShippingContact } from './session-handlers/apple-pay-session.interface';
|
|
21
21
|
import { UpdatedPrice } from './updated-price.interface';
|
|
22
22
|
import { LoggerService } from '../../exceptions-handling/logger/logger.service';
|
|
23
|
-
import {
|
|
23
|
+
import { AnalyticsEventPayload } from '../../user-behaviour-analytics/user-behaviour-analytics.interface';
|
|
24
24
|
import * as i0 from "@angular/core";
|
|
25
25
|
export declare class ApplePayService {
|
|
26
26
|
private readonly window;
|
|
@@ -31,12 +31,12 @@ export declare class ApplePayService {
|
|
|
31
31
|
private readonly loggerService;
|
|
32
32
|
private readonly applePaySdkService;
|
|
33
33
|
private readonly externalWindowCommunicationService;
|
|
34
|
-
private readonly userBehaviourAnalyticsService;
|
|
35
34
|
private readonly settingsService;
|
|
36
35
|
private readonly payment;
|
|
37
36
|
private readonly error;
|
|
38
37
|
private readonly integrationType;
|
|
39
38
|
private readonly applePayQrOpened;
|
|
39
|
+
private readonly analyticsEvent;
|
|
40
40
|
private readonly destroy$;
|
|
41
41
|
private paymentClient;
|
|
42
42
|
private readonly api;
|
|
@@ -46,13 +46,14 @@ export declare class ApplePayService {
|
|
|
46
46
|
get payment$(): Observable<string>;
|
|
47
47
|
get error$(): Observable<ApplePayErrors>;
|
|
48
48
|
get applePayQrOpened$(): Observable<void>;
|
|
49
|
+
get analyticsEvent$(): Observable<AnalyticsEventPayload>;
|
|
49
50
|
get windowClosing$(): Observable<void>;
|
|
50
51
|
get integrationType$(): Observable<ApplePayIntegration>;
|
|
51
52
|
get getCartRecalculationMessage$(): Observable<RecalculateCartMessage>;
|
|
52
53
|
get getWindowSendTokenMessage$(): Observable<ApplePaySendTokenMessage>;
|
|
53
54
|
get getWindowClose$(): Observable<WindowCloseMessage>;
|
|
54
55
|
get getWindowReturnMessage$(): Observable<ReturnMessage>;
|
|
55
|
-
constructor(window: ExtendedWindow, summaryFinanceDetailsAdapterService: SummaryFinanceDetailsAdapterService, braintreeHandler: BraintreeHandler, checkoutHandler: CheckoutHandler, appleParamsBuilder: ApplePayParamsBuilderService, loggerService: LoggerService, applePaySdkService: ApplePaySdkService, externalWindowCommunicationService: ApplePayExternalWindowCommunicationService,
|
|
56
|
+
constructor(window: ExtendedWindow, summaryFinanceDetailsAdapterService: SummaryFinanceDetailsAdapterService, braintreeHandler: BraintreeHandler, checkoutHandler: CheckoutHandler, appleParamsBuilder: ApplePayParamsBuilderService, loggerService: LoggerService, applePaySdkService: ApplePaySdkService, externalWindowCommunicationService: ApplePayExternalWindowCommunicationService, settingsService: SettingsService);
|
|
56
57
|
addApplePaySdkJs(): void;
|
|
57
58
|
removeListeners(): void;
|
|
58
59
|
setApplePayParams(data: {
|
|
@@ -7,15 +7,16 @@ import { CommandsForPages } from '../commands-for-pages.enum';
|
|
|
7
7
|
import { RecalculateCartMessage } from '../socket-messages/recalculate-cart-message.interface';
|
|
8
8
|
import { ApplePaySendTokenMessage } from '../socket-messages/send-token-message.interface';
|
|
9
9
|
import { ReturnMessage } from '../socket-messages/return-message.interface';
|
|
10
|
-
import {
|
|
10
|
+
import { AnalyticsEventPayload } from '../../../user-behaviour-analytics/user-behaviour-analytics.interface';
|
|
11
11
|
import * as i0 from "@angular/core";
|
|
12
12
|
export declare class ApplePayExternalWindowCommunicationService {
|
|
13
13
|
private readonly window;
|
|
14
14
|
private readonly webSocketFactory;
|
|
15
15
|
private readonly socketBridgeService;
|
|
16
|
-
private readonly userBehaviourAnalyticsService;
|
|
17
16
|
private websocketClient;
|
|
18
|
-
|
|
17
|
+
private readonly analyticsEvent;
|
|
18
|
+
constructor(window: ExtendedWindow, webSocketFactory: WebSocketFactory, socketBridgeService: SocketBridgeService);
|
|
19
|
+
get analyticsEvent$(): Observable<AnalyticsEventPayload>;
|
|
19
20
|
getWindowClose$(): Observable<WindowCloseMessage>;
|
|
20
21
|
getWindowReturnMessage$(): Observable<ReturnMessage>;
|
|
21
22
|
getWindowSendTokenMessage$(): Observable<ApplePaySendTokenMessage>;
|
|
@@ -5,15 +5,13 @@ import { ApplePaySessionHandlerAbstract } from './session-handler.abstract';
|
|
|
5
5
|
import { StartSessionParams } from './start-session-params.interface';
|
|
6
6
|
import { ApplePayCartService } from '../apple-pay-cart/apple-pay-cart.service';
|
|
7
7
|
import { LoggerService } from '../../../exceptions-handling/logger/logger.service';
|
|
8
|
-
import { UserBehaviourAnalyticsService } from '../../../user-behaviour-analytics/user-behaviour-analytics.service';
|
|
9
8
|
import * as i0 from "@angular/core";
|
|
10
9
|
export declare class BraintreeHandler extends ApplePaySessionHandlerAbstract {
|
|
11
10
|
private readonly window;
|
|
12
11
|
private readonly loggerService;
|
|
13
12
|
private readonly applePayCartService;
|
|
14
|
-
private readonly userBehaviourAnalyticsService;
|
|
15
13
|
private paymentClient;
|
|
16
|
-
constructor(window: ExtendedWindow, loggerService: LoggerService, applePayCartService: ApplePayCartService
|
|
14
|
+
constructor(window: ExtendedWindow, loggerService: LoggerService, applePayCartService: ApplePayCartService);
|
|
17
15
|
setClient(client: ApplePay): void;
|
|
18
16
|
startSession(params: ApplePayParams, additionalParams: StartSessionParams, applePayFinallyCallback: () => void): void;
|
|
19
17
|
static ɵfac: i0.ɵɵFactoryDeclaration<BraintreeHandler, never>;
|
|
@@ -4,7 +4,6 @@ import { ApplePayParams } from '../apple-pay-params.interface';
|
|
|
4
4
|
import { ApplePaySessionHandlerAbstract } from './session-handler.abstract';
|
|
5
5
|
import { StartSessionParams } from './start-session-params.interface';
|
|
6
6
|
import { ApplePayCartService } from '../apple-pay-cart/apple-pay-cart.service';
|
|
7
|
-
import { UserBehaviourAnalyticsService } from '../../../user-behaviour-analytics/user-behaviour-analytics.service';
|
|
8
7
|
import { LoggerService } from '../../../exceptions-handling/logger/logger.service';
|
|
9
8
|
import * as i0 from "@angular/core";
|
|
10
9
|
export declare class CheckoutHandler extends ApplePaySessionHandlerAbstract {
|
|
@@ -12,8 +11,7 @@ export declare class CheckoutHandler extends ApplePaySessionHandlerAbstract {
|
|
|
12
11
|
private readonly http;
|
|
13
12
|
private readonly loggerService;
|
|
14
13
|
private readonly applePayCartService;
|
|
15
|
-
|
|
16
|
-
constructor(window: ExtendedWindow, http: HttpClient, loggerService: LoggerService, applePayCartService: ApplePayCartService, userBehaviourAnalyticsService: UserBehaviourAnalyticsService);
|
|
14
|
+
constructor(window: ExtendedWindow, http: HttpClient, loggerService: LoggerService, applePayCartService: ApplePayCartService);
|
|
17
15
|
startSession(params: ApplePayParams, additionalParams: StartSessionParams, applePayFinallyCallback: () => void): void;
|
|
18
16
|
static ɵfac: i0.ɵɵFactoryDeclaration<CheckoutHandler, never>;
|
|
19
17
|
static ɵprov: i0.ɵɵInjectableDeclaration<CheckoutHandler>;
|
package/lib/core/sdk-payment-systems/apple-pay/session-handlers/session-handler.abstract.d.ts
CHANGED
|
@@ -3,12 +3,16 @@ import { ApplePayParams } from '../apple-pay-params.interface';
|
|
|
3
3
|
import { ApplePayErrors } from '../apple-pay.errors.enum';
|
|
4
4
|
import { ApplePayPaymentRequest } from './apple-pay-session.interface';
|
|
5
5
|
import { StartSessionParams } from './start-session-params.interface';
|
|
6
|
+
import { AnalyticsEventPayload } from '../../../user-behaviour-analytics/user-behaviour-analytics.interface';
|
|
6
7
|
export declare abstract class ApplePaySessionHandlerAbstract {
|
|
7
8
|
protected readonly payment: Subject<string>;
|
|
8
9
|
private readonly _errorSubject;
|
|
10
|
+
private readonly _analyticsEventSubject;
|
|
9
11
|
get error$(): Observable<ApplePayErrors>;
|
|
10
12
|
get payment$(): Observable<string>;
|
|
13
|
+
get analyticsEvent$(): Observable<AnalyticsEventPayload>;
|
|
11
14
|
abstract startSession(params: ApplePayParams, additionalParams: StartSessionParams, applePayFinallyCallback: () => void): void;
|
|
12
15
|
protected emitError(error: ApplePayErrors): void;
|
|
16
|
+
protected emitAnalyticsEvent(event: AnalyticsEventPayload): void;
|
|
13
17
|
protected buildPaymentRequest(params: ApplePayParams): ApplePayPaymentRequest;
|
|
14
18
|
}
|
|
@@ -9,7 +9,7 @@ import { GooglePayCheckoutPaymentService } from './payment/google-pay-checkout-p
|
|
|
9
9
|
import { GooglePayInstantPaymentService } from './payment/google-pay-instant-payment.service';
|
|
10
10
|
import { LoggerService } from '../../exceptions-handling/logger/logger.service';
|
|
11
11
|
import { GooglePayButtonConfiguration } from './google-pay-button-configuration.interface';
|
|
12
|
-
import {
|
|
12
|
+
import { AnalyticsEventPayload } from '../../user-behaviour-analytics/user-behaviour-analytics.interface';
|
|
13
13
|
import * as i0 from "@angular/core";
|
|
14
14
|
export declare class GooglePayService {
|
|
15
15
|
private readonly window;
|
|
@@ -18,12 +18,12 @@ export declare class GooglePayService {
|
|
|
18
18
|
private readonly googlePayCheckoutPaymentService;
|
|
19
19
|
private readonly googlePayInstantPaymentService;
|
|
20
20
|
private readonly injector;
|
|
21
|
-
private readonly userBehaviourAnalyticsService;
|
|
22
21
|
private readonly googlePayScriptUrl;
|
|
23
22
|
private readonly readyToPay;
|
|
24
23
|
private readonly paymentWindowIsReady;
|
|
25
24
|
private readonly paymentWindowIsClose;
|
|
26
25
|
private readonly error;
|
|
26
|
+
private readonly analyticsEvent;
|
|
27
27
|
private paymentInProgress;
|
|
28
28
|
private googlePaymentClient;
|
|
29
29
|
private initParams;
|
|
@@ -32,11 +32,12 @@ export declare class GooglePayService {
|
|
|
32
32
|
private onPaymentAuthorized;
|
|
33
33
|
private get libraryWasInitialized();
|
|
34
34
|
private get googlePaymentClientWasInitialized();
|
|
35
|
-
constructor(window: ExtendedWindow, loggerService: LoggerService, paymentSystemProcessingService: PaymentSystemProcessingService, googlePayCheckoutPaymentService: GooglePayCheckoutPaymentService, googlePayInstantPaymentService: GooglePayInstantPaymentService, injector: Injector
|
|
35
|
+
constructor(window: ExtendedWindow, loggerService: LoggerService, paymentSystemProcessingService: PaymentSystemProcessingService, googlePayCheckoutPaymentService: GooglePayCheckoutPaymentService, googlePayInstantPaymentService: GooglePayInstantPaymentService, injector: Injector);
|
|
36
36
|
get readyToPay$(): Observable<boolean | null>;
|
|
37
37
|
get paymentWindowIsReady$(): Observable<void>;
|
|
38
38
|
get paymentWindowIsClose$(): Observable<void>;
|
|
39
39
|
get error$(): Observable<unknown>;
|
|
40
|
+
get analyticsEvent$(): Observable<AnalyticsEventPayload>;
|
|
40
41
|
isReadyToPay(): boolean | null;
|
|
41
42
|
initGooglePayLibrary(data: GooglePayInitParams): void;
|
|
42
43
|
checkPaymentDevice(data: CheckPaymentDeviceData): void;
|
package/lib/core/sdk-payment-systems/google-pay/payment/google-pay-checkout-payment.service.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
1
2
|
import { PaymentSystemProcessingService } from '../../payment-systems/payment-system-processing.service';
|
|
2
3
|
import { AllowedPaymentMethod, GoogleInitData, GooglePayPaymentRequest, PaymentDataResponse } from '../google-pay-library.interface';
|
|
3
4
|
import { GooglePayPaymentService, PreparePaymentParams } from './google-pay-payment-service.interface';
|
|
4
|
-
import {
|
|
5
|
+
import { AnalyticsEventPayload } from '../../../user-behaviour-analytics/user-behaviour-analytics.interface';
|
|
5
6
|
import { LoggerService } from '../../../exceptions-handling/logger/logger.service';
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
8
|
export declare class GooglePayCheckoutPaymentService implements GooglePayPaymentService {
|
|
8
9
|
readonly paymentSystemProcessingService: PaymentSystemProcessingService;
|
|
9
|
-
private readonly userBehaviourAnalyticsService;
|
|
10
10
|
private readonly loggerService;
|
|
11
11
|
private initParams;
|
|
12
12
|
private checkout;
|
|
13
|
-
|
|
13
|
+
private readonly analyticsEvent;
|
|
14
|
+
constructor(paymentSystemProcessingService: PaymentSystemProcessingService, loggerService: LoggerService);
|
|
15
|
+
get analyticsEvent$(): Observable<AnalyticsEventPayload>;
|
|
14
16
|
preparePayment({ initParams, checkDeviceData, }: PreparePaymentParams): GoogleInitData | null;
|
|
15
17
|
getPaymentRequest(): GooglePayPaymentRequest | null;
|
|
16
18
|
getAllowedPaymentMethods(): AllowedPaymentMethod[];
|
|
@@ -11,6 +11,7 @@ export interface UserBehaviourEvent extends Invoice {
|
|
|
11
11
|
timezone: string;
|
|
12
12
|
session_id: string | null;
|
|
13
13
|
referrer_url: string | null;
|
|
14
|
+
ancestor_origins: string[] | null;
|
|
14
15
|
project_id: number | null;
|
|
15
16
|
payment_country: string | null;
|
|
16
17
|
instance_id: number | null;
|
|
@@ -34,3 +34,15 @@ export interface CreateEventMethodOptionsInterface {
|
|
|
34
34
|
dimension4: string | null;
|
|
35
35
|
dimension5: string | null;
|
|
36
36
|
}
|
|
37
|
+
export interface AnalyticsEventPayload {
|
|
38
|
+
eventName: string;
|
|
39
|
+
eventType: keyof typeof userBehaviourEventTypes;
|
|
40
|
+
value?: SendEventMethodOptionsInterface['value'];
|
|
41
|
+
extraValue?: SendEventMethodOptionsInterface['extraValue'];
|
|
42
|
+
dimension1?: SendEventMethodOptionsInterface['dimension1'];
|
|
43
|
+
dimension2?: SendEventMethodOptionsInterface['dimension2'];
|
|
44
|
+
dimension3?: SendEventMethodOptionsInterface['dimension3'];
|
|
45
|
+
dimension4?: SendEventMethodOptionsInterface['dimension4'];
|
|
46
|
+
dimension5?: SendEventMethodOptionsInterface['dimension5'];
|
|
47
|
+
instanceId?: SendEventMethodOptionsInterface['instanceId'];
|
|
48
|
+
}
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PAYMENT_CLIENT_CORE_VERSION = "0.5.
|
|
1
|
+
export declare const PAYMENT_CLIENT_CORE_VERSION = "0.5.2";
|