@smile_identity/react-native 10.0.0-beta02 → 10.0.0-beta03

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 (56) hide show
  1. package/README.md +1 -1
  2. package/android/gradle.properties +1 -1
  3. package/android/src/main/java/com/smileidentity/react/Mapper.kt +179 -0
  4. package/android/src/main/java/com/smileidentity/react/SmileIdModule.kt +64 -87
  5. package/android/src/main/java/com/smileidentity/react/utils/ReactUtils.kt +4 -39
  6. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDBiometricKYCViewManager.kt +11 -8
  7. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDConsentViewManager.kt +16 -10
  8. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDDocumentVerificationViewManager.kt +14 -12
  9. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDEnhancedDocumentVerificationViewManager.kt +13 -11
  10. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieAuthenticationViewManager.kt +7 -6
  11. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieEnrollmentViewManager.kt +7 -6
  12. package/android/src/main/java/com/smileidentity/react/views/SmileIDBiometricKYCView.kt +32 -22
  13. package/android/src/main/java/com/smileidentity/react/views/SmileIDConsentView.kt +21 -14
  14. package/android/src/main/java/com/smileidentity/react/views/SmileIDDocumentVerificationView.kt +35 -27
  15. package/android/src/main/java/com/smileidentity/react/views/SmileIDEnhancedDocumentVerificationView.kt +34 -26
  16. package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieAuthenticationView.kt +30 -22
  17. package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieEnrollmentView.kt +30 -22
  18. package/android/src/main/java/com/smileidentity/react/views/SmileIDView.kt +1 -0
  19. package/android/src/oldarch/SmileIdSpec.kt +23 -1
  20. package/ios/View/BaseSmileIDView.swift +5 -5
  21. package/ios/View/SmileIDBiometricKYCView.swift +6 -4
  22. package/ios/View/SmileIDConsentView.swift +5 -4
  23. package/ios/View/SmileIDDocumentVerificationView.swift +5 -3
  24. package/ios/View/SmileIDEnhancedDocumentVerificationView.swift +6 -4
  25. package/ios/View/SmileIDSmartSelfieAuthView.swift +6 -4
  26. package/ios/View/SmileIDSmartSelfieEnrollmentView.swift +6 -4
  27. package/ios/ViewManagers/SmileIDBaseViewManager.swift +1 -0
  28. package/ios/ViewManagers/SmileIDBiometricKYCViewManager.swift +11 -10
  29. package/ios/ViewManagers/SmileIDConsentViewManager.swift +8 -8
  30. package/ios/ViewManagers/SmileIDDocumentVerificationViewManager.swift +17 -16
  31. package/ios/ViewManagers/SmileIDEnhancedDocumentVerificationViewManager.swift +16 -15
  32. package/ios/ViewManagers/SmileIDSmartSelfieAuthenticationViewManager.swift +10 -9
  33. package/ios/ViewManagers/SmileIDSmartSelfieEnrollmentViewManager.swift +10 -9
  34. package/ios/ViewModels/SmileIDProductModel.swift +1 -0
  35. package/lib/commonjs/NativeSmileId.js.map +1 -1
  36. package/lib/commonjs/index.js +96 -0
  37. package/lib/commonjs/index.js.map +1 -1
  38. package/lib/commonjs/types.js +511 -0
  39. package/lib/commonjs/types.js.map +1 -1
  40. package/lib/module/NativeSmileId.js.map +1 -1
  41. package/lib/module/index.js +2 -2
  42. package/lib/module/index.js.map +1 -1
  43. package/lib/module/types.js +471 -1
  44. package/lib/module/types.js.map +1 -1
  45. package/lib/typescript/NativeSmileId.d.ts +13 -9
  46. package/lib/typescript/NativeSmileId.d.ts.map +1 -1
  47. package/lib/typescript/index.d.ts +2 -2
  48. package/lib/typescript/index.d.ts.map +1 -1
  49. package/lib/typescript/types.d.ts +410 -88
  50. package/lib/typescript/types.d.ts.map +1 -1
  51. package/package.json +3 -3
  52. package/react-native-smile-id.podspec +1 -1
  53. package/src/NativeSmileId.ts +58 -11
  54. package/src/index.tsx +33 -1
  55. package/src/types.ts +985 -90
  56. package/android/src/main/assets/smile_config.json +0 -9
