@qore-id/react-native-qoreid-sdk 1.2.5-rc → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +6 -2
- package/RNQoreIdSdk.podspec +22 -0
- package/android/build.gradle +25 -46
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/com/qoreid/reactnativeqoreidsdk/RNQoreIdSdkModule.kt +220 -0
- package/android/src/main/java/com/qoreid/reactnativeqoreidsdk/RNQoreIdSdkPackage.kt +33 -0
- package/ios/{QoreidSdk.swift → RCTRNQoreIdSdk.swift} +28 -15
- package/ios/RNQoreIdSdk.h +6 -0
- package/ios/RNQoreIdSdk.mm +41 -0
- package/lib/module/NativeRNQoreIdSdk.js +5 -0
- package/lib/module/NativeRNQoreIdSdk.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/qoreIdSdk.js +46 -28
- package/lib/module/qoreIdSdk.js.map +1 -1
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeRNQoreIdSdk.d.ts +8 -0
- package/lib/typescript/src/NativeRNQoreIdSdk.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/qoreIdSdk.d.ts +9 -4
- package/lib/typescript/src/qoreIdSdk.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +51 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils.d.ts +5 -4
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/package.json +48 -66
- package/src/NativeRNQoreIdSdk.ts +12 -0
- package/src/index.tsx +1 -0
- package/src/qoreIdSdk.tsx +53 -45
- package/src/types.ts +60 -0
- package/src/utils.ts +7 -5
- package/android/src/main/java/com/qoreidsdk/QoreidSdkModule.kt +0 -241
- package/android/src/main/java/com/qoreidsdk/QoreidSdkPackage.kt +0 -17
- package/ios/QoreidSdk-Bridging-Header.h +0 -7
- package/ios/QoreidSdk.m +0 -12
- package/ios/QoreidSdk.xcodeproj/project.pbxproj +0 -292
- package/lib/commonjs/index.js +0 -28
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/qoreIdSdk.js +0 -74
- package/lib/commonjs/qoreIdSdk.js.map +0 -1
- package/lib/commonjs/types.d.js +0 -13
- package/lib/commonjs/types.d.js.map +0 -1
- package/lib/commonjs/utils.js +0 -19
- package/lib/commonjs/utils.js.map +0 -1
- package/lib/module/types.d.js +0 -4
- package/lib/module/types.d.js.map +0 -1
- package/qore-id-react-native-qoreid-sdk.podspec +0 -42
- package/src/types.d.ts +0 -76
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 Emmannuel
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
6
6
|
in the Software without restriction, including without limitation the rights
|
package/README.md
CHANGED
|
@@ -4,10 +4,14 @@ Link to [documentation](https://docs.qoreid.com/docs/qoreid-react-native-sdk)
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
```c
|
|
7
|
+
```c
|
|
8
8
|
npm install --save @qore-id/react-native-qoreid-sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
```c
|
|
11
|
+
```c
|
|
12
12
|
yarn add @qore-id/react-native-qoreid-sdk
|
|
13
13
|
```
|
|
14
|
+
|
|
15
|
+
`@qore-id/react-native-qoreid-sdk@2.0.0` is supported only on react-native version >= `0.81.*` and New Architecture.
|
|
16
|
+
|
|
17
|
+
If you are using older react-native version, install `@qore-id/react-native-qoreid-sdk` versions lower than v2.0.0
|
|
@@ -0,0 +1,22 @@
|
|
|
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 = "RNQoreIdSdk"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
+
s.source = { :git => "https://.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
|
|
17
|
+
s.private_header_files = "ios/**/*.h"
|
|
18
|
+
s.dependency 'QoreIDSDK'
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
install_modules_dependencies(s)
|
|
22
|
+
end
|
package/android/build.gradle
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RNQoreIdSdk_' + name]
|
|
4
|
+
}
|
|
4
5
|
|
|
5
6
|
repositories {
|
|
6
7
|
google()
|
|
@@ -8,55 +9,24 @@ buildscript {
|
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
dependencies {
|
|
11
|
-
classpath "com.android.tools.build:gradle:7.2
|
|
12
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
12
13
|
// noinspection DifferentKotlinGradleVersion
|
|
13
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$
|
|
14
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
def reactNativeArchitectures() {
|
|
18
|
-
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
19
|
-
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
def isNewArchitectureEnabled() {
|
|
23
|
-
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
24
|
-
}
|
|
25
18
|
|
|
26
19
|
apply plugin: "com.android.library"
|
|
27
20
|
apply plugin: "kotlin-android"
|
|
28
21
|
|
|
29
|
-
|
|
30
|
-
apply plugin: "com.facebook.react"
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
def getExtOrDefault(name) {
|
|
34
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["RNQoreIDSdk_" + name]
|
|
35
|
-
}
|
|
22
|
+
apply plugin: "com.facebook.react"
|
|
36
23
|
|
|
37
24
|
def getExtOrIntegerDefault(name) {
|
|
38
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
def supportsNamespace() {
|
|
42
|
-
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
43
|
-
def major = parsed[0].toInteger()
|
|
44
|
-
def minor = parsed[1].toInteger()
|
|
45
|
-
|
|
46
|
-
// Namespace support was added in 7.3.0
|
|
47
|
-
return (major == 7 && minor >= 3) || major >= 8
|
|
25
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["RNQoreIdSdk_" + name]).toInteger()
|
|
48
26
|
}
|
|
49
27
|
|
|
50
28
|
android {
|
|
51
|
-
|
|
52
|
-
namespace "com.qoreidsdk"
|
|
53
|
-
|
|
54
|
-
sourceSets {
|
|
55
|
-
main {
|
|
56
|
-
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
29
|
+
namespace "com.qoreid.reactnativeqoreidsdk"
|
|
60
30
|
|
|
61
31
|
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
62
32
|
|
|
@@ -64,7 +34,10 @@ android {
|
|
|
64
34
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
65
35
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
66
36
|
buildConfigField "String", "s", "\"react_native_android_sdk\""
|
|
67
|
-
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
buildFeatures {
|
|
40
|
+
buildConfig true
|
|
68
41
|
}
|
|
69
42
|
|
|
70
43
|
buildTypes {
|
|
@@ -81,13 +54,23 @@ android {
|
|
|
81
54
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
82
55
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
83
56
|
}
|
|
57
|
+
|
|
58
|
+
sourceSets {
|
|
59
|
+
main {
|
|
60
|
+
java.srcDirs += [
|
|
61
|
+
"generated/java",
|
|
62
|
+
"generated/jni"
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
84
66
|
}
|
|
85
67
|
|
|
86
68
|
repositories {
|
|
87
69
|
mavenCentral()
|
|
88
70
|
google()
|
|
89
|
-
|
|
90
|
-
|
|
71
|
+
maven {
|
|
72
|
+
url "https://repo.qoreid.com/repository/maven-releases/"
|
|
73
|
+
}
|
|
91
74
|
maven { url 'https://jitpack.io' }
|
|
92
75
|
}
|
|
93
76
|
|
|
@@ -95,10 +78,6 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
|
95
78
|
|
|
96
79
|
dependencies {
|
|
97
80
|
implementation 'com.qoreid:qoreid-sdk:+'
|
|
98
|
-
|
|
99
|
-
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
100
|
-
//noinspection GradleDynamicVersion
|
|
101
|
-
implementation "com.facebook.react:react-native:+"
|
|
81
|
+
implementation "com.facebook.react:react-android"
|
|
102
82
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
103
83
|
}
|
|
104
|
-
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
RNQoreIdSdk_kotlinVersion=2.0.21
|
|
2
|
+
RNQoreIdSdk_minSdkVersion=24
|
|
3
|
+
RNQoreIdSdk_targetSdkVersion=34
|
|
4
|
+
RNQoreIdSdk_compileSdkVersion=35
|
|
5
|
+
RNQoreIdSdk_ndkVersion=27.1.12297006
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
package com.qoreid.reactnativeqoreidsdk
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.content.Intent
|
|
5
|
+
import android.os.Build
|
|
6
|
+
import android.util.Log
|
|
7
|
+
import com.facebook.react.bridge.Arguments
|
|
8
|
+
import com.facebook.react.bridge.BaseActivityEventListener
|
|
9
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
10
|
+
import com.facebook.react.bridge.ReadableMap
|
|
11
|
+
import com.facebook.react.bridge.WritableMap
|
|
12
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
13
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
14
|
+
import com.qoreid.sdk.core.OnFlowRequestIdCallback
|
|
15
|
+
import com.qoreid.sdk.core.QoreIDParams
|
|
16
|
+
import com.qoreid.sdk.core.QoreIDSdk
|
|
17
|
+
import com.qoreid.sdk.core.QoreIDSdk.QORE_ID_RESULT_CODE
|
|
18
|
+
import com.qoreid.sdk.core.QoreIDSdk.QORE_ID_RESULT_EXTRA_KEY
|
|
19
|
+
import com.qoreid.sdk.core.models.AddressData
|
|
20
|
+
import com.qoreid.sdk.core.models.ApplicantData
|
|
21
|
+
import com.qoreid.sdk.core.models.ErrorResult
|
|
22
|
+
import com.qoreid.sdk.core.models.IdentityData
|
|
23
|
+
import com.qoreid.sdk.core.models.QoreIDResult
|
|
24
|
+
import com.qoreid.sdk.core.models.ResultData
|
|
25
|
+
import com.qoreid.sdk.core.models.SuccessResult
|
|
26
|
+
import com.qoreid.sdk.core.models.VerificationExtraData
|
|
27
|
+
|
|
28
|
+
@ReactModule(name = RNQoreIdSdkModule.NAME)
|
|
29
|
+
class RNQoreIdSdkModule(context: ReactApplicationContext) :
|
|
30
|
+
NativeRNQoreIdSdkSpec(context) {
|
|
31
|
+
|
|
32
|
+
override fun getName(): String {
|
|
33
|
+
return NAME
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private var qoreIdResult: QoreIDResult? = null
|
|
37
|
+
|
|
38
|
+
init {
|
|
39
|
+
context.addActivityEventListener(object : BaseActivityEventListener () {
|
|
40
|
+
override fun onActivityResult(
|
|
41
|
+
activity: Activity,
|
|
42
|
+
requestCode: Int,
|
|
43
|
+
resultCode: Int,
|
|
44
|
+
data: Intent?
|
|
45
|
+
) {
|
|
46
|
+
if (resultCode == QORE_ID_RESULT_CODE && data!= null) {
|
|
47
|
+
qoreIdResult =
|
|
48
|
+
if (Build.VERSION.SDK_INT < 33) {
|
|
49
|
+
data.extras?.getSerializable(QORE_ID_RESULT_EXTRA_KEY) as QoreIDResult
|
|
50
|
+
} else {
|
|
51
|
+
data.extras?.getSerializable(
|
|
52
|
+
QORE_ID_RESULT_EXTRA_KEY,
|
|
53
|
+
QoreIDResult::class.java
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
processQoreIDResult(context, qoreIdResult!!)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
QoreIDSdk.Callbacks.onFlowRequestId(
|
|
62
|
+
object : OnFlowRequestIdCallback {
|
|
63
|
+
override fun onValue(flowRequestId: Long) {
|
|
64
|
+
Log.i("QORE_ID", flowRequestId.toString())
|
|
65
|
+
val event =
|
|
66
|
+
Arguments.createMap().apply {
|
|
67
|
+
putString("data", flowRequestId.toString())
|
|
68
|
+
putString("message", "QOREID SDK INITIALIZED")
|
|
69
|
+
putString("event", "SESSION_RESULT")
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
emitOnResult( event)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
override fun launchQoreidSdk(readableData: ReadableMap) {
|
|
79
|
+
val data = readableData.toHashMap()
|
|
80
|
+
|
|
81
|
+
if (reactApplicationContext.currentActivity == null) {
|
|
82
|
+
Log.e("Error", "No current activity")
|
|
83
|
+
return
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
val config = data?.get("config") as? HashMap<*, *>
|
|
87
|
+
val apD = data?.get("applicantData") as? HashMap<*, *>
|
|
88
|
+
val applicantData =
|
|
89
|
+
ApplicantData(
|
|
90
|
+
apD?.get("firstName") as String,
|
|
91
|
+
apD?.get("lastName") as String,
|
|
92
|
+
apD?.get("phoneNumber") as String?,
|
|
93
|
+
apD?.get("middleName") as String?,
|
|
94
|
+
apD?.get("dob") as String?,
|
|
95
|
+
apD?.get("email") as String?,
|
|
96
|
+
apD?.get("gender") as String?
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
val adD = data?.get("addressData") as? HashMap<*, *>
|
|
100
|
+
val addressData =
|
|
101
|
+
AddressData(
|
|
102
|
+
adD?.get("address") as String?,
|
|
103
|
+
adD?.get("city") as String?,
|
|
104
|
+
adD?.get("lga") as String?,
|
|
105
|
+
adD?.get("state") as String?,
|
|
106
|
+
)
|
|
107
|
+
val flowId = config?.get("flowId") as? Double
|
|
108
|
+
|
|
109
|
+
val _identityData = data?.get("identityData") as? HashMap<*, *>
|
|
110
|
+
|
|
111
|
+
var identityData: IdentityData? = null
|
|
112
|
+
|
|
113
|
+
if (!_identityData.isNullOrEmpty()) {
|
|
114
|
+
identityData =
|
|
115
|
+
IdentityData(
|
|
116
|
+
_identityData?.get("idType") as String,
|
|
117
|
+
_identityData?.get("idNumber") as String
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
val _extraData = data?.get("extraData") as? HashMap<*, *>?
|
|
122
|
+
var extraData: VerificationExtraData? = null
|
|
123
|
+
|
|
124
|
+
if (!_extraData.isNullOrEmpty()) {
|
|
125
|
+
extraData =
|
|
126
|
+
VerificationExtraData(
|
|
127
|
+
_extraData.get("organisationId") as String,
|
|
128
|
+
_extraData.get("organisationName") as String,
|
|
129
|
+
_extraData?.get("requestSource") as String,
|
|
130
|
+
_extraData?.get("internalReferenceId") as String
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
var acceptedDocuments: List<String>? = data?.get("acceptedDocuments") as? List<String>
|
|
135
|
+
|
|
136
|
+
if (acceptedDocuments.isNullOrEmpty()) {
|
|
137
|
+
acceptedDocuments = emptyList()
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
val qoreIDParams =
|
|
141
|
+
if (flowId?.toLong() != 0L) {
|
|
142
|
+
QoreIDParams()
|
|
143
|
+
.clientId(config?.get("clientId") as String)
|
|
144
|
+
.customerReference(config?.get("customerReference") as String)
|
|
145
|
+
.inputData(applicantData, addressData, identityData, extraData)
|
|
146
|
+
.ocrAcceptedDocuments(acceptedDocuments)
|
|
147
|
+
.workflow(flowId!!.toLong())
|
|
148
|
+
.workflowDefaultIdentity(config?.get("defaultIdType") as String)
|
|
149
|
+
} else {
|
|
150
|
+
QoreIDParams()
|
|
151
|
+
.clientId(config?.get("clientId") as String)
|
|
152
|
+
.customerReference(config?.get("customerReference") as String)
|
|
153
|
+
.inputData(applicantData, addressData, identityData, extraData)
|
|
154
|
+
.ocrAcceptedDocuments(acceptedDocuments)
|
|
155
|
+
.collection(config?.get("productCode") as String)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
QoreIDSdk.s(BuildConfig.s)
|
|
159
|
+
QoreIDSdk.params(qoreIDParams)
|
|
160
|
+
QoreIDSdk.launch(requireNotNull(reactApplicationContext.currentActivity ))
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
fun processQoreIDResult(context: ReactApplicationContext, qoreIdResult: QoreIDResult) {
|
|
164
|
+
when (qoreIdResult) {
|
|
165
|
+
is ErrorResult -> {
|
|
166
|
+
// Handle error.
|
|
167
|
+
val event =
|
|
168
|
+
Arguments.createMap().apply {
|
|
169
|
+
putString("code", qoreIdResult.code.toString())
|
|
170
|
+
putMap("data", parseData(qoreIdResult.data))
|
|
171
|
+
putString("message", qoreIdResult.message)
|
|
172
|
+
putString("event", "ERROR_RESULT")
|
|
173
|
+
}
|
|
174
|
+
emitOnResult(event)
|
|
175
|
+
}
|
|
176
|
+
is SuccessResult -> {
|
|
177
|
+
// Handle success.
|
|
178
|
+
val event =
|
|
179
|
+
Arguments.createMap().apply {
|
|
180
|
+
putMap("data", parseData(qoreIdResult.data))
|
|
181
|
+
putString("message", qoreIdResult.message)
|
|
182
|
+
putString("event", "SUCCESS_RESULT")
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
emitOnResult(event)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
private fun parseData(data: ResultData?): ReadableMap {
|
|
191
|
+
val dataMap = Arguments.createMap()
|
|
192
|
+
|
|
193
|
+
// Adding verification object
|
|
194
|
+
val verificationMap =
|
|
195
|
+
Arguments.createMap().apply {
|
|
196
|
+
putString("id", data?.verification?.id.toString())
|
|
197
|
+
putString("status", data?.verification?.status?.state)
|
|
198
|
+
putString("state", data?.verification?.status?.state)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Populating the main map
|
|
202
|
+
dataMap.apply {
|
|
203
|
+
putString("customerReference", data?.customerReference)
|
|
204
|
+
putString("productCode", data?.productCode)
|
|
205
|
+
putString("flowId", data?.flowId.toString())
|
|
206
|
+
putMap("verification", verificationMap) // Nested map
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return dataMap
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
companion object {
|
|
213
|
+
const val NAME = "RNQoreIdSdk"
|
|
214
|
+
|
|
215
|
+
@JvmStatic
|
|
216
|
+
fun initialize(activity: Activity) {
|
|
217
|
+
QoreIDSdk.initialize(activity)
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
package com.qoreid.reactnativeqoreidsdk
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.BaseReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
|
+
import java.util.HashMap
|
|
9
|
+
|
|
10
|
+
class RNQoreIdSdkPackage : BaseReactPackage() {
|
|
11
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
12
|
+
return if (name == RNQoreIdSdkModule.NAME) {
|
|
13
|
+
RNQoreIdSdkModule(reactContext)
|
|
14
|
+
} else {
|
|
15
|
+
null
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
20
|
+
return ReactModuleInfoProvider {
|
|
21
|
+
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
22
|
+
moduleInfos[RNQoreIdSdkModule.NAME] = ReactModuleInfo(
|
|
23
|
+
RNQoreIdSdkModule.NAME,
|
|
24
|
+
RNQoreIdSdkModule.NAME,
|
|
25
|
+
false, // canOverrideExistingModule
|
|
26
|
+
false, // needsEagerInit
|
|
27
|
+
false, // isCxxModule
|
|
28
|
+
true // isTurboModule
|
|
29
|
+
)
|
|
30
|
+
moduleInfos
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -12,10 +12,13 @@ import UIKit
|
|
|
12
12
|
import QoreIDSDK
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
@objc(QoreidSdk)
|
|
16
|
-
class QoreidSdk: RCTEventEmitter {
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
@objc(RCTRNQoreIdSdk)
|
|
17
|
+
public class RCTRNQoreIdSdk: NSObject {
|
|
18
|
+
@objc public static let shared: RCTRNQoreIdSdk = RCTRNQoreIdSdk()
|
|
19
|
+
@objc public var onEmitResult: (([String: Any]) -> Void)?
|
|
20
|
+
|
|
21
|
+
@objc public func launchQoreidSdk(_ data: NSDictionary) -> Void {
|
|
19
22
|
let config = data["config"] as? NSDictionary
|
|
20
23
|
let _applicant = data["applicantData"] as? NSDictionary
|
|
21
24
|
let _identity = data["identityData"] as? NSDictionary
|
|
@@ -90,13 +93,29 @@ class QoreidSdk: RCTEventEmitter {
|
|
|
90
93
|
func onQoreIdResultReceived(result: QoreIDResult?) {
|
|
91
94
|
if let result = result {
|
|
92
95
|
if let errorResult = result as? ErrorResult {
|
|
93
|
-
|
|
96
|
+
let payload: [String: Any] = [
|
|
97
|
+
"code": String(describing: errorResult.code),
|
|
98
|
+
"data": self.parseData(errorResult.data),
|
|
99
|
+
"message": errorResult.message,
|
|
100
|
+
"event": "ERROR_RESULT"
|
|
101
|
+
]
|
|
102
|
+
self.emitOnResult(payload)
|
|
94
103
|
self.controller()?.popViewController(animated: false)
|
|
95
104
|
} else if let successResult = result as? SuccessResult {
|
|
96
|
-
|
|
105
|
+
let payload: [String: Any] = [
|
|
106
|
+
"data": self.parseData(successResult.data),
|
|
107
|
+
"message": successResult.message ?? "",
|
|
108
|
+
"event": "SUCCESS_RESULT"
|
|
109
|
+
]
|
|
110
|
+
self.emitOnResult(payload)
|
|
97
111
|
self.controller()?.popViewController(animated: false)
|
|
98
112
|
} else if let pendingResult = result as? PendingResult {
|
|
99
|
-
|
|
113
|
+
let payload: [String: Any] = [
|
|
114
|
+
"data": pendingResult.data?.verification?.id ?? 0,
|
|
115
|
+
"message": pendingResult.message ?? "",
|
|
116
|
+
"event": "SESSION_RESULT"
|
|
117
|
+
]
|
|
118
|
+
self.emitOnResult(payload)
|
|
100
119
|
}
|
|
101
120
|
}
|
|
102
121
|
}
|
|
@@ -129,13 +148,9 @@ class QoreidSdk: RCTEventEmitter {
|
|
|
129
148
|
return data
|
|
130
149
|
}
|
|
131
150
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
@objc override static func requiresMainQueueSetup() -> Bool {
|
|
137
|
-
return false
|
|
138
|
-
}
|
|
151
|
+
private func emitOnResult(_ payload: [String: Any]) {
|
|
152
|
+
onEmitResult?(payload)
|
|
153
|
+
}
|
|
139
154
|
|
|
140
155
|
private func controller() -> UINavigationController? {
|
|
141
156
|
if #available(iOS 13.0, *) {
|
|
@@ -151,5 +166,3 @@ class QoreidSdk: RCTEventEmitter {
|
|
|
151
166
|
}
|
|
152
167
|
}
|
|
153
168
|
}
|
|
154
|
-
|
|
155
|
-
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#import "RNQoreIdSdk.h"
|
|
2
|
+
#import <UIKit/UIKit.h>
|
|
3
|
+
#import "RNQoreIdSdk-Swift.h"
|
|
4
|
+
|
|
5
|
+
@implementation RNQoreIdSdk {
|
|
6
|
+
RCTRNQoreIdSdk *qoreIdSdk;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
- (id) init {
|
|
12
|
+
|
|
13
|
+
if(self = [super init]) {
|
|
14
|
+
|
|
15
|
+
qoreIdSdk = [RCTRNQoreIdSdk shared];
|
|
16
|
+
|
|
17
|
+
[qoreIdSdk setOnEmitResult:^(NSDictionary<NSString *,id> * _Nonnull result) {
|
|
18
|
+
[self emitOnResult:result];
|
|
19
|
+
}];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return self;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
27
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
28
|
+
{
|
|
29
|
+
return std::make_shared<facebook::react::NativeRNQoreIdSdkSpecJSI>(params);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
+ (NSString *)moduleName
|
|
33
|
+
{
|
|
34
|
+
return @"RNQoreIdSdk";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
- (void)launchQoreidSdk:(nonnull NSDictionary *)arg {
|
|
38
|
+
[qoreIdSdk launchQoreidSdk:arg];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeRNQoreIdSdk.ts"],"mappings":";;AAAA,SACEA,mBAAmB,QAGd,cAAc;AAOrB,eAAeA,mBAAmB,CAACC,YAAY,CAAO,aAAa,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,cAAc,gBAAa;AAC3B,cAAc,YAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,cAAc,gBAAa;AAC3B,cAAc,YAAS;AACvB,cAAc,YAAS","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|