react-native-unit-components 3.1.2 → 3.3.0-beta.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.
- package/README.md +77 -1
- package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.js +25 -1
- package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.js.map +1 -1
- package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.js +14 -2
- package/lib/commonjs/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.js.map +1 -1
- package/lib/commonjs/messages/webMessages/veryfiMessages.js +11 -0
- package/lib/commonjs/messages/webMessages/veryfiMessages.js.map +1 -0
- package/lib/commonjs/scripts/html/bodyScript.js +10 -1
- package/lib/commonjs/scripts/html/bodyScript.js.map +1 -1
- package/lib/commonjs/services/veryfiService.js +107 -0
- package/lib/commonjs/services/veryfiService.js.map +1 -0
- package/lib/commonjs/slices/ConfigurationSlice.js +7 -2
- package/lib/commonjs/slices/ConfigurationSlice.js.map +1 -1
- package/lib/commonjs/types/shared/index.js +11 -0
- package/lib/commonjs/types/shared/index.js.map +1 -1
- package/lib/commonjs/types/shared/veryfi.types.js +2 -0
- package/lib/commonjs/types/shared/veryfi.types.js.map +1 -0
- package/lib/commonjs/unitComponentsSdkManager/UnitComponentsSdkManager.js +4 -1
- package/lib/commonjs/unitComponentsSdkManager/UnitComponentsSdkManager.js.map +1 -1
- package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.js +27 -3
- package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.js.map +1 -1
- package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.js +13 -2
- package/lib/module/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.js.map +1 -1
- package/lib/module/messages/webMessages/veryfiMessages.js +5 -0
- package/lib/module/messages/webMessages/veryfiMessages.js.map +1 -0
- package/lib/module/scripts/html/bodyScript.js +9 -0
- package/lib/module/scripts/html/bodyScript.js.map +1 -1
- package/lib/module/services/veryfiService.js +99 -0
- package/lib/module/services/veryfiService.js.map +1 -0
- package/lib/module/slices/ConfigurationSlice.js +5 -1
- package/lib/module/slices/ConfigurationSlice.js.map +1 -1
- package/lib/module/types/shared/index.js +1 -0
- package/lib/module/types/shared/index.js.map +1 -1
- package/lib/module/types/shared/veryfi.types.js +2 -0
- package/lib/module/types/shared/veryfi.types.js.map +1 -0
- package/lib/module/unitComponentsSdkManager/UnitComponentsSdkManager.js +5 -2
- package/lib/module/unitComponentsSdkManager/UnitComponentsSdkManager.js.map +1 -1
- package/lib/typescript/src/components/UNCheckDepositComponent/UNCheckDepositComponent.d.ts.map +1 -1
- package/lib/typescript/src/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.d.ts +5 -1
- package/lib/typescript/src/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.d.ts.map +1 -1
- package/lib/typescript/src/messages/webMessages/veryfiMessages.d.ts +4 -0
- package/lib/typescript/src/messages/webMessages/veryfiMessages.d.ts.map +1 -0
- package/lib/typescript/src/scripts/html/bodyScript.d.ts +1 -0
- package/lib/typescript/src/scripts/html/bodyScript.d.ts.map +1 -1
- package/lib/typescript/src/services/veryfiService.d.ts +8 -0
- package/lib/typescript/src/services/veryfiService.d.ts.map +1 -0
- package/lib/typescript/src/slices/ConfigurationSlice.d.ts +3 -1
- package/lib/typescript/src/slices/ConfigurationSlice.d.ts.map +1 -1
- package/lib/typescript/src/types/shared/index.d.ts +1 -0
- package/lib/typescript/src/types/shared/index.d.ts.map +1 -1
- package/lib/typescript/src/types/shared/veryfi.types.d.ts +7 -0
- package/lib/typescript/src/types/shared/veryfi.types.d.ts.map +1 -0
- package/lib/typescript/src/unitComponentsSdkManager/UnitComponentsSdkManager.d.ts +2 -0
- package/lib/typescript/src/unitComponentsSdkManager/UnitComponentsSdkManager.d.ts.map +1 -1
- package/package.json +11 -4
- package/src/components/UNCheckDepositComponent/UNCheckDepositComponent.tsx +33 -4
- package/src/components/UNCheckDepositComponent/UNCheckDepositComponent.utils.ts +14 -2
- package/src/messages/webMessages/veryfiMessages.ts +3 -0
- package/src/scripts/html/bodyScript.ts +10 -0
- package/src/services/veryfiService.ts +123 -0
- package/src/slices/ConfigurationSlice.ts +7 -2
- package/src/types/shared/index.ts +1 -0
- package/src/types/shared/veryfi.types.ts +6 -0
- package/src/unitComponentsSdkManager/UnitComponentsSdkManager.ts +7 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-unit-components",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.3.0-beta.1",
|
|
4
4
|
"description": "Unit React Native components",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -29,11 +29,12 @@
|
|
|
29
29
|
"prepare": "bob build",
|
|
30
30
|
"example": "yarn --cwd example",
|
|
31
31
|
"cleanNodeModules": "rm -rf node_modules",
|
|
32
|
-
"
|
|
32
|
+
"setup-veryfi": "node scripts/setup-veryfi.js",
|
|
33
|
+
"bootstrap": "node scripts/setup-veryfi.js && yarn cleanNodeModules && yarn example cleanNodeModules && yarn example && yarn && yarn example pods",
|
|
33
34
|
"cleanAll": "rm -rf node_modules example/node_modules android/build example/android/build example/ios/pods",
|
|
34
35
|
"installAll": "yarn installOldArch && yarn installNewArch",
|
|
35
|
-
"installOldArch": "yarn install && cd example && yarn install && cd ios && pod install",
|
|
36
|
-
"installNewArch": "yarn install && cd exampleNewArch && yarn install && cd ios && pod install"
|
|
36
|
+
"installOldArch": "node scripts/setup-veryfi.js && yarn install && cd example && yarn install && cd ios && pod install",
|
|
37
|
+
"installNewArch": "node scripts/setup-veryfi.js && yarn install && cd exampleNewArch && yarn install && cd ios && pod install"
|
|
37
38
|
},
|
|
38
39
|
"keywords": [
|
|
39
40
|
"react-native",
|
|
@@ -77,12 +78,18 @@
|
|
|
77
78
|
"@types/react": "^16.14.20"
|
|
78
79
|
},
|
|
79
80
|
"peerDependencies": {
|
|
81
|
+
"@veryfi/react-native-veryfi-lens": "*",
|
|
80
82
|
"react": "*",
|
|
81
83
|
"react-native": "*",
|
|
82
84
|
"react-native-plaid-link-sdk": "*",
|
|
83
85
|
"react-native-safe-area-context": ">=4.0.0",
|
|
84
86
|
"react-native-webview": "*"
|
|
85
87
|
},
|
|
88
|
+
"peerDependenciesMeta": {
|
|
89
|
+
"@veryfi/react-native-veryfi-lens": {
|
|
90
|
+
"optional": true
|
|
91
|
+
}
|
|
92
|
+
},
|
|
86
93
|
"dependencies": {
|
|
87
94
|
"@reduxjs/toolkit": "^1.9.5",
|
|
88
95
|
"axios": "^1.7.1",
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
|
+
import { useSelector } from 'react-redux';
|
|
3
4
|
import { WebComponent } from '../../webComponent/WebComponent';
|
|
4
5
|
import type { WebViewMessage } from '../../messages/webMessages';
|
|
5
6
|
import { HeightEvent, PageMessage } from '../../messages/webMessages/pageMessage';
|
|
6
|
-
import { UnitComponentsMessage } from '../../messages/webMessages/unitComponentsMessages';
|
|
7
|
-
import { getCheckDepositParams, getCheckDepositScript } from './UNCheckDepositComponent.utils';
|
|
7
|
+
import { RequestExternalSdkEvent, UnitComponentsMessage } from '../../messages/webMessages/unitComponentsMessages';
|
|
8
|
+
import { getCheckDepositParams, getCheckDepositScript, injectUnitVeryfiResponse } from './UNCheckDepositComponent.utils';
|
|
8
9
|
import { CheckMessage } from '../../messages/webMessages/checkMessage';
|
|
9
10
|
import type { UNCheckDeposit, UNAccount, UNComponentsError, UNComponentsOnLoadResponse, UNComponentsOnLoadResponseData } from '../../types/shared';
|
|
10
11
|
import { RESPONSE_KEYS, UnitOnLoadResponseEvent } from '../../messages/webMessages/onLoadMessage';
|
|
@@ -13,6 +14,9 @@ import { withReduxStore } from '../../helpers/store/helpers';
|
|
|
13
14
|
import { PaymentMessage } from '../../messages/webMessages/paymentsMessage';
|
|
14
15
|
import { UNBaseView } from '../../nativeComponents/UNBaseView';
|
|
15
16
|
import UNPermissionsModule from '../../nativeModulesHelpers/UNPermissionsHelper/UNPermissionsHelper';
|
|
17
|
+
import { isVeryfiAvailable, configureAndShowVeryfiCamera } from '../../services/veryfiService';
|
|
18
|
+
import type WebView from 'react-native-webview';
|
|
19
|
+
import type { RootState } from '../../store';
|
|
16
20
|
|
|
17
21
|
export interface UNCheckDepositComponentProps {
|
|
18
22
|
accountId: string;
|
|
@@ -31,6 +35,8 @@ export interface UNCheckDepositComponentProps {
|
|
|
31
35
|
const UNCheckDepositComponent = (props: UNCheckDepositComponentProps) => {
|
|
32
36
|
const [height, setHeight] = useState<number>(0);
|
|
33
37
|
const [presentationMode, setPresentationMode] = useState<PresentationMode>(PresentationMode.Inherit);
|
|
38
|
+
const webRef = useRef<WebView>(null);
|
|
39
|
+
const veryfiCredentials = useSelector((state: RootState) => state.configuration.veryfiCredentials);
|
|
34
40
|
|
|
35
41
|
useEffect(() => {
|
|
36
42
|
const requestCameraAccess = async () => {
|
|
@@ -96,6 +102,28 @@ const UNCheckDepositComponent = (props: UNCheckDepositComponentProps) => {
|
|
|
96
102
|
}
|
|
97
103
|
break;
|
|
98
104
|
}
|
|
105
|
+
case UnitComponentsMessage.UNIT_REQUEST_EXTERNAL_SDK: {
|
|
106
|
+
const externalSdkEvent = message.details as RequestExternalSdkEvent;
|
|
107
|
+
if (externalSdkEvent.type !== 'veryfi') return;
|
|
108
|
+
if (!isVeryfiAvailable()) {
|
|
109
|
+
console.warn('Veryfi SDK is not installed — check deposit will use the default web scanner');
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (!veryfiCredentials) {
|
|
113
|
+
console.error('Veryfi credentials not provided in UnitComponentsSdkManager.init()');
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
configureAndShowVeryfiCamera(
|
|
117
|
+
veryfiCredentials,
|
|
118
|
+
(images) => {
|
|
119
|
+
injectUnitVeryfiResponse(webRef.current, images);
|
|
120
|
+
},
|
|
121
|
+
(error) => {
|
|
122
|
+
console.error('Veryfi error:', error);
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
99
127
|
}
|
|
100
128
|
};
|
|
101
129
|
|
|
@@ -104,9 +132,10 @@ const UNCheckDepositComponent = (props: UNCheckDepositComponentProps) => {
|
|
|
104
132
|
return (
|
|
105
133
|
<UNBaseView style={style} onLoadError={ handleUnitOnLoad } fallback={<></>}>
|
|
106
134
|
<WebComponent
|
|
135
|
+
ref={webRef}
|
|
107
136
|
type={WebComponentType.checkDeposit}
|
|
108
137
|
presentationMode={presentationMode}
|
|
109
|
-
params={getCheckDepositParams(props)}
|
|
138
|
+
params={getCheckDepositParams(props, veryfiCredentials)}
|
|
110
139
|
script={getCheckDepositScript()}
|
|
111
140
|
onMessage={(message: WebViewMessage) => handleWebViewMessage(message)}
|
|
112
141
|
theme={props.theme}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { CheckMessage } from '../../messages/webMessages/checkMessage';
|
|
2
2
|
import type { UNCheckDepositComponentProps } from './UNCheckDepositComponent';
|
|
3
|
-
import { LISTENERS } from '../../scripts/html/bodyScript';
|
|
3
|
+
import { DISPATCH_VERYFI_RESPONSE, LISTENERS } from '../../scripts/html/bodyScript';
|
|
4
|
+
import { isVeryfiAvailable, type UNVeryfiImage } from '../../services/veryfiService';
|
|
5
|
+
import type WebView from 'react-native-webview';
|
|
6
|
+
import type { UNVeryfiCredentials } from '../../types/shared/veryfi.types';
|
|
4
7
|
|
|
5
|
-
export const getCheckDepositParams = (props: UNCheckDepositComponentProps) => {
|
|
8
|
+
export const getCheckDepositParams = (props: UNCheckDepositComponentProps, veryfiCredentials?: UNVeryfiCredentials | null) => {
|
|
6
9
|
const feeParam = props.fee ? `fee="${props.fee}"` : '';
|
|
10
|
+
const useVeryfi = veryfiCredentials && isVeryfiAvailable();
|
|
11
|
+
const versionParam = useVeryfi ? 'version="veryfi"' : '';
|
|
7
12
|
return `
|
|
8
13
|
account-id="${props.accountId}"
|
|
9
14
|
${feeParam}
|
|
15
|
+
${versionParam}
|
|
10
16
|
initial-stage-back-button="${props.initialStageBackButton ?? false}"
|
|
11
17
|
final-stage-done-button="${props.finalStageDoneButton ?? false}"
|
|
12
18
|
`;
|
|
@@ -41,5 +47,11 @@ export const getCheckDepositScript = () => {
|
|
|
41
47
|
${LISTENERS.unitPaymentInitialStageBackButtonClicked}
|
|
42
48
|
${LISTENERS.unitPaymentFinalStageDoneButtonClicked}
|
|
43
49
|
${CHECK_DEPOSIT_LISTENERS.restartRequest}
|
|
50
|
+
${DISPATCH_VERYFI_RESPONSE}
|
|
44
51
|
`;
|
|
45
52
|
};
|
|
53
|
+
|
|
54
|
+
export const injectUnitVeryfiResponse = (currentWeb: WebView | null, images: UNVeryfiImage[]) => {
|
|
55
|
+
const payload = { images };
|
|
56
|
+
currentWeb?.injectJavaScript(`dispatchVeryfiEvent(${JSON.stringify(payload)})`);
|
|
57
|
+
};
|
|
@@ -7,6 +7,7 @@ import { ActivityMessage } from '../../messages/webMessages/activityMessage';
|
|
|
7
7
|
import { PlaidMessage } from '../../messages/webMessages/plaidMessages';
|
|
8
8
|
import { PayeeManagementMessage } from '../../messages/webMessages/payeeManagementMessage';
|
|
9
9
|
import { MultipleCardsMessage } from '../../messages/webMessages/multipleCardsMessage';
|
|
10
|
+
import { VeryfiMessage } from '../../messages/webMessages/veryfiMessages';
|
|
10
11
|
import { WebComponentType } from '../../types/internal/webComponent.types';
|
|
11
12
|
import { UserDataKeys } from '../../types/internal/unitStore.types';
|
|
12
13
|
|
|
@@ -360,6 +361,15 @@ export const DISPATCH_PLAID_RESPONSE = `
|
|
|
360
361
|
}
|
|
361
362
|
`;
|
|
362
363
|
|
|
364
|
+
export const DISPATCH_VERYFI_RESPONSE = `
|
|
365
|
+
const dispatchVeryfiEvent = (details) => {
|
|
366
|
+
const element = document.querySelector("${WebComponentType.checkDeposit}")
|
|
367
|
+
if (!element) return;
|
|
368
|
+
const event = new CustomEvent("${VeryfiMessage.UNIT_VERYFI_RESPONSE}",{ detail: details })
|
|
369
|
+
element.dispatchEvent(event)
|
|
370
|
+
}
|
|
371
|
+
`;
|
|
372
|
+
|
|
363
373
|
export const DISPATCH_PLAID_EXIT = `
|
|
364
374
|
const dispatchPlaidExit = (details) => {
|
|
365
375
|
const event = new CustomEvent("${PlaidMessage.UNIT_PLAID_EXIT}",{ detail: details })
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { NativeEventEmitter } from 'react-native';
|
|
2
|
+
import type { UNVeryfiCredentials } from '../types/shared/veryfi.types';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
+
let VeryfiLens: any = null;
|
|
6
|
+
try {
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
8
|
+
VeryfiLens = require('@veryfi/react-native-veryfi-lens').default;
|
|
9
|
+
} catch {
|
|
10
|
+
// Veryfi SDK not installed — will use web fallback
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const isVeryfiAvailable = (): boolean => {
|
|
14
|
+
return VeryfiLens != null;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export interface UNVeryfiImage {
|
|
18
|
+
base64Img: string;
|
|
19
|
+
isFront: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const CHECK_SETTINGS = {
|
|
23
|
+
documentTypes: ['check'],
|
|
24
|
+
checksBackIsOn: true,
|
|
25
|
+
blurDetectionIsOn: true,
|
|
26
|
+
autoDocDetectionAndCropIsOn: true,
|
|
27
|
+
dataExtractionEngine: true,
|
|
28
|
+
returnStitchedPDF: true,
|
|
29
|
+
originalImageMaxSizeInMB: 1.4,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const configureAndShowVeryfiCamera = (
|
|
33
|
+
credentials: UNVeryfiCredentials,
|
|
34
|
+
onImages: (images: UNVeryfiImage[]) => void,
|
|
35
|
+
onError: (error: string) => void
|
|
36
|
+
): void => {
|
|
37
|
+
if (!VeryfiLens) {
|
|
38
|
+
onError('Veryfi SDK is not available');
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const emitter = new NativeEventEmitter(VeryfiLens.NativeModule);
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
+
const subscriptions: any[] = [];
|
|
45
|
+
let delivered = false;
|
|
46
|
+
|
|
47
|
+
const cleanup = () => {
|
|
48
|
+
subscriptions.forEach((sub) => sub.remove());
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const deliverImages = (imagePaths: string[]) => {
|
|
52
|
+
if (delivered) return;
|
|
53
|
+
delivered = true;
|
|
54
|
+
|
|
55
|
+
let converted = 0;
|
|
56
|
+
const images: UNVeryfiImage[] = [];
|
|
57
|
+
|
|
58
|
+
imagePaths.forEach((filePath, index) => {
|
|
59
|
+
VeryfiLens.getFileBase64(
|
|
60
|
+
filePath,
|
|
61
|
+
// errorCallback
|
|
62
|
+
() => {
|
|
63
|
+
converted++;
|
|
64
|
+
if (converted === imagePaths.length) {
|
|
65
|
+
cleanup();
|
|
66
|
+
if (images.length > 0) {
|
|
67
|
+
onImages(images);
|
|
68
|
+
} else {
|
|
69
|
+
onError('Failed to convert check images');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
// successCallback
|
|
74
|
+
(base64Data: string) => {
|
|
75
|
+
images.push({
|
|
76
|
+
base64Img: base64Data,
|
|
77
|
+
isFront: index === 1,
|
|
78
|
+
});
|
|
79
|
+
converted++;
|
|
80
|
+
if (converted === imagePaths.length) {
|
|
81
|
+
cleanup();
|
|
82
|
+
onImages(images);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// Process images when stitched PDF is ready (matches Android pattern)
|
|
90
|
+
subscriptions.push(
|
|
91
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
|
+
emitter.addListener(VeryfiLens.Events.onVeryfiLensUpdate, (event: any) => {
|
|
93
|
+
if (event.status === 'inprogress' && event.msg === 'img_stitched_pdf_path') {
|
|
94
|
+
const paths = event.img_original_paths || [];
|
|
95
|
+
if (paths.length > 0) {
|
|
96
|
+
deliverImages(paths);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
// No onClose listener — if the user cancels, we simply don't dispatch
|
|
103
|
+
// unitVeryfiResponse, and the web SDK's polling handles the timeout.
|
|
104
|
+
|
|
105
|
+
subscriptions.push(
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
107
|
+
emitter.addListener(VeryfiLens.Events.onVeryfiLensError, (event: any) => {
|
|
108
|
+
cleanup();
|
|
109
|
+
onError(event.msg || 'Veryfi error');
|
|
110
|
+
})
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const veryfiCredentials = {
|
|
114
|
+
clientId: credentials.clientId,
|
|
115
|
+
userName: credentials.userName,
|
|
116
|
+
apiKey: credentials.apiKey,
|
|
117
|
+
url: credentials.url,
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
VeryfiLens.configureWithCredentials(veryfiCredentials, CHECK_SETTINGS, () => {
|
|
121
|
+
VeryfiLens.showCamera();
|
|
122
|
+
});
|
|
123
|
+
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
2
2
|
import type { RootState } from '../store';
|
|
3
|
+
import type { UNVeryfiCredentials } from '../types/shared/veryfi.types';
|
|
3
4
|
|
|
4
5
|
export interface ConfigurationState {
|
|
5
6
|
unitScript?: string;
|
|
6
7
|
theme?: string;
|
|
7
8
|
language?: string;
|
|
8
9
|
customerToken?: string;
|
|
10
|
+
veryfiCredentials?: UNVeryfiCredentials;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
const initialState: ConfigurationState = {};
|
|
@@ -25,10 +27,13 @@ const ConfigurationSlice = createSlice({
|
|
|
25
27
|
},
|
|
26
28
|
setCustomerToken(state, action: PayloadAction<string | undefined>) {
|
|
27
29
|
state.customerToken = action.payload;
|
|
28
|
-
}
|
|
30
|
+
},
|
|
31
|
+
setVeryfiCredentials(state, action: PayloadAction<UNVeryfiCredentials | undefined>) {
|
|
32
|
+
state.veryfiCredentials = action.payload;
|
|
33
|
+
},
|
|
29
34
|
},
|
|
30
35
|
});
|
|
31
36
|
|
|
32
|
-
export const { setUnitScript, setLanguage, setTheme, setCustomerToken } = ConfigurationSlice.actions;
|
|
37
|
+
export const { setUnitScript, setLanguage, setTheme, setCustomerToken, setVeryfiCredentials } = ConfigurationSlice.actions;
|
|
33
38
|
export const selectConfiguration = (state: RootState) => state.configuration;
|
|
34
39
|
export default ConfigurationSlice.reducer;
|
|
@@ -5,9 +5,10 @@ import type { UNFonts } from '../types/shared/fonts.types';
|
|
|
5
5
|
import { warnClientIfNeeded } from '../utils/webVersioningStrategy.utils';
|
|
6
6
|
import { UNComponentsSDKConstants } from './UnitComponentsSdk.constants';
|
|
7
7
|
import type { UNComponentsWebVersioningStrategy } from '../types/shared';
|
|
8
|
-
import { setTheme, setLanguage, setCustomerToken } from '../slices/ConfigurationSlice';
|
|
8
|
+
import { setTheme, setLanguage, setCustomerToken, setVeryfiCredentials } from '../slices/ConfigurationSlice';
|
|
9
9
|
import { store } from '../store/store';
|
|
10
10
|
import { UNComponentsEnvironment } from '../types/shared/env.types';
|
|
11
|
+
import type { UNVeryfiCredentials } from '../types/shared/veryfi.types';
|
|
11
12
|
import { UserDataKeys } from '../types/internal/unitStore.types';
|
|
12
13
|
import UNStoreManagerHelper from '../nativeModulesHelpers/UNStoreModuleHelper/UNStoreModuleHelper';
|
|
13
14
|
import { UnitComponentsHelpersManager } from './unitComponentsHelpersManager/UnitComponentsHelpersManager';
|
|
@@ -26,7 +27,7 @@ export class UnitComponentsSDK {
|
|
|
26
27
|
protected static fonts?: UNFonts;
|
|
27
28
|
protected static signedNonce?: string;
|
|
28
29
|
protected static pushProvisionModule?: typeof NativeModules;
|
|
29
|
-
protected static sdkVersion = '3.1
|
|
30
|
+
protected static sdkVersion = '3.3.0-beta.1';
|
|
30
31
|
static iosFontBase64Map: Record<string, string> = {};
|
|
31
32
|
|
|
32
33
|
public static init = async (
|
|
@@ -115,6 +116,10 @@ export class UnitComponentsSDK {
|
|
|
115
116
|
return this.sdkVersion;
|
|
116
117
|
};
|
|
117
118
|
|
|
119
|
+
public static setVeryfiCredentials = (credentials: UNVeryfiCredentials) => {
|
|
120
|
+
store.dispatch(setVeryfiCredentials(credentials));
|
|
121
|
+
};
|
|
122
|
+
|
|
118
123
|
public static cleanUserData = () => {
|
|
119
124
|
UNStoreManagerHelper.cleanValue(UserDataKeys.unitCustomerToken);
|
|
120
125
|
UNStoreManagerHelper.cleanValue(UserDataKeys.unitVerifiedCustomerToken);
|