@idscan/idvc2 2.8.0 → 2.8.2

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.
@@ -6,7 +6,7 @@ import Step from './modules/Step';
6
6
  import { Base64Image, ISize, IOffset } from './helpers/image';
7
7
  import MetaData from './modules/MetaData';
8
8
  import { StepType } from './environment/stepsDescription';
9
- import { IStepMode } from './defaultConfig';
9
+ import { StepConfig, StepMode } from './defaultConfig';
10
10
  import { IMRZResults } from './types/mrz';
11
11
  import { RealFaceTurnSide } from './types/enums/realFace';
12
12
  import { InitClient } from './modules/supaBaseClient';
@@ -72,6 +72,7 @@ export interface Context {
72
72
  isShowStayText: boolean;
73
73
  isShowHoldText: boolean;
74
74
  isShowHelpText: boolean;
75
+ isShowSwitchToUploaderText: boolean;
75
76
  isShowCloserText: boolean;
76
77
  isShowCenterText: boolean;
77
78
  isShowAwayText: boolean;
@@ -104,7 +105,9 @@ export interface Context {
104
105
  offsetsFace: IOffset;
105
106
  offsetsResized: IOffset;
106
107
  offsets: IOffset;
107
- get currentStepMode(): IStepMode;
108
+ loop: null | LoopFunction;
109
+ get currentStepMode(): StepMode;
110
+ get currentStepDelay(): number;
108
111
  get hasFrontStep(): boolean;
109
112
  calculateIsMirroring(): void;
110
113
  dropKeys(): void;
@@ -122,7 +125,7 @@ export interface Context {
122
125
  init(): void;
123
126
  dropCounters(): void;
124
127
  updateRealFaceTurnSide(): void;
125
- loop: null | LoopFunction;
128
+ getStepConfigValue<K extends keyof StepConfig>(key: K): StepConfig[K];
126
129
  }
127
130
  declare const context: Context;
128
131
  export default context;
@@ -10,29 +10,31 @@ export type NormalizedType = 'Path';
10
10
  * { boolean? } uploader
11
11
  * { boolean? } video
12
12
  */
13
- export interface IStepMode {
13
+ export type StepMode = {
14
14
  uploader?: boolean;
15
15
  video?: boolean;
16
- }
17
- export type IStepModeKeys = keyof IStepMode;
18
- export interface IStepConfig {
16
+ };
17
+ export type IStepModeKeys = keyof StepMode;
18
+ export type StepConfig = {
19
19
  type: StepType;
20
20
  name: string;
21
- mode: IStepMode;
22
- }
23
- export interface IDocumentType {
21
+ mode: StepMode;
22
+ autocaptureDelay?: number;
23
+ enableDesktopNotification?: boolean;
24
+ };
25
+ export type DocumentType = {
24
26
  type: DocumentTypeName;
25
- steps: IStepConfig[];
26
- mode?: IStepMode;
27
- }
27
+ steps: StepConfig[];
28
+ mode?: StepMode;
29
+ };
28
30
  type ImageURI = 'png' | 'jpeg' | 'webp';
29
- export type DefaultConfigName = 'el' | 'licenseKey' | 'networkUrl' | 'chunkPublicPath' | 'language' | 'documentTypes' | 'realFaceMode' | 'modalPosition' | 'resizeUploadedImage' | 'showSubmitBtn' | 'h_stepMode' | 'isShowDocumentTypeSelect' | 'useCDN' | 'useHeic' | 'processingImageFormat' | 'hideDocumentTitle' | 'autoContinue' | 'isShowGuidelinesButton' | 'fixFrontOrientAfterUpload' | 'onChange' | 'clickGuidlines' | 'onReset' | 'submit' | 'onRetakeHook' | 'onCameraError' | 'onMounted' | 'onReloaded';
31
+ export type DefaultConfigName = 'el' | 'licenseKey' | 'networkUrl' | 'chunkPublicPath' | 'language' | 'documentTypes' | 'realFaceMode' | 'modalPosition' | 'resizeUploadedImage' | 'showSubmitBtn' | 'h_stepMode' | 'isShowDocumentTypeSelect' | 'useCDN' | 'useHeic' | 'processingImageFormat' | 'hideDocumentTitle' | 'autoContinue' | 'autocaptureDelay' | 'isShowGuidelinesButton' | 'fixFrontOrientAfterUpload' | 'onChange' | 'clickGuidlines' | 'onReset' | 'submit' | 'onRetakeHook' | 'onCameraError' | 'onMounted' | 'onReloaded';
30
32
  /**
31
33
  * IDefaultConfig
32
34
  * @param {string} name,
33
35
  * @param {'String' | 'Array' | 'Number' | 'Boolean' | 'Function' | 'Object'} type,
34
36
  * @param {string} description,
35
- * @param {string | boolean | DefaultValueFunction | number | IDocumentType[]} defaultValue,
37
+ * @param {string | boolean | DefaultValueFunction | number | DocumentType[]} defaultValue,
36
38
  * @param {ValidationFn} validationFn,
37
39
  * @parma {boolean} hidden?,
38
40
  * @param {RealFaceMode[]} values?,
@@ -43,7 +45,7 @@ export interface IDefaultConfig {
43
45
  name: DefaultConfigName;
44
46
  type: 'String' | 'Array' | 'Number' | 'Boolean' | 'Function' | 'Object';
45
47
  description: string;
46
- defaultValue: IStepMode | string | boolean | DefaultValueFunction | number | IDocumentType[];
48
+ defaultValue: StepMode | string | boolean | DefaultValueFunction | number | DocumentType[];
47
49
  validationFn: ValidationFn;
48
50
  hidden?: boolean;
49
51
  values?: ModalPositionKeys[] | RealFaceMode[] | typeof supportedLanguages[number][] | ImageURI[];
@@ -22,6 +22,7 @@ interface IHintTexts {
22
22
  mrz: string;
23
23
  capturing: string;
24
24
  pdf: string;
25
+ switchToUploader: string;
25
26
  back: string;
26
27
  barcode: string;
27
28
  hold: string;
@@ -54,6 +55,10 @@ interface IGeneral {
54
55
  continueBtn: string;
55
56
  submitBtn: string;
56
57
  resetAllStepsBtn: string;
58
+ desktopNotification: {
59
+ barcode: string;
60
+ other: string;
61
+ };
57
62
  btnUploader: string;
58
63
  btnCamera: string;
59
64
  pressToUpdateText: string;
@@ -4,15 +4,15 @@ import { SupportedLanguage } from './environment/langs';
4
4
  import { IDocumentTypeConfig } from './modules/validator';
5
5
  export default class VideoCapturing {
6
6
  constructor(config: IConfig);
7
- private init;
7
+ get version(): string;
8
8
  /**
9
9
  *
10
10
  * @param language
11
11
  */
12
12
  changeLanguage(language: SupportedLanguage): void;
13
- get version(): string;
14
13
  resetAllSteps(): void;
15
14
  reloadComponent(newConfig: Partial<IConfig>): void;
16
15
  updateDocumentTypes(documentTypes: IDocumentTypeConfig): void;
17
16
  showSpinner(val: any): void;
17
+ private init;
18
18
  }
@@ -1,4 +1,4 @@
1
- import { IStepConfig, ValidationFn } from '../defaultConfig';
1
+ import { StepConfig, ValidationFn } from '../defaultConfig';
2
2
  import { RealFaceMode } from '../environment/realFaceModes';
3
3
  import { SupportedLanguage } from '../environment/langs';
4
4
  import { StepType } from '../environment/stepsDescription';
@@ -57,8 +57,10 @@ export interface IConfig {
57
57
  * - video - capturing an image using the auto capture feature
58
58
  */
59
59
  documentTypes: IDocumentTypeConfig | null;
60
- /** the setting that enables the automatic transition from one step to the next step. Default */
60
+ /** the setting that enables the automatic transition from one step to the next step. Default is false */
61
61
  autoContinue?: boolean;
62
+ /** the setting the delay (in ms) when automatically switching steps. Default is 1000ms */
63
+ autocaptureDelay?: number;
62
64
  /** sets the maximum size in pixels (of the largest of the height or width) for a manually uploaded picture */
63
65
  resizeUploadedImage?: number;
64
66
  /** this setting will change the orientation of a front step's image if it is not horizontal when it is uploaded */
@@ -122,10 +124,11 @@ declare class Config implements IConfig {
122
124
  el: string;
123
125
  commonStepTypes: Set<StepType>;
124
126
  types: DocumentTypeName[];
125
- steps: IStepConfig[];
127
+ steps: StepConfig[];
126
128
  documentTypes: IDocumentTypeConfig | null;
127
129
  licenseKey: string;
128
130
  autoContinue: boolean;
131
+ autocaptureDelay: number;
129
132
  resizeUploadedImage: number;
130
133
  fixFrontOrientAfterUpload: boolean;
131
134
  useCDN: boolean;
@@ -1,4 +1,5 @@
1
- import { ISize } from '../helpers/image';
1
+ import type { ISize } from '../helpers/image';
2
+ import type { PDFPreProcessResult, PDFResult } from '../types/pdf';
2
3
  interface Coord {
3
4
  x: number;
4
5
  y: number;
@@ -13,6 +14,7 @@ export declare class PdfModule {
13
14
  out: any;
14
15
  isAllocate: boolean;
15
16
  successCount: number;
17
+ pdfCapturedCount: number;
16
18
  edgMem: any;
17
19
  src2: any;
18
20
  outLen: any;
@@ -24,7 +26,15 @@ export declare class PdfModule {
24
26
  minPDFframes: number;
25
27
  cropSizes: ISize;
26
28
  canvasSizes: ISize;
27
- constructor(core: any, processor: any);
29
+ private preProcessCore;
30
+ private readonly preProcessReader;
31
+ constructor(pdf: {
32
+ core: any;
33
+ processor: any;
34
+ }, pdfWithPreProcess?: {
35
+ core: any;
36
+ processor: any;
37
+ });
28
38
  _errorId: number;
29
39
  get errorId(): number;
30
40
  set errorId(id: number);
@@ -37,10 +47,6 @@ export declare class PdfModule {
37
47
  * @param {{width: number, height: number}} canvasSizes - ui.borderCanvas
38
48
  */
39
49
  init(geometry: any, minPDFframes: any, cropSize: any, canvasSizes: any): void;
40
- /**
41
- * returns error Object
42
- * @return {{errorType: string, error: boolean, errorVal: string}}
43
- */
44
50
  licenseError(): {
45
51
  error: boolean;
46
52
  errorType: string;
@@ -51,7 +57,7 @@ export declare class PdfModule {
51
57
  initReader(key: any): void;
52
58
  destroyReader(): void;
53
59
  setPdfData(data: any): void;
54
- readPdf(): any;
60
+ readPdf(): PDFResult;
55
61
  releasePdf(): void;
56
62
  create(): void;
57
63
  free(): void;
@@ -61,20 +67,10 @@ export declare class PdfModule {
61
67
  bh: number;
62
68
  };
63
69
  allocate(): void;
64
- readPDF(data: any): any;
65
70
  drawCords(locations: Record<string, number>): Coord[];
66
- proccessPDF(data: ImageData): {
67
- status: boolean;
68
- predict: boolean;
69
- touch: boolean;
70
- image: any;
71
- type: string;
72
- error: any;
73
- coords: any[];
74
- trackString: string;
75
- pdfSuccessCount: number;
76
- pdfCount: number;
77
- isSuccessProcess: boolean;
78
- };
71
+ processPDF(data: ImageData): Record<string, any>;
72
+ processPDFWithPreProcess(data: ImageData): PDFPreProcessResult;
73
+ private readPDF;
74
+ private readPDFWithPreProcess;
79
75
  }
80
76
  export default PdfModule;
@@ -1,9 +1,9 @@
1
1
  import { Base64Image } from '../helpers/image';
2
2
  import { StepType } from '../environment/stepsDescription';
3
- import { IStepMode } from '../defaultConfig';
3
+ import { StepMode } from '../defaultConfig';
4
4
  export interface IStepConfigMode {
5
5
  name: 'mode';
6
- value: IStepMode;
6
+ value: StepMode;
7
7
  }
8
8
  export type StepConfig = IStepConfigMode;
9
9
  export type StepConfigNames = StepConfig['name'];
@@ -60,11 +60,11 @@ export default class Step implements IStepCallback, IStepObj {
60
60
  img: Base64Image | null;
61
61
  cameraInfo: Record<string, any>;
62
62
  constructor(nameOrObj: string | IStepObj, type?: StepType, camera?: VideoFacingModeEnum, time?: number, img?: Base64Image | null);
63
+ get isShowManualSwitchButton(): boolean;
64
+ get capturingMode(): StepMode;
65
+ static createStep(stepObj: IStepObj): Step;
63
66
  setConfig(configName: StepConfigNames, configValue: StepConfigValues): void;
64
67
  hasConfig(configName: StepConfigNames): StepConfig | undefined;
65
68
  getConfig(configName: StepConfigNames): StepConfigValues | null;
66
- get isShowManualSwitchButton(): boolean;
67
- get capturingMode(): IStepMode;
68
69
  prepareStepForCallback(index: number): IStepCallback;
69
- static createStep(stepObj: IStepObj): Step;
70
70
  }
@@ -1,33 +1,30 @@
1
- import { StepType } from '../../environment/stepsDescription';
1
+ import type { StepType } from '../../environment/stepsDescription';
2
+ import { DocumentTypeIndex } from '../../environment/documentTypes';
2
3
  declare class MaskCapture {
3
4
  private readonly svg;
4
5
  private readonly strokeMask;
5
6
  private successMask;
6
7
  private readonly pdfHint;
7
- private readonly mrzHint;
8
+ private readonly mrz2Hint;
9
+ private readonly mrz3Hint;
8
10
  private type;
9
11
  private cssVarContainer;
10
12
  private borders;
11
13
  private cssVars;
14
+ private hintElements;
15
+ constructor(cssVarContainer: any);
12
16
  _mainContainerSizes: {
13
17
  width: string;
14
18
  height: string;
15
19
  };
16
- private mappedState;
17
- constructor(cssVarContainer: any);
18
20
  /**
19
- * get computed width and height of element
20
- * @param {HTMLElement} el
21
- * @return {{width: string, height: string}}
21
+ * resizes frame based on width and height of main container
22
+ * @param {{width: number, height: number}} param - width and height of main container
22
23
  */
23
- getSizes: (el: any) => {
24
- width: string;
25
- height: string;
26
- };
27
- applyMaskCaptureSizes(mainContainer: Element, currentStepType: StepType): void;
28
- applyCaptureHintMask(mainContainer: Element): void;
29
- applyMainContainerSize(mainContainer: Element): void;
30
- changeHintState(currentStepType: StepType): void;
24
+ set mainContainerSizes({ width, height }: {
25
+ width: any;
26
+ height: any;
27
+ });
31
28
  get svgSizes(): {
32
29
  width: string;
33
30
  height: string;
@@ -37,36 +34,43 @@ declare class MaskCapture {
37
34
  height: number;
38
35
  };
39
36
  get strokeLength(): number;
40
- private calculateUserSizes;
41
- private set borderSizes(value);
42
- private calculateEnvironmentSizes;
43
- private calculateFieldMaskSizes;
44
- private applySizes;
45
37
  set sizes({ width, height }: {
46
38
  width: any;
47
39
  height: any;
48
40
  });
49
- private addAnimation;
50
- private removeAnimation;
51
41
  set fillPercentage(percentage: any);
52
42
  /**
53
43
  * sets the type of capturing mask and it position on screen
54
44
  * @param {VideoFacingModeEnum} type - 'environment', 'user'
55
45
  */
56
46
  set maskType(type: any);
47
+ private set borderSizes(value);
48
+ /**
49
+ * get computed width and height of element
50
+ * @param {HTMLElement} el
51
+ * @return {{width: string, height: string}}
52
+ */
53
+ getSizes: (el: any) => {
54
+ width: string;
55
+ height: string;
56
+ };
57
+ applyMaskCaptureSizes(mainContainer: Element, currentStepType: StepType, currentDocument: DocumentTypeIndex | 0): void;
58
+ applyCaptureHintMask(mainContainer: Element): void;
59
+ applyMainContainerSize(mainContainer: Element): void;
60
+ changeHintState(currentStepType: any, currentDocument: any): void;
61
+ hideAllHints(): void;
62
+ showHintForCurrentStep(currentStepType: any, currentDocument: any): void;
63
+ private calculateUserSizes;
64
+ private calculateEnvironmentSizes;
65
+ private calculateFieldMaskSizes;
66
+ private applySizes;
67
+ private addAnimation;
68
+ private removeAnimation;
57
69
  /**
58
70
  *
59
71
  * @param {Number} size1
60
72
  * @param {Number} size2
61
73
  */
62
74
  private calculateSize;
63
- /**
64
- * resizes frame based on width and height of main container
65
- * @param {{width: number, height: number}} param - width and height of main container
66
- */
67
- set mainContainerSizes({ width, height }: {
68
- width: any;
69
- height: any;
70
- });
71
75
  }
72
76
  export default MaskCapture;
@@ -1,20 +1,20 @@
1
- import { DefaultConfigName, IDocumentType } from '../../defaultConfig';
1
+ import { DefaultConfigName, DocumentType } from '../../defaultConfig';
2
2
  import { DocumentTypeName } from '../../environment/documentTypes';
3
3
  import { StepType } from '../../environment/stepsDescription';
4
4
  import { IDocumentTypeConfig, IValidator } from '../validator';
5
- declare class ValidateDocumentTypes implements IValidator<IDocumentType[]> {
5
+ declare class ValidateDocumentTypes implements IValidator<DocumentType[]> {
6
6
  types: any[];
7
7
  steps: any[];
8
8
  commonStepTypes: Set<StepType>;
9
9
  documentTypes: IDocumentTypeConfig;
10
- validate(val: IDocumentType[], fallback: IDocumentType[], configName: DefaultConfigName): {
10
+ validate(val: DocumentType[], fallback: DocumentType[], configName: DefaultConfigName): {
11
11
  types: any[];
12
12
  steps: any[];
13
13
  commonStepTypes: Set<StepType>;
14
14
  documentTypes: IDocumentTypeConfig;
15
15
  };
16
16
  validateTypes(types: string[]): DocumentTypeName[];
17
- transformDocType({ type, steps }: IDocumentType): void;
17
+ transformDocType({ type, steps }: DocumentType): void;
18
18
  setCommonStepTypes(): void;
19
19
  }
20
20
  export default ValidateDocumentTypes;
@@ -1,8 +1,8 @@
1
1
  import { DocumentTypeName } from '../environment/documentTypes';
2
- import { DefaultConfigName, IStepConfig } from '../defaultConfig';
2
+ import { DefaultConfigName, StepConfig } from '../defaultConfig';
3
3
  export type IDocumentTypeConfig = {
4
4
  type: DocumentTypeName;
5
- steps: IStepConfig[];
5
+ steps: StepConfig[];
6
6
  }[];
7
7
  type SimpleValidate<T> = (val: T, fallback: T, configName: DefaultConfigName) => any;
8
8
  type OneOfArray<T> = (valueToSet: T, defaultValue: T, configName: DefaultConfigName, availableValues: T[]) => any;
@@ -0,0 +1,8 @@
1
+ export declare enum EResultStatus {
2
+ Empty = 0,
3
+ Detected = 1,
4
+ Decoded = 2,
5
+ Error = 3,
6
+ InvalidLicenseKey = 4,
7
+ LicenseKeyHasExpired = 5
8
+ }
@@ -0,0 +1,43 @@
1
+ import { EResultStatus } from './enums/pdf';
2
+ export type PDFParameters = {
3
+ rows: number;
4
+ columns: number;
5
+ ecl: number;
6
+ };
7
+ export type PDFLocation = {
8
+ x1: number;
9
+ y1: number;
10
+ x2: number;
11
+ y2: number;
12
+ x3: number;
13
+ y3: number;
14
+ x4: number;
15
+ y4: number;
16
+ };
17
+ export type PDFStatus = {
18
+ value: EResultStatus;
19
+ };
20
+ export type PDFResult = {
21
+ error?: any;
22
+ data: string;
23
+ errorDesc: string;
24
+ location: PDFLocation;
25
+ parameters: PDFParameters;
26
+ status: PDFStatus;
27
+ trackString?: string;
28
+ };
29
+ export type PDFError = {
30
+ errorType: string;
31
+ error: boolean;
32
+ errorVal: any;
33
+ };
34
+ export type PDFPreProcessResult = {
35
+ direction: {
36
+ value: number;
37
+ };
38
+ error: string;
39
+ location: PDFLocation;
40
+ resultParams: PDFParameters;
41
+ status: PDFStatus;
42
+ trackString: string;
43
+ } | PDFError;
@@ -32,6 +32,7 @@ declare class Ui {
32
32
  pressToUpdateText: HTMLElement;
33
33
  pressToUpdateTextSuccess: HTMLElement;
34
34
  documentType: HTMLParagraphElement;
35
+ desktopNotification: HTMLDivElement;
35
36
  videoErrorText: HTMLElement;
36
37
  mainContainer: HTMLElement;
37
38
  Mask: MaskCapture;
@@ -83,6 +84,7 @@ declare class Ui {
83
84
  getFakeContourWidth(width: number): number;
84
85
  setFakeContourStyles(width: number): void;
85
86
  setMirroring(): void;
87
+ setDesktopNotificationVisibility(): void;
86
88
  }
87
89
  declare const ui: {
88
90
  ui: Ui | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idscan/idvc2",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "description": "component for the capturing documents",
5
5
  "main": "dist/idvc.js",
6
6
  "types": "dist/types/idvc.d.ts",