@smile_identity/react-native 10.2.3 → 10.2.4-beta.1

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 (123) hide show
  1. package/android/build.gradle +4 -1
  2. package/android/gradle.properties +1 -1
  3. package/android/src/main/java/com/smileidentity/react/Mapper.kt +19 -2
  4. package/android/src/main/java/com/smileidentity/react/fragments/SmileCaptureFragment.kt +56 -0
  5. package/android/src/main/java/com/smileidentity/react/utils/ReactUtils.kt +16 -0
  6. package/android/src/main/java/com/smileidentity/react/viewmanagers/BaseSmileIDViewManager.kt +130 -0
  7. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDBiometricKYCViewManager.kt +22 -46
  8. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDConsentViewManager.kt +27 -52
  9. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDDocumentCaptureViewManager.kt +15 -40
  10. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDDocumentVerificationViewManager.kt +23 -49
  11. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDEnhancedDocumentVerificationViewManager.kt +28 -47
  12. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieAuthenticationEnhancedViewManager.kt +12 -37
  13. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieAuthenticationViewManager.kt +16 -40
  14. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieCaptureViewManager.kt +15 -38
  15. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieEnrollmentEnhancedViewManager.kt +13 -38
  16. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieEnrollmentViewManager.kt +15 -44
  17. package/android/src/main/java/com/smileidentity/react/views/SmileIDBiometricKYCView.kt +7 -0
  18. package/android/src/main/java/com/smileidentity/react/views/SmileIDEnhancedDocumentVerificationView.kt +8 -0
  19. package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieCaptureView.kt +38 -25
  20. package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieEnrollmentEnhancedView.kt +29 -21
  21. package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieEnrollmentView.kt +35 -28
  22. package/android/src/main/java/com/smileidentity/react/views/SmileIDView.kt +11 -10
  23. package/android/src/main/res/values/colors.xml +14 -0
  24. package/android/src/main/res/values/strings.xml +91 -0
  25. package/ios/ViewManagers/SmileIDBaseViewManager.swift +24 -20
  26. package/ios/ViewManagers/SmileIDBiometricKYCViewManager.m +4 -1
  27. package/ios/ViewManagers/SmileIDBiometricKYCViewManager.swift +24 -24
  28. package/ios/ViewManagers/SmileIDConsentViewManager.m +4 -1
  29. package/ios/ViewManagers/SmileIDConsentViewManager.swift +1 -1
  30. package/ios/ViewManagers/SmileIDDocumentCaptureViewManager.m +4 -1
  31. package/ios/ViewManagers/SmileIDDocumentCaptureViewManager.swift +1 -1
  32. package/ios/ViewManagers/SmileIDDocumentVerificationViewManager.m +4 -1
  33. package/ios/ViewManagers/SmileIDDocumentVerificationViewManager.swift +1 -1
  34. package/ios/ViewManagers/SmileIDEnhancedDocumentVerificationViewManager.m +4 -1
  35. package/ios/ViewManagers/SmileIDEnhancedDocumentVerificationViewManager.swift +1 -1
  36. package/ios/ViewManagers/SmileIDSmartSelfieAuthenticationEnhancedViewManager.m +4 -1
  37. package/ios/ViewManagers/SmileIDSmartSelfieAuthenticationEnhancedViewManager.swift +1 -1
  38. package/ios/ViewManagers/SmileIDSmartSelfieAuthenticationViewManager.m +4 -1
  39. package/ios/ViewManagers/SmileIDSmartSelfieAuthenticationViewManager.swift +1 -1
  40. package/ios/ViewManagers/SmileIDSmartSelfieCaptureViewManager.m +4 -1
  41. package/ios/ViewManagers/SmileIDSmartSelfieCaptureViewManager.swift +1 -1
  42. package/ios/ViewManagers/SmileIDSmartSelfieEnrollmentEnhancedViewManager.m +4 -1
  43. package/ios/ViewManagers/SmileIDSmartSelfieEnrollmentEnhancedViewManager.swift +1 -1
  44. package/ios/ViewManagers/SmileIDSmartSelfieEnrollmentViewManager.m +4 -1
  45. package/ios/ViewManagers/SmileIDSmartSelfieEnrollmentViewManager.swift +1 -1
  46. package/lib/commonjs/SmileIDBiometricKYCView.js +18 -29
  47. package/lib/commonjs/SmileIDBiometricKYCView.js.map +1 -1
  48. package/lib/commonjs/SmileIDConsentView.js +9 -29
  49. package/lib/commonjs/SmileIDConsentView.js.map +1 -1
  50. package/lib/commonjs/SmileIDDocumentCaptureView.js +9 -29
  51. package/lib/commonjs/SmileIDDocumentCaptureView.js.map +1 -1
  52. package/lib/commonjs/SmileIDDocumentVerificationView.js +9 -29
  53. package/lib/commonjs/SmileIDDocumentVerificationView.js.map +1 -1
  54. package/lib/commonjs/SmileIDEnhancedDocumentVerificationView.js +17 -28
  55. package/lib/commonjs/SmileIDEnhancedDocumentVerificationView.js.map +1 -1
  56. package/lib/commonjs/SmileIDSmartSelfieAuthenticationEnhancedView.js +9 -29
  57. package/lib/commonjs/SmileIDSmartSelfieAuthenticationEnhancedView.js.map +1 -1
  58. package/lib/commonjs/SmileIDSmartSelfieAuthenticationView.js +9 -29
  59. package/lib/commonjs/SmileIDSmartSelfieAuthenticationView.js.map +1 -1
  60. package/lib/commonjs/SmileIDSmartSelfieCaptureView.js +9 -29
  61. package/lib/commonjs/SmileIDSmartSelfieCaptureView.js.map +1 -1
  62. package/lib/commonjs/SmileIDSmartSelfieEnrollmentEnhancedView.js +9 -29
  63. package/lib/commonjs/SmileIDSmartSelfieEnrollmentEnhancedView.js.map +1 -1
  64. package/lib/commonjs/SmileIDSmartSelfieEnrollmentView.js +9 -29
  65. package/lib/commonjs/SmileIDSmartSelfieEnrollmentView.js.map +1 -1
  66. package/lib/commonjs/useSmileIDView.js +55 -0
  67. package/lib/commonjs/useSmileIDView.js.map +1 -0
  68. package/lib/module/SmileIDBiometricKYCView.js +18 -26
  69. package/lib/module/SmileIDBiometricKYCView.js.map +1 -1
  70. package/lib/module/SmileIDConsentView.js +9 -26
  71. package/lib/module/SmileIDConsentView.js.map +1 -1
  72. package/lib/module/SmileIDDocumentCaptureView.js +9 -26
  73. package/lib/module/SmileIDDocumentCaptureView.js.map +1 -1
  74. package/lib/module/SmileIDDocumentVerificationView.js +9 -26
  75. package/lib/module/SmileIDDocumentVerificationView.js.map +1 -1
  76. package/lib/module/SmileIDEnhancedDocumentVerificationView.js +17 -25
  77. package/lib/module/SmileIDEnhancedDocumentVerificationView.js.map +1 -1
  78. package/lib/module/SmileIDSmartSelfieAuthenticationEnhancedView.js +9 -26
  79. package/lib/module/SmileIDSmartSelfieAuthenticationEnhancedView.js.map +1 -1
  80. package/lib/module/SmileIDSmartSelfieAuthenticationView.js +9 -26
  81. package/lib/module/SmileIDSmartSelfieAuthenticationView.js.map +1 -1
  82. package/lib/module/SmileIDSmartSelfieCaptureView.js +9 -26
  83. package/lib/module/SmileIDSmartSelfieCaptureView.js.map +1 -1
  84. package/lib/module/SmileIDSmartSelfieEnrollmentEnhancedView.js +9 -26
  85. package/lib/module/SmileIDSmartSelfieEnrollmentEnhancedView.js.map +1 -1
  86. package/lib/module/SmileIDSmartSelfieEnrollmentView.js +9 -26
  87. package/lib/module/SmileIDSmartSelfieEnrollmentView.js.map +1 -1
  88. package/lib/module/useSmileIDView.js +48 -0
  89. package/lib/module/useSmileIDView.js.map +1 -0
  90. package/lib/typescript/SmileIDBiometricKYCView.d.ts +3 -6
  91. package/lib/typescript/SmileIDBiometricKYCView.d.ts.map +1 -1
  92. package/lib/typescript/SmileIDConsentView.d.ts +3 -6
  93. package/lib/typescript/SmileIDConsentView.d.ts.map +1 -1
  94. package/lib/typescript/SmileIDDocumentCaptureView.d.ts +3 -6
  95. package/lib/typescript/SmileIDDocumentCaptureView.d.ts.map +1 -1
  96. package/lib/typescript/SmileIDDocumentVerificationView.d.ts +3 -6
  97. package/lib/typescript/SmileIDDocumentVerificationView.d.ts.map +1 -1
  98. package/lib/typescript/SmileIDEnhancedDocumentVerificationView.d.ts +3 -6
  99. package/lib/typescript/SmileIDEnhancedDocumentVerificationView.d.ts.map +1 -1
  100. package/lib/typescript/SmileIDSmartSelfieAuthenticationEnhancedView.d.ts +3 -6
  101. package/lib/typescript/SmileIDSmartSelfieAuthenticationEnhancedView.d.ts.map +1 -1
  102. package/lib/typescript/SmileIDSmartSelfieAuthenticationView.d.ts +3 -6
  103. package/lib/typescript/SmileIDSmartSelfieAuthenticationView.d.ts.map +1 -1
  104. package/lib/typescript/SmileIDSmartSelfieCaptureView.d.ts +3 -6
  105. package/lib/typescript/SmileIDSmartSelfieCaptureView.d.ts.map +1 -1
  106. package/lib/typescript/SmileIDSmartSelfieEnrollmentEnhancedView.d.ts +3 -6
  107. package/lib/typescript/SmileIDSmartSelfieEnrollmentEnhancedView.d.ts.map +1 -1
  108. package/lib/typescript/SmileIDSmartSelfieEnrollmentView.d.ts +3 -6
  109. package/lib/typescript/SmileIDSmartSelfieEnrollmentView.d.ts.map +1 -1
  110. package/lib/typescript/useSmileIDView.d.ts +12 -0
  111. package/lib/typescript/useSmileIDView.d.ts.map +1 -0
  112. package/package.json +1 -1
  113. package/src/SmileIDBiometricKYCView.tsx +14 -30
  114. package/src/SmileIDConsentView.tsx +7 -30
  115. package/src/SmileIDDocumentCaptureView.tsx +9 -33
  116. package/src/SmileIDDocumentVerificationView.tsx +9 -36
  117. package/src/SmileIDEnhancedDocumentVerificationView.tsx +23 -35
  118. package/src/SmileIDSmartSelfieAuthenticationEnhancedView.tsx +17 -36
  119. package/src/SmileIDSmartSelfieAuthenticationView.tsx +10 -37
  120. package/src/SmileIDSmartSelfieCaptureView.tsx +9 -33
  121. package/src/SmileIDSmartSelfieEnrollmentEnhancedView.tsx +14 -36
  122. package/src/SmileIDSmartSelfieEnrollmentView.tsx +10 -37
  123. package/src/useSmileIDView.tsx +80 -0
