@regulaforensics/idv-capture-web 2.5.218-nightly → 2.5.223-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 CHANGED
@@ -5,7 +5,11 @@
5
5
  - [Compatibility](#compatibility)
6
6
  - [Install via NPM](#install-via-npm)
7
7
  - [Install via CDN](#install-via-cdn)
8
+ - [Setup](#setup)
8
9
  - [Events](#events)
10
+ - [Setters](#setters)
11
+ - [Getters](#getters)
12
+ - [Methods](#methods)
9
13
 
10
14
  ---
11
15
 
@@ -52,7 +56,6 @@ Install idv-capture-web:
52
56
 
53
57
  ```
54
58
  npm i @regulaforensics/idv-capture-web
55
- npm i @regulaforensics/idv-gui
56
59
 
57
60
  #optionally
58
61
 
@@ -66,7 +69,6 @@ Import `@regulaforensics/idv-capture-web` into your `index.js`:
66
69
 
67
70
  ```javascript
68
71
  import './node_modules/@regulaforensics/idv-capture-web/dist/main.js';
69
- import './node_modules/@regulaforensics/idv-gui/dist/main.js';
70
72
  ```
71
73
 
72
74
  In `index.html` connect `index.js` and add the name of the component you want to use. Available components:
@@ -97,14 +99,13 @@ For example:
97
99
 
98
100
  ```html
99
101
  <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
 
102
103
  <script src="https://unpkg.com/@regulaforensics/idv-face@latest/dist/main.iife.js"></script>
103
104
  <script src="https://unpkg.com/@regulaforensics/idv-document@latest/dist/main.iife.js"></script>
104
105
 
105
106
  ```
106
107
 
107
- Add the name of the component to the html, as in the example above.
108
+ Add the component tag to your HTML, as shown in the example above.
108
109
 
109
110
  ## Setup
110
111
 
@@ -113,10 +114,9 @@ Use `IdvIntegrationService` to setup idv flow.
113
114
  General example of the integration step by step
114
115
 
115
116
  ```javascript
116
- /** import necessary service & packages */
117
+ /** import necessary service */
117
118
  import { IdvIntegrationService } from '@regulaforensics/idv-capture-web';
118
- import { GuiIdv } from "@regulaforensics/idv-gui";
119
- /** depends of your workflow */
119
+ /** and packages depends of your workflow */
120
120
  import { FaceIdv } from "@regulaforensics/idv-face";
121
121
  import { DocumentIdv } from "@regulaforensics/idv-document";
122
122
 
@@ -133,12 +133,12 @@ const idvEventListener = (event) => {
133
133
  service.sessionRestoreMode = true;
134
134
  service.eventListener = idvEventListener;
135
135
 
136
- /** for convenience, we will use an asynchronous function. You also can use Promises */
136
+ /** for convenience, we will use an asynchronous function. You can also use Promises */
137
137
  (async function () {
138
138
  /** set modules */
139
139
  const initResult = await service.initialize({
140
140
  modulesConfig: { docreader: { devLicense: 'yourBase64license' } },
141
- includedModules: [GuiIdv, FaceIdv, DocumentIdv],
141
+ includedModules: [FaceIdv, DocumentIdv],
142
142
  });
143
143
  /** if something goes wrong, the command error will contain an error field. */
144
144
  if (initResult.error) {
@@ -147,7 +147,7 @@ service.eventListener = idvEventListener;
147
147
  }
148
148
 
149
149
  const configureResult = await service.configure({
150
- host: 'https://your.host.com',
150
+ baseUrl: 'https://your.host.com',
151
151
  userName: '',
152
152
  password: '',
153
153
  });
@@ -179,6 +179,26 @@ service.eventListener = idvEventListener;
179
179
  })();
180
180
  ```
181
181
 
182
+ **Alternative configure options:**
183
+
184
+ Using **apiKey**:
185
+
186
+ ```javascript
187
+ const configureResult = await service.configure({
188
+ baseUrl: 'https://your.host.com',
189
+ apiKey: 'your apiKey',
190
+ ttl: 86400,
191
+ });
192
+ ```
193
+
194
+ Using **url**:
195
+
196
+ ```javascript
197
+ const configureResult = await service.configure({
198
+ url: 'your url with token',
199
+ });
200
+ ```
201
+
182
202
  ## Events
183
203
 
184
204
  You can subscribe to the component events.
@@ -194,9 +214,10 @@ For example:
194
214
  const service = new IdvIntegrationService();
195
215
  service.eventListener = idvEventListener;
196
216
  ```
217
+
197
218
  ## Setters
198
219
 
199
- `nonce` - set CSP nonce id to the style tag
220
+ `nonce` - set CSP nonce id to the style tag
200
221
 
201
222
  ```javascript
202
223
  const service = new IdvIntegrationService();
@@ -226,8 +247,8 @@ Check types in the `index.d.ts`
226
247
 
227
248
 
228
249
  `async configure(
229
- config: ConnectionConfig | UrlConnectionConfig | ConnectionByApiKeyConfig,
230
- ): Promise<ConfigureCompletion | UrlConfigureCompletion>` - configures the service. accepts input parameters for connecting to the platform
250
+ config: CredentialConnectionConfig | TokenConnectionConfig | ApiKeyConnectionConfig,
251
+ ): Promise<ConfigureCompletion | TokenConfigureCompletion>` - configures the service. accepts input parameters for connecting to the platform
231
252
 
232
253
  `async getWorkFlows(params?: WorkflowListRequest): Promise<WorkflowListCompletion>` - returns list of available workflows
233
254
 
package/dist/index.d.ts CHANGED
@@ -1,3 +1,21 @@
1
+ export declare type ApiKeyConnectionConfig = {
2
+ baseUrl: string;
3
+ apiKey: string;
4
+ ttl?: number;
5
+ };
6
+
7
+ declare class BaseConfigureError extends BaseError {
8
+ private static readonly MODULE;
9
+ private static readonly ERROR_ENUM_NAME;
10
+ private static readonly SHORT_CODE;
11
+ constructor({ errorCode, message, underlyingError, underlyingBaseError, }: {
12
+ errorCode: ConfigureError;
13
+ message?: string;
14
+ underlyingError?: string;
15
+ underlyingBaseError?: BaseError;
16
+ });
17
+ }
18
+
1
19
  declare class BaseDeinitializationError extends BaseError {
2
20
  private static readonly MODULE;
3
21
  private static readonly ERROR_ENUM_NAME;
@@ -62,24 +80,24 @@ declare class BasePrepareWorkflowError extends BaseError {
62
80
  });
63
81
  }
64
82
 
65
- declare class BaseScenarioError extends BaseError {
83
+ declare class BaseTokenInitializationError extends BaseError {
66
84
  private static readonly MODULE;
67
85
  private static readonly ERROR_ENUM_NAME;
68
86
  private static readonly SHORT_CODE;
69
87
  constructor({ errorCode, message, underlyingError, underlyingBaseError, }: {
70
- errorCode: ScenarioError;
88
+ errorCode: TokenInitializeError;
71
89
  message?: string;
72
90
  underlyingError?: string;
73
91
  underlyingBaseError?: BaseError;
74
92
  });
75
93
  }
76
94
 
77
- declare class BaseTokenInitializationError extends BaseError {
95
+ declare class BaseWorkflowError extends BaseError {
78
96
  private static readonly MODULE;
79
97
  private static readonly ERROR_ENUM_NAME;
80
98
  private static readonly SHORT_CODE;
81
99
  constructor({ errorCode, message, underlyingError, underlyingBaseError, }: {
82
- errorCode: TokenInitializeError;
100
+ errorCode: WorkflowError;
83
101
  message?: string;
84
102
  underlyingError?: string;
85
103
  underlyingBaseError?: BaseError;
@@ -87,38 +105,27 @@ declare class BaseTokenInitializationError extends BaseError {
87
105
  }
88
106
 
89
107
  export declare type ConfigureCompletion = {
90
- error?: BaseInitializationError;
91
- };
92
-
93
- export declare type ConnectionByApiKeyConfig = {
94
- host: string;
95
- apiKey: string;
96
- isSecure?: boolean;
97
- port?: number;
98
- deviceDescriptor?: Record<string, unknown>;
99
- httpRetryCount?: number;
100
- httpTimeoutMs?: number;
108
+ error?: BaseConfigureError;
101
109
  };
102
110
 
103
- export declare type ConnectionConfig = {
104
- host: string;
105
- httpRetryCount?: number;
106
- httpTimeoutMs?: number;
107
- isSecure?: boolean;
108
- password: string;
109
- port?: number;
110
- schema?: string;
111
- userName: string;
112
- deviceDescriptor?: {
113
- ttl?: number;
114
- } & Record<string, unknown>;
115
- };
111
+ declare enum ConfigureError {
112
+ CONNECTION_ISSUE = 0,
113
+ CONFIG_MISSED_OR_INVALID = 1,
114
+ INITIALIZATION_REQUIRED = 2,
115
+ SCENARIO_IN_PROGRESS = 3
116
+ }
116
117
 
117
118
  export declare enum ConnectionError {
118
119
  HTTP_ISSUE = 0,
119
120
  PROVIDER_ERROR = 1
120
121
  }
121
122
 
123
+ export declare type CredentialConnectionConfig = {
124
+ baseUrl: string;
125
+ password: string;
126
+ userName: string;
127
+ };
128
+
122
129
  export declare enum DeinitializationError {
123
130
  INITIALIZATION_REQUIRED = 0,
124
131
  SCENARIO_IN_PROGRESS = 3
@@ -140,7 +147,7 @@ export declare class IdvIntegrationService {
140
147
  initialize(config: InitConfig): Promise<{
141
148
  error?: BaseInitializationError;
142
149
  }>;
143
- configure(config: ConnectionConfig | UrlConnectionConfig | ConnectionByApiKeyConfig): Promise<ConfigureCompletion | UrlConfigureCompletion>;
150
+ configure(config: CredentialConnectionConfig | TokenConnectionConfig | ApiKeyConnectionConfig): Promise<ConfigureCompletion | TokenConfigureCompletion>;
144
151
  getWorkFlows(params?: WorkflowListRequest): Promise<WorkflowListCompletion>;
145
152
  prepareWorkflow({ workflowId }: {
146
153
  workflowId: string;
@@ -160,13 +167,6 @@ export declare type IdvMessageEvent = {
160
167
  message?: IdvServiceMessages;
161
168
  };
162
169
 
163
- export declare const IdvModules: {
164
- readonly LIVENESS: "LIVENESS";
165
- readonly DOC_READER: "DOC_READER";
166
- };
167
-
168
- export declare type IdvModulesType = (typeof IdvModules)[keyof typeof IdvModules];
169
-
170
170
  export declare enum IdvServiceMessages {
171
171
  DID_START_SESSION = "DID_START_SESSION",
172
172
  DID_END_SESSION = "DID_END_SESSION",
@@ -218,25 +218,6 @@ export declare enum PrepareWorkflowError {
218
218
  SCENARIO_IN_PROGRESS = 4
219
219
  }
220
220
 
221
- export declare enum ScenarioError {
222
- INITIALIZATION_REQUIRED = 0,
223
- PREPARED_REQUIRED = 1,
224
- START_SESSION_FAILED = 2,
225
- UNKNOWN_STEP = 3,
226
- MODULES_ISSUE = 4,
227
- ALREADY_STARTED = 5,
228
- INTERNAL_ISSUE = 6
229
- }
230
-
231
- declare type ScenarioResults = {
232
- sessionId?: string;
233
- finalStep?: {
234
- id: string;
235
- name: string;
236
- final: boolean;
237
- };
238
- } & Record<string, any>;
239
-
240
221
  export declare enum SessionError {
241
222
  HTTP_ISSUE = 0,
242
223
  PROVIDER_ERROR = 1,
@@ -259,20 +240,20 @@ export declare type StartWorkflowConfig = {
259
240
  locale?: string;
260
241
  };
261
242
 
262
- declare enum TokenInitializeError {
263
- CONNECTION_ISSUE = 0,
264
- WORKFLOW_ISSUE = 1
265
- }
266
-
267
- export declare type UrlConfigureCompletion = {
243
+ export declare type TokenConfigureCompletion = {
268
244
  workflows: string[];
269
245
  error?: BaseTokenInitializationError;
270
246
  };
271
247
 
272
- export declare type UrlConnectionConfig = {
248
+ export declare type TokenConnectionConfig = {
273
249
  url: string;
274
250
  };
275
251
 
252
+ declare enum TokenInitializeError {
253
+ CONNECTION_ISSUE = 0,
254
+ WORKFLOW_ISSUE = 1
255
+ }
256
+
276
257
  declare type Workflow = {
277
258
  id: string;
278
259
  steps: Array<WorkflowStep>;
@@ -283,14 +264,18 @@ declare type Workflow = {
283
264
  } & Record<string, any>;
284
265
 
285
266
  export declare type WorkflowCompletion = {
286
- results?: ScenarioResults;
287
- error?: BaseScenarioError;
267
+ results?: WorkflowResult;
268
+ error?: BaseWorkflowError;
288
269
  };
289
270
 
290
271
  export declare enum WorkflowError {
291
- HTTP_ISSUE = 0,
292
- PROVIDER_ERROR = 1,
293
- DECODING_FAILED = 2
272
+ INITIALIZATION_REQUIRED = 0,
273
+ PREPARED_REQUIRED = 1,
274
+ START_SESSION_FAILED = 2,
275
+ UNKNOWN_STEP = 3,
276
+ MODULES_ISSUE = 4,
277
+ ALREADY_STARTED = 5,
278
+ INTERNAL_ISSUE = 6
294
279
  }
295
280
 
296
281
  export declare type WorkflowListCompletion = {
@@ -303,6 +288,21 @@ export declare type WorkflowListRequest = {
303
288
  skip: number;
304
289
  };
305
290
 
291
+ export declare enum WorkflowPlatformError {
292
+ HTTP_ISSUE = 0,
293
+ PROVIDER_ERROR = 1,
294
+ DECODING_FAILED = 2
295
+ }
296
+
297
+ declare type WorkflowResult = {
298
+ sessionId?: string;
299
+ finalStep?: {
300
+ id: string;
301
+ name: string;
302
+ final: boolean;
303
+ };
304
+ } & Record<string, any>;
305
+
306
306
  declare type WorkflowStep = {
307
307
  id: string;
308
308
  name: string;