idwise-nfc-react-native-sdk 4.9.4 → 5.0.2

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 (52) hide show
  1. package/android/build.gradle +5 -5
  2. package/android/gradle.properties +1 -1
  3. package/android/src/main/java/com/idwisemobilesdk/IdwiseMobileSdkModule.kt +94 -73
  4. package/idwise-react-native-sdk.podspec +3 -4
  5. package/ios/IDWiseNFC.framework/IDWiseNFC +0 -0
  6. package/ios/IDWiseNFC.framework/Info.plist +0 -0
  7. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  8. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  9. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/arm64-apple-ios.abi.json +5689 -4620
  10. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/arm64-apple-ios.private.swiftinterface +95 -57
  11. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/arm64-apple-ios.swiftinterface +95 -57
  12. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
  13. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/x86_64-apple-ios-simulator.abi.json +5689 -4620
  14. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +95 -57
  15. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +95 -57
  16. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/x86_64-apple-ios-simulator.swiftmodule +0 -0
  17. package/ios/IDWiseNFC.framework/ProcessJourneyViewController.storyboardc/yS7-79-T86-view-owr-v5-NaP.nib/objects-13.0+.nib +0 -0
  18. package/ios/IDWiseNFC.framework/ProcessJourneyViewController.storyboardc/yS7-79-T86-view-owr-v5-NaP.nib/runtime.nib +0 -0
  19. package/ios/IDWiseNFC.framework/document_detector.mlmodelc/metadata.json +2 -2
  20. package/ios/IdwiseMobileSdk.mm +5 -2
  21. package/ios/IdwiseMobileSdk.swift +160 -115
  22. package/lib/commonjs/ApplicantDetailsKeys.js +12 -0
  23. package/lib/commonjs/ApplicantDetailsKeys.js.map +1 -0
  24. package/lib/commonjs/IDWise.js +3 -38
  25. package/lib/commonjs/IDWise.js.map +1 -1
  26. package/lib/commonjs/IDWiseConstants.js +3 -3
  27. package/lib/commonjs/IDWiseConstants.js.map +1 -1
  28. package/lib/commonjs/IDWiseDynamic.js +60 -0
  29. package/lib/commonjs/IDWiseDynamic.js.map +1 -0
  30. package/lib/commonjs/IDWiseEventListeners.js +16 -11
  31. package/lib/commonjs/IDWiseEventListeners.js.map +1 -1
  32. package/lib/commonjs/index.js +4 -2
  33. package/lib/commonjs/index.js.map +1 -1
  34. package/lib/module/ApplicantDetailsKeys.js +6 -0
  35. package/lib/module/ApplicantDetailsKeys.js.map +1 -0
  36. package/lib/module/IDWise.js +4 -39
  37. package/lib/module/IDWise.js.map +1 -1
  38. package/lib/module/IDWiseConstants.js +2 -2
  39. package/lib/module/IDWiseConstants.js.map +1 -1
  40. package/lib/module/IDWiseDynamic.js +54 -0
  41. package/lib/module/IDWiseDynamic.js.map +1 -0
  42. package/lib/module/IDWiseEventListeners.js +16 -11
  43. package/lib/module/IDWiseEventListeners.js.map +1 -1
  44. package/lib/module/index.js +4 -2
  45. package/lib/module/index.js.map +1 -1
  46. package/package.json +2 -2
  47. package/src/ApplicantDetailsKeys.js +5 -0
  48. package/src/IDWise.js +8 -64
  49. package/src/IDWiseConstants.js +2 -2
  50. package/src/IDWiseDynamic.js +98 -0
  51. package/src/IDWiseEventListeners.js +17 -16
  52. package/src/index.js +3 -2
