@smile_identity/react-native 10.3.2 → 11.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.
Files changed (34) hide show
  1. package/android/build.gradle +12 -8
  2. package/android/gradle.properties +1 -3
  3. package/android/src/main/java/com/smileidentity/react/Mapper.kt +35 -10
  4. package/android/src/main/java/com/smileidentity/react/SmileIdModule.kt +169 -93
  5. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDBiometricKYCViewManager.kt +8 -5
  6. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDEnhancedDocumentVerificationViewManager.kt +7 -4
  7. package/android/src/main/java/com/smileidentity/react/views/SmileIDDocumentCaptureView.kt +13 -11
  8. package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieCaptureView.kt +149 -32
  9. package/ios/RNSmileID.swift +18 -10
  10. package/ios/SmileId.xcodeproj/xcuserdata/japhetndhlovu.xcuserdatad/xcschemes/SmileId.xcscheme +23 -0
  11. package/ios/SmileId.xcodeproj/xcuserdata/japhetndhlovu.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  12. package/ios/Utils/SmileIDDictExt.swift +35 -11
  13. package/ios/View/SmileIDDocumentCaptureView.swift +1 -2
  14. package/ios/View/SmileIDSmartSelfieCaptureView.swift +38 -10
  15. package/ios/ViewManagers/SmileIDBiometricKYCViewManager.swift +6 -4
  16. package/ios/ViewManagers/SmileIDEnhancedDocumentVerificationViewManager.swift +6 -4
  17. package/ios/ViewManagers/SmileIDSmartSelfieCaptureViewManager.swift +1 -2
  18. package/ios/ViewModels/SmileIDProductModel.swift +6 -4
  19. package/lib/commonjs/index.js +6 -0
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/commonjs/types.js +28 -8
  22. package/lib/commonjs/types.js.map +1 -1
  23. package/lib/module/index.js +2 -2
  24. package/lib/module/index.js.map +1 -1
  25. package/lib/module/types.js +28 -8
  26. package/lib/module/types.js.map +1 -1
  27. package/lib/typescript/index.d.ts +2 -2
  28. package/lib/typescript/index.d.ts.map +1 -1
  29. package/lib/typescript/types.d.ts +22 -4
  30. package/lib/typescript/types.d.ts.map +1 -1
  31. package/package.json +2 -2
  32. package/react-native-smile-id.podspec +10 -5
  33. package/src/index.tsx +2 -0
  34. package/src/types.ts +41 -13
@@ -8,10 +8,10 @@ buildscript {
8
8
  google()
9
9
  mavenCentral()
10
10
  gradlePluginPortal()
11
- // uncomment for development to test snapshots
12
- // maven {
13
- // url 'https://oss.sonatype.org/content/repositories/snapshots/'
14
- // }
11
+ // uncomment for development to test snapshots
12
+ // maven {
13
+ // url = 'https://central.sonatype.com/repository/maven-snapshots/'
14
+ // }
15
15
  }
16
16
 
