@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
@@ -0,0 +1,96 @@
1
+ import { ASN1Constants } from './asn1Constants';
2
+
3
+ export class TLVHelpers extends ASN1Constants {
4
+ public static isPrimitive(tag: number): boolean {
5
+ let i = 3;
6
+ for (; i >= 0; i--) {
7
+ const mask = 0xff << (8 * i);
8
+ if ((tag & mask) !== 0x00) {
9
+ break;
10
+ }
11
+ }
12
+ const msByte = ((tag & (0xff << (8 * i))) >> (8 * i)) & 0xff;
13
+ return (msByte & 0x20) === 0x00;
14
+ }
15
+
16
+ public static getTagLength(tag: number): number {
17
+ return TLVHelpers.getTagAsBytes(tag).length;
18
+ }
19
+
20
+ public static getLengthLength(length: number): number {
21
+ return TLVHelpers.getLengthAsBytes(length).length;
22
+ }
23
+
24
+ public static getTagAsBytes(tag: number): number[] {
25
+ const out: number[] = [];
26
+ const byteCount = Math.floor(Math.log(tag) / Math.log(256)) + 1;
27
+ for (let i = 0; i < byteCount; i++) {
28
+ const pos = 8 * (byteCount - i - 1);
29
+ out.push((tag & (0xff << pos)) >> pos);
30
+ }
31
+ const tagBytes = out;
32
+ switch (TLVHelpers.getTagClass(tag)) {
33
+ case TLVHelpers.APPLICATION_CLASS:
34
+ tagBytes[0] |= 0x40;
35
+ break;
36
+ case TLVHelpers.CONTEXT_SPECIFIC_CLASS:
37
+ tagBytes[0] |= 0x80;
38
+ break;
39
+ case TLVHelpers.PRIVATE_CLASS:
40
+ tagBytes[0] |= 0xc0;
41
+ break;
42
+ default:
43
+ break;
44
+ }
45
+ if (!TLVHelpers.isPrimitive(tag)) {
46
+ tagBytes[0] |= 0x20;
47
+ }
48
+ return tagBytes;
49
+ }
50
+
51
+ public static getLengthAsBytes(length: number): number[] {
52
+ const out: number[] = [];
53
+ if (length < 0x80) {
54
+ out.push(length);
55
+ } else {
56
+ const byteCount = TLVHelpers.log(length, 256);
57
+ out.push(0x80 | byteCount);
58
+ for (let i = 0; i < byteCount; i++) {
59
+ const pos = 8 * (byteCount - i - 1);
60
+ out.push((length & (0xff << pos)) >> pos);
61
+ }
62
+ }
63
+ return out;
64
+ }
65
+
66
+ static getTagClass(tag: number): number {
67
+ let i = 3;
68
+ for (; i >= 0; i--) {
69
+ const mask = 0xff << (8 * i);
70
+ if ((tag & mask) !== 0x00) {
71
+ break;
72
+ }
73
+ }
74
+ const msByte = ((tag & (0xff << (8 * i))) >> (8 * i)) & 0xff;
75
+ switch (msByte & 0xc0) {
76
+ case 0x00:
77
+ return TLVHelpers.UNIVERSAL_CLASS;
78
+ case 0x40:
79
+ return TLVHelpers.APPLICATION_CLASS;
80
+ case 0x80:
81
+ return TLVHelpers.CONTEXT_SPECIFIC_CLASS;
82
+ case 0xc0:
83
+ default:
84
+ return TLVHelpers.PRIVATE_CLASS;
85
+ }
86
+ }
87
+
88
+ private static log(n: number, base: number): number {
89
+ let result = 0;
90
+ while (n > 0) {
91
+ n = n / base;
92
+ result++;
93
+ }
94
+ return result;
95
+ }
96
+ }
@@ -1,97 +1,12 @@
1
1
  import { ByteArrayInputStream } from '../java/byteArrayInputStream';
2
2
  import { ByteArrayOutputStream } from '../java/byteArrayOutputStream';
3
- import { ASN1Constants } from './asn1Constants';
4
3
  import { TLVInputStream } from './tlvInputStream';
5
4
  import { TLVOutputStream } from './tlvOutputStream';
6
5
  import { Buffer } from 'buffer';
6
+ import { TLVHelpers } from './tlv.helpers';
7
7
 
