@trustchex/react-native-sdk 1.354.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 (256) 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 -13
  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 +2149 -778
  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/http-client.js +1 -0
  45. package/lib/module/Shared/Libs/mrz.utils.js +1 -176
  46. package/lib/module/Shared/Libs/native-device-info.utils.js +12 -6
  47. package/lib/module/Shared/Libs/tts.utils.js +40 -6
  48. package/lib/module/Shared/Services/AnalyticsService.js +9 -8
  49. package/lib/module/Shared/Types/mrzFields.js +1 -0
  50. package/lib/module/Translation/Resources/en.js +87 -88
  51. package/lib/module/Translation/Resources/tr.js +84 -85
  52. package/lib/module/Trustchex.js +10 -19
  53. package/lib/module/index.js +1 -0
  54. package/lib/module/version.js +1 -1
  55. package/lib/typescript/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.d.ts.map +1 -1
  56. package/lib/typescript/src/Screens/Dynamic/IdentityDocumentScanningScreen.d.ts.map +1 -1
  57. package/lib/typescript/src/Screens/Dynamic/LivenessDetectionScreen.d.ts.map +1 -1
  58. package/lib/typescript/src/Screens/Static/OTPVerificationScreen.d.ts.map +1 -1
  59. package/lib/typescript/src/Screens/Static/QrCodeScanningScreen.d.ts.map +1 -1
  60. package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -1
  61. package/lib/typescript/src/Screens/Static/VerificationSessionCheckScreen.d.ts.map +1 -1
  62. package/lib/typescript/src/Shared/Components/DebugNavigationPanel.d.ts.map +1 -1
  63. package/lib/typescript/src/Shared/Components/EIDScanner.d.ts +2 -2
  64. package/lib/typescript/src/Shared/Components/EIDScanner.d.ts.map +1 -1
  65. package/lib/typescript/src/Shared/Components/FaceCamera.d.ts +18 -4
  66. package/lib/typescript/src/Shared/Components/FaceCamera.d.ts.map +1 -1
  67. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts +3 -4
  68. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -1
  69. package/lib/typescript/src/Shared/Components/QrCodeScannerCamera.d.ts +2 -1
  70. package/lib/typescript/src/Shared/Components/QrCodeScannerCamera.d.ts.map +1 -1
  71. package/lib/typescript/src/Shared/Components/TrustchexCamera.d.ts +124 -0
  72. package/lib/typescript/src/Shared/Components/TrustchexCamera.d.ts.map +1 -0
  73. package/lib/typescript/src/Shared/EIDReader/tlv/tlv.helpers.d.ts +11 -0
  74. package/lib/typescript/src/Shared/EIDReader/tlv/tlv.helpers.d.ts.map +1 -0
  75. package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts +2 -39
  76. package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts.map +1 -1
  77. package/lib/typescript/src/Shared/Libs/analytics.utils.d.ts.map +1 -1
  78. package/lib/typescript/src/Shared/Libs/debug.utils.d.ts +42 -0
  79. package/lib/typescript/src/Shared/Libs/debug.utils.d.ts.map +1 -0
  80. package/lib/typescript/src/Shared/Libs/deeplink.utils.d.ts.map +1 -1
  81. package/lib/typescript/src/Shared/Libs/demo.utils.d.ts.map +1 -1
  82. package/lib/typescript/src/Shared/Libs/http-client.d.ts.map +1 -1
  83. package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts +0 -4
  84. package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts.map +1 -1
  85. package/lib/typescript/src/Shared/Libs/native-device-info.utils.d.ts.map +1 -1
  86. package/lib/typescript/src/Shared/Libs/tts.utils.d.ts +4 -3
  87. package/lib/typescript/src/Shared/Libs/tts.utils.d.ts.map +1 -1
  88. package/lib/typescript/src/Shared/Services/AnalyticsService.d.ts.map +1 -1
  89. package/lib/typescript/src/Shared/Types/identificationInfo.d.ts +2 -2
  90. package/lib/typescript/src/Shared/Types/identificationInfo.d.ts.map +1 -1
  91. package/lib/typescript/src/Shared/Types/mrzFields.d.ts +11 -0
  92. package/lib/typescript/src/Shared/Types/mrzFields.d.ts.map +1 -0
  93. package/lib/typescript/src/Translation/Resources/en.d.ts +4 -5
  94. package/lib/typescript/src/Translation/Resources/en.d.ts.map +1 -1
  95. package/lib/typescript/src/Translation/Resources/tr.d.ts +4 -5
  96. package/lib/typescript/src/Translation/Resources/tr.d.ts.map +1 -1
  97. package/lib/typescript/src/Trustchex.d.ts +2 -0
  98. package/lib/typescript/src/Trustchex.d.ts.map +1 -1
  99. package/lib/typescript/src/index.d.ts +1 -0
  100. package/lib/typescript/src/index.d.ts.map +1 -1
  101. package/lib/typescript/src/version.d.ts +1 -1
  102. package/package.json +13 -36
  103. package/src/Screens/Dynamic/ContractAcceptanceScreen.tsx +1 -1
  104. package/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.tsx +7 -5
  105. package/src/Screens/Dynamic/IdentityDocumentScanningScreen.tsx +2 -3
  106. package/src/Screens/Dynamic/LivenessDetectionScreen.tsx +498 -216
  107. package/src/Screens/Static/OTPVerificationScreen.tsx +37 -31
  108. package/src/Screens/Static/QrCodeScanningScreen.tsx +8 -1
  109. package/src/Screens/Static/ResultScreen.tsx +136 -104
  110. package/src/Screens/Static/VerificationSessionCheckScreen.tsx +46 -13
  111. package/src/Shared/Components/DebugNavigationPanel.tsx +290 -34
  112. package/src/Shared/Components/EIDScanner.tsx +94 -16
  113. package/src/Shared/Components/FaceCamera.tsx +236 -203
  114. package/src/Shared/Components/IdentityDocumentCamera.tsx +3070 -1036
  115. package/src/Shared/Components/QrCodeScannerCamera.tsx +133 -127
  116. package/src/Shared/Components/TrustchexCamera.tsx +289 -0
  117. package/src/Shared/Config/camera-enhancement.config.ts +2 -2
  118. package/src/Shared/EIDReader/tlv/tlv.helpers.ts +96 -0
  119. package/src/Shared/EIDReader/tlv/tlv.utils.ts +2 -125
  120. package/src/Shared/EIDReader/tlv/tlvInputStream.ts +4 -4
  121. package/src/Shared/EIDReader/tlv/tlvOutputState.ts +4 -4
  122. package/src/Shared/EIDReader/tlv/tlvOutputStream.ts +4 -4
  123. package/src/Shared/Libs/analytics.utils.ts +48 -20
  124. package/src/Shared/Libs/debounce.utils.ts +1 -1
  125. package/src/Shared/Libs/debug.utils.ts +149 -0
  126. package/src/Shared/Libs/deeplink.utils.ts +7 -5
  127. package/src/Shared/Libs/demo.utils.ts +4 -0
  128. package/src/Shared/Libs/http-client.ts +13 -8
  129. package/src/Shared/Libs/mrz.utils.ts +1 -164
  130. package/src/Shared/Libs/native-device-info.utils.ts +12 -6
  131. package/src/Shared/Libs/tts.utils.ts +48 -6
  132. package/src/Shared/Services/AnalyticsService.ts +69 -24
  133. package/src/Shared/Types/identificationInfo.ts +2 -2
  134. package/src/Shared/Types/mrzFields.ts +29 -0
  135. package/src/Translation/Resources/en.ts +90 -100
  136. package/src/Translation/Resources/tr.ts +89 -97
  137. package/src/Translation/index.ts +1 -1
  138. package/src/Trustchex.tsx +22 -17
  139. package/src/index.tsx +14 -0
  140. package/src/version.ts +1 -1
  141. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/barcodescanner/BarcodeScannerFrameProcessorPlugin.kt +0 -301
  142. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/BitmapUtils.kt +0 -205
  143. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/CropperPlugin.kt +0 -72
  144. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/cropper/FrameMetadata.kt +0 -4
  145. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/facedetector/FaceDetectorFrameProcessorPlugin.kt +0 -303
  146. package/android/src/main/java/com/trustchex/reactnativesdk/visioncameraplugins/textrecognition/TextRecognitionFrameProcessorPlugin.kt +0 -115
  147. package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin-Bridging-Header.h +0 -9
  148. package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin.mm +0 -22
  149. package/ios/VisionCameraPlugins/BarcodeScanner/BarcodeScannerFrameProcessorPlugin.swift +0 -188
  150. package/ios/VisionCameraPlugins/Cropper/Cropper-Bridging-Header.h +0 -13
  151. package/ios/VisionCameraPlugins/Cropper/Cropper.h +0 -20
  152. package/ios/VisionCameraPlugins/Cropper/Cropper.mm +0 -22
  153. package/ios/VisionCameraPlugins/Cropper/Cropper.swift +0 -145
  154. package/ios/VisionCameraPlugins/Cropper/CropperUtils.swift +0 -49
  155. package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin-Bridging-Header.h +0 -4
  156. package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin.mm +0 -22
  157. package/ios/VisionCameraPlugins/FaceDetector/FaceDetectorFrameProcessorPlugin.swift +0 -320
  158. package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin-Bridging-Header.h +0 -4
  159. package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin.mm +0 -27
  160. package/ios/VisionCameraPlugins/TextRecognition/TextRecognitionFrameProcessorPlugin.swift +0 -144
  161. package/lib/module/Shared/Libs/camera.utils.js +0 -308
  162. package/lib/module/Shared/Libs/frame-enhancement.utils.js +0 -133
  163. package/lib/module/Shared/Libs/opencv.utils.js +0 -21
  164. package/lib/module/Shared/Libs/worklet.utils.js +0 -53
  165. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.js +0 -46
  166. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.js +0 -35
  167. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/index.js +0 -19
  168. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.js +0 -26
  169. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/types.js +0 -3
  170. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.js +0 -197
  171. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.js +0 -101
  172. package/lib/module/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.js +0 -60
  173. package/lib/module/Shared/VisionCameraPlugins/Cropper/index.js +0 -47
  174. package/lib/module/Shared/VisionCameraPlugins/FaceDetector/Camera.js +0 -42
  175. package/lib/module/Shared/VisionCameraPlugins/FaceDetector/detectFaces.js +0 -35
  176. package/lib/module/Shared/VisionCameraPlugins/FaceDetector/index.js +0 -4
  177. package/lib/module/Shared/VisionCameraPlugins/FaceDetector/types.js +0 -3
  178. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/Camera.js +0 -56
  179. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.js +0 -20
  180. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.js +0 -9
  181. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/index.js +0 -6
  182. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/scanText.js +0 -20
  183. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/translateText.js +0 -19
  184. package/lib/module/Shared/VisionCameraPlugins/TextRecognition/types.js +0 -3
  185. package/lib/typescript/src/Shared/Libs/camera.utils.d.ts +0 -87
  186. package/lib/typescript/src/Shared/Libs/camera.utils.d.ts.map +0 -1
  187. package/lib/typescript/src/Shared/Libs/frame-enhancement.utils.d.ts +0 -25
  188. package/lib/typescript/src/Shared/Libs/frame-enhancement.utils.d.ts.map +0 -1
  189. package/lib/typescript/src/Shared/Libs/opencv.utils.d.ts +0 -3
  190. package/lib/typescript/src/Shared/Libs/opencv.utils.d.ts.map +0 -1
  191. package/lib/typescript/src/Shared/Libs/worklet.utils.d.ts +0 -3
  192. package/lib/typescript/src/Shared/Libs/worklet.utils.d.ts.map +0 -1
  193. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.d.ts +0 -13
  194. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.d.ts.map +0 -1
  195. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.d.ts +0 -6
  196. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.d.ts.map +0 -1
  197. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/index.d.ts +0 -12
  198. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/index.d.ts.map +0 -1
  199. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.d.ts +0 -3
  200. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.d.ts.map +0 -1
  201. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/types.d.ts +0 -52
  202. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/types.d.ts.map +0 -1
  203. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.d.ts +0 -62
  204. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.d.ts.map +0 -1
  205. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.d.ts +0 -34
  206. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.d.ts.map +0 -1
  207. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.d.ts +0 -32
  208. package/lib/typescript/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.d.ts.map +0 -1
  209. package/lib/typescript/src/Shared/VisionCameraPlugins/Cropper/index.d.ts +0 -23
  210. package/lib/typescript/src/Shared/VisionCameraPlugins/Cropper/index.d.ts.map +0 -1
  211. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/Camera.d.ts +0 -9
  212. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/Camera.d.ts.map +0 -1
  213. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.d.ts +0 -3
  214. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.d.ts.map +0 -1
  215. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/index.d.ts +0 -3
  216. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/index.d.ts.map +0 -1
  217. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/types.d.ts +0 -79
  218. package/lib/typescript/src/Shared/VisionCameraPlugins/FaceDetector/types.d.ts.map +0 -1
  219. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/Camera.d.ts +0 -6
  220. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/Camera.d.ts.map +0 -1
  221. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.d.ts +0 -3
  222. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.d.ts.map +0 -1
  223. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.d.ts +0 -3
  224. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.d.ts.map +0 -1
  225. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/index.d.ts +0 -5
  226. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/index.d.ts.map +0 -1
  227. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/scanText.d.ts +0 -3
  228. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/scanText.d.ts.map +0 -1
  229. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/translateText.d.ts +0 -3
  230. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/translateText.d.ts.map +0 -1
  231. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/types.d.ts +0 -67
  232. package/lib/typescript/src/Shared/VisionCameraPlugins/TextRecognition/types.d.ts.map +0 -1
  233. package/src/Shared/Libs/camera.utils.ts +0 -345
  234. package/src/Shared/Libs/frame-enhancement.utils.ts +0 -217
  235. package/src/Shared/Libs/opencv.utils.ts +0 -40
  236. package/src/Shared/Libs/worklet.utils.ts +0 -58
  237. package/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useBarcodeScanner.ts +0 -79
  238. package/src/Shared/VisionCameraPlugins/BarcodeScanner/hooks/useCameraPermissions.ts +0 -46
  239. package/src/Shared/VisionCameraPlugins/BarcodeScanner/index.ts +0 -60
  240. package/src/Shared/VisionCameraPlugins/BarcodeScanner/scanCodes.ts +0 -32
  241. package/src/Shared/VisionCameraPlugins/BarcodeScanner/types.ts +0 -82
  242. package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/convert.ts +0 -195
  243. package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/geometry.ts +0 -135
  244. package/src/Shared/VisionCameraPlugins/BarcodeScanner/utils/highlights.ts +0 -84
  245. package/src/Shared/VisionCameraPlugins/Cropper/index.ts +0 -78
  246. package/src/Shared/VisionCameraPlugins/FaceDetector/Camera.tsx +0 -63
  247. package/src/Shared/VisionCameraPlugins/FaceDetector/detectFaces.ts +0 -44
  248. package/src/Shared/VisionCameraPlugins/FaceDetector/index.ts +0 -3
  249. package/src/Shared/VisionCameraPlugins/FaceDetector/types.ts +0 -99
  250. package/src/Shared/VisionCameraPlugins/TextRecognition/Camera.tsx +0 -76
  251. package/src/Shared/VisionCameraPlugins/TextRecognition/PhotoRecognizer.ts +0 -18
  252. package/src/Shared/VisionCameraPlugins/TextRecognition/RemoveLanguageModel.ts +0 -7
  253. package/src/Shared/VisionCameraPlugins/TextRecognition/index.ts +0 -7
  254. package/src/Shared/VisionCameraPlugins/TextRecognition/scanText.ts +0 -27
  255. package/src/Shared/VisionCameraPlugins/TextRecognition/translateText.ts +0 -21
  256. package/src/Shared/VisionCameraPlugins/TextRecognition/types.ts +0 -141
