@regulaforensics/idv-capture-web 3.2.236-nightly → 3.2.243-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/dist/index.d.ts CHANGED
@@ -1,9 +1,19 @@
1
+ import { CSSResult } from 'lit';
2
+ import { LitElement } from 'lit';
3
+ import { TemplateResult } from 'lit-html';
4
+
1
5
  export declare type ApiKeyConnectionConfig = {
2
6
  baseUrl: string;
3
7
  apiKey: string;
4
8
  ttl?: number;
5
9
  };
6
10
 
11
+ declare type AuthTokenStoreData = {
12
+ apiKey: string;
13
+ authToken: string;
14
+ tokenExpiredIn: number;
15
+ };
16
+
7
17
  declare class BaseConfigureError extends BaseError {
8
18
  private static readonly MODULE;
9
19
  private static readonly ERROR_ENUM_NAME;
@@ -16,6 +26,18 @@ declare class BaseConfigureError extends BaseError {
16
26
  });
17
27
  }
18
28
 
29
+ declare class BaseConnectionError extends BaseError {
30
+ private static readonly MODULE;
31
+ private static readonly ERROR_ENUM_NAME;
32
+ private static readonly SHORT_CODE;
33
+ constructor({ errorCode, message, underlyingError, underlyingBaseError, }: {
34
+ errorCode: ConnectionError;
35
+ message?: string;
36
+ underlyingError?: string;
37
+ underlyingBaseError?: BaseError;
38
+ });
39
+ }
40
+
19
41
  declare class BaseDeinitializationError extends BaseError {
20
42
  private static readonly MODULE;
21
43
  private static readonly ERROR_ENUM_NAME;
@@ -120,17 +142,49 @@ declare enum ConfigureError {
120
142
  SCENARIO_IN_PROGRESS = 3
121
143
  }
122
144
 
145
+ declare type ConnectionByApiKeyConfigCore = {
146
+ host: string;
147
+ isSecure?: boolean;
148
+ port?: number;
149
+ apiKey: string;
150
+ authToken?: string;
151
+ deviceDescriptor: {
152
+ ttl: number;
153
+ };
154
+ };
155
+
156
+ declare type ConnectionConfigCore = {
157
+ host: string;
158
+ isSecure?: boolean;
159
+ password: string;
160
+ port?: number;
161
+ userName: string;
162
+ };
163
+
123
164
  export declare enum ConnectionError {
124
165
  HTTP_ISSUE = 0,
125
166
  PROVIDER_ERROR = 1
126
167
  }
127
168
 
169
+ declare type ContinueSessionResults = SessionData | WorkflowResult | {
170
+ error?: BaseWorkflowError;
171
+ };
172
+
128
173
  export declare type CredentialConnectionConfig = {
129
174
  baseUrl: string;
130
175
  password: string;
131
176
  userName: string;
132
177
  };
133
178
 
179
+ declare type CurrentScreenConfig = {
180
+ templateId: string;
181
+ templateLayout?: Record<string, unknown>;
182
+ dataSource: Record<string, unknown> | null;
183
+ properties?: SessionPropertiesItem[];
184
+ sessionId?: string;
185
+ serviceToken?: string;
186
+ } & Record<string, any>;
187
+
134
188
  export declare enum DeinitializationError {
135
189
  INITIALIZATION_REQUIRED = 0,
136
190
  SCENARIO_IN_PROGRESS = 3
@@ -140,6 +194,53 @@ export declare type DeinitializeCompletion = {
140
194
  error?: BaseDeinitializationError;
141
195
  };
142
196
 
197
+ declare type IdvBusinessLogicControllerProps = {
198
+ connectByUserPass: (config: ConnectionConfigCore) => Promise<{
199
+ error?: BaseConnectionError;
200
+ }>;
201
+ connectByApiKey: (config: ConnectionByApiKeyConfigCore) => Promise<{
202
+ error?: BaseTokenInitializationError;
203
+ workflows?: string[];
204
+ authToken?: string;
205
+ }>;
206
+ connectByUrl: (urlWithToken: string) => Promise<{
207
+ error?: BaseTokenInitializationError;
208
+ workflows: string[];
209
+ }>;
210
+ workflowSessionCompletion: (data: WorkflowCompletion) => void;
211
+ setWorkflowSessionCompletion: (fn: (data: WorkflowCompletion) => void) => void;
212
+ loadModules: (modulesFromProps: any[]) => Promise<{
213
+ error?: BaseInitializationError;
214
+ }>;
215
+ setProcessingTemplate: (workflowSteps: any[]) => void;
216
+ isProcessing: boolean;
217
+ setIsProcessing: (isProcessing: boolean) => void;
218
+ _pushStep: (stepId: string, data: Record<string, any>) => Promise<{
219
+ error?: BaseWorkflowError;
220
+ }>;
221
+ _waitingForNextStep: () => Promise<{
222
+ sessionData: SessionData;
223
+ error?: undefined;
224
+ } | {
225
+ error: BaseWorkflowError;
226
+ sessionData?: undefined;
227
+ }>;
228
+ _findStepById: (stepId: string) => WorkflowStep | null;
229
+ pushStepWaitNextStepAndSet: (data: Record<string, any>) => void;
230
+ setNextStep: (workflow: Workflow, properties: SessionPropertiesItem[], nextStepId: string) => void;
231
+ onChangeScreen: (stepId: string | null) => void;
232
+ deinitializationIdv: () => Promise<{
233
+ error?: any;
234
+ }>;
235
+ wasmService: IdvWasmService | null;
236
+ setAndInitWasmService: () => Promise<void>;
237
+ isFinalWaitingUi: boolean;
238
+ setFinalWaitingUi: (isWaitingUi: boolean) => void;
239
+ setFinalStepAndStopProcess: (stepId?: string) => void;
240
+ resetSession: () => void;
241
+ resetWasmService: () => void;
242
+ };
243
+
143
244
  export declare type IdvEventTypes = (typeof IdvEventTypesEnum)[keyof typeof IdvEventTypesEnum];
144
245
 
145
246
  export declare const IdvEventTypesEnum: {
@@ -147,6 +248,48 @@ export declare const IdvEventTypesEnum: {
147
248
  readonly ERROR: "ERROR";
148
249
  };
149
250
 
251
+ declare type IdvIntegrationControllerProps = {
252
+ _isInitialized: boolean;
253
+ _isConnectedToPlatform: boolean;
254
+ _initializationInProgress: boolean;
255
+ _sessionIdFromUrl: null | string;
256
+ _ttl: number;
257
+ _runWasmService: () => Promise<{
258
+ error?: BaseWorkflowError;
259
+ }>;
260
+ _continueSession: (locale: string, forceSessionId: string | null) => Promise<ContinueSessionResults>;
261
+ _checkIsSessionDataValid: (sessionData: SessionData | {
262
+ httpCode: number;
263
+ method: string;
264
+ url: string;
265
+ what?: string;
266
+ }) => SessionData | {
267
+ error?: BaseWorkflowError;
268
+ };
269
+ _checkAndSetApiTokenToLs: (sessionId: string) => void;
270
+ _runSocketConnection: (token: string) => Promise<{
271
+ error?: BaseWorkflowError;
272
+ }>;
273
+ _prepareDataForWorkflow: (sessionData: SessionData) => void;
274
+ initialize: (config: InitConfig) => Promise<{
275
+ error?: BaseInitializationError;
276
+ }>;
277
+ configureByUserPass: (config: CredentialConnectionConfig) => Promise<object | {
278
+ error?: BaseConfigureError;
279
+ }>;
280
+ configureWithUrl: (urlWithToken: string) => Promise<object | {
281
+ error?: BaseConfigureError;
282
+ }>;
283
+ configureByApiKey: (config: ApiKeyConnectionConfig) => Promise<object | {
284
+ error?: BaseConfigureError;
285
+ }>;
286
+ getWorkflows: (params?: WorkflowListRequest) => Promise<WorkflowListCompletion>;
287
+ prepareWorkflowAndPrepareUi: (workflowId: string) => Promise<PrepareWorkflowCompletion>;
288
+ startNewSession: (completion: (data: WorkflowCompletion) => void, locale: string, metadata?: Record<string, unknown>) => Promise<WorkflowCompletion>;
289
+ playWorkflow: () => void;
290
+ deinitialize: () => Promise<DeinitializeCompletion>;
291
+ };
292
+
150
293
  export declare class IdvIntegrationService {
151
294
  /** main commands */
152
295
  initialize(config: InitConfig): Promise<{
@@ -196,15 +339,168 @@ export declare enum IdvServiceMessages {
196
339
  DID_CONTINUE_REMOTE_SESSION = "DID_CONTINUE_REMOTE_SESSION"
197
340
  }
198
341
 
199
- export declare class IdvWebComponent extends HTMLElement {
200
- private _root;
201
- private _mounted;
342
+ declare type IdvStoreProps = {
343
+ sessionRestoreMode: boolean;
344
+ setSessionRestoreMode: (isEnabled: boolean) => void;
345
+ currentSessionData: {
346
+ sessionId: string;
347
+ workflowId: string;
348
+ } | null;
349
+ setCurrentSessionDataLsAndStore: (data: {
350
+ sessionId: string;
351
+ workflowId: string;
352
+ }) => void;
353
+ removeCurrentSessionDataLsAndStore: () => void;
354
+ getCurrentSessionDataLs: () => {
355
+ sessionId: string;
356
+ workflowId: string;
357
+ apiKey?: string;
358
+ } | null;
359
+ getCurrentSessionId: () => string | null;
360
+ modulesConfig: Record<string, any>;
361
+ layout: Record<string, any> | null;
362
+ sessionProperties: SessionPropertiesItem[];
363
+ setSessionProperties: (properties: SessionPropertiesItem[]) => void;
364
+ setLayout: (layout: Record<string, any>) => void;
365
+ workflow: Workflow | null;
366
+ setWorkflow: (workflow: Workflow) => void;
367
+ currentStepId: string | null;
368
+ setCurrentStepId: (stepId: string) => void;
369
+ listener: (message: IdvMessageEvent) => void | null;
370
+ setListener: (callback: (message: IdvMessageEvent) => void) => void;
371
+ workflowId: string | null;
372
+ setWorkflowId: (id: string) => void;
373
+ nonce?: string;
374
+ setNonce: (id: string) => void;
375
+ getNonce: () => string | undefined;
376
+ currentScreenConfig: CurrentScreenConfig | null;
377
+ externalModules: LoadedModule[] | [];
378
+ processingTransformedTemplate: WorkflowStepClientGui | null;
379
+ serviceToken?: string;
380
+ apiKeyAuthTokenCollection: AuthTokenStoreData | Record<string, unknown>;
381
+ setApiKeyAuthTokenCollection: (apiKey: string, authToken: string, tokenExpiredIn: number) => void;
382
+ setServiceSessionToken: (token: string) => void;
383
+ resetProps: () => void;
384
+ startConfig: StartConfig;
385
+ setStartConfig: (startConfig: StartConfig) => void;
386
+ };
387
+
388
+ declare class IdvWasmService {
389
+ _worker: Worker | null;
390
+ _initialized: boolean;
391
+ _connectedToIdv: boolean;
392
+ _serviceRunning: boolean;
393
+ private _setErrorScreen;
394
+ constructor(setErrorScreen?: ({ type, details }: {
395
+ type: string;
396
+ details: string;
397
+ }) => void);
398
+ init(): Promise<any>;
399
+ connectByUserPass(config: ConnectionConfigCore): Promise<{
400
+ data: Record<string, any>;
401
+ code: number;
402
+ codeKey: string;
403
+ }>;
404
+ connectByApiKey(config: ConnectionByApiKeyConfigCore): Promise<any>;
405
+ connectByUrl(urlWithToken: string): Promise<any>;
406
+ startSession(id: string, locale: string, metadata?: Record<string, unknown>): Promise<{
407
+ data: SessionData | {
408
+ httpCode: number;
409
+ method: string;
410
+ url: string;
411
+ what?: string;
412
+ };
413
+ code: number;
414
+ codeKey: string;
415
+ }>;
416
+ continueSession(sessionId: string, locale: string): Promise<{
417
+ data: SessionData | {
418
+ httpCode: number;
419
+ method: string;
420
+ url: string;
421
+ what?: string;
422
+ };
423
+ code: number;
424
+ codeKey: string;
425
+ }>;
426
+ listWorkflows(params?: {
427
+ limit: number;
428
+ skip: number;
429
+ }): Promise<{
430
+ data: {
431
+ count: number;
432
+ items: Workflow[];
433
+ };
434
+ code: number;
435
+ codeKey: string;
436
+ }>;
437
+ getHealth(): Promise<{
438
+ data: Record<string, any>;
439
+ code: number;
440
+ codeKey: string;
441
+ }>;
442
+ getServiceToken(): Promise<{
443
+ data: string;
444
+ code: number;
445
+ codeKey: string;
446
+ }>;
447
+ abandonSession(): Promise<{
448
+ data: Record<string, any>;
449
+ code: number;
450
+ codeKey: string;
451
+ }>;
452
+ getWorkflow(workflowId: string): Promise<{
453
+ data: Workflow;
454
+ code: number;
455
+ codeKey: string;
456
+ }>;
457
+ pushData(stepId: string, data: any): Promise<{
458
+ data: Record<string, any>;
459
+ code: number;
460
+ codeKey: string;
461
+ }>;
462
+ getSessionState(): Promise<{
463
+ data: SessionData;
464
+ code: number;
465
+ codeKey: string;
466
+ }>;
467
+ waitForSessionUpdate(): Promise<{
468
+ data: Record<string, any>;
469
+ code: number;
470
+ codeKey: string;
471
+ }>;
472
+ pushSessionLogs(pushSessionLogsParams: PushSessionLogsParams): Promise<any>;
473
+ disconnect(): Promise<{
474
+ code: number;
475
+ codeKey: string;
476
+ }>;
477
+ private sendMessage;
478
+ isServiceRunning(): boolean;
479
+ isServiceConnected(): boolean;
480
+ private terminateWorker;
481
+ shutdown(): Promise<{
482
+ code: number;
483
+ }>;
484
+ }
485
+
486
+ export declare class IdvWebComponent extends LitElement {
487
+ static styles: CSSResult[];
488
+ private orientation;
489
+ store: IdvStoreProps & IdvIntegrationControllerProps & IdvBusinessLogicControllerProps;
490
+ currentScreenConfig: CurrentScreenConfig | null;
491
+ processingScreenFromWorkflow: WorkflowStepClientGui | null;
492
+ isProcessing: boolean;
493
+ loadedModules: [] | LoadedModule[];
494
+ modulesConfig: Record<string, any>;
202
495
  constructor();
203
- static get observedAttributes(): Array<string>;
204
- connectedCallback(): void;
496
+ _listenerFromModule: (module: string, data: any) => void;
497
+ _isProcessingCallback: (isProcessing: boolean) => void;
498
+ _performFromModule: (data: any) => void;
499
+ _processingScreen(): HTMLElement | TemplateResult<1>;
500
+ _currentScreen(): HTMLElement | null;
205
501
  get version(): string;
206
- private render;
207
502
  disconnectedCallback(): void;
503
+ render(): TemplateResult<1> | null;
208
504
  }
209
505
 
210
506
  export declare type InitConfig = {
@@ -227,6 +523,12 @@ export declare enum InitializeError {
227
523
  INITIALIZATION_IN_PROGRESS = 2
228
524
  }
229
525
 
526
+ declare type LoadedModule = {
527
+ id: string;
528
+ supportedTemplates: string[];
529
+ component: any;
530
+ };
531
+
230
532
  export declare type ModuleClass<TModuleProps = unknown, TModulesConfig = unknown> = IdvModuleStaticMethods & (new (...args: any[]) => BaseModule<TModuleProps, TModulesConfig>);
231
533
 
232
534
  export declare type PrepareWorkflowCompletion = {
@@ -242,8 +544,25 @@ export declare enum PrepareWorkflowError {
242
544
  SCENARIO_IN_PROGRESS = 4
243
545
  }
244
546
 
547
+ declare type PushSessionLogsParams = {
548
+ sessionId: string;
549
+ body: {
550
+ log: string;
551
+ errorCode?: string;
552
+ deviceInfo?: Record<string, string>;
553
+ };
554
+ };
555
+
245
556
  export declare function registerModule<TModuleProps = unknown, TModulesConfig = unknown>(name: string, ModuleClass: ModuleClass<TModuleProps, TModulesConfig>): void;
246
557
 
558
+ declare type SessionData = {
559
+ id: string;
560
+ currentStep: string;
561
+ workflow: Workflow;
562
+ properties: SessionPropertiesItem[];
563
+ isProcessingFiles: boolean;
564
+ };
565
+
247
566
  export declare enum SessionError {
248
567
  HTTP_ISSUE = 0,
249
568
  PROVIDER_ERROR = 1,
@@ -253,6 +572,31 @@ export declare enum SessionError {
253
572
  NOT_DATA_TYPE = 5
254
573
  }
255
574
 
575
+ /** sync with gui module */
576
+ declare type SessionPropertiesItem = {
577
+ id: string;
578
+ createdAt: string;
579
+ updatedAt: string;
580
+ createdBy: unknown;
581
+ updatedBy: unknown;
582
+ action: unknown;
583
+ step: string;
584
+ name: string;
585
+ path: unknown;
586
+ string: string;
587
+ array?: string[];
588
+ integer: unknown;
589
+ decimal: unknown;
590
+ object: unknown;
591
+ };
592
+
593
+ declare type StartConfig = {
594
+ host?: string;
595
+ isSecure?: boolean;
596
+ apiKey?: string;
597
+ port?: number;
598
+ };
599
+
256
600
  export declare enum StartSessionError {
257
601
  HTTP_ISSUE = 0,
258
602
  PROVIDER_ERROR = 1,