@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.
Files changed (254) hide show
  1. package/README.md +2 -9
  2. package/TrustchexSDK.podspec +5 -4
  3. package/android/build.gradle +6 -4
  4. package/android/src/main/AndroidManifest.xml +1 -1
  5. package/android/src/main/java/com/trustchex/reactnativesdk/TrustchexSDKPackage.kt +45 -25
  6. package/android/src/main/java/com/trustchex/reactnativesdk/camera/TrustchexCameraManager.kt +168 -0
  7. package/android/src/main/java/com/trustchex/reactnativesdk/camera/TrustchexCameraView.kt +871 -0
  8. package/android/src/main/java/com/trustchex/reactnativesdk/mlkit/MLKitModule.kt +245 -0
  9. package/android/src/main/java/com/trustchex/reactnativesdk/mrz/MRZValidationModule.kt +785 -0
  10. package/android/src/main/java/com/trustchex/reactnativesdk/mrz/MRZValidator.kt +419 -0
  11. package/android/src/main/java/com/trustchex/reactnativesdk/opencv/OpenCVModule.kt +818 -0
  12. package/ios/Camera/TrustchexCameraManager.m +37 -0
  13. package/ios/Camera/TrustchexCameraManager.swift +125 -0
  14. package/ios/Camera/TrustchexCameraView.swift +1176 -0
  15. package/ios/MLKit/MLKitModule.m +23 -0
  16. package/ios/MLKit/MLKitModule.swift +250 -0
  17. package/ios/MRZValidation.m +39 -0
  18. package/ios/MRZValidation.swift +802 -0
  19. package/ios/MRZValidator.swift +466 -0
  20. package/ios/OpenCV/OpenCVModule.h +4 -0
  21. package/ios/OpenCV/OpenCVModule.mm +810 -0
  22. package/lib/module/Screens/Dynamic/IdentityDocumentEIDScanningScreen.js +2 -3
  23. package/lib/module/Screens/Dynamic/IdentityDocumentScanningScreen.js +1 -2
  24. package/lib/module/Screens/Dynamic/LivenessDetectionScreen.js +418 -193
  25. package/lib/module/Screens/Static/OTPVerificationScreen.js +11 -11
  26. package/lib/module/Screens/Static/QrCodeScanningScreen.js +5 -1
  27. package/lib/module/Screens/Static/ResultScreen.js +25 -2
  28. package/lib/module/Screens/Static/VerificationSessionCheckScreen.js +25 -7
  29. package/lib/module/Shared/Components/DebugNavigationPanel.js +234 -24
  30. package/lib/module/Shared/Components/EIDScanner.js +99 -9
  31. package/lib/module/Shared/Components/FaceCamera.js +170 -179
  32. package/lib/module/Shared/Components/IdentityDocumentCamera.js +2151 -771
  33. package/lib/module/Shared/Components/QrCodeScannerCamera.js +109 -107
  34. package/lib/module/Shared/Components/TrustchexCamera.js +122 -0
  35. package/lib/module/Shared/EIDReader/tlv/tlv.helpers.js +91 -0
  36. package/lib/module/Shared/EIDReader/tlv/tlv.utils.js +2 -124
  37. package/lib/module/Shared/EIDReader/tlv/tlvInputStream.js +4 -4
  38. package/lib/module/Shared/EIDReader/tlv/tlvOutputState.js +4 -4
  39. package/lib/module/Shared/EIDReader/tlv/tlvOutputStream.js +4 -4
  40. package/lib/module/Shared/Libs/analytics.utils.js +2 -2
  41. package/lib/module/Shared/Libs/debug.utils.js +132 -0
  42. package/lib/module/Shared/Libs/deeplink.utils.js +6 -5
  43. package/lib/module/Shared/Libs/demo.utils.js +13 -3
  44. package/lib/module/Shared/Libs/mrz.utils.js +1 -175
  45. package/lib/module/Shared/Libs/native-device-info.utils.js +12 -6
  46. package/lib/module/Shared/Libs/tts.utils.js +40 -6
  47. package/lib/module/Shared/Services/AnalyticsService.js +9 -8
  48. package/lib/module/Shared/Types/mrzFields.js +1 -0
  49. package/lib/module/Translation/Resources/en.js +87 -88
  50. package/lib/module/Translation/Resources/tr.js +84 -85
  51. package/lib/module/Trustchex.js +9 -2
  52. package/lib/module/index.js +1 -0
  53. package/lib/module/version.js +1 -1
  54. package/lib/typescript/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.d.ts.map +1 -1
  55. package/lib/typescript/src/Screens/Dynamic/IdentityDocumentScanningScreen.d.ts.map +1 -1
  56. package/lib/typescript/src/Screens/Dynamic/LivenessDetectionScreen.d.ts.map +1 -1
  57. package/lib/typescript/src/Screens/Static/OTPVerificationScreen.d.ts.map +1 -1
  58. package/lib/typescript/src/Screens/Static/QrCodeScanningScreen.d.ts.map +1 -1
  59. package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -1
  60. package/lib/typescript/src/Screens/Static/VerificationSessionCheckScreen.d.ts.map +1 -1
  61. package/lib/typescript/src/Shared/Components/DebugNavigationPanel.d.ts.map +1 -1
  62. package/lib/typescript/src/Shared/Components/EIDScanner.d.ts +2 -2
  63. package/lib/typescript/src/Shared/Components/EIDScanner.d.ts.map +1 -1
  64. package/lib/typescript/src/Shared/Components/FaceCamera.d.ts +18 -4
  65. package/lib/typescript/src/Shared/Components/FaceCamera.d.ts.map +1 -1
  66. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts +3 -4
  67. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -1
  68. package/lib/typescript/src/Shared/Components/QrCodeScannerCamera.d.ts +2 -1
  69. package/lib/typescript/src/Shared/Components/QrCodeScannerCamera.d.ts.map +1 -1
  70. package/lib/typescript/src/Shared/Components/TrustchexCamera.d.ts +124 -0
  71. package/lib/typescript/src/Shared/Components/TrustchexCamera.d.ts.map +1 -0
  72. package/lib/typescript/src/Shared/EIDReader/tlv/tlv.helpers.d.ts +11 -0
  73. package/lib/typescript/src/Shared/EIDReader/tlv/tlv.helpers.d.ts.map +1 -0
  74. package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts +2 -39
  75. package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts.map +1 -1
  76. package/lib/typescript/src/Shared/Libs/analytics.utils.d.ts.map +1 -1
  77. package/lib/typescript/src/Shared/Libs/debug.utils.d.ts +42 -0
  78. package/lib/typescript/src/Shared/Libs/debug.utils.d.ts.map +1 -0
  79. package/lib/typescript/src/Shared/Libs/deeplink.utils.d.ts.map +1 -1
  80. package/lib/typescript/src/Shared/Libs/demo.utils.d.ts.map +1 -1
  81. package/lib/typescript/src/Shared/Libs/http-client.d.ts.map +1 -1
  82. package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts +0 -4
  83. package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts.map +1 -1
  84. package/lib/typescript/src/Shared/Libs/native-device-info.utils.d.ts.map +1 -1
  85. package/lib/typescript/src/Shared/Libs/tts.utils.d.ts +4 -3
  86. package/lib/typescript/src/Shared/Libs/tts.utils.d.ts.map +1 -1
  87. package/lib/typescript/src/Shared/Services/AnalyticsService.d.ts.map +1 -1
  88. package/lib/typescript/src/Shared/Types/identificationInfo.d.ts +2 -2
  89. package/lib/typescript/src/Shared/Types/identificationInfo.d.ts.map +1 -1
  90. package/lib/typescript/src/Shared/Types/mrzFields.d.ts +11 -0
  91. package/lib/typescript/src/Shared/Types/mrzFields.d.ts.map +1 -0
  92. package/lib/typescript/src/Translation/Resources/en.d.ts +4 -5
  93. package/lib/typescript/src/Translation/Resources/en.d.ts.map +1 -1
  94. package/lib/typescript/src/Translation/Resources/tr.d.ts +4 -5
  95. package/lib/typescript/src/Translation/Resources/tr.d.ts.map +1 -1
  96. package/lib/typescript/src/Trustchex.d.ts +2 -0
  97. package/lib/typescript/src/Trustchex.d.ts.map +1 -1
  98. package/lib/typescript/src/index.d.ts +1 -0
  99. package/lib/typescript/src/index.d.ts.map +1 -1
  100. package/lib/typescript/src/version.d.ts +1 -1
  101. package/package.json +4 -35
  102. package/src/Screens/Dynamic/ContractAcceptanceScreen.tsx +1 -1
  103. package/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.tsx +7 -5
  104. package/src/Screens/Dynamic/IdentityDocumentScanningScreen.tsx +2 -3
  105. package/src/Screens/Dynamic/LivenessDetectionScreen.tsx +498 -216
  106. package/src/Screens/Static/OTPVerificationScreen.tsx +37 -31
  107. package/src/Screens/Static/QrCodeScanningScreen.tsx +8 -1
  108. package/src/Screens/Static/ResultScreen.tsx +136 -88
  109. package/src/Screens/Static/VerificationSessionCheckScreen.tsx +46 -13
  110. package/src/Shared/Components/DebugNavigationPanel.tsx +290 -34
  111. package/src/Shared/Components/EIDScanner.tsx +94 -16
  112. package/src/Shared/Components/FaceCamera.tsx +236 -203
  113. package/src/Shared/Components/IdentityDocumentCamera.tsx +3073 -1030
  114. package/src/Shared/Components/QrCodeScannerCamera.tsx +133 -127
  115. package/src/Shared/Components/TrustchexCamera.tsx +289 -0
  116. package/src/Shared/Config/camera-enhancement.config.ts +2 -2
  117. package/src/Shared/EIDReader/tlv/tlv.helpers.ts +96 -0
  118. package/src/Shared/EIDReader/tlv/tlv.utils.ts +2 -125
  119. package/src/Shared/EIDReader/tlv/tlvInputStream.ts +4 -4
  120. package/src/Shared/EIDReader/tlv/tlvOutputState.ts +4 -4
  121. package/src/Shared/EIDReader/tlv/tlvOutputStream.ts +4 -4
  122. package/src/Shared/Libs/analytics.utils.ts +48 -20
  123. package/src/Shared/Libs/debug.utils.ts +149 -0
  124. package/src/Shared/Libs/deeplink.utils.ts +7 -5
  125. package/src/Shared/Libs/demo.utils.ts +4 -0
  126. package/src/Shared/Libs/http-client.ts +12 -8
  127. package/src/Shared/Libs/mrz.utils.ts +1 -163
  128. package/src/Shared/Libs/native-device-info.utils.ts +12 -6
  129. package/src/Shared/Libs/tts.utils.ts +48 -6
  130. package/src/Shared/Services/AnalyticsService.ts +69 -24
  131. package/src/Shared/Types/identificationInfo.ts +2 -2
  132. package/src/Shared/Types/mrzFields.ts +29 -0
  133. package/src/Translation/Resources/en.ts +90 -100
  134. package/src/Translation/Resources/tr.ts +89 -97
  135. package/src/Translation/index.ts +1 -1
  136. package/src/Trustchex.tsx +21 -4
  137. package/src/index.tsx +14 -0
  138. package/src/version.ts +1 -1
  139. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/barcodescanner/BarcodeScannerFrameProcessorPlugin.kt +0 -301
  140. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/BitmapUtils.kt +0 -205
  141. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/CropperPlugin.kt +0 -72
  142. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/FrameMetadata.kt +0 -4
  143. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/facedetector/FaceDetectorFrameProcessorPlugin.kt +0 -303
  144. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/textrecognition/TextRecognitionFrameProcessorPlugin.kt +0 -115
  145. package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin-Bridging-Header.h +0 -9
  146. package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin.mm +0 -22
  147. package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin.swift +0 -188
  148. package/ios/VisionCameraPlugins/Cropper/Cropper-Bridging-Header.h +0 -13
  149. package/ios/VisionCameraPlugins/Cropper/Cropper.h +0 -20
  150. package/ios/VisionCameraPlugins/Cropper/Cropper.mm +0 -22
  151. package/ios/VisionCameraPlugins/Cropper/Cropper.swift +0 -145
  152. package/ios/VisionCameraPlugins/Cropper/CropperUtils.swift +0 -49
  153. package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin-Bridging-Header.h +0 -4
  154. package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin.mm +0 -22
  155. package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin.swift +0 -320
  156. package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin-Bridging-Header.h +0 -4
  157. package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin.mm +0 -27
  158. package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin.swift +0 -144
  159. package/lib/module/Shared/Libs/camera.utils.js +0 -308
  160. package/lib/module/Shared/Libs/frame-enhancement.utils.js +0 -133
  161. package/lib/module/Shared/Libs/opencv.utils.js +0 -21
  162. package/lib/module/Shared/Libs/worklet.utils.js +0 -68
  163. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.js +0 -46
  164. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.js +0 -35
  165. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/index.js +0 -19
  166. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.js +0 -26
  167. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/types.js +0 -3
  168. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.js +0 -197
  169. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.js +0 -101
  170. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.js +0 -60
  171. package/lib/module/Shared/VisionCameraPlugins/Cropper/index.js +0 -47
  172. package/lib/module/Shared/VisionCameraPlugins/FaceDetector/Camera.js +0 -42
  173. package/lib/module/Shared/VisionCameraPlugins/FaceDetector/detectFaces.js +0 -35
  174. package/lib/module/Shared/VisionCameraPlugins/FaceDetector/index.js +0 -4
  175. package/lib/module/Shared/VisionCameraPlugins/FaceDetector/types.js +0 -3
  176. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/Camera.js +0 -56
  177. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.js +0 -20
  178. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.js +0 -9
  179. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/index.js +0 -6
  180. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/scanText.js +0 -20
  181. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/translateText.js +0 -19
  182. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/types.js +0 -3
  183. package/lib/typescript/src/Shared/Libs/camera.utils.d.ts +0 -87
  184. package/lib/typescript/src/Shared/Libs/camera.utils.d.ts.map +0 -1
  185. package/lib/typescript/src/Shared/Libs/frame-enhancement.utils.d.ts +0 -25
  186. package/lib/typescript/src/Shared/Libs/frame-enhancement.utils.d.ts.map +0 -1
  187. package/lib/typescript/src/Shared/Libs/opencv.utils.d.ts +0 -3
  188. package/lib/typescript/src/Shared/Libs/opencv.utils.d.ts.map +0 -1
  189. package/lib/typescript/src/Shared/Libs/worklet.utils.d.ts +0 -9
  190. package/lib/typescript/src/Shared/Libs/worklet.utils.d.ts.map +0 -1
  191. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.d.ts +0 -13
  192. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.d.ts.map +0 -1
  193. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.d.ts +0 -6
  194. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.d.ts.map +0 -1
  195. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/index.d.ts +0 -12
  196. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/index.d.ts.map +0 -1
  197. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.d.ts +0 -3
  198. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.d.ts.map +0 -1
  199. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/types.d.ts +0 -52
  200. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/types.d.ts.map +0 -1
  201. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.d.ts +0 -62
  202. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.d.ts.map +0 -1
  203. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.d.ts +0 -34
  204. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.d.ts.map +0 -1
  205. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.d.ts +0 -32
  206. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.d.ts.map +0 -1
  207. package/lib/typescript/src/Shared/VisionCameraPlugins/Cropper/index.d.ts +0 -23
  208. package/lib/typescript/src/Shared/VisionCameraPlugins/Cropper/index.d.ts.map +0 -1
  209. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/Camera.d.ts +0 -9
  210. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/Camera.d.ts.map +0 -1
  211. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.d.ts +0 -3
  212. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.d.ts.map +0 -1
  213. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/index.d.ts +0 -3
  214. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/index.d.ts.map +0 -1
  215. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/types.d.ts +0 -79
  216. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/types.d.ts.map +0 -1
  217. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/Camera.d.ts +0 -6
  218. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/Camera.d.ts.map +0 -1
  219. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.d.ts +0 -3
  220. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.d.ts.map +0 -1
  221. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.d.ts +0 -3
  222. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.d.ts.map +0 -1
  223. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/index.d.ts +0 -5
  224. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/index.d.ts.map +0 -1
  225. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/scanText.d.ts +0 -3
  226. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/scanText.d.ts.map +0 -1
  227. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/translateText.d.ts +0 -3
  228. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/translateText.d.ts.map +0 -1
  229. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/types.d.ts +0 -67
  230. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/types.d.ts.map +0 -1
  231. package/src/Shared/Libs/camera.utils.ts +0 -345
  232. package/src/Shared/Libs/frame-enhancement.utils.ts +0 -217
  233. package/src/Shared/Libs/opencv.utils.ts +0 -40
  234. package/src/Shared/Libs/worklet.utils.ts +0 -72
  235. package/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.ts +0 -79
  236. package/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.ts +0 -46
  237. package/src/Shared/VisionCameraPlugins/BarcodeScanner/index.ts +0 -60
  238. package/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.ts +0 -32
  239. package/src/Shared/VisionCameraPlugins/BarcodeScanner/types.ts +0 -82
  240. package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.ts +0 -195
  241. package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.ts +0 -135
  242. package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.ts +0 -84
  243. package/src/Shared/VisionCameraPlugins/Cropper/index.ts +0 -78
  244. package/src/Shared/VisionCameraPlugins/FaceDetector/Camera.tsx +0 -63
  245. package/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.ts +0 -44
  246. package/src/Shared/VisionCameraPlugins/FaceDetector/index.ts +0 -3
  247. package/src/Shared/VisionCameraPlugins/FaceDetector/types.ts +0 -99
  248. package/src/Shared/VisionCameraPlugins/TextRecognition/Camera.tsx +0 -76
  249. package/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.ts +0 -18
  250. package/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.ts +0 -7
  251. package/src/Shared/VisionCameraPlugins/TextRecognition/index.ts +0 -7
  252. package/src/Shared/VisionCameraPlugins/TextRecognition/scanText.ts +0 -27
  253. package/src/Shared/VisionCameraPlugins/TextRecognition/translateText.ts +0 -21
  254. package/src/Shared/VisionCameraPlugins/TextRecognition/types.ts +0 -141
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import TLVUtil from "./tlv.utils.js";
3
+ import { TLVHelpers } from "./tlv.helpers.js";
4
4
  export class TLVOutputState {
5
5
  constructor() {
6
6
  this.state = [];
@@ -56,7 +56,7 @@ export class TLVOutputState {
56
56
  const obj = new TLVStruct(tag);
57
57
  if (this.state.length !== 0) {
58
58
  const parent = this.state[this.state.length - 1];
59
- const tagBytes = TLVUtil.getTagAsBytes(tag);
59
+ const tagBytes = TLVHelpers.getTagAsBytes(tag);
60
60
  parent.write(tagBytes, 0, tagBytes.length);
61
61
  }
62
62
  this.state.push(obj);
@@ -83,7 +83,7 @@ export class TLVOutputState {
83
83
  const obj = this.state.pop();
84
84
  if (this.state.length !== 0) {
85
85
  const parent = this.state[this.state.length - 1];
86
- const lengthBytes = TLVUtil.getLengthAsBytes(length);
86
+ const lengthBytes = TLVHelpers.getLengthAsBytes(length);
87
87
  parent.write(lengthBytes, 0, lengthBytes.length);
88
88
  }
89
89
  if (obj) {
@@ -102,7 +102,7 @@ export class TLVOutputState {
102
102
  currentObject.setLength(byteCount);
103
103
  if (currentObject.getValueBytesProcessed() === currentObject.getLength()) {
104
104
  this.state.pop();
105
- const lengthBytes = TLVUtil.getLengthAsBytes(byteCount);
105
+ const lengthBytes = TLVHelpers.getLengthAsBytes(byteCount);
106
106
  const value = currentObject.getValue();
107
107
  this.updateValueBytesProcessed(lengthBytes, 0, lengthBytes.length);
108
108
  this.updateValueBytesProcessed(value, 0, value.length);
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { DataOutputStream } from "../java/dataOutputStream.js";
4
4
  import { OutputStream } from "../java/outputStream.js";
5
- import TLVUtil from "./tlv.utils.js";
5
+ import { TLVHelpers } from "./tlv.helpers.js";
6
6
  import { TLVOutputState } from "./tlvOutputState.js";
7
7
  export class TLVOutputStream extends OutputStream {
8
8
  constructor(outputStream) {
@@ -14,7 +14,7 @@ export class TLVOutputStream extends OutputStream {
14
14
  if (!this.state.getIsAtStartOfTag()) {
15
15
  throw new Error('Cannot write tag, still need length');
16
16
  }
17
- const tagAsBytes = TLVUtil.getTagAsBytes(tag);
17
+ const tagAsBytes = TLVHelpers.getTagAsBytes(tag);
18
18
  this.outputStream.writeBytes(Uint8Array.from(tagAsBytes));
19
19
  this.state.setTagProcessed(tag);
20
20
  }
@@ -22,7 +22,7 @@ export class TLVOutputStream extends OutputStream {
22
22
  if (!this.state.getIsAtStartOfLength()) {
23
23
  throw new Error('Cannot write length');
24
24
  }
25
- const lengthAsBytes = TLVUtil.getLengthAsBytes(length);
25
+ const lengthAsBytes = TLVHelpers.getLengthAsBytes(length);
26
26
  this.outputStream.writeBytes(Uint8Array.from(lengthAsBytes));
27
27
  this.state.setLengthProcessed(length);
28
28
  }
@@ -68,7 +68,7 @@ export class TLVOutputStream extends OutputStream {
68
68
  const length = bufferedValueBytes.length;
69
69
  this.state.updatePreviousLength(length);
70
70
  if (this.state.canBeWritten()) {
71
- const lengthAsBytes = TLVUtil.getLengthAsBytes(length);
71
+ const lengthAsBytes = TLVHelpers.getLengthAsBytes(length);
72
72
  this.outputStream.writeBytes(Uint8Array.from(lengthAsBytes));
73
73
  this.outputStream.writeBytes(Uint8Array.from(bufferedValueBytes));
74
74
  }
@@ -89,10 +89,10 @@ const inferErrorCategory = errorCode => {
89
89
  /**
90
90
  * Track error event with unique event name per error code
91
91
  * Event name format: error_{errorCode} (e.g., error_camera_permission_denied)
92
- *
92
+ *
93
93
  * Only errors with severity 'medium' or higher are recorded.
94
94
  * Low severity errors are ignored to reduce noise.
95
- *
95
+ *
96
96
  * @param errorCode - Unique identifier for the error type
97
97
  * @param errorMessage - Human-readable error message (sanitized)
98
98
  * @param screenName - Screen where the error occurred
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Debug logging utility with log levels for SDK development
5
+ * Logs are filtered based on the current log level and debug mode
6
+ *
7
+ * Log Levels (lower number = more verbose):
8
+ * 0 - TRACE (all debug information)
9
+ * 1 - DEBUG (important debug information)
10
+ * 2 - INFO (informational messages)
11
+ * 3 - WARN (warnings and important issues)
12
+ * 4 - ERROR (errors only)
13
+ * 5 - SILENT (no logging)
14
+ *
15
+ * Enable debug mode via:
16
+ * 1. Environment variable: TRUSTCHEX_DEBUG=true
17
+ * 2. Global flag: (global as any).TRUSTCHEX_DEBUG = true
18
+ * 3. TrustchexProvider prop: debug={true}
19
+ *
20
+ * Set log level via:
21
+ * 1. setLogLevel(LogLevel.TRACE)
22
+ * 2. TRUSTCHEX_LOG_LEVEL environment variable
23
+ * 3. TrustchexProvider prop: logLevel="trace"
24
+ */
25
+
26
+ export let LogLevel = /*#__PURE__*/function (LogLevel) {
27
+ LogLevel[LogLevel["TRACE"] = 0] = "TRACE";
28
+ LogLevel[LogLevel["DEBUG"] = 1] = "DEBUG";
29
+ LogLevel[LogLevel["INFO"] = 2] = "INFO";
30
+ LogLevel[LogLevel["WARN"] = 3] = "WARN";
31
+ LogLevel[LogLevel["ERROR"] = 4] = "ERROR";
32
+ LogLevel[LogLevel["SILENT"] = 5] = "SILENT";
33
+ return LogLevel;
34
+ }({});
35
+ let debugEnabled = process.env.NODE_ENV === 'development' && (global.TRUSTCHEX_DEBUG === true || process.env.TRUSTCHEX_DEBUG === 'true');
36
+
37
+ // Default to TRACE level for development debugging
38
+ let currentLogLevel = debugEnabled ? LogLevel.TRACE : LogLevel.WARN;
39
+
40
+ // Parse log level from env or string
41
+ const parseLogLevel = level => {
42
+ if (level === undefined) return currentLogLevel;
43
+ if (typeof level === 'number') return level;
44
+ const levelMap = {
45
+ trace: LogLevel.TRACE,
46
+ debug: LogLevel.DEBUG,
47
+ info: LogLevel.INFO,
48
+ warn: LogLevel.WARN,
49
+ error: LogLevel.ERROR,
50
+ silent: LogLevel.SILENT
51
+ };
52
+ return levelMap[level.toLowerCase()] ?? currentLogLevel;
53
+ };
54
+ export const setDebugMode = enabled => {
55
+ debugEnabled = enabled;
56
+ // When debug mode is enabled, default to TRACE level
57
+ if (enabled && currentLogLevel === LogLevel.WARN) {
58
+ currentLogLevel = LogLevel.TRACE;
59
+ }
60
+ };
61
+ export const setLogLevel = level => {
62
+ currentLogLevel = parseLogLevel(level);
63
+ };
64
+ export const isDebugEnabled = () => {
65
+ return debugEnabled;
66
+ };
67
+ export const getLogLevel = () => {
68
+ return currentLogLevel;
69
+ };
70
+
71
+ // Check if a message at the given level should be logged
72
+ const shouldLog = level => {
73
+ return debugEnabled && level >= currentLogLevel;
74
+ };
75
+ export const traceLog = (tag, message, data) => {
76
+ if (!shouldLog(LogLevel.TRACE)) return;
77
+ if (data !== undefined) {
78
+ console.log(`[${tag}] TRACE: ${message}`, data);
79
+ } else {
80
+ console.log(`[${tag}] TRACE: ${message}`);
81
+ }
82
+ };
83
+ export const debugLog = (tag, message, data) => {
84
+ if (!shouldLog(LogLevel.DEBUG)) return;
85
+ if (data !== undefined) {
86
+ console.log(`[${tag}] DEBUG: ${message}`, data);
87
+ } else {
88
+ console.log(`[${tag}] DEBUG: ${message}`);
89
+ }
90
+ };
91
+ export const infoLog = (tag, message, data) => {
92
+ if (!shouldLog(LogLevel.INFO)) return;
93
+ if (data !== undefined) {
94
+ console.log(`[${tag}] INFO: ${message}`, data);
95
+ } else {
96
+ console.log(`[${tag}] INFO: ${message}`);
97
+ }
98
+ };
99
+ export const debugWarn = (tag, message, data) => {
100
+ if (!shouldLog(LogLevel.WARN)) return;
101
+ if (data !== undefined) {
102
+ console.warn(`[${tag}] WARN: ${message}`, data);
103
+ } else {
104
+ console.warn(`[${tag}] WARN: ${message}`);
105
+ }
106
+ };
107
+ export const debugError = (tag, message, error) => {
108
+ if (!shouldLog(LogLevel.ERROR)) return;
109
+ if (error !== undefined) {
110
+ console.error(`[${tag}] ERROR: ${message}`, error);
111
+ } else {
112
+ console.error(`[${tag}] ERROR: ${message}`);
113
+ }
114
+ };
115
+
116
+ // Always log errors regardless of debug mode (critical issues)
117
+ export const logError = (tag, message, error) => {
118
+ if (error !== undefined) {
119
+ console.error(`[${tag}] ERROR: ${message}`, error);
120
+ } else {
121
+ console.error(`[${tag}] ERROR: ${message}`);
122
+ }
123
+ };
124
+
125
+ // Always log warnings for critical issues regardless of debug mode
126
+ export const logWarn = (tag, message, data) => {
127
+ if (data !== undefined) {
128
+ console.warn(`[${tag}] WARN: ${message}`, data);
129
+ } else {
130
+ console.warn(`[${tag}] WARN: ${message}`);
131
+ }
132
+ };
@@ -1,25 +1,26 @@
1
1
  "use strict";
2
2
 
3
+ import { debugLog } from "./debug.utils.js";
3
4
  const handleDeepLink = ({
4
5
  url
5
6
  }) => {
6
- console.log('[handleDeepLink] Received URL:', url);
7
+ debugLog('handleDeepLink', 'Received URL:', url);
7
8
  const isHttps = url.includes('https');
8
9
  const route = url.replace(/http(s)?(:)?(\/\/)?/g, '');
9
10
  const segments = route.split('/');
10
- console.log('[handleDeepLink] Parsed segments:', segments);
11
+ debugLog('handleDeepLink', 'Parsed segments:', segments);
11
12
  let baseUrl = '';
12
13
  let sessionId = '';
13
14
  for (let i = 0; i < segments.length; i++) {
14
15
  if (segments[i] === 'verification-session') {
15
16
  sessionId = segments[i + 1] ?? '';
16
- console.log('[handleDeepLink] Found sessionId:', sessionId);
17
+ debugLog('handleDeepLink', 'Found sessionId:', sessionId);
17
18
  } else if (segments[i] === 'app-url') {
18
19
  baseUrl = `${isHttps ? 'https' : 'http'}://${segments[i + 1]}`;
19
- console.log('[handleDeepLink] Found baseUrl:', baseUrl);
20
+ debugLog('handleDeepLink', 'Found baseUrl:', baseUrl);
20
21
  }
21
22
  }
22
- console.log('[handleDeepLink] Returning:', {
23
+ debugLog('handleDeepLink', 'Returning:', {
23
24
  baseUrl,
24
25
  sessionId
25
26
  });
@@ -14,6 +14,7 @@ const demoSession = {
14
14
  type: 'CONTRACT_ACCEPTANCE',
15
15
  required: false,
16
16
  data: {
17
+ voiceGuidanceActive: true,
17
18
  contracts: {
18
19
  en: {
19
20
  id: '1',
@@ -29,13 +30,22 @@ const demoSession = {
29
30
  }
30
31
  }, {
31
32
  type: 'IDENTITY_DOCUMENT_SCAN',
32
- required: false
33
+ required: false,
34
+ data: {
35
+ voiceGuidanceActive: true
36
+ }
33
37
  }, {
34
38
  type: 'IDENTITY_DOCUMENT_EID_SCAN',
35
- required: false
39
+ required: false,
40
+ data: {
41
+ voiceGuidanceActive: true
42
+ }
36
43
  }, {
37
44
  type: 'LIVENESS_CHECK',
38
- required: false
45
+ required: false,
46
+ data: {
47
+ voiceGuidanceActive: true
48
+ }
39
49
  }]
40
50
  };
41
51
  const isDemoSession = sessionCode => sessionCode.toUpperCase() === 'DEMXCXDE';
@@ -1,195 +1,21 @@
1
1
  "use strict";
2
2
 
3
- import { parse } from 'mrz';
4
-
5
- /**
6
- * Fixes the raw text of an MRZ by removing spaces and « characters, and padding lines to the expected length.
7
- * @param rawText The raw text to fix
8
- * @returns The fixed text
9
- */
10
- const fixMRZ = rawText => {
11
- if (!rawText) {
12
- return rawText;
13
- }
14
- const FILLER_CHAR = '<';
15
- const MRZ_FORMATS = [{
16
- lines: 3,
17
- length: 30
18
- },
19
- // TD1
20
- {
21
- lines: 2,
22
- length: 36
23
- },
24
- // TD2
25
- {
26
- lines: 2,
27
- length: 44
28
- } // TD3
29
- ];
30
- const cleanedText = rawText.replace(/«| /g, '') // Remove « characters and spaces
31
- .replace(/<K+|r+K+|<r+K+/g, '') // Remove invalid patterns
32
- .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'
33
-
34
- const lines = cleanedText.split(/\n/).map(line => line.trim()).filter(line => /<+/.test(line));
35
- let detectedFormat = MRZ_FORMATS.find(format => {
36
- return lines.every(line => line.length <= format.length);
37
- });
38
- if (!detectedFormat) {
39
- return rawText;
40
- }
41
- const fixedLines = lines.map(line => {
42
- if (/<+/.test(line) && line.length < detectedFormat.length) {
43
- return line.padEnd(detectedFormat.length, FILLER_CHAR);
44
- }
45
- return line;
46
- });
47
- return fixedLines.join('\n');
48
- };
49
- const MRZ_REGEX = /^(?:[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
- const getMRZText = fixedText => {
51
- if (MRZ_REGEX.test(fixedText)) {
52
- return fixedText.match(MRZ_REGEX)[0];
53
- }
54
- return null;
55
- };
56
-
57
- /**
58
- * Apply common OCR corrections for MRZ text
59
- * Common confusions: 0/O, 1/I, 8/B, 5/S, 2/Z
60
- */
61
- const applyOCRCorrections = mrzText => {
62
- const corrections = [];
63
-
64
- // Common OCR substitutions to try
65
- // In MRZ: letters should be in name fields, numbers in date/checksum fields
66
- const substitutions = [
67
- // Try replacing O with 0 in numeric positions (dates, checksums)
68
- {
69
- from: /O/g,
70
- to: '0'
71
- },
72
- // Try replacing 0 with O in alphabetic positions (names, country codes)
73
- {
74
- from: /0/g,
75
- to: 'O'
76
- },
77
- // I and 1 confusion
78
- {
79
- from: /I(?=\d)/g,
80
- to: '1'
81
- },
82
- // I followed by digit -> likely 1
83
- {
84
- from: /1(?=[A-Z])/g,
85
- to: 'I'
86
- },
87
- // 1 followed by letter -> likely I
88
- // B and 8 confusion
89
- {
90
- from: /B(?=\d)/g,
91
- to: '8'
92
- }, {
93
- from: /8(?=[A-Z])/g,
94
- to: 'B'
95
- },
96
- // S and 5 confusion
97
- {
98
- from: /S(?=\d)/g,
99
- to: '5'
100
- }, {
101
- from: /5(?=[A-Z])/g,
102
- to: 'S'
103
- },
104
- // Z and 2 confusion
105
- {
106
- from: /Z(?=\d)/g,
107
- to: '2'
108
- }, {
109
- from: /2(?=[A-Z])/g,
110
- to: 'Z'
111
- }];
112
- for (const sub of substitutions) {
113
- const corrected = mrzText.replace(sub.from, sub.to);
114
- if (corrected !== mrzText) {
115
- corrections.push(corrected);
116
- }
117
- }
118
- return corrections;
119
- };
120
- const getMRZData = ocrText => {
121
- const fixedText = fixMRZ(ocrText);
122
- const mrzText = getMRZText(fixedText);
123
- if (mrzText) {
124
- // First attempt with original text
125
- let parsedResult = parse(mrzText, {
126
- autocorrect: true
127
- });
128
-
129
- // Check if parse is valid with all required fields
130
- const isValidParse = result => {
131
- return result.valid && result.fields.firstName && result.fields.lastName && result.fields.birthDate && result.fields.expirationDate && result.fields.documentNumber && result.fields.issuingState;
132
- };
133
- if (isValidParse(parsedResult)) {
134
- return {
135
- mrzText,
136
- parsedResult
137
- };
138
- }
139
-
140
- // If not valid, try OCR corrections
141
- const corrections = applyOCRCorrections(mrzText);
142
- for (const correctedMRZ of corrections) {
143
- try {
144
- const correctedResult = parse(correctedMRZ, {
145
- autocorrect: true
146
- });
147
- if (isValidParse(correctedResult)) {
148
- return {
149
- mrzText: correctedMRZ,
150
- parsedResult: correctedResult
151
- };
152
- }
153
- } catch (e) {
154
- // Continue trying other corrections
155
- }
156
- }
157
-
158
- // Return original result even if not fully valid (for partial matches)
159
- if (parsedResult.fields.firstName && parsedResult.fields.lastName && parsedResult.fields.birthDate && parsedResult.fields.expirationDate && parsedResult.fields.documentNumber && parsedResult.fields.issuingState) {
160
- return {
161
- mrzText,
162
- parsedResult
163
- };
164
- }
165
- }
166
- return {
167
- mrzText: null,
168
- parsedResult: null
169
- };
170
- };
171
-
172
3
  /**
173
4
  * Converts an MRZ date string to an ISO date string.
174
- * @param mrzDate The MRZ date string to convert
5
+ * @param mrzDate The MRZ date string to convert (YYMMDD format)
175
6
  * @returns The ISO date string, or null if the input is invalid
176
7
  */
177
8
  const convertMRZDateToISODate = mrzDate => {
178
9
  if (!mrzDate || mrzDate.length !== 6) {
179
10
  return null;
180
11
  }
181
-
182
- // Extract year, month, and day from the MRZ date string
183
12
  let year = parseInt(mrzDate.slice(0, 2), 10);
184
13
  let month = parseInt(mrzDate.slice(2, 4), 10) - 1;
185
14
  let day = parseInt(mrzDate.slice(4, 6), 10);
186
-
187
- // Handle century assumption (usually 1900 or 2000)
188
15
  year += year < 50 ? 2000 : 1900;
189
16
  const date = new Date(Date.UTC(year, month, day));
190
17
  return date.toISOString();
191
18
  };
192
19
  export default {
193
- getMRZData,
194
20
  convertMRZDateToISODate
195
21
  };
@@ -4,12 +4,18 @@ import { Platform } from 'react-native';
4
4
  import DeviceInfo from 'react-native-device-info';
5
5
  export const NativeDeviceInfo = {
6
6
  generateHumanReadableIdentifier: async () => {
7
- const brand = DeviceInfo.getBrand();
8
- const model = DeviceInfo.getModel();
9
- const systemName = Platform.OS === 'ios' ? 'iOS' : 'Android';
10
- const systemVersion = DeviceInfo.getSystemVersion();
11
- const uniqueId = await DeviceInfo.getUniqueId();
12
- return `${brand} ${model} (${systemName} ${systemVersion}) - ${uniqueId}`;
7
+ try {
8
+ const brand = await DeviceInfo.getBrand();
9
+ const model = await DeviceInfo.getModel();
10
+ const systemName = Platform.OS === 'ios' ? 'iOS' : 'Android';
11
+ const systemVersion = await DeviceInfo.getSystemVersion();
12
+ const uniqueId = await DeviceInfo.getUniqueId();
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
  export default NativeDeviceInfo;
@@ -3,23 +3,57 @@
3
3
  import i18n from "../../Translation/index.js";
4
4
  import Tts from 'react-native-tts';
5
5
  import debounce from "./debounce.utils.js";
6
+ let isSpeaking = false;
7
+ let lastSpokenMessage = '';
8
+ let lastSpeakTime = 0;
9
+ const MIN_SPEAK_INTERVAL = 3000; // Minimum 3 seconds between messages
10
+
6
11
  Tts.addEventListener('tts-start', _event => {
7
- // console.log('TTS started', event);
12
+ isSpeaking = true;
8
13
  });
9
14
  Tts.addEventListener('tts-finish', _event => {
10
- // console.log('TTS finished', event);
15
+ isSpeaking = false;
11
16
  });
12
17
  Tts.addEventListener('tts-cancel', _event => {
13
- // console.log('TTS cancelled', event);
18
+ isSpeaking = false;
14
19
  });
15
- const speak = async text => {
20
+ const speak = async (text, bypassInterval = false) => {
21
+ const now = Date.now();
22
+
23
+ // Prevent duplicate message
24
+ if (text === lastSpokenMessage) {
25
+ return;
26
+ }
27
+
28
+ // Enforce minimum interval between different messages (unless bypassed)
29
+ if (!bypassInterval && now - lastSpeakTime < MIN_SPEAK_INTERVAL) {
30
+ return;
31
+ }
32
+
33
+ // When bypassing interval (e.g., liveness instructions), interrupt current speech
34
+ // to ensure new instruction is spoken immediately
35
+ if (bypassInterval && isSpeaking) {
36
+ await Tts.stop();
37
+ isSpeaking = false;
38
+ }
39
+
40
+ // Wait for any ongoing speech to finish (unless we just interrupted it)
41
+ if (isSpeaking) {
42
+ return;
43
+ }
16
44
  await Tts.setDefaultLanguage(i18n.language);
17
45
  await Tts.stop();
18
46
  Tts.speak(text);
47
+ lastSpokenMessage = text;
48
+ lastSpeakTime = now;
19
49
  };
20
- const speakWithDebounce = debounce(speak, 500);
50
+ const speakWithDebounce = debounce(speak, 1500);
21
51
  const stopSpeaking = async () => {
22
52
  await Tts.stop();
53
+ isSpeaking = false;
54
+ };
55
+ const resetLastMessage = () => {
56
+ lastSpokenMessage = '';
23
57
  };
24
58
  const initializeTTS = () => {
25
59
  Tts.getInitStatus().then(() => {}, err => {
@@ -28,4 +62,4 @@ const initializeTTS = () => {
28
62
  }
29
63
  });
30
64
  };
31
- export { speak, speakWithDebounce, stopSpeaking, initializeTTS };
65
+ export { speak, speakWithDebounce, stopSpeaking, resetLastMessage, initializeTTS };
@@ -12,6 +12,7 @@ import 'react-native-get-random-values';
12
12
  import { v4 as uuidv4 } from 'uuid';
13
13
  import { SDK_VERSION } from "../../version.js";
14
14
  import { AnalyticsEventName } from "../Types/analytics.types.js";
15
+ import { debugLog, debugWarn } from "../Libs/debug.utils.js";
15
16
  class AnalyticsService {
16
17
  config = null;
17
18
  sessionId = null;
@@ -97,13 +98,13 @@ class AnalyticsService {
97
98
  if (Array.isArray(persistedQueue) && persistedQueue.length > 0) {
98
99
  // Merge with existing queue, prioritizing persisted events
99
100
  this.queue = [...persistedQueue, ...this.queue];
100
- if (__DEV__) console.log(`[Analytics] Loaded ${persistedQueue.length} events from disk`);
101
+ if (__DEV__) debugLog('AnalyticsService', `[Analytics] Loaded ${persistedQueue.length} events from disk`);
101
102
  }
102
103
  // Clear the file after loading to prevent duplicate loads
103
104
  await RNFS.unlink(this.QUEUE_FILE_PATH);
104
105
  }
105
106
  } catch (error) {
106
- if (__DEV__) console.warn('[Analytics] Failed to load persisted queue:', error);
107
+ if (__DEV__) debugWarn('[Analytics] Failed to load persisted queue:', error);
107
108
  }
108
109
  }
109
110
 
@@ -120,7 +121,7 @@ class AnalyticsService {
120
121
  }
121
122
  await RNFS.writeFile(this.QUEUE_FILE_PATH, JSON.stringify(this.queue), 'utf8');
122
123
  } catch (error) {
123
- if (__DEV__) console.warn('[Analytics] Failed to persist queue:', error);
124
+ if (__DEV__) debugWarn('[Analytics] Failed to persist queue:', error);
124
125
  }
125
126
  }
126
127
 
@@ -168,7 +169,7 @@ class AnalyticsService {
168
169
  if (this.queue.length > this.MAX_QUEUE_SIZE) {
169
170
  const dropped = this.queue.length - this.MAX_QUEUE_SIZE;
170
171
  this.queue = this.queue.slice(dropped);
171
- if (__DEV__) console.warn(`[Analytics] Queue overflow, dropped ${dropped} oldest events`);
172
+ if (__DEV__) debugWarn('AnalyticsService', `[Analytics] Queue overflow, dropped ${dropped} oldest events`);
172
173
  }
173
174
 
174
175
  // Flush immediately for critical events or if batch size reached
@@ -228,7 +229,7 @@ class AnalyticsService {
228
229
  await this.persistQueue();
229
230
  } catch (error) {
230
231
  // On failure, we keep events in the queue
231
- if (__DEV__) console.warn('[Analytics] Failed to flush batch, keeping events:', error);
232
+ if (__DEV__) debugWarn('AnalyticsService', '[Analytics] Failed to flush batch, keeping events:', error);
232
233
 
233
234
  // Ensure they are persisted
234
235
  await this.persistQueue();
@@ -265,10 +266,10 @@ class AnalyticsService {
265
266
  // For other 4xx errors (Bad Request, Unauthorized, etc.), do NOT retry.
266
267
  // We return successfully so the bad events are removed from the queue.
267
268
  if (response.status >= 400 && response.status < 500) {
268
- if (__DEV__) console.warn(`[Analytics] Dropping batch due to ${response.status} error`);
269
+ if (__DEV__) debugWarn('AnalyticsService', `[Analytics] Dropping batch due to ${response.status} error`);
269
270
  return;
270
271
  }
271
- if (__DEV__) console.warn('[Analytics] Failed to send batch:', response.status);
272
+ if (__DEV__) debugWarn('AnalyticsService', '[Analytics] Failed to send batch:', response.status);
272
273
  }
273
274
  } catch (error) {
274
275
  if (attempt <= maxRetries) {
@@ -324,7 +325,7 @@ class AnalyticsService {
324
325
  screenResolution: `${DeviceInfo.getDeviceType()}`
325
326
  };
326
327
  } catch (error) {
327
- if (__DEV__) console.warn('[Analytics] Error collecting device info:', error);
328
+ if (__DEV__) debugWarn('AnalyticsService', '[Analytics] Error collecting device info:', error);
328
329
  // Fallback device info
329
330
  this.deviceInfo = {
330
331
  platform: 'android',
@@ -0,0 +1 @@
1
+ "use strict";