@@ -1,6 +1,10 @@
1
1
  package com.smileidentity.react.views
2
2
 
3
+ import androidx.compose.runtime.CompositionLocalProvider
3
4
  import androidx.compose.runtime.saveable.rememberSaveable
5
+ import androidx.compose.ui.platform.ViewCompositionStrategy
6
+ import androidx.lifecycle.ViewModelStoreOwner
7
+ import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
4
8
  import com.facebook.react.bridge.ReactApplicationContext
5
9
  import com.smileidentity.SmileID
6
10
  import com.smileidentity.compose.BiometricKYC
@@ -9,6 +13,7 @@ import com.smileidentity.results.BiometricKycResult
9
13
  import com.smileidentity.results.SmileIDResult
10
14
  import com.smileidentity.util.randomJobId
11
15
  import com.smileidentity.util.randomUserId
16
+ import kotlinx.collections.immutable.toImmutableMap
12
17
  import timber.log.Timber
13
18
 
14
19
  class SmileIDBiometricKYCView(context: ReactApplicationContext) : SmileIDView(context) {
@@ -18,32 +23,37 @@ class SmileIDBiometricKYCView(context: ReactApplicationContext) : SmileIDView(co
18
23
  emitFailure(IllegalArgumentException("idInfo is required for BiometricKYC"))
19
24
  return
20
25
  }
21
-
22
26
  composeView.apply {
27
+ setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindow)
23
28
  setContent {
24
- SmileID.BiometricKYC(
25
- idInfo = idInfo!!,
26
- userId = userId ?: rememberSaveable { randomUserId() },
27
- jobId = jobId ?: rememberSaveable { randomJobId() },
28
- allowAgentMode = allowAgentMode ?: false,
29
- showAttribution = showInstructions ?: true,
30
- ) { result ->
31
- when (result) {
32
- is SmileIDResult.Success -> {
33
- val json = try {
34
- SmileID.moshi
35
- .adapter(BiometricKycResult::class.java)
36
- .toJson(result.data)
37
- } catch (e: Exception) {
38
- Timber.w(e)
39
- "null"
29
+ CompositionLocalProvider(LocalViewModelStoreOwner provides (context as ViewModelStoreOwner)) {
30
+ SmileID.BiometricKYC(
31
+ idInfo = idInfo!!,
32
+ userId = userId ?: rememberSaveable { randomUserId() },
33
+ jobId = jobId ?: rememberSaveable { randomJobId() },
34
+ allowAgentMode = allowAgentMode ?: false,
35
+ allowNewEnroll = allowNewEnroll ?: false,
36
+ showAttribution = showAttribution ?: true,
37
+ showInstructions = showInstructions ?: true,
38
+ extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
39
+ ) { result ->
40
+ when (result) {
41
+ is SmileIDResult.Success -> {
42
+ val json = try {
43
+ SmileID.moshi
44
+ .adapter(BiometricKycResult::class.java)
45
+ .toJson(result.data)
46
+ } catch (e: Exception) {
47
+ Timber.w(e)
48
+ "null"
49
+ }
50
+ emitSuccess(json)
40
51
  }
41
- emitSuccess(json)
42
- }
43
52
 
44
- is SmileIDResult.Error -> {
45
- result.throwable.printStackTrace()
46
- emitFailure(result.throwable)
53
+ is SmileIDResult.Error -> {
54
+ result.throwable.printStackTrace()
55
+ emitFailure(result.throwable)
56
+ }
47
57
  }
48
58
  }
49
59
  }
@@ -1,7 +1,11 @@
1
1
  package com.smileidentity.react.views
2
2
 
3
3
  import android.webkit.URLUtil
4
+ import androidx.compose.runtime.CompositionLocalProvider
5
+ import androidx.compose.ui.platform.ViewCompositionStrategy
4
6
  import androidx.compose.ui.res.painterResource
7
+ import androidx.lifecycle.ViewModelStoreOwner
8
+ import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
5
9
  import com.facebook.react.bridge.ReactApplicationContext
6
10
  import com.smileidentity.SmileID
7
11
  import com.smileidentity.compose.ConsentScreen
@@ -39,21 +43,24 @@ class SmileIDConsentView(context: ReactApplicationContext) : SmileIDView(context
39
43
  (context as? ReactApplicationContext)?.currentActivity?.packageName
40
44
  )
41
45
  composeView.apply {
46
+ setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindow)
42
47
  setContent {
43
- SmileID.ConsentScreen(
44
- partnerIcon = painterResource(
45
- id = partnerIcon
46
- ),
47
- partnerName = partnerName!!,
48
- productName = productName!!,
49
- partnerPrivacyPolicy = URL(partnerPrivacyPolicy),
50
- onConsentDenied = {
51
- emitSuccess("denied")
52
- },
53
- onConsentGranted = {
54
- emitSuccess("accepted")
55
- },
56
- )
48
+ CompositionLocalProvider(LocalViewModelStoreOwner provides (context as ViewModelStoreOwner)) {
49
+ SmileID.ConsentScreen(
50
+ partnerIcon = painterResource(
51
+ id = partnerIcon
52
+ ),
53
+ partnerName = partnerName!!,
54
+ productName = productName!!,
55
+ partnerPrivacyPolicy = URL(partnerPrivacyPolicy),
56
+ onConsentDenied = {
57
+ emitSuccess("denied")
58
+ },
59
+ onConsentGranted = {
60
+ emitSuccess("accepted")
61
+ },
62
+ )
63
+ }
57
64
  }
58
65
  }
59
66
  }
@@ -1,6 +1,10 @@
1
1
  package com.smileidentity.react.views
2
2
 
3
+ import androidx.compose.runtime.CompositionLocalProvider
3
4
  import androidx.compose.runtime.saveable.rememberSaveable
5
+ import androidx.compose.ui.platform.ViewCompositionStrategy
6
+ import androidx.lifecycle.ViewModelStoreOwner
7
+ import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
4
8
  import com.facebook.react.bridge.ReactApplicationContext
5
9
  import com.smileidentity.SmileID
6
10
  import com.smileidentity.compose.DocumentVerification
@@ -30,36 +34,40 @@ class SmileIDDocumentVerificationView(context: ReactApplicationContext) : SmileI
30
34
  bypassSelfieCaptureWithFile = File(it)
31
35
  }
32
36
  composeView.apply {
37
+ setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindow)
33
38
  setContent {
34
- SmileID.DocumentVerification(
35
- userId = userId ?: rememberSaveable { randomUserId() },
36
- jobId = jobId ?: rememberSaveable { randomJobId() },
37
- countryCode = countryCode!!,
38
- documentType = documentType,
39
- idAspectRatio = idAspectRatio,
40
- showAttribution = showAttribution ?: true,
41
- showInstructions = showInstructions ?: true,
42
- allowGalleryUpload = allowGalleryUpload,
43
- captureBothSides = captureBothSides,
44
- bypassSelfieCaptureWithFile = bypassSelfieCaptureWithFile,
45
- extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
46
- ) { result ->
47
- when (result) {
48
- is SmileIDResult.Success -> {
49
- val json = try {
50
- SmileID.moshi
51
- .adapter(DocumentVerificationResult::class.java)
52
- .toJson(result.data)
53
- } catch (e: Exception) {
54
- Timber.w(e)
55
- "null"
39
+ CompositionLocalProvider(LocalViewModelStoreOwner provides (context as ViewModelStoreOwner)) {
40
+ SmileID.DocumentVerification(
41
+ userId = userId ?: rememberSaveable { randomUserId() },
42
+ jobId = jobId ?: rememberSaveable { randomJobId() },
43
+ countryCode = countryCode!!,
44
+ documentType = documentType,
45
+ idAspectRatio = idAspectRatio,
46
+ showAttribution = showAttribution ?: true,
47
+ showInstructions = showInstructions ?: true,
48
+ allowGalleryUpload = allowGalleryUpload,
49
+ captureBothSides = captureBothSides,
50
+ allowNewEnroll = allowNewEnroll ?: false,
51
+ bypassSelfieCaptureWithFile = bypassSelfieCaptureWithFile,
52
+ extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
53
+ ) { result ->
54
+ when (result) {
55
+ is SmileIDResult.Success -> {
56
+ val json = try {
57
+ SmileID.moshi
58
+ .adapter(DocumentVerificationResult::class.java)
59
+ .toJson(result.data)
60
+ } catch (e: Exception) {
61
+ Timber.w(e)
62
+ "null"
63
+ }
64
+ emitSuccess(json)
56
65
  }
57
- emitSuccess(json)
58
- }
59
66
 
60
- is SmileIDResult.Error -> {
61
- result.throwable.printStackTrace()
62
- emitFailure(result.throwable)
67
+ is SmileIDResult.Error -> {
68
+ result.throwable.printStackTrace()
69
+ emitFailure(result.throwable)
70
+ }
63
71
  }
64
72
  }
65
73
  }
@@ -1,6 +1,10 @@
1
1
  package com.smileidentity.react.views
2
2
 
3
+ import androidx.compose.runtime.CompositionLocalProvider
3
4
  import androidx.compose.runtime.saveable.rememberSaveable
5
+ import androidx.compose.ui.platform.ViewCompositionStrategy
6
+ import androidx.lifecycle.ViewModelStoreOwner
7
+ import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
4
8
  import com.facebook.react.bridge.ReactApplicationContext
5
9
  import com.smileidentity.SmileID
6
10
  import com.smileidentity.compose.EnhancedDocumentVerificationScreen
@@ -25,35 +29,39 @@ class SmileIDEnhancedDocumentVerificationView(context: ReactApplicationContext)
25
29
  return;
26
30
  }
27
31
  composeView.apply {
32
+ setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindow)
28
33
  setContent {
29
- SmileID.EnhancedDocumentVerificationScreen(
30
- userId = userId ?: rememberSaveable { randomUserId() },
31
- jobId = jobId ?: rememberSaveable { randomJobId() },
32
- countryCode = countryCode!!,
33
- documentType = documentType,
34
- idAspectRatio = idAspectRatio,
35
- showAttribution = showAttribution ?: true,
36
- showInstructions = showInstructions ?: true,
37
- allowGalleryUpload = allowGalleryUpload,
38
- captureBothSides = captureBothSides,
39
- extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
40
- ) { result ->
41
- when (result) {
42
- is SmileIDResult.Success -> {
43
- val json = try {
44
- SmileID.moshi
45
- .adapter(EnhancedDocumentVerificationResult::class.java)
46
- .toJson(result.data)
47
- } catch (e: Exception) {
48
- Timber.w(e)
49
- "null"
34
+ CompositionLocalProvider(LocalViewModelStoreOwner provides (context as ViewModelStoreOwner)) {
35
+ SmileID.EnhancedDocumentVerificationScreen(
36
+ userId = userId ?: rememberSaveable { randomUserId() },
37
+ jobId = jobId ?: rememberSaveable { randomJobId() },
38
+ countryCode = countryCode!!,
39
+ documentType = documentType,
40
+ idAspectRatio = idAspectRatio,
41
+ showAttribution = showAttribution ?: true,
42
+ showInstructions = showInstructions ?: true,
43
+ allowNewEnroll = allowNewEnroll ?: false,
44
+ allowGalleryUpload = allowGalleryUpload,
45
+ captureBothSides = captureBothSides,
46
+ extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
47
+ ) { result ->
48
+ when (result) {
49
+ is SmileIDResult.Success -> {
50
+ val json = try {
51
+ SmileID.moshi
52
+ .adapter(EnhancedDocumentVerificationResult::class.java)
53
+ .toJson(result.data)
54
+ } catch (e: Exception) {
55
+ Timber.w(e)
56
+ "null"
57
+ }
58
+ emitSuccess(json)
50
59
  }
51
- emitSuccess(json)
52
- }
53
60
 
54
- is SmileIDResult.Error -> {
55
- result.throwable.printStackTrace()
56
- emitFailure(result.throwable)
61
+ is SmileIDResult.Error -> {
62
+ result.throwable.printStackTrace()
63
+ emitFailure(result.throwable)
64
+ }
57
65
  }
58
66
  }
59
67
  }
@@ -1,6 +1,10 @@
1
1
  package com.smileidentity.react.views
2
2
 
3
+ import androidx.compose.runtime.CompositionLocalProvider
3
4
  import androidx.compose.runtime.saveable.rememberSaveable
5
+ import androidx.compose.ui.platform.ViewCompositionStrategy
6
+ import androidx.lifecycle.ViewModelStoreOwner
7
+ import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
4
8
  import com.facebook.react.bridge.ReactApplicationContext
5
9
  import com.smileidentity.SmileID
6
10
  import com.smileidentity.compose.SmartSelfieAuthentication
@@ -16,31 +20,35 @@ class SmileIDSmartSelfieAuthenticationView(context: ReactApplicationContext) :
16
20
 
17
21
  override fun renderContent() {
18
22
  composeView.apply {
23
+ setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindow)
19
24
  setContent {
20
- SmileID.SmartSelfieAuthentication(
21
- userId = userId ?: rememberSaveable { randomUserId() },
22
- jobId = jobId ?: rememberSaveable { randomJobId() },
23
- allowAgentMode = allowAgentMode ?: false,
24
- showAttribution = showAttribution ?: true,
25
- showInstructions = showInstructions ?: true,
26
- extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
27
- ) { result ->
28
- when (result) {
29
- is SmileIDResult.Success -> {
30
- val json = try {
31
- SmileID.moshi
32
- .adapter(SmartSelfieResult::class.java)
33
- .toJson(result.data)
34
- } catch (e: Exception) {
35
- Timber.w(e)
36
- "null"
25
+ CompositionLocalProvider(LocalViewModelStoreOwner provides (context as ViewModelStoreOwner)) {
26
+ SmileID.SmartSelfieAuthentication(
27
+ userId = userId ?: rememberSaveable { randomUserId() },
28
+ jobId = jobId ?: rememberSaveable { randomJobId() },
29
+ allowAgentMode = allowAgentMode ?: false,
30
+ allowNewEnroll = allowNewEnroll ?: false,
31
+ showAttribution = showAttribution ?: true,
32
+ showInstructions = showInstructions ?: true,
33
+ extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
34
+ ) { result ->
35
+ when (result) {
36
+ is SmileIDResult.Success -> {
37
+ val json = try {
38
+ SmileID.moshi
39
+ .adapter(SmartSelfieResult::class.java)
40
+ .toJson(result.data)
41
+ } catch (e: Exception) {
42
+ Timber.w(e)
43
+ "null"
44
+ }
45
+ emitSuccess(json)
37
46
  }
38
- emitSuccess(json)
39
- }
40
47
 
41
- is SmileIDResult.Error -> {
42
- result.throwable.printStackTrace()
43
- emitFailure(result.throwable)
48
+ is SmileIDResult.Error -> {
49
+ result.throwable.printStackTrace()
50
+ emitFailure(result.throwable)
51
+ }
44
52
  }
45
53
  }
46
54
  }
@@ -1,6 +1,10 @@
1
1
  package com.smileidentity.react.views
2
2
 
3
+ import androidx.compose.runtime.CompositionLocalProvider
3
4
  import androidx.compose.runtime.saveable.rememberSaveable
5
+ import androidx.compose.ui.platform.ViewCompositionStrategy
6
+ import androidx.lifecycle.ViewModelStoreOwner
7
+ import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
4
8
  import com.facebook.react.bridge.ReactApplicationContext
5
9
  import com.smileidentity.SmileID
6
10
  import com.smileidentity.compose.SmartSelfieEnrollment
@@ -15,31 +19,35 @@ class SmileIDSmartSelfieEnrollmentView(context: ReactApplicationContext) : Smile
15
19
 
16
20
  override fun renderContent() {
17
21
  composeView.apply {
22
+ setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindow)
18
23
  setContent {
19
- SmileID.SmartSelfieEnrollment(
20
- userId = userId ?: rememberSaveable { randomUserId() },
21
- jobId = jobId ?: rememberSaveable { randomJobId() },
22
- allowAgentMode = allowAgentMode ?: false,
23
- showAttribution = showAttribution ?: true,
24
- showInstructions = showInstructions ?: true,
25
- extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
26
- ) { result ->
27
- when (result) {
28
- is SmileIDResult.Success -> {
29
- val json = try {
30
- SmileID.moshi
31
- .adapter(SmartSelfieResult::class.java)
32
- .toJson(result.data)
33
- } catch (e: Exception) {
34
- Timber.w(e)
35
- "null"
24
+ CompositionLocalProvider(LocalViewModelStoreOwner provides (context as ViewModelStoreOwner)) {
25
+ SmileID.SmartSelfieEnrollment(
26
+ userId = userId ?: rememberSaveable { randomUserId() },
27
+ jobId = jobId ?: rememberSaveable { randomJobId() },
28
+ allowAgentMode = allowAgentMode ?: false,
29
+ allowNewEnroll = allowNewEnroll ?: false,
30
+ showAttribution = showAttribution ?: true,
31
+ showInstructions = showInstructions ?: true,
32
+ extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
33
+ ) { result ->
34
+ when (result) {
35
+ is SmileIDResult.Success -> {
36
+ val json = try {
37
+ SmileID.moshi
38
+ .adapter(SmartSelfieResult::class.java)
39
+ .toJson(result.data)
40
+ } catch (e: Exception) {
41
+ Timber.w(e)
42
+ "null"
43
+ }
44
+ emitSuccess(json)
36
45
  }
37
- emitSuccess(json)
38
- }
39
46
 
40
- is SmileIDResult.Error -> {
41
- result.throwable.printStackTrace()
42
- emitFailure(result.throwable)
47
+ is SmileIDResult.Error -> {
48
+ result.throwable.printStackTrace()
49
+ emitFailure(result.throwable)
50
+ }
43
51
  }
44
52
  }
45
53
  }
@@ -18,6 +18,7 @@ abstract class SmileIDView(context: ReactApplicationContext) : LinearLayout(cont
18
18
  var jobId: String? = null
19
19
  private var jobType: JobType? = null
20
20
  var allowAgentMode: Boolean? = false
21
+ var allowNewEnroll: Boolean? = false
21
22
  var showInstructions: Boolean? = true
22
23
  var showAttribution: Boolean? = true
23
24
  var extraPartnerParams: Map<String, String>? = null
@@ -11,6 +11,28 @@ abstract class SmileIdSpec internal constructor(context: ReactApplicationContext
11
11
  abstract fun initialize(useSandBox: Boolean ,promise: Promise)
12
12
 
13
13
  abstract fun disableCrashReporting(promise: Promise)
14
- abstract fun doEnhancedKycAsync(request: ReadableMap, promise: Promise)
14
+
15
+ abstract fun authenticate(request: ReadableMap, promise: Promise)
16
+
17
+ abstract fun prepUpload(request: ReadableMap, promise: Promise)
18
+
19
+ abstract fun upload(url: String, request: ReadableMap, promise: Promise)
20
+
15
21
  abstract fun doEnhancedKyc(request: ReadableMap, promise: Promise)
22
+
23
+ abstract fun doEnhancedKycAsync(request: ReadableMap, promise: Promise)
24
+
25
+ abstract fun getSmartSelfieJobStatus(request: ReadableMap, promise: Promise)
26
+
27
+ abstract fun getDocumentVerificationJobStatus(request: ReadableMap, promise: Promise)
28
+
29
+ abstract fun getBiometricKycJobStatus(request: ReadableMap, promise: Promise)
30
+
31
+ abstract fun getEnhancedDocumentVerificationJobStatus(request: ReadableMap, promise: Promise)
32
+
33
+ abstract fun getProductsConfig(request: ReadableMap, promise: Promise)
34
+
35
+ abstract fun getValidDocuments(request: ReadableMap, promise: Promise)
36
+
37
+ abstract fun getServices(promise: Promise)
16
38
  }
@@ -3,10 +3,10 @@ import SwiftUI
3
3
 
4
4
  class BaseSmileIDView: UIView {
5
5
  typealias ContentView = AnyView
6
+ var contentView : AnyView?
6
7
 
7
- var product = SmileIDProductModel()
8
-
9
- override init(frame: CGRect) {
8
+ init(frame: CGRect,contentView:AnyView) {
9
+ self.contentView = contentView
10
10
  super.init(frame: frame)
11
11
  commonInit()
12
12
  }
@@ -19,7 +19,7 @@ class BaseSmileIDView: UIView {
19
19
  private func commonInit() {
20
20
  // Perform initialization tasks here
21
21
  // For example, setup subviews, add constraints, configure appearance
22
- let hostingController = UIHostingController(rootView: getView())
22
+ let hostingController = UIHostingController(rootView:contentView)
23
23
  let hostingView = hostingController.view!
24
24
  hostingView.translatesAutoresizingMaskIntoConstraints = false
25
25
  addSubview(hostingView)
@@ -29,7 +29,7 @@ class BaseSmileIDView: UIView {
29
29
  hostingView.rightAnchor.constraint(equalTo: rightAnchor).isActive = true
30
30
  }
31
31
 
32
- func getView() -> AnyView {
32
+ func getView(product:SmileIDProductModel) -> AnyView {
33
33
  fatalError("Must be implemented by subclass")
34
34
  }
35
35
  }
@@ -3,14 +3,16 @@ import Foundation
3
3
  import SmileID
4
4
  import SwiftUI
5
5
 
6
- class SmileIDBiometricKYCView: BaseSmileIDView {
7
- override func getView() -> AnyView {
8
- AnyView(NavigationView {
6
+ struct SmileIDBiometricKYCView: View {
7
+ @ObservedObject var product : SmileIDProductModel
8
+ var body: some View{
9
+ NavigationView {
9
10
  if let idInfo = product.idInfo {
10
11
  SmileID.biometricKycScreen(
11
12
  idInfo: idInfo, // already validated in the SmileIDBiometricKYCViewManager
12
13
  userId: product.userId ?? generateUserId(),
13
14
  jobId: product.jobId ?? generateJobId(),
15
+ allowNewEnroll: product.allowNewEnroll,
14
16
  allowAgentMode: product.allowAgentMode,
15
17
  showAttribution: product.showAttribution,
16
18
  showInstructions: product.showInstructions,
@@ -23,7 +25,7 @@ class SmileIDBiometricKYCView: BaseSmileIDView {
23
25
  // return an error if the required data is missing
24
26
  Text("An error has occured")
25
27
  }
26
- }.navigationViewStyle(StackNavigationViewStyle()))
28
+ }.navigationViewStyle(StackNavigationViewStyle())
27
29
  }
28
30
  }
29
31
 
@@ -3,9 +3,10 @@ import Foundation
3
3
  import SmileID
4
4
  import SwiftUI
5
5
 
6
- class SmileIDConsentView: BaseSmileIDView {
7
- override func getView() -> AnyView {
8
- AnyView(NavigationView {
6
+ struct SmileIDConsentView: View {
7
+ @ObservedObject var product : SmileIDProductModel
8
+ var body: some View {
9
+ NavigationView {
9
10
  if let partnerIcon = product.partnerIcon,
10
11
  let partnerName = product.partnerName,
11
12
  let productName = product.productName,
@@ -30,6 +31,6 @@ class SmileIDConsentView: BaseSmileIDView {
30
31
  // return an error if the required data is missing
31
32
  Text("An error has occured")
32
33
  }
33
- }.navigationViewStyle(StackNavigationViewStyle()))
34
+ }.navigationViewStyle(StackNavigationViewStyle())
34
35
  }
35
36
  }
@@ -3,13 +3,15 @@ import Foundation
3
3
  import SmileID
4
4
  import SwiftUI
5
5
 
6
- class SmileIDDocumentVerificationView: BaseSmileIDView {
7
- override func getView() -> AnyView {
6
+ struct SmileIDDocumentVerificationView: View {
7
+ @ObservedObject var product : SmileIDProductModel
8
+ var body : some View {
8
9
  AnyView(NavigationView {
9
10
  if let countryCode = product.countryCode {
10
11
  SmileID.documentVerificationScreen(
11
12
  userId: product.userId ?? generateUserId(),
12
13
  jobId: product.jobId ?? generateJobId(),
14
+ allowNewEnroll: product.allowNewEnroll,
13
15
  countryCode: countryCode, // already validated in SmileIDDocumentVerificationViewManager
14
16
  documentType: product.documentType,
15
17
  idAspectRatio: product.idAspectRatio,
@@ -46,7 +48,7 @@ extension SmileIDDocumentVerificationView: DocumentVerificationResultDelegate {
46
48
  }
47
49
  product.onResult?(["result": String(data: jsonData, encoding: .utf8)!])
48
50
  }
49
-
51
+
50
52
  func didError(error: Error) {
51
53
  product.onResult?(["error": error.localizedDescription])
52
54
  }
@@ -3,13 +3,15 @@ import Foundation
3
3
  import SmileID
4
4
  import SwiftUI
5
5
 
6
- class SmileIDEnhancedDocumentVerificationView: BaseSmileIDView {
7
- override func getView() -> AnyView {
8
- AnyView(NavigationView {
6
+ struct SmileIDEnhancedDocumentVerificationView: View {
7
+ @ObservedObject var product : SmileIDProductModel
8
+ var body: some View {
9
+ NavigationView {
9
10
  if let countryCode = product.countryCode {
10
11
  SmileID.enhancedDocumentVerificationScreen(
11
12
  userId: product.userId ?? generateUserId(),
12
13
  jobId: product.jobId ?? generateJobId(),
14
+ allowNewEnroll: product.allowNewEnroll,
13
15
  countryCode: countryCode, // already validated in the view manager
14
16
  documentType: product.documentType,
15
17
  idAspectRatio: product.idAspectRatio,
@@ -28,7 +30,7 @@ class SmileIDEnhancedDocumentVerificationView: BaseSmileIDView {
28
30
  // return an error if the required data is missing
29
31
  Text("An error has occured")
30
32
  }
31
- }.navigationViewStyle(StackNavigationViewStyle()))
33
+ }.navigationViewStyle(StackNavigationViewStyle())
32
34
  }
33
35
  }
34
36
 
@@ -3,19 +3,21 @@ import Foundation
3
3
  import SmileID
4
4
  import SwiftUI
5
5
 
6
- class SmileIDSmartSelfieAuthView: BaseSmileIDView {
7
- override func getView() -> AnyView {
8
- AnyView(NavigationView {
6
+ struct SmileIDSmartSelfieAuthView: View {
7
+ @ObservedObject var product : SmileIDProductModel
8
+ var body: some View {
9
+ NavigationView {
9
10
  SmileID.smartSelfieAuthenticationScreen(
10
11
  userId: product.userId ?? generateUserId(),
11
12
  jobId: product.jobId ?? generateJobId(),
13
+ allowNewEnroll: product.allowNewEnroll,
12
14
  allowAgentMode: product.allowAgentMode,
13
15
  showAttribution: product.showAttribution,
14
16
  showInstructions: product.showInstructions,
15
17
  extraPartnerParams: product.extraPartnerParams as [String: String],
16
18
  delegate: self
17
19
  )
18
- }.navigationViewStyle(StackNavigationViewStyle()))
20
+ }.navigationViewStyle(StackNavigationViewStyle())
19
21
  }
20
22
  }
21
23