@adyen/kyc-components 2.36.0 → 2.36.1
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.
|
@@ -33205,16 +33205,6 @@ const getAddress = async (context, addressId) => {
|
|
|
33205
33205
|
}
|
|
33206
33206
|
});
|
|
33207
33207
|
};
|
|
33208
|
-
const getAnalyticsSession = async (loadingContext, data) => httpPost({
|
|
33209
|
-
loadingContext,
|
|
33210
|
-
errorLevel: "warn",
|
|
33211
|
-
errorMessage: `Failed to get analytics sessionId`,
|
|
33212
|
-
path: `analytics/ui`,
|
|
33213
|
-
authentication: "jwt",
|
|
33214
|
-
headers: {
|
|
33215
|
-
"Content-Type": "application/json"
|
|
33216
|
-
}
|
|
33217
|
-
}, data);
|
|
33218
33208
|
const getIdverificationToken = async (context, request) => {
|
|
33219
33209
|
const {
|
|
33220
33210
|
loadingContext,
|
|
@@ -33285,16 +33275,6 @@ const idVerificationStartcheck = async (context, request) => {
|
|
|
33285
33275
|
}
|
|
33286
33276
|
}, request);
|
|
33287
33277
|
};
|
|
33288
|
-
const pushEvents = async (loadingContext, sessionId, event) => httpPost({
|
|
33289
|
-
loadingContext,
|
|
33290
|
-
errorLevel: "warn",
|
|
33291
|
-
errorMessage: `Failed to push events`,
|
|
33292
|
-
path: `analytics/ui/${sessionId}`,
|
|
33293
|
-
authentication: "jwt",
|
|
33294
|
-
headers: {
|
|
33295
|
-
"Content-Type": "application/json"
|
|
33296
|
-
}
|
|
33297
|
-
}, event);
|
|
33298
33278
|
const searchAddress = async (context, address2) => {
|
|
33299
33279
|
const {
|
|
33300
33280
|
loadingContext,
|
|
@@ -33354,9 +33334,7 @@ const useComponentApi = (rootLegalEntityId) => {
|
|
|
33354
33334
|
getIdVerificationToken: async (legalEntityId, data) => getIdverificationToken(baseRequestContext, data),
|
|
33355
33335
|
idVerificationStartCheck: async (legalEntityId, data) => idVerificationStartcheck(baseRequestContext, data),
|
|
33356
33336
|
getOnboardingStatus: async () => getOnboardingStatus(baseRequestContext),
|
|
33357
|
-
generateOnboardingLink: async (config) => generateOnboardingLink(baseRequestContext, config)
|
|
33358
|
-
getAnalyticsSession: async (data) => getAnalyticsSession(loadingContext, data),
|
|
33359
|
-
pushEvents: async (sessionId, event) => pushEvents(loadingContext, sessionId, event)
|
|
33337
|
+
generateOnboardingLink: async (config) => generateOnboardingLink(baseRequestContext, config)
|
|
33360
33338
|
};
|
|
33361
33339
|
}, [base, rootLegalEntityId]);
|
|
33362
33340
|
};
|
|
@@ -33749,6 +33727,26 @@ const AuthProvider = ({
|
|
|
33749
33727
|
children
|
|
33750
33728
|
});
|
|
33751
33729
|
};
|
|
33730
|
+
const getAnalyticsSession = async (loadingContext, data) => httpPost({
|
|
33731
|
+
loadingContext,
|
|
33732
|
+
errorLevel: "warn",
|
|
33733
|
+
errorMessage: `Failed to get analytics sessionId`,
|
|
33734
|
+
path: `analytics/ui`,
|
|
33735
|
+
authentication: "jwt",
|
|
33736
|
+
headers: {
|
|
33737
|
+
"Content-Type": "application/json"
|
|
33738
|
+
}
|
|
33739
|
+
}, data);
|
|
33740
|
+
const pushEvents = async (loadingContext, sessionId, event) => httpPost({
|
|
33741
|
+
loadingContext,
|
|
33742
|
+
errorLevel: "warn",
|
|
33743
|
+
errorMessage: `Failed to push events`,
|
|
33744
|
+
path: `analytics/ui/${sessionId}`,
|
|
33745
|
+
authentication: "jwt",
|
|
33746
|
+
headers: {
|
|
33747
|
+
"Content-Type": "application/json"
|
|
33748
|
+
}
|
|
33749
|
+
}, event);
|
|
33752
33750
|
const convertToEmbeddedEvent = (eventQueueItem) => {
|
|
33753
33751
|
const [eventType, event] = eventQueueItem;
|
|
33754
33752
|
const hasEventData = typeof event === "object";
|
|
@@ -33763,28 +33761,33 @@ const convertToEmbeddedEvent = (eventQueueItem) => {
|
|
|
33763
33761
|
};
|
|
33764
33762
|
const useAnalytics = async ({
|
|
33765
33763
|
onUserEvent,
|
|
33766
|
-
isEmbeddedDropin,
|
|
33767
33764
|
legalEntityId,
|
|
33768
33765
|
sdkVersion,
|
|
33769
33766
|
componentName
|
|
33770
33767
|
}) => {
|
|
33771
33768
|
const {
|
|
33772
|
-
|
|
33773
|
-
|
|
33774
|
-
} =
|
|
33769
|
+
isEmbeddedDropin,
|
|
33770
|
+
loadingContext: base
|
|
33771
|
+
} = useAuthContext();
|
|
33772
|
+
const loadingContext = `${base}api/${COMPONENTS_API_VERSION}/`;
|
|
33775
33773
|
if (isEmbeddedDropin) {
|
|
33776
|
-
|
|
33777
|
-
|
|
33778
|
-
|
|
33779
|
-
|
|
33780
|
-
|
|
33781
|
-
|
|
33782
|
-
|
|
33783
|
-
|
|
33784
|
-
|
|
33785
|
-
|
|
33786
|
-
|
|
33787
|
-
|
|
33774
|
+
try {
|
|
33775
|
+
const sessionResponse = await getAnalyticsSession(loadingContext, {
|
|
33776
|
+
sdkVersion,
|
|
33777
|
+
componentName,
|
|
33778
|
+
userAgent: navigator.userAgent,
|
|
33779
|
+
legalEntityId
|
|
33780
|
+
});
|
|
33781
|
+
if (!(sessionResponse == null ? void 0 : sessionResponse.id)) {
|
|
33782
|
+
throw Error("Analytics session Id not received");
|
|
33783
|
+
}
|
|
33784
|
+
userEvents.subscribe((data) => {
|
|
33785
|
+
const eventItem = convertToEmbeddedEvent(data);
|
|
33786
|
+
pushEvents(loadingContext, sessionResponse.id, eventItem);
|
|
33787
|
+
});
|
|
33788
|
+
} catch (e) {
|
|
33789
|
+
console.error("Failed to initiate analytics for component", e);
|
|
33790
|
+
}
|
|
33788
33791
|
} else if (onUserEvent) {
|
|
33789
33792
|
userEvents.subscribe(onUserEvent);
|
|
33790
33793
|
}
|
|
@@ -34088,10 +34091,9 @@ const ConfigurationApiProvider = ({
|
|
|
34088
34091
|
isEmbeddedDropin,
|
|
34089
34092
|
loadingContext
|
|
34090
34093
|
} = authContext;
|
|
34091
|
-
const sdkVersion = "2.36.
|
|
34094
|
+
const sdkVersion = "2.36.1";
|
|
34092
34095
|
useAnalytics({
|
|
34093
34096
|
onUserEvent,
|
|
34094
|
-
isEmbeddedDropin,
|
|
34095
34097
|
legalEntityId: rootLegalEntityId,
|
|
34096
34098
|
sdkVersion,
|
|
34097
34099
|
componentName
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ComponentMap } from '../../components';
|
|
2
2
|
import { EmbeddedEventItem, EventQueueItem, UserEventCallback } from '../user-events';
|
|
3
3
|
export type useAnalyticsProps = {
|
|
4
|
-
isEmbeddedDropin: boolean;
|
|
5
4
|
legalEntityId: string;
|
|
6
5
|
onUserEvent?: UserEventCallback;
|
|
7
6
|
sdkVersion: string;
|
|
8
7
|
componentName: keyof ComponentMap;
|
|
9
8
|
};
|
|
10
9
|
export declare const convertToEmbeddedEvent: (eventQueueItem: EventQueueItem) => EmbeddedEventItem;
|
|
11
|
-
export declare const useAnalytics: ({ onUserEvent,
|
|
10
|
+
export declare const useAnalytics: ({ onUserEvent, legalEntityId, sdkVersion, componentName, }: useAnalyticsProps) => Promise<void>;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { DropinAPIHandlers } from '../../components/Dropins/types';
|
|
2
|
-
import { EmbeddedAnalyticsSessionRequest, EmbeddedAnalyticsSessionResponse } from '../models/api/analytics';
|
|
3
2
|
import { BankVerificationErrorResponse, CreateTrustedTransferInstrumentResponse } from '../models/api/trusted-transferInstrument';
|
|
4
|
-
import { EmbeddedEventItem } from '../user-events';
|
|
5
3
|
export type ComponentApi = {
|
|
6
4
|
getLegalEntity: Required<DropinAPIHandlers>['handleGetLegalEntity'];
|
|
7
5
|
updateLegalEntity: Required<DropinAPIHandlers>['handleUpdateLegalEntity'];
|
|
@@ -21,8 +19,6 @@ export type ComponentApi = {
|
|
|
21
19
|
handleBankVerificationError: (errorCode: string, errorMessage: string, state: string, metadata?: Map<string, string>) => Promise<BankVerificationErrorResponse>;
|
|
22
20
|
getOnboardingStatus: Required<DropinAPIHandlers>['handleGetOnboardingStatus'];
|
|
23
21
|
generateOnboardingLink: Required<DropinAPIHandlers>['handleGenerateOnboardingLink'];
|
|
24
|
-
getAnalyticsSession(data: EmbeddedAnalyticsSessionRequest): Promise<EmbeddedAnalyticsSessionResponse>;
|
|
25
|
-
pushEvents(sessionId: string, event: EmbeddedEventItem): Promise<void>;
|
|
26
22
|
};
|
|
27
23
|
export declare const COMPONENTS_API_VERSION = "v1";
|
|
28
24
|
/**
|