@regulaforensics/idv-capture-web 4.0.685-nightly → 4.0.687-rc

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