@trustchex/react-native-sdk 1.354.0 → 1.355.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 +3 -1
- package/lib/module/Screens/Dynamic/IdentityDocumentEIDScanningScreen.js +1 -1
- package/lib/module/Screens/Dynamic/IdentityDocumentScanningScreen.js +1 -1
- package/lib/module/Screens/Static/ResultScreen.js +0 -11
- package/lib/module/Shared/Components/IdentityDocumentCamera.js +10 -19
- package/lib/module/Shared/Libs/http-client.js +1 -0
- package/lib/module/Shared/Libs/mrz.utils.js +0 -1
- package/lib/module/Shared/Libs/worklet.utils.js +15 -0
- package/lib/module/Trustchex.js +1 -17
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/http-client.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/worklet.utils.d.ts +6 -0
- package/lib/typescript/src/Shared/Libs/worklet.utils.d.ts.map +1 -1
- package/lib/typescript/src/Trustchex.d.ts.map +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +10 -2
- package/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.tsx +1 -1
- package/src/Screens/Dynamic/IdentityDocumentScanningScreen.tsx +1 -1
- package/src/Screens/Static/ResultScreen.tsx +0 -16
- package/src/Shared/Components/IdentityDocumentCamera.tsx +12 -21
- package/src/Shared/Libs/debounce.utils.ts +1 -1
- package/src/Shared/Libs/http-client.ts +1 -0
- package/src/Shared/Libs/mrz.utils.ts +0 -1
- package/src/Shared/Libs/worklet.utils.ts +14 -0
- package/src/Trustchex.tsx +2 -14
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -27,9 +27,11 @@ npm install @trustchex/react-native-sdk
|
|
|
27
27
|
npm install @react-native-community/image-editor@^4.3.0 \
|
|
28
28
|
@react-navigation/native@^7.1.14 \
|
|
29
29
|
@react-navigation/native-stack@^7.3.21 \
|
|
30
|
+
@react-navigation/stack@^7.4.2 \
|
|
30
31
|
lottie-react-native@^7.2.4 \
|
|
31
32
|
react-native-compressor@^1.12.0 \
|
|
32
|
-
react-native-
|
|
33
|
+
react-native-device-info@^13.0.0 \
|
|
34
|
+
react-native-fast-opencv@^0.4.7 \
|
|
33
35
|
react-native-fs@^2.20.0 \
|
|
34
36
|
react-native-gesture-handler@^2.27.1 \
|
|
35
37
|
react-native-get-random-values@^1.11.0 \
|
|
@@ -131,7 +131,7 @@ const IdentityDocumentEIDScanningScreen = () => {
|
|
|
131
131
|
setDocumentType(data.mrzFields.documentCode === 'I' ? 'ID' : data.mrzFields?.documentCode === 'P' ? 'PASSPORT' : 'UNKNOWN');
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
|
-
showDebugImages:
|
|
134
|
+
showDebugImages: true
|
|
135
135
|
}), /*#__PURE__*/_jsx(View, {
|
|
136
136
|
style: [styles.footer, {
|
|
137
137
|
bottom: insets.bottom
|
|
@@ -103,7 +103,6 @@ const ResultScreen = () => {
|
|
|
103
103
|
const submitIdentificationConsent = useCallback(async (identificationId, sessionKey) => {
|
|
104
104
|
// Ensure device info is always populated before sending consent
|
|
105
105
|
if (!appContext.identificationInfo.consent.deviceInfo) {
|
|
106
|
-
console.log('Device info not set, generating now...');
|
|
107
106
|
appContext.identificationInfo.consent.deviceInfo = await NativeDeviceInfo.generateHumanReadableIdentifier();
|
|
108
107
|
}
|
|
109
108
|
const {
|
|
@@ -238,10 +237,6 @@ const ResultScreen = () => {
|
|
|
238
237
|
}
|
|
239
238
|
await RNFS.copyFile(livenessVideoPath, videoFilePath);
|
|
240
239
|
|
|
241
|
-
// Get original file size
|
|
242
|
-
const originalStats = await RNFS.stat(videoFilePath);
|
|
243
|
-
const originalSize = originalStats.size;
|
|
244
|
-
|
|
245
240
|
// Compress video with maximum compression settings
|
|
246
241
|
const compressedVideoPath = await VideoCompressor.compress(videoFilePath, {
|
|
247
242
|
compressionMethod: 'manual',
|
|
@@ -257,12 +252,6 @@ const ResultScreen = () => {
|
|
|
257
252
|
|
|
258
253
|
// Convert file:// URI to regular path for RNFS upload
|
|
259
254
|
const normalizedPath = compressedVideoPath.replace('file://', '');
|
|
260
|
-
|
|
261
|
-
// Get compressed file size and log difference
|
|
262
|
-
const compressedStats = await RNFS.stat(normalizedPath);
|
|
263
|
-
const compressedSize = compressedStats.size;
|
|
264
|
-
const compressionRatio = ((originalSize - compressedSize) / originalSize * 100).toFixed(2);
|
|
265
|
-
console.log(`Video compression: ${(originalSize / 1024 / 1024).toFixed(2)}MB -> ${(compressedSize / 1024 / 1024).toFixed(2)}MB (${compressionRatio}% reduction)`);
|
|
266
255
|
uploadFileOptions.files.push({
|
|
267
256
|
name: 'files',
|
|
268
257
|
filename: 'LIVENESS_VIDEO.mp4',
|
|
@@ -494,15 +494,10 @@ const IdentityDocumentCamera = ({
|
|
|
494
494
|
|
|
495
495
|
// Early wrong side detection for SCAN_ID_BACK: if faces detected, it's the front side
|
|
496
496
|
if (nextStep === 'SCAN_ID_BACK' && faces.length > 0) {
|
|
497
|
-
console.log('[WRONG_SIDE] Back side expected but faces detected:', faces.length);
|
|
498
497
|
setStatus('INCORRECT');
|
|
499
498
|
return;
|
|
500
499
|
}
|
|
501
500
|
if (!text || text.length < 10 || !image) {
|
|
502
|
-
// Log when searching to help debug
|
|
503
|
-
if (nextStep === 'SCAN_ID_BACK') {
|
|
504
|
-
console.log('[SCAN_ID_BACK] Searching... faces:', faces.length, 'text length:', text?.length || 0);
|
|
505
|
-
}
|
|
506
501
|
setStatus('SEARCHING');
|
|
507
502
|
return;
|
|
508
503
|
}
|
|
@@ -792,7 +787,7 @@ const IdentityDocumentCamera = ({
|
|
|
792
787
|
}
|
|
793
788
|
handleFaceAndText(scannedText.resultText ?? '', detectedFaces, frame.width, frame.height, barcodes.length ? barcodes[0] : undefined, image?.base64);
|
|
794
789
|
} catch (error) {
|
|
795
|
-
console.warn('Frame processing error:', error);
|
|
790
|
+
console.warn('Frame processing error:', error?.message);
|
|
796
791
|
}
|
|
797
792
|
};
|
|
798
793
|
const frameProcessor = useFrameProcessor(frame => {
|
|
@@ -809,24 +804,20 @@ const IdentityDocumentCamera = ({
|
|
|
809
804
|
try {
|
|
810
805
|
handleWorklet(frame);
|
|
811
806
|
} catch (error) {
|
|
812
|
-
console.warn('Frame processor error:', error);
|
|
807
|
+
console.warn('iOS Frame processor error:', error?.message || error?.name || String(error));
|
|
813
808
|
}
|
|
814
809
|
});
|
|
815
810
|
} else {
|
|
816
811
|
// Android: Run async without throttling
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
'worklet';
|
|
812
|
+
runAsync(frame, () => {
|
|
813
|
+
'worklet';
|
|
820
814
|
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
} catch (error) {
|
|
828
|
-
console.warn('Frame processor error:', error);
|
|
829
|
-
}
|
|
815
|
+
try {
|
|
816
|
+
handleWorklet(frame);
|
|
817
|
+
} catch (workletError) {
|
|
818
|
+
console.warn('[Android workletCallback] Worklet execution error:', workletError?.message || workletError?.name || String(workletError));
|
|
819
|
+
}
|
|
820
|
+
});
|
|
830
821
|
}
|
|
831
822
|
}, [handleFaceAndText, isCameraInitialized]);
|
|
832
823
|
if (!permissionsRequested) {
|
|
@@ -158,6 +158,7 @@ const upload = async (url, file) => {
|
|
|
158
158
|
formData.append('file', file);
|
|
159
159
|
const response = await fetch(url, {
|
|
160
160
|
method: 'POST',
|
|
161
|
+
// @ts-ignore - FormData type mismatch between React Native and standard DOM
|
|
161
162
|
body: formData
|
|
162
163
|
});
|
|
163
164
|
if (!response.ok) {
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Worklets } from 'react-native-worklets-core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A synchronized Shared Value to indicate whether the async context is currently executing
|
|
7
|
+
*/
|
|
4
8
|
let isAsyncContextBusy;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Runs the given function on the async context, and sets isAsyncContextBusy to false after it finished executing.
|
|
12
|
+
*/
|
|
5
13
|
let runOnAsyncContext;
|
|
6
14
|
try {
|
|
7
15
|
isAsyncContextBusy = Worklets.createSharedValue(false);
|
|
@@ -34,6 +42,13 @@ try {
|
|
|
34
42
|
throw new Error('react-native-worklets-core is not installed! Please install it to use Frame Processors.');
|
|
35
43
|
};
|
|
36
44
|
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Runs the given func asynchronously on a separate thread,
|
|
48
|
+
* allowing the Frame Processor to continue executing without dropping a Frame.
|
|
49
|
+
*
|
|
50
|
+
* @note This is a custom implementation. For most cases, use runAsync from react-native-vision-camera.
|
|
51
|
+
*/
|
|
37
52
|
export function runAsync(frame, func) {
|
|
38
53
|
'worklet';
|
|
39
54
|
|
package/lib/module/Trustchex.js
CHANGED
|
@@ -38,13 +38,6 @@ const Trustchex = ({
|
|
|
38
38
|
onError,
|
|
39
39
|
enableAnalytics = true
|
|
40
40
|
}) => {
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
console.log('[Trustchex] Props updated:', {
|
|
43
|
-
baseUrl: propBaseUrl,
|
|
44
|
-
sessionId: propSessionId,
|
|
45
|
-
enableAnalytics
|
|
46
|
-
});
|
|
47
|
-
}, [propBaseUrl, propSessionId, enableAnalytics]);
|
|
48
41
|
const [baseUrl, setBaseUrl] = useState(null);
|
|
49
42
|
const [sessionId, setSessionId] = useState(null);
|
|
50
43
|
const [locale, setLocale] = useState(propLocale || i18n.language);
|
|
@@ -76,24 +69,15 @@ const Trustchex = ({
|
|
|
76
69
|
setIsDemoSession
|
|
77
70
|
}), [baseUrl, locale, branding, sessionId, propLocale, onCompleted, onError, isDemoSession]);
|
|
78
71
|
|
|
79
|
-
// Initialize analytics
|
|
72
|
+
// Initialize analytics when SDK mounts with valid session
|
|
80
73
|
useEffect(() => {
|
|
81
|
-
console.log('[Trustchex] Analytics check:', {
|
|
82
|
-
enableAnalytics,
|
|
83
|
-
hasBaseUrl: !!baseUrl,
|
|
84
|
-
hasSessionId: !!sessionId,
|
|
85
|
-
analyticsInitialized,
|
|
86
|
-
sessionId: sessionId?.substring(0, 8) + '...'
|
|
87
|
-
});
|
|
88
74
|
if (enableAnalytics && baseUrl && sessionId && !analyticsInitialized) {
|
|
89
|
-
console.log('[Trustchex] Initializing analytics...');
|
|
90
75
|
// Initialize analytics synchronously with the verification sessionId
|
|
91
76
|
analyticsService.initialize({
|
|
92
77
|
enabled: true,
|
|
93
78
|
baseUrl: baseUrl,
|
|
94
79
|
verificationSessionId: sessionId // Pass the verification session ID from backend
|
|
95
80
|
}).then(() => {
|
|
96
|
-
console.log('[Trustchex] Analytics initialized successfully');
|
|
97
81
|
setAnalyticsInitialized(true);
|
|
98
82
|
// Track session start as the very first event
|
|
99
83
|
analyticsService.trackEvent(AnalyticsEventName.SESSION_START, AnalyticsEventCategory.SESSION, {
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultScreen.d.ts","sourceRoot":"","sources":["../../../../../src/Screens/Static/ResultScreen.tsx"],"names":[],"mappings":"AAkDA,QAAA,MAAM,YAAY,+
|
|
1
|
+
{"version":3,"file":"ResultScreen.d.ts","sourceRoot":"","sources":["../../../../../src/Screens/Static/ResultScreen.tsx"],"names":[],"mappings":"AAkDA,QAAA,MAAM,YAAY,+CAqzBjB,CAAC;AAoIF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdentityDocumentCamera.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Components/IdentityDocumentCamera.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAA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B,EAAE,gBAAgB;IACrC,YAAY,EAAE,SAAS;IACvB,WAAW,EAAE,MAAM;CACpB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EACV,gBAAgB,GAChB,UAAU,GACV,oBAAoB,GACpB,eAAe,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,OAAO,CAAC;IACrB,yBAAyB,EAAE,CAAC,WAAW,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACtE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAaD,QAAA,MAAM,sBAAsB,GAAI,8DAI7B,2BAA2B,
|
|
1
|
+
{"version":3,"file":"IdentityDocumentCamera.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Components/IdentityDocumentCamera.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AA6BxC,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,YAAY,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,UAAU,EAAE,SAAS,CAAC;IACtB,iBAAiB,EAAE,gBAAgB,CAAC;IACpC,KAAK,EAAE,SAAS,CAAC;IACjB,cAAc,EAAE,MAAM,EAAE,GAA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,mBAAoB,SAAQ,eAAe;gBAC1C,OAAO,CAAC,EAAE,MAAM;CAG7B;;UAyIY,SAAS,OAAO,MAAM,sBAAsB,SAAS;WASpD,SAAS,EAAE,KAAK,OACvB,MAAM,SACJ,KAAK,sBACQ,SAAS;UAKlB,SAAS,EAAE,KAAK,OACtB,MAAM,SACJ,GAAG,sBACU,SAAS;UAKlB,SAAS,OAAO,MAAM,sBAAsB,SAAS;kBASvC,MAAM,QAAQ,IAAI;;AAe7C,wBAA+C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mrz.utils.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Libs/mrz.utils.ts"],"names":[],"mappings":";0BA+F6B,MAAM;;;;
|
|
1
|
+
{"version":3,"file":"mrz.utils.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Libs/mrz.utils.ts"],"names":[],"mappings":";0BA+F6B,MAAM;;;;wCAqEQ,MAAM,GAAG,IAAI;;AAkBxD,wBAGE"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { Frame } from 'react-native-vision-camera';
|
|
2
|
+
/**
|
|
3
|
+
* Runs the given func asynchronously on a separate thread,
|
|
4
|
+
* allowing the Frame Processor to continue executing without dropping a Frame.
|
|
5
|
+
*
|
|
6
|
+
* @note This is a custom implementation. For most cases, use runAsync from react-native-vision-camera.
|
|
7
|
+
*/
|
|
2
8
|
export declare function runAsync(frame: Frame, func: () => void): void;
|
|
3
9
|
//# sourceMappingURL=worklet.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worklet.utils.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Libs/worklet.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"worklet.utils.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Libs/worklet.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,4BAA4B,CAAC;AAgDvE;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,GAAG,IAAI,CAiB7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Trustchex.d.ts","sourceRoot":"","sources":["../../../src/Trustchex.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,gCAAgC,CAAC;AAuBxC,UAAU,iBAAiB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,cAAc;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AASD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"Trustchex.d.ts","sourceRoot":"","sources":["../../../src/Trustchex.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,gCAAgC,CAAC;AAuBxC,UAAU,iBAAiB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,cAAc;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AASD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAuKvC,CAAC;AAWF,eAAe,SAAS,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.
|
|
1
|
+
export declare const SDK_VERSION = "1.355.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trustchex/react-native-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.355.1",
|
|
4
4
|
"description": "Trustchex mobile app react native SDK for android or ios devices",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -53,10 +53,18 @@
|
|
|
53
53
|
"!**/.*"
|
|
54
54
|
],
|
|
55
55
|
"workspaces": [
|
|
56
|
-
"example"
|
|
56
|
+
"example",
|
|
57
|
+
"example-expo"
|
|
57
58
|
],
|
|
58
59
|
"scripts": {
|
|
59
60
|
"example": "yarn workspace @trustchex/react-native-sdk-example",
|
|
61
|
+
"example:android": "yarn example android",
|
|
62
|
+
"example:ios": "yarn example ios",
|
|
63
|
+
"example:start": "yarn example start",
|
|
64
|
+
"example-expo": "yarn workspace @trustchex/react-native-sdk-example-expo",
|
|
65
|
+
"example-expo:android": "yarn example-expo android",
|
|
66
|
+
"example-expo:ios": "yarn example-expo ios",
|
|
67
|
+
"example-expo:start": "yarn example-expo start",
|
|
60
68
|
"test": "jest",
|
|
61
69
|
"typecheck": "tsc",
|
|
62
70
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
@@ -158,7 +158,7 @@ const IdentityDocumentScanningScreen = () => {
|
|
|
158
158
|
setPassportData(data);
|
|
159
159
|
}
|
|
160
160
|
}}
|
|
161
|
-
showDebugImages={
|
|
161
|
+
showDebugImages={true}
|
|
162
162
|
/>
|
|
163
163
|
<View style={[styles.footer, { bottom: insets.bottom }]}>
|
|
164
164
|
<NavigationManager ref={navigationManagerRef} />
|
|
@@ -158,7 +158,6 @@ const ResultScreen = () => {
|
|
|
158
158
|
async (identificationId: string, sessionKey: string) => {
|
|
159
159
|
// Ensure device info is always populated before sending consent
|
|
160
160
|
if (!appContext.identificationInfo.consent.deviceInfo) {
|
|
161
|
-
console.log('Device info not set, generating now...');
|
|
162
161
|
appContext.identificationInfo.consent.deviceInfo =
|
|
163
162
|
await NativeDeviceInfo.generateHumanReadableIdentifier();
|
|
164
163
|
}
|
|
@@ -391,10 +390,6 @@ const ResultScreen = () => {
|
|
|
391
390
|
}
|
|
392
391
|
await RNFS.copyFile(livenessVideoPath, videoFilePath);
|
|
393
392
|
|
|
394
|
-
// Get original file size
|
|
395
|
-
const originalStats = await RNFS.stat(videoFilePath);
|
|
396
|
-
const originalSize = originalStats.size;
|
|
397
|
-
|
|
398
393
|
// Compress video with maximum compression settings
|
|
399
394
|
const compressedVideoPath = await VideoCompressor.compress(
|
|
400
395
|
videoFilePath,
|
|
@@ -413,17 +408,6 @@ const ResultScreen = () => {
|
|
|
413
408
|
// Convert file:// URI to regular path for RNFS upload
|
|
414
409
|
const normalizedPath = compressedVideoPath.replace('file://', '');
|
|
415
410
|
|
|
416
|
-
// Get compressed file size and log difference
|
|
417
|
-
const compressedStats = await RNFS.stat(normalizedPath);
|
|
418
|
-
const compressedSize = compressedStats.size;
|
|
419
|
-
const compressionRatio = (
|
|
420
|
-
((originalSize - compressedSize) / originalSize) *
|
|
421
|
-
100
|
|
422
|
-
).toFixed(2);
|
|
423
|
-
console.log(
|
|
424
|
-
`Video compression: ${(originalSize / 1024 / 1024).toFixed(2)}MB -> ${(compressedSize / 1024 / 1024).toFixed(2)}MB (${compressionRatio}% reduction)`
|
|
425
|
-
);
|
|
426
|
-
|
|
427
411
|
uploadFileOptions.files.push({
|
|
428
412
|
name: 'files',
|
|
429
413
|
filename: 'LIVENESS_VIDEO.mp4',
|
|
@@ -756,16 +756,11 @@ const IdentityDocumentCamera = ({
|
|
|
756
756
|
|
|
757
757
|
// Early wrong side detection for SCAN_ID_BACK: if faces detected, it's the front side
|
|
758
758
|
if (nextStep === 'SCAN_ID_BACK' && faces.length > 0) {
|
|
759
|
-
console.log('[WRONG_SIDE] Back side expected but faces detected:', faces.length);
|
|
760
759
|
setStatus('INCORRECT');
|
|
761
760
|
return;
|
|
762
761
|
}
|
|
763
762
|
|
|
764
763
|
if (!text || text.length < 10 || !image) {
|
|
765
|
-
// Log when searching to help debug
|
|
766
|
-
if (nextStep === 'SCAN_ID_BACK') {
|
|
767
|
-
console.log('[SCAN_ID_BACK] Searching... faces:', faces.length, 'text length:', text?.length || 0);
|
|
768
|
-
}
|
|
769
764
|
setStatus('SEARCHING');
|
|
770
765
|
return;
|
|
771
766
|
}
|
|
@@ -1152,8 +1147,8 @@ const IdentityDocumentCamera = ({
|
|
|
1152
1147
|
barcodes.length ? barcodes[0] : undefined,
|
|
1153
1148
|
image?.base64
|
|
1154
1149
|
);
|
|
1155
|
-
} catch (error) {
|
|
1156
|
-
console.warn('Frame processing error:', error);
|
|
1150
|
+
} catch (error: any) {
|
|
1151
|
+
console.warn('Frame processing error:', error?.message);
|
|
1157
1152
|
}
|
|
1158
1153
|
};
|
|
1159
1154
|
|
|
@@ -1171,24 +1166,20 @@ const IdentityDocumentCamera = ({
|
|
|
1171
1166
|
'worklet';
|
|
1172
1167
|
try {
|
|
1173
1168
|
handleWorklet(frame);
|
|
1174
|
-
} catch (error) {
|
|
1175
|
-
console.warn('Frame processor error:', error);
|
|
1169
|
+
} catch (error: any) {
|
|
1170
|
+
console.warn('iOS Frame processor error:', error?.message || error?.name || String(error));
|
|
1176
1171
|
}
|
|
1177
1172
|
});
|
|
1178
1173
|
} else {
|
|
1179
1174
|
// Android: Run async without throttling
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
});
|
|
1189
|
-
} catch (error) {
|
|
1190
|
-
console.warn('Frame processor error:', error);
|
|
1191
|
-
}
|
|
1175
|
+
runAsync(frame, () => {
|
|
1176
|
+
'worklet';
|
|
1177
|
+
try {
|
|
1178
|
+
handleWorklet(frame);
|
|
1179
|
+
} catch (workletError: any) {
|
|
1180
|
+
console.warn('[Android workletCallback] Worklet execution error:', workletError?.message || workletError?.name || String(workletError));
|
|
1181
|
+
}
|
|
1182
|
+
});
|
|
1192
1183
|
}
|
|
1193
1184
|
},
|
|
1194
1185
|
[handleFaceAndText, isCameraInitialized]
|
|
@@ -9,7 +9,7 @@ const debounce = <T extends (...args: any[]) => any>(
|
|
|
9
9
|
func: T,
|
|
10
10
|
wait: number
|
|
11
11
|
): ((...args: Parameters<T>) => void) => {
|
|
12
|
-
let timeout:
|
|
12
|
+
let timeout: ReturnType<typeof setTimeout> | null = null;
|
|
13
13
|
let lastCallTime = 0;
|
|
14
14
|
|
|
15
15
|
return (...args: Parameters<T>): void => {
|
|
@@ -125,7 +125,6 @@ const getMRZData = (ocrText: string) => {
|
|
|
125
125
|
try {
|
|
126
126
|
const correctedResult = parse(correctedMRZ, { autocorrect: true });
|
|
127
127
|
if (isValidParse(correctedResult)) {
|
|
128
|
-
console.log('[MRZ] OCR correction applied successfully');
|
|
129
128
|
return {
|
|
130
129
|
mrzText: correctedMRZ,
|
|
131
130
|
parsedResult: correctedResult,
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import type { Frame, FrameInternal } from 'react-native-vision-camera';
|
|
2
2
|
import { Worklets } from 'react-native-worklets-core';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* A synchronized Shared Value to indicate whether the async context is currently executing
|
|
6
|
+
*/
|
|
4
7
|
let isAsyncContextBusy: { value: boolean };
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Runs the given function on the async context, and sets isAsyncContextBusy to false after it finished executing.
|
|
11
|
+
*/
|
|
5
12
|
let runOnAsyncContext: (frame: Frame, func: () => void) => void;
|
|
6
13
|
|
|
7
14
|
try {
|
|
8
15
|
isAsyncContextBusy = Worklets.createSharedValue(false);
|
|
9
16
|
|
|
10
17
|
const asyncContext = Worklets.defaultContext;
|
|
18
|
+
|
|
11
19
|
runOnAsyncContext = asyncContext.createRunAsync(
|
|
12
20
|
(frame: Frame, func: () => void) => {
|
|
13
21
|
'worklet';
|
|
@@ -38,6 +46,12 @@ try {
|
|
|
38
46
|
};
|
|
39
47
|
}
|
|
40
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Runs the given func asynchronously on a separate thread,
|
|
51
|
+
* allowing the Frame Processor to continue executing without dropping a Frame.
|
|
52
|
+
*
|
|
53
|
+
* @note This is a custom implementation. For most cases, use runAsync from react-native-vision-camera.
|
|
54
|
+
*/
|
|
41
55
|
export function runAsync(frame: Frame, func: () => void): void {
|
|
42
56
|
'worklet';
|
|
43
57
|
|
package/src/Trustchex.tsx
CHANGED
|
@@ -59,9 +59,7 @@ const Trustchex: React.FC<TrustchexProps> = ({
|
|
|
59
59
|
onError,
|
|
60
60
|
enableAnalytics = true,
|
|
61
61
|
}) => {
|
|
62
|
-
|
|
63
|
-
console.log('[Trustchex] Props updated:', { baseUrl: propBaseUrl, sessionId: propSessionId, enableAnalytics });
|
|
64
|
-
}, [propBaseUrl, propSessionId, enableAnalytics]);
|
|
62
|
+
|
|
65
63
|
|
|
66
64
|
const [baseUrl, setBaseUrl] = useState<string | null>(null);
|
|
67
65
|
const [sessionId, setSessionId] = useState<string | null>(null);
|
|
@@ -104,18 +102,9 @@ const Trustchex: React.FC<TrustchexProps> = ({
|
|
|
104
102
|
[baseUrl, locale, branding, sessionId, propLocale, onCompleted, onError, isDemoSession]
|
|
105
103
|
);
|
|
106
104
|
|
|
107
|
-
// Initialize analytics
|
|
105
|
+
// Initialize analytics when SDK mounts with valid session
|
|
108
106
|
useEffect(() => {
|
|
109
|
-
console.log('[Trustchex] Analytics check:', {
|
|
110
|
-
enableAnalytics,
|
|
111
|
-
hasBaseUrl: !!baseUrl,
|
|
112
|
-
hasSessionId: !!sessionId,
|
|
113
|
-
analyticsInitialized,
|
|
114
|
-
sessionId: sessionId?.substring(0, 8) + '...'
|
|
115
|
-
});
|
|
116
|
-
|
|
117
107
|
if (enableAnalytics && baseUrl && sessionId && !analyticsInitialized) {
|
|
118
|
-
console.log('[Trustchex] Initializing analytics...');
|
|
119
108
|
// Initialize analytics synchronously with the verification sessionId
|
|
120
109
|
analyticsService
|
|
121
110
|
.initialize({
|
|
@@ -124,7 +113,6 @@ const Trustchex: React.FC<TrustchexProps> = ({
|
|
|
124
113
|
verificationSessionId: sessionId, // Pass the verification session ID from backend
|
|
125
114
|
})
|
|
126
115
|
.then(() => {
|
|
127
|
-
console.log('[Trustchex] Analytics initialized successfully');
|
|
128
116
|
setAnalyticsInitialized(true);
|
|
129
117
|
// Track session start as the very first event
|
|
130
118
|
analyticsService.trackEvent(
|
package/src/version.ts
CHANGED