@regulaforensics/idv-capture-web 3.2.244-nightly → 3.2.250-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,5 +1,6 @@
1
1
  import { CSSResult } from 'lit';
2
2
  import { LitElement } from 'lit';
3
+ import { nothing } from 'lit';
3
4
  import { TemplateResult } from 'lit-html';
4
5
 
5
6
  export declare type ApiKeyConnectionConfig = {
@@ -11,7 +12,7 @@ export declare type ApiKeyConnectionConfig = {
11
12
  declare type AuthTokenStoreData = {
12
13
  apiKey: string;
13
14
  authToken: string;
14
- tokenExpiredIn: number;
15
+ tokenExpiresAt: number;
15
16
  };
16
17
 
17
18
  declare class BaseConfigureError extends BaseError {
@@ -148,6 +149,7 @@ declare type ConnectionByApiKeyConfigCore = {
148
149
  port?: number;
149
150
  apiKey: string;
150
151
  authToken?: string;
152
+ tokenExpiresAt?: number;
151
153
  deviceDescriptor: {
152
154
  ttl: number;
153
155
  };
@@ -194,6 +196,25 @@ export declare type DeinitializeCompletion = {
194
196
  error?: BaseDeinitializationError;
195
197
  };
196
198
 
199
+ declare type FetchErrorResult = {
200
+ code: FetchResultCode.HTTP_ISSUE | FetchResultCode.PROVIDER_ERROR | FetchResultCode.DECODING_FAILED;
201
+ data: FetchState;
202
+ };
203
+
204
+ declare enum FetchResultCode {
205
+ SUCCESS = 0,
206
+ HTTP_ISSUE = 4,
207
+ PROVIDER_ERROR = 5,
208
+ DECODING_FAILED = 6
209
+ }
210
+
211
+ declare type FetchState = {
212
+ httpCode: number;
213
+ method: string;
214
+ url: string;
215
+ what?: string;
216
+ };
217
+
197
218
  declare type IdvBusinessLogicControllerProps = {
198
219
  connectByUserPass: (config: ConnectionConfigCore) => Promise<{
199
220
  error?: BaseConnectionError;
@@ -232,13 +253,13 @@ declare type IdvBusinessLogicControllerProps = {
232
253
  deinitializationIdv: () => Promise<{
233
254
  error?: any;
234
255
  }>;
235
- wasmService: IdvWasmService | null;
236
- setAndInitWasmService: () => Promise<void>;
256
+ fetchService: IdvFetchService | null;
257
+ setAndInitFetchService: () => Promise<void>;
237
258
  isFinalWaitingUi: boolean;
238
259
  setFinalWaitingUi: (isWaitingUi: boolean) => void;
239
260
  setFinalStepAndStopProcess: (stepId?: string) => void;
240
261
  resetSession: () => void;
241
- resetWasmService: () => void;
262
+ resetFetchService: () => void;
242
263
  };
243
264
 
244
265
  export declare type IdvEventTypes = (typeof IdvEventTypesEnum)[keyof typeof IdvEventTypesEnum];
@@ -248,15 +269,109 @@ export declare const IdvEventTypesEnum: {
248
269
  readonly ERROR: "ERROR";
249
270
  };
250
271
 
272
+ declare class IdvFetchService {
273
+ private _connectionTokenExpirationBufferMs;
274
+ private _origin;
275
+ private _locale;
276
+ private _workflowId;
277
+ private _session;
278
+ private _apiKeyAuthToken;
279
+ private _connectionToken;
280
+ private _connect;
281
+ private _getErrorTextFromError;
282
+ private _setApiKeyAuthToken;
283
+ private _setConnectionToken;
284
+ private _getOriginFromConfig;
285
+ private _getOriginFromUrl;
286
+ private _getExpiresAtFromTtl;
287
+ private _getAuthorizationHeaderFromConnectionToken;
288
+ private _getAuthorizationHeaderFromBasicToken;
289
+ private _getAuthorizationHeaderFromAuthToken;
290
+ private _getApiKeyAuthTokenFromLs;
291
+ private _getApiKeyAuthTokenFromHeader;
292
+ _getValidApiKeyAuthToken(config: {
293
+ apiKey: string;
294
+ deviceDescriptor: {
295
+ ttl: number;
296
+ };
297
+ }, isFromSession: boolean): Promise<{
298
+ code: FetchResultCode.SUCCESS;
299
+ data: {
300
+ token: string;
301
+ expiresAt: number;
302
+ };
303
+ } | FetchErrorResult>;
304
+ private _getAuthorizationSearchParam;
305
+ private _getResponseTextFromBadResponse;
306
+ private _fetchPing;
307
+ private _fetchMe;
308
+ private _fetchConnection;
309
+ private _fetchEphemeral;
310
+ private _fetchSessionByWorkflowId;
311
+ private _fetchSessionState;
312
+ private _fetchWorkflows;
313
+ private _fetchWorkflow;
314
+ private _fetchStep;
315
+ private _fetchSessionLogs;
316
+ connectByUserPass(config: ConnectionConfigCore): Promise<{
317
+ code: FetchResultCode.SUCCESS;
318
+ data: {
319
+ workflows: string[];
320
+ };
321
+ } | FetchErrorResult>;
322
+ connectByApiKey(config: ConnectionByApiKeyConfigCore, isFromSession: boolean): Promise<{
323
+ code: FetchResultCode.SUCCESS;
324
+ data: {
325
+ authToken: string;
326
+ workflows: string[];
327
+ };
328
+ } | FetchErrorResult>;
329
+ connectByUrl(urlWithToken: string): Promise<{
330
+ code: FetchResultCode.SUCCESS;
331
+ data: {
332
+ workflows: string[];
333
+ };
334
+ } | FetchErrorResult>;
335
+ getConnectionToken(isFromSession: boolean): Promise<string>;
336
+ startSession(id: string, locale: string, metadata?: Record<string, unknown>): Promise<{
337
+ code: FetchResultCode.SUCCESS;
338
+ data: SessionData;
339
+ } | FetchErrorResult>;
340
+ continueSession(sessionId: string, locale: string): Promise<{
341
+ code: FetchResultCode.SUCCESS;
342
+ data: SessionData;
343
+ } | FetchErrorResult>;
344
+ listWorkflows(params?: {
345
+ limit: number;
346
+ skip: number;
347
+ }): Promise<{
348
+ code: FetchResultCode.SUCCESS;
349
+ data: {
350
+ count: number;
351
+ items: Workflow[];
352
+ };
353
+ } | FetchErrorResult>;
354
+ getWorkflow(workflowId: string): Promise<{
355
+ code: FetchResultCode.SUCCESS;
356
+ data: Workflow;
357
+ } | FetchErrorResult>;
358
+ pushData(stepId: string, data: any): Promise<{
359
+ code: FetchResultCode.SUCCESS;
360
+ data: SessionData;
361
+ } | FetchErrorResult>;
362
+ getSessionState(): Promise<{
363
+ code: FetchResultCode.SUCCESS;
364
+ data: SessionData;
365
+ } | FetchErrorResult>;
366
+ pushSessionLogs(pushSessionLogsParams: PushSessionLogsParams): Promise<Record<string, unknown>>;
367
+ }
368
+
251
369
  declare type IdvIntegrationControllerProps = {
252
370
  _isInitialized: boolean;
253
371
  _isConnectedToPlatform: boolean;
254
372
  _initializationInProgress: boolean;
255
373
  _sessionIdFromUrl: null | string;
256
374
  _ttl: number;
257
- _runWasmService: () => Promise<{
258
- error?: BaseWorkflowError;
259
- }>;
260
375
  _continueSession: (locale: string, forceSessionId: string | null) => Promise<ContinueSessionResults>;
261
376
  _checkIsSessionDataValid: (sessionData: SessionData | {
262
377
  httpCode: number;
@@ -378,112 +493,18 @@ declare type IdvStoreProps = {
378
493
  processingTransformedTemplate: WorkflowStepClientGui | null;
379
494
  serviceToken?: string;
380
495
  apiKeyAuthTokenCollection: AuthTokenStoreData | Record<string, unknown>;
381
- setApiKeyAuthTokenCollection: (apiKey: string, authToken: string, tokenExpiredIn: number) => void;
496
+ setApiKeyAuthTokenCollection: (apiKey: string, authToken: string, tokenExpiresAt: number) => void;
382
497
  setServiceSessionToken: (token: string) => void;
383
498
  resetProps: () => void;
384
499
  startConfig: StartConfig;
385
500
  setStartConfig: (startConfig: StartConfig) => void;
386
501
  };
387
502
 
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
503
  export declare class IdvWebComponent extends LitElement {
504
+ private _currentProgressElement;
505
+ private _currentScreenElement;
506
+ private _currentScreenModuleId;
507
+ private _currentScreenConfig;
487
508
  static styles: CSSResult[];
488
509
  private orientation;
489
510
  store: IdvStoreProps & IdvIntegrationControllerProps & IdvBusinessLogicControllerProps;
@@ -497,7 +518,8 @@ export declare class IdvWebComponent extends LitElement {
497
518
  _isProcessingCallback: (isProcessing: boolean) => void;
498
519
  _performFromModule: (data: any) => void;
499
520
  _processingScreen(): HTMLElement | TemplateResult<1>;
500
- _currentScreen(): HTMLElement | null;
521
+ private _isTheSameModuleAndScreen;
522
+ _currentScreen(): HTMLElement | typeof nothing;
501
523
  get version(): string;
502
524
  disconnectedCallback(): void;
503
525
  render(): TemplateResult<1> | null;
@@ -545,7 +567,6 @@ export declare enum PrepareWorkflowError {
545
567
  }
546
568
 
547
569
  declare type PushSessionLogsParams = {
548
- sessionId: string;
549
570
  body: {
550
571
  log: string;
551
572
  errorCode?: string;