@regulaforensics/idv-capture-web 4.0.681-rc → 4.0.683-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,16 +1,6 @@
1
- import { BaseError } from '../../interfaces-idv/src';
2
- import { BaseError as BaseError_2 } from '../../../interfaces-idv/src';
3
- import { BaseModule } from '../../interfaces-idv/src';
4
1
  import { CSSResult } from 'lit';
5
- import { FailedAssets } from '../../interfaces-idv/src';
6
- import { IdvModuleProps } from '../../interfaces-idv/src';
7
- import { IdvModuleStaticMethods } from '../../interfaces-idv/src';
8
2
  import { LitElement } from 'lit';
9
- import { ModuleClass } from '../../interfaces-idv/src';
10
3
  import { nothing } from 'lit';
11
- import { PerformType } from '../../../interfaces-idv/src';
12
- import { PerformType as PerformType_2 } from '../../../../interfaces-idv/src';
13
- import { registerModule } from '../../interfaces-idv/src';
14
4
  import { TemplateResult } from 'lit-html';
15
5
 
16
6
  export declare type ApiKeyConnectionConfig = {
@@ -20,13 +10,18 @@ export declare type ApiKeyConnectionConfig = {
20
10
  httpTimeoutMs?: number;
21
11
  };
22
12
 
13
+ declare type ApiKeyConnectResult = {
14
+ authToken: string;
15
+ workflows: string[];
16
+ };
17
+
23
18
  declare type AuthTokenStoreData = {
24
19
  apiKey: string;
25
20
  authToken: string;
26
21
  tokenExpiresAt: number;
27
22
  };
28
23
 
29
- declare class BaseConfigureError extends BaseError_2 {
24
+ declare class BaseConfigureError extends BaseError {
30
25
  private static readonly MODULE;
31
26
  private static readonly ERROR_ENUM_NAME;
32
27
  private static readonly SHORT_CODE;
@@ -34,11 +29,11 @@ declare class BaseConfigureError extends BaseError_2 {
34
29
  errorCode: ConfigureError;
35
30
  message?: string;
36
31
  underlyingError?: string;
37
- underlyingBaseError?: BaseError_2;
32
+ underlyingBaseError?: BaseError;
38
33
  });
39
34
  }
40
35
 
41
- declare class BaseConnectionError extends BaseError_2 {
36
+ declare class BaseConnectionError extends BaseError {
42
37
  private static readonly MODULE;
43
38
  private static readonly ERROR_ENUM_NAME;
44
39
  private static readonly SHORT_CODE;
@@ -46,11 +41,11 @@ declare class BaseConnectionError extends BaseError_2 {
46
41
  errorCode: ConnectionError;
47
42
  message?: string;
48
43
  underlyingError?: string;
49
- underlyingBaseError?: BaseError_2;
44
+ underlyingBaseError?: BaseError;
50
45
  });
51
46
  }
52
47
 
53
- declare class BaseDeinitializationError extends BaseError_2 {
48
+ declare class BaseDeinitializationError extends BaseError {
54
49
  private static readonly MODULE;
55
50
  private static readonly ERROR_ENUM_NAME;
56
51
  private static readonly SHORT_CODE;
@@ -58,13 +53,39 @@ declare class BaseDeinitializationError extends BaseError_2 {
58
53
  errorCode: DeinitializationError;
59
54
  message?: string;
60
55
  underlyingError?: string;
61
- underlyingBaseError?: BaseError_2;
56
+ underlyingBaseError?: BaseError;
62
57
  });
63
58
  }
64
59
 
65
- export { BaseError }
60
+ export declare class BaseError {
61
+ errorCode: number | string;
62
+ errorCodeKey: string;
63
+ message?: string;
64
+ underlyingError?: string;
65
+ underlyingBaseError?: BaseError;
66
+ domain?: string;
67
+ module: string;
68
+ errorEnumName: string;
69
+ shortDomainCode: string;
70
+ constructor({ errorCode, errorCodeKey, message, underlyingError, underlyingBaseError, domain, module, errorEnumName, shortDomainCode, }: {
71
+ errorCode: number | string;
72
+ errorCodeKey: string;
73
+ module: string;
74
+ message?: string;
75
+ underlyingError?: string;
76
+ underlyingBaseError?: BaseError;
77
+ domain?: string;
78
+ errorEnumName: string;
79
+ shortDomainCode: string;
80
+ });
81
+ static getErrorKey<T extends Record<string, any>>(errorCode: number | string, errorEnum: T): string;
82
+ get lastUnderlyingError(): string | undefined;
83
+ toObject(): Record<string, any>;
84
+ get shortChain(): string;
85
+ get fullChain(): string;
86
+ }
66
87
 
67
- declare class BaseInitializationError extends BaseError_2 {
88
+ declare class BaseInitializationError extends BaseError {
68
89
  private static readonly MODULE;
69
90
  private static readonly ERROR_ENUM_NAME;
70
91
  private static readonly SHORT_CODE;
@@ -72,11 +93,11 @@ declare class BaseInitializationError extends BaseError_2 {
72
93
  errorCode: InitializeError;
73
94
  message?: string;
74
95
  underlyingError?: string;
75
- underlyingBaseError?: BaseError_2;
96
+ underlyingBaseError?: BaseError;
76
97
  });
77
98
  }
78
99
 
79
- export declare class BaseLoginError extends BaseError_2 {
100
+ export declare class BaseLoginError extends BaseError {
80
101
  private static readonly MODULE;
81
102
  private static readonly ERROR_ENUM_NAME;
82
103
  private static readonly SHORT_CODE;
@@ -84,13 +105,16 @@ export declare class BaseLoginError extends BaseError_2 {
84
105
  errorCode: LoginError;
85
106
  message?: string;
86
107
  underlyingError?: string;
87
- underlyingBaseError?: BaseError_2;
108
+ underlyingBaseError?: BaseError;
88
109
  });
89
110
  }
90
111
 
91
- export { BaseModule }
112
+ export declare abstract class BaseModule<TModuleProps = unknown, TModulesConfig = unknown> extends HTMLElement {
113
+ abstract props: IdvModuleProps<TModuleProps, TModulesConfig> | null;
114
+ abstract setProps(config: IdvModuleProps<TModuleProps, TModulesConfig>): void;
115
+ }
92
116
 
93
- declare class BasePrepareWorkflowError extends BaseError_2 {
117
+ declare class BasePrepareWorkflowError extends BaseError {
94
118
  private static readonly MODULE;
95
119
  private static readonly ERROR_ENUM_NAME;
96
120
  private static readonly SHORT_CODE;
@@ -98,11 +122,11 @@ declare class BasePrepareWorkflowError extends BaseError_2 {
98
122
  errorCode: PrepareWorkflowError;
99
123
  message?: string;
100
124
  underlyingError?: string;
101
- underlyingBaseError?: BaseError_2;
125
+ underlyingBaseError?: BaseError;
102
126
  });
103
127
  }
104
128
 
105
- declare class BaseTokenInitializationError extends BaseError_2 {
129
+ declare class BaseTokenInitializationError extends BaseError {
106
130
  private static readonly MODULE;
107
131
  private static readonly ERROR_ENUM_NAME;
108
132
  private static readonly SHORT_CODE;
@@ -110,11 +134,11 @@ declare class BaseTokenInitializationError extends BaseError_2 {
110
134
  errorCode: TokenInitializeError;
111
135
  message?: string;
112
136
  underlyingError?: string;
113
- underlyingBaseError?: BaseError_2;
137
+ underlyingBaseError?: BaseError;
114
138
  });
115
139
  }
116
140
 
117
- declare class BaseWorkflowError extends BaseError_2 {
141
+ declare class BaseWorkflowError extends BaseError {
118
142
  private static readonly MODULE;
119
143
  private static readonly ERROR_ENUM_NAME;
120
144
  private static readonly SHORT_CODE;
@@ -122,7 +146,7 @@ declare class BaseWorkflowError extends BaseError_2 {
122
146
  errorCode: WorkflowError;
123
147
  message?: string;
124
148
  underlyingError?: string;
125
- underlyingBaseError?: BaseError_2;
149
+ underlyingBaseError?: BaseError;
126
150
  });
127
151
  }
128
152
 
@@ -165,6 +189,10 @@ export declare enum ConnectionError {
165
189
  DECODING_FAILED = 2
166
190
  }
167
191
 
192
+ declare type ConnectResult = {
193
+ workflows: string[];
194
+ };
195
+
168
196
  declare type ContinueSessionResults = {
169
197
  error: BaseWorkflowError;
170
198
  } | {
@@ -220,11 +248,22 @@ export declare type DeinitializeCompletion = {
220
248
  error?: BaseDeinitializationError;
221
249
  };
222
250
 
251
+ declare type FailedAssets = {
252
+ imageURL: Set<string>;
253
+ base64: Set<string>;
254
+ blockingAssets: Set<string>;
255
+ };
256
+
223
257
  declare type FetchErrorResult = {
224
258
  code: FetchResultCode.HTTP_ISSUE | FetchResultCode.PROVIDER_ERROR | FetchResultCode.DECODING_FAILED;
225
259
  data: FetchState;
226
260
  };
227
261
 
262
+ declare type FetchResult<T> = {
263
+ code: FetchResultCode.SUCCESS;
264
+ data: T;
265
+ } | FetchErrorResult;
266
+
228
267
  declare enum FetchResultCode {
229
268
  SUCCESS = 0,
230
269
  HTTP_ISSUE = 4,
@@ -316,6 +355,8 @@ declare type IdvBusinessLogicControllerProps = {
316
355
  setFinalWaitingUi: (isWaitingUi: boolean) => void;
317
356
  _setFinalStepAndStopProcess: (stepId?: string) => void;
318
357
  _setIamAuthCodeAndStopProcess: (step: WorkflowStep) => void;
358
+ _redirectUsingFormSubmit: (url: string, authorizationToken: string) => void;
359
+ _redirectAndStopProcess: (step: WorkflowStep) => Promise<void>;
319
360
  resetSession: () => void;
320
361
  resetFetchService: () => void;
321
362
  _decodeMessageFromWebSocket: (eventData: MessageEvent['data']) => WebSocketDecodedSessionMessage | null;
@@ -344,121 +385,62 @@ declare class IdvFetchService {
344
385
  private _setConnectionToken;
345
386
  private _getOriginFromConfig;
346
387
  private _getOriginFromUrl;
347
- private _getSessionIdFromUrl;
348
388
  private _getExpiresAtFromTtl;
349
389
  private _getAuthorizationHeaderFromConnectionToken;
350
390
  private _getAuthorizationHeaderFromBasicToken;
351
391
  private _getAuthorizationHeaderFromAuthToken;
352
392
  private _getApiKeyAuthTokenFromLs;
353
393
  private _getApiKeyAuthTokenFromHeader;
354
- _getValidApiKeyAuthToken(config: {
355
- apiKey: string;
356
- deviceDescriptor: {
357
- ttl: number;
358
- };
359
- }, isFromSession: boolean): Promise<{
360
- code: FetchResultCode.SUCCESS;
361
- data: {
362
- token: string;
363
- expiresAt: number;
364
- };
365
- } | FetchErrorResult>;
366
- private _getAuthorizationSearchParam;
394
+ private _requestEphemeralAuthToken;
395
+ private _getValidApiKeyAuthToken;
367
396
  private _getResponseTextFromBadResponse;
368
397
  private _applyHttpTimeout;
369
398
  private _getRequestSignal;
370
399
  private _httpFetch;
400
+ private _fetchAndHandleResponse;
371
401
  private _fetchPing;
372
402
  private _fetchMe;
373
403
  private _fetchConnection;
374
404
  private _fetchEphemeral;
375
- private _fetchSessionByWorkflowId;
376
405
  private _fetchSessionState;
377
- private _fetchWorkflows;
378
- private _fetchWorkflow;
379
- private _fetchStep;
380
- private _fetchSessionLogs;
381
- private _fetchStartIamAuth;
382
- connectByUserPass(config: ConnectionConfigCore): Promise<{
383
- code: FetchResultCode.SUCCESS;
384
- data: {
385
- workflows: string[];
386
- };
387
- } | FetchErrorResult>;
388
- connectByApiKey(config: ConnectionByApiKeyConfigCore, isFromSession: boolean): Promise<{
389
- code: FetchResultCode.SUCCESS;
390
- data: {
391
- authToken: string;
392
- workflows: string[];
393
- };
394
- } | FetchErrorResult>;
395
- connectByUrl(urlWithToken: string): Promise<{
396
- code: FetchResultCode.SUCCESS;
397
- data: {
398
- workflows: string[];
399
- };
400
- } | FetchErrorResult>;
406
+ connectByUserPass(config: ConnectionConfigCore): Promise<FetchResult<ConnectResult>>;
407
+ connectByApiKey(config: ConnectionByApiKeyConfigCore, isFromSession: boolean): Promise<FetchResult<ApiKeyConnectResult>>;
408
+ connectByUrl(urlWithToken: string): Promise<FetchResult<ConnectResult>>;
401
409
  getConnectionToken(isFromSession: boolean): Promise<string>;
402
410
  startSession({ workflowId, locale, metadata, location, }: {
403
411
  workflowId: string;
404
412
  locale: string;
405
413
  metadata?: Record<string, unknown>;
406
414
  location?: GeoCoords | null;
407
- }): Promise<{
408
- code: FetchResultCode.SUCCESS;
409
- data: SessionData;
410
- } | FetchErrorResult>;
415
+ }): Promise<FetchResult<SessionData>>;
411
416
  continueSession({ sessionId, locale, }: {
412
417
  sessionId: string;
413
418
  locale: string;
414
- }): Promise<{
415
- code: FetchResultCode.SUCCESS;
416
- data: SessionData;
417
- } | FetchErrorResult>;
419
+ }): Promise<FetchResult<SessionData>>;
418
420
  listWorkflows(params?: {
419
421
  limit: number;
420
422
  skip: number;
421
- }): Promise<{
422
- code: FetchResultCode.SUCCESS;
423
- data: {
424
- count: number;
425
- items: Workflow[];
426
- };
427
- } | FetchErrorResult>;
428
- getWorkflow(workflowId: string, sessionIdFromUrl?: string | null, locale?: string): Promise<{
429
- code: FetchResultCode.SUCCESS;
430
- data: Workflow;
431
- } | FetchErrorResult>;
423
+ }): Promise<FetchResult<WorkflowsData>>;
424
+ getWorkflow(workflowId: string, sessionIdFromUrl?: string | null, locale?: string): Promise<FetchResult<Workflow>>;
432
425
  pushData({ sessionId, stepId, data, type, }: {
433
426
  sessionId: string;
434
427
  stepId: string;
435
428
  data: any;
436
429
  type?: PerformType;
437
- }): Promise<{
438
- code: FetchResultCode.SUCCESS;
439
- data: Record<string, unknown>;
440
- } | FetchErrorResult>;
441
- getSessionState(sessionId: string, locale?: string): Promise<{
442
- code: FetchResultCode.SUCCESS;
443
- data: SessionData;
444
- } | FetchErrorResult>;
445
- pushLogs(sessionId: string, pushLogsParams: PushLogsParams): Promise<Record<string, unknown>>;
430
+ }): Promise<FetchResult<Record<string, unknown>>>;
431
+ getSessionState(sessionId: string, locale?: string): Promise<FetchResult<SessionData>>;
432
+ pushLogs(sessionId: string, pushLogsParams: PushLogsParams): Promise<FetchResult<Record<string, unknown>>>;
446
433
  startIamAuth({ applicationId, baseUrl, metadata, locale, httpTimeoutMs, }: {
447
434
  applicationId: string;
448
435
  baseUrl: string;
449
436
  metadata?: Record<string, unknown>;
450
437
  locale?: string;
451
438
  httpTimeoutMs?: number;
452
- }): Promise<Record<string, unknown>>;
453
- private _postStartUpload;
454
- private _postFileChunk;
439
+ }): Promise<FetchResult<Record<string, unknown>>>;
440
+ private _startUpload;
441
+ private _uploadFileChunk;
455
442
  private _uploadFileInChunks;
