@innovatrics/dot-document-auto-capture
Version:
Digital onboarding document capture
75 lines (74 loc) • 2.63 kB
TypeScript
import type { DocumentCustomEvent } from './document';
import type { FaceCustomEvent } from './face';
import type { PalmCustomEvent } from './palm';
import type { AutoCaptureError } from '../../error/auto-capture-error';
import type { AppState, ObjectValues, Resolution } from '../common';
import type { DocumentInstructionCode } from '../document';
import type { FaceInstructionCode } from '../face';
import type { PalmInstructionCode } from '../palm';
export declare const ControlEventInstruction: {
readonly CONTINUE_DETECTION: "continue-detection";
readonly SWITCH_CAMERA: "switch-camera";
readonly TOGGLE_MIRROR: "toggle-mirror";
};
export type ControlEventInstructionValues = ObjectValues<typeof ControlEventInstruction>;
export declare const RequestCaptureInstruction: {
readonly FIRST_FRAME: "first-frame";
readonly FIRST_VALID_FRAME: "first-valid-frame";
};
export type RequestCaptureInstructionValues = ObjectValues<typeof RequestCaptureInstruction>;
export declare const ComponentCustomEvent: {
readonly REQUEST_CAPTURE: "dot-custom-event:request-capture";
};
export type ComponentCustomEventValues = ObjectValues<typeof ComponentCustomEvent>;
export type ControlEvent<T> = {
detail?: {
instruction: T;
};
} & Event;
export type CameraPropsChangeEvent = {
detail?: {
cameraResolution: Resolution;
isMirroring: boolean;
};
} & Event;
export type CameraStateChangeEvent = {
detail?: {
appState: AppState;
error?: AutoCaptureError;
};
} & Event;
export type InstructionChangeEvent<T> = {
detail?: {
instructionCode: T;
isEscalated: boolean;
};
} & Event;
export type InstructionEscalatedEvent<T> = {
detail?: {
instructionCode: T;
};
} & Event;
export type InstructionChangeEventCodeMap = {
[DocumentCustomEvent.INSTRUCTION_CHANGED]: DocumentInstructionCode;
[FaceCustomEvent.INSTRUCTION_CHANGED]: FaceInstructionCode;
[PalmCustomEvent.INSTRUCTION_CHANGED]: PalmInstructionCode;
};
export type CaptureCustomEvent = typeof PalmCustomEvent | typeof DocumentCustomEvent | typeof FaceCustomEvent;
export type VideoElementSizeChangeEvent = {
detail?: {
size: DOMRect;
};
} & Event;
export type DetectionEvent<TDetectedObject, TInstructionCode extends string = string> = {
detail?: {
data: {
detection: TDetectedObject;
fps: number;
imageResolution: Resolution;
invalidValidators: Array<TInstructionCode>;
isInCandidateSelection: boolean;
};
image: HTMLCanvasElement;
};
} & Event;