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