@@ -94,10 +94,10 @@ android {
94
94
  repositories {
95
95
  mavenCentral()
96
96
  google()
97
- maven{
98
- name 'Staging'
99
- url 'https://s01.oss.sonatype.org/content/repositories/staging/'
100
- }
97
+ //maven{
98
+ // name 'Staging'
99
+ // url 'https://s01.oss.sonatype.org/content/repositories/staging/'
100
+ // }
101
101
  }
102
102
 
103
103
  def kotlin_version = getExtOrDefault("kotlinVersion")
@@ -112,6 +112,6 @@ dependencies {
112
112
  implementation 'com.google.code.gson:gson:2.10.1'
113
113
 
114
114
  implementation "com.idwise:android-sdk:$idwise_sdk_version"
115
- implementation "com.idwise:nfc:4.9.1"
115
+ implementation "com.idwise:nfc:5.0.2"
116
116
  }
117
117
 
@@ -4,4 +4,4 @@ IdwiseMobileSdk_targetSdkVersion=31
4
4
  IdwiseMobileSdk_compileSdkVersion=31
5
5
  IdwiseMobileSdk_ndkversion=21.4.7075529
6
6
  # Idwise SDK version
7
- idwise_sdk_version=4.9.1
7
+ idwise_sdk_version=5.0.2
@@ -7,12 +7,10 @@ import com.facebook.react.bridge.*
7
7
  import com.facebook.react.modules.core.DeviceEventManagerModule
8
8
  import com.google.gson.Gson
9
9
  import com.idwise.sdk.IDWise
10
- import com.idwise.sdk.IDWiseSDKCallback
11
- import com.idwise.sdk.IDWiseSDKStepCallback
12
- import com.idwise.sdk.data.models.IDWiseSDKError
13
- import com.idwise.sdk.data.models.IDWiseSDKTheme
14
- import com.idwise.sdk.data.models.JourneyInfo
15
- import com.idwise.sdk.data.models.StepResult
10
+ import com.idwise.sdk.IDWiseDynamic
11
+ import com.idwise.sdk.IDWiseJourneyCallbacks
12
+ import com.idwise.sdk.IDWiseStepCallbacks
13
+ import com.idwise.sdk.data.models.*
16
14
  import java.io.ByteArrayOutputStream
17
15
 
18
16
  class IdwiseMobileSdkModule(private val reactContext: ReactApplicationContext) :
@@ -29,16 +27,15 @@ class IdwiseMobileSdkModule(private val reactContext: ReactApplicationContext) :
29
27
 
30
28
  @ReactMethod
31
29
  fun initialize(clientKey: String, theme: String) {
32
- val idwiseTheme: IDWiseSDKTheme = try {
33
- IDWiseSDKTheme.valueOf(theme!!)
30
+ val idwiseTheme: IDWiseTheme = try {
31
+ IDWiseTheme.valueOf(theme!!)
34
32
  } catch (e: Exception) {
35
- IDWiseSDKTheme.SYSTEM_DEFAULT
33
+ IDWiseTheme.SYSTEM_DEFAULT
36
34
  }
37
35
 
38
36
  IDWise.initialize(clientKey, idwiseTheme) { error ->
39
37
  val params: WritableMap = Arguments.createMap()
40
- error?.errorCode?.let { code -> params.putInt("errorCode", code) }
41
- params.putString("errorMessage", error?.message)
38
+ params.putString("data",Gson().toJson(error))
42
39
  sendEvent("onInitializeError", params)
43
40
  }
44
41
  }
@@ -47,10 +44,16 @@ class IdwiseMobileSdkModule(private val reactContext: ReactApplicationContext) :
47
44
  fun startJourney(
48
45
  journeyTemplateId: String,
49
46
  referenceNo: String?,
50
- locale: String
47
+ locale: String?,
48
+ applicantDetails: ReadableMap?
51
49
  ) {
50
+ var deconstructedMap: HashMap<String,String>? = null
51
+ applicantDetails?.let{
52
+ deconstructedMap = recursivelyDeconstructReadableMap(applicantDetails)
53
+ }
54
+
52
55
  currentActivity?.let { activity ->
53
- IDWise.startJourney(activity, journeyTemplateId, referenceNo, locale, journeyCallback)
56
+ IDWise.startJourney(context=activity, flowId=journeyTemplateId, referenceNo=referenceNo, locale=locale, applicantDetails=deconstructedMap, journeyCallbacks=journeyCallback)
54
57
  }
55
58
  }
56
59
 
@@ -58,12 +61,18 @@ class IdwiseMobileSdkModule(private val reactContext: ReactApplicationContext) :
58
61
  fun startDynamicJourney(
59
62
  journeyTemplateId: String,
60
63
  referenceNo: String?,
61
- locale: String
64
+ locale: String?,
65
+ applicantDetails: ReadableMap?
62
66
  ) {
67
+
68
+ var deconstructedMap: HashMap<String,String>? = null
69
+ applicantDetails?.let{
70
+ deconstructedMap = recursivelyDeconstructReadableMap(applicantDetails)
71
+ }
72
+
63
73
  currentActivity?.let { activity ->
64
- IDWise.startDynamicJourney(
65
- activity, journeyTemplateId, referenceNo, locale,
66
- journeyCallback, stepCallback
74
+ IDWiseDynamic.startJourney(
75
+ context=activity, flowId=journeyTemplateId, referenceNo=referenceNo, locale=locale,applicantDetails=deconstructedMap, journeyCallbacks=journeyCallback, stepCallbacks=stepCallback
67
76
  )
68
77
  }
69
78
  }
@@ -75,9 +84,9 @@ class IdwiseMobileSdkModule(private val reactContext: ReactApplicationContext) :
75
84
  locale: String
76
85
  ) {
77
86
  currentActivity?.let { activity ->
78
- IDWise.resumeDynamicJourney(
79
- activity, journeyTemplateId, journeyId, locale,
80
- journeyCallback, stepCallback
87
+ IDWiseDynamic.resumeJourney(
88
+ context=activity, flowId=journeyTemplateId, journeyId=journeyId, locale=locale,
89
+ journeyCallbacks=journeyCallback, stepCallbacks=stepCallback
81
90
  )
82
91
  }
83
92
  }
@@ -90,54 +99,50 @@ class IdwiseMobileSdkModule(private val reactContext: ReactApplicationContext) :
90
99
  ) {
91
100
  currentActivity?.let { activity ->
92
101
  IDWise.resumeJourney(
93
- activity, journeyTemplateId, journeyId, locale,
94
- journeyCallback
102
+ context=activity, flowId=journeyTemplateId, journeyId=journeyId, locale=locale,
103
+ journeyCallbacks=journeyCallback
95
104
  )
96
105
  }
97
106
  }
98
107
 
99
108
  @ReactMethod
100
109
  fun startStep(stepId: String) {
101
- currentActivity?.let { activity -> IDWise.startStep(activity, stepId) }
110
+ currentActivity?.let { activity -> IDWiseDynamic.startStep(activity, stepId) }
102
111
  }
103
112
 
104
113
  @ReactMethod
105
114
  fun startStepFromFileUpload(stepId: String, data: ByteArray) {
106
- currentActivity?.let { activity -> IDWise.startStepFromFileUpload(activity, stepId, data) }
115
+ currentActivity?.let { activity -> IDWiseDynamic.startStepFromFileUpload(activity, stepId, data) }
107
116
  }
108
117
 
109
118
  @ReactMethod
110
119
  fun finishDynamicJourney() {
111
- IDWise.finishDynamicJourney()
120
+ IDWiseDynamic.finishJourney()
112
121
  }
113
122
 
114
123
 
115
124
  @ReactMethod
116
125
  fun skipStep(stepId: String) {
117
- IDWise.skipStep(stepId)
126
+ IDWiseDynamic.skipStep(stepId)
118
127
  }
119
128
 
120
129
  @ReactMethod
121
130
  fun getJourneySummary() {
122
- IDWise.getJourneySummary() { summary, error ->
131
+ IDWiseDynamic.getJourneySummary() { summary, error ->
123
132
  val gson = Gson()
124
133
  val argsMap = Arguments.createMap()
134
+
135
+ val summaryResponse = JourneySummaryExposed(summary,error)
136
+
137
+ argsMap.putString("data", gson.toJson(summaryResponse))
138
+ sendEvent("onJourneySummary", argsMap)
125
139
 
126
- summary?.let {
127
- argsMap.putString("summary", gson.toJson(summary))
128
- sendEvent("onJourneySummary", argsMap)
129
- }
130
-
131
- error?.let {
132
- argsMap.putString("error", gson.toJson(error))
133
- sendEvent("onJourneySummaryError", argsMap)
134
- }
135
140
  }
136
141
  }
137
142
 
138
143
  @ReactMethod
139
144
  fun unloadSDK() {
140
- UiThreadUtil.runOnUiThread { IDWise.unloadSDK() }
145
+ UiThreadUtil.runOnUiThread { IDWiseDynamic.unloadSDK() }
141
146
  }
142
147
 
143
148
  @ReactMethod
@@ -148,75 +153,67 @@ class IdwiseMobileSdkModule(private val reactContext: ReactApplicationContext) :
148
153
  fun removeListeners(count: Integer?) {
149
154
  }
150
155
 
151
- val journeyCallback = object : IDWiseSDKCallback {
152
- override fun onJourneyStarted(journeyInfo: JourneyInfo) {
156
+ val journeyCallback = object : IDWiseJourneyCallbacks {
157
+ override fun onJourneyStarted(journeyInfo: JourneyStartedInfo) {
153
158
  val params: WritableMap = Arguments.createMap()
154
- params.putString("journeyId", journeyInfo.journeyId)
159
+
160
+ params.putString("data", Gson().toJson(journeyInfo))
155
161
  sendEvent("onJourneyStarted", params)
156
162
  }
157
163
 
158
- override fun onJourneyResumed(journeyInfo: JourneyInfo) {
164
+ override fun onJourneyResumed(journeyInfo: JourneyResumedInfo) {
159
165
  val params: WritableMap = Arguments.createMap()
160
- params.putString("journeyId", journeyInfo.journeyId)
166
+ params.putString("data", Gson().toJson(journeyInfo))
161
167
  sendEvent("onJourneyResumed", params)
162
168
  }
163
169
 
164
- override fun onJourneyCompleted(journeyInfo: JourneyInfo, isCompleted: Boolean) {
170
+ override fun onJourneyCompleted(journeyInfo: JourneyCompletedInfo) {
165
171
  val params: WritableMap = Arguments.createMap()
166
- params.putString("journeyId", journeyInfo.journeyId)
167
- sendEvent("onJourneyFinished", params)
172
+ params.putString("data", Gson().toJson(journeyInfo))
173
+ sendEvent("onJourneyCompleted", params)
168
174
  }
169
175
 
170
- override fun onJourneyCancelled(journeyInfo: JourneyInfo?) {
176
+ override fun onJourneyCancelled(journeyInfo: JourneyCancelledInfo) {
171
177
  val params: WritableMap = Arguments.createMap()
172
- params.putString("journeyId", journeyInfo?.journeyId)
178
+ params.putString("data", Gson().toJson(journeyInfo))
173
179
  sendEvent("onJourneyCancelled", params)
174
180
  }
175
181
 
176
- override fun onError(error: IDWiseSDKError) {
182
+ override fun onError(error: IDWiseError) {
177
183
  val params: WritableMap = Arguments.createMap()
178
- params.putInt("errorCode", error.errorCode)
179
- params.putString("errorMessage", error.message)
184
+ params.putString("data", Gson().toJson(error))
180
185
  sendEvent("onJourneyError", params)
181
186
  }
182
187
  }
183
188
 
184
- val stepCallback = object : IDWiseSDKStepCallback {
185
- override fun onStepCaptured(stepId: String, bitmap: Bitmap?, croppedBitmap: Bitmap?) {
186
- val bitmapString = convertImageToBase64String(croppedBitmap)
189
+ val stepCallback = object : IDWiseStepCallbacks {
190
+ override fun onStepCaptured(stepCapturedInfo:StepCapturedInfo) {
187
191
  val params: WritableMap = Arguments.createMap()
188
- params.putString("stepId", stepId)
189
- params.putString("capturedImage", bitmapString)
192
+
193
+ val originalImage = convertImageToBase64String(stepCapturedInfo.originalImage)
194
+ val croppedImage = convertImageToBase64String(stepCapturedInfo.croppedImage)
195
+ val response = OnStepCapturedInfoExposed(stepCapturedInfo.stepId.toString(),originalImage,croppedImage)
196
+
197
+ params.putString("data", Gson().toJson(response))
190
198
  sendEvent("onStepCaptured", params)
191
199
  }
192
200
 
193
- override fun onStepResult(stepId: String, stepResult: StepResult?) {
201
+ override fun onStepResult(stepInfo:StepResultInfo) {
194
202
  val gson = Gson()
195
- val argsMap = Arguments.createMap()
196
-
197
- argsMap.putString("stepId", stepId)
198
- stepResult?.let {
199
- argsMap.putString("stepResult", gson.toJson(stepResult))
200
- }
201
-
203
+ val argsMap: WritableMap = Arguments.createMap()
204
+ argsMap.putString("data", Gson().toJson(stepInfo))
202
205
  sendEvent("onStepResult", argsMap)
203
206
  }
204
207
 
205
- override fun onStepSkipped(stepId: String) {
208
+ override fun onStepSkipped(stepInfo:StepSkippedInfo) {
206
209
  val params: WritableMap = Arguments.createMap()
207
- params.putString("stepId", stepId)
210
+ params.putString("data", Gson().toJson(stepInfo))
208
211
  sendEvent("onStepSkipped", params)
209
212
  }
210
213
 
211
- override fun onStepConfirmed(stepId: String) {
212
- /**
213
- * No need to implement this as for latest version it's not being required.
214
- */
215
- }
216
-
217
- override fun onStepCancelled(stepId: String) {
214
+ override fun onStepCancelled(stepInfo:StepCancelledInfo) {
218
215
  val params: WritableMap = Arguments.createMap()
219
- params.putString("stepId", stepId)
216
+ params.putString("data", Gson().toJson(stepInfo))
220
217
  sendEvent("onStepCancelled", params)
221
218
  }
222
219
  }
@@ -233,4 +230,28 @@ class IdwiseMobileSdkModule(private val reactContext: ReactApplicationContext) :
233
230
  companion object {
234
231
  const val NAME = "IdwiseMobileSdk"
235
232
  }
233
+
234
+ private fun recursivelyDeconstructReadableMap(readableMap: ReadableMap):HashMap<String, String> {
235
+ val iterator: ReadableMapKeySetIterator = readableMap.keySetIterator();
236
+ val deconstructedMap = HashMap<String,String>();
237
+ while (iterator.hasNextKey()) {
238
+ val key = iterator.nextKey();
239
+ deconstructedMap.put(key, readableMap.getString(key)?:"");
240
+ }
241
+
242
+ return deconstructedMap;
243
+ }
244
+
245
+
246
+ internal data class OnStepCapturedInfoExposed(
247
+ val stepId:String,
248
+ val originalImage:String?,
249
+ val croppedImage:String
250
+ )
251
+
252
+
253
+ internal data class JourneySummaryExposed(
254
+ val summary:JourneySummary?,
255
+ val error:IDWiseError?
256
+ )
236
257
  }
@@ -17,6 +17,9 @@ Pod::Spec.new do |s|
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
18
  s.static_framework = true
19
19
 
20
+ s.dependency 'DocumentReader', '6.8.2981'
21
+ s.dependency 'DocumentReaderMRZRFID', '6.8.7687'
22
+
20
23
  s.pod_target_xcconfig = {
21
24
  "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
22
25
  "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
@@ -25,10 +28,6 @@ Pod::Spec.new do |s|
25
28
  "CODE_SIGNING_ALLOWED" => 'NO'
26
29
  }
27
30
 
28
-
29
- s.dependency 'DocumentReader', '6.8.2981'
30
- s.dependency 'DocumentReaderMRZRFID', '6.8.7687'
31
-
32
31
  s.preserve_paths = 'ios/IDWiseNFC.framework/**/*'
33
32
  s.xcconfig = { 'OTHER_LDFLAGS' => '-framework IDWiseNFC' }
34
33
  s.vendored_frameworks = 'ios/IDWiseNFC.framework'
Binary file
Binary file