@idnow/react-idcheckio 7.2.2 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +15 -0
- package/.gitattributes +2 -0
- package/README.md +236 -193
- package/android/build.gradle +95 -37
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +5 -4
- package/android/src/main/AndroidManifestNew.xml +9 -0
- package/android/src/main/java/com/idnowreactidcheckio/IdnowReactIdcheckioActivity.kt +67 -0
- package/android/src/main/java/com/idnowreactidcheckio/IdnowReactIdcheckioModule.kt +115 -0
- package/android/src/main/java/com/idnowreactidcheckio/IdnowReactIdcheckioPackage.kt +17 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/ExtractionEnum.kt +6 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/ExtractionReact.kt +20 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/IntegrityCheckEnum.kt +6 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/IntegrityCheckReact.kt +18 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/OnlineConfigEnum.kt +9 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/ParamsEnum.kt +19 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/Theme.kt +29 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/ThemeEnum.kt +13 -0
- package/android/src/main/java/com/idnowreactidcheckio/utils/Extension.kt +20 -0
- package/android/src/main/java/com/idnowreactidcheckio/utils/Mapper.kt +178 -0
- package/android/src/main/res/layout/activity_idnow_react_idcheckio.xml +9 -0
- package/idnow-react-idcheckio.podspec +43 -0
- package/ios/IdnowReactIdcheckio-Bridging-Header.h +2 -0
- package/ios/IdnowReactIdcheckio.mm +29 -0
- package/ios/IdnowReactIdcheckio.swift +131 -0
- package/ios/Models/ExtractionEnum.swift +13 -0
- package/ios/Models/ExtractionReact.swift +23 -0
- package/ios/Models/IntegrityCheckEnum.swift +13 -0
- package/ios/Models/IntegrityCheckReact.swift +24 -0
- package/ios/Models/OnlineConfigEnum.swift +16 -0
- package/ios/Models/ParamsEnum.swift +26 -0
- package/ios/Models/ThemeEnum.swift +20 -0
- package/ios/Models/ThemeReact.swift +32 -0
- package/ios/Utils/Mapper.swift +139 -0
- package/package.json +14 -11
- package/release-public.sh +4 -4
- package/src/index.d.ts +259 -0
- package/src/index.js +270 -0
- package/tsconfig.json +12 -0
- package/ReactIdcheckio.podspec +0 -15
- package/android/.project +0 -17
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/android/src/main/java/com/ariadnext/idcheckio/IdcheckioActivity.java +0 -133
- package/android/src/main/java/com/ariadnext/idcheckio/IdcheckioConst.java +0 -39
- package/android/src/main/java/com/ariadnext/idcheckio/IdcheckioModule.java +0 -189
- package/android/src/main/java/com/ariadnext/idcheckio/IdcheckioPackage.java +0 -22
- package/android/src/main/java/com/ariadnext/idcheckio/ParameterUtils.java +0 -251
- package/idcheckio_params.js +0 -343
- package/index.js +0 -6
- package/ios/Idcheckio.h +0 -11
- package/ios/Idcheckio.m +0 -301
- package/ios/Idcheckio.xcodeproj/project.pbxproj +0 -340
- package/ios/Idcheckio.xcworkspace/contents.xcworkspacedata +0 -10
- package/ios/Idcheckio.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/IdcheckioKeys.h +0 -49
- package/ios/IdcheckioSdk+Utils.swift +0 -35
package/.editorconfig
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# EditorConfig helps developers define and maintain consistent
|
|
2
|
+
# coding styles between different editors and IDEs
|
|
3
|
+
# editorconfig.org
|
|
4
|
+
|
|
5
|
+
root = true
|
|
6
|
+
|
|
7
|
+
[*]
|
|
8
|
+
|
|
9
|
+
indent_style = space
|
|
10
|
+
indent_size = 2
|
|
11
|
+
|
|
12
|
+
end_of_line = lf
|
|
13
|
+
charset = utf-8
|
|
14
|
+
trim_trailing_whitespace = true
|
|
15
|
+
insert_final_newline = true
|
package/.gitattributes
CHANGED
package/README.md
CHANGED
|
@@ -2,233 +2,276 @@
|
|
|
2
2
|
|
|
3
3
|
## Getting started
|
|
4
4
|
|
|
5
|
-
#### Local setup for react-idcheckio
|
|
6
|
-
See [GitHub documentation](https://github.com/ariadnext/React-Native-SmartSDK/tree/master/react-idcheckio#getting-started) for setting up the local library.
|
|
7
|
-
|
|
8
5
|
### Install from NPM
|
|
9
|
-
```
|
|
6
|
+
```sh
|
|
10
7
|
// with npm
|
|
11
|
-
npm install react-idcheckio
|
|
8
|
+
npm install @idnow/react-idcheckio
|
|
12
9
|
|
|
13
10
|
// with yarn
|
|
14
|
-
yarn add react-idcheckio
|
|
11
|
+
yarn add @idnow/react-idcheckio
|
|
15
12
|
```
|
|
16
13
|
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
#### iOS
|
|
14
|
+
## Usage
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
- Change the minimum version to at least '10.0'
|
|
23
|
-
- Add the following lines before the target :
|
|
24
|
-
```
|
|
25
|
-
source 'https://github.com/CocoaPods/Specs.git'
|
|
26
|
-
source 'https://git-externe.rennes.ariadnext.com/idcheckio/axt-podspecs.git'
|
|
27
|
-
```
|
|
28
|
-
- Add `use_frameworks!` before the `use_native_modules!`
|
|
16
|
+
You will have access to four methods to communicate with the sdk.
|
|
29
17
|
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
```js
|
|
19
|
+
/**
|
|
20
|
+
* Preload the native models of the sdk.
|
|
21
|
+
*
|
|
22
|
+
* @param extractData - A boolean indicating whether to use extract data. True by default.
|
|
23
|
+
* @returns Void on success.
|
|
24
|
+
*/
|
|
25
|
+
export function preload(extractData: boolean): void;
|
|
32
26
|
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Activates the sdk with the given token.
|
|
29
|
+
*
|
|
30
|
+
* @param token - The token string used for activation.
|
|
31
|
+
* @param extractData - A boolean indicating whether to use extract data. True by default.
|
|
32
|
+
* @returns Void on success.
|
|
33
|
+
* @throws An error of type {@link IDCheckioError} if the activation fails.
|
|
34
|
+
*/
|
|
35
|
+
export function activate(token: string, extractData: boolean): Promise<void>;
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Start an onboarding session with the given folder uid.
|
|
39
|
+
*
|
|
40
|
+
* @param folderUid - The folder that will be used to run the session.
|
|
41
|
+
* @param theme - A theme to customize SDK colors.
|
|
42
|
+
* @returns Void on success.
|
|
43
|
+
* @throws An error of type {@link IDCheckioError} if the session fails.
|
|
44
|
+
*/
|
|
45
|
+
export function startOnboarding(folderUid: string, theme: IDCheckTheme | null): Promise<void>;
|
|
37
46
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Start the capture of one document with the given parameters.
|
|
49
|
+
*
|
|
50
|
+
* @param parameters - The parameters to configure the capture session.
|
|
51
|
+
* @param onlineContext - Online context. Let it null and the first capture and send the one you receive on result to chain to capture.
|
|
52
|
+
* @param theme - A theme to customize SDK colors.
|
|
53
|
+
* @returns {@link IDCheckioResult}
|
|
54
|
+
* @throws An error of type {@link IDCheckioError} if the capture fails.
|
|
55
|
+
*/
|
|
56
|
+
export function start(parameters: IDCheckioParams, onlineContext: IDCheckioOnlineContext | null, theme: IDCheckTheme | null): Promise<IDCheckioResult>;
|
|
41
57
|
```
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
pickFirst '**/x86_64/libc++_shared.so'
|
|
50
|
-
pickFirst '**/x86/libjsc.so'
|
|
51
|
-
pickFirst '**/armeabi-v7a/libjsc.so'
|
|
52
|
-
pickFirst 'META-INF/DEPENDENCIES'
|
|
53
|
-
pickFirst 'META-INF/notice.txt'
|
|
54
|
-
pickFirst 'META-INF/license.txt'
|
|
55
|
-
}
|
|
58
|
+
### Preload
|
|
59
|
+
The `preload` is completely optional and will preload the embedded model of the sdk, this way the `activate` will be faster afterwards.
|
|
60
|
+
You don't to wait for a result, there is no result expected.
|
|
61
|
+
```js
|
|
62
|
+
import { preload } from '@idnow/react-idcheckio';
|
|
63
|
+
|
|
64
|
+
const preloadSdk = preload(true);
|
|
56
65
|
```
|
|
57
66
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
### Activate
|
|
68
|
+
The `activate` is a mandatory call that need to be done once before starting any session. The token is unique and will be provided by our CS team, contact them at csm@idnow.io if needed.
|
|
69
|
+
On a success, no result is expected, on error you will receive an `IDCheckioError`, check the error section for more information.
|
|
70
|
+
```js
|
|
71
|
+
import { activate } from '@idnow/react-idcheckio';
|
|
72
|
+
|
|
73
|
+
const activateSdk = async () => {
|
|
74
|
+
activate('YOUR_ACTIVATION_TOKEN', true).then(
|
|
75
|
+
() => {
|
|
76
|
+
setIsSdkActivated(true);
|
|
77
|
+
},
|
|
78
|
+
(error) => {
|
|
79
|
+
handleError(error.message);
|
|
64
80
|
}
|
|
65
|
-
|
|
66
|
-
}
|
|
81
|
+
);
|
|
82
|
+
};
|
|
67
83
|
```
|
|
68
84
|
|
|
69
|
-
|
|
85
|
+
### Start an onboarding (recommended)
|
|
86
|
+
The onboarding mode is the recommended mode to start the sdk as it simplify a lot the integration and improve the UX.
|
|
87
|
+
To start it you need to call the `startOnboarding` with a CIS folderUid, if the folder already exists, every captured document will be pushed into it. And if the folderUid does not exist it will be created.
|
|
70
88
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
```
|
|
89
|
+
All the parameters of the onboarding are on the server you don't have to set any parameter on your side. (To check what is configurable, look at the official documentation or contact your dedicated CSM).
|
|
90
|
+
|
|
91
|
+
You can also provide an `IDCheckTheme` to customize the colors of the sdk, check the associated section for more information.
|
|
92
|
+
|
|
93
|
+
No result is expected, you will also receive an `IDCheckioError` if something happens during the session.
|
|
94
|
+
```js
|
|
95
|
+
import { startOnboarding } from '@idnow/react-idcheckio';
|
|
77
96
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
)
|
|
87
|
-
if (granted[PermissionsAndroid.PERMISSIONS.CAMERA] === PermissionsAndroid.RESULTS.GRANTED) {} else {
|
|
88
|
-
console.log("Permission denied")
|
|
89
|
-
}
|
|
90
|
-
} catch (err) {
|
|
91
|
-
console.warn(err);
|
|
97
|
+
const startCapture = async () => {
|
|
98
|
+
let theme = new IDCheckTheme({});
|
|
99
|
+
startOnboarding(generateUUID(), theme).then(
|
|
100
|
+
() => {
|
|
101
|
+
Alert.alert('Success', 'Onboarding ended successfully.');
|
|
102
|
+
},
|
|
103
|
+
(error) => {
|
|
104
|
+
handleError(error.message);
|
|
92
105
|
}
|
|
93
|
-
|
|
106
|
+
);
|
|
107
|
+
};
|
|
94
108
|
```
|
|
95
109
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
```
|
|
110
|
+
### Start a capture session
|
|
111
|
+
The start mode is a single capture of a document that can be configured directly in the code.
|
|
112
|
+
To perform a full onboarding, you must manage the flow of multiple documents yourself by calling `start` as many times as you have documents to capture.
|
|
113
|
+
|
|
114
|
+
To start it, you need to call the `start` with an `IDCheckioParams` object containing all the parameters you have set for this capture, an optional `IDCheckioOnlineContext` and an optional `IDCheckTheme`.
|
|
102
115
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
116
|
+
The result is an `IDCheckioResult` that will only contain an `IDCheckioOnlineContext`. I will explain more about this `IDCheckioOnlineContext` in the dedicated section.
|
|
117
|
+
Like others calls, you will also receive an `IDCheckioError` if something happens during the session.
|
|
118
|
+
```js
|
|
119
|
+
import { useState } from 'react';
|
|
120
|
+
import { start } from '@idnow/react-idcheckio';
|
|
121
|
+
|
|
122
|
+
const [onlineContext, setOnlineContext] = useState<IDCheckioOnlineContext | null>(null);
|
|
123
|
+
|
|
124
|
+
const startCapture = async () => {
|
|
125
|
+
let theme = new IDCheckTheme({});
|
|
126
|
+
let params = new IDCheckioParamsBuilder().build();
|
|
127
|
+
start(params, onlineContext, theme).then(
|
|
128
|
+
(result) => {
|
|
129
|
+
setOnlineContext(result.onlineContext);
|
|
130
|
+
Alert.alert('Success', 'Capture ended successfully.');
|
|
110
131
|
},
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
});
|
|
117
|
-
}
|
|
132
|
+
(error) => {
|
|
133
|
+
handleError(error.message);
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
};
|
|
118
137
|
```
|
|
119
138
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
.
|
|
126
|
-
.
|
|
127
|
-
.
|
|
128
|
-
.
|
|
129
|
-
.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
.
|
|
133
|
-
.
|
|
134
|
-
.
|
|
135
|
-
.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
.
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
139
|
+
#### Recommended parameters for each document type
|
|
140
|
+
|
|
141
|
+
Here is a list of the best practice we recommend for each document.
|
|
142
|
+
```js
|
|
143
|
+
const id = new IDCheckioParamsBuilder()
|
|
144
|
+
.setDocType(DocumentType.ID)
|
|
145
|
+
.setOrientation(IDCheckioOrientation.PORTRAIT)
|
|
146
|
+
.setIntegrityCheck(new IntegrityCheck({ readEmrtd: false, docLiveness: false }))
|
|
147
|
+
.setOnlineConfig(new OnlineConfig({ isReferenceDocument: true }))
|
|
148
|
+
.build()
|
|
149
|
+
|
|
150
|
+
const liveness = new IDCheckioParamsBuilder()
|
|
151
|
+
.setDocType(DocumentType.LIVENESS)
|
|
152
|
+
.setOrientation(IDCheckioOrientation.PORTRAIT)
|
|
153
|
+
.setConfirmAbort(true)
|
|
154
|
+
.build()
|
|
155
|
+
|
|
156
|
+
const frenchHealthCard = new IDCheckioParamsBuilder()
|
|
157
|
+
.setDocType(DocumentType.FRENCH_HEALTH_CARD)
|
|
158
|
+
.setConfirmationType(ConfirmationType.DATA_OR_PICTURE)
|
|
159
|
+
.setOrientation(IDCheckioOrientation.PORTRAIT)
|
|
160
|
+
.build()
|
|
161
|
+
|
|
162
|
+
const selfie = new IDCheckioParamsBuilder()
|
|
163
|
+
.setDocType(DocumentType.SELFIE)
|
|
164
|
+
.setConfirmationType(ConfirmationType.DATA_OR_PICTURE)
|
|
165
|
+
.setOrientation(IDCheckioOrientation.PORTRAIT)
|
|
166
|
+
.build()
|
|
167
|
+
|
|
168
|
+
const addressProof = new IDCheckioParamsBuilder()
|
|
169
|
+
.setDocType(DocumentType.A4)
|
|
170
|
+
.setConfirmationType(ConfirmationType.DATA_OR_PICTURE)
|
|
171
|
+
.setOrientation(IDCheckioOrientation.PORTRAIT)
|
|
172
|
+
.setUseHd(true)
|
|
173
|
+
.setOnlineConfig(new OnlineConfig({ cisType: CISType.ADDRESS_PROOF }))
|
|
174
|
+
.build()
|
|
150
175
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
.
|
|
155
|
-
.
|
|
156
|
-
.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
.
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
.
|
|
169
|
-
|
|
170
|
-
|
|
176
|
+
const vehicleRegistration = new IDCheckioParamsBuilder()
|
|
177
|
+
.setDocType(DocumentType.VEHICLE_REGISTRATION)
|
|
178
|
+
.setConfirmationType(ConfirmationType.DATA_OR_PICTURE)
|
|
179
|
+
.setOrientation(IDCheckioOrientation.PORTRAIT)
|
|
180
|
+
.setSideOneExtraction(new Extraction(Codeline.VALID, FaceDetection.DISABLED))
|
|
181
|
+
.build()
|
|
182
|
+
|
|
183
|
+
const iban = new IDCheckioParamsBuilder()
|
|
184
|
+
.setDocType(DocumentType.PHOTO)
|
|
185
|
+
.setOrientation(IDCheckioOrientation.PORTRAIT)
|
|
186
|
+
.setCaptureMode(CaptureMode.PROMPT)
|
|
187
|
+
.setOnlineConfig(new OnlineConfig({ cisType: CISType.IBAN }))
|
|
188
|
+
.build()
|
|
189
|
+
|
|
190
|
+
const attachment = new IDCheckioParamsBuilder()
|
|
191
|
+
.setDocType(DocumentType.PHOTO)
|
|
192
|
+
.setConfirmationType(ConfirmationType.DATA_OR_PICTURE)
|
|
193
|
+
.setOrientation(IDCheckioOrientation.PORTRAIT)
|
|
194
|
+
.setUseHd(true)
|
|
195
|
+
.setAdjustCrop(true)
|
|
196
|
+
.setOnlineConfig(new OnlineConfig({ cisType: CISType.OTHER }))
|
|
197
|
+
.setOverrideWordings(new Map([
|
|
198
|
+
// Label that will update the type of document wanted in the title of the presentation page.
|
|
199
|
+
['label', 'document'],
|
|
200
|
+
// A quick description of the document you want your users to capture. Can be useful if the label is not clear by itself.
|
|
201
|
+
['description', 'Capture a document of your choice.'],
|
|
202
|
+
]))
|
|
203
|
+
.build()
|
|
171
204
|
```
|
|
172
205
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
launchImageLibrary(options, (response) => {
|
|
185
|
-
if (response.didCancel) {
|
|
186
|
-
console.log('User cancelled image picker');
|
|
187
|
-
} else if (response.error) {
|
|
188
|
-
console.log('ImagePicker Error: ', response.error);
|
|
189
|
-
} else if (response.customButton) {
|
|
190
|
-
console.log('User tapped custom button: ', response.customButton);
|
|
191
|
-
} else {
|
|
192
|
-
const source = { uri: response.assets[0].uri };
|
|
193
|
-
// You can also display the image using data:
|
|
194
|
-
// const source = { uri: 'data:image/jpeg;base64,' + response.data };
|
|
195
|
-
IdcheckioModule.analyze(params, source.uri, null, true, onlineContext)
|
|
196
|
-
.then(data => {
|
|
197
|
-
console.log(data);
|
|
198
|
-
let results = JSON.parse(data)
|
|
199
|
-
this.response_server(results);
|
|
200
|
-
},
|
|
201
|
-
cause => {
|
|
202
|
-
this.showError(cause);
|
|
203
|
-
})
|
|
204
|
-
.catch(err => {
|
|
205
|
-
console.log(err);
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
}
|
|
206
|
+
#### IDCheckioOnlineContext
|
|
207
|
+
The `IDCheckioOnlineContext` is an object that will be used by the sdk to chain the capture in a none onboarding mode.
|
|
208
|
+
In the first capture, you can set it to null and for the other captures you need to retrieve the `IDCheckioOnlineContext` from the latest `IDCheckioResult` and set it to the next call of the `start` method.
|
|
209
|
+
|
|
210
|
+
#### IDCheckioResult
|
|
211
|
+
The `IDCheckioResult` is only used in response of a `start` to retrieve the `IDCheckioOnlineContext`.
|
|
212
|
+
```js
|
|
213
|
+
export type IDCheckioResult = {
|
|
214
|
+
onlineContext: IDCheckioOnlineContext;
|
|
215
|
+
};
|
|
210
216
|
```
|
|
211
217
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
218
|
+
### IDCheckioError
|
|
219
|
+
Here is the content of an error, you will find this object in the message of the error you will receive.
|
|
220
|
+
```js
|
|
221
|
+
export type IDCheckioError = {
|
|
222
|
+
cause: IDCheckioErrorCause;
|
|
223
|
+
details: string;
|
|
224
|
+
subCause?: IDCheckioSubCause | undefined;
|
|
225
|
+
message?: string | undefined;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export type IDCheckioErrorCause =
|
|
229
|
+
| 'CUSTOMER_ERROR'
|
|
230
|
+
| 'NETWORK_ERROR'
|
|
231
|
+
| 'USER_ERROR'
|
|
232
|
+
| 'INTERNAL_ERROR'
|
|
233
|
+
| 'DEVICE_ERROR'
|
|
234
|
+
| 'DOCUMENT_ERROR';
|
|
235
|
+
|
|
236
|
+
export type IDCheckioSubCause =
|
|
237
|
+
| 'MISSING_PERMISSIONS'
|
|
238
|
+
| 'CANCELLED_BY_USER'
|
|
239
|
+
| 'MODEL_REJECTED'
|
|
240
|
+
| 'ANALYSIS_EXPIRED_DOC'
|
|
241
|
+
| 'PVID_NOT_ELIGIBLE'
|
|
242
|
+
| 'UNIDENTIFIED'
|
|
243
|
+
| 'DOC_NOT_USABLE_FACEREC'
|
|
244
|
+
| 'UNSUPPORTED_FILE_EXTENSION';
|
|
223
245
|
```
|
|
246
|
+
Two possibilities here, the easier is to handle the `IDCheckioErrorCause` and show generic errors for all or each cause.
|
|
247
|
+
|
|
248
|
+
If you want to go deeper, you can also handle the `IDCheckioSubCause`, those are mainly that the user did something wrong, and we had to stop the session after X retries.
|
|
249
|
+
You can if you want handle those and show some specific messages for each or for the ones you want. (For example if the user refuses the permission, you can tell him that it is mandatory to create an account, ...)
|
|
224
250
|
|
|
225
|
-
## Theming
|
|
226
251
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
252
|
+
### IDCheckTheme
|
|
253
|
+
When starting a single capture or an onboarding, you can provide an `IDCheckTheme` to customize the colors of the session.
|
|
254
|
+
The theme look like this :
|
|
255
|
+
```js
|
|
256
|
+
export class IDCheckTheme {
|
|
257
|
+
// Correspond to the primary color of the SDK, applied to buttons and images.
|
|
258
|
+
public primaryColor?: string | null;
|
|
259
|
+
// Correspond to the background color of all the presentation/informational views.
|
|
260
|
+
public foregroundColor?: string | null;
|
|
261
|
+
// Correspond to the color of the camera overlay.
|
|
262
|
+
public backgroundColor?: string | null;
|
|
263
|
+
// Correspond to the cropping mask border color.
|
|
264
|
+
public borderColor?: string | null;
|
|
265
|
+
// Not recommended to use it as by default the sdk will change the text color from white to black depending on the background it is on.
|
|
266
|
+
public textColor?: string | null;
|
|
267
|
+
// Not recommended to use it as by default the sdk will change the text color from white to black depending on the background it is on.
|
|
268
|
+
public titleColor?: string | null;
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
You need to provide the name of color (name of the resources for Android and name of the ColorAssets or iOS).
|
|
272
|
+
For example :
|
|
273
|
+
```js
|
|
274
|
+
new IDCheckTheme({ primaryColor: "blue", foregroundColor: "white", backgroundColor: "white", borderColor: "blue" })
|
|
231
275
|
```
|
|
232
276
|
|
|
233
277
|
|
|
234
|
-
- ✅ To learn more informations on those methods and theirs parameters. Please refer to the official IDCheck.io sdk documentation.
|
package/android/build.gradle
CHANGED
|
@@ -1,51 +1,109 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
repositories {
|
|
6
|
-
google()
|
|
7
|
-
jcenter()
|
|
8
|
-
}
|
|
2
|
+
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
|
+
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["IdnowReactIdcheckio_kotlinVersion"]
|
|
9
4
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
mavenCentral()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
dependencies {
|
|
11
|
+
classpath "com.android.tools.build:gradle:8.2.2"
|
|
12
|
+
// noinspection DifferentKotlinGradleVersion
|
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def reactNativeArchitectures() {
|
|
18
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
19
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
def isNewArchitectureEnabled() {
|
|
23
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
15
24
|
}
|
|
16
25
|
|
|
17
|
-
apply plugin:
|
|
26
|
+
apply plugin: "com.android.library"
|
|
27
|
+
apply plugin: "kotlin-android"
|
|
28
|
+
|
|
29
|
+
if (isNewArchitectureEnabled()) {
|
|
30
|
+
apply plugin: "com.facebook.react"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
def getExtOrDefault(name) {
|
|
34
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["IdnowReactIdcheckio_" + name]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
def getExtOrIntegerDefault(name) {
|
|
38
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["IdnowReactIdcheckio_" + name]).toInteger()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
def supportsNamespace() {
|
|
42
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
43
|
+
def major = parsed[0].toInteger()
|
|
44
|
+
def minor = parsed[1].toInteger()
|
|
45
|
+
|
|
46
|
+
// Namespace support was added in 7.3.0
|
|
47
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
48
|
+
}
|
|
18
49
|
|
|
19
50
|
android {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
51
|
+
if (supportsNamespace()) {
|
|
52
|
+
namespace "com.idnowreactidcheckio"
|
|
53
|
+
|
|
54
|
+
sourceSets {
|
|
55
|
+
main {
|
|
56
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
62
|
+
|
|
63
|
+
defaultConfig {
|
|
64
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
65
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
buildTypes {
|
|
70
|
+
release {
|
|
71
|
+
minifyEnabled false
|
|
28
72
|
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
lintOptions {
|
|
76
|
+
disable "GradleCompatible"
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
compileOptions {
|
|
80
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
81
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
kotlinOptions {
|
|
85
|
+
jvmTarget = JavaVersion.VERSION_17.toString()
|
|
86
|
+
}
|
|
29
87
|
}
|
|
30
88
|
|
|
31
89
|
repositories {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
35
|
-
url("$rootDir/../node_modules/react-native/android")
|
|
36
|
-
}
|
|
37
|
-
maven {
|
|
38
|
-
// Android JSC is installed from npm
|
|
39
|
-
url("$rootDir/../node_modules/jsc-android/dist")
|
|
40
|
-
}
|
|
41
|
-
google()
|
|
42
|
-
jcenter()
|
|
43
|
-
maven { url 'https://jitpack.io' }
|
|
90
|
+
mavenCentral()
|
|
91
|
+
google()
|
|
44
92
|
}
|
|
45
93
|
|
|
94
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
95
|
+
|
|
46
96
|
dependencies {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
97
|
+
// For < 0.71, this will be from the local maven repo
|
|
98
|
+
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
99
|
+
//noinspection GradleDynamicVersion
|
|
100
|
+
implementation "com.facebook.react:react-native:+"
|
|
101
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
102
|
+
implementation('com.ariadnext.android.idcheckio:sdk:8.0.0@aar') {
|
|
103
|
+
transitive = true
|
|
104
|
+
}
|
|
105
|
+
implementation 'androidx.appcompat:appcompat:1.7.0'
|
|
106
|
+
implementation 'com.google.android.material:material:1.12.0'
|
|
107
|
+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
|
51
108
|
}
|
|
109
|
+
|