456
- uploadFileToTemp(file: File, onProgress: (sentBytes: number, total: number) => void): Promise<{
457
- code: FetchResultCode.SUCCESS;
458
- data: {
459
- tempFileId: string;
460
- };
461
- } | FetchErrorResult>;
443
+ uploadFileToTemp(file: File, onProgress: (sentBytes: number, total: number) => void): Promise<FetchResult<TempFileIdResult>>;
462
444
  abortRequest(): void;
463
445
  }
464
446
 
@@ -527,13 +509,15 @@ declare enum IdvLogLevelConfigEnum {
527
509
  INFO = "INFO"
528
510
  }
529
511
 
530
- declare enum IdvLogLevelEnum {
531
- DEBUG = "DEBUG",
532
- ERROR = "ERROR",
533
- INFO = "INFO",
534
- WARNING = "WARNING",
535
- CRITICAL = "CRITICAL"
536
- }
512
+ export declare const IdvLogLevelEnum: {
513
+ readonly DEBUG: "DEBUG";
514
+ readonly ERROR: "ERROR";
515
+ readonly INFO: "INFO";
516
+ readonly WARNING: "WARNING";
517
+ readonly CRITICAL: "CRITICAL";
518
+ };
519
+
520
+ export declare type IdvLogLevelEnum = (typeof IdvLogLevelEnum)[keyof typeof IdvLogLevelEnum];
537
521
 