17
17
  dependencies {
@@ -78,7 +78,10 @@ android {
78
78
  defaultConfig {
79
79
  minSdkVersion getExtOrIntegerDefault("minSdkVersion")
80
80
  targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
81
-
81
+
82
+ // Read version from package.json for setWrapperInfo
83
+ def packageJson = new groovy.json.JsonSlurper().parseText(file("../package.json").text)
84
+ buildConfigField "String", "SMILE_ID_VERSION", "\"${packageJson.version}\""
82
85
  }
83
86
 
84
87
  buildTypes {
@@ -121,9 +124,10 @@ repositories {
121
124
  mavenCentral()
122
125
  google()
123
126
  gradlePluginPortal()
124
- maven {
125
- url 'https://oss.sonatype.org/content/repositories/snapshots/'
126
- }
127
+ // uncomment for development to test snapshots
128
+ // maven {
129
+ // url = 'https://central.sonatype.com/repository/maven-snapshots/'
130
+ // }
127
131
  }
128
132
 
129
133
  def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["SmileId_kotlinVersion"]
@@ -3,7 +3,5 @@ SmileId_minSdkVersion=21
3
3
  SmileId_targetSdkVersion=35
4
4
  SmileId_compileSdkVersion=35
5
5
  SmileId_ndkversion=21.4.7075529
6
- SmileId_androidVersion=10.6.0
7
- ; Uncomment for dev also uncomment snapshots repo in build.gradle
8
- ; SmileId_androidVersion=10.6.1-SNAPSHOT
6
+ SmileId_androidVersion=11.0.3
9
7
  SmileId_kotlinCompilerExtensionVersion=1.5.11
@@ -5,6 +5,7 @@ import com.facebook.react.bridge.ReadableMap
5
5
  import com.smileidentity.models.AuthenticationRequest
6
6
  import com.smileidentity.models.Config
7
7
  import com.smileidentity.models.ConsentInformation
8
+ import com.smileidentity.models.ConsentedInformation
8
9
  import com.smileidentity.models.EnhancedKycRequest
9
10
  import com.smileidentity.models.IdInfo
10
11
  import com.smileidentity.models.ImageType
@@ -153,23 +154,47 @@ fun ReadableMap.toEnhancedKycRequest(): EnhancedKycRequest {
153
154
  },
154
155
  consentInformation = getMapOrDefault("consentInformation", null)?.toConsentInfo() ?: run {
155
156
  ConsentInformation(
156
- consentGrantedDate = getCurrentIsoTimestamp(),
157
- personalDetailsConsentGranted = false,
158
- contactInfoConsentGranted = false,
159
- documentInfoConsentGranted = false
157
+ consented = ConsentedInformation(
158
+ consentGrantedDate = getCurrentIsoTimestamp(),
159
+ personalDetails = false,
160
+ contactInformation = false,
161
+ documentInformation = false
162
+ )
160
163
  )
161
164
  },
162
165
  )
163
166
  }
164
167
 
165
168
  fun ReadableMap.toConsentInfo(): ConsentInformation {
169
+ val consentGrantedDate =
170
+ getStringOrDefault("consentGrantedDate", getCurrentIsoTimestamp()) ?: getCurrentIsoTimestamp()
171
+
172
+ // Try the new property names first, fall back to old property names if new ones aren't present
173
+ val personalDetailsConsentGranted = if (hasKey("personalDetails")) {
174
+ getBoolOrDefault("personalDetails", false)
175
+ } else {
176
+ getBoolOrDefault("personalDetailsConsentGranted", false)
177
+ }
178
+
179
+ val contactInfoConsentGranted = if (hasKey("contactInformation")) {
180
+ getBoolOrDefault("contactInformation", false)
181
+ } else {
182
+ getBoolOrDefault("contactInfoConsentGranted", false)
183
+ }
184
+
185
+ val documentInfoConsentGranted = if (hasKey("documentInformation")) {
186
+ getBoolOrDefault("documentInformation", false)
187
+ } else {
188
+ getBoolOrDefault("documentInfoConsentGranted", false)
189
+ }
190
+
166
191
  return ConsentInformation(
167
- consentGrantedDate = getStringOrDefault("consentGrantedDate", null) ?: run {
168
- getCurrentIsoTimestamp()
169
- },
170
- personalDetailsConsentGranted = getBoolOrDefault("personalDetailsConsentGranted", false),
171
- contactInfoConsentGranted = getBoolOrDefault("contactInfoConsentGranted", false),
172
- documentInfoConsentGranted = getBoolOrDefault("documentInfoConsentGranted", false)
192
+ consented = ConsentedInformation(
193
+ consentGrantedDate = consentGrantedDate,
194
+ personalDetails = personalDetailsConsentGranted,
195
+ contactInformation = contactInfoConsentGranted,
196
+ documentInformation = documentInfoConsentGranted
197
+ ),
173
198
  )
174
199
  }
175
200
 
@@ -9,6 +9,7 @@ import com.facebook.react.bridge.WritableArray
9
9
  import com.smileidentity.SmileID
10
10
  import com.smileidentity.SmileIDCrashReporting
11
11
  import com.smileidentity.SmileIdSpec
12
+ import com.smileidentity.metadata.models.WrapperSdkName
12
13
  import com.smileidentity.models.AuthenticationResponse
13
14
  import com.smileidentity.models.BiometricKycJobStatusResponse
14
15
  import com.smileidentity.models.DocumentVerificationJobStatusResponse
@@ -38,10 +39,9 @@ import kotlin.time.Duration
38
39
  import kotlin.time.Duration.Companion.milliseconds
39
40
 
40
41
  class SmileIdModule internal constructor(
41
- context: ReactApplicationContext
42
+ context: ReactApplicationContext,
42
43
  ) : SmileIdSpec(context) {
43
-
44
- override fun getName(): String = NAME
44
+ override fun getName(): String = NAME
45
45
 
46
46
  @ReactMethod
47
47
  override fun initialize(
@@ -49,9 +49,18 @@ class SmileIdModule internal constructor(
49
49
  enableCrashReporting: Boolean,
50
50
  config: ReadableMap?,
51
51
  apiKey: String?,
52
- promise: Promise
52
+ promise: Promise,
53
53
  ) {
54
54
  try {
55
+ // Set wrapper info for React Native SDK
56
+ try {
57
+ val version = com.smileidentity.react.BuildConfig.SMILE_ID_VERSION
58
+ SmileID.setWrapperInfo(WrapperSdkName.ReactNative, version)
59
+ } catch (e: Exception) {
60
+ // Fallback to default version if BuildConfig is not available
61
+ SmileID.setWrapperInfo(WrapperSdkName.ReactNative, "unknown")
62
+ }
63
+
55
64
  when {
56
65
  // Case 1: Initialize with API key and config
57
66
  apiKey != null && config != null -> {
@@ -60,7 +69,7 @@ class SmileIdModule internal constructor(
60
69
  apiKey = apiKey,
61
70
  config = config.toConfig(),
62
71
  useSandbox = useSandBox,
63
- enableCrashReporting = enableCrashReporting
72
+ enableCrashReporting = enableCrashReporting,
64
73
  )
65
74
  }
66
75
  // Case 2: Initialize with just config
@@ -69,14 +78,14 @@ class SmileIdModule internal constructor(
69
78
  context = reactApplicationContext,
70
79
  config = config.toConfig(),
71
80
  useSandbox = useSandBox,
72
- enableCrashReporting = enableCrashReporting
81
+ enableCrashReporting = enableCrashReporting,
73
82
  )
74
83
  }
75
84
  // Case 3: Basic initialization
76
85
  else -> {
77
86
  SmileID.initialize(
78
87
  context = reactApplicationContext,
79
- useSandbox = useSandBox
88
+ useSandbox = useSandBox,
80
89
  )
81
90
  }
82
91
  }
@@ -87,7 +96,10 @@ class SmileIdModule internal constructor(
87
96
  }
88
97
 
89
98
  @ReactMethod
90
- override fun setCallbackUrl(callbackUrl: String, promise: Promise) {
99
+ override fun setCallbackUrl(
100
+ callbackUrl: String,
101
+ promise: Promise,
102
+ ) {
91
103
  SmileID.setCallbackUrl(callbackUrl = URL(callbackUrl))
92
104
  promise.resolve(null)
93
105
  }
@@ -98,16 +110,22 @@ class SmileIdModule internal constructor(
98
110
  }
99
111
 
100
112
  @ReactMethod
101
- override fun setAllowOfflineMode(allowOfflineMode: Boolean, promise: Promise) {
113
+ override fun setAllowOfflineMode(
114
+ allowOfflineMode: Boolean,
115
+ promise: Promise,
116
+ ) {
102
117
  SmileID.setAllowOfflineMode(allowOfflineMode)
103
118
  promise.resolve(null)
104
119
  }
105
120
 
106
121
  @ReactMethod
107
- override fun submitJob(jobId: String, promise: Promise) = launch(
122
+ override fun submitJob(
123
+ jobId: String,
124
+ promise: Promise,
125
+ ) = launch(
108
126
  work = { SmileID.submitJob(jobId) },
109
127
  clazz = Unit::class.java,
110
- promise = promise
128
+ promise = promise,
111
129
  )
112
130
 
113
131
  @ReactMethod
@@ -137,7 +155,10 @@ class SmileIdModule internal constructor(
137
155
  }
138
156
 
139
157
  @ReactMethod
140
- override fun cleanup(jobId: String, promise: Promise) {
158
+ override fun cleanup(
159
+ jobId: String,
160
+ promise: Promise,
161
+ ) {
141
162
  try {
142
163
  SmileID.cleanup(jobId)
143
164
  promise.resolve(null)
@@ -147,102 +168,141 @@ class SmileIdModule internal constructor(
147
168
  }
148
169
 
149
170
  @ReactMethod
150
- override fun authenticate(request: ReadableMap, promise: Promise) = launch(
171
+ override fun authenticate(
172
+ request: ReadableMap,
173
+ promise: Promise,
174
+ ) = launch(
151
175
  work = {
152
176
  SmileID.api.authenticate(request = request.toAuthenticationRequest())
153
177
  },
154
178
  clazz = AuthenticationResponse::class.java,
155
- promise = promise
179
+ promise = promise,
156
180
  )
157
181
 
158
182
  @ReactMethod
159
- override fun prepUpload(request: ReadableMap, promise: Promise) = launch(
183
+ override fun prepUpload(
184
+ request: ReadableMap,
185
+ promise: Promise,
186
+ ) = launch(
160
187
  work = { SmileID.api.prepUpload(request = request.toPrepUploadRequest()) },
161
188
  clazz = PrepUploadResponse::class.java,
162
- promise = promise
189
+ promise = promise,
163
190
  )
164
191
 
165
192
  @ReactMethod
166
- override fun upload(url: String, request: ReadableMap, promise: Promise) = launch(
193
+ override fun upload(
194
+ url: String,
195
+ request: ReadableMap,
196
+ promise: Promise,
197
+ ) = launch(
167
198
  work = { SmileID.api.upload(url, request.toUploadRequest()) },
168
199
  clazz = Unit::class.java,
169
- promise = promise
200
+ promise = promise,
170
201
  )
171
202
 
172
203
  @ReactMethod
173
- override fun doEnhancedKyc(request: ReadableMap, promise: Promise) = launch(
204
+ override fun doEnhancedKyc(
205
+ request: ReadableMap,
206
+ promise: Promise,
207
+ ) = launch(
174
208
  work = { SmileID.api.doEnhancedKyc(request = request.toEnhancedKycRequest()) },
175
209
  clazz = EnhancedKycResponse::class.java,
176
- promise = promise
210
+ promise = promise,
177
211
  )
178
212
 
179
213
  @ReactMethod
180
- override fun doEnhancedKycAsync(request: ReadableMap, promise: Promise) = launch(
214
+ override fun doEnhancedKycAsync(
215
+ request: ReadableMap,
216
+ promise: Promise,
217
+ ) = launch(
181
218
  work = { SmileID.api.doEnhancedKycAsync(request = request.toEnhancedKycRequest()) },
182
219
  clazz = EnhancedKycAsyncResponse::class.java,
183
- promise = promise
220
+ promise = promise,
184
221
  )
185
222
 
186
223
  @ReactMethod
187
- override fun getSmartSelfieJobStatus(request: ReadableMap, promise: Promise) = launch(
224
+ override fun getSmartSelfieJobStatus(
225
+ request: ReadableMap,
226
+ promise: Promise,
227
+ ) = launch(
188
228
  work = { SmileID.api.getSmartSelfieJobStatus(request = request.toJobStatusRequest()) },
189
229
  clazz = SmartSelfieJobStatusResponse::class.java,
190
- promise = promise
230
+ promise = promise,
191
231
  )
192
232
 
193
233
  @ReactMethod
194
- override fun getDocumentVerificationJobStatus(request: ReadableMap, promise: Promise) = launch(
234
+ override fun getDocumentVerificationJobStatus(
235
+ request: ReadableMap,
236
+ promise: Promise,
237
+ ) = launch(
195
238
  work = { SmileID.api.getDocumentVerificationJobStatus(request = request.toJobStatusRequest()) },
196
239
  clazz = DocumentVerificationJobStatusResponse::class.java,
197
- promise = promise
240
+ promise = promise,
198
241
  )
199
242
 
200
243
  @ReactMethod
201
- override fun getBiometricKycJobStatus(request: ReadableMap, promise: Promise) = launch(
244
+ override fun getBiometricKycJobStatus(
245
+ request: ReadableMap,
246
+ promise: Promise,
247
+ ) = launch(
202
248
  work = { SmileID.api.getBiometricKycJobStatus(request = request.toJobStatusRequest()) },
203
249
  clazz = BiometricKycJobStatusResponse::class.java,
204
- promise = promise
250
+ promise = promise,
205
251
  )
206
252
 
207
253
  @ReactMethod
208
- override fun getEnhancedDocumentVerificationJobStatus(request: ReadableMap, promise: Promise) =
209
- launch(
210
- work = { SmileID.api.getEnhancedDocumentVerificationJobStatus(request = request.toJobStatusRequest()) },
211
- clazz = EnhancedDocumentVerificationJobStatusResponse::class.java,
212
- promise = promise
213
- )
254
+ override fun getEnhancedDocumentVerificationJobStatus(
255
+ request: ReadableMap,
256
+ promise: Promise,
257
+ ) = launch(
258
+ work = { SmileID.api.getEnhancedDocumentVerificationJobStatus(request = request.toJobStatusRequest()) },
259
+ clazz = EnhancedDocumentVerificationJobStatusResponse::class.java,
260
+ promise = promise,
261
+ )
214
262
 
215
263
  @ReactMethod
216
- override fun getProductsConfig(request: ReadableMap, promise: Promise) = launch(
264
+ override fun getProductsConfig(
265
+ request: ReadableMap,
266
+ promise: Promise,
267
+ ) = launch(
217
268
  work = { SmileID.api.getProductsConfig(request = request.toProductsConfigRequest()) },
218
269
  clazz = ProductsConfigResponse::class.java,
219
- promise = promise
270
+ promise = promise,
220
271
  )
221
272
 
222
273
  @ReactMethod
223
- override fun getValidDocuments(request: ReadableMap, promise: Promise) = launch(
274
+ override fun getValidDocuments(
275
+ request: ReadableMap,
276
+ promise: Promise,
277
+ ) = launch(
224
278
  work = { SmileID.api.getValidDocuments(request = request.toProductsConfigRequest()) },
225
279
  clazz = ValidDocumentsResponse::class.java,
226
- promise = promise
280
+ promise = promise,
227
281
  )
228
282
 
229
283
  @ReactMethod
230
- override fun getServices(promise: Promise) = launch(
231
- work = { SmileID.api.getServices() },
232
- clazz = ServicesResponse::class.java,
233
- promise = promise
234
- )
284
+ override fun getServices(promise: Promise) =
285
+ launch(
286
+ work = { SmileID.api.getServices() },
287
+ clazz = ServicesResponse::class.java,
288
+ promise = promise,
289
+ )
235
290
 
236
291
  @ReactMethod
237
- override fun pollSmartSelfieJobStatus(request: ReadableMap, promise: Promise) = launch(
292
+ override fun pollSmartSelfieJobStatus(
293
+ request: ReadableMap,
294
+ promise: Promise,
295
+ ) = launch(
238
296
  work = {
239
297
  val jobStatusRequest = request.toJobStatusRequest()
240
- val interval = request.getIntOrDefault("interval") ?: run {
241
- throw IllegalArgumentException("interval is required")
242
- }
243
- val numAttempts = request.getIntOrDefault("numAttempts") ?: run {
244
- throw IllegalArgumentException("numAttempts is required")
245
- }
298
+ val interval =
299
+ request.getIntOrDefault("interval") ?: run {
300
+ throw IllegalArgumentException("interval is required")
301
+ }
302
+ val numAttempts =
303
+ request.getIntOrDefault("numAttempts") ?: run {
304
+ throw IllegalArgumentException("numAttempts is required")
305
+ }
246
306
  pollJobStatus(
247
307
  apiCall = SmileID.api::pollSmartSelfieJobStatus,
248
308
  request = jobStatusRequest,
@@ -251,19 +311,24 @@ class SmileIdModule internal constructor(
251
311
  )
252
312
  },
253
313
  clazz = SmartSelfieJobStatusResponse::class.java,
254
- promise = promise
314
+ promise = promise,
255
315
  )
256
316
 
257
317
  @ReactMethod
258
- override fun pollDocumentVerificationJobStatus(request: ReadableMap, promise: Promise) = launch(
318
+ override fun pollDocumentVerificationJobStatus(
319
+ request: ReadableMap,
320
+ promise: Promise,
321
+ ) = launch(
259
322
  work = {
260
323
  val jobStatusRequest = request.toJobStatusRequest()
261
- val interval = request.getIntOrDefault("interval") ?: run {
262
- throw IllegalArgumentException("interval is required")
263
- }
264
- val numAttempts = request.getIntOrDefault("numAttempts") ?: run {
265
- throw IllegalArgumentException("numAttempts is required")
266
- }
324
+ val interval =
325
+ request.getIntOrDefault("interval") ?: run {
326
+ throw IllegalArgumentException("interval is required")
327
+ }
328
+ val numAttempts =
329
+ request.getIntOrDefault("numAttempts") ?: run {
330
+ throw IllegalArgumentException("numAttempts is required")
331
+ }
267
332
  pollJobStatus(
268
333
  apiCall = SmileID.api::pollDocumentVerificationJobStatus,
269
334
  request = jobStatusRequest,
@@ -272,19 +337,24 @@ class SmileIdModule internal constructor(
272
337
  )
273
338
  },
274
339
  clazz = DocumentVerificationJobStatusResponse::class.java,
275
- promise = promise
340
+ promise = promise,
276
341
  )
277
342
 
278
343
  @ReactMethod
279
- override fun pollBiometricKycJobStatus(request: ReadableMap, promise: Promise) = launch(
344
+ override fun pollBiometricKycJobStatus(
345
+ request: ReadableMap,
346
+ promise: Promise,
347
+ ) = launch(
280
348
  work = {
281
349
  val jobStatusRequest = request.toJobStatusRequest()
282
- val interval = request.getIntOrDefault("interval") ?: run {
283
- throw IllegalArgumentException("interval is required")
284
- }
285
- val numAttempts = request.getIntOrDefault("numAttempts") ?: run {
286
- throw IllegalArgumentException("numAttempts is required")
287
- }
350
+ val interval =
351
+ request.getIntOrDefault("interval") ?: run {
352
+ throw IllegalArgumentException("interval is required")
353
+ }
354
+ val numAttempts =
355
+ request.getIntOrDefault("numAttempts") ?: run {
356
+ throw IllegalArgumentException("numAttempts is required")
357
+ }
288
358
  pollJobStatus(
289
359
  apiCall = SmileID.api::pollBiometricKycJobStatus,
290
360
  request = jobStatusRequest,
@@ -293,53 +363,58 @@ class SmileIdModule internal constructor(
293
363
  )
294
364
  },
295
365
  clazz = BiometricKycJobStatusResponse::class.java,
296
- promise = promise
366
+ promise = promise,
297
367
  )
298
368
 
299
369
  @ReactMethod
300
- override fun pollEnhancedDocumentVerificationJobStatus(request: ReadableMap, promise: Promise) =
301
- launch(
302
- work = {
303
- val jobStatusRequest = request.toJobStatusRequest()
304
- val interval = request.getIntOrDefault("interval") ?: run {
370
+ override fun pollEnhancedDocumentVerificationJobStatus(
371
+ request: ReadableMap,
372
+ promise: Promise,
373
+ ) = launch(
374
+ work = {
375
+ val jobStatusRequest = request.toJobStatusRequest()
376
+ val interval =
377
+ request.getIntOrDefault("interval") ?: run {
305
378
  throw IllegalArgumentException("interval is required")
306
379
  }
307
- val numAttempts = request.getIntOrDefault("numAttempts") ?: run {
380
+ val numAttempts =
381
+ request.getIntOrDefault("numAttempts") ?: run {
308
382
  throw IllegalArgumentException("numAttempts is required")
309
383
  }
310
- pollJobStatus(
311
- apiCall = SmileID.api::pollEnhancedDocumentVerificationJobStatus,
312
- request = jobStatusRequest,
313
- interval = interval.toLong(),
314
- numAttempts = numAttempts.toLong(),
315
- )
316
- },
317
- clazz = EnhancedDocumentVerificationJobStatusResponse::class.java,
318
- promise = promise
319
- )
384
+ pollJobStatus(
385
+ apiCall = SmileID.api::pollEnhancedDocumentVerificationJobStatus,
386
+ request = jobStatusRequest,
387
+ interval = interval.toLong(),
388
+ numAttempts = numAttempts.toLong(),
389
+ )
390
+ },
391
+ clazz = EnhancedDocumentVerificationJobStatusResponse::class.java,
392
+ promise = promise,
393
+ )
320
394
 
321
395
  private suspend fun <RequestType, ResponseType> pollJobStatus(
322
396
  apiCall: suspend (RequestType, Duration, Int) -> Flow<ResponseType>,
323
397
  request: RequestType,
324
398
  interval: Long,
325
399
  numAttempts: Long,
326
- ): ResponseType {
327
- return try {
400
+ ): ResponseType =
401
+ try {
328
402
  val response =
329
403
  withContext(Dispatchers.IO) {
330
404
  apiCall(request, interval.milliseconds, numAttempts.toInt())
331
405
  .map {
332
406
  it
333
- }
334
- .last()
407
+ }.last()
335
408
  }
336
409
  response
337
410
  } catch (e: Exception) {
338
411
  throw e
339
412
  }
340
- }
341
413
 
342
- private fun <T> toJson(result: T, clazz: Class<T>): String {
414
+ private fun <T> toJson(
415
+ result: T,
416
+ clazz: Class<T>,
417
+ ): String {
343
418
  val adapter = SmileID.moshi.adapter(clazz)
344
419
  return adapter.toJson(result)
345
420
  }
@@ -348,11 +423,12 @@ class SmileIdModule internal constructor(
348
423
  work: suspend () -> T,
349
424
  clazz: Class<T>,
350
425
  promise: Promise,
351
- scope: CoroutineScope = CoroutineScope(Dispatchers.IO)
426
+ scope: CoroutineScope = CoroutineScope(Dispatchers.IO),
352
427
  ) {
353
- val handler = CoroutineExceptionHandler { _, throwable ->
354
- promise.reject(throwable)
355
- }
428
+ val handler =
429
+ CoroutineExceptionHandler { _, throwable ->
430
+ promise.reject(throwable)
431
+ }
356
432
  scope.launch(handler) {
357
433
  try {
358
434
  val result = work()
@@ -4,6 +4,7 @@ import com.facebook.react.bridge.ReactApplicationContext
4
4
  import com.facebook.react.bridge.ReadableMap
5
5
  import com.facebook.react.module.annotations.ReactModule
6
6
  import com.smileidentity.models.ConsentInformation
7
+ import com.smileidentity.models.ConsentedInformation
7
8
  import com.smileidentity.react.toConsentInfo
8
9
  import com.smileidentity.react.toIdInfo
9
10
  import com.smileidentity.react.utils.getBoolOrDefault
@@ -31,11 +32,13 @@ class SmileIDBiometricKYCViewManager(
31
32
  val idInfo = idInfoMap.toIdInfo()
32
33
  view.consentInformation = it.getMapOrDefault("consentInformation")?.toConsentInfo()
33
34
  ?: ConsentInformation(
34
- consentGrantedDate = getCurrentIsoTimestamp(),
35
- personalDetailsConsentGranted = false,
36
- contactInfoConsentGranted = false,
37
- documentInfoConsentGranted = false
38
- )
35
+ consented = ConsentedInformation(
36
+ consentGrantedDate = getCurrentIsoTimestamp(),
37
+ personalDetails = false,
38
+ contactInformation = false,
39
+ documentInformation = false
40
+ ),
41
+ )
39
42
  view.extraPartnerParams = it.getImmutableMapOrDefault("extraPartnerParams")
40
43
  view.userId = it.getStringOrDefault("userId")
41
44
  view.jobId = it.getStringOrDefault("jobId")
@@ -7,6 +7,7 @@ import com.facebook.react.module.annotations.ReactModule
7
7
  import com.facebook.react.uimanager.SimpleViewManager
8
8
  import com.facebook.react.uimanager.ThemedReactContext
9
9
  import com.smileidentity.models.ConsentInformation
10
+ import com.smileidentity.models.ConsentedInformation
10
11
  import com.smileidentity.react.toConsentInfo
11
12
  import com.smileidentity.react.toIdInfo
12
13
  import com.smileidentity.react.utils.getBoolOrDefault
@@ -37,10 +38,12 @@ class SmileIDEnhancedDocumentVerificationViewManager(
37
38
  )
38
39
  view.consentInformation = it.getMapOrDefault("consentInformation")?.toConsentInfo()
39
40
  ?: ConsentInformation(
40
- consentGrantedDate = getCurrentIsoTimestamp(),
41
- personalDetailsConsentGranted = false,
42
- contactInfoConsentGranted = false,
43
- documentInfoConsentGranted = false
41
+ consented = ConsentedInformation(
42
+ consentGrantedDate = getCurrentIsoTimestamp(),
43
+ personalDetails = false,
44
+ contactInformation = false,
45
+ documentInformation = false
46
+ ),
44
47
  )
45
48
  view.extraPartnerParams = it.getImmutableMapOrDefault("extraPartnerParams")
46
49
  view.userId = it.getStringOrDefault("userId")