react-native-zyprotectabio-module 0.1.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 (50) hide show
  1. package/.gitattributes +2 -0
  2. package/CODE_OF_CONDUCT.md +133 -0
  3. package/CONTRIBUTING.md +122 -0
  4. package/LICENSE +20 -0
  5. package/README.md +178 -0
  6. package/android/.gradle/8.8/checksums/checksums.lock +0 -0
  7. package/android/.gradle/8.8/dependencies-accessors/gc.properties +0 -0
  8. package/android/.gradle/8.8/fileChanges/last-build.bin +0 -0
  9. package/android/.gradle/8.8/fileHashes/fileHashes.lock +0 -0
  10. package/android/.gradle/8.8/gc.properties +0 -0
  11. package/android/.gradle/9.0-milestone-1/checksums/checksums.lock +0 -0
  12. package/android/.gradle/9.0-milestone-1/fileChanges/last-build.bin +0 -0
  13. package/android/.gradle/9.0-milestone-1/fileHashes/fileHashes.lock +0 -0
  14. package/android/.gradle/9.0-milestone-1/gc.properties +0 -0
  15. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  16. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  17. package/android/.gradle/config.properties +2 -0
  18. package/android/.gradle/vcs-1/gc.properties +0 -0
  19. package/android/.idea/AndroidProjectSystem.xml +6 -0
  20. package/android/.idea/android.iml +9 -0
  21. package/android/.idea/caches/deviceStreaming.xml +1186 -0
  22. package/android/.idea/gradle.xml +13 -0
  23. package/android/.idea/migrations.xml +10 -0
  24. package/android/.idea/misc.xml +9 -0
  25. package/android/.idea/modules.xml +8 -0
  26. package/android/.idea/runConfigurations.xml +17 -0
  27. package/android/.idea/vcs.xml +6 -0
  28. package/android/build.gradle +82 -0
  29. package/android/gradle.properties +5 -0
  30. package/android/local.properties +8 -0
  31. package/android/src/main/AndroidManifest.xml +7 -0
  32. package/android/src/main/AndroidManifestNew.xml +2 -0
  33. package/android/src/main/java/com/zyprotectabiomodule/ZyBioProtectaReactNativeModuleModule.kt +163 -0
  34. package/android/src/main/java/com/zyprotectabiomodule/ZyBioProtectaReactNativeModulePackage.kt +26 -0
  35. package/android/src/main/java/com/zyprotectabiomodule/bean/ErroresPantallaRN.kt +32 -0
  36. package/android/src/main/java/com/zyprotectabiomodule/bean/Opcional.kt +17 -0
  37. package/android/src/main/java/com/zyprotectabiomodule/bean/ScreenText.kt +27 -0
  38. package/android/src/main/java/com/zyprotectabiomodule/bean/StepperRN.kt +24 -0
  39. package/babel.config.js +5 -0
  40. package/ios/ZyBanbifBioRn.h +12 -0
  41. package/ios/ZyBanbifBioRn.m +90 -0
  42. package/lefthook.yml +14 -0
  43. package/package.json +32 -0
  44. package/react-native-zyprotectabio-module.podspec +23 -0
  45. package/scripts/postinstall.js +50 -0
  46. package/src/__tests__/index.test.tsx +1 -0
  47. package/src/index.tsx +22 -0
  48. package/tsconfig.build.json +4 -0
  49. package/tsconfig.json +29 -0
  50. package/turbo.json +36 -0
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="GradleMigrationSettings" migrationVersion="1" />
4
+ <component name="GradleSettings">
5
+ <option name="linkedExternalProjectsSettings">
6
+ <GradleProjectSettings>
7
+ <option name="testRunner" value="CHOOSE_PER_TEST" />
8
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
9
+ <option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
10
+ </GradleProjectSettings>
11
+ </option>
12
+ </component>
13
+ </project>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectMigrations">
4
+ <option name="MigrateToGradleLocalJavaHome">
5
+ <set>
6
+ <option value="$PROJECT_DIR$" />
7
+ </set>
8
+ </option>
9
+ </component>
10
+ </project>
@@ -0,0 +1,9 @@
1
+ <project version="4">
2
+ <component name="ExternalStorageConfigurationManager" enabled="true" />
3
+ <component name="ProjectRootManager">
4
+ <output url="file://$PROJECT_DIR$/build/classes" />
5
+ </component>
6
+ <component name="ProjectType">
7
+ <option name="id" value="Android" />
8
+ </component>
9
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/android.iml" filepath="$PROJECT_DIR$/.idea/android.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="RunConfigurationProducerService">
4
+ <option name="ignoredProducers">
5
+ <set>
6
+ <option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
7
+ <option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
8
+ <option value="com.intellij.execution.junit.PatternConfigurationProducer" />
9
+ <option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
10
+ <option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
11
+ <option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
12
+ <option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
13
+ <option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
14
+ </set>
15
+ </option>
16
+ </component>
17
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,82 @@
1
+ buildscript {
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ }
6
+
7
+ dependencies {
8
+ classpath "com.android.tools.build:gradle:8.1.1"
9
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22"
10
+ }
11
+ }
12
+
13
+ apply plugin: 'com.android.library'
14
+ apply plugin: 'kotlin-android'
15
+
16
+ android {
17
+ // Conditional for compatibility with AGP <4.2.
18
+
19
+ compileSdk 34
20
+
21
+ defaultConfig {
22
+ minSdkVersion 24
23
+ targetSdk 34
24
+ versionCode 1
25
+ versionName "1.0"
26
+ }
27
+
28
+ lint {
29
+ //disable 'MissingTranslation', 'TypographyFractions'
30
+ abortOnError false
31
+ checkReleaseBuilds false
32
+ }
33
+ packagingOptions {
34
+ exclude 'META-INF/DEPENDENCIES'
35
+ exclude 'META-INF/NOTICE'
36
+ exclude 'META-INF/LICENSE'
37
+
38
+ }
39
+
40
+ }
41
+
42
+ rootProject.allprojects {
43
+ repositories {
44
+ google()
45
+ mavenCentral()
46
+ maven {
47
+ url = uri("https://maven.regulaforensics.com/RegulaDocumentReader")
48
+ }
49
+ maven {
50
+ url = uri("https://repo.zytrust.com/artifactory/zy-mobile-maven")
51
+ }
52
+ maven {
53
+ url = "https://identy.jfrog.io/identy/identy-face-release"
54
+ credentials {
55
+ username = 'zytrust'
56
+ password = 'yK54WHqgel8PztBHwXZn7'
57
+ }
58
+ }
59
+ }
60
+ }
61
+
62
+ dependencies {
63
+ //INICIO_ZY_ZYTRUST
64
+ implementation("com.facebook.react:react-android")
65
+
66
+ implementation 'androidx.appcompat:appcompat:1.4.0'
67
+ implementation 'com.google.android.material:material:1.5.0'
68
+
69
+ /************************gson***********************************/
70
+ implementation(group: 'com.zy.multiempresa.android.lib.protecta', name: 'sdk', version: '1.0.18', ext: 'aar'){
71
+ transitive = true
72
+ }
73
+
74
+ implementation(group: 'com.zy.identy.face', name: 'sdk', version: '6.5.14', ext: 'aar'){
75
+ transitive = true
76
+ }
77
+ debugImplementation(group: 'com.identy.face', name: 'face', version: '6.3.0-develop', ext: 'aar')
78
+ releaseImplementation(group: 'com.identy.face', name: 'face', version: '6.3.0', ext: 'aar')
79
+
80
+ //FIN_ZY_ZYTRUST
81
+
82
+ }
@@ -0,0 +1,5 @@
1
+ ZyprotectabioModule_kotlinVersion=1.7.0
2
+ ZyprotectabioModule_minSdkVersion=21
3
+ ZyprotectabioModule_targetSdkVersion=31
4
+ ZyprotectabioModule_compileSdkVersion=31
5
+ ZyprotectabioModule_ndkversion=21.4.7075529
@@ -0,0 +1,8 @@
1
+ ## This file must *NOT* be checked into Version Control Systems,
2
+ # as it contains information specific to your local configuration.
3
+ #
4
+ # Location of the SDK. This is only used by Gradle.
5
+ # For customization when using a Version Control System, please read the
6
+ # header note.
7
+ #Thu Dec 04 11:39:59 PET 2025
8
+ sdk.dir=/Users/jsaenz/Library/Android/sdk
@@ -0,0 +1,7 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ xmlns:tools="http://schemas.android.com/tools"
3
+ package="com.zyprotectabiomodule">
4
+
5
+
6
+
7
+ </manifest>
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,163 @@
1
+ package com.zyprotectabiomodule
2
+
3
+ import android.util.Log
4
+ import com.facebook.react.bridge.Promise
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.bridge.ReactContextBaseJavaModule
7
+ import com.facebook.react.bridge.ReactMethod
8
+ import com.facebook.react.bridge.ReadableMap
9
+ import com.facebook.react.bridge.WritableMap
10
+ import com.facebook.react.bridge.WritableNativeMap
11
+ import com.google.gson.Gson
12
+ import com.zy.multicompany.android.lib.sdk.validacionfacial.api.IZyApiCapturaFacial
13
+ import com.zy.multicompany.android.lib.sdk.validacionfacial.api.ZyApiCapturaFacial
14
+ import com.zy.multicompany.android.lib.sdk.validacionfacial.api.ZyRequest
15
+ import com.zy.multicompany.android.lib.sdk.validacionfacial.api.ZyResponse
16
+ import com.zy.multicompany.android.lib.sdk.validacionfacial.api.bean.visual.ScreenEnum
17
+ import com.zy.multicompany.android.lib.sdk.validacionfacial.api.bean.visual.Stepper
18
+ import com.zy.multicompany.android.lib.sdk.validacionfacial.api.bean.visual.VisualScreenError
19
+
20
+
21
+ class ZyBioProtectaReactNativeModuleModule(reactContext: ReactApplicationContext) :
22
+ ReactContextBaseJavaModule(reactContext) {
23
+ /**
24
+ * @return the name of this module. This will be the name used to `require()` this module
25
+ * from javascript.
26
+ */
27
+ override fun getName(): String {
28
+ return "ZyProtectaBioRn"
29
+ }
30
+
31
+ @ReactMethod
32
+ fun validacionFacialOcr(opcional: ReadableMap,
33
+ promise: Promise) {
34
+ val gson = Gson()
35
+ val opcionalJson = gson.toJson(opcional.toHashMap())
36
+ val opcionalData = gson.fromJson(opcionalJson, com.zyprotectabiomodule.bean.Opcional::class.java)
37
+ val zyRequestApi: ZyRequest = ZyRequest()
38
+
39
+ zyRequestApi.bioTiDoc = opcionalData.tiDocumento
40
+ zyRequestApi.bioNuDoc = opcionalData.nuDocumento
41
+ zyRequestApi.token = opcionalData.accessToken
42
+ zyRequestApi.bioPais = opcionalData.bioPais
43
+ zyRequestApi.bioOperacion = opcionalData.tiOperacion
44
+ zyRequestApi.url = opcionalData.urlSource
45
+ zyRequestApi.flujoExterno = opcionalData.flujoExterno
46
+
47
+ zyRequestApi.stepper = Stepper(opcionalData.stepper.nuPasos,opcionalData.stepper.pasoActual)
48
+
49
+ val vsList: MutableList<VisualScreenError> = ArrayList()
50
+ vsList.add(
51
+ VisualScreenError(
52
+ opcionalData.errores.reintentar.titulo,
53
+ opcionalData.errores.reintentar.descripcion,
54
+ opcionalData.errores.reintentar.textoBoton,
55
+ ScreenEnum.REINTENTAR
56
+ )
57
+ )
58
+ vsList.add(
59
+ VisualScreenError(
60
+ opcionalData.errores.limite_tiempo_alcanzado.titulo,
61
+ opcionalData.errores.limite_tiempo_alcanzado.descripcion,
62
+ opcionalData.errores.limite_tiempo_alcanzado.textoBoton,
63
+ ScreenEnum.LIMITE_TIEMPO_ALZANZADO
64
+ )
65
+ )
66
+ vsList.add(
67
+ VisualScreenError(
68
+ opcionalData.errores.limite_intentos_alcanzado.titulo,
69
+ opcionalData.errores.limite_intentos_alcanzado.descripcion,
70
+ opcionalData.errores.limite_intentos_alcanzado.textoBoton,
71
+ ScreenEnum.LIMITE_INTENTOS_ALCANZADO
72
+ )
73
+ )
74
+
75
+ zyRequestApi.errores = vsList
76
+
77
+ Log.i(TAG, "calling validacionFacialOcr")
78
+ Log.i(TAG, "nuDocumento:" + zyRequestApi.bioTiDoc)
79
+ Log.i(TAG, "tiDocumento:" + zyRequestApi.bioNuDoc)
80
+ verifyProtecta(zyRequestApi, promise)
81
+ }
82
+
83
+ protected fun verifyProtecta(zyRequestApi: ZyRequest?, promise: Promise) {
84
+
85
+ val iZyApiCapturaFacial: IZyApiCapturaFacial =
86
+ ZyApiCapturaFacial(getCurrentActivity(), object : IZyApiCapturaFacial.ICallback {
87
+ override fun onStart() {
88
+ Log.i(TAG, "onStart")
89
+ //openDialog("Porfavor espere...");
90
+ }
91
+
92
+ override fun onComplete() {
93
+ Log.i(TAG, "onComplete")
94
+ //closeDialog();
95
+ }
96
+
97
+ override fun onSuccess(zyResponse: ZyResponse) {
98
+ Log.i(TAG, "onSuccess")
99
+ Log.i(TAG, "=====>>> zyResponse: $zyResponse")
100
+ val result: WritableMap = WritableNativeMap().apply {
101
+ putString("coError", if (zyResponse.coError.isNotEmpty()) zyResponse.coError else "")
102
+ putString("deError", if (zyResponse.deError.isNotEmpty()) zyResponse.deError else "")
103
+ putString("coErrorButton", if (zyResponse.coErrorButton.isNotEmpty()) zyResponse.coErrorButton else "")
104
+ putString("deErrorButton", if (zyResponse.deErrorButton.isNotEmpty()) zyResponse.deErrorButton else "")
105
+ putString("idSolicitud", if (zyResponse.bmoNuSolicitud.isNotEmpty()) zyResponse.bmoNuSolicitud else "")
106
+ }
107
+
108
+ //successCallBack.invoke(result)
109
+ promise.resolve(result)
110
+
111
+ }
112
+
113
+ override fun onError(zyError: ZyResponse) {
114
+ Log.i(TAG, "OnError")
115
+ Log.i(TAG, "=====>>> zyError: $zyError")
116
+
117
+ val result: WritableMap = WritableNativeMap().apply {
118
+ putString("coError", if (zyError.coError.isNotEmpty()) zyError.coError else "")
119
+ putString("deError", if (zyError.deError.isNotEmpty()) zyError.deError else "")
120
+ putString("coErrorButton", zyError.coErrorButton?.takeIf { it.isNotEmpty() } ?: "")
121
+ putString("deErrorButton", zyError.deErrorButton?.takeIf { it.isNotEmpty() } ?: "")
122
+ putString("idSolicitud", if (zyError.bmoNuSolicitud.isNotEmpty()) zyError.bmoNuSolicitud else "")
123
+
124
+ }
125
+ //errorCallBack.invoke(result)
126
+ promise.resolve(result)
127
+
128
+ //promise.reject("ERROR_CODE", result)
129
+
130
+ }
131
+
132
+ override fun onRetries(zyError: ZyResponse) {
133
+ Log.i(TAG, "onRetries")
134
+ Log.i(TAG,"coError: " + zyError.coError + " , " + "deError: " + zyError.deError + " , " + "bmoNuSolicitud " + zyError.bmoNuSolicitud
135
+ )
136
+ }
137
+ })
138
+
139
+ val zyRequest = ZyRequest()
140
+ zyRequest.bioTiDoc = zyRequestApi?.bioTiDoc?.takeIf { it.isNotBlank() } ?: ""
141
+ zyRequest.bioNuDoc = zyRequestApi?.bioNuDoc ?: ""
142
+ zyRequest.bmoNuOperacionEmps = "BANBIF-ANDROID"
143
+
144
+ zyRequest.token = zyRequestApi?.token ?: ""
145
+ zyRequest.bioPais = zyRequestApi?.bioPais ?: "PE"
146
+ zyRequest.bioOperacion = zyRequestApi?.bioOperacion ?: "FLUJO_FACIAL_MANUAL"
147
+ zyRequest.isDialogActivated = true
148
+ zyRequest.url = zyRequestApi?.url ?: "DEV2"
149
+ zyRequest.flujoExterno = zyRequest.flujoExterno ?: ""
150
+ zyRequest.stepper = zyRequestApi?.stepper
151
+ zyRequest.errores = zyRequestApi?.errores
152
+
153
+ Log.v("JSAENZ-bioOperacion", zyRequest.bioOperacion.toString())
154
+ Log.v("JSAENZ", Gson().toJson(zyRequest))
155
+
156
+ iZyApiCapturaFacial.zyCapturaFacial(zyRequest)
157
+
158
+ }
159
+
160
+ companion object {
161
+ private const val TAG = "ZyTFacialModule"
162
+ }
163
+ }
@@ -0,0 +1,26 @@
1
+ package com.zyprotectabiomodule
2
+
3
+
4
+ import com.facebook.react.ReactPackage
5
+ import com.facebook.react.bridge.NativeModule
6
+ import com.facebook.react.bridge.ReactApplicationContext
7
+ import com.facebook.react.uimanager.ViewManager
8
+
9
+
10
+ class ZyBioProtectaReactNativeModulePackage : ReactPackage {
11
+ /**
12
+ * @param reactContext react application context that can be used to create modules
13
+ * @return list of native modules to register with the newly created catalyst instance
14
+ */
15
+ override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
16
+ return listOf(ZyBioProtectaReactNativeModuleModule(reactContext))
17
+ }
18
+
19
+ /**
20
+ * @param reactContext
21
+ * @return a list of view managers that should be registered with [UIManagerModule]
22
+ */
23
+ override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
24
+ return emptyList()
25
+ }
26
+ }
@@ -0,0 +1,32 @@
1
+ package com.zyprotectabiomodule.bean
2
+
3
+ import com.facebook.react.bridge.Arguments
4
+ import com.facebook.react.bridge.WritableMap
5
+
6
+ class ErroresPantallaRN {
7
+ lateinit var reintentar: ScreenText
8
+ lateinit var limite_tiempo_alcanzado: ScreenText
9
+ lateinit var limite_intentos_alcanzado : ScreenText
10
+
11
+ constructor(
12
+ reintentar: ScreenText,
13
+ limite_tiempo_alcanzado: ScreenText,
14
+ limite_intentos_alcanzado: ScreenText
15
+ ) {
16
+ this.reintentar = reintentar
17
+ this.limite_tiempo_alcanzado = limite_tiempo_alcanzado
18
+ this.limite_intentos_alcanzado = limite_intentos_alcanzado
19
+ }
20
+
21
+ // Método para convertir a WritableMap
22
+ fun toWritableMap(): WritableMap {
23
+ val map = Arguments.createMap()
24
+ map.putMap("reintentar", reintentar.toWritableMap())
25
+ map.putMap("limite_tiempo_alcanzado", limite_tiempo_alcanzado.toWritableMap())
26
+ map.putMap("limite_intentos_alcanzado", limite_intentos_alcanzado.toWritableMap())
27
+ return map
28
+ }
29
+
30
+ }
31
+
32
+
@@ -0,0 +1,17 @@
1
+ package com.zyprotectabiomodule.bean
2
+
3
+ import androidx.annotation.Keep
4
+
5
+ @Keep
6
+ internal class Opcional {
7
+ var tiDocumento: String = ""
8
+ var nuDocumento: String = ""
9
+ var accessToken: String = ""
10
+ var bioPais: String = ""
11
+ var tiOperacion: String = ""
12
+ var urlSource: String = ""
13
+ var flujoExterno: String = ""
14
+ lateinit var stepper: StepperRN
15
+ lateinit var errores: ErroresPantallaRN
16
+ }
17
+
@@ -0,0 +1,27 @@
1
+ package com.zyprotectabiomodule.bean
2
+
3
+ import com.facebook.react.bridge.Arguments
4
+ import com.facebook.react.bridge.WritableMap
5
+
6
+ class ScreenText {
7
+ var titulo: String = ""
8
+ var descripcion: String = ""
9
+ var textoBoton: String = ""
10
+
11
+
12
+ constructor(textoBoton: String, descripcion: String, titulo: String) {
13
+ this.textoBoton = textoBoton
14
+ this.descripcion = descripcion
15
+ this.titulo = titulo
16
+ }
17
+
18
+ // Método para convertir a WritableMap
19
+ fun toWritableMap(): WritableMap {
20
+ val map = Arguments.createMap()
21
+ map.putString("titulo", titulo)
22
+ map.putString("descripcion", descripcion)
23
+ map.putString("textoBoton", textoBoton)
24
+ return map
25
+ }
26
+
27
+ }
@@ -0,0 +1,24 @@
1
+ package com.zyprotectabiomodule.bean
2
+
3
+ import androidx.annotation.Keep
4
+ import com.facebook.react.bridge.Arguments
5
+ import com.facebook.react.bridge.WritableMap
6
+
7
+ @Keep
8
+ class StepperRN {
9
+ var nuPasos: Int = 4
10
+ var pasoActual: Int = 2
11
+
12
+ constructor(var1: Int, var2: Int) {
13
+ this.nuPasos = var1
14
+ this.pasoActual = var2
15
+ }
16
+
17
+ // Método para convertir a WritableMap
18
+ fun toWritableMap(): WritableMap {
19
+ val map = Arguments.createMap()
20
+ map.putInt("nuPasos", nuPasos)
21
+ map.putInt("pasoActual", pasoActual)
22
+ return map
23
+ }
24
+ }
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ presets: [
3
+ ['module:react-native-builder-bob/babel-preset', { modules: 'commonjs' }],
4
+ ],
5
+ };
@@ -0,0 +1,12 @@
1
+ //
2
+ // ZyProtectaBioRn.h
3
+ // Protecta
4
+ //
5
+ // Created by Developer on 9/08/24.
6
+ //
7
+
8
+ #import "React/RCTBridgeModule.h"
9
+
10
+ // Instead of LoadingOverlay put the name of your module
11
+ @interface ZyProtectaBioRn : NSObject <RCTBridgeModule>
12
+ @end
@@ -0,0 +1,90 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import <React/RCTBridgeModule.h>
3
+ #import <zy_protecta_bio_lib_ios/zy_protecta_bio_lib_ios-Swift.h>
4
+
5
+ #import "ZyProtectaBioRn.h" // Here put the name of your module
6
+
7
+ @implementation ZyProtectaBioRn
8
+
9
+ RCT_EXPORT_MODULE();
10
+
11
+
12
+ RCT_EXPORT_METHOD(validacionFacialOcr:(NSDictionary *)opcional
13
+ resolver:(RCTPromiseResolveBlock)resolve
14
+ rejecter:(RCTPromiseRejectBlock)reject)
15
+ {
16
+
17
+ dispatch_async(dispatch_get_main_queue(), ^{
18
+ @try{
19
+ UIViewController *ctrl = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
20
+
21
+ ReactRequest *request = [ReactRequest new];
22
+ request.token = opcional[@"accessToken"] ;
23
+ request.bioTiDoc = opcional[@"tiDocumento"];
24
+ request.bioNuDoc = opcional[@"nuDocumento"];
25
+ request.bioPais = opcional[@"bioPais"];
26
+ request.bioOperacion = opcional[@"tiOperacion"];
27
+ request.url = opcional[@"urlSource"];
28
+ request.flujoExterno = opcional[@"flujoExterno"];
29
+
30
+
31
+ NSDictionary *stepperDict = opcional[@"stepper"];
32
+ if (stepperDict && [stepperDict isKindOfClass:[NSDictionary class]]) {
33
+ Stepper *st = [Stepper new];
34
+ st.nuPasos = [stepperDict[@"nuPasos"] intValue];
35
+ st.pasoActual = [stepperDict[@"pasoActual"] intValue];
36
+ request.stepper = st;
37
+ }
38
+
39
+ NSDictionary *erroresDict = opcional[@"errores"];
40
+ NSDictionary *reintentarDict = erroresDict[@"reintentar"];
41
+ NSDictionary *limite_tiempo_alcanzadoDict = erroresDict[@"limite_tiempo_alcanzado"];
42
+ NSDictionary *limite_intentos_alcanzadoDict = erroresDict[@"limite_intentos_alcanzado"];
43
+
44
+ VisualScreenError *error1 = [[VisualScreenError alloc] initWithTitulo:reintentarDict[@"titulo"]
45
+ descripcion:reintentarDict[@"descripcion"]
46
+ textBoton:reintentarDict[@"textoBoton"]
47
+ screenEnum:ScreenEnumREINTENTAR];
48
+
49
+ VisualScreenError *error2 = [[VisualScreenError alloc] initWithTitulo:limite_tiempo_alcanzadoDict[@"titulo"]
50
+ descripcion:limite_tiempo_alcanzadoDict[@"descripcion"]
51
+ textBoton:limite_tiempo_alcanzadoDict[@"textoBoton"]
52
+ screenEnum:ScreenEnumLIMITE_TIEMPO_ALZANZADO];
53
+
54
+ VisualScreenError *error3 = [[VisualScreenError alloc] initWithTitulo:limite_intentos_alcanzadoDict[@"titulo"]
55
+ descripcion:limite_intentos_alcanzadoDict[@"descripcion"]
56
+ textBoton:limite_intentos_alcanzadoDict[@"textoBoton"]
57
+ screenEnum:ScreenEnumLIMITE_INTENTOS_ALCANZADO];
58
+
59
+ NSArray<VisualScreenError *> *errores = @[error1, error2, error3];
60
+ request.errores = errores;
61
+
62
+ ZyReactComp *biomatch = [[ZyReactComp alloc] initOnView:ctrl];
63
+
64
+ [biomatch reactValidacionFacial:request
65
+ completion:^(ReactResponse * _Nonnull response) {
66
+
67
+ dispatch_async(dispatch_get_main_queue(), ^{
68
+ resolve(@{ @"coError": [NSString stringWithString:(response.coError.length != 0) ? response.coError : @""],
69
+ @"deError": [NSString stringWithString:(response.deError.length != 0) ? response.deError : @"" ],
70
+ @"coErrorButton": [NSString stringWithString:(response.coErrorButton.length != 0) ? response.coErrorButton : @"" ],
71
+ @"deErrorButton": [NSString stringWithString:(response.deErrorButton.length != 0) ? response.deErrorButton : @"" ],
72
+ @"idSolicitud": [NSString stringWithString:(response.bmoNuSolicitud.length != 0) ? response.bmoNuSolicitud : @"" ]
73
+
74
+ });
75
+
76
+ });
77
+
78
+ }];
79
+
80
+ }
81
+ @catch(NSException *exception){
82
+ reject(@"get_error",exception.reason, nil);
83
+ }
84
+ });
85
+ }
86
+
87
+
88
+ @end
89
+
90
+
package/lefthook.yml ADDED
@@ -0,0 +1,14 @@
1
+ pre-commit:
2
+ parallel: true
3
+ commands:
4
+ lint:
5
+ glob: "*.{js,ts,jsx,tsx}"
6
+ run: npx eslint {staged_files}
7
+ types:
8
+ glob: "*.{js,ts, jsx, tsx}"
9
+ run: npx tsc
10
+ commit-msg:
11
+ parallel: true
12
+ commands:
13
+ commitlint:
14
+ run: npx commitlint --edit
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "react-native-zyprotectabio-module",
3
+ "version": "0.1.0",
4
+ "description": "bio protecta",
5
+ "scripts":
6
+ {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "postinstall": "node ./scripts/postinstall.js"
9
+ },
10
+ "keywords":
11
+ [
12
+ "react-native",
13
+ "ios",
14
+ "android"
15
+ ],
16
+ "repository":
17
+ {
18
+ "type": "git",
19
+ "url": "git+https://github.com/ZYTRUST/react-native-zyprotectabio-module.git"
20
+ },
21
+ "author": "Iván Cáceres <ztmobile@zytrust.com> (https://github.com/ZYTRUST)",
22
+ "license": "MIT",
23
+ "bugs":
24
+ {
25
+ "url": "https://github.com/ZYTRUST/react-native-zyprotectabio-module/issues"
26
+ },
27
+ "homepage": "www.zytrust.com",
28
+ "publishConfig":
29
+ {
30
+ "access": "public"
31
+ }
32
+ }
@@ -0,0 +1,23 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "react-native-zyprotectabio-module"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+
10
+ s.license = package["license"]
11
+ s.authors = { 'Iván Cáceres' => 'ztmobile@zytrust.com' }
12
+ s.homepage = 'https://www.zytrust.com'
13
+ s.ios.deployment_target = '13.0'
14
+
15
+ s.source = { :git => "https://github.com/ZYTRUST/react-native-zyprotectabio-module.git", :tag => "#{s.version}" }
16
+ s.source_files = "ios/*.{h,m,mm}"
17
+
18
+ s.dependency 'zy_protecta_bio_lib_ios', '3.5.3'
19
+ s.dependency 'React'
20
+
21
+ end
22
+
23
+