@@ -6,6 +6,7 @@ import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
6
6
  import com.facebook.react.bridge.ReactApplicationContext
7
7
  import com.smileidentity.SmileID
8
8
  import com.smileidentity.compose.EnhancedDocumentVerificationScreen
9
+ import com.smileidentity.models.ConsentInformation
9
10
  import com.smileidentity.react.results.DocumentCaptureResult
10
11
  import com.smileidentity.react.utils.DocumentCaptureResultAdapter
11
12
  import com.smileidentity.results.SmileIDResult
@@ -19,6 +20,7 @@ class SmileIDEnhancedDocumentVerificationView(context: ReactApplicationContext)
19
20
  var captureBothSides: Boolean = true
20
21
  var documentType: String? = null
21
22
  var idAspectRatio: Float? = null
23
+ var consentInformation: ConsentInformation? = null
22
24
 
23
25
  override fun renderContent() {
24
26
  countryCode ?: run {
@@ -26,6 +28,11 @@ class SmileIDEnhancedDocumentVerificationView(context: ReactApplicationContext)
26
28
  return
27
29
  }
28
30
 
31
+ consentInformation ?: run {
32
+ emitFailure(IllegalArgumentException("consentInformation is required for DocumentVerification"))
33
+ return
34
+ }
35
+
29
36
  composeView.apply {
30
37
  val customViewModelStoreOwner = CustomViewModelStoreOwner()
31
38
  setContent {
@@ -43,6 +50,7 @@ class SmileIDEnhancedDocumentVerificationView(context: ReactApplicationContext)
43
50
  allowGalleryUpload = allowGalleryUpload,
44
51
  captureBothSides = captureBothSides,
45
52
  extraPartnerParams = extraPartnerParams,
53
+ consentInformation = consentInformation!!,
46
54
  ) { res ->
47
55
  when (res) {
48
56
  is SmileIDResult.Success -> {
@@ -175,35 +175,48 @@ class SmileIDSmartSelfieCaptureView(context: ReactApplicationContext) : SmileIDV
175
175
 
176
176
  @Composable
177
177
  private fun HandleProcessingState(viewModel: SelfieViewModel) {
178
- viewModel.onFinished { res ->
179
- when (res) {
180
- is SmileIDResult.Success -> {
181
- val result =
182
- SmartSelfieCaptureResult(
183
- selfieFile = res.data.selfieFile,
184
- livenessFiles = res.data.livenessFiles,
185
- )
186
- val newMoshi =
187
- SmileID.moshi
188
- .newBuilder()
189
- .add(SelfieCaptureResultAdapter.FACTORY)
190
- .build()
191
- val json =
192
- try {
193
- newMoshi
194
- .adapter(SmartSelfieCaptureResult::class.java)
195
- .toJson(result)
196
- } catch (e: Exception) {
197
- emitFailure(e)
198
- return@onFinished
178
+ try {
179
+ viewModel.onFinished { res ->
180
+ when (res) {
181
+ is SmileIDResult.Success -> {
182
+ res.data?.let { data ->
183
+ val result = SmartSelfieCaptureResult(
184
+ selfieFile = data.selfieFile,
185
+ livenessFiles = data.livenessFiles ?: emptyList()
186
+ )
187
+
188
+ try {
189
+ val newMoshi = SmileID.moshi
190
+ .newBuilder()
191
+ .add(SelfieCaptureResultAdapter.FACTORY)
192
+ .build()
193
+
194
+ newMoshi.adapter(SmartSelfieCaptureResult::class.java)
195
+ ?.toJson(result)
196
+ ?.let { js ->
197
+ emitSuccess(js)
198
+ } ?: run {
199
+ emitFailure(Exception("Failed to serialize result"))
200
+ }
201
+ } catch (e: Exception) {
202
+ emitFailure(e)
203
+ }
204
+ } ?: run {
205
+ emitFailure(Exception("No data available in success result"))
199
206
  }
200
- json?.let { js ->
201
- emitSuccess(js)
202
207
  }
203
- }
204
208
 
205
- is SmileIDResult.Error -> emitFailure(res.throwable)
209
+ is SmileIDResult.Error -> {
210
+ emitFailure(res.throwable ?: Exception("Unknown error occurred"))
211
+ }
212
+
213
+ else -> {
214
+ emitFailure(Exception("Unexpected result type"))
215
+ }
216
+ }
206
217
  }
218
+ } catch (e: Exception) {
219
+ // emitFailure(e)
207
220
  }
208
221
  }
209
222
  }
@@ -10,9 +10,13 @@ import com.smileidentity.react.results.SmartSelfieCaptureResult
10
10
  import com.smileidentity.react.utils.SelfieCaptureResultAdapter
11
11
  import com.smileidentity.results.SmileIDResult
12
12
  import com.smileidentity.util.randomUserId
13
+ import kotlinx.coroutines.CoroutineScope
14
+ import kotlinx.coroutines.Dispatchers
15
+ import kotlinx.coroutines.Job
16
+ import kotlinx.coroutines.launch
13
17
 
14
18
  class SmileIDSmartSelfieEnrollmentEnhancedView(context: ReactApplicationContext) : SmileIDView(context) {
15
-
19
+ private val viewScope = CoroutineScope(Dispatchers.Main + Job())
16
20
  override fun renderContent() {
17
21
  composeView.apply {
18
22
  setContent {
@@ -24,33 +28,37 @@ class SmileIDSmartSelfieEnrollmentEnhancedView(context: ReactApplicationContext)
24
28
  showAttribution = showAttribution,
25
29
  showInstructions = showInstructions,
26
30
  extraPartnerParams = extraPartnerParams,
27
- ) {
28
- when (it) {
29
- is SmileIDResult.Success -> {
30
- val result =
31
- SmartSelfieCaptureResult(
32
- selfieFile = it.data.selfieFile,
33
- livenessFiles = it.data.livenessFiles,
34
- apiResponse = it.data.apiResponse,
35
- )
36
- val json =
37
- try {
31
+ ) {res ->
32
+ viewScope.launch {
33
+ when (res) {
34
+ is SmileIDResult.Success -> {
35
+ val result =
36
+ SmartSelfieCaptureResult(
37
+ selfieFile = res.data.selfieFile,
38
+ livenessFiles = res.data.livenessFiles,
39
+ apiResponse = res.data.apiResponse,
40
+ )
41
+ val newMoshi =
38
42
  SmileID.moshi
39
43
  .newBuilder()
40
44
  .add(SelfieCaptureResultAdapter.FACTORY)
41
45
  .build()
42
- .adapter(SmartSelfieCaptureResult::class.java)
43
- .toJson(result)
44
- } catch (e: Exception) {
45
- emitFailure(e)
46
- return@SmartSelfieEnrollmentEnhanced
46
+ val json =
47
+ try {
48
+ newMoshi
49
+ .adapter(SmartSelfieCaptureResult::class.java)
50
+ .toJson(result)
51
+ } catch (e: Exception) {
52
+ emitFailure(e)
53
+ return@launch
54
+ }
55
+ json?.let { js ->
56
+ emitSuccess(js)
47
57
  }
48
- json?.let { response ->
49
- emitSuccess(response)
50
58
  }
51
- }
52
59
 
53
- is SmileIDResult.Error -> emitFailure(it.throwable)
60
+ is SmileIDResult.Error -> emitFailure(res.throwable)
61
+ }
54
62
  }
55
63
  }
56
64
  }
@@ -1,18 +1,23 @@
1
1
  package com.smileidentity.react.views
2
2
 
3
+ import android.content.Context
4
+ import android.util.Log
3
5
  import androidx.compose.runtime.CompositionLocalProvider
4
6
  import androidx.compose.runtime.saveable.rememberSaveable
5
7
  import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
6
- import com.facebook.react.bridge.ReactApplicationContext
7
8
  import com.smileidentity.SmileID
8
9
  import com.smileidentity.compose.SmartSelfieEnrollment
9
10
  import com.smileidentity.react.results.SmartSelfieCaptureResult
10
11
  import com.smileidentity.react.utils.SelfieCaptureResultAdapter
11
12
  import com.smileidentity.results.SmileIDResult
12
13
  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
13
18
 
14
- class SmileIDSmartSelfieEnrollmentView(context: ReactApplicationContext) : SmileIDView(context) {
15
-
19
+ class SmileIDSmartSelfieEnrollmentView(context: Context) : SmileIDView(context) {
20
+ private val viewScope = CoroutineScope(Dispatchers.Main + Job())
16
21
  override fun renderContent() {
17
22
  composeView.apply {
18
23
  setContent {
@@ -26,34 +31,36 @@ class SmileIDSmartSelfieEnrollmentView(context: ReactApplicationContext) : Smile
26
31
  showInstructions = showInstructions,
27
32
  extraPartnerParams = extraPartnerParams,
28
33
  ) { res ->
29
- when (res) {
30
- is SmileIDResult.Success -> {
31
- val result =
32
- SmartSelfieCaptureResult(
33
- selfieFile = res.data.selfieFile,
34
- livenessFiles = res.data.livenessFiles,
35
- apiResponse = res.data.apiResponse,
36
- )
37
- val newMoshi =
38
- SmileID.moshi
39
- .newBuilder()
40
- .add(SelfieCaptureResultAdapter.FACTORY)
41
- .build()
42
- val json =
43
- try {
44
- newMoshi
45
- .adapter(SmartSelfieCaptureResult::class.java)
46
- .toJson(result)
47
- } catch (e: Exception) {
48
- emitFailure(e)
49
- return@SmartSelfieEnrollment
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)
50
59
  }
51
- json?.let { js ->
52
- emitSuccess(js)
53
60
  }
54
- }
55
61
 
56
- is SmileIDResult.Error -> emitFailure(res.throwable)
62
+ is SmileIDResult.Error -> emitFailure(res.throwable)
63
+ }
57
64
  }
58
65
  }
59
66
  }
@@ -1,6 +1,7 @@
1
1
  package com.smileidentity.react.views
2
2
 
3
3
  import android.annotation.SuppressLint
4
+ import android.content.Context
4
5
  import android.view.Choreographer
5
6
  import android.view.ViewGroup
6
7
  import android.widget.LinearLayout
@@ -8,27 +9,31 @@ import androidx.compose.ui.platform.ComposeView
8
9
  import androidx.core.view.contains
9
10
  import com.facebook.react.bridge.Arguments
10
11
  import com.facebook.react.bridge.ReactApplicationContext
11
- import com.facebook.react.bridge.ReactContext
12
12
  import com.facebook.react.bridge.WritableMap
13
- import com.facebook.react.uimanager.events.RCTEventEmitter
14
13
  import com.smileidentity.models.JobType
15
14
  import kotlinx.collections.immutable.ImmutableMap
16
15
  import kotlinx.collections.immutable.persistentMapOf
17
16
  import timber.log.Timber
18
17
 
18
+
19
+ interface SmileViewListener {
20
+ fun emitSuccess(map: WritableMap)
21
+ }
22
+
19
23
  @SuppressLint("CheckResult")
20
- abstract class SmileIDView(context: ReactApplicationContext) : LinearLayout(context) {
24
+ abstract class SmileIDView(private val currentContext: Context) : LinearLayout(currentContext) {
25
+
21
26
  lateinit var composeView: ComposeView
22
27
  var userId: String? = null
23
28
  var jobId: String? = null
24
29
  private var jobType: JobType? = null
25
30
  var allowAgentMode: Boolean? = false
31
+ var smileViewListener: SmileViewListener? = null
26
32
  var allowNewEnroll: Boolean? = false
27
33
  var showInstructions: Boolean = true
28
34
  var skipApiSubmission: Boolean = false
29
35
  var showAttribution: Boolean = true
30
36
  var extraPartnerParams: ImmutableMap<String, String> = persistentMapOf()
31
- private var eventEmitter: RCTEventEmitter
32
37
  private var productThrowable: Throwable? = null
33
38
 
34
39
  init {
@@ -36,8 +41,6 @@ abstract class SmileIDView(context: ReactApplicationContext) : LinearLayout(cont
36
41
  ViewGroup.LayoutParams.WRAP_CONTENT,
37
42
  ViewGroup.LayoutParams.WRAP_CONTENT
38
43
  )
39
-
40
- eventEmitter = (context as ReactContext).getJSModule(RCTEventEmitter::class.java);
41
44
  setLayoutParams(layoutParams)
42
45
  orientation = VERTICAL
43
46
  render()
@@ -50,7 +53,7 @@ abstract class SmileIDView(context: ReactApplicationContext) : LinearLayout(cont
50
53
  if (::composeView.isInitialized && contains(composeView)) {
51
54
  removeView(composeView)
52
55
  }
53
- (context as ReactContext).currentActivity?.let {
56
+ (context as ReactApplicationContext).currentActivity?.let {
54
57
  it.runOnUiThread {
55
58
  composeView = ComposeView(it)
56
59
  composeView.layoutParams = ViewGroup.LayoutParams(
@@ -77,9 +80,7 @@ abstract class SmileIDView(context: ReactApplicationContext) : LinearLayout(cont
77
80
  }
78
81
 
79
82
  open fun sendEvent(map: WritableMap) {
80
- val reactContext = context as ReactContext
81
- reactContext.getJSModule(RCTEventEmitter::class.java)
82
- .receiveEvent(id, "onSmileResult", map)
83
+ smileViewListener?.emitSuccess(map)
83
84
  }
84
85
 
85
86
  open fun emitFailure(error: Throwable?) {
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <!-- White label the brand-neutral SDK with Smile branding -->
4
+ <color name="si_color_on_dark">#FFF6EDE4</color>
5
+ <color name="si_color_on_light">#FF2D2B2A</color>
6
+ <color name="si_color_accent">#FF151F72</color>
7
+ <color name="si_color_success">#FF2CC05C</color>
8
+ <color name="si_color_error">#FF91180F</color>
9
+ <color name="si_color_background_dark">#FFC0C0A5</color>
10
+ <color name="si_color_background_main">#FFDBDBC4</color>
11
+ <color name="si_color_background_light">#FFE2DCD5</color>
12
+ <color name="si_color_background_lightest">#FFF9F0E7</color>
13
+ <color name="si_color_material_surface">@color/si_color_background_dark</color>
14
+ </resources>
@@ -0,0 +1,91 @@
1
+ <resources>
2
+ <string name="app_name">Smile ID</string>
3
+ <string name="production">Production</string>
4
+ <string name="sandbox">Sandbox</string>
5
+ <string name="home">Home</string>
6
+ <string name="back">Back</string>
7
+ <string name="scan_qr_code">Scan QR Code from Portal</string>
8
+ <string name="test_our_products">Test Our Products</string>
9
+ <string name="product_name_icon">%1$s icon</string>
10
+ <string name="okay">Okay</string>
11
+ <string name="cancel">Cancel</string>
12
+ <string name="cont">Continue</string>
13
+ <string name="loading">Loading…</string>
14
+ <string name="search">Search</string>
15
+ <string name="version_info">Partner %1$s • %2$s</string>
16
+ <string name="try_again">Try Again</string>
17
+ <string name="something_went_wrong">Something went wrong</string>
18
+ <string name="warning_no_internet">No internet connection</string>
19
+ <string name="applying_config">Applying config…</string>
20
+
21
+ <!-- Jobs Screen -->
22
+ <string name="jobs">Jobs</string>
23
+ <string name="jobs_clear_jobs_icon_tooltip">Clear Job History</string>
24
+ <string name="jobs_no_jobs_found">No jobs found</string>
25
+ <string name="jobs_detail_user_id_label">User ID</string>
26
+ <string name="jobs_detail_job_id_label">Job ID</string>
27
+ <string name="jobs_detail_smile_job_id_label">Smile Job ID</string>
28
+ <string name="jobs_detail_result_code_label">Result Code</string>
29
+ <string name="jobs_detail_code_label">Code</string>
30
+
31
+ <!-- Resources Screen -->
32
+ <string name="resources">Resources</string>
33
+ <string name="resources_explore_docs_title">Explore our documentation</string>
34
+ <string name="resources_explore_docs_subtitle">Read everything related to our solution stack</string>
35
+ <string name="resources_privacy_policy_title">Privacy Policy</string>
36
+ <string name="resources_privacy_policy_subtitle">Learn more about how we handle data</string>
37
+ <string name="resources_faqs_title">View FAQs</string>
38
+ <string name="resources_faqs_subtitle">Explore frequently asked questions</string>
39
+ <string name="resources_supported_types_title">Supported ID types and documents</string>
40
+ <string name="resources_supported_types_subtitle">See our coverage range across the continent</string>
41
+ <string name="about_us_who_we_are">Who we are</string>
42
+ <string name="about_us_who_we_are_content">Smile ID products are tools for developers to perform real-time digital KYC, identity verification, user onboarding, and user authentication across Africa</string>
43
+ <string name="about_us_visit_our_website">Visit our website</string>
44
+ <string name="about_us_contact_support">Contact support</string>
45
+
46
+ <!-- Root Screen -->
47
+ <string name="root_welcome">Welcome to our Sample App!</string>
48
+ <string name="root_description">To begin testing on this app, you need to add a configuration from Smile Portal. \n\nSee link here: \n<annotation is_url="true">portal.usesmileid.com/sdk</annotation></string>
49
+ <string name="root_scan_qr">Scan Configuration QR</string>
50
+ <string name="root_add_config">Add Config manually</string>
51
+ <string name="root_config_added">Configuration Added</string>
52
+ <string name="root_config_added_welcome">Welcome Partner %1$s, you can now proceed to the home screen of the Sample App</string>
53
+
54
+ <!-- Settings Screen -->
55
+ <string name="settings">Settings</string>
56
+ <string name="settings_add_smile_config">Add your config manually</string>
57
+ <string name="settings_update_smile_config">Apply config</string>
58
+ <string name="settings_smile_config_error">There is an error in your Smile Config</string>
59
+
60
+ <!-- SmartSelfie Auth -->
61
+ <string name="user_id_label">User ID</string>
62
+ <string name="user_id_dialog_title">Enter User ID</string>
63
+ <string name="user_id_dialog_supporting_text">From a previous successful SmartSelfie™ Enrollment</string>
64
+
65
+ <!-- Enhanced KYC -->
66
+ <string name="enhanced_kyc_product_name">Enhanced KYC</string>
67
+ <string name="enhanced_kyc_instructions">Provide ID Information</string>
68
+ <string name="enhanced_kyc_country_picker_label">Country</string>
69
+ <string name="enhanced_kyc_id_type_picker_label">ID Type</string>
70
+ <string name="enhanced_kyc_submit_button">Submit</string>
71
+ <string name="enhanced_kyc_processing_title">Processing Enhanced KYC…</string>
72
+ <string name="enhanced_kyc_processing_subtitle">Just a few more seconds</string>
73
+ <string name="enhanced_kyc_processing_success_title">Enhanced KYC Complete</string>
74
+ <string name="enhanced_kyc_processing_success_subtitle">You can now proceed</string>
75
+ <string name="enhanced_kyc_processing_error_title">Enhanced KYC Failed</string>
76
+ <string name="enhanced_kyc_processing_error_subtitle">This could be because of internet connectivity</string>
77
+ <string name="enhanced_kyc_processing_continue_button">Continue</string>
78
+ <string name="enhanced_kyc_processing_retry_button">Retry</string>
79
+ <string name="enhanced_kyc_processing_close_button">Close</string>
80
+
81
+ <!-- Biometric KYC -->
82
+ <string name="biometric_kyc_instructions">Provide ID Information</string>
83
+ <string name="biometric_kyc_enter_id_info">Enter ID Information</string>
84
+
85
+ <!-- Document Verification -->
86
+ <string name="doc_v_select_country">Select Country of Issue</string>
87
+ <string name="doc_v_country_search_field_hint">Select Country</string>
88
+ <string name="doc_v_select_id_type">Select ID Type</string>
89
+ <string name="doc_v_info_title">Get Your ID Verified</string>
90
+ <string name="doc_v_info_subtitle">We need a valid document to verify who you are.</string>
91
+ </resources>
@@ -3,25 +3,29 @@ import React
3
3
  import SwiftUI
4
4
 
5
5
  class SmileIDBaseViewManager: RCTViewManager, SmileIDUIViewDelegate {
6
- var product = SmileIDProductModel()
7
- @objc var onResult: RCTDirectEventBlock?
8
- func getView() -> UIView {
9
- fatalError("Must be implemented by subclass")
10
- }
6
+ var product = SmileIDProductModel()
7
+ @objc var onResult: RCTDirectEventBlock?
8
+ func getView() -> UIView {
9
+ fatalError("Must be implemented by subclass")
10
+ }
11
+
12
+ @objc open func create(_ node: NSNumber, params: NSDictionary) {
11
13
 
12
- override func view() -> UIView! {
13
- getView()
14
- }
15
-
16
- override func customBubblingEventTypes() -> [String]! {
17
- return ["onResult"]
18
- }
19
-
20
- @objc override func constantsToExport() -> [AnyHashable : Any]! {
21
- return ["onResult": "onResult"]
22
- }
23
-
24
- override static func requiresMainQueueSetup() -> Bool {
25
- return true
26
- }
14
+ }
15
+
16
+ override func view() -> UIView! {
17
+ getView()
18
+ }
19
+
20
+ override func customBubblingEventTypes() -> [String]! {
21
+ return ["onResult"]
22
+ }
23
+
24
+ @objc override func constantsToExport() -> [AnyHashable : Any]! {
25
+ return ["onResult": "onResult"]
26
+ }
27
+
28
+ override static func requiresMainQueueSetup() -> Bool {
29
+ return true
30
+ }
27
31
  }
@@ -2,6 +2,9 @@
2
2
  #import <React/RCTViewManager.h>
3
3
 
4
4
  @interface RCT_EXTERN_MODULE(SmileIDBiometricKYCViewManager, RCTViewManager)
5
- RCT_EXTERN_METHOD(setParams:(nonnull NSNumber *)node params:(NSDictionary *)params)
5
+ RCT_EXTERN_METHOD(setParams:(nonnull NSNumber *)node
6
+ commandId:(nonnull NSNumber *)commandId
7
+ params:(nonnull NSDictionary *)params)
8
+ RCT_EXTERN_METHOD(create:(nonnull NSNumber *)node params:(NSDictionary *)params)
6
9
  RCT_EXPORT_VIEW_PROPERTY(onResult, RCTBubblingEventBlock);
7
10
  @end
@@ -5,30 +5,30 @@ import SwiftUI
5
5
 
6
6
  @objc(SmileIDBiometricKYCViewManager)
7
7
  class SmileIDBiometricKYCViewManager: SmileIDBaseViewManager {
8
- override func getView() -> UIView {
9
- BaseSmileIDView(frame: .zero, contentView: AnyView(SmileIDBiometricKYCView(product: self.product)),product:self.product)
10
- }
11
-
12
- @objc func setParams(_ node: NSNumber, params: NSDictionary) {
13
- /* UI Updates on the Main Thread:async ensures that the UI update is scheduled to run on the next cycle of the run loop, preventing any potential blocking of the UI if the update were to take a noticeable amount of time
14
- */
15
- DispatchQueue.main.async {
16
- if let component = self.bridge.uiManager.view(forReactTag: node) as? BaseSmileIDView {
17
- let onResult = params["onResult"] as? RCTDirectEventBlock
18
- guard let idInfo = params["idInfo"] as? NSDictionary else {
19
- onResult?(["error": SmileIDError.unknown("idInfo is required to run Biometric KYC")])
20
- return
21
- }
22
- self.product.extraPartnerParams = params["extraPartnerParams"] as? [String: String] ?? [:]
23
- self.product.userId = params["userId"] as? String
24
- self.product.jobId = params["jobId"] as? String
25
- self.product.allowNewEnroll = params["allowNewEnroll"] as? Bool ?? false
26
- self.product.allowAgentMode = params["allowAgentMode"] as? Bool ?? false
27
- self.product.showAttribution = params["showAttribution"] as? Bool ?? true
28
- self.product.showInstructions = params["showInstructions"] as? Bool ?? true
29
- self.product.idInfo = idInfo.toIdInfo()
30
- self.product.onResult = onResult
31
- }
8
+ override func getView() -> UIView {
9
+ BaseSmileIDView(frame: .zero, contentView: AnyView(SmileIDBiometricKYCView(product: self.product)),product:self.product)
10
+ }
11
+
12
+ @objc func setParams(_ node: NSNumber, commandId: NSNumber, params: NSDictionary) {
13
+ /* UI Updates on the Main Thread:async ensures that the UI update is scheduled to run on the next cycle of the run loop, preventing any potential blocking of the UI if the update were to take a noticeable amount of time
14
+ */
15
+ DispatchQueue.main.async {
16
+ if let component = self.bridge.uiManager.view(forReactTag: node) as? BaseSmileIDView {
17
+ let onResult = params["onResult"] as? RCTDirectEventBlock
18
+ guard let idInfo = params["idInfo"] as? NSDictionary else {
19
+ onResult?(["error": SmileIDError.unknown("idInfo is required to run Biometric KYC")])
20
+ return
32
21
  }
22
+ self.product.extraPartnerParams = params["extraPartnerParams"] as? [String: String] ?? [:]
23
+ self.product.userId = params["userId"] as? String
24
+ self.product.jobId = params["jobId"] as? String
25
+ self.product.allowNewEnroll = params["allowNewEnroll"] as? Bool ?? false
26
+ self.product.allowAgentMode = params["allowAgentMode"] as? Bool ?? false
27
+ self.product.showAttribution = params["showAttribution"] as? Bool ?? true
28
+ self.product.showInstructions = params["showInstructions"] as? Bool ?? true
29
+ self.product.idInfo = idInfo.toIdInfo()
30
+ self.product.onResult = onResult
31
+ }
33
32
  }
33
+ }
34
34
  }
@@ -2,6 +2,9 @@
2
2
  #import <React/RCTViewManager.h>
3
3
 
4
4
  @interface RCT_EXTERN_MODULE(SmileIDConsentViewManager, RCTViewManager)
5
+ RCT_EXTERN_METHOD(setParams:(nonnull NSNumber *)node
6
+ commandId:(nonnull NSNumber *)commandId
7
+ params:(nonnull NSDictionary *)params)
8
+ RCT_EXTERN_METHOD(create:(nonnull NSNumber *)node params:(NSDictionary *)params)
5
9
  RCT_EXPORT_VIEW_PROPERTY(onResult, RCTBubblingEventBlock);
6
- RCT_EXTERN_METHOD(setParams:(nonnull NSNumber *)node params:(NSDictionary *)params)
7
10
  @end
@@ -9,7 +9,7 @@ class SmileIDConsentViewManager: SmileIDBaseViewManager {
9
9
  BaseSmileIDView(frame: .zero, contentView: AnyView(SmileIDConsentView(product: self.product)),product:self.product)
10
10
  }
11
11
 
12
- @objc func setParams(_ node: NSNumber, params: NSDictionary) {
12
+ @objc func setParams(_ node: NSNumber, commandId: NSNumber, params: NSDictionary) {
13
13
  /* UI Updates on the Main Thread:async ensures that the UI update is scheduled to run on the next cycle of the run loop, preventing any potential blocking of the UI if the update were to take a noticeable amount of time
14
14
  */
15
15
  DispatchQueue.main.async {
@@ -2,6 +2,9 @@
2
2
  #import <React/RCTViewManager.h>
3
3
 
4
4
  @interface RCT_EXTERN_MODULE(SmileIDDocumentCaptureViewManager, RCTViewManager)
5
- RCT_EXTERN_METHOD(setParams:(nonnull NSNumber *)node params:(NSDictionary *)params)
5
+ RCT_EXTERN_METHOD(setParams:(nonnull NSNumber *)node
6
+ commandId:(nonnull NSNumber *)commandId
7
+ params:(nonnull NSDictionary *)params)
8
+ RCT_EXTERN_METHOD(create:(nonnull NSNumber *)node params:(NSDictionary *)params)
6
9
  RCT_EXPORT_VIEW_PROPERTY(onResult, RCTBubblingEventBlock);
7
10
  @end
@@ -8,7 +8,7 @@ class SmileIDDocumentCaptureViewManager: SmileIDBaseViewManager {
8
8
  BaseSmileIDView(frame: .zero, contentView: AnyView(SmileIDDocumentCaptureView(product: self.product)), product: self.product)
9
9
  }
10
10
 
11
- @objc func setParams(_ node: NSNumber, params: NSDictionary) {
11
+ @objc func setParams(_ node: NSNumber, commandId: NSNumber, params: NSDictionary) {
12
12
  /* UI Updates on the Main Thread:async ensures that the UI update is scheduled to run on the next cycle of the run loop, preventing any potential blocking of the UI if the update were to take a noticeable amount of time
13
13
  */
14
14
  DispatchQueue.main.async {
@@ -2,6 +2,9 @@
2
2
  #import <React/RCTViewManager.h>
3
3
 
4
4
  @interface RCT_EXTERN_MODULE(SmileIDDocumentVerificationViewManager, RCTViewManager)
5
- RCT_EXTERN_METHOD(setParams:(nonnull NSNumber *)node params:(NSDictionary *)params)
5
+ RCT_EXTERN_METHOD(setParams:(nonnull NSNumber *)node
6
+ commandId:(nonnull NSNumber *)commandId
7
+ params:(nonnull NSDictionary *)params)
8
+ RCT_EXTERN_METHOD(create:(nonnull NSNumber *)node params:(NSDictionary *)params)
6
9
  RCT_EXPORT_VIEW_PROPERTY(onResult, RCTBubblingEventBlock);
7
10
  @end
@@ -9,7 +9,7 @@ class SmileIDDocumentVerificationViewManager: SmileIDBaseViewManager {
9
9
  BaseSmileIDView(frame: .zero, contentView: AnyView(SmileIDDocumentVerificationView(product: self.product)),product:self.product)
10
10
  }
11
11
 
12
- @objc func setParams(_ node: NSNumber, params: NSDictionary) {
12
+ @objc func setParams(_ node: NSNumber, commandId: NSNumber, params: NSDictionary) {
13
13
  /* UI Updates on the Main Thread:async ensures that the UI update is scheduled to run on the next cycle of the run loop, preventing any potential blocking of the UI if the update were to take a noticeable amount of time
14
14
  */
15
15
  DispatchQueue.main.async {
@@ -2,6 +2,9 @@
2
2
  #import <React/RCTViewManager.h>
3
3
 
4
4
  @interface RCT_EXTERN_MODULE(SmileIDEnhancedDocumentVerificationViewManager, RCTViewManager)
5
- RCT_EXTERN_METHOD(setParams:(nonnull NSNumber *)node params:(NSDictionary *)params)
5
+ RCT_EXTERN_METHOD(setParams:(nonnull NSNumber *)node
6
+ commandId:(nonnull NSNumber *)commandId
7
+ params:(nonnull NSDictionary *)params)
8
+ RCT_EXTERN_METHOD(create:(nonnull NSNumber *)node params:(NSDictionary *)params)
6
9
  RCT_EXPORT_VIEW_PROPERTY(onResult, RCTBubblingEventBlock);
7
10
  @end