538
522
  export declare type IdvMessageEvent = {
539
523
  /** @deprecated Prefer `logLevel` and `message`; scheduled for removal. */
@@ -543,9 +527,24 @@ export declare type IdvMessageEvent = {
543
527
  message?: IdvServiceMessages | string;
544
528
  };
545
529
 
546
- export { IdvModuleProps }
530
+ export declare type IdvModuleProps<TModuleProps, TModulesConfig> = {
531
+ isProcessing?: (isProcessing: boolean) => void;
532
+ moduleProps: TModuleProps;
533
+ modulesConfig?: TModulesConfig;
534
+ perform: (data: any, type?: PerformType) => void;
535
+ idvEventListener: (module: string, data: any, logLevel?: 'INFO' | 'DEBUG') => void;
536
+ nonce?: string;
537
+ };
547
538
 
548
- export { IdvModuleStaticMethods }
539
+ export declare interface IdvModuleStaticMethods {
540
+ displayName: string;
541
+ isReady(): boolean;
542
+ getSupportedTemplates(): string[];
543
+ initialize(modulesConfig: Record<string, unknown>): void;
544
+ deinitialize(): void;
545
+ getIdentifier(): string;
546
+ cancel(): void;
547
+ }
549
548
 
550
549
  export declare enum IdvServiceMessages {
551
550
  DID_START_SESSION = "DID_START_SESSION",
@@ -616,9 +615,9 @@ export declare class IdvWebComponent extends LitElement {
616
615
  modulesConfig: Record<string, any>;
617
616
  storeNonce: string | undefined;
618
617
  connectedCallback(): void;
619
- _listenerFromModule: (module: string, data: any) => void;
618
+ _listenerFromModule: (module: string, data: any, logLevel?: IdvLogLevelEnum) => void;
620
619
  _isProcessingCallback: (isProcessing: boolean) => void;
621
- _performFromModule: (data: any, type?: PerformType_2) => void;
620
+ _performFromModule: (data: any, type?: PerformType) => void;
622
621
  _processingScreen(): HTMLElement | TemplateResult<1>;
623
622
  private _isTheSameModuleAndScreen;
624
623
  _currentScreen(): HTMLElement | typeof nothing;
@@ -673,7 +672,14 @@ export declare enum LoginError {
673
672
  AUTH_FAILURE = 7
674
673
  }
675
674
 
676
- export { ModuleClass }
675
+ export declare type ModuleClass<TModuleProps = unknown, TModulesConfig = unknown> = IdvModuleStaticMethods & (new (...args: any[]) => BaseModule<TModuleProps, TModulesConfig>);
676
+
677
+ declare type PerformType = (typeof PerformTypes)[keyof typeof PerformTypes] | undefined;
678
+
679
+ declare const PerformTypes: {
680
+ readonly FORM: "form";
681
+ readonly DATA: "data";
682
+ };
677
683
 
678
684
  export declare type PrepareWorkflowCompletion = {
679
685
  workflow?: Workflow;
@@ -713,7 +719,7 @@ declare type PushLogsParams = {
713
719
  };
714
720
  };
715
721
 
716
- export { registerModule }
722
+ export declare function registerModule<TModuleProps = unknown, TModulesConfig = unknown>(name: string, ModuleClass: ModuleClass<TModuleProps, TModulesConfig>): void;
717
723
 
718
724
  declare type SessionData = {
719
725
  id: string;
@@ -799,6 +805,10 @@ export declare type StartWorkflowConfig = {
799
805
  locale?: string;
800
806
  };
801
807
 
808
+ declare type TempFileIdResult = {
809
+ tempFileId: string;
810
+ };
811
+
802
812
  export declare type TokenConfigureCompletion = {
803
813
  workflows: string[];
804
814
  error?: BaseTokenInitializationError;
@@ -913,6 +923,11 @@ declare type WorkflowResult = {
913
923
  };
914
924
  } & Record<string, any>;
915
925
 
926
+ declare type WorkflowsData = {
927
+ count: number;
928
+ items: Workflow[];
929
+ };
930
+
916
931
  declare type WorkflowStep = {
917
932
  type: string;
918
933
  id: string;