@idscan/idvc2
Version:
component for the capturing documents
160 lines (158 loc) • 7.88 kB
TypeScript
import { StepConfig, ValidationFn } from '../defaultConfig';
import { RealFaceMode } from '../environment/realFaceModes';
import { AllLabels, SupportedLanguage } from '../environment/langs';
import { StepType } from '../environment/stepsDescription';
import { DocumentTypeName } from '../environment/documentTypes';
import { DeepPartial } from '../types/helpers/DeepPartial';
import { IDocumentTypeConfig } from './validator';
import { IStepCallback } from './Step';
import { IDataForDocumentTypeSelect, IDataForSubmit } from '../util';
import ValidateDocumentTypes from './validation/ValidateDocumentTypes';
/**
* @param {string} el,
* @param {string} licenseKey,
* @param {RealFaceMode} realFaceMode,
* @param {IDocumentTypeConfig | null} documentTypes,
* @param {boolean} autoContinue?,
* @param {number} resizeUploadedImage?,
* @param {boolean} fixFrontOrientAfterUpload?,
* @param {boolean} useCDN?,
* @param {string} networkUrl?,
*/
export interface IConfig {
/** this is the id of the html tag on the page where the web library will be displayed. Default: videoCapturingEl */
el: string;
/** license key for the web library provided for you by Idscan.net */
licenseKey: string;
/**
* an option that enables advanced image capturing with volumetric face detection. Available values: 'auto', 'all', 'none'
* - Auto - enable "realFaceMode" only for iPhone
* - All - enable "realFaceMode" for all devices
* - None - disable this option
*/
realFaceMode: RealFaceMode;
/**
* the array contains an object per document type that is configured. Each object has the document type listed in the type field and then in its steps array you can configure what steps you want the user to complete and what capture modes you will allow (i.e. uploader and/or video)
*
* Available Document Types
*
* - ID (1) – USA driver license and USA ID (non-driver license), Canadian driver licenses
* - Passport (2) – with 2 lines MRZ
* - PassportCard (3) – with 3 lines MRZ (most European IDs, USA passports/cards)
* - GreenCard (6) – USA Permanent Resident Cards (only MRZ)
* - InternationalId (7) – Internationally approved U.S. IDs with 3 lines MRZ
* - EmploymentAuthorization (9) - Employment Authorization
* - Barcode (11) – 1-D and 2-D barcodes
*
* Available Step Types
*
* - front – capturing the front side of a document
* - mrz – detection and capturing of the MRZ of a document
* - pdf – detection and capturing of pdf417 of a document
* - face – detection and capturing of the end user's face using the front camera
* - barcode – detection and capturing of 1 dimensional (barcodes) or 2 dimensional (qr codes)
* - back - capturing the back side of a document
*
* Available Capture Mode
*
* - uploader - uploading an image from the file system
* - video - capturing an image using the auto capture feature
*/
documentTypes: IDocumentTypeConfig | null;
/** the setting that enables the automatic transition from one step to the next step. Default is false */
autoContinue?: boolean;
/** the setting the delay (in ms) when automatically switching steps. Default is 1000ms */
autocaptureDelay?: number;
/** sets the maximum size in pixels (of the largest of the height or width) for a manually uploaded picture */
resizeUploadedImage?: number;
/** this setting will change the orientation of a front step's image if it is not horizontal when it is uploaded */
fixFrontOrientAfterUpload?: boolean;
/** set to true if you prefer to load neural networks from a content delivery network instead of from your web server */
useCDN?: boolean;
/** Path to the folder with neural networks. Specify the path on the server if you need to remove the folder to another location */
networkUrl?: string;
/** the web library supports two languages, english and spanish. English uses en and Spanish uses es */
language?: SupportedLanguage;
/**
* Custom translations for UI strings (e.g., titles, buttons). Overrides the default library translations if provided.
*/
customTranslations?: DeepPartial<AllLabels>;
/**
* if this setting is set to false the document type dialog will not be displayed to the end user
*/
isShowDocumentTypeSelect?: boolean;
/**
* option to show the button 'submit' after capturing all the images. If the button is turned off, an event will automatically fire that triggers the submit event handler
*/
showSubmitBtn?: boolean;
/**
* This option switches image format, that used for image processing. Available values: 'jpeg', 'png', 'webp'
*/
processingImageFormat?: string;
/**
* This option allows the user to perform a 'submit' even if there are warnings
*/
allowSubmitWithWarnings?: boolean;
/**
* The option specifies the strictness of the type recognition decision filter. The value must be a floating point number between 0 and 1. Where 1 is the strictest filter, 0 is the least strict.
*/
autocaptureConfidence?: number;
/**
* This option allows you not to display the step selection screen when selecting a document.
*/
autoStart?: boolean;
/**
* This option allows you to turn off step preview animations.
*/
playPreviewAnimations?: boolean;
/** function which will be called after each step completes */
onChange?: (data: {
step: IStepCallback;
}) => void;
/**
* function which will be called after the retake button is clicked
* @param data - Step object of current step
*/
onRetakeHook?: (data: {
step: IStepCallback;
}) => void;
/** the function that will be called on the component mounted. */
onMounted?: () => void;
/**
* function which will be called after reset all the steps button is clicked
* @param data - Step objects of current pipeline
*/
onReset?: (data: IDataForSubmit) => void;
/** function which will be called in case the camera is not available */
onCameraError?: (data: Error) => void;
/** function which will be called after clicking the submit button
*
* This option switches on/off the HEIC image processing (HEIC is Apple’s proprietary version of the Image File format). It’s possible to upload an image of this type only using a Mac/MacBook
*/
submit?: (data: IDataForSubmit) => void;
/**
* Function that will be called when a document type is selected.
*/
onDocumentTypeSelect?: (data: IDataForDocumentTypeSelect) => void;
}
declare class Config implements IConfig {
el: string;
commonStepTypes: Set<StepType>;
types: DocumentTypeName[];
steps: StepConfig[];
documentTypes: IDocumentTypeConfig | null;
licenseKey: string;
autoContinue: boolean;
autocaptureDelay: number;
resizeUploadedImage: number;
fixFrontOrientAfterUpload: boolean;
useCDN: boolean;
networkUrl: string;
realFaceMode: "all" | "auto" | "none";
language: any;
constructor(configObject: IConfig);
getFunction(validationFn: ValidationFn): false | import("./validation/ValidateElement").default | import("./validation/ValidateBool").default | import("./validation/ValidateStringInArray").default | ValidateDocumentTypes | import("./validation/ValidateFunction").default | import("./validation/ValidateNumber").default | import("./validation/ValidateString").default | import("./validation/ValidateAllowCameraSelection").default | import("./validation/ValidateDictionaryLangMatch").default<Record<string, unknown>>;
validate(configObject: IConfig): void;
normalize(configObject: IConfig): void;
}
export default Config;