@smile_identity/react-native 10.2.5 → 10.2.6

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 (37) hide show
  1. package/android/gradle.properties +1 -1
  2. package/android/src/main/java/com/smileidentity/react/Mapper.kt +6 -1
  3. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDBiometricKYCViewManager.kt +9 -3
  4. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDDocumentVerificationViewManager.kt +0 -1
  5. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDEnhancedDocumentVerificationViewManager.kt +12 -5
  6. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieAuthenticationEnhancedViewManager.kt +1 -0
  7. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieCaptureViewManager.kt +1 -0
  8. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieEnrollmentEnhancedViewManager.kt +1 -0
  9. package/android/src/main/java/com/smileidentity/react/views/SmileIDSelfieView.kt +48 -0
  10. package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieAuthenticationEnhancedView.kt +5 -30
  11. package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieAuthenticationView.kt +7 -32
  12. package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieCaptureView.kt +30 -189
  13. package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieEnrollmentEnhancedView.kt +5 -35
  14. package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieEnrollmentView.kt +7 -40
  15. package/ios/RNSmileID.swift +11 -4
  16. package/ios/Utils/SmileIDDictExt.swift +241 -230
  17. package/ios/View/SmileIDBiometricKYCView.swift +2 -2
  18. package/ios/View/SmileIDEnhancedDocumentVerificationView.swift +2 -2
  19. package/ios/View/SmileIDSmartSelfieAuthEnhancedView.swift +35 -34
  20. package/ios/View/SmileIDSmartSelfieAuthView.swift +2 -0
  21. package/ios/View/SmileIDSmartSelfieCaptureView.swift +27 -33
  22. package/ios/View/SmileIDSmartSelfieEnrollmentEnhancedView.swift +1 -0
  23. package/ios/ViewManagers/SmileIDBiometricKYCViewManager.swift +35 -30
  24. package/ios/ViewManagers/SmileIDEnhancedDocumentVerificationViewManager.swift +52 -47
  25. package/ios/ViewManagers/SmileIDSmartSelfieAuthenticationEnhancedViewManager.swift +7 -2
  26. package/ios/ViewManagers/SmileIDSmartSelfieCaptureViewManager.swift +1 -0
  27. package/ios/ViewManagers/SmileIDSmartSelfieEnrollmentEnhancedViewManager.swift +1 -0
  28. package/ios/ViewModels/SmileIDProductModel.swift +29 -24
  29. package/lib/commonjs/types.js +2 -1
  30. package/lib/commonjs/types.js.map +1 -1
  31. package/lib/module/types.js +2 -1
  32. package/lib/module/types.js.map +1 -1
  33. package/lib/typescript/types.d.ts +5 -4
  34. package/lib/typescript/types.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/react-native-smile-id.podspec +1 -1
  37. package/src/types.ts +7 -4
@@ -1,7 +1,6 @@
1
1
  package com.smileidentity.react.views
2
2
 
3
3
  import android.content.Context
4
- import android.util.Log
5
4
  import androidx.compose.runtime.CompositionLocalProvider
6
5
  import androidx.compose.runtime.saveable.rememberSaveable
7
6
  import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
@@ -9,15 +8,12 @@ import com.smileidentity.SmileID
9
8
  import com.smileidentity.compose.SmartSelfieEnrollment
10
9
  import com.smileidentity.react.results.SmartSelfieCaptureResult
11
10
  import com.smileidentity.react.utils.SelfieCaptureResultAdapter
11
+ import com.smileidentity.results.SmartSelfieResult
12
12
  import com.smileidentity.results.SmileIDResult
13
+ import com.smileidentity.util.randomJobId
13
14
  import com.smileidentity.util.randomUserId
14
- import kotlinx.coroutines.CoroutineScope
15
- import kotlinx.coroutines.Dispatchers
16
- import kotlinx.coroutines.Job
17
- import kotlinx.coroutines.launch
18
15
 
