@trustchex/react-native-sdk 1.355.1 → 1.357.0
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 +2 -9
- package/TrustchexSDK.podspec +5 -4
- package/android/build.gradle +6 -4
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/trustchex/reactnativesdk/TrustchexSDKPackage.kt +45 -25
- package/android/src/main/java/com/trustchex/reactnativesdk/camera/TrustchexCameraManager.kt +168 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/camera/TrustchexCameraView.kt +871 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/mlkit/MLKitModule.kt +245 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/mrz/MRZValidationModule.kt +785 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/mrz/MRZValidator.kt +419 -0
- package/android/src/main/java/com/trustchex/reactnativesdk/opencv/OpenCVModule.kt +818 -0
- package/ios/Camera/TrustchexCameraManager.m +37 -0
- package/ios/Camera/TrustchexCameraManager.swift +125 -0
- package/ios/Camera/TrustchexCameraView.swift +1176 -0
- package/ios/MLKit/MLKitModule.m +23 -0
- package/ios/MLKit/MLKitModule.swift +250 -0
- package/ios/MRZValidation.m +39 -0
- package/ios/MRZValidation.swift +802 -0
- package/ios/MRZValidator.swift +466 -0
- package/ios/OpenCV/OpenCVModule.h +4 -0
- package/ios/OpenCV/OpenCVModule.mm +810 -0
- package/lib/module/Screens/Dynamic/IdentityDocumentEIDScanningScreen.js +2 -3
- package/lib/module/Screens/Dynamic/IdentityDocumentScanningScreen.js +1 -2
- package/lib/module/Screens/Dynamic/LivenessDetectionScreen.js +418 -193
- package/lib/module/Screens/Static/OTPVerificationScreen.js +11 -11
- package/lib/module/Screens/Static/QrCodeScanningScreen.js +5 -1
- package/lib/module/Screens/Static/ResultScreen.js +25 -2
- package/lib/module/Screens/Static/VerificationSessionCheckScreen.js +25 -7
- package/lib/module/Shared/Components/DebugNavigationPanel.js +234 -24
- package/lib/module/Shared/Components/EIDScanner.js +99 -9
- package/lib/module/Shared/Components/FaceCamera.js +170 -179
- package/lib/module/Shared/Components/IdentityDocumentCamera.js +2151 -771
- package/lib/module/Shared/Components/QrCodeScannerCamera.js +109 -107
- package/lib/module/Shared/Components/TrustchexCamera.js +122 -0
- package/lib/module/Shared/EIDReader/tlv/tlv.helpers.js +91 -0
- package/lib/module/Shared/EIDReader/tlv/tlv.utils.js +2 -124
- package/lib/module/Shared/EIDReader/tlv/tlvInputStream.js +4 -4
- package/lib/module/Shared/EIDReader/tlv/tlvOutputState.js +4 -4
- package/lib/module/Shared/EIDReader/tlv/tlvOutputStream.js +4 -4
- package/lib/module/Shared/Libs/analytics.utils.js +2 -2
- package/lib/module/Shared/Libs/debug.utils.js +132 -0
- package/lib/module/Shared/Libs/deeplink.utils.js +6 -5
- package/lib/module/Shared/Libs/demo.utils.js +13 -3
- package/lib/module/Shared/Libs/mrz.utils.js +1 -175
- package/lib/module/Shared/Libs/native-device-info.utils.js +12 -6
- package/lib/module/Shared/Libs/tts.utils.js +40 -6
- package/lib/module/Shared/Services/AnalyticsService.js +9 -8
- package/lib/module/Shared/Types/mrzFields.js +1 -0
- package/lib/module/Translation/Resources/en.js +87 -88
- package/lib/module/Translation/Resources/tr.js +84 -85
- package/lib/module/Trustchex.js +9 -2
- package/lib/module/index.js +1 -0
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/IdentityDocumentScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/LivenessDetectionScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/OTPVerificationScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/QrCodeScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/VerificationSessionCheckScreen.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/DebugNavigationPanel.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/EIDScanner.d.ts +2 -2
- package/lib/typescript/src/Shared/Components/EIDScanner.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/FaceCamera.d.ts +18 -4
- package/lib/typescript/src/Shared/Components/FaceCamera.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts +3 -4
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/QrCodeScannerCamera.d.ts +2 -1
- package/lib/typescript/src/Shared/Components/QrCodeScannerCamera.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/TrustchexCamera.d.ts +124 -0
- package/lib/typescript/src/Shared/Components/TrustchexCamera.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlv.helpers.d.ts +11 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlv.helpers.d.ts.map +1 -0
- package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts +2 -39
- package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/analytics.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/debug.utils.d.ts +42 -0
- package/lib/typescript/src/Shared/Libs/debug.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/deeplink.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/demo.utils.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 +0 -4
- package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/native-device-info.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/tts.utils.d.ts +4 -3
- package/lib/typescript/src/Shared/Libs/tts.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Services/AnalyticsService.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Types/identificationInfo.d.ts +2 -2
- package/lib/typescript/src/Shared/Types/identificationInfo.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Types/mrzFields.d.ts +11 -0
- package/lib/typescript/src/Shared/Types/mrzFields.d.ts.map +1 -0
- package/lib/typescript/src/Translation/Resources/en.d.ts +4 -5
- package/lib/typescript/src/Translation/Resources/en.d.ts.map +1 -1
- package/lib/typescript/src/Translation/Resources/tr.d.ts +4 -5
- package/lib/typescript/src/Translation/Resources/tr.d.ts.map +1 -1
- package/lib/typescript/src/Trustchex.d.ts +2 -0
- package/lib/typescript/src/Trustchex.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +4 -35
- package/src/Screens/Dynamic/ContractAcceptanceScreen.tsx +1 -1
- package/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.tsx +7 -5
- package/src/Screens/Dynamic/IdentityDocumentScanningScreen.tsx +2 -3
- package/src/Screens/Dynamic/LivenessDetectionScreen.tsx +498 -216
- package/src/Screens/Static/OTPVerificationScreen.tsx +37 -31
- package/src/Screens/Static/QrCodeScanningScreen.tsx +8 -1
- package/src/Screens/Static/ResultScreen.tsx +136 -88
- package/src/Screens/Static/VerificationSessionCheckScreen.tsx +46 -13
- package/src/Shared/Components/DebugNavigationPanel.tsx +290 -34
- package/src/Shared/Components/EIDScanner.tsx +94 -16
- package/src/Shared/Components/FaceCamera.tsx +236 -203
- package/src/Shared/Components/IdentityDocumentCamera.tsx +3073 -1030
- package/src/Shared/Components/QrCodeScannerCamera.tsx +133 -127
- package/src/Shared/Components/TrustchexCamera.tsx +289 -0
- package/src/Shared/Config/camera-enhancement.config.ts +2 -2
- package/src/Shared/EIDReader/tlv/tlv.helpers.ts +96 -0
- package/src/Shared/EIDReader/tlv/tlv.utils.ts +2 -125
- package/src/Shared/EIDReader/tlv/tlvInputStream.ts +4 -4
- package/src/Shared/EIDReader/tlv/tlvOutputState.ts +4 -4
- package/src/Shared/EIDReader/tlv/tlvOutputStream.ts +4 -4
- package/src/Shared/Libs/analytics.utils.ts +48 -20
- package/src/Shared/Libs/debug.utils.ts +149 -0
- package/src/Shared/Libs/deeplink.utils.ts +7 -5
- package/src/Shared/Libs/demo.utils.ts +4 -0
- package/src/Shared/Libs/http-client.ts +12 -8
- package/src/Shared/Libs/mrz.utils.ts +1 -163
- package/src/Shared/Libs/native-device-info.utils.ts +12 -6
- package/src/Shared/Libs/tts.utils.ts +48 -6
- package/src/Shared/Services/AnalyticsService.ts +69 -24
- package/src/Shared/Types/identificationInfo.ts +2 -2
- package/src/Shared/Types/mrzFields.ts +29 -0
- package/src/Translation/Resources/en.ts +90 -100
- package/src/Translation/Resources/tr.ts +89 -97
- package/src/Translation/index.ts +1 -1
- package/src/Trustchex.tsx +21 -4
- package/src/index.tsx +14 -0
- package/src/version.ts +1 -1
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/barcodescanner/BarcodeScannerFrameProcessorPlugin.kt +0 -301
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/BitmapUtils.kt +0 -205
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/CropperPlugin.kt +0 -72
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/FrameMetadata.kt +0 -4
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/facedetector/FaceDetectorFrameProcessorPlugin.kt +0 -303
- package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/textrecognition/TextRecognitionFrameProcessorPlugin.kt +0 -115
- package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin-Bridging-Header.h +0 -9
- package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin.mm +0 -22
- package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin.swift +0 -188
- package/ios/VisionCameraPlugins/Cropper/Cropper-Bridging-Header.h +0 -13
- package/ios/VisionCameraPlugins/Cropper/Cropper.h +0 -20
- package/ios/VisionCameraPlugins/Cropper/Cropper.mm +0 -22
- package/ios/VisionCameraPlugins/Cropper/Cropper.swift +0 -145
- package/ios/VisionCameraPlugins/Cropper/CropperUtils.swift +0 -49
- package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin-Bridging-Header.h +0 -4
- package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin.mm +0 -22
- package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin.swift +0 -320
- package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin-Bridging-Header.h +0 -4
- package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin.mm +0 -27
- package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin.swift +0 -144
- package/lib/module/Shared/Libs/camera.utils.js +0 -308
- package/lib/module/Shared/Libs/frame-enhancement.utils.js +0 -133
- package/lib/module/Shared/Libs/opencv.utils.js +0 -21
- package/lib/module/Shared/Libs/worklet.utils.js +0 -68
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.js +0 -46
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.js +0 -35
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/index.js +0 -19
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.js +0 -26
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/types.js +0 -3
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.js +0 -197
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.js +0 -101
- package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.js +0 -60
- package/lib/module/Shared/VisionCameraPlugins/Cropper/index.js +0 -47
- package/lib/module/Shared/VisionCameraPlugins/FaceDetector/Camera.js +0 -42
- package/lib/module/Shared/VisionCameraPlugins/FaceDetector/detectFaces.js +0 -35
- package/lib/module/Shared/VisionCameraPlugins/FaceDetector/index.js +0 -4
- package/lib/module/Shared/VisionCameraPlugins/FaceDetector/types.js +0 -3
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/Camera.js +0 -56
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.js +0 -20
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.js +0 -9
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/index.js +0 -6
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/scanText.js +0 -20
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/translateText.js +0 -19
- package/lib/module/Shared/VisionCameraPlugins/TextRecognition/types.js +0 -3
- package/lib/typescript/src/Shared/Libs/camera.utils.d.ts +0 -87
- package/lib/typescript/src/Shared/Libs/camera.utils.d.ts.map +0 -1
- package/lib/typescript/src/Shared/Libs/frame-enhancement.utils.d.ts +0 -25
- package/lib/typescript/src/Shared/Libs/frame-enhancement.utils.d.ts.map +0 -1
- package/lib/typescript/src/Shared/Libs/opencv.utils.d.ts +0 -3
- package/lib/typescript/src/Shared/Libs/opencv.utils.d.ts.map +0 -1
- package/lib/typescript/src/Shared/Libs/worklet.utils.d.ts +0 -9
- package/lib/typescript/src/Shared/Libs/worklet.utils.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.d.ts +0 -13
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.d.ts +0 -6
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/index.d.ts +0 -12
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/index.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.d.ts +0 -3
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/types.d.ts +0 -52
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/types.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.d.ts +0 -62
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.d.ts +0 -34
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.d.ts +0 -32
- package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/Cropper/index.d.ts +0 -23
- package/lib/typescript/src/Shared/VisionCameraPlugins/Cropper/index.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/Camera.d.ts +0 -9
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/Camera.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.d.ts +0 -3
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/index.d.ts +0 -3
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/index.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/types.d.ts +0 -79
- package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/types.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/Camera.d.ts +0 -6
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/Camera.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.d.ts +0 -3
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.d.ts +0 -3
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/index.d.ts +0 -5
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/index.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/scanText.d.ts +0 -3
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/scanText.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/translateText.d.ts +0 -3
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/translateText.d.ts.map +0 -1
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/types.d.ts +0 -67
- package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/types.d.ts.map +0 -1
- package/src/Shared/Libs/camera.utils.ts +0 -345
- package/src/Shared/Libs/frame-enhancement.utils.ts +0 -217
- package/src/Shared/Libs/opencv.utils.ts +0 -40
- package/src/Shared/Libs/worklet.utils.ts +0 -72
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.ts +0 -79
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.ts +0 -46
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/index.ts +0 -60
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.ts +0 -32
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/types.ts +0 -82
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.ts +0 -195
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.ts +0 -135
- package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.ts +0 -84
- package/src/Shared/VisionCameraPlugins/Cropper/index.ts +0 -78
- package/src/Shared/VisionCameraPlugins/FaceDetector/Camera.tsx +0 -63
- package/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.ts +0 -44
- package/src/Shared/VisionCameraPlugins/FaceDetector/index.ts +0 -3
- package/src/Shared/VisionCameraPlugins/FaceDetector/types.ts +0 -99
- package/src/Shared/VisionCameraPlugins/TextRecognition/Camera.tsx +0 -76
- package/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.ts +0 -18
- package/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.ts +0 -7
- package/src/Shared/VisionCameraPlugins/TextRecognition/index.ts +0 -7
- package/src/Shared/VisionCameraPlugins/TextRecognition/scanText.ts +0 -27
- package/src/Shared/VisionCameraPlugins/TextRecognition/translateText.ts +0 -21
- package/src/Shared/VisionCameraPlugins/TextRecognition/types.ts +0 -141
|
@@ -88,8 +88,8 @@ const request = async <TResponse, TBody>(
|
|
|
88
88
|
// Wrap in try-catch to ensure analytics failures never mask HTTP errors
|
|
89
89
|
try {
|
|
90
90
|
const duration = Date.now() - startTime;
|
|
91
|
-
trackApiCall(url, duration, statusCode, success).catch(() => {
|
|
92
|
-
} catch {
|
|
91
|
+
trackApiCall(url, duration, statusCode, success).catch(() => {});
|
|
92
|
+
} catch {}
|
|
93
93
|
|
|
94
94
|
if (response && !response.ok && responseJson) {
|
|
95
95
|
const message = (responseJson as unknown as ErrorResponse).message;
|
|
@@ -117,7 +117,9 @@ const request = async <TResponse, TBody>(
|
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
119
|
|
|
120
|
-
const getSeverityFromStatus = (
|
|
120
|
+
const getSeverityFromStatus = (
|
|
121
|
+
status: number
|
|
122
|
+
): 'low' | 'medium' | 'high' | 'critical' => {
|
|
121
123
|
if (status >= 500) return 'high';
|
|
122
124
|
if (status === 401 || status === 403) return 'medium';
|
|
123
125
|
if (status === 400 || status === 404) return 'low';
|
|
@@ -132,8 +134,8 @@ const request = async <TResponse, TBody>(
|
|
|
132
134
|
message || 'API request failed',
|
|
133
135
|
'http_client',
|
|
134
136
|
getSeverityFromStatus(statusCode)
|
|
135
|
-
).catch(() => {
|
|
136
|
-
} catch {
|
|
137
|
+
).catch(() => {});
|
|
138
|
+
} catch {}
|
|
137
139
|
|
|
138
140
|
if (response.status === 401) {
|
|
139
141
|
throw new UnauthorizedError(message);
|
|
@@ -172,9 +174,11 @@ const request = async <TResponse, TBody>(
|
|
|
172
174
|
const errorMessage =
|
|
173
175
|
error instanceof Error ? error.message : 'Unknown error';
|
|
174
176
|
|
|
175
|
-
trackApiCall(url, duration, statusCode, false).catch(() => {
|
|
176
|
-
trackError('NETWORK_ERROR', errorMessage, 'http_client', 'high').catch(
|
|
177
|
-
|
|
177
|
+
trackApiCall(url, duration, statusCode, false).catch(() => {});
|
|
178
|
+
trackError('NETWORK_ERROR', errorMessage, 'http_client', 'high').catch(
|
|
179
|
+
() => {}
|
|
180
|
+
);
|
|
181
|
+
} catch {}
|
|
178
182
|
}
|
|
179
183
|
|
|
180
184
|
throw error;
|
|
@@ -1,165 +1,6 @@
|
|
|
1
|
-
import { parse } from 'mrz';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Fixes the raw text of an MRZ by removing spaces and « characters, and padding lines to the expected length.
|
|
5
|
-
* @param rawText The raw text to fix
|
|
6
|
-
* @returns The fixed text
|
|
7
|
-
*/
|
|
8
|
-
const fixMRZ = (rawText: string) => {
|
|
9
|
-
if (!rawText) {
|
|
10
|
-
return rawText;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const FILLER_CHAR = '<';
|
|
14
|
-
const MRZ_FORMATS = [
|
|
15
|
-
{ lines: 3, length: 30 }, // TD1
|
|
16
|
-
{ lines: 2, length: 36 }, // TD2
|
|
17
|
-
{ lines: 2, length: 44 }, // TD3
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
const cleanedText = rawText
|
|
21
|
-
.replace(/«| /g, '') // Remove « characters and spaces
|
|
22
|
-
.replace(/<K+|r+K+|<r+K+/g, '') // Remove invalid patterns
|
|
23
|
-
.replace(/\bI<TUR([A-Z0-9]{3})0([A-Z0-9]{6})\b/g, 'I<TUR$1O$2'); // Fix document number if it contains '0' instead of 'O'
|
|
24
|
-
|
|
25
|
-
const lines = cleanedText
|
|
26
|
-
.split(/\n/)
|
|
27
|
-
.map((line) => line.trim())
|
|
28
|
-
.filter((line) => /<+/.test(line));
|
|
29
|
-
|
|
30
|
-
let detectedFormat = MRZ_FORMATS.find((format) => {
|
|
31
|
-
return lines.every((line) => line.length <= format.length);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
if (!detectedFormat) {
|
|
35
|
-
return rawText;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const fixedLines = lines.map((line) => {
|
|
39
|
-
if (/<+/.test(line) && line.length < detectedFormat.length) {
|
|
40
|
-
return line.padEnd(detectedFormat.length, FILLER_CHAR);
|
|
41
|
-
}
|
|
42
|
-
return line;
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return fixedLines.join('\n');
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const MRZ_REGEX =
|
|
49
|
-
/^(?:[A-Z0-9<]{44}\n[A-Z0-9<]{44}|[A-Z0-9<]{30}\n[A-Z0-9<]{30}\n[A-Z0-9<]{30}|[A-Z0-9<]{36}\n[A-Z0-9<]{36})$/im;
|
|
50
|
-
|
|
51
|
-
const getMRZText = (fixedText: string) => {
|
|
52
|
-
if (MRZ_REGEX.test(fixedText)) {
|
|
53
|
-
return fixedText.match(MRZ_REGEX)![0];
|
|
54
|
-
}
|
|
55
|
-
return null;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Apply common OCR corrections for MRZ text
|
|
60
|
-
* Common confusions: 0/O, 1/I, 8/B, 5/S, 2/Z
|
|
61
|
-
*/
|
|
62
|
-
const applyOCRCorrections = (mrzText: string): string[] => {
|
|
63
|
-
const corrections: string[] = [];
|
|
64
|
-
|
|
65
|
-
// Common OCR substitutions to try
|
|
66
|
-
// In MRZ: letters should be in name fields, numbers in date/checksum fields
|
|
67
|
-
const substitutions = [
|
|
68
|
-
// Try replacing O with 0 in numeric positions (dates, checksums)
|
|
69
|
-
{ from: /O/g, to: '0' },
|
|
70
|
-
// Try replacing 0 with O in alphabetic positions (names, country codes)
|
|
71
|
-
{ from: /0/g, to: 'O' },
|
|
72
|
-
// I and 1 confusion
|
|
73
|
-
{ from: /I(?=\d)/g, to: '1' }, // I followed by digit -> likely 1
|
|
74
|
-
{ from: /1(?=[A-Z])/g, to: 'I' }, // 1 followed by letter -> likely I
|
|
75
|
-
// B and 8 confusion
|
|
76
|
-
{ from: /B(?=\d)/g, to: '8' },
|
|
77
|
-
{ from: /8(?=[A-Z])/g, to: 'B' },
|
|
78
|
-
// S and 5 confusion
|
|
79
|
-
{ from: /S(?=\d)/g, to: '5' },
|
|
80
|
-
{ from: /5(?=[A-Z])/g, to: 'S' },
|
|
81
|
-
// Z and 2 confusion
|
|
82
|
-
{ from: /Z(?=\d)/g, to: '2' },
|
|
83
|
-
{ from: /2(?=[A-Z])/g, to: 'Z' },
|
|
84
|
-
];
|
|
85
|
-
|
|
86
|
-
for (const sub of substitutions) {
|
|
87
|
-
const corrected = mrzText.replace(sub.from, sub.to);
|
|
88
|
-
if (corrected !== mrzText) {
|
|
89
|
-
corrections.push(corrected);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return corrections;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
const getMRZData = (ocrText: string) => {
|
|
97
|
-
const fixedText = fixMRZ(ocrText);
|
|
98
|
-
const mrzText = getMRZText(fixedText);
|
|
99
|
-
|
|
100
|
-
if (mrzText) {
|
|
101
|
-
// First attempt with original text
|
|
102
|
-
let parsedResult = parse(mrzText, { autocorrect: true });
|
|
103
|
-
|
|
104
|
-
// Check if parse is valid with all required fields
|
|
105
|
-
const isValidParse = (result: typeof parsedResult) => {
|
|
106
|
-
return result.valid &&
|
|
107
|
-
result.fields.firstName &&
|
|
108
|
-
result.fields.lastName &&
|
|
109
|
-
result.fields.birthDate &&
|
|
110
|
-
result.fields.expirationDate &&
|
|
111
|
-
result.fields.documentNumber &&
|
|
112
|
-
result.fields.issuingState;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
if (isValidParse(parsedResult)) {
|
|
116
|
-
return {
|
|
117
|
-
mrzText,
|
|
118
|
-
parsedResult,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// If not valid, try OCR corrections
|
|
123
|
-
const corrections = applyOCRCorrections(mrzText);
|
|
124
|
-
for (const correctedMRZ of corrections) {
|
|
125
|
-
try {
|
|
126
|
-
const correctedResult = parse(correctedMRZ, { autocorrect: true });
|
|
127
|
-
if (isValidParse(correctedResult)) {
|
|
128
|
-
return {
|
|
129
|
-
mrzText: correctedMRZ,
|
|
130
|
-
parsedResult: correctedResult,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
} catch (e) {
|
|
134
|
-
// Continue trying other corrections
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Return original result even if not fully valid (for partial matches)
|
|
139
|
-
if (
|
|
140
|
-
parsedResult.fields.firstName &&
|
|
141
|
-
parsedResult.fields.lastName &&
|
|
142
|
-
parsedResult.fields.birthDate &&
|
|
143
|
-
parsedResult.fields.expirationDate &&
|
|
144
|
-
parsedResult.fields.documentNumber &&
|
|
145
|
-
parsedResult.fields.issuingState
|
|
146
|
-
) {
|
|
147
|
-
return {
|
|
148
|
-
mrzText,
|
|
149
|
-
parsedResult,
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return {
|
|
155
|
-
mrzText: null,
|
|
156
|
-
parsedResult: null,
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
|
|
160
1
|
/**
|
|
161
2
|
* Converts an MRZ date string to an ISO date string.
|
|
162
|
-
* @param mrzDate The MRZ date string to convert
|
|
3
|
+
* @param mrzDate The MRZ date string to convert (YYMMDD format)
|
|
163
4
|
* @returns The ISO date string, or null if the input is invalid
|
|
164
5
|
*/
|
|
165
6
|
const convertMRZDateToISODate = (mrzDate?: string | null) => {
|
|
@@ -167,12 +8,10 @@ const convertMRZDateToISODate = (mrzDate?: string | null) => {
|
|
|
167
8
|
return null;
|
|
168
9
|
}
|
|
169
10
|
|
|
170
|
-
// Extract year, month, and day from the MRZ date string
|
|
171
11
|
let year = parseInt(mrzDate.slice(0, 2), 10);
|
|
172
12
|
let month = parseInt(mrzDate.slice(2, 4), 10) - 1;
|
|
173
13
|
let day = parseInt(mrzDate.slice(4, 6), 10);
|
|
174
14
|
|
|
175
|
-
// Handle century assumption (usually 1900 or 2000)
|
|
176
15
|
year += year < 50 ? 2000 : 1900;
|
|
177
16
|
|
|
178
17
|
const date = new Date(Date.UTC(year, month, day));
|
|
@@ -181,6 +20,5 @@ const convertMRZDateToISODate = (mrzDate?: string | null) => {
|
|
|
181
20
|
};
|
|
182
21
|
|
|
183
22
|
export default {
|
|
184
|
-
getMRZData,
|
|
185
23
|
convertMRZDateToISODate,
|
|
186
24
|
};
|
|
@@ -3,13 +3,19 @@ import DeviceInfo from 'react-native-device-info';
|
|
|
3
3
|
|
|
4
4
|
export const NativeDeviceInfo = {
|
|
5
5
|
generateHumanReadableIdentifier: async (): Promise<string> => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
try {
|
|
7
|
+
const brand = await DeviceInfo.getBrand();
|
|
8
|
+
const model = await DeviceInfo.getModel();
|
|
9
|
+
const systemName = Platform.OS === 'ios' ? 'iOS' : 'Android';
|
|
10
|
+
const systemVersion = await DeviceInfo.getSystemVersion();
|
|
11
|
+
const uniqueId = await DeviceInfo.getUniqueId();
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
return `${brand} ${model} (${systemName} ${systemVersion}) - ${uniqueId}`;
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.warn('[DeviceInfo] Failed to get device info:', error);
|
|
16
|
+
const systemName = Platform.OS === 'ios' ? 'iOS' : 'Android';
|
|
17
|
+
return `Unknown Device (${systemName}) - ${Date.now()}`;
|
|
18
|
+
}
|
|
13
19
|
},
|
|
14
20
|
};
|
|
15
21
|
|
|
@@ -2,28 +2,64 @@ import i18n from '../../Translation';
|
|
|
2
2
|
import Tts from 'react-native-tts';
|
|
3
3
|
import debounce from './debounce.utils';
|
|
4
4
|
|
|
5
|
+
let isSpeaking = false;
|
|
6
|
+
let lastSpokenMessage = '';
|
|
7
|
+
let lastSpeakTime = 0;
|
|
8
|
+
const MIN_SPEAK_INTERVAL = 3000; // Minimum 3 seconds between messages
|
|
9
|
+
|
|
5
10
|
Tts.addEventListener('tts-start', (_event) => {
|
|
6
|
-
|
|
11
|
+
isSpeaking = true;
|
|
7
12
|
});
|
|
8
13
|
|
|
9
14
|
Tts.addEventListener('tts-finish', (_event) => {
|
|
10
|
-
|
|
15
|
+
isSpeaking = false;
|
|
11
16
|
});
|
|
12
17
|
|
|
13
18
|
Tts.addEventListener('tts-cancel', (_event) => {
|
|
14
|
-
|
|
19
|
+
isSpeaking = false;
|
|
15
20
|
});
|
|
16
21
|
|
|
17
|
-
const speak = async (text: string) => {
|
|
22
|
+
const speak = async (text: string, bypassInterval: boolean = false) => {
|
|
23
|
+
const now = Date.now();
|
|
24
|
+
|
|
25
|
+
// Prevent duplicate message
|
|
26
|
+
if (text === lastSpokenMessage) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Enforce minimum interval between different messages (unless bypassed)
|
|
31
|
+
if (!bypassInterval && now - lastSpeakTime < MIN_SPEAK_INTERVAL) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// When bypassing interval (e.g., liveness instructions), interrupt current speech
|
|
36
|
+
// to ensure new instruction is spoken immediately
|
|
37
|
+
if (bypassInterval && isSpeaking) {
|
|
38
|
+
await Tts.stop();
|
|
39
|
+
isSpeaking = false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Wait for any ongoing speech to finish (unless we just interrupted it)
|
|
43
|
+
if (isSpeaking) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
18
47
|
await Tts.setDefaultLanguage(i18n.language);
|
|
19
48
|
await Tts.stop();
|
|
20
49
|
Tts.speak(text);
|
|
50
|
+
lastSpokenMessage = text;
|
|
51
|
+
lastSpeakTime = now;
|
|
21
52
|
};
|
|
22
53
|
|
|
23
|
-
const speakWithDebounce = debounce(speak,
|
|
54
|
+
const speakWithDebounce = debounce(speak, 1500);
|
|
24
55
|
|
|
25
56
|
const stopSpeaking = async () => {
|
|
26
57
|
await Tts.stop();
|
|
58
|
+
isSpeaking = false;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const resetLastMessage = () => {
|
|
62
|
+
lastSpokenMessage = '';
|
|
27
63
|
};
|
|
28
64
|
|
|
29
65
|
const initializeTTS = () => {
|
|
@@ -37,4 +73,10 @@ const initializeTTS = () => {
|
|
|
37
73
|
);
|
|
38
74
|
};
|
|
39
75
|
|
|
40
|
-
export {
|
|
76
|
+
export {
|
|
77
|
+
speak,
|
|
78
|
+
speakWithDebounce,
|
|
79
|
+
stopSpeaking,
|
|
80
|
+
resetLastMessage,
|
|
81
|
+
initializeTTS,
|
|
82
|
+
};
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
AnalyticsEventCategory,
|
|
14
14
|
AnalyticsEventName,
|
|
15
15
|
} from '../Types/analytics.types';
|
|
16
|
+
import { debugLog, debugWarn } from '../Libs/debug.utils';
|
|
16
17
|
import type {
|
|
17
18
|
AnalyticsConfig,
|
|
18
19
|
AnalyticsEvent,
|
|
@@ -63,7 +64,9 @@ class AnalyticsService implements IAnalyticsService {
|
|
|
63
64
|
|
|
64
65
|
// Validate required verificationSessionId
|
|
65
66
|
if (!config.verificationSessionId) {
|
|
66
|
-
throw new Error(
|
|
67
|
+
throw new Error(
|
|
68
|
+
'Analytics initialization failed: verificationSessionId is required (must be verification session ID from backend)'
|
|
69
|
+
);
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
// Merge with defaults
|
|
@@ -114,13 +117,18 @@ class AnalyticsService implements IAnalyticsService {
|
|
|
114
117
|
if (Array.isArray(persistedQueue) && persistedQueue.length > 0) {
|
|
115
118
|
// Merge with existing queue, prioritizing persisted events
|
|
116
119
|
this.queue = [...persistedQueue, ...this.queue];
|
|
117
|
-
if (__DEV__)
|
|
120
|
+
if (__DEV__)
|
|
121
|
+
debugLog(
|
|
122
|
+
'AnalyticsService',
|
|
123
|
+
`[Analytics] Loaded ${persistedQueue.length} events from disk`
|
|
124
|
+
);
|
|
118
125
|
}
|
|
119
126
|
// Clear the file after loading to prevent duplicate loads
|
|
120
127
|
await RNFS.unlink(this.QUEUE_FILE_PATH);
|
|
121
128
|
}
|
|
122
129
|
} catch (error) {
|
|
123
|
-
if (__DEV__)
|
|
130
|
+
if (__DEV__)
|
|
131
|
+
debugWarn('[Analytics] Failed to load persisted queue:', error);
|
|
124
132
|
}
|
|
125
133
|
}
|
|
126
134
|
|
|
@@ -135,9 +143,13 @@ class AnalyticsService implements IAnalyticsService {
|
|
|
135
143
|
}
|
|
136
144
|
return;
|
|
137
145
|
}
|
|
138
|
-
await RNFS.writeFile(
|
|
146
|
+
await RNFS.writeFile(
|
|
147
|
+
this.QUEUE_FILE_PATH,
|
|
148
|
+
JSON.stringify(this.queue),
|
|
149
|
+
'utf8'
|
|
150
|
+
);
|
|
139
151
|
} catch (error) {
|
|
140
|
-
if (__DEV__)
|
|
152
|
+
if (__DEV__) debugWarn('[Analytics] Failed to persist queue:', error);
|
|
141
153
|
}
|
|
142
154
|
}
|
|
143
155
|
|
|
@@ -192,7 +204,11 @@ class AnalyticsService implements IAnalyticsService {
|
|
|
192
204
|
if (this.queue.length > this.MAX_QUEUE_SIZE) {
|
|
193
205
|
const dropped = this.queue.length - this.MAX_QUEUE_SIZE;
|
|
194
206
|
this.queue = this.queue.slice(dropped);
|
|
195
|
-
if (__DEV__)
|
|
207
|
+
if (__DEV__)
|
|
208
|
+
debugWarn(
|
|
209
|
+
'AnalyticsService',
|
|
210
|
+
`[Analytics] Queue overflow, dropped ${dropped} oldest events`
|
|
211
|
+
);
|
|
196
212
|
}
|
|
197
213
|
|
|
198
214
|
// Flush immediately for critical events or if batch size reached
|
|
@@ -237,7 +253,7 @@ class AnalyticsService implements IAnalyticsService {
|
|
|
237
253
|
// Take a batch, but don't remove from queue yet until success
|
|
238
254
|
const batchSize = Math.min(this.queue.length, this.BATCH_SIZE);
|
|
239
255
|
const batch = this.queue.slice(0, batchSize);
|
|
240
|
-
|
|
256
|
+
|
|
241
257
|
// Double-check batch has items (defensive programming)
|
|
242
258
|
if (batch.length === 0) {
|
|
243
259
|
this.isFlushing = false;
|
|
@@ -246,16 +262,21 @@ class AnalyticsService implements IAnalyticsService {
|
|
|
246
262
|
|
|
247
263
|
try {
|
|
248
264
|
await this.sendBatchWithRetry(batch);
|
|
249
|
-
|
|
265
|
+
|
|
250
266
|
// Remove sent events
|
|
251
267
|
this.queue = this.queue.slice(batchSize);
|
|
252
|
-
|
|
268
|
+
|
|
253
269
|
// Update persistence
|
|
254
270
|
await this.persistQueue();
|
|
255
271
|
} catch (error) {
|
|
256
272
|
// On failure, we keep events in the queue
|
|
257
|
-
if (__DEV__)
|
|
258
|
-
|
|
273
|
+
if (__DEV__)
|
|
274
|
+
debugWarn(
|
|
275
|
+
'AnalyticsService',
|
|
276
|
+
'[Analytics] Failed to flush batch, keeping events:',
|
|
277
|
+
error
|
|
278
|
+
);
|
|
279
|
+
|
|
259
280
|
// Ensure they are persisted
|
|
260
281
|
await this.persistQueue();
|
|
261
282
|
} finally {
|
|
@@ -266,7 +287,11 @@ class AnalyticsService implements IAnalyticsService {
|
|
|
266
287
|
/**
|
|
267
288
|
* Send batch with retry logic (exponential backoff: 1s, 2s, 4s)
|
|
268
289
|
*/
|
|
269
|
-
private async sendBatchWithRetry(
|
|
290
|
+
private async sendBatchWithRetry(
|
|
291
|
+
events: AnalyticsEvent[],
|
|
292
|
+
maxRetries = 3,
|
|
293
|
+
attempt = 1
|
|
294
|
+
): Promise<void> {
|
|
270
295
|
if (!this.config || events.length === 0) return;
|
|
271
296
|
|
|
272
297
|
try {
|
|
@@ -285,28 +310,37 @@ class AnalyticsService implements IAnalyticsService {
|
|
|
285
310
|
if (attempt <= maxRetries && response.status >= 500) {
|
|
286
311
|
// Retry on server errors with exponential backoff
|
|
287
312
|
const delay = Math.pow(2, attempt - 1) * 1000; // 1s, 2s, 4s
|
|
288
|
-
await new Promise(resolve => setTimeout(resolve, delay));
|
|
313
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
289
314
|
return this.sendBatchWithRetry(events, maxRetries, attempt + 1);
|
|
290
315
|
}
|
|
291
316
|
// For 429 (Too Many Requests), throw to retry
|
|
292
317
|
if (response.status === 429) {
|
|
293
318
|
throw new Error('Rate limit exceeded');
|
|
294
319
|
}
|
|
295
|
-
|
|
320
|
+
|
|
296
321
|
// For other 4xx errors (Bad Request, Unauthorized, etc.), do NOT retry.
|
|
297
322
|
// We return successfully so the bad events are removed from the queue.
|
|
298
323
|
if (response.status >= 400 && response.status < 500) {
|
|
299
|
-
if (__DEV__)
|
|
324
|
+
if (__DEV__)
|
|
325
|
+
debugWarn(
|
|
326
|
+
'AnalyticsService',
|
|
327
|
+
`[Analytics] Dropping batch due to ${response.status} error`
|
|
328
|
+
);
|
|
300
329
|
return;
|
|
301
330
|
}
|
|
302
|
-
|
|
303
|
-
if (__DEV__)
|
|
331
|
+
|
|
332
|
+
if (__DEV__)
|
|
333
|
+
debugWarn(
|
|
334
|
+
'AnalyticsService',
|
|
335
|
+
'[Analytics] Failed to send batch:',
|
|
336
|
+
response.status
|
|
337
|
+
);
|
|
304
338
|
}
|
|
305
339
|
} catch (error) {
|
|
306
340
|
if (attempt <= maxRetries) {
|
|
307
341
|
// Retry on network errors with exponential backoff
|
|
308
342
|
const delay = Math.pow(2, attempt - 1) * 1000;
|
|
309
|
-
await new Promise(resolve => setTimeout(resolve, delay));
|
|
343
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
310
344
|
return this.sendBatchWithRetry(events, maxRetries, attempt + 1);
|
|
311
345
|
}
|
|
312
346
|
throw error;
|
|
@@ -319,15 +353,15 @@ class AnalyticsService implements IAnalyticsService {
|
|
|
319
353
|
async clear(): Promise<void> {
|
|
320
354
|
// Flush any pending events before clearing
|
|
321
355
|
await this.flush();
|
|
322
|
-
|
|
356
|
+
|
|
323
357
|
this.stopFlushTimer();
|
|
324
|
-
|
|
358
|
+
|
|
325
359
|
// Remove AppState listener
|
|
326
360
|
if (this.appStateSubscription) {
|
|
327
361
|
this.appStateSubscription.remove();
|
|
328
362
|
this.appStateSubscription = null;
|
|
329
363
|
}
|
|
330
|
-
|
|
364
|
+
|
|
331
365
|
this.queue = [];
|
|
332
366
|
this.sessionId = null;
|
|
333
367
|
this.deviceInfo = null;
|
|
@@ -358,7 +392,12 @@ class AnalyticsService implements IAnalyticsService {
|
|
|
358
392
|
screenResolution: `${DeviceInfo.getDeviceType()}`,
|
|
359
393
|
};
|
|
360
394
|
} catch (error) {
|
|
361
|
-
if (__DEV__)
|
|
395
|
+
if (__DEV__)
|
|
396
|
+
debugWarn(
|
|
397
|
+
'AnalyticsService',
|
|
398
|
+
'[Analytics] Error collecting device info:',
|
|
399
|
+
error
|
|
400
|
+
);
|
|
362
401
|
// Fallback device info
|
|
363
402
|
this.deviceInfo = {
|
|
364
403
|
platform: 'android',
|
|
@@ -423,13 +462,19 @@ class AnalyticsService implements IAnalyticsService {
|
|
|
423
462
|
if (lowerKey === forbidden) return true;
|
|
424
463
|
|
|
425
464
|
// Check if forbidden word appears at start followed by non-letter
|
|
426
|
-
if (
|
|
465
|
+
if (
|
|
466
|
+
lowerKey.startsWith(forbidden) &&
|
|
467
|
+
lowerKey.length > forbidden.length
|
|
468
|
+
) {
|
|
427
469
|
const nextChar = lowerKey[forbidden.length];
|
|
428
470
|
if (!/[a-z]/.test(nextChar)) return true;
|
|
429
471
|
}
|
|
430
472
|
|
|
431
473
|
// Check if forbidden word appears at end preceded by non-letter
|
|
432
|
-
if (
|
|
474
|
+
if (
|
|
475
|
+
lowerKey.endsWith(forbidden) &&
|
|
476
|
+
lowerKey.length > forbidden.length
|
|
477
|
+
) {
|
|
433
478
|
const prevChar = lowerKey[lowerKey.length - forbidden.length - 1];
|
|
434
479
|
if (!/[a-z]/.test(prevChar)) return true;
|
|
435
480
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MRZFields } from './mrzFields';
|
|
2
2
|
import type { LivenessInstructionType } from './livenessIntructionType';
|
|
3
3
|
|
|
4
4
|
export interface IdentificationInfo {
|
|
@@ -24,7 +24,7 @@ export interface ScannedIdentityDocument {
|
|
|
24
24
|
faceImageMimeType?: string;
|
|
25
25
|
barcodeValue?: string;
|
|
26
26
|
mrzText?: string;
|
|
27
|
-
mrzFields?:
|
|
27
|
+
mrzFields?: MRZFields;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export interface LivenessDetection {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MRZ Field Names - ICAO 9303 Standard Machine Readable Zone Fields
|
|
3
|
+
* Local type definitions to replace dependency on 'mrz' package
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type MRZFieldName =
|
|
7
|
+
| 'documentCode'
|
|
8
|
+
| 'issuingState'
|
|
9
|
+
| 'documentNumber'
|
|
10
|
+
| 'documentNumberCheckDigit'
|
|
11
|
+
| 'nationality'
|
|
12
|
+
| 'lastName'
|
|
13
|
+
| 'firstName'
|
|
14
|
+
| 'sex'
|
|
15
|
+
| 'birthDate'
|
|
16
|
+
| 'birthDateCheckDigit'
|
|
17
|
+
| 'expirationDate'
|
|
18
|
+
| 'expirationDateCheckDigit'
|
|
19
|
+
| 'personalNumber'
|
|
20
|
+
| 'personalNumberCheckDigit'
|
|
21
|
+
| 'compositeCheckDigit'
|
|
22
|
+
| 'optional1'
|
|
23
|
+
| 'optional2';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* MRZ Fields - Parsed data from Machine Readable Zone
|
|
27
|
+
* Compatible with native module output
|
|
28
|
+
*/
|
|
29
|
+
export type MRZFields = Partial<Record<MRZFieldName, string | null>>;
|