@@ -1,217 +0,0 @@
1
- import type { Frame } from 'react-native-vision-camera';
2
- import {
3
- ColorConversionCodes,
4
- DataTypes,
5
- type Mat,
6
- ObjectType,
7
- OpenCV,
8
- } from 'react-native-fast-opencv';
9
- import { ENHANCEMENT_CONFIG } from '../Config/camera-enhancement.config';
10
-
11
- // Cast OpenCV for methods not in type definitions
12
- const OpenCVAny = OpenCV as any;
13
-
14
- /**
15
- * Convert YUV frame to BGR Mat for OpenCV processing
16
- */
17
- const convertYUVToBGR = (frame: Frame): Mat => {
18
- 'worklet';
19
-
20
- const buffer = frame.toArrayBuffer();
21
- const data = new Uint8Array(buffer);
22
- const width = frame.width;
23
- const height = frame.height;
24
-
25
- // Create YUV Mat from frame buffer
26
- const yuvMat = OpenCV.createObject(
27
- ObjectType.Mat,
28
- height + height / 2,
29
- width,
30
- DataTypes.CV_8UC1
31
- );
32
-
33
- // Copy frame data to YUV Mat
34
- OpenCVAny.invoke('matSetData', yuvMat, data);
35
-
36
- // Convert YUV to BGR
37
- const bgrMat = OpenCV.createObject(
38
- ObjectType.Mat,
39
- height,
40
- width,
41
- DataTypes.CV_8UC3
42
- );
43
-
44
- OpenCV.invoke(
45
- 'cvtColor',
46
- yuvMat,
47
- bgrMat,
48
- ColorConversionCodes.COLOR_YUV2BGR_NV21
49
- );
50
-
51
- return bgrMat;
52
- };
53
-
54
- /**
55
- * Apply CLAHE (Contrast Limited Adaptive Histogram Equalization) to enhance frame
56
- * This improves text and face recognition in varying lighting conditions
57
- */
58
- const enhanceFrameForOCR = (
59
- frame: Frame,
60
- options?: {
61
- clipLimit?: number;
62
- tileGridSize?: number;
63
- }
64
- ): Mat => {
65
- 'worklet';
66
-
67
- const clipLimit = options?.clipLimit ?? ENHANCEMENT_CONFIG.contrast.clahe.clipLimit;
68
- const tileGridSize = options?.tileGridSize ?? ENHANCEMENT_CONFIG.contrast.clahe.tileGridSize[0];
69
-
70
- try {
71
- // 1. Convert YUV to BGR
72
- const bgrMat = convertYUVToBGR(frame);
73
-
74
- // 2. Convert BGR to LAB color space (better for luminance enhancement)
75
- const labMat = OpenCV.createObject(
76
- ObjectType.Mat,
77
- frame.height,
78
- frame.width,
79
- DataTypes.CV_8UC3
80
- );
81
-
82
- OpenCV.invoke('cvtColor', bgrMat, labMat, ColorConversionCodes.COLOR_BGR2Lab);
83
-
84
- // 3. Split LAB channels
85
- const channels = OpenCVAny.invoke('split', labMat);
86
- const lChannel = channels[0]; // Luminance channel
87
- const aChannel = channels[1]; // a channel
88
- const bChannel = channels[2]; // b channel
89
-
90
- // 4. Apply CLAHE to L channel
91
- const clahe = OpenCVAny.invoke('createCLAHE', clipLimit, [
92
- tileGridSize,
93
- tileGridSize,
94
- ]);
95
-
96
- const enhancedL = OpenCV.createObject(
97
- ObjectType.Mat,
98
- frame.height,
99
- frame.width,
100
- DataTypes.CV_8UC1
101
- );
102
-
103
- OpenCVAny.invoke('apply', clahe, lChannel, enhancedL);
104
-
105
- // 5. Merge enhanced L channel with original a and b channels
106
- const enhancedLab = OpenCVAny.invoke('merge', [enhancedL, aChannel, bChannel]);
107
-
108
- // 6. Convert back to BGR
109
- const enhancedBGR = OpenCV.createObject(
110
- ObjectType.Mat,
111
- frame.height,
112
- frame.width,
113
- DataTypes.CV_8UC3
114
- );
115
-
116
- OpenCV.invoke(
117
- 'cvtColor',
118
- enhancedLab,
119
- enhancedBGR,
120
- ColorConversionCodes.COLOR_Lab2BGR
121
- );
122
-
123
- // Cleanup intermediate Mats
124
- OpenCVAny.invoke('delete', bgrMat);
125
- OpenCVAny.invoke('delete', labMat);
126
- OpenCVAny.invoke('delete', lChannel);
127
- OpenCVAny.invoke('delete', aChannel);
128
- OpenCVAny.invoke('delete', bChannel);
129
- OpenCVAny.invoke('delete', enhancedL);
130
- OpenCVAny.invoke('delete', enhancedLab);
131
-
132
- return enhancedBGR;
133
- } catch (error) {
134
- console.warn('Error enhancing frame:', error);
135
- // Return original frame converted to BGR if enhancement fails
136
- return convertYUVToBGR(frame);
137
- }
138
- };
139
-
140
- /**
141
- * Apply sharpening to enhance text clarity
142
- * Uses unsharp mask technique
143
- */
144
- const sharpenForText = (mat: Mat, amount: number = 1.5): Mat => {
145
- 'worklet';
146
-
147
- try {
148
- const blurred = OpenCV.createObject(
149
- ObjectType.Mat,
150
- 0,
151
- 0,
152
- DataTypes.CV_8UC3
153
- );
154
-
155
- // Apply Gaussian blur
156
- OpenCVAny.invoke('GaussianBlur', mat, blurred, [0, 0], 3.0);
157
-
158
- // Create sharpened image: original * (1 + amount) - blurred * amount
159
- const sharpened = OpenCV.createObject(
160
- ObjectType.Mat,
161
- 0,
162
- 0,
163
- DataTypes.CV_8UC3
164
- );
165
-
166
- OpenCV.invoke('addWeighted', mat, 1.0 + amount, blurred, -amount, 0, sharpened);
167
-
168
- // Cleanup
169
- OpenCVAny.invoke('delete', blurred);
170
-
171
- return sharpened;
172
- } catch (error) {
173
- console.warn('Error sharpening frame:', error);
174
- return mat;
175
- }
176
- };
177
-
178
- /**
179
- * Determine if frame should be enhanced based on current scanning state
180
- */
181
- const shouldEnhanceFrame = (
182
- nextStep: string,
183
- detectedFaces: number,
184
- mrzRetryCount: number
185
- ): boolean => {
186
- 'worklet';
187
-
188
- const config = ENHANCEMENT_CONFIG.contrast.applyWhen;
189
-
190
- // Always enhance for document back side (MRZ scanning)
191
- if (config.documentBackSide && nextStep === 'SCAN_ID_BACK') {
192
- return true;
193
- }
194
-
195
- // Enhance if faces are failing to detect on front/passport
196
- if (
197
- config.faceFailing &&
198
- nextStep === 'SCAN_ID_FRONT_OR_PASSPORT' &&
199
- detectedFaces === 0
200
- ) {
201
- return true;
202
- }
203
-
204
- // Enhance if MRZ detection is failing
205
- if (config.mrzFailing && mrzRetryCount >= config.retryThreshold) {
206
- return true;
207
- }
208
-
209
- return false;
210
- };
211
-
212
- export {
213
- convertYUVToBGR,
214
- enhanceFrameForOCR,
215
- sharpenForText,
216
- shouldEnhanceFrame,
217
- };
@@ -1,40 +0,0 @@
1
- import {
2
- ColorConversionCodes,
3
- DataTypes,
4
- ObjectType,
5
- OpenCV,
6
- } from 'react-native-fast-opencv';
7
-
8
- const isImageBright = (
9
- width: number,
10
- height: number,
11
- frameBuffer: Uint8Array
12
- ) => {
13
- 'worklet';
14
- try {
15
- const imageMat = OpenCV.frameBufferToMat(height, width, 3, frameBuffer);
16
- const grayMat = OpenCV.createObject(ObjectType.Mat, 0, 0, DataTypes.CV_8U);
17
- OpenCV.invoke(
18
- 'cvtColor',
19
- imageMat,
20
- grayMat,
21
- ColorConversionCodes.COLOR_BGR2GRAY
22
- );
23
- const meanMat = OpenCV.createObject(ObjectType.Mat, 0, 0, DataTypes.CV_64F);
24
- const stdDevMat = OpenCV.createObject(
25
- ObjectType.Mat,
26
- 0,
27
- 0,
28
- DataTypes.CV_64F
29
- );
30
- OpenCV.invoke('meanStdDev', grayMat, meanMat, stdDevMat);
31
- const minMax = OpenCV.invoke('minMaxLoc', meanMat);
32
- return minMax.maxVal >= 90;
33
- } catch (e) {
34
- // console.log('error', e);
35
- }
36
-
37
- return false;
38
- };
39
-
40
- export { isImageBright };
@@ -1,58 +0,0 @@
1
- import type { Frame, FrameInternal } from 'react-native-vision-camera';
2
- import { Worklets } from 'react-native-worklets-core';
3
-
4
- let isAsyncContextBusy: { value: boolean };
5
- let runOnAsyncContext: (frame: Frame, func: () => void) => void;
6
-
7
- try {
8
- isAsyncContextBusy = Worklets.createSharedValue(false);
9
-
10
- const asyncContext = Worklets.defaultContext;
11
- runOnAsyncContext = asyncContext.createRunAsync(
12
- (frame: Frame, func: () => void) => {
13
- 'worklet';
14
- try {
15
- // Call long-running function
16
- func();
17
- } catch (e) {
18
- // Re-throw error on JS Thread
19
- throw e;
20
- } finally {
21
- // Potentially delete Frame if we were the last ref
22
- const internal = frame as FrameInternal;
23
- internal.decrementRefCount();
24
-
25
- // free up async context again, new calls can be made
26
- isAsyncContextBusy.value = false;
27
- }
28
- }
29
- );
30
- } catch (e) {
31
- // react-native-worklets-core is not installed!
32
- // Just use dummy implementations that will throw when the user tries to use Frame Processors.
33
- isAsyncContextBusy = { value: false };
34
- runOnAsyncContext = () => {
35
- throw new Error(
36
- 'react-native-worklets-core is not installed! Please install it to use Frame Processors.'
37
- );
38
- };
39
- }
40
-
41
- export function runAsync(frame: Frame, func: () => void): void {
42
- 'worklet';
43
-
44
- if (isAsyncContextBusy.value) {
45
- // async context is currently busy, we cannot schedule new work in time.
46
- // drop this frame/runAsync call.
47
- return;
48
- }
49
-
50
- // Increment ref count by one
51
- const internal = frame as FrameInternal;
52
- internal.incrementRefCount();
53
-
54
- isAsyncContextBusy.value = true;
55
-
56
- // Call in separate background context
57
- runOnAsyncContext(frame, func);
58
- }
@@ -1,79 +0,0 @@
1
- import { useCallback, useState } from 'react';
2
- import type { Frame } from 'react-native-vision-camera';
3
- import { createBarcodeScannerPlugin } from '../scanCodes';
4
- import type { Barcode, ScanBarcodesOptions } from '../types';
5
-
6
- export interface UseBarcodeScannerOptions extends ScanBarcodesOptions {
7
- onBarcodeScanned?: (barcodes: Barcode[]) => void;
8
- onError?: (error: Error) => void;
9
- }
10
-
11
- export interface UseBarcodeScannerResult {
12
- scanBarcodes: (frame: Frame) => Barcode[];
13
- barcodes: Barcode[];
14
- isScanning: boolean;
15
- }
16
-
17
- let barcodeScannerPlugin: ReturnType<typeof createBarcodeScannerPlugin> | null =
18
- null;
19
-
20
- export const useBarcodeScanner = (
21
- options: UseBarcodeScannerOptions = {}
22
- ): UseBarcodeScannerResult => {
23
- const [barcodes, setBarcodes] = useState<Barcode[]>([]);
24
- const [isScanning, setIsScanning] = useState(false);
25
-
26
- const scanBarcodes = useCallback(
27
- (frame: Frame): Barcode[] => {
28
- 'worklet';
29
-
30
- if (!barcodeScannerPlugin) {
31
- try {
32
- barcodeScannerPlugin = createBarcodeScannerPlugin();
33
- } catch (error) {
34
- console.warn(
35
- 'useBarcodeScanner: Failed to initialize plugin:',
36
- error
37
- );
38
- options.onError?.(error as Error);
39
- return [];
40
- }
41
- }
42
-
43
- setIsScanning(true);
44
-
45
- try {
46
- const scanOptions: ScanBarcodesOptions = {
47
- barcodeTypes: options.barcodeTypes,
48
- regionOfInterest: options.regionOfInterest,
49
- };
50
-
51
- const detectedBarcodes = barcodeScannerPlugin.scanCodes(
52
- frame,
53
- scanOptions
54
- );
55
-
56
- setBarcodes(detectedBarcodes);
57
-
58
- if (detectedBarcodes.length > 0) {
59
- options.onBarcodeScanned?.(detectedBarcodes);
60
- }
61
-
62
- return detectedBarcodes;
63
- } catch (error) {
64
- console.warn('useBarcodeScanner: Scan failed:', error);
65
- options.onError?.(error as Error);
66
- return [];
67
- } finally {
68
- setIsScanning(false);
69
- }
70
- },
71
- [options]
72
- );
73
-
74
- return {
75
- scanBarcodes,
76
- barcodes,
77
- isScanning,
78
- };
79
- };
@@ -1,46 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { Alert, Linking } from 'react-native';
3
- import { useCameraPermission } from 'react-native-vision-camera';
4
-
5
- export interface UseCameraPermissionResult {
6
- hasPermission: boolean;
7
- requestPermission: () => Promise<boolean>;
8
- }
9
-
10
- export const useCameraPermissions = (): UseCameraPermissionResult => {
11
- const {
12
- hasPermission: cameraPermission,
13
- requestPermission: requestCameraPermission,
14
- } = useCameraPermission();
15
-
16
- const [hasPermission, setHasPermission] = useState(cameraPermission);
17
-
18
- useEffect(() => {
19
- setHasPermission(cameraPermission);
20
- }, [cameraPermission]);
21
-
22
- const requestPermission = async (): Promise<boolean> => {
23
- const permission = await requestCameraPermission();
24
-
25
- if (!permission) {
26
- // Camera permission denied by user - their choice, not actionable
27
- Alert.alert(
28
- 'Camera Permission Required',
29
- 'This app needs camera access to scan barcodes. Please enable camera permissions in your device settings.',
30
- [
31
- { text: 'Cancel', style: 'cancel' },
32
- { text: 'Open Settings', onPress: () => Linking.openSettings() },
33
- ]
34
- );
35
- return false;
36
- }
37
-
38
- setHasPermission(permission);
39
- return permission;
40
- };
41
-
42
- return {
43
- hasPermission,
44
- requestPermission,
45
- };
46
- };
@@ -1,60 +0,0 @@
1
- // Main plugin function
2
- export { createBarcodeScannerPlugin } from './scanCodes';
3
-
4
- // Create default plugin instance and export scanCodes function
5
- import { createBarcodeScannerPlugin } from './scanCodes';
6
- const defaultPlugin = createBarcodeScannerPlugin();
7
- export const scanCodes = defaultPlugin.scanCodes;
8
-
9
- // Types
10
- export type {
11
- BarcodeType,
12
- Barcode,
13
- ScanBarcodesOptions,
14
- Point,
15
- Size,
16
- Rect,
17
- BoundingBox,
18
- CornerPoints,
19
- Highlight,
20
- FrameProcessorPlugin,
21
- BarcodeScannerPlugin,
22
- BarcodeScannerOptions,
23
- } from './types';
24
-
25
- // Hooks
26
- export { useBarcodeScanner } from './hooks/useBarcodeScanner';
27
- export { useCameraPermissions } from './hooks/useCameraPermissions';
28
- export type {
29
- UseBarcodeScannerOptions,
30
- UseBarcodeScannerResult,
31
- } from './hooks/useBarcodeScanner';
32
- export type { UseCameraPermissionResult } from './hooks/useCameraPermissions';
33
-
34
- // Utilities
35
- export {
36
- convertFrameToScreen,
37
- convertScreenToFrame,
38
- convertBarcodeToScreen,
39
- getRectCenter,
40
- getCornerPointsCenter,
41
- getBoundsFromCornerPoints,
42
- } from './utils/geometry';
43
- export type { FrameDimensions, ScreenDimensions } from './utils/geometry';
44
-
45
- export {
46
- boundingBoxToHighlight,
47
- barcodesToHighlights,
48
- getHighlightStyle,
49
- cornerPointsToPath,
50
- cornerPointsToPolygonPoints,
51
- } from './utils/highlights';
52
-
53
- export {
54
- barcodeTypeToAndroidFormat,
55
- barcodeTypeToIOSSymbology,
56
- androidFormatToBarcodeType,
57
- iosSymbologyToBarcodeType,
58
- AndroidBarcodeFormat,
59
- IOSBarcodeSymbology,
60
- } from './utils/convert';
@@ -1,32 +0,0 @@
1
- import { VisionCameraProxy, type Frame } from 'react-native-vision-camera';
2
- import type {
3
- ScanBarcodesOptions,
4
- Barcode,
5
- BarcodeScannerPlugin,
6
- } from './types';
7
-
8
- const LINKING_ERROR = `Can't load plugin scanCodes. Try cleaning cache or reinstall plugin.`;
9
-
10
- export function createBarcodeScannerPlugin(): BarcodeScannerPlugin {
11
- const plugin = VisionCameraProxy.initFrameProcessorPlugin('scanCodes', {});
12
-
13
- if (!plugin) {
14
- throw new Error(LINKING_ERROR);
15
- }
16
-
17
- return {
18
- scanCodes: (frame: Frame, options?: ScanBarcodesOptions): Barcode[] => {
19
- 'worklet';
20
- try {
21
- // @ts-ignore
22
- const result = plugin.call(frame, options) as Barcode[];
23
-
24
- // iOS now handles coordinate conversion, so return results directly
25
- return result || [];
26
- } catch (error) {
27
- console.warn('scanCodes: Plugin call failed:', error);
28
- return [];
29
- }
30
- },
31
- };
32
- }
@@ -1,82 +0,0 @@
1
- import type { Frame } from 'react-native-vision-camera';
2
-
3
- export type Point = {
4
- x: number;
5
- y: number;
6
- };
7
-
8
- export type Size = {
9
- width: number;
10
- height: number;
11
- };
12
-
13
- export type Rect = Point & Size;
14
-
15
- export type Key = string | number | bigint;
16
-
17
- export type BoundingBox = {
18
- origin: Point;
19
- size: Size;
20
- };
21
-
22
- export type CornerPoints = Point[];
23
- export type Highlight = BoundingBox & { key: Key };
24
-
25
- export type BarcodeType =
26
- | 'aztec'
27
- | 'codabar'
28
- | 'code-128'
29
- | 'code-39'
30
- | 'code-93'
31
- | 'data-matrix'
32
- | 'ean-13'
33
- | 'ean-8'
34
- | 'gs1-databar'
35
- | 'itf'
36
- | 'msi-plessey'
37
- | 'pdf-417'
38
- | 'qr'
39
- | 'upc-a'
40
- | 'upc-e'
41
- | 'unknown';
42
-
43
- export type Barcode = {
44
- value: string | null;
45
- type: BarcodeType;
46
- boundingBox: BoundingBox;
47
- cornerPoints: Point[];
48
- native?: any;
49
- };
50
-
51
- export type ScanBarcodesOptions = {
52
- barcodeTypes?: BarcodeType[];
53
- regionOfInterest?: [number, number, number, number];
54
- };
55
-
56
- export type BasicParameterType = string | number | boolean | undefined;
57
- export type ParameterType =
58
- | BasicParameterType
59
- | BasicParameterType[]
60
- | Record<string, BasicParameterType | undefined>;
61
-
62
- export interface FrameProcessorPlugin {
63
- call: (
64
- frame: Frame,
65
- options?: Record<string, ParameterType>
66
- ) => ParameterType;
67
- }
68
-
69
- export interface BarcodeScannerPlugin {
70
- scanCodes: (frame: Frame, options?: ScanBarcodesOptions) => Barcode[];
71
- }
72
-
73
- export type BarcodeScannerOptions = {
74
- barcodeTypes?: BarcodeType[];
75
- regionOfInterest?: Rect;
76
- fps?: number;
77
- onBarcodeScanned: (barcodes: Barcode[], frame: Frame) => void;
78
- disableHighlighting?: boolean;
79
- resizeMode?: 'cover' | 'contain';
80
- scanMode?: 'continuous' | 'once';
81
- isMountedRef?: { value: boolean };
82
- };