@idnow/react-idcheckio 9.0.3 → 9.1.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 +22 -44
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/idnowreactidcheckio/IDCheckIOBridgeModule.kt +2 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/ParamsEnum.kt +1 -2
- package/android/src/main/java/com/idnowreactidcheckio/utils/Mapper.kt +0 -1
- package/app.plugin.js +1 -1
- package/ios/IDCheckIOBridgeModule.swift +1 -1
- package/ios/Models/ParamsEnum.swift +0 -1
- package/ios/Utils/Mapper.swift +0 -2
- package/package.json +1 -1
- package/release-public.sh +2 -2
- package/src/index.d.ts +0 -3
- package/src/index.js +1 -25
package/README.md
CHANGED
|
@@ -11,6 +11,24 @@ npm install @idnow/react-idcheckio
|
|
|
11
11
|
yarn add @idnow/react-idcheckio
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
+
You need to add this into your `app.json` to link the plugin IDCheckIO.
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"expo": {
|
|
19
|
+
"plugins": [
|
|
20
|
+
[
|
|
21
|
+
"@idnow/react-idcheckio",
|
|
22
|
+
{
|
|
23
|
+
"version": "9.1.0"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
|
|
14
32
|
## Usage
|
|
15
33
|
|
|
16
34
|
You will have access to four methods to communicate with the sdk.
|
|
@@ -38,22 +56,20 @@ You will have access to four methods to communicate with the sdk.
|
|
|
38
56
|
* Start an onboarding session with the given folder uid.
|
|
39
57
|
*
|
|
40
58
|
* @param folderUid - The folder that will be used to run the session.
|
|
41
|
-
* @param theme - A theme to customize SDK colors.
|
|
42
59
|
* @returns Void on success.
|
|
43
60
|
* @throws An error of type {@link IDCheckioError} if the session fails.
|
|
44
61
|
*/
|
|
45
|
-
export function startOnboarding(folderUid: string
|
|
62
|
+
export function startOnboarding(folderUid: string): Promise<void>;
|
|
46
63
|
|
|
47
64
|
/**
|
|
48
65
|
* Start the capture of one document with the given parameters.
|
|
49
66
|
*
|
|
50
67
|
* @param parameters - The parameters to configure the capture session.
|
|
51
68
|
* @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
69
|
* @returns {@link IDCheckioResult}
|
|
54
70
|
* @throws An error of type {@link IDCheckioError} if the capture fails.
|
|
55
71
|
*/
|
|
56
|
-
export function startSession(onlineContext: IDCheckioOnlineContext | null, parameters: IDCheckioParams
|
|
72
|
+
export function startSession(onlineContext: IDCheckioOnlineContext | null, parameters: IDCheckioParams): Promise<IDCheckioResult>;
|
|
57
73
|
```
|
|
58
74
|
### Preload
|
|
59
75
|
The `preload` is completely optional and will preload the embedded model of the sdk, this way the `activate` will be faster afterwards.
|
|
@@ -88,15 +104,12 @@ To start it you need to call the `startOnboarding` with a CIS folderUid, if the
|
|
|
88
104
|
|
|
89
105
|
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
106
|
|
|
91
|
-
You can also provide an `IDCheckTheme` to customize the colors of the sdk, check the associated section for more information.
|
|
92
|
-
|
|
93
107
|
No result is expected, you will also receive an `IDCheckioError` if something happens during the session.
|
|
94
108
|
```js
|
|
95
109
|
import { startOnboarding } from '@idnow/react-idcheckio';
|
|
96
110
|
|
|
97
111
|
const startCapture = async () => {
|
|
98
|
-
|
|
99
|
-
startOnboarding(generateUUID(), theme).then(
|
|
112
|
+
startOnboarding(generateUUID()).then(
|
|
100
113
|
() => {
|
|
101
114
|
Alert.alert('Success', 'Onboarding ended successfully.');
|
|
102
115
|
},
|
|
@@ -111,7 +124,7 @@ const startCapture = async () => {
|
|
|
111
124
|
The start mode is a single capture of a document that can be configured directly in the code.
|
|
112
125
|
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
126
|
|
|
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
|
|
127
|
+
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`.
|
|
115
128
|
|
|
116
129
|
The result is an `IDCheckioResult` that will only contain an `IDCheckioOnlineContext`. I will explain more about this `IDCheckioOnlineContext` in the dedicated section.
|
|
117
130
|
Like others calls, you will also receive an `IDCheckioError` if something happens during the session.
|
|
@@ -122,7 +135,6 @@ import { start } from '@idnow/react-idcheckio';
|
|
|
122
135
|
const [onlineContext, setOnlineContext] = useState<IDCheckioOnlineContext | null>(null);
|
|
123
136
|
|
|
124
137
|
const startCapture = async () => {
|
|
125
|
-
let theme = new IDCheckTheme({});
|
|
126
138
|
let params = new IDCheckioParamsBuilder().build();
|
|
127
139
|
startSession(onlineContext, params).then(
|
|
128
140
|
(result) => {
|
|
@@ -194,12 +206,6 @@ const attachment = new IDCheckioParamsBuilder()
|
|
|
194
206
|
.setUseHd(true)
|
|
195
207
|
.setAdjustCrop(true)
|
|
196
208
|
.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
209
|
.build()
|
|
204
210
|
```
|
|
205
211
|
|
|
@@ -247,31 +253,3 @@ Two possibilities here, the easier is to handle the `IDCheckioErrorCause` and sh
|
|
|
247
253
|
|
|
248
254
|
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
255
|
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, ...)
|
|
250
|
-
|
|
251
|
-
|
|
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" })
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
|
package/android/build.gradle
CHANGED
|
@@ -105,7 +105,7 @@ dependencies {
|
|
|
105
105
|
//noinspection GradleDynamicVersion
|
|
106
106
|
implementation "com.facebook.react:react-native:+"
|
|
107
107
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
108
|
-
implementation('com.ariadnext.android.idcheckio:sdk:9.0
|
|
108
|
+
implementation('com.ariadnext.android.idcheckio:sdk:9.1.0@aar') {
|
|
109
109
|
transitive = true
|
|
110
110
|
}
|
|
111
111
|
implementation 'androidx.appcompat:appcompat:1.7.0'
|
|
@@ -2,6 +2,7 @@ package com.idnowreactidcheckio
|
|
|
2
2
|
|
|
3
3
|
import android.app.Activity
|
|
4
4
|
import android.content.Intent
|
|
5
|
+
import com.ariadnext.idcheckio.data.params.Framework
|
|
5
6
|
import com.ariadnext.idcheckio.domain.utils.extension.toJson
|
|
6
7
|
import com.ariadnext.idcheckio.external.Idcheckio
|
|
7
8
|
import com.ariadnext.idcheckio.external.error.ErrorMsg
|
|
@@ -52,6 +53,7 @@ class IDCheckIOBridgeModule(private val reactContext: ReactApplicationContext) :
|
|
|
52
53
|
@ReactMethod
|
|
53
54
|
fun activate(token: String, extractData: Boolean, promise: Promise) {
|
|
54
55
|
this.promise = promise
|
|
56
|
+
Idcheckio.framework = Framework.REACT_NATIVE
|
|
55
57
|
Idcheckio.activate(token, reactContext, this, extractData)
|
|
56
58
|
}
|
|
57
59
|
|
|
@@ -91,7 +91,6 @@ internal object Mapper {
|
|
|
91
91
|
ParamsEnum.adjustCrop -> adjustCrop(value.toString().toBoolean())
|
|
92
92
|
ParamsEnum.confirmAbort -> confirmAbort(value.toString().toBoolean())
|
|
93
93
|
ParamsEnum.captureMode -> captureMode(CaptureMode.valueOf(value.toString()))
|
|
94
|
-
ParamsEnum.overrideWordings -> overrideWordings(value as Map<String, String>)
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
}
|
package/app.plugin.js
CHANGED
|
@@ -4,7 +4,7 @@ const copyNativeFiles = require('./plugins/copyNativeFiles');
|
|
|
4
4
|
|
|
5
5
|
const withIDCheckIO = (config, options = {}) => {
|
|
6
6
|
const {
|
|
7
|
-
version = '9.0
|
|
7
|
+
version = '9.1.0',
|
|
8
8
|
repositoryUrl = 'https://git-externe.rennes.ariadnext.com/idcheckio/idcheckiosdk-release-ios',
|
|
9
9
|
repoName = 'idcheckiosdk-release-ios',
|
|
10
10
|
productName = 'IDCheckIOSDK',
|
|
@@ -10,7 +10,6 @@ class IDCheckIOBridgeModule: NSObject {
|
|
|
10
10
|
func preload(_ extractData: Bool) {
|
|
11
11
|
Task(priority: .userInitiated) { @MainActor in
|
|
12
12
|
Idcheckio.preload(extractData: extractData)
|
|
13
|
-
Idcheckio.framework = .reactNative
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
|
|
@@ -23,6 +22,7 @@ class IDCheckIOBridgeModule: NSObject {
|
|
|
23
22
|
) {
|
|
24
23
|
Task(priority: .userInitiated) { @MainActor in
|
|
25
24
|
do {
|
|
25
|
+
Idcheckio.framework = .reactNative
|
|
26
26
|
try await Idcheckio.activate(withToken: token, extractData: extractData)
|
|
27
27
|
print("[\(self.tag))] Initialization ended successfully !")
|
|
28
28
|
resolve(true)
|
package/ios/Utils/Mapper.swift
CHANGED
|
@@ -20,8 +20,6 @@ class Mapper {
|
|
|
20
20
|
let confirmTypeValue = map?[ParamsEnum.confirmationType.rawValue] as? String
|
|
21
21
|
sdkParams.confirmType = ConfirmationType(rawValue: confirmTypeValue ?? "") ?? .none
|
|
22
22
|
sdkParams.useHD = map?[ParamsEnum.useHd.rawValue] as? Bool ?? false
|
|
23
|
-
sdkParams.overrideWordings =
|
|
24
|
-
map?[ParamsEnum.overrideWordings.rawValue] as? [String: String]? ?? nil
|
|
25
23
|
let documentType = map?[ParamsEnum.docType.rawValue] as? String
|
|
26
24
|
sdkParams.documentType = DocumentType(rawValue: documentType ?? "") ?? .disabled
|
|
27
25
|
let mapExtraction1 = map?[ParamsEnum.sideOneExtraction.rawValue] as? [String: Any?]
|
package/package.json
CHANGED
package/release-public.sh
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
PACKAGE_VERSION=$(node -p -e "require('./package.json').version")
|
|
15
15
|
|
|
16
16
|
# Don't modify theses two variables!
|
|
17
|
-
current_android_version="9.0
|
|
18
|
-
current_ios_version="9.0
|
|
17
|
+
current_android_version="9.1.0"
|
|
18
|
+
current_ios_version="9.1.0"
|
|
19
19
|
|
|
20
20
|
# Read version wanted from input
|
|
21
21
|
android_value=""
|
package/src/index.d.ts
CHANGED
|
@@ -20,7 +20,6 @@ export function activate(token: string, extractData: boolean): Promise<void>;
|
|
|
20
20
|
* Start an onboarding session with the given folder uid.
|
|
21
21
|
*
|
|
22
22
|
* @param folderUid - The folder that will be used to run the session.
|
|
23
|
-
* @param theme - A theme to customize SDK colors.
|
|
24
23
|
* @returns Void on success.
|
|
25
24
|
* @throws An error of type {@link IDCheckioError} if the session fails.
|
|
26
25
|
*/
|
|
@@ -31,7 +30,6 @@ export function startOnboarding(folderUid: string): Promise<void>;
|
|
|
31
30
|
*
|
|
32
31
|
* @param onlineContext - Online context. Let it null and the first capture and send the one you receive on result to chain to capture.
|
|
33
32
|
* @param parameters - The parameters to configure the capture session.
|
|
34
|
-
* @param theme - A theme to customize SDK colors.
|
|
35
33
|
* @returns {@link IDCheckioResult}
|
|
36
34
|
* @throws An error of type {@link IDCheckioError} if the capture fails.
|
|
37
35
|
*/
|
|
@@ -61,7 +59,6 @@ export class IDCheckioParamsBuilder {
|
|
|
61
59
|
setToken(token: string): this;
|
|
62
60
|
setConfirmAbort(confirmAbort: boolean): this;
|
|
63
61
|
setOnlineConfig(onlineConfig: OnlineConfig): this;
|
|
64
|
-
setOverrideWordings(overrideWordings: Map<string, string>): this;
|
|
65
62
|
build(): IDCheckioParams;
|
|
66
63
|
}
|
|
67
64
|
|
package/src/index.js
CHANGED
|
@@ -45,7 +45,7 @@ export function startSession(onlineContext, parameters) {
|
|
|
45
45
|
|
|
46
46
|
export class IDCheckioParams {
|
|
47
47
|
constructor({ docType, orientation, confirmationType, useHd, integrityCheck, captureMode, sideOneExtraction, sideTwoExtraction,
|
|
48
|
-
language, manualButtonTimer, adjustCrop, maxPictureFilesize, token, confirmAbort, onlineConfig
|
|
48
|
+
language, manualButtonTimer, adjustCrop, maxPictureFilesize, token, confirmAbort, onlineConfig } = {}) {
|
|
49
49
|
this.docType = docType
|
|
50
50
|
this.orientation = orientation
|
|
51
51
|
this.confirmationType = confirmationType
|
|
@@ -61,7 +61,6 @@ export class IDCheckioParams {
|
|
|
61
61
|
this.token = token
|
|
62
62
|
this.confirmAbort = confirmAbort
|
|
63
63
|
this.onlineConfig = onlineConfig
|
|
64
|
-
this.overrideWordings = overrideWordings
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
66
|
|
|
@@ -126,13 +125,8 @@ export class IDCheckioParamsBuilder {
|
|
|
126
125
|
this.onlineConfig = onlineConfig;
|
|
127
126
|
return this;
|
|
128
127
|
}
|
|
129
|
-
setOverrideWordings(overrideWordings) {
|
|
130
|
-
this.overrideWordings = overrideWordings
|
|
131
|
-
return this;
|
|
132
|
-
}
|
|
133
128
|
build() {
|
|
134
129
|
let params = new IDCheckioParams(this);
|
|
135
|
-
params.overrideWordings = typeof this.overrideWordings !== 'undefined' ? Object.fromEntries(this.overrideWordings) : undefined;
|
|
136
130
|
return params;
|
|
137
131
|
}
|
|
138
132
|
}
|
|
@@ -169,24 +163,6 @@ export class OnlineConfig {
|
|
|
169
163
|
}
|
|
170
164
|
}
|
|
171
165
|
|
|
172
|
-
export class IDCheckTheme {
|
|
173
|
-
constructor({
|
|
174
|
-
primaryColor = null,
|
|
175
|
-
foregroundColor = null,
|
|
176
|
-
backgroundColor = null,
|
|
177
|
-
borderColor = null,
|
|
178
|
-
textColor = null,
|
|
179
|
-
titleColor = null,
|
|
180
|
-
} = {}) {
|
|
181
|
-
this.primaryColor = primaryColor;
|
|
182
|
-
this.foregroundColor = foregroundColor;
|
|
183
|
-
this.backgroundColor = backgroundColor;
|
|
184
|
-
this.borderColor = borderColor;
|
|
185
|
-
this.textColor = textColor;
|
|
186
|
-
this.titleColor = titleColor;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
166
|
export const DocumentType = {
|
|
191
167
|
DISABLED: 'DISABLED',
|
|
192
168
|
ID: 'ID',
|