19
- class SmileIDSmartSelfieEnrollmentView(context: Context) : SmileIDView(context) {
20
- private val viewScope = CoroutineScope(Dispatchers.Main + Job())
16
+ class SmileIDSmartSelfieEnrollmentView(context: Context) : SmileIDSelfieView(context) {
21
17
  override fun renderContent() {
22
18
  composeView.apply {
23
19
  setContent {
@@ -25,44 +21,15 @@ class SmileIDSmartSelfieEnrollmentView(context: Context) : SmileIDView(context)
25
21
  CompositionLocalProvider(LocalViewModelStoreOwner provides customViewModelStoreOwner) {
26
22
  SmileID.SmartSelfieEnrollment(
27
23
  userId = userId ?: rememberSaveable { randomUserId() },
24
+ jobId = jobId ?: rememberSaveable { randomJobId() },
28
25
  allowAgentMode = allowAgentMode ?: false,
29
26
  allowNewEnroll = allowNewEnroll ?: false,
30
27
  showAttribution = showAttribution,
31
28
  showInstructions = showInstructions,
29
+ skipApiSubmission = skipApiSubmission,
32
30
  extraPartnerParams = extraPartnerParams,
33
- ) { res ->
34
- viewScope.launch {
35
- when (res) {
36
- is SmileIDResult.Success -> {
37
- val result =
38
- SmartSelfieCaptureResult(
39
- selfieFile = res.data.selfieFile,
40
- livenessFiles = res.data.livenessFiles,
41
- apiResponse = res.data.apiResponse,
42
- )
43
- val newMoshi =
44
- SmileID.moshi
45
- .newBuilder()
46
- .add(SelfieCaptureResultAdapter.FACTORY)
47
- .build()
48
- val json =
49
- try {
50
- newMoshi
51
- .adapter(SmartSelfieCaptureResult::class.java)
52
- .toJson(result)
53
- } catch (e: Exception) {
54
- emitFailure(e)
55
- return@launch
56
- }
57
- json?.let { js ->
58
- emitSuccess(js)
59
- }
60
- }
61
-
62
- is SmileIDResult.Error -> emitFailure(res.throwable)
63
- }
64
- }
65
- }
31
+ onResult = { res -> handleResultCallback(res)},
32
+ )
66
33
  }
67
34
  }
68
35
  }
@@ -171,16 +171,23 @@ class RNSmileID: NSObject {
171
171
  return
172
172
  }
173
173
 
174
- guard let consentInformation = request["consentInformation"] as? NSDictionary else {
175
- reject("doEnhancedKyc", "consentInformation is required", nil)
176
- return
174
+ let consentInfo: ConsentInformation
175
+ if let consentInformation = request["consentInformation"] as? NSDictionary{
176
+ consentInfo = consentInformation.toConsentInfo()
177
+ } else {
178
+ consentInfo = ConsentInformation(
179
+ consentGrantedDate: getCurrentIsoTimestamp(),
180
+ personalDetailsConsentGranted: false,
181
+ contactInformationConsentGranted: false,
182
+ documentInformationConsentGranted: false
183
+ )
177
184
  }
178
185
 
179
186
  let request = EnhancedKycRequest(
180
187
  country: country,
181
188
  idType: idType,
182
189
  idNumber: idNumber,
183
- consentInformation: consentInformation.toConsentInfo(),
190
+ consentInformation: consentInfo,
184
191
  firstName: request["firstName"] as? String,
185
192
  middleName: request["middleName"] as? String,
186
193
  lastName: request["lastName"] as? String,
@@ -2,250 +2,261 @@ import Foundation
2
2
  import SmileID
3
3
 
4
4
  extension NSDictionary {
5
- func toConfig() -> Config {
6
- return Config(
7
- partnerId: (self["partnerId"] as? String)!,
8
- authToken: (self["authToken"] as? String)!,
9
- prodLambdaUrl: (self["prodLambdaUrl"] as? String)!,
10
- testLambdaUrl: (self["testLambdaUrl"] as? String)!
11
- )
5
+ func toConfig() -> Config {
6
+ return Config(
7
+ partnerId: (self["partnerId"] as? String)!,
8
+ authToken: (self["authToken"] as? String)!,
9
+ prodLambdaUrl: (self["prodLambdaUrl"] as? String)!,
10
+ testLambdaUrl: (self["testLambdaUrl"] as? String)!
11
+ )
12
+ }
13
+
14
+ func toAuthenticationRequest() -> AuthenticationRequest? {
15
+ guard let jobTypeValue = self["jobType"] as? Int,
16
+ let jobType = JobType(rawValue: jobTypeValue),
17
+ let jobId = self["jobId"] as? String,
18
+ let userId = self["userId"] as? String
19
+ else {
20
+ return nil
12
21
  }
13
-
14
- func toAuthenticationRequest() -> AuthenticationRequest? {
15
- guard let jobTypeValue = self["jobType"] as? Int,
16
- let jobType = JobType(rawValue: jobTypeValue),
17
- let jobId = self["jobId"] as? String,
18
- let userId = self["userId"] as? String
19
- else {
20
- return nil
21
- }
22
-
23
- let country = self["country"] as? String
24
- let idType = self["idType"] as? String
25
- let updateEnrolledImage = self["updateEnrolledImage"] as? Bool
26
-
27
- return AuthenticationRequest(
28
- jobType: jobType,
29
- updateEnrolledImage: updateEnrolledImage,
30
- jobId: jobId,
31
- userId: userId,
32
- country: country,
33
- idType: idType
34
- )
22
+
23
+ let country = self["country"] as? String
24
+ let idType = self["idType"] as? String
25
+ let updateEnrolledImage = self["updateEnrolledImage"] as? Bool
26
+
27
+ return AuthenticationRequest(
28
+ jobType: jobType,
29
+ updateEnrolledImage: updateEnrolledImage,
30
+ jobId: jobId,
31
+ userId: userId,
32
+ country: country,
33
+ idType: idType
34
+ )
35
+ }
36
+
37
+ func toPrepUploadRequest() -> PrepUploadRequest? {
38
+ guard let partnerParamsDict = self["partnerParams"] as? NSDictionary,
39
+ let partnerParams = partnerParamsDict.toPartnerParams(),
40
+ let callbackUrl = self["callbackUrl"] as? String,
41
+ let partnerId = self["partnerId"] as? String,
42
+ let timestamp = self["timestamp"] as? String,
43
+ let signature = self["signature"] as? String
44
+ else {
45
+ return nil
35
46
  }
36
-
37
- func toPrepUploadRequest() -> PrepUploadRequest? {
38
- guard let partnerParamsDict = self["partnerParams"] as? NSDictionary,
39
- let partnerParams = partnerParamsDict.toPartnerParams(),
40
- let callbackUrl = self["callbackUrl"] as? String,
41
- let partnerId = self["partnerId"] as? String,
42
- let timestamp = self["timestamp"] as? String,
43
- let signature = self["signature"] as? String
44
- else {
45
- return nil
46
- }
47
-
48
- return PrepUploadRequest(
49
- partnerParams: partnerParams,
50
- callbackUrl: callbackUrl,
51
- partnerId: partnerId,
52
- sourceSdk: self["sourceSdk"] as? String ?? "ios (react-native)",
53
- timestamp: timestamp,
54
- signature: signature
55
- )
47
+
48
+ return PrepUploadRequest(
49
+ partnerParams: partnerParams,
50
+ callbackUrl: callbackUrl,
51
+ partnerId: partnerId,
52
+ sourceSdk: self["sourceSdk"] as? String ?? "ios (react-native)",
53
+ timestamp: timestamp,
54
+ signature: signature
55
+ )
56
+ }
57
+
58
+ func toUploadRequest() -> UploadRequest? {
59
+ guard let imagesArray = self["images"] as? [NSDictionary] else {
60
+ return nil
56
61
  }
57
-
58
- func toUploadRequest() -> UploadRequest? {
59
- guard let imagesArray = self["images"] as? [NSDictionary] else {
60
- return nil
61
- }
62
- let images = imagesArray.compactMap { $0.toUploadImageInfo() }
63
- let idInfo = (self["idInfo"] as? NSDictionary)?.toIdInfo()
64
-
65
- return UploadRequest(
66
- images: images,
67
- idInfo: idInfo
68
- )
62
+ let images = imagesArray.compactMap { $0.toUploadImageInfo() }
63
+ let idInfo = (self["idInfo"] as? NSDictionary)?.toIdInfo()
64
+
65
+ return UploadRequest(
66
+ images: images,
67
+ idInfo: idInfo
68
+ )
69
+ }
70
+
71
+ func toUploadImageInfo() -> UploadImageInfo? {
72
+ guard let imageTypeIdValue = self["imageTypeId"] as? String,
73
+ let imageTypeId = ImageType(rawValue: imageTypeIdValue),
74
+ let imageName = self["imageName"] as? String
75
+ else {
76
+ return nil
69
77
  }
70
-
71
- func toUploadImageInfo() -> UploadImageInfo? {
72
- guard let imageTypeIdValue = self["imageTypeId"] as? String,
73
- let imageTypeId = ImageType(rawValue: imageTypeIdValue),
74
- let imageName = self["imageName"] as? String
75
- else {
76
- return nil
77
- }
78
-
79
- return UploadImageInfo(
80
- imageTypeId: imageTypeId,
81
- fileName: imageName
82
- )
78
+
79
+ return UploadImageInfo(
80
+ imageTypeId: imageTypeId,
81
+ fileName: imageName
82
+ )
83
+ }
84
+
85
+ func toIdInfo() -> IdInfo? {
86
+ guard let country = self["country"] as? String else {
87
+ return nil
83
88
  }
84
-
85
- func toIdInfo() -> IdInfo? {
86
- guard let country = self["country"] as? String else {
87
- return nil
88
- }
89
-
90
- let idType = self["idType"] as? String
91
- let idNumber = self["idNumber"] as? String
92
- let firstName = self["firstName"] as? String
93
- let middleName = self["middleName"] as? String
94
- let lastName = self["lastName"] as? String
95
- let dob = self["dob"] as? String
96
- let bankCode = self["bankCode"] as? String
97
- let entered = self["entered"] as? Bool
98
-
99
- return IdInfo(
100
- country: country,
101
- idType: idType,
102
- idNumber: idNumber,
103
- firstName: firstName,
104
- middleName: middleName,
105
- lastName: lastName,
106
- dob: dob,
107
- bankCode: bankCode,
108
- entered: entered
109
- )
89
+
90
+ let idType = self["idType"] as? String
91
+ let idNumber = self["idNumber"] as? String
92
+ let firstName = self["firstName"] as? String
93
+ let middleName = self["middleName"] as? String
94
+ let lastName = self["lastName"] as? String
95
+ let dob = self["dob"] as? String
96
+ let bankCode = self["bankCode"] as? String
97
+ let entered = self["entered"] as? Bool
98
+
99
+ return IdInfo(
100
+ country: country,
101
+ idType: idType,
102
+ idNumber: idNumber,
103
+ firstName: firstName,
104
+ middleName: middleName,
105
+ lastName: lastName,
106
+ dob: dob,
107
+ bankCode: bankCode,
108
+ entered: entered
109
+ )
110
+ }
111
+
112
+ func toConsentInfo() -> ConsentInformation {
113
+ let consentGrantedDate = self["consentGrantedDate"] as? String ?? getCurrentIsoTimestamp()
114
+ let personalDetailsConsentGranted = self["personalDetailsConsentGranted"] as? Bool ?? false
115
+ let contactInfoConsentGranted = self["contactInfoConsentGranted"] as? Bool ?? false
116
+ let documentInfoConsentGranted = self["documentInfoConsentGranted"] as? Bool ?? false
117
+ return ConsentInformation(
118
+ consentGrantedDate: consentGrantedDate,
119
+ personalDetailsConsentGranted: personalDetailsConsentGranted,
120
+ contactInformationConsentGranted: contactInfoConsentGranted,
121
+ documentInformationConsentGranted: documentInfoConsentGranted
122
+ )
123
+ }
124
+
125
+ func toEnhancedKycRequest() -> EnhancedKycRequest? {
126
+ guard let country = self["country"] as? String,
127
+ let idType = self["idType"] as? String,
128
+ let idNumber = self["idNumber"] as? String,
129
+ let firstName = self["firstName"] as? String,
130
+ let middleName = self["middleName"] as? String,
131
+ let lastName = self["lastName"] as? String,
132
+ let dob = self["dob"] as? String,
133
+ let phoneNumber = self["phoneNumber"] as? String,
134
+ let bankCode = self["bankCode"] as? String,
135
+ let callbackUrl = self["callbackUrl"] as? String,
136
+ let partnerParamsDict = self["partnerParams"] as? NSDictionary,
137
+ let partnerParams = partnerParamsDict.toPartnerParams(),
138
+ let timestamp = self["timestamp"] as? String,
139
+ let signature = self["signature"] as? String
140
+ else {
141
+ return nil
110
142
  }
111
-
112
- func toConsentInfo() -> ConsentInformation {
113
- let consentGrantedDate = self["consentGrantedDate"] as? String ?? getCurrentIsoTimestamp()
114
- let personalDetailsConsentGranted = self["personalDetailsConsentGranted"] as? Bool ?? false
115
- let contactInfoConsentGranted = self["contactInfoConsentGranted"] as? Bool ?? false
116
- let documentInfoConsentGranted = self["documentInfoConsentGranted"] as? Bool ?? false
117
- return ConsentInformation(
118
- consentGrantedDate: consentGrantedDate,
119
- personalDetailsConsentGranted: personalDetailsConsentGranted,
120
- contactInformationConsentGranted: contactInfoConsentGranted,
121
- documentInformationConsentGranted: documentInfoConsentGranted
122
- )
143
+
144
+ let consentInfo: ConsentInformation
145
+ if let consentInformation = self["consentInformation"] as? NSDictionary{
146
+ consentInfo = consentInformation.toConsentInfo()
147
+ } else {
148
+ consentInfo = ConsentInformation(
149
+ consentGrantedDate: getCurrentIsoTimestamp(),
150
+ personalDetailsConsentGranted: false,
151
+ contactInformationConsentGranted: false,
152
+ documentInformationConsentGranted: false
153
+ )
123
154
  }
124
-
125
- func toEnhancedKycRequest() -> EnhancedKycRequest? {
126
- guard let country = self["country"] as? String,
127
- let idType = self["idType"] as? String,
128
- let idNumber = self["idNumber"] as? String,
129
- let firstName = self["firstName"] as? String,
130
- let middleName = self["middleName"] as? String,
131
- let lastName = self["lastName"] as? String,
132
- let dob = self["dob"] as? String,
133
- let phoneNumber = self["phoneNumber"] as? String,
134
- let bankCode = self["bankCode"] as? String,
135
- let callbackUrl = self["callbackUrl"] as? String,
136
- let partnerParamsDict = self["partnerParams"] as? NSDictionary,
137
- let consentInformation = self["consentInformation"] as? NSDictionary,
138
- let partnerParams = partnerParamsDict.toPartnerParams(),
139
- let timestamp = self["timestamp"] as? String,
140
- let signature = self["signature"] as? String
141
- else {
142
- return nil
143
- }
144
-
145
- return EnhancedKycRequest(
146
- country: country,
147
- idType: idType,
148
- idNumber: idNumber,
149
- consentInformation: consentInformation.toConsentInfo(),
150
- firstName: firstName,
151
- middleName: middleName,
152
- lastName: lastName,
153
- dob: dob,
154
- phoneNumber: phoneNumber,
155
- bankCode: bankCode,
156
- callbackUrl: callbackUrl,
157
- partnerParams: partnerParams,
158
- sourceSdk: self["sourceSdk"] as? String ?? "ios (react-native)",
159
- timestamp: timestamp,
160
- signature: signature
161
- )
155
+
156
+ return EnhancedKycRequest(
157
+ country: country,
158
+ idType: idType,
159
+ idNumber: idNumber,
160
+ consentInformation: consentInfo,
161
+ firstName: firstName,
162
+ middleName: middleName,
163
+ lastName: lastName,
164
+ dob: dob,
165
+ phoneNumber: phoneNumber,
166
+ bankCode: bankCode,
167
+ callbackUrl: callbackUrl,
168
+ partnerParams: partnerParams,
169
+ sourceSdk: self["sourceSdk"] as? String ?? "ios (react-native)",
170
+ timestamp: timestamp,
171
+ signature: signature
172
+ )
173
+ }
174
+
175
+ func toJobStatusRequest() -> JobStatusRequest? {
176
+ guard let userId = self["userId"] as? String,
177
+ let jobId = self["jobId"] as? String,
178
+ let includeImageLinks = self["includeImageLinks"] as? Bool,
179
+ let includeHistory = self["includeHistory"] as? Bool,
180
+ let partnerId = self["partnerId"] as? String,
181
+ let timestamp = self["timestamp"] as? String,
182
+ let signature = self["signature"] as? String
183
+ else {
184
+ return nil
162
185
  }
163
-
164
- func toJobStatusRequest() -> JobStatusRequest? {
165
- guard let userId = self["userId"] as? String,
166
- let jobId = self["jobId"] as? String,
167
- let includeImageLinks = self["includeImageLinks"] as? Bool,
168
- let includeHistory = self["includeHistory"] as? Bool,
169
- let partnerId = self["partnerId"] as? String,
170
- let timestamp = self["timestamp"] as? String,
171
- let signature = self["signature"] as? String
172
- else {
173
- return nil
174
- }
175
-
176
- return JobStatusRequest(
177
- userId: userId,
178
- jobId: jobId,
179
- includeImageLinks: includeImageLinks,
180
- includeHistory: includeHistory,
181
- partnerId: partnerId,
182
- timestamp: timestamp,
183
- signature: signature
184
- )
186
+
187
+ return JobStatusRequest(
188
+ userId: userId,
189
+ jobId: jobId,
190
+ includeImageLinks: includeImageLinks,
191
+ includeHistory: includeHistory,
192
+ partnerId: partnerId,
193
+ timestamp: timestamp,
194
+ signature: signature
195
+ )
196
+ }
197
+
198
+ func toProductsConfigRequest() -> ProductsConfigRequest? {
199
+ guard let partnerId = self["partnerId"] as? String,
200
+ let timestamp = self["timestamp"] as? String,
201
+ let signature = self["signature"] as? String
202
+ else {
203
+ return nil
185
204
  }
186
-
187
- func toProductsConfigRequest() -> ProductsConfigRequest? {
188
- guard let partnerId = self["partnerId"] as? String,
189
- let timestamp = self["timestamp"] as? String,
190
- let signature = self["signature"] as? String
191
- else {
192
- return nil
193
- }
194
-
195
- return ProductsConfigRequest(
196
- timestamp: timestamp,
197
- signature: signature,
198
- partnerId: partnerId
199
- )
205
+
206
+ return ProductsConfigRequest(
207
+ timestamp: timestamp,
208
+ signature: signature,
209
+ partnerId: partnerId
210
+ )
211
+ }
212
+
213
+ func toPartnerParams() -> PartnerParams? {
214
+ guard let country = self["country"] as? String else {
215
+ return nil
200
216
  }
201
-
202
- func toPartnerParams() -> PartnerParams? {
203
- guard let country = self["country"] as? String else {
204
- return nil
205
- }
206
- var jobType: JobType?
207
- let jobId = self["jobId"] as? String
208
- let userId = self["userId"] as? String
209
- if let jobTypeValue = self["jobType"] as? Int {
210
- jobType = JobType(rawValue: jobTypeValue)
211
- }
212
- let extras = self["extras"] as? [String: String] ?? [:]
213
- return PartnerParams(
214
- jobId: jobId ?? generateJobId(),
215
- userId: userId ?? generateUserId(),
216
- jobType: jobType,
217
- extras: extras
218
- )
217
+ var jobType: JobType?
218
+ let jobId = self["jobId"] as? String
219
+ let userId = self["userId"] as? String
220
+ if let jobTypeValue = self["jobType"] as? Int {
221
+ jobType = JobType(rawValue: jobTypeValue)
219
222
  }
223
+ let extras = self["extras"] as? [String: String] ?? [:]
224
+ return PartnerParams(
225
+ jobId: jobId ?? generateJobId(),
226
+ userId: userId ?? generateUserId(),
227
+ jobType: jobType,
228
+ extras: extras
229
+ )
230
+ }
220
231
  }
221
232
 
222
233
  extension Dictionary where Key == String, Value == Any {
223
- func toJSONCompatibleDictionary() -> [String: Any] {
224
- var jsonCompatibleDict = [String: Any]()
225
- for (key, value) in self {
226
- if let arrayValue = value as? [Any] {
227
- jsonCompatibleDict[key] = arrayValue.map { convertToJSONCompatible($0) }
228
- } else {
229
- jsonCompatibleDict[key] = convertToJSONCompatible(value)
230
- }
231
- }
232
- return jsonCompatibleDict
234
+ func toJSONCompatibleDictionary() -> [String: Any] {
235
+ var jsonCompatibleDict = [String: Any]()
236
+ for (key, value) in self {
237
+ if let arrayValue = value as? [Any] {
238
+ jsonCompatibleDict[key] = arrayValue.map { convertToJSONCompatible($0) }
239
+ } else {
240
+ jsonCompatibleDict[key] = convertToJSONCompatible(value)
241
+ }
233
242
  }
234
-
235
- private func convertToJSONCompatible(_ value: Any) -> Any {
236
- switch value {
237
- case let url as URL:
238
- return url.absoluteString
239
- case let bool as Bool:
240
- return bool
241
- case let string as String:
242
- return string
243
- case let number as NSNumber:
244
- return number
245
- case let dict as [String: Any]:
246
- return dict.toJSONCompatibleDictionary()
247
- default:
248
- return String(describing: value)
249
- }
243
+ return jsonCompatibleDict
244
+ }
245
+
246
+ private func convertToJSONCompatible(_ value: Any) -> Any {
247
+ switch value {
248
+ case let url as URL:
249
+ return url.absoluteString
250
+ case let bool as Bool:
251
+ return bool
252
+ case let string as String:
253
+ return string
254
+ case let number as NSNumber:
255
+ return number
256
+ case let dict as [String: Any]:
257
+ return dict.toJSONCompatibleDictionary()
258
+ default:
259
+ return String(describing: value)
250
260
  }
261
+ }
251
262
  }
@@ -8,10 +8,9 @@ struct SmileIDBiometricKYCView: View, SmileIDFileUtilsProtocol {
8
8
  var smileIDUIViewDelegate: SmileIDUIViewDelegate
9
9
  var body: some View {
10
10
  NavigationView {
11
- if let idInfo = product.idInfo, let consentInformation = product.consentInformation {
11
+ if let idInfo = product.idInfo {
12
12
  SmileID.biometricKycScreen(
13
13
  idInfo: idInfo,
14
- consentInformation: consentInformation, // already validated in the SmileIDBiometricKYCViewManager
15
14
  userId: product.userId ?? generateUserId(),
16
15
  jobId: product.jobId ?? generateJobId(),
17
16
  allowNewEnroll: product.allowNewEnroll,
@@ -20,6 +19,7 @@ struct SmileIDBiometricKYCView: View, SmileIDFileUtilsProtocol {
20
19
  showInstructions: product.showInstructions,
21
20
  useStrictMode: product.useStrictMode,
22
21
  extraPartnerParams: product.extraPartnerParams as [String: String],
22
+ consentInformation: product.consentInformation, // already validated in the SmileIDBiometricKYCViewManager
23
23
  delegate: self
24
24
  )
25
25
  } else {
@@ -8,11 +8,10 @@ struct SmileIDEnhancedDocumentVerificationView: View, SmileIDFileUtilsProtocol {
8
8
  var smileIDUIViewDelegate: SmileIDUIViewDelegate
9
9
  var body: some View {
10
10
  NavigationView {
11
- if let countryCode = product.countryCode, let consentInformation = product.consentInformation {
11
+ if let countryCode = product.countryCode {
12
12
  SmileID.enhancedDocumentVerificationScreen(
13
13
  userId: product.userId ?? generateUserId(),
14
14
  jobId: product.jobId ?? generateJobId(),
15
- consentInformation: consentInformation,
16
15
  allowNewEnroll: product.allowNewEnroll,
17
16
  countryCode: countryCode, // already validated in the view manager
18
17
  documentType: product.documentType,
@@ -26,6 +25,7 @@ struct SmileIDEnhancedDocumentVerificationView: View, SmileIDFileUtilsProtocol {
26
25
  showAttribution: product.showAttribution,
27
26
  useStrictMode: product.useStrictMode,
28
27
  extraPartnerParams: product.extraPartnerParams as [String: String],
28
+ consentInformation: product.consentInformation,
29
29
  delegate: self
30
30
  )
31
31
  } else {