@idscan/idvc2
Version:
component for the capturing documents
67 lines (66 loc) • 3.02 kB
TypeScript
import { RealFaceMode } from './environment/realFaceModes';
import { DocumentTypeName } from './environment/documentTypes';
import { StepType } from './environment/stepsDescription';
import { AllLabels, supportedLanguages } from './environment/langs';
import { ModalPositionKeys } from './environment/modalPosition';
import { DeepPartial } from './types/helpers/DeepPartial';
export type ValidationFn = 'validateElement' | 'validateString' | 'validateDocumentTypes' | 'validateDistinctStringInArray' | 'validateNumber' | 'validateFunction' | 'ValidateDictionaryLangMatch' | 'validateBool';
type DefaultValueFunction = () => boolean;
export type NormalizedType = 'Path';
/**
* { boolean? } uploader
* { boolean? } video
*/
export type StepMode = {
uploader?: boolean;
video?: boolean;
};
export type IStepModeKeys = keyof StepMode;
export type StepConfig = {
type: StepType;
name: string;
mode: StepMode;
autocaptureDelay?: number;
enableDesktopNotification?: boolean;
enableFourCornerCapture?: boolean;
shouldRecordVideo?: boolean;
};
export type DocumentType = {
type: DocumentTypeName;
steps: StepConfig[];
mode?: StepMode;
tooltipText?: string;
};
type ImageURI = 'png' | 'jpeg' | 'webp';
export type DefaultConfigName = 'el' | 'licenseKey' | 'networkUrl' | 'language' | 'customTranslations' | 'documentTypes' | 'realFaceMode' | 'modalPosition' | 'resizeUploadedImage' | 'showSubmitBtn' | 'isShowDocumentTypeSelect' | 'useCDN' | 'processingImageFormat' | 'allowSubmitWithWarnings' | 'autocaptureConfidence' | 'autoContinue' | 'autoStart' | 'playPreviewAnimations' | 'autocaptureDelay' | 'fixFrontOrientAfterUpload' | 'onChange' | 'onReset' | 'submit' | 'onRetakeHook' | 'onCameraError' | 'onMounted' | 'onDocumentTypeSelect' | 'onReloaded';
/**
* IDefaultConfig
* @param {string} name,
* @param {'String' | 'Array' | 'Number' | 'Boolean' | 'Function' | 'Object'} type,
* @param {string} description,
* @param {string | boolean | DefaultValueFunction | number | DocumentType[]} defaultValue,
* @param {ValidationFn} validationFn,
* @parma {boolean} hidden?,
* @param {RealFaceMode[]} values?,
* @param {any[]} arrayValues,
* @param {boolean} multiple?,
*/
export interface IDefaultConfig {
name: DefaultConfigName;
type: 'String' | 'Array' | 'Number' | 'Boolean' | 'Function' | 'Object';
description: string;
defaultValue: StepMode | string | boolean | DefaultValueFunction | number | DocumentType[];
validationFn: ValidationFn;
hidden?: boolean;
values?: ModalPositionKeys[] | RealFaceMode[] | typeof supportedLanguages[number][] | ImageURI[] | DeepPartial<AllLabels>;
arrayValues?: unknown[];
multiple?: boolean;
normalizedType?: NormalizedType;
}
/**
* @param {String} name - config param name
* @param {any} defaultValue - value to fallback
* @param {String} validationFn - name of validation function from Config module
*/
declare const defaultConfig: IDefaultConfig[];
export default defaultConfig;