@veriff/react-native-sdk 2.3.0 → 2.5.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.
package/README.md
CHANGED
|
@@ -1,75 +1,29 @@
|
|
|
1
|
-
---
|
|
2
|
-
owner: "End User"
|
|
3
|
-
description: "React Native wrapper around our native Android & iOS SDKs"
|
|
4
|
-
status: "production"
|
|
5
|
-
type: "library"
|
|
6
|
-
---
|
|
7
|
-
|
|
8
1
|
# Veriff React Native SDK
|
|
9
2
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
cd ios
|
|
35
|
-
bundle install
|
|
36
|
-
bundle exec pod update
|
|
37
|
-
|
|
38
|
-
# Finally bundle the .js files so that we can open the project and run in Xcode
|
|
39
|
-
cd ..
|
|
40
|
-
npx react-native bundle --dev false --platform ios --entry-file index.js --bundle-output ./ios/VeriffRN/main.jsbundle --assets-dest ./ios/VeriffRN
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Now you can open `example/ios/VeriffRN.xcworkspace` with Xcode and build for your target.
|
|
44
|
-
|
|
45
|
-
## Running RN SDK + example locally with Android
|
|
46
|
-
|
|
3
|
+
## Getting started
|
|
4
|
+
|
|
5
|
+
To start using the Veriff React Native SDK follow the steps described
|
|
6
|
+
[here](https://developers.veriff.com/#react-native-sdk-integration).
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
```javascript
|
|
11
|
+
import VeriffSdk from '@veriff/react-native-sdk';
|
|
12
|
+
|
|
13
|
+
var result = await VeriffSdk.launchVeriff({ sessionUrl: SESSION_URL });
|
|
14
|
+
switch (result.status) {
|
|
15
|
+
case VeriffSdk.statusDone:
|
|
16
|
+
// user submitted the images and completed the flow
|
|
17
|
+
// note that this does not mean a final decision yet
|
|
18
|
+
break;
|
|
19
|
+
case VeriffSdk.statusCanceled:
|
|
20
|
+
// user canceled the flow before completing
|
|
21
|
+
break;
|
|
22
|
+
case VeriffSdk.statusError:
|
|
23
|
+
// the flow could not be completed due to an error
|
|
24
|
+
console.log("Veriff verification failed with error=" + result.error);
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
47
27
|
```
|
|
48
|
-
# Clone the repository & move into it
|
|
49
|
-
git clone git@github.com:Veriff/react-native-sdk.git
|
|
50
|
-
cd react-native-sdk
|
|
51
|
-
|
|
52
|
-
# Install RN SDK dependencies
|
|
53
|
-
npx yarn install
|
|
54
|
-
|
|
55
|
-
# Move into the example folder and install deps there
|
|
56
|
-
cd example
|
|
57
|
-
npx yarn install
|
|
58
|
-
|
|
59
|
-
# Finally bundle the .js files so that we can open the project and run in Android Studio
|
|
60
|
-
cd ..
|
|
61
|
-
npx react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundlse --assets-dest ./android/app/src/main/res
|
|
62
|
-
|
|
63
|
-
# Open Android Studio
|
|
64
|
-
open -a "Android Studio.app" android
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## Troubleshooting
|
|
68
|
-
Sometimes you may do some changes but not receive any update on `react-native-sdk`. This is because of `npx yarn install` creating a copy to work with in example directory. To reflect/update the changes there;
|
|
69
|
-
|
|
70
|
-
- delete the `example/native_modules` in `example` directory
|
|
71
|
-
- do `npx install yarn` in `example` directory
|
|
72
|
-
|
|
73
|
-
## Downstream usage
|
|
74
28
|
|
|
75
|
-
See [
|
|
29
|
+
See more details [here](https://developers.veriff.com/#using-the-veriff-react-native-sdk).
|
package/android/build.gradle
CHANGED
|
@@ -78,7 +78,7 @@ repositories {
|
|
|
78
78
|
dependencies {
|
|
79
79
|
//noinspection GradleDynamicVersion
|
|
80
80
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
81
|
-
implementation 'com.veriff:veriff-library:3.+'
|
|
81
|
+
implementation 'com.veriff:veriff-library:3.21.+'
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
def configureReactNativePom(def pom) {
|
|
@@ -83,6 +83,7 @@ public class VeriffSdkModule extends ReactContextBaseJavaModule {
|
|
|
83
83
|
public static final String KEY_STATUS_BAR_COLOR = "statusBarColor";
|
|
84
84
|
public static final String KEY_PRIMARY_TEXT_COLOR = "primaryTextColor";
|
|
85
85
|
public static final String KEY_SECONDARY_TEXT_COLOR = "secondaryTextColor";
|
|
86
|
+
public static final String KEY_PRIMARY_BUTTON_BACKGROUND_COLOR = "primaryButtonBackgroundColor";
|
|
86
87
|
public static final String KEY_BUTTON_CORNER_RADIUS = "buttonCornerRadius";
|
|
87
88
|
private static final String KEY_CUSTOM_INTRO_SCREEN = "customIntroScreen";
|
|
88
89
|
private static final String KEY_RN_IMAGE_URI = "uri";
|
|
@@ -250,6 +251,9 @@ public class VeriffSdkModule extends ReactContextBaseJavaModule {
|
|
|
250
251
|
if (brandConfig.hasKey(KEY_SECONDARY_TEXT_COLOR)) {
|
|
251
252
|
branding.secondaryTextColor(parseColor(brandConfig.getString(KEY_SECONDARY_TEXT_COLOR)));
|
|
252
253
|
}
|
|
254
|
+
if (brandConfig.hasKey(KEY_PRIMARY_BUTTON_BACKGROUND_COLOR)) {
|
|
255
|
+
branding.primaryButtonBackgroundColor(parseColor(brandConfig.getString(KEY_PRIMARY_BUTTON_BACKGROUND_COLOR)));
|
|
256
|
+
}
|
|
253
257
|
if (brandConfig.hasKey(KEY_BUTTON_CORNER_RADIUS)) {
|
|
254
258
|
branding.buttonCornerRadius((float)brandConfig.getDouble(KEY_BUTTON_CORNER_RADIUS));
|
|
255
259
|
}
|
package/ios/VeriffSdk.m
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#import <React/RCTBridgeModule.h>
|
|
2
2
|
|
|
3
|
-
@interface
|
|
3
|
+
@interface RCT_EXTERN_REMAP_MODULE(VeriffSdk, VeriffSdkReactWrapper, NSObject)
|
|
4
4
|
|
|
5
5
|
RCT_EXTERN_METHOD(launchVeriff:(NSDictionary *)configuration resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
6
6
|
|
package/ios/VeriffSdk.swift
CHANGED
|
@@ -2,7 +2,7 @@ import Foundation
|
|
|
2
2
|
import Veriff
|
|
3
3
|
import UIKit
|
|
4
4
|
|
|
5
|
-
@objc(
|
|
5
|
+
@objc(VeriffSdkReactWrapper)
|
|
6
6
|
class VeriffSdk: NSObject {
|
|
7
7
|
/**
|
|
8
8
|
* Indicates that the parameters passed to |launchVeriff([String: AnyObject]], RCTPromiseResolveBlock,RCTPromiseRejectBlock| were invalid.
|
|
@@ -34,6 +34,7 @@ class VeriffSdk: NSObject {
|
|
|
34
34
|
private static let STATUS_BAR_COLOR = "statusBarColor"
|
|
35
35
|
private static let PRIMARY_TEXT_COLOR = "primaryTextColor"
|
|
36
36
|
private static let SECONDARY_TEXT_COLOR = "secondaryTextColor"
|
|
37
|
+
private static let PRIMARY_BUTTON_BACKGROUND_COLOR = "primaryButtonBackgroundColor"
|
|
37
38
|
private static let BUTTON_CORNER_RADIUS = "buttonCornerRadius"
|
|
38
39
|
private static let USE_CUSTOM_INTRO_SCREEN = "customIntroScreen"
|
|
39
40
|
|
|
@@ -94,6 +95,7 @@ class VeriffSdk: NSObject {
|
|
|
94
95
|
branding?.statusBarColor = (brandingConfig[VeriffSdk.STATUS_BAR_COLOR] as? String).map { VeriffSdk.parseColor(hexcolor: $0) }
|
|
95
96
|
branding?.primaryTextColor = (brandingConfig[VeriffSdk.PRIMARY_TEXT_COLOR] as? String).map { VeriffSdk.parseColor(hexcolor: $0) }
|
|
96
97
|
branding?.secondaryTextColor = (brandingConfig[VeriffSdk.SECONDARY_TEXT_COLOR] as? String).map { VeriffSdk.parseColor(hexcolor: $0) }
|
|
98
|
+
branding?.primaryButtonBackgroundColor = (brandingConfig[VeriffSdk.PRIMARY_BUTTON_BACKGROUND_COLOR] as? String).map { VeriffSdk.parseColor(hexcolor: $0) }
|
|
97
99
|
branding?.buttonCornerRadius = (brandingConfig[VeriffSdk.BUTTON_CORNER_RADIUS] as? Double).map { CGFloat($0) }
|
|
98
100
|
}
|
|
99
101
|
|
|
@@ -126,6 +128,7 @@ class VeriffSdk: NSObject {
|
|
|
126
128
|
|
|
127
129
|
let veriff = Veriff.VeriffSdk.shared
|
|
128
130
|
veriff.delegate = self
|
|
131
|
+
veriff.implementationType = .reactNative
|
|
129
132
|
veriffConfiguration?.queryItems = VeriffSdk.updateConfigWithQueryItems(urlString: sessionUrl!)
|
|
130
133
|
veriff.startAuthentication(sessionUrl: sessionUrl!, configuration: veriffConfiguration)
|
|
131
134
|
}
|
package/package.json
CHANGED
package/react-native-sdk.podspec
CHANGED
package/README
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# Veriff React Native SDK
|
|
2
|
-
|
|
3
|
-
## Getting started
|
|
4
|
-
|
|
5
|
-
To start using the Veriff React Native SDK follow the steps described
|
|
6
|
-
[here](https://developers.veriff.com/#react-native-sdk-integration).
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```javascript
|
|
11
|
-
import VeriffSdk from '@veriff/react-native-sdk';
|
|
12
|
-
|
|
13
|
-
var result = await VeriffSdk.launchVeriff({ sessionUrl: SESSION_URL });
|
|
14
|
-
switch (result.status) {
|
|
15
|
-
case VeriffSdk.statusDone:
|
|
16
|
-
// user submitted the images and completed the flow
|
|
17
|
-
// note that this does not mean a final decision yet
|
|
18
|
-
break;
|
|
19
|
-
case VeriffSdk.statusCanceled:
|
|
20
|
-
// user canceled the flow before completing
|
|
21
|
-
break;
|
|
22
|
-
case VeriffSdk.statusError:
|
|
23
|
-
// the flow could not be completed due to an error
|
|
24
|
-
console.log("Veriff verification failed with error=" + result.error);
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
See more details [here](https://developers.veriff.com/#using-the-veriff-react-native-sdk).
|