8
- class TLVUtil extends ASN1Constants {
9
- public static isPrimitive(tag: number): boolean {
10
- let i = 3;
11
- for (; i >= 0; i--) {
12
- const mask = 0xff << (8 * i);
13
- if ((tag & mask) !== 0x00) {
14
- break;
15
- }
16
- }
17
- const msByte = ((tag & (0xff << (8 * i))) >> (8 * i)) & 0xff;
18
- return (msByte & 0x20) === 0x00;
19
- }
20
-
21
- public static getTagLength(tag: number): number {
22
- return TLVUtil.getTagAsBytes(tag).length;
23
- }
24
-
25
- public static getLengthLength(length: number): number {
26
- return TLVUtil.getLengthAsBytes(length).length;
27
- }
28
-
29
- /**
30
- * The tag bytes of this object.
31
- *
32
- * @param tag the tag
33
- *
34
- * @return the tag bytes of this object.
35
- */
36
- public static getTagAsBytes(tag: number): number[] {
37
- const out: number[] = [];
38
- const byteCount = Math.floor(Math.log(tag) / Math.log(256)) + 1;
39
- for (let i = 0; i < byteCount; i++) {
40
- const pos = 8 * (byteCount - i - 1);
41
- out.push((tag & (0xff << pos)) >> pos);
42
- }
43
- const tagBytes = out;
44
- switch (TLVUtil.getTagClass(tag)) {
45
- case TLVUtil.APPLICATION_CLASS:
46
- tagBytes[0] |= 0x40;
47
- break;
48
- case TLVUtil.CONTEXT_SPECIFIC_CLASS:
49
- tagBytes[0] |= 0x80;
50
- break;
51
- case TLVUtil.PRIVATE_CLASS:
52
- tagBytes[0] |= 0xc0;
53
- break;
54
- default:
55
- /* NOTE: Unsupported tag class. Now what? */
56
- break;
57
- }
58
- if (!TLVUtil.isPrimitive(tag)) {
59
- tagBytes[0] |= 0x20;
60
- }
61
- return tagBytes;
62
- }
8
+ class TLVUtil extends TLVHelpers {
63
9
 
64
- /**
65
- * The length bytes of this object.
66
- *
67
- * @param length the length
68
- *
69
- * @return length of encoded value as bytes
70
- */
71
- public static getLengthAsBytes(length: number): number[] {
72
- const out: number[] = [];
73
- if (length < 0x80) {
74
- /* short form */
75
- out.push(length);
76
- } else {
77
- const byteCount = TLVUtil.log(length, 256);
78
- out.push(0x80 | byteCount);
79
- for (let i = 0; i < byteCount; i++) {
80
- const pos = 8 * (byteCount - i - 1);
81
- out.push((length & (0xff << pos)) >> pos);
82
- }
83
- }
84
- return out;
85
- }
86
-
87
- /**
88
- * TLV encodes an encoded data object with a tag.
89
- *
90
- * @param tag the tag
91
- * @param data the data to encode
92
- *
93
- * @return the TLV encoded data
94
- */
95
10
  public static wrapDO(tag: number, data: number[]): Uint8Array {
96
11
  if (data == null) {
97
12
  throw new Error('Data to wrap is null');
@@ -117,14 +32,6 @@ class TLVUtil extends ASN1Constants {
117
32
  }
118
33
  }
119
34
 
120
- /**
121
- * TLV decodes tagged TLV data object.
122
- *
123
- * @param expectedTag the tag to expect, an {@code IllegalArgumentException} will be throws if a different tag is read
124
- * @param wrappedData the encoded data
125
- *
126
- * @return the decoded data
127
- */
128
35
  public static async unwrapDO(
129
36
  expectedTag: number,
130
37
  wrappedData: number[]
@@ -166,36 +73,6 @@ class TLVUtil extends ASN1Constants {
166
73
  }
167
74
  }
168
75
 
169
- static getTagClass(tag: number): number {
170
- let i = 3;
171
- for (; i >= 0; i--) {
172
- const mask = 0xff << (8 * i);
173
- if ((tag & mask) !== 0x00) {
174
- break;
175
- }
176
- }
177
- const msByte = ((tag & (0xff << (8 * i))) >> (8 * i)) & 0xff;
178
- switch (msByte & 0xc0) {
179
- case 0x00:
180
- return TLVUtil.UNIVERSAL_CLASS;
181
- case 0x40:
182
- return TLVUtil.APPLICATION_CLASS;
183
- case 0x80:
184
- return TLVUtil.CONTEXT_SPECIFIC_CLASS;
185
- case 0xc0:
186
- default:
187
- return TLVUtil.PRIVATE_CLASS;
188
- }
189
- }
190
-
191
- private static log(n: number, base: number): number {
192
- let result = 0;
193
- while (n > 0) {
194
- n = n / base;
195
- result++;
196
- }
197
- return result;
198
- }
199
76
  }
200
77
 
201
78
  export default TLVUtil;
@@ -1,7 +1,7 @@
1
1
  import { ByteArrayInputStream } from '../java/byteArrayInputStream';
2
2
  import { DataInputStream } from '../java/dataInputStream';
3
3
  import { InputStream } from '../java/inputStream';
4
- import TLVUtil from './tlv.utils';
4
+ import { TLVHelpers } from './tlv.helpers';
5
5
  import { TLVInputState } from './tlvInputState';
6
6
 
7
7
  export class TLVInputStream extends InputStream {
@@ -132,11 +132,11 @@ export class TLVInputStream extends InputStream {
132
132
  if (this.state.getIsAtStartOfTag()) {
133
133
  } else if (this.state.getIsAtStartOfLength()) {
134
134
  await this.readLength();
135
- if (TLVUtil.isPrimitive(this.state.getTag())) {
135
+ if (TLVHelpers.isPrimitive(this.state.getTag())) {
136
136
  await this.skipValue();
137
137
  }
138
138
  } else {
139
- if (TLVUtil.isPrimitive(this.state.getTag())) {
139
+ if (TLVHelpers.isPrimitive(this.state.getTag())) {
140
140
  await this.skipValue();
141
141
  }
142
142
  }
@@ -144,7 +144,7 @@ export class TLVInputStream extends InputStream {
144
144
  if (tag === searchTag) {
145
145
  return;
146
146
  }
147
- if (TLVUtil.isPrimitive(tag)) {
147
+ if (TLVHelpers.isPrimitive(tag)) {
148
148
  const length = await this.readLength();
149
149
  const skippedBytes = await this.skipValue();
150
150
  if (skippedBytes >= length) {
@@ -1,4 +1,4 @@
1
- import TLVUtil from './tlv.utils';
1
+ import { TLVHelpers } from './tlv.helpers';
2
2
 
3
3
  export class TLVOutputState {
4
4
  private state: TLVStruct[];
@@ -68,7 +68,7 @@ export class TLVOutputState {
68
68
  const obj = new TLVStruct(tag);
69
69
  if (this.state.length !== 0) {
70
70
  const parent = this.state[this.state.length - 1];
71
- const tagBytes = TLVUtil.getTagAsBytes(tag);
71
+ const tagBytes = TLVHelpers.getTagAsBytes(tag);
72
72
  parent.write(tagBytes, 0, tagBytes.length);
73
73
  }
74
74
 
@@ -99,7 +99,7 @@ export class TLVOutputState {
99
99
  const obj = this.state.pop();
100
100
  if (this.state.length !== 0) {
101
101
  const parent = this.state[this.state.length - 1];
102
- const lengthBytes = TLVUtil.getLengthAsBytes(length);
102
+ const lengthBytes = TLVHelpers.getLengthAsBytes(length);
103
103
  parent.write(lengthBytes, 0, lengthBytes.length);
104
104
  }
105
105
 
@@ -125,7 +125,7 @@ export class TLVOutputState {
125
125
  currentObject.getValueBytesProcessed() === currentObject.getLength()
126
126
  ) {
127
127
  this.state.pop();
128
- const lengthBytes = TLVUtil.getLengthAsBytes(byteCount);
128
+ const lengthBytes = TLVHelpers.getLengthAsBytes(byteCount);
129
129
  const value = currentObject.getValue();
130
130
  this.updateValueBytesProcessed(lengthBytes, 0, lengthBytes.length);
131
131
  this.updateValueBytesProcessed(value, 0, value.length);
@@ -1,6 +1,6 @@
1
1
  import { DataOutputStream } from '../java/dataOutputStream';
2
2
  import { OutputStream } from '../java/outputStream';
3
- import TLVUtil from './tlv.utils';
3
+ import { TLVHelpers } from './tlv.helpers';
4
4
  import { TLVOutputState } from './tlvOutputState';
5
5
 
6
6
  export class TLVOutputStream extends OutputStream {
@@ -20,7 +20,7 @@ export class TLVOutputStream extends OutputStream {
20
20
  if (!this.state.getIsAtStartOfTag()) {
21
21
  throw new Error('Cannot write tag, still need length');
22
22
  }
23
- const tagAsBytes = TLVUtil.getTagAsBytes(tag);
23
+ const tagAsBytes = TLVHelpers.getTagAsBytes(tag);
24
24
  this.outputStream.writeBytes(Uint8Array.from(tagAsBytes));
25
25
  this.state.setTagProcessed(tag);
26
26
  }
@@ -29,7 +29,7 @@ export class TLVOutputStream extends OutputStream {
29
29
  if (!this.state.getIsAtStartOfLength()) {
30
30
  throw new Error('Cannot write length');
31
31
  }
32
- const lengthAsBytes = TLVUtil.getLengthAsBytes(length);
32
+ const lengthAsBytes = TLVHelpers.getLengthAsBytes(length);
33
33
  this.outputStream.writeBytes(Uint8Array.from(lengthAsBytes));
34
34
  this.state.setLengthProcessed(length);
35
35
  }
@@ -92,7 +92,7 @@ export class TLVOutputStream extends OutputStream {
92
92
  const length = bufferedValueBytes.length;
93
93
  this.state.updatePreviousLength(length);
94
94
  if (this.state.canBeWritten()) {
95
- const lengthAsBytes = TLVUtil.getLengthAsBytes(length);
95
+ const lengthAsBytes = TLVHelpers.getLengthAsBytes(length);
96
96
  this.outputStream.writeBytes(Uint8Array.from(lengthAsBytes));
97
97
  this.outputStream.writeBytes(Uint8Array.from(bufferedValueBytes));
98
98
  }
@@ -10,7 +10,11 @@ import {
10
10
  AnalyticsEventCategory,
11
11
  AnalyticsEventName,
12
12
  } from '../Types/analytics.types';
13
- import type { AnalyticsEventMetadata, ErrorSeverity, ErrorContext } from '../Types/analytics.types';
13
+ import type {
14
+ AnalyticsEventMetadata,
15
+ ErrorSeverity,
16
+ ErrorContext,
17
+ } from '../Types/analytics.types';
14
18
 
15
19
  /**
16
20
  * Track screen view event
@@ -86,11 +90,12 @@ const sanitizeStackTrace = (error: Error): string | undefined => {
86
90
  // Keep only function names and line numbers, remove file paths
87
91
  const lines = error.stack.split('\n').slice(0, 5);
88
92
  return lines
89
- .map(line => {
93
+ .map((line) => {
90
94
  // Remove full file paths, keep just the filename and line
91
- return line.replace(/\(.*\/([^/]+:[0-9]+:[0-9]+)\)/, '($1)')
92
- .replace(/at\s+.*\/([^/]+)/, 'at $1')
93
- .trim();
95
+ return line
96
+ .replace(/\(.*\/([^/]+:[0-9]+:[0-9]+)\)/, '($1)')
97
+ .replace(/at\s+.*\/([^/]+)/, 'at $1')
98
+ .trim();
94
99
  })
95
100
  .join(' -> ');
96
101
  } catch {
@@ -103,13 +108,30 @@ const sanitizeStackTrace = (error: Error): string | undefined => {
103
108
  */
104
109
  const inferErrorCategory = (errorCode: string): string => {
105
110
  const code = errorCode.toLowerCase();
106
- if (code.includes('network') || code.includes('fetch') || code.includes('timeout')) return 'network';
107
- if (code.includes('permission') || code.includes('denied')) return 'permission';
111
+ if (
112
+ code.includes('network') ||
113
+ code.includes('fetch') ||
114
+ code.includes('timeout')
115
+ )
116
+ return 'network';
117
+ if (code.includes('permission') || code.includes('denied'))
118
+ return 'permission';
108
119
  if (code.includes('camera')) return 'camera';
109
120
  if (code.includes('nfc') || code.includes('eid')) return 'nfc';
110
- if (code.includes('validation') || code.includes('invalid')) return 'validation';
111
- if (code.includes('api') || code.includes('response') || code.includes('status')) return 'api';
112
- if (code.includes('storage') || code.includes('file') || code.includes('save')) return 'storage';
121
+ if (code.includes('validation') || code.includes('invalid'))
122
+ return 'validation';
123
+ if (
124
+ code.includes('api') ||
125
+ code.includes('response') ||
126
+ code.includes('status')
127
+ )
128
+ return 'api';
129
+ if (
130
+ code.includes('storage') ||
131
+ code.includes('file') ||
132
+ code.includes('save')
133
+ )
134
+ return 'storage';
113
135
  if (code.includes('device')) return 'device';
114
136
  if (code.includes('input') || code.includes('user')) return 'user_input';
115
137
  return 'unknown';
@@ -118,10 +140,10 @@ const inferErrorCategory = (errorCode: string): string => {
118
140
  /**
119
141
  * Track error event with unique event name per error code
120
142
  * Event name format: error_{errorCode} (e.g., error_camera_permission_denied)
121
- *
143
+ *
122
144
  * Only errors with severity 'medium' or higher are recorded.
123
145
  * Low severity errors are ignored to reduce noise.
124
- *
146
+ *
125
147
  * @param errorCode - Unique identifier for the error type
126
148
  * @param errorMessage - Human-readable error message (sanitized)
127
149
  * @param screenName - Screen where the error occurred
@@ -165,9 +187,11 @@ export const trackError = async (
165
187
  // Add optional context fields
166
188
  if (context?.component) metadata.component = context.component;
167
189
  if (context?.userAction) metadata.userAction = context.userAction;
168
- if (context?.recoverable !== undefined) metadata.recoverable = context.recoverable;
169
- if (context?.retryCount !== undefined) metadata.retryCount = context.retryCount;
170
-
190
+ if (context?.recoverable !== undefined)
191
+ metadata.recoverable = context.recoverable;
192
+ if (context?.retryCount !== undefined)
193
+ metadata.retryCount = context.retryCount;
194
+
171
195
  // Add sanitized stack trace if error object provided
172
196
  if (context?.error) {
173
197
  const stackTrace = sanitizeStackTrace(context.error);
@@ -245,7 +269,10 @@ export const trackApiCall = async (
245
269
  /**
246
270
  * Map workflow step types to valid analytics event names
247
271
  */
248
- const STEP_EVENT_MAP: Record<string, { started: AnalyticsEventName; completed: AnalyticsEventName }> = {
272
+ const STEP_EVENT_MAP: Record<
273
+ string,
274
+ { started: AnalyticsEventName; completed: AnalyticsEventName }
275
+ > = {
249
276
  contract_acceptance: {
250
277
  started: AnalyticsEventName.CONTRACT_ACCEPTANCE_STARTED,
251
278
  completed: AnalyticsEventName.CONTRACT_ACCEPTANCE_COMPLETED,
@@ -264,7 +291,10 @@ const STEP_EVENT_MAP: Record<string, { started: AnalyticsEventName; completed: A
264
291
  },
265
292
  };
266
293
 
267
- function getStepEventName(stepType: string, suffix: 'started' | 'completed'): string {
294
+ function getStepEventName(
295
+ stepType: string,
296
+ suffix: 'started' | 'completed'
297
+ ): string {
268
298
  const normalizedStep = stepType.toLowerCase();
269
299
  const mapping = STEP_EVENT_MAP[normalizedStep];
270
300
  if (mapping) {
@@ -277,9 +307,7 @@ function getStepEventName(stepType: string, suffix: 'started' | 'completed'): st
277
307
  /**
278
308
  * Track verification process events
279
309
  */
280
- export const trackVerificationStart = async (
281
- stepType: string
282
- ) => {
310
+ export const trackVerificationStart = async (stepType: string) => {
283
311
  try {
284
312
  const eventName = getStepEventName(stepType, 'started');
285
313
 
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Debug logging utility with log levels for SDK development
3
+ * Logs are filtered based on the current log level and debug mode
4
+ *
5
+ * Log Levels (lower number = more verbose):
6
+ * 0 - TRACE (all debug information)
7
+ * 1 - DEBUG (important debug information)
8
+ * 2 - INFO (informational messages)
9
+ * 3 - WARN (warnings and important issues)
10
+ * 4 - ERROR (errors only)
11
+ * 5 - SILENT (no logging)
12
+ *
13
+ * Enable debug mode via:
14
+ * 1. Environment variable: TRUSTCHEX_DEBUG=true
15
+ * 2. Global flag: (global as any).TRUSTCHEX_DEBUG = true
16
+ * 3. TrustchexProvider prop: debug={true}
17
+ *
18
+ * Set log level via:
19
+ * 1. setLogLevel(LogLevel.TRACE)
20
+ * 2. TRUSTCHEX_LOG_LEVEL environment variable
21
+ * 3. TrustchexProvider prop: logLevel="trace"
22
+ */
23
+
24
+ export enum LogLevel {
25
+ TRACE = 0,
26
+ DEBUG = 1,
27
+ INFO = 2,
28
+ WARN = 3,
29
+ ERROR = 4,
30
+ SILENT = 5,
31
+ }
32
+
33
+ let debugEnabled =
34
+ process.env.NODE_ENV === 'development' &&
35
+ ((global as any).TRUSTCHEX_DEBUG === true ||
36
+ process.env.TRUSTCHEX_DEBUG === 'true');
37
+
38
+ // Default to TRACE level for development debugging
39
+ let currentLogLevel: LogLevel = debugEnabled ? LogLevel.TRACE : LogLevel.WARN;
40
+
41
+ // Parse log level from env or string
42
+ const parseLogLevel = (level: string | LogLevel | undefined): LogLevel => {
43
+ if (level === undefined) return currentLogLevel;
44
+ if (typeof level === 'number') return level;
45
+
46
+ const levelMap: Record<string, LogLevel> = {
47
+ trace: LogLevel.TRACE,
48
+ debug: LogLevel.DEBUG,
49
+ info: LogLevel.INFO,
50
+ warn: LogLevel.WARN,
51
+ error: LogLevel.ERROR,
52
+ silent: LogLevel.SILENT,
53
+ };
54
+
55
+ return levelMap[level.toLowerCase()] ?? currentLogLevel;
56
+ };
57
+
58
+ export const setDebugMode = (enabled: boolean) => {
59
+ debugEnabled = enabled;
60
+ // When debug mode is enabled, default to TRACE level
61
+ if (enabled && currentLogLevel === LogLevel.WARN) {
62
+ currentLogLevel = LogLevel.TRACE;
63
+ }
64
+ };
65
+
66
+ export const setLogLevel = (level: LogLevel | string) => {
67
+ currentLogLevel = parseLogLevel(level);
68
+ };
69
+
70
+ export const isDebugEnabled = () => {
71
+ return debugEnabled;
72
+ };
73
+
74
+ export const getLogLevel = () => {
75
+ return currentLogLevel;
76
+ };
77
+
78
+ // Check if a message at the given level should be logged
79
+ const shouldLog = (level: LogLevel): boolean => {
80
+ return debugEnabled && level >= currentLogLevel;
81
+ };
82
+
83
+ export const traceLog = (tag: string, message: string, data?: unknown) => {
84
+ if (!shouldLog(LogLevel.TRACE)) return;
85
+
86
+ if (data !== undefined) {
87
+ console.log(`[${tag}] TRACE: ${message}`, data);
88
+ } else {
89
+ console.log(`[${tag}] TRACE: ${message}`);
90
+ }
91
+ };
92
+
93
+ export const debugLog = (tag: string, message: string, data?: unknown) => {
94
+ if (!shouldLog(LogLevel.DEBUG)) return;
95
+
96
+ if (data !== undefined) {
97
+ console.log(`[${tag}] DEBUG: ${message}`, data);
98
+ } else {
99
+ console.log(`[${tag}] DEBUG: ${message}`);
100
+ }
101
+ };
102
+
103
+ export const infoLog = (tag: string, message: string, data?: unknown) => {
104
+ if (!shouldLog(LogLevel.INFO)) return;
105
+
106
+ if (data !== undefined) {
107
+ console.log(`[${tag}] INFO: ${message}`, data);
108
+ } else {
109
+ console.log(`[${tag}] INFO: ${message}`);
110
+ }
111
+ };
112
+
113
+ export const debugWarn = (tag: string, message: string, data?: unknown) => {
114
+ if (!shouldLog(LogLevel.WARN)) return;
115
+
116
+ if (data !== undefined) {
117
+ console.warn(`[${tag}] WARN: ${message}`, data);
118
+ } else {
119
+ console.warn(`[${tag}] WARN: ${message}`);
120
+ }
121
+ };
122
+
123
+ export const debugError = (tag: string, message: string, error?: unknown) => {
124
+ if (!shouldLog(LogLevel.ERROR)) return;
125
+
126
+ if (error !== undefined) {
127
+ console.error(`[${tag}] ERROR: ${message}`, error);
128
+ } else {
129
+ console.error(`[${tag}] ERROR: ${message}`);
130
+ }
131
+ };
132
+
133
+ // Always log errors regardless of debug mode (critical issues)
134
+ export const logError = (tag: string, message: string, error?: unknown) => {
135
+ if (error !== undefined) {
136
+ console.error(`[${tag}] ERROR: ${message}`, error);
137
+ } else {
138
+ console.error(`[${tag}] ERROR: ${message}`);
139
+ }
140
+ };
141
+
142
+ // Always log warnings for critical issues regardless of debug mode
143
+ export const logWarn = (tag: string, message: string, data?: unknown) => {
144
+ if (data !== undefined) {
145
+ console.warn(`[${tag}] WARN: ${message}`, data);
146
+ } else {
147
+ console.warn(`[${tag}] WARN: ${message}`);
148
+ }
149
+ };
@@ -1,23 +1,25 @@
1
+ import { debugLog } from './debug.utils';
2
+
1
3
  const handleDeepLink = ({ url }: { url: string }) => {
2
- console.log('[handleDeepLink] Received URL:', url);
4
+ debugLog('handleDeepLink', 'Received URL:', url);
3
5
  const isHttps = url.includes('https');
4
6
  const route = url.replace(/http(s)?(:)?(\/\/)?/g, '');
5
7
  const segments = route.split('/');
6
- console.log('[handleDeepLink] Parsed segments:', segments);
8
+ debugLog('handleDeepLink', 'Parsed segments:', segments);
7
9
  let baseUrl = '';
8
10
  let sessionId = '';
9
11
 
10
12
  for (let i = 0; i < segments.length; i++) {
11
13
  if (segments[i] === 'verification-session') {
12
14
  sessionId = segments[i + 1] ?? '';
13
- console.log('[handleDeepLink] Found sessionId:', sessionId);
15
+ debugLog('handleDeepLink', 'Found sessionId:', sessionId);
14
16
  } else if (segments[i] === 'app-url') {
15
17
  baseUrl = `${isHttps ? 'https' : 'http'}://${segments[i + 1]}`;
16
- console.log('[handleDeepLink] Found baseUrl:', baseUrl);
18
+ debugLog('handleDeepLink', 'Found baseUrl:', baseUrl);
17
19
  }
18
20
  }
19
21
 
20
- console.log('[handleDeepLink] Returning:', { baseUrl, sessionId });
22
+ debugLog('handleDeepLink', 'Returning:', { baseUrl, sessionId });
21
23
  return [baseUrl, sessionId];
22
24
  };
23
25
 
@@ -21,6 +21,7 @@ const demoSession = {
21
21
  type: 'CONTRACT_ACCEPTANCE',
22
22
  required: false,
23
23
  data: {
24
+ voiceGuidanceActive: true,
24
25
  contracts: {
25
26
  en: {
26
27
  id: '1',
@@ -38,14 +39,17 @@ const demoSession = {
38
39
  {
39
40
  type: 'IDENTITY_DOCUMENT_SCAN',
40
41
  required: false,
42
+ data: { voiceGuidanceActive: true },
41
43
  },
42
44
  {
43
45
  type: 'IDENTITY_DOCUMENT_EID_SCAN',
44
46
  required: false,
47
+ data: { voiceGuidanceActive: true },
45
48
  },
46
49
  {
47
50
  type: 'LIVENESS_CHECK',
48
51
  required: false,
52
+ data: { voiceGuidanceActive: true },
49
53
  },
50
54
  ],
51
55
  } satisfies VerificationSession;