@regulaforensics/idv-capture-web 0.1.118-rc → 0.1.206-nightly
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 +69 -6
- package/dist/index.d.ts +52 -23
- package/dist/main.iife.js +55 -215
- package/dist/main.js +20637 -14
- package/package.json +1 -2
- package/dist/index-Cx_fIW52.js +0 -20369
- package/dist/index-DJf3qPC1.js +0 -17242
- package/dist/index-DN0UIUaI.js +0 -24228
package/README.md
CHANGED
|
@@ -52,6 +52,12 @@ Install idv-capture-web:
|
|
|
52
52
|
|
|
53
53
|
```
|
|
54
54
|
npm i @regulaforensics/idv-capture-web
|
|
55
|
+
npm i @regulaforensics/idv-gui
|
|
56
|
+
|
|
57
|
+
#optionally
|
|
58
|
+
|
|
59
|
+
npm i @regulaforensics/idv-face
|
|
60
|
+
npm i @regulaforensics/idv-document
|
|
55
61
|
```
|
|
56
62
|
|
|
57
63
|
Create `index.html` and `index.js` files in the root directory of the project.
|
|
@@ -60,6 +66,7 @@ Import `@regulaforensics/idv-capture-web` into your `index.js`:
|
|
|
60
66
|
|
|
61
67
|
```javascript
|
|
62
68
|
import './node_modules/@regulaforensics/idv-capture-web/dist/main.js';
|
|
69
|
+
import './node_modules/@regulaforensics/idv-gui/dist/main.js';
|
|
63
70
|
```
|
|
64
71
|
|
|
65
72
|
In `index.html` connect `index.js` and add the name of the component you want to use. Available components:
|
|
@@ -90,6 +97,11 @@ For example:
|
|
|
90
97
|
|
|
91
98
|
```html
|
|
92
99
|
<script src="https://unpkg.com/@regulaforensics/idv-capture-web@latest/dist/main.iife.js"></script>
|
|
100
|
+
<script src="https://unpkg.com/@regulaforensics/idv-gui@latest/dist/main.iife.js"></script>
|
|
101
|
+
|
|
102
|
+
<script src="https://unpkg.com/@regulaforensics/idv-face@latest/dist/main.iife.js"></script>
|
|
103
|
+
<script src="https://unpkg.com/@regulaforensics/idv-document@latest/dist/main.iife.js"></script>
|
|
104
|
+
|
|
93
105
|
```
|
|
94
106
|
|
|
95
107
|
Add the name of the component to the html, as in the example above.
|
|
@@ -101,6 +113,14 @@ Use `IdvIntegrationService` to setup idv flow.
|
|
|
101
113
|
General example of the integration step by step
|
|
102
114
|
|
|
103
115
|
```javascript
|
|
116
|
+
/** import necessary service & packages */
|
|
117
|
+
import { IdvIntegrationService } from '@regulaforensics/idv-capture-web';
|
|
118
|
+
import { GuiIdv } from "@regulaforensics/idv-gui";
|
|
119
|
+
/** depends of your workflow */
|
|
120
|
+
import { FaceIdv } from "@regulaforensics/idv-face";
|
|
121
|
+
import { DocumentIdv } from "@regulaforensics/idv-document";
|
|
122
|
+
|
|
123
|
+
|
|
104
124
|
/** create service */
|
|
105
125
|
const service = new IdvIntegrationService();
|
|
106
126
|
|
|
@@ -116,13 +136,13 @@ service.eventListener = idvEventListener;
|
|
|
116
136
|
/** for convenience, we will use an asynchronous function. You also can use Promises */
|
|
117
137
|
(async function () {
|
|
118
138
|
/** set modules */
|
|
119
|
-
const
|
|
139
|
+
const initResult = await service.initialize({
|
|
120
140
|
modulesConfig: { docreader: { devLicense: 'yourBase64license' } },
|
|
121
|
-
includedModules: [
|
|
141
|
+
includedModules: [GuiIdv, FaceIdv, DocumentIdv],
|
|
122
142
|
});
|
|
123
143
|
/** if something goes wrong, the command error will contain an error field. */
|
|
124
|
-
if (
|
|
125
|
-
console.log(
|
|
144
|
+
if (initResult.error) {
|
|
145
|
+
console.log(initResult.error);
|
|
126
146
|
return;
|
|
127
147
|
}
|
|
128
148
|
|
|
@@ -147,7 +167,8 @@ service.eventListener = idvEventListener;
|
|
|
147
167
|
}
|
|
148
168
|
|
|
149
169
|
const metadata = { anyMetadata: 'Any Metadata' };
|
|
150
|
-
const
|
|
170
|
+
const locale = 'en-us'; // 'en-us' for example. Should be the language of your workflow
|
|
171
|
+
const startWorkflowResult = await service?.startWorkflow({ locale: locale, metadata: metadata });
|
|
151
172
|
|
|
152
173
|
if (startWorkflowResult.error) {
|
|
153
174
|
console.log(startWorkflowResult.error);
|
|
@@ -172,4 +193,46 @@ For example:
|
|
|
172
193
|
|
|
173
194
|
const service = new IdvIntegrationService();
|
|
174
195
|
service.eventListener = idvEventListener;
|
|
175
|
-
```
|
|
196
|
+
```
|
|
197
|
+
## Setters
|
|
198
|
+
|
|
199
|
+
`nonce` - set CSP nonce id to the style tag
|
|
200
|
+
|
|
201
|
+
```javascript
|
|
202
|
+
const service = new IdvIntegrationService();
|
|
203
|
+
service.nonce = nonceId;
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
`sessionRestoreMode` - set restore mode to the **idv-capture-web** . restores the session from the current step (for example, if the page was accidentally reloaded)
|
|
207
|
+
|
|
208
|
+
```javascript
|
|
209
|
+
const service = new IdvIntegrationService();
|
|
210
|
+
service.sessionRestoreMode = true;
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Getters
|
|
214
|
+
|
|
215
|
+
`version` - returns the version of the component
|
|
216
|
+
```javascript
|
|
217
|
+
const service = new IdvIntegrationService();
|
|
218
|
+
console.log(service.version);
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Methods
|
|
222
|
+
|
|
223
|
+
Check types in the `index.d.ts`
|
|
224
|
+
|
|
225
|
+
`async initialize(config: InitConfig): Promise<{ error?: BaseInitializationError }>` - initialize the idv-web-capture worker.
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
`async configure(
|
|
229
|
+
config: ConnectionConfig | UrlConnectionConfig | ConnectionByApiKeyConfig,
|
|
230
|
+
): Promise<ConfigureCompletion | UrlConfigureCompletion>` - configures the service. accepts input parameters for connecting to the platform
|
|
231
|
+
|
|
232
|
+
`async getWorkFlows(params?: WorkflowListRequest): Promise<WorkflowListCompletion>` - returns list of available workflows
|
|
233
|
+
|
|
234
|
+
`async prepareWorkflow({ workflowId }: { workflowId: string }): Promise<PrepareWorkflowCompletion>` - prepared service with workflowId. In this method, the component checks the compatibility of modules and steps in the workflow.
|
|
235
|
+
|
|
236
|
+
`async startWorkflow(config?: StartWorkflowConfig): Promise<WorkflowCompletion>` - this method starts workflow. We recommend showing the web component immediately before executing this method and deleting the web component after the promise of this method resolves.
|
|
237
|
+
|
|
238
|
+
`async deinitialize(): Promise<DeinitializeCompletion>` - deinitialize the service. After this command you should run `initialize` method if you want to continue working with the service. We recommend executing this command when you have completed the necessary work on the page.
|
package/dist/index.d.ts
CHANGED
|
@@ -86,11 +86,23 @@ declare class BaseTokenInitializationError extends BaseError {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
declare type ConfigureCompletion = {
|
|
89
|
+
export declare type ConfigureCompletion = {
|
|
90
90
|
error?: BaseInitializationError;
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
declare type
|
|
93
|
+
export declare type ConnectionByApiKeyConfig = {
|
|
94
|
+
host: string;
|
|
95
|
+
apiKey: string;
|
|
96
|
+
isSecure?: boolean;
|
|
97
|
+
port?: number;
|
|
98
|
+
deviceDescriptor: {
|
|
99
|
+
ttl: number;
|
|
100
|
+
} & Record<string, unknown>;
|
|
101
|
+
httpRetryCount?: number;
|
|
102
|
+
httpTimeoutMs?: number;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export declare type ConnectionConfig = {
|
|
94
106
|
host: string;
|
|
95
107
|
httpRetryCount?: number;
|
|
96
108
|
httpTimeoutMs?: number;
|
|
@@ -99,6 +111,9 @@ declare type ConnectionConfig = {
|
|
|
99
111
|
port?: number;
|
|
100
112
|
schema?: string;
|
|
101
113
|
userName: string;
|
|
114
|
+
deviceDescriptor?: {
|
|
115
|
+
ttl?: number;
|
|
116
|
+
} & Record<string, unknown>;
|
|
102
117
|
};
|
|
103
118
|
|
|
104
119
|
export declare enum ConnectionError {
|
|
@@ -106,12 +121,6 @@ export declare enum ConnectionError {
|
|
|
106
121
|
PROVIDER_ERROR = 1
|
|
107
122
|
}
|
|
108
123
|
|
|
109
|
-
declare type CurrentScreenConfig = {
|
|
110
|
-
templateId: string;
|
|
111
|
-
sessionId?: string;
|
|
112
|
-
serviceToken?: string;
|
|
113
|
-
} & Record<string, any>;
|
|
114
|
-
|
|
115
124
|
export declare enum DeinitializationError {
|
|
116
125
|
INITIALIZATION_REQUIRED = 0,
|
|
117
126
|
SCENARIO_IN_PROGRESS = 3
|
|
@@ -133,18 +142,18 @@ export declare class IdvIntegrationService {
|
|
|
133
142
|
initialize(config: InitConfig): Promise<{
|
|
134
143
|
error?: BaseInitializationError;
|
|
135
144
|
}>;
|
|
136
|
-
configure(config: ConnectionConfig | UrlConnectionConfig): Promise<ConfigureCompletion |
|
|
145
|
+
configure(config: ConnectionConfig | UrlConnectionConfig | ConnectionByApiKeyConfig): Promise<ConfigureCompletion | UrlConfigureCompletion>;
|
|
137
146
|
getWorkFlows(params?: WorkflowListRequest): Promise<WorkflowListCompletion>;
|
|
138
147
|
prepareWorkflow({ workflowId }: {
|
|
139
148
|
workflowId: string;
|
|
140
149
|
}): Promise<PrepareWorkflowCompletion>;
|
|
141
|
-
startWorkflow(
|
|
150
|
+
startWorkflow(config?: StartWorkflowConfig): Promise<WorkflowCompletion>;
|
|
142
151
|
deinitialize(): Promise<DeinitializeCompletion>;
|
|
143
152
|
/** service commands */
|
|
144
|
-
|
|
153
|
+
get version(): string;
|
|
154
|
+
set nonce(id: string);
|
|
145
155
|
set eventListener(callback: (message: IdvMessageEvent) => void);
|
|
146
156
|
set sessionRestoreMode(isEnabled: boolean);
|
|
147
|
-
get currentSessionId(): string | null;
|
|
148
157
|
}
|
|
149
158
|
|
|
150
159
|
export declare type IdvMessageEvent = {
|
|
@@ -163,7 +172,8 @@ export declare type IdvModulesType = (typeof IdvModules)[keyof typeof IdvModules
|
|
|
163
172
|
export declare enum IdvServiceMessages {
|
|
164
173
|
DID_START_SESSION = "DID_START_SESSION",
|
|
165
174
|
DID_END_SESSION = "DID_END_SESSION",
|
|
166
|
-
DID_START_RESTORE_SESSION = "DID_START_RESTORE_SESSION"
|
|
175
|
+
DID_START_RESTORE_SESSION = "DID_START_RESTORE_SESSION",
|
|
176
|
+
DID_CONTINUE_REMOTE_SESSION = "DID_CONTINUE_REMOTE_SESSION"
|
|
167
177
|
}
|
|
168
178
|
|
|
169
179
|
export declare class IdvWebComponent extends HTMLElement {
|
|
@@ -177,14 +187,14 @@ export declare class IdvWebComponent extends HTMLElement {
|
|
|
177
187
|
disconnectedCallback(): void;
|
|
178
188
|
}
|
|
179
189
|
|
|
180
|
-
declare type InitConfig = {
|
|
190
|
+
export declare type InitConfig = {
|
|
181
191
|
modulesConfig?: {
|
|
182
192
|
docreader?: {
|
|
183
193
|
devLicense: string;
|
|
184
194
|
};
|
|
185
195
|
face?: Record<string, any>;
|
|
186
196
|
};
|
|
187
|
-
includedModules:
|
|
197
|
+
includedModules: any[];
|
|
188
198
|
};
|
|
189
199
|
|
|
190
200
|
export declare type InitializeCompletion = {
|
|
@@ -213,7 +223,7 @@ export declare enum PrepareWorkflowError {
|
|
|
213
223
|
export declare enum ScenarioError {
|
|
214
224
|
INITIALIZATION_REQUIRED = 0,
|
|
215
225
|
PREPARED_REQUIRED = 1,
|
|
216
|
-
|
|
226
|
+
START_SESSION_FAILED = 2,
|
|
217
227
|
UNKNOWN_STEP = 3,
|
|
218
228
|
MODULES_ISSUE = 4,
|
|
219
229
|
ALREADY_STARTED = 5,
|
|
@@ -222,7 +232,11 @@ export declare enum ScenarioError {
|
|
|
222
232
|
|
|
223
233
|
declare type ScenarioResults = {
|
|
224
234
|
sessionId?: string;
|
|
225
|
-
finalStep?:
|
|
235
|
+
finalStep?: {
|
|
236
|
+
id: string;
|
|
237
|
+
name: string;
|
|
238
|
+
final: boolean;
|
|
239
|
+
};
|
|
226
240
|
} & Record<string, any>;
|
|
227
241
|
|
|
228
242
|
export declare enum SessionError {
|
|
@@ -238,31 +252,39 @@ export declare enum StartSessionError {
|
|
|
238
252
|
HTTP_ISSUE = 0,
|
|
239
253
|
PROVIDER_ERROR = 1,
|
|
240
254
|
DECODING_FAILED = 2,
|
|
241
|
-
TOKEN_ERROR = 3
|
|
255
|
+
TOKEN_ERROR = 3,
|
|
256
|
+
CONNECTION_ISSUE = 4
|
|
242
257
|
}
|
|
243
258
|
|
|
259
|
+
export declare type StartWorkflowConfig = {
|
|
260
|
+
metadata?: Record<string, unknown>;
|
|
261
|
+
locale?: string;
|
|
262
|
+
};
|
|
263
|
+
|
|
244
264
|
declare enum TokenInitializeError {
|
|
245
265
|
CONNECTION_ISSUE = 0,
|
|
246
266
|
WORKFLOW_ISSUE = 1
|
|
247
267
|
}
|
|
248
268
|
|
|
249
|
-
declare type
|
|
269
|
+
export declare type UrlConfigureCompletion = {
|
|
250
270
|
workflows: string[];
|
|
251
271
|
error?: BaseTokenInitializationError;
|
|
252
272
|
};
|
|
253
273
|
|
|
254
|
-
declare type UrlConnectionConfig =
|
|
274
|
+
export declare type UrlConnectionConfig = {
|
|
275
|
+
url: string;
|
|
276
|
+
};
|
|
255
277
|
|
|
256
278
|
declare type Workflow = {
|
|
257
279
|
id: string;
|
|
258
280
|
steps: Array<WorkflowStep>;
|
|
259
281
|
client: {
|
|
260
282
|
layout: Record<string, any>;
|
|
261
|
-
steps: Array<
|
|
283
|
+
steps: Array<WorkflowStepClientGui>;
|
|
262
284
|
};
|
|
263
285
|
} & Record<string, any>;
|
|
264
286
|
|
|
265
|
-
export declare type
|
|
287
|
+
export declare type WorkflowCompletion = {
|
|
266
288
|
results?: ScenarioResults;
|
|
267
289
|
error?: BaseScenarioError;
|
|
268
290
|
};
|
|
@@ -278,7 +300,7 @@ export declare type WorkflowListCompletion = {
|
|
|
278
300
|
error?: BasePrepareWorkflowError;
|
|
279
301
|
};
|
|
280
302
|
|
|
281
|
-
declare type WorkflowListRequest = {
|
|
303
|
+
export declare type WorkflowListRequest = {
|
|
282
304
|
limit: number;
|
|
283
305
|
skip: number;
|
|
284
306
|
};
|
|
@@ -287,6 +309,13 @@ declare type WorkflowStep = {
|
|
|
287
309
|
id: string;
|
|
288
310
|
name: string;
|
|
289
311
|
final: boolean;
|
|
312
|
+
client?: Record<string, unknown> | WorkflowStepClientGui;
|
|
313
|
+
dataSource: Record<string, unknown> | null;
|
|
290
314
|
} & Record<string, any>;
|
|
291
315
|
|
|
316
|
+
declare type WorkflowStepClientGui = {
|
|
317
|
+
templateId: string;
|
|
318
|
+
templateLayout: Record<string, unknown>;
|
|
319
|
+
};
|
|
320
|
+
|
|
292
321
|
export { }
|