@idscan/idvc2 3.7.0 → 3.9.0

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.
@@ -1 +1,4 @@
1
- export declare const SHOW_PREVIEW_DELAY = 4000;
1
+ export declare const TIME_TO_SCALE = 1000;
2
+ export declare const TIME_TO_ROTATE = 1000;
3
+ export declare const TIME_TO_SCAN = 1000;
4
+ export declare const SHOW_PREVIEW_DELAY: number;
@@ -0,0 +1,3 @@
1
+ import type { StepType } from './stepsDescription';
2
+ import { DocumentTypeName } from './documentTypes';
3
+ export declare const checkIsNeedRotateCard: (stepType: StepType, documentTypeName: '' | DocumentTypeName) => boolean;
@@ -0,0 +1,6 @@
1
+ export type Base64 = string;
2
+ export type Base64DataUrl = string;
3
+ export declare const base64ToUint8Array: (base64: string) => Uint8Array;
4
+ export declare const isBase64DataUrl: (value: string) => value is string;
5
+ export declare const extractBase64: (input?: string | null) => Base64;
6
+ export declare const blobToBase64DataUrl: (blob: Blob) => Promise<Base64DataUrl>;
@@ -1,6 +1,5 @@
1
1
  import { ICrop } from './ts/common';
2
2
  import { Bbox } from '../types/geometry';
3
- export type Base64Image = string;
4
3
  export type RGBAColor = string;
5
4
  export type RGBColor8 = Uint8ClampedArray;
6
5
  export type RGBColor32 = Float32Array;
@@ -1,2 +1,5 @@
1
1
  import { StepTypeImageName } from '../environment/stepsDescription';
2
- export declare const getStepBackground: (stepType: StepTypeImageName) => string;
2
+ import { DocumentTypeName } from '../environment/documentTypes';
3
+ export declare const getFrontImageOfDocument: (documentTypeName: DocumentTypeName | '') => string;
4
+ export declare const getScanLineTranslateYRange: (stepType: StepTypeImageName, documentTypeName: DocumentTypeName | '') => readonly [string, string];
5
+ export declare const getStepBackground: (stepType: StepTypeImageName, documentTypeName: DocumentTypeName | '') => string | undefined;
@@ -1,8 +1,3 @@
1
- import { Base64Image } from './image';
2
- export declare const encodeMeta: (metadata: any) => string;
3
- export declare const decodeMeta: (str: string) => any;
4
- export declare const base64ToArrayBuffer: (base64: string) => Uint8Array;
5
- export declare const getDataFromBase64Img: (imgString: Base64Image) => string;
6
1
  export declare const splitWordByUpperLetters: (word: string) => string[];
7
2
  export declare const normalizeCamelCase: (word: string) => string;
8
3
  export declare const removeHtmlEntities: (str: string) => string;
@@ -1,6 +1,8 @@
1
1
  import { IConfig } from './modules/Config';
2
2
  import type { SupportedLanguage } from './environment/langs';
3
3
  import type { IDocumentTypeConfig } from './modules/validator';
4
+ export { prepareRequestDataForDiveApi, } from './integrations/prepareRequestDataForDiveApi';
5
+ export type { IPrepareRequestDataForDiveApiParams } from './integrations/prepareRequestDataForDiveApi';
4
6
  export default class VideoCapturing {
5
7
  constructor(config: IConfig);
6
8
  get version(): string;
@@ -0,0 +1,59 @@
1
+ import { IDataForSubmit } from '../util';
2
+ import { Base64 } from '../helpers/base64';
3
+ import { DocumentTypeIndex } from '../environment/documentTypes';
4
+ interface IRequestBase {
5
+ frontImageBase64: Base64;
6
+ backOrSecondImageBase64: Base64;
7
+ faceImageBase64: Base64;
8
+ ssn: string;
9
+ frontMultiImagesBase64: Base64;
10
+ faceMultiImagesBase64: Base64;
11
+ documentType: DocumentTypeIndex | 0;
12
+ }
13
+ interface IRequestV3 extends IRequestBase {
14
+ trackString: string;
15
+ verifyFace: boolean;
16
+ captureMethod: string;
17
+ userAgent: string;
18
+ frontEndMetadata: string;
19
+ metadata?: string;
20
+ }
21
+ interface IRequestV4 extends IRequestBase {
22
+ trackString: {
23
+ data: string;
24
+ barcodeParams: string;
25
+ };
26
+ metadata: {
27
+ captureMethod: string;
28
+ userAgent: string;
29
+ frontEndMetadata: string;
30
+ otherMetadata?: string;
31
+ };
32
+ }
33
+ export interface IPrepareRequestDataForDiveApiParams<P = Record<string, unknown>> {
34
+ data?: IDataForSubmit;
35
+ payload?: P;
36
+ versionAPI?: '3' | '3.1' | '4';
37
+ }
38
+ type IRequestPayload = Record<string, unknown>;
39
+ /**
40
+ * Prepares request payload for Dive API (v3 / v3.1 / v4) based on submitted capture data.
41
+ *
42
+ * Builds a normalized request object:
43
+ * - extracts base64 images (front, back/second, face)
44
+ * - prepares multi-capture images if available
45
+ * - parses metadata
46
+ * - adjusts payload structure depending on API version
47
+ *
48
+ * @template P - Additional custom payload fields to be merged into the request
49
+ *
50
+ * @param params - Parameters object
51
+ * @param params.data - Raw data collected from the results of the IDVC capture flow
52
+ * @param params.payload - Optional custom fields to extend the request payload
53
+ * @param params.versionAPI - Target Dive API version (`'3' | '3.1' | '4'`)
54
+ *
55
+ * @returns Promise resolving to a prepared Dive API request object
56
+ * compatible with the specified API version and extended with custom payload fields
57
+ */
58
+ export declare const prepareRequestDataForDiveApi: <P extends IRequestPayload>({ data, versionAPI, payload, }: IPrepareRequestDataForDiveApiParams<P>) => Promise<(IRequestV3 | IRequestV4) & P>;
59
+ export {};
@@ -1,6 +1,6 @@
1
- import { Base64Image } from './helpers/image';
1
+ import { Base64 } from './helpers/base64';
2
2
  type Base64Object = {
3
- data: ImageData | Base64Image | null;
3
+ data: ImageData | Base64 | null;
4
4
  err: boolean;
5
5
  };
6
6
  declare const dropFile: (base64Obj: Base64Object) => Promise<void>;
@@ -1,8 +1,8 @@
1
- import { Base64Image } from '../helpers/image';
2
1
  import { StepType, StepTypeImageName } from '../environment/stepsDescription';
3
2
  import { StepMode } from '../defaultConfig';
4
3
  import { ErrorCodes } from '../environment/langs';
5
4
  import { DocumentTypeName } from '../environment/documentTypes';
5
+ import { Base64 } from '../helpers/base64';
6
6
  export interface IStepConfigMode {
7
7
  name: 'mode';
8
8
  value: StepMode;
@@ -14,7 +14,7 @@ export interface IStepObj {
14
14
  name: string;
15
15
  type: StepType;
16
16
  camera: VideoFacingModeEnum;
17
- img: Base64Image | null;
17
+ img: Base64 | null;
18
18
  err?: string | null;
19
19
  text?: string;
20
20
  time?: number;
@@ -25,7 +25,7 @@ export interface IStepObj {
25
25
  }
26
26
  export interface IStepCallback {
27
27
  /** base64 encoded step image */
28
- img: Base64Image | null;
28
+ img: Base64 | null;
29
29
  /** blob step image */
30
30
  blob: Blob | null;
31
31
  /** blob step MultiImages */
@@ -43,7 +43,7 @@ export interface IStepCallback {
43
43
  /** mrz recognized text */
44
44
  mrzText?: string;
45
45
  /** cropped base64 encoded mrz image */
46
- mrzImg?: Base64Image | null;
46
+ mrzImg?: Base64 | null;
47
47
  /** cropped blob mrz image */
48
48
  mrzBlob?: Blob | null;
49
49
  /** recognized text */
@@ -54,7 +54,7 @@ export default class Step implements IStepCallback, IStepObj {
54
54
  multiImagesBlob: Blob | null;
55
55
  errorCode: ErrorCodes | null | undefined;
56
56
  mrzText?: string;
57
- mrzImg?: Base64Image | null;
57
+ mrzImg?: Base64 | null;
58
58
  mrzBlob?: Blob | null;
59
59
  trackString?: string;
60
60
  err?: string | null;
@@ -65,12 +65,12 @@ export default class Step implements IStepCallback, IStepObj {
65
65
  name: string;
66
66
  type: StepType;
67
67
  camera: VideoFacingModeEnum;
68
- img: Base64Image | null;
68
+ img: Base64 | null;
69
69
  cameraInfo: Record<string, any>;
70
70
  stepTypeImageName: StepTypeImageName;
71
71
  shouldRecordMultiImages: boolean;
72
72
  delayUntilCaptureButtonVisible?: number;
73
- constructor(nameOrObj: string | IStepObj, type?: StepType, camera?: VideoFacingModeEnum, time?: number, img?: Base64Image | null);
73
+ constructor(nameOrObj: string | IStepObj);
74
74
  get isShowManualSwitchButton(): boolean;
75
75
  get capturingMode(): StepMode;
76
76
  static createStep(stepObj: IStepObj, currentDocumentType: DocumentTypeName | ''): Step;
@@ -1,5 +1,5 @@
1
- import type { Base64Image } from '../helpers/image';
2
1
  import type { ErrorCodeNames } from '../environment/langs';
2
+ import { Base64 } from '../helpers/base64';
3
3
  type ProcessingErrorCode = ErrorCodeNames | '';
4
4
  type Coordinate = {
5
5
  x: number;
@@ -22,9 +22,9 @@ export declare const pdfProcess: (smallImage: any, { perimeter }: {
22
22
  }) => Promise<boolean>;
23
23
  /**
24
24
  *
25
- * @param {Base64Image} data - base64 image
25
+ * @param {Base64} data - base64 image
26
26
  */
27
- export declare const barCodeProcess: (data: Base64Image) => Promise<boolean>;
27
+ export declare const barCodeProcess: (data: Base64) => Promise<boolean>;
28
28
  export declare const frontProcess: ({ side, perimeter, isHasFace }: {
29
29
  side: any;
30
30
  perimeter: any;
@@ -4,7 +4,7 @@ import { CardStep } from '../CardStep/CardStep';
4
4
  import { VideoWrapper } from '../VideoWrapper/VideoWrapper';
5
5
  import { UploaderUI } from '../Uploader/UploaderUI';
6
6
  import { StepType } from '../../../environment/stepsDescription';
7
- import { ControlButton, ControlButtonClickedCustomEvent } from '../ControlButton/ControlButton';
7
+ import { ControlButton, ControlButtonClickedCustomEvent } from '../ControlButton';
8
8
  import { CallbackHandler, MessageBox } from '../MessageBox/MessageBox';
9
9
  import { DesktopNotification, DesktopNotificationVisibility } from '../DesktopNotification/DesktopNotification';
10
10
  import { LoaderUI } from '../Loader/LoaderUI';
@@ -1,4 +1,5 @@
1
1
  import { ComponentLit } from '../ComponentLit';
2
+ import { DocumentTypeName } from '../../../environment/documentTypes';
2
3
  import type { StepTypeImageName } from '../../../environment/stepsDescription';
3
4
  import type { ErrorCodes } from '../../../environment/langs';
4
5
  import Step from '../../Step';
@@ -9,6 +10,7 @@ export type UploaderState = {
9
10
  image: string;
10
11
  errorCode?: ErrorCodes;
11
12
  isBadImage?: boolean;
13
+ documentTypeName: DocumentTypeName | '';
12
14
  };
13
15
  export type UploaderUIEvents = {
14
16
  onFileInput: (event: Event) => void;
@@ -1,16 +1,19 @@
1
1
  import { ComponentLit } from '../../ComponentLit';
2
2
  import type { StepType } from '../../../../environment/stepsDescription';
3
+ import { DocumentTypeName } from '../../../../environment/documentTypes';
3
4
  type StepPreviewState = {
4
5
  stepType: StepType;
6
+ documentTypeName: DocumentTypeName | '';
5
7
  };
6
8
  export declare class StepPreview extends ComponentLit<StepPreviewState> {
7
- private backgroundElement;
9
+ #private;
8
10
  constructor(mountElement: any, state: StepPreviewState);
9
- showPreview(timeToShow: number, isEnabled: boolean): Promise<void>;
11
+ showPreview(isEnabled: boolean): Promise<void>;
12
+ stopAnimation: () => void;
10
13
  backToInitialState(): void;
11
14
  remount(): void;
12
- protected updateView(): void;
13
- private setStepBackground;
14
- private getStepTypeBackground;
15
+ protected updateView(): Promise<void>;
16
+ private updateStepBackground;
17
+ private setBackgroundMarkup;
15
18
  }
16
19
  export {};
@@ -7,7 +7,8 @@ import LoggerController from '../controllers/LoggerController';
7
7
  import Step from '../modules/Step';
8
8
  import { AllLabels } from '../environment/langs';
9
9
  import { StepType } from '../environment/stepsDescription';
10
- import { Base64Image, Offset, Size } from '../helpers/image';
10
+ import { Base64 } from '../helpers/base64';
11
+ import { Offset, Size } from '../helpers/image';
11
12
  import { RealFaceTurnSide } from './enums/realFace';
12
13
  import { StepConfig, StepMode } from '../defaultConfig';
13
14
  import { DeepPartial } from './helpers/DeepPartial';
@@ -45,7 +46,7 @@ export type Context = {
45
46
  steps: Step[];
46
47
  currentStepType: StepType;
47
48
  currentStepCamera: VideoFacingModeEnum;
48
- currentStepImg: Base64Image | null;
49
+ currentStepImg: Base64 | null;
49
50
  currentStepBlob: Blob | null;
50
51
  curStep: number;
51
52
  currentStep: number;
@@ -1,4 +1,4 @@
1
- import { Base64Image } from './helpers/image';
1
+ import { Base64 } from './helpers/base64';
2
2
  import { IStepCallback } from './modules/Step';
3
3
  import { DocumentTypeIndex, DocumentTypeName } from './environment/documentTypes';
4
4
  import { Context } from './types/context';
@@ -22,5 +22,5 @@ export declare const filterWithForbiddenKeysValues: (obj: any, forbiddenKeys: an
22
22
  export declare const prepareCameraErr: (err: IError) => IError;
23
23
  export declare const formDataForSubmit: (steps: IStepCallback[], c: Context, payload?: {}) => IDataForSubmit;
24
24
  export declare const imageToImageData: (img: HTMLImageElement) => ImageData;
25
- export declare const base64ToImageData: (base64: Base64Image) => Promise<ImageData>;
25
+ export declare const base64ToImageData: (base64: Base64) => Promise<ImageData>;
26
26
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idscan/idvc2",
3
- "version": "3.7.0",
3
+ "version": "3.9.0",
4
4
  "description": "component for the capturing documents",
5
5
  "main": "dist/idvc.js",
6
6
  "types": "dist/types/idvc.d.ts",