@ahmed_hani/dot-document-auto-capture 7.4.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.
Files changed (34) hide show
  1. package/LICENSE.txt +117 -0
  2. package/README.md +80 -0
  3. package/common/src/types/document.d.ts +43 -0
  4. package/document/src/events.d.ts +5 -0
  5. package/dot-assets/document/dot-D3RXoL6u.js +7432 -0
  6. package/dot-assets/document/wasm/sam.wasm +0 -0
  7. package/dot-assets/document/wasm/sam_simd.wasm +0 -0
  8. package/dot-assets/wasm/dot_embedded_bg.wasm +0 -0
  9. package/events.mjs +48 -0
  10. package/events.umd.js +1 -0
  11. package/index.mjs +18797 -0
  12. package/index.umd.js +89 -0
  13. package/package.json +75 -0
  14. package/ui-common/src/error/auto-capture-error.d.ts +7 -0
  15. package/ui-common/src/error/index.d.ts +1 -0
  16. package/ui-common/src/events/control.d.ts +9 -0
  17. package/ui-common/src/events/custom.d.ts +1 -0
  18. package/ui-common/src/types/common.d.ts +88 -0
  19. package/ui-common/src/types/document.d.ts +30 -0
  20. package/ui-common/src/types/events/common.d.ts +74 -0
  21. package/ui-common/src/types/events/document.d.ts +23 -0
  22. package/ui-common/src/types/events/eye-gaze.d.ts +4 -0
  23. package/ui-common/src/types/events/face.d.ts +21 -0
  24. package/ui-common/src/types/events/index.d.ts +8 -0
  25. package/ui-common/src/types/events/liveness.d.ts +13 -0
  26. package/ui-common/src/types/events/magnifeye.d.ts +5 -0
  27. package/ui-common/src/types/events/palm.d.ts +16 -0
  28. package/ui-common/src/types/events/smile.d.ts +8 -0
  29. package/ui-common/src/types/eye-gaze.d.ts +39 -0
  30. package/ui-common/src/types/face.d.ts +52 -0
  31. package/ui-common/src/types/index.d.ts +8 -0
  32. package/ui-common/src/types/magnifeye.d.ts +32 -0
  33. package/ui-common/src/types/palm.d.ts +44 -0
  34. package/ui-common/src/types/smile.d.ts +36 -0
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@ahmed_hani/dot-document-auto-capture",
3
+ "private": false,
4
+ "version": "7.4.0",
5
+ "license": "sofa proprietary license",
6
+ "description": "Digital onboarding document capture",
7
+ "keywords": [
8
+ "document",
9
+ "capture",
10
+ "document capture",
11
+ "auto",
12
+ "automatic",
13
+ "identity",
14
+ "verification",
15
+ "detection",
16
+ "camera",
17
+ "video",
18
+ "selfie",
19
+ "scan",
20
+ "scanning",
21
+ "sdk",
22
+ "api"
23
+ ],
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/Eng-AhmedHani/dot-js-kit.git"
27
+ },
28
+ "homepage": "https://github.com/Eng-AhmedHani/dot-js-kit.git",
29
+ "dependencies": {
30
+ "@preact/signals": "^2.0.4",
31
+ "comlink": "^4.4.2",
32
+ "preact": "^10.26.6",
33
+ "preact-custom-element": "^4.3.0",
34
+ "styled-components": "^6.1.18"
35
+ },
36
+ "typesVersions": {
37
+ "*": {
38
+ ".": [
39
+ "common/src/types/document.d.ts"
40
+ ],
41
+ "events": [
42
+ "document/src/events.d.ts"
43
+ ]
44
+ }
45
+ },
46
+ "types": "common/src/types/document.d.ts",
47
+ "exports": {
48
+ ".": {
49
+ "types": "./common/src/types/document.d.ts",
50
+ "import": "./index.mjs",
51
+ "require": "./index.umd.js"
52
+ },
53
+ "./events": {
54
+ "types": "./document/src/events.d.ts",
55
+ "import": "./events.mjs",
56
+ "require": "./events.umd.js"
57
+ }
58
+ },
59
+ "scripts": {
60
+ "dev": "vite",
61
+ "build:document": "LIB=document vite build",
62
+ "build:controller": "LIB=document vite build --config ../../config/vite-controller.config.ts",
63
+ "build:events": "LIB=events vite build",
64
+ "build": "tsc && pnpm build:document && pnpm build:events && pnpm build:types",
65
+ "build:watch": "pnpm build:document --watch",
66
+ "build:pack": "pnpm build && cd dist && pnpm pack --pack-destination ../",
67
+ "build:types": "tsc --project tsconfig.production.json && tsc-alias -p tsc-alias.json",
68
+ "preview": "vite preview",
69
+ "lint": "eslint \"src/**/*.{ts,tsx}\" --max-warnings 0",
70
+ "test": "vitest run --coverage",
71
+ "tsc": "tsc",
72
+ "bump:version": "npm pkg set version=$VERSION",
73
+ "update:changelog": "../../scripts/update-changelog.sh"
74
+ }
75
+ }
@@ -0,0 +1,7 @@
1
+ export declare class AutoCaptureError extends Error {
2
+ cause: Error | undefined;
3
+ constructor(message: string, cause?: Error);
4
+ static logError(error: unknown): void;
5
+ static fromCameraError(error: Error): AutoCaptureError;
6
+ static fromError(error: unknown): AutoCaptureError;
7
+ }
@@ -0,0 +1 @@
1
+ export * from './auto-capture-error';
@@ -0,0 +1,9 @@
1
+ import type { ControlEventInstructionValues, DocumentCustomEvent, EyeGazeCustomEvent, FaceCustomEvent, MagnifEyeCustomEvent, PalmCustomEvent, RequestCaptureInstructionValues, SmileCustomEvent } from '../types/events';
2
+ /**
3
+ * It dispatches a custom event with the given event name and event detail
4
+ * @param {DocumentCustomEvent.CONTROL | FaceCustomEvent.CONTROL | PalmCustomEvent.CONTROL | SmileCustomEvent.CONTROL | EyeGazeCustomEvent.CONTROL | MagnifEyeCustomEvent.CONTROL} eventName - The name of the event to
5
+ * dispatch.
6
+ * @param {ControlEventInstruction} instruction - ControlEventInstruction
7
+ */
8
+ export declare const dispatchControlEvent: (eventName: DocumentCustomEvent.CONTROL | FaceCustomEvent.CONTROL | PalmCustomEvent.CONTROL | SmileCustomEvent.CONTROL | EyeGazeCustomEvent.CONTROL | MagnifEyeCustomEvent.CONTROL, instruction: ControlEventInstructionValues) => void;
9
+ export declare function dispatchCaptureEvent(instruction: RequestCaptureInstructionValues): void;
@@ -0,0 +1 @@
1
+ export declare const dispatchCustomEvent: (eventName: string, detail: Record<string, unknown>) => void;
@@ -0,0 +1,88 @@
1
+ type CustomEvents<K extends string> = {
2
+ [key in K]: (event: CustomEvent) => void;
3
+ };
4
+ export type CustomElement<T, K extends string = ''> = Partial<T & HTMLElement & {
5
+ children: unknown;
6
+ } & CustomEvents<`on${K}`> & {
7
+ ref?: unknown;
8
+ }>;
9
+ export type DeepRequired<T> = Required<{
10
+ [P in keyof T]: T[P] extends Record<string, unknown> | undefined ? DeepRequired<Required<T[P]>> : T[P];
11
+ }>;
12
+ export type DeepPartial<T> = T extends object ? {
13
+ [P in keyof T]?: DeepPartial<T[P]>;
14
+ } : T;
15
+ export type RequireSome<T, K extends keyof T> = T & {
16
+ [P in K]-?: T[P];
17
+ };
18
+ export type ObjectValues<T> = T[keyof T];
19
+ export declare const FacingMode: {
20
+ readonly FRONT: "user";
21
+ readonly REAR: "environment";
22
+ };
23
+ export type FacingModeValues = ObjectValues<typeof FacingMode>;
24
+ export declare const CaptureMode: {
25
+ readonly AUTO_CAPTURE: "AUTO_CAPTURE";
26
+ readonly WAIT_FOR_REQUEST: "WAIT_FOR_REQUEST";
27
+ };
28
+ export type CaptureModeValues = ObjectValues<typeof CaptureMode>;
29
+ export type BaseCameraProps<CallbackData> = {
30
+ assetsDirectoryPath?: string;
31
+ cameraFacing?: FacingModeValues;
32
+ candidateSelectionDurationMillis?: number;
33
+ captureMode?: CaptureModeValues;
34
+ onError: (e: Error) => void;
35
+ onPhotoTaken: (imageData: CallbackImage<CallbackData>, content: Uint8Array) => void;
36
+ sessionToken?: string;
37
+ styleTarget?: HTMLElement;
38
+ };
39
+ export type ImageParameters = {
40
+ brightness: number;
41
+ sharpness: number;
42
+ };
43
+ export type CameraSettings = MediaTrackSettings & {
44
+ deviceName?: string;
45
+ };
46
+ export type Resolution = {
47
+ height: number;
48
+ width: number;
49
+ };
50
+ export type Point = {
51
+ x: number;
52
+ y: number;
53
+ };
54
+ export declare const AppStateValues: {
55
+ readonly LOADING: "LOADING";
56
+ readonly ERROR: "ERROR";
57
+ readonly WAITING: "WAITING";
58
+ readonly RUNNING: "RUNNING";
59
+ };
60
+ export declare const LivenessStateValues: {
61
+ readonly DONE: "DONE";
62
+ readonly LOADING: "LOADING";
63
+ readonly ERROR: "ERROR";
64
+ readonly WAITING: "WAITING";
65
+ readonly RUNNING: "RUNNING";
66
+ };
67
+ export type AppState = ObjectValues<typeof AppStateValues>;
68
+ export type Crop = {
69
+ height: number;
70
+ shiftX: number;
71
+ shiftY: number;
72
+ width: number;
73
+ };
74
+ export type CallbackImage<T> = {
75
+ data: T;
76
+ image: Blob;
77
+ };
78
+ export type DetectedCorners = {
79
+ bottomLeft: Point;
80
+ bottomRight: Point;
81
+ topLeft: Point;
82
+ topRight: Point;
83
+ };
84
+ export type ThresholdInterval = {
85
+ max: number;
86
+ min: number;
87
+ };
88
+ export {};
@@ -0,0 +1,30 @@
1
+ import type { DetectedCorners, ImageParameters, ObjectValues } from './common';
2
+ export declare const DocumentInstructionCodeValues: {
3
+ readonly CANDIDATE_SELECTION: "candidate_selection";
4
+ readonly DOCUMENT_CENTERING: "document_centering";
5
+ readonly DOCUMENT_NOT_PRESENT: "document_not_present";
6
+ readonly DOCUMENT_TOO_FAR: "document_too_far";
7
+ readonly SHARPNESS_TOO_LOW: "sharpness_too_low";
8
+ readonly BRIGHTNESS_TOO_LOW: "brightness_too_low";
9
+ readonly BRIGHTNESS_TOO_HIGH: "brightness_too_high";
10
+ readonly HOTSPOTS_PRESENT: "hotspots_present";
11
+ };
12
+ export declare const DocumentCheckToInstructionCodeMap: {
13
+ isPresent: "document_not_present";
14
+ isNotSmall: "document_too_far";
15
+ isNotOutOfBounds: "document_centering";
16
+ isSharp: "sharpness_too_low";
17
+ isNotDim: "brightness_too_low";
18
+ isNotBright: "brightness_too_high";
19
+ noHotspots: "hotspots_present";
20
+ };
21
+ export type DocumentInstructionCode = ObjectValues<typeof DocumentInstructionCodeValues>;
22
+ export type DetectedDocumentCorners = DetectedCorners;
23
+ export type DocumentImageParameters = ImageParameters & {
24
+ hotspots: number;
25
+ };
26
+ export type DetectedDocument = DocumentImageParameters & DetectedDocumentCorners & {
27
+ confidence: number;
28
+ smallestEdge: number;
29
+ };
30
+ export type DocumentEscalatedInstructionCodes = typeof DocumentInstructionCodeValues.DOCUMENT_TOO_FAR | typeof DocumentInstructionCodeValues.BRIGHTNESS_TOO_HIGH | typeof DocumentInstructionCodeValues.BRIGHTNESS_TOO_LOW | typeof DocumentInstructionCodeValues.SHARPNESS_TOO_LOW;
@@ -0,0 +1,74 @@
1
+ import type { DocumentCustomEvent } from './document';
2
+ import type { FaceCustomEvent } from './face';
3
+ import type { PalmCustomEvent } from './palm';
4
+ import type { AutoCaptureError } from '../../error/auto-capture-error';
5
+ import type { AppState, ObjectValues, Resolution } from '../common';
6
+ import type { DocumentInstructionCode } from '../document';
7
+ import type { FaceInstructionCode } from '../face';
8
+ import type { PalmInstructionCode } from '../palm';
9
+ export declare const ControlEventInstruction: {
10
+ readonly CONTINUE_DETECTION: "continue-detection";
11
+ readonly SWITCH_CAMERA: "switch-camera";
12
+ readonly TOGGLE_MIRROR: "toggle-mirror";
13
+ };
14
+ export type ControlEventInstructionValues = ObjectValues<typeof ControlEventInstruction>;
15
+ export declare const RequestCaptureInstruction: {
16
+ readonly FIRST_FRAME: "first-frame";
17
+ readonly FIRST_VALID_FRAME: "first-valid-frame";
18
+ };
19
+ export type RequestCaptureInstructionValues = ObjectValues<typeof RequestCaptureInstruction>;
20
+ export declare const ComponentCustomEvent: {
21
+ readonly REQUEST_CAPTURE: "dot-custom-event:request-capture";
22
+ };
23
+ export type ComponentCustomEventValues = ObjectValues<typeof ComponentCustomEvent>;
24
+ export type ControlEvent<T> = {
25
+ detail?: {
26
+ instruction: T;
27
+ };
28
+ } & Event;
29
+ export type CameraPropsChangeEvent = {
30
+ detail?: {
31
+ cameraResolution: Resolution;
32
+ isMirroring: boolean;
33
+ };
34
+ } & Event;
35
+ export type CameraStateChangeEvent = {
36
+ detail?: {
37
+ appState: AppState;
38
+ error?: AutoCaptureError;
39
+ };
40
+ } & Event;
41
+ export type InstructionChangeEvent<T> = {
42
+ detail?: {
43
+ instructionCode: T;
44
+ isEscalated: boolean;
45
+ };
46
+ } & Event;
47
+ export type InstructionEscalatedEvent<T> = {
48
+ detail?: {
49
+ instructionCode: T;
50
+ };
51
+ } & Event;
52
+ export type InstructionChangeEventCodeMap = {
53
+ [DocumentCustomEvent.INSTRUCTION_CHANGED]: DocumentInstructionCode;
54
+ [FaceCustomEvent.INSTRUCTION_CHANGED]: FaceInstructionCode;
55
+ [PalmCustomEvent.INSTRUCTION_CHANGED]: PalmInstructionCode;
56
+ };
57
+ export type CaptureCustomEvent = typeof PalmCustomEvent | typeof DocumentCustomEvent | typeof FaceCustomEvent;
58
+ export type VideoElementSizeChangeEvent = {
59
+ detail?: {
60
+ size: DOMRect;
61
+ };
62
+ } & Event;
63
+ export type DetectionEvent<TDetectedObject, TInstructionCode extends string = string> = {
64
+ detail?: {
65
+ data: {
66
+ detection: TDetectedObject;
67
+ fps: number;
68
+ imageResolution: Resolution;
69
+ invalidValidators: Array<TInstructionCode>;
70
+ isInCandidateSelection: boolean;
71
+ };
72
+ image: HTMLCanvasElement;
73
+ };
74
+ } & Event;
@@ -0,0 +1,23 @@
1
+ import type { InstructionChangeEvent, InstructionEscalatedEvent } from './common';
2
+ import type { DetectedDocument, DocumentInstructionCode } from '../document';
3
+ export declare enum DocumentCustomEvent {
4
+ CAMERA_PROPS_CHANGED = "document-auto-capture:camera-props-changed",
5
+ CONTROL = "document-auto-capture:control",
6
+ DETECTED_DOCUMENT_CHANGED = "document-auto-capture:detected-document-changed",
7
+ DOCUMENT_DETECTION = "document-auto-capture:document-detection",
8
+ INSTRUCTION_CHANGED = "document-auto-capture:instruction-changed",
9
+ INSTRUCTION_ESCALATED = "document-auto-capture:instruction-escalated",
10
+ STATE_CHANGED = "document-auto-capture:state-changed",
11
+ VIDEO_ELEMENT_SIZE = "document-auto-capture:video-element-size"
12
+ }
13
+ export type DetectedDocumentChangeEvent = {
14
+ detail?: {
15
+ detectedObject: DetectedDocument;
16
+ };
17
+ } & Event;
18
+ export type DocumentInstructionChangeEvent = InstructionChangeEvent<DocumentInstructionCode>;
19
+ export type DispatchDocumentDetectionEvent = {
20
+ detection: DetectedDocument;
21
+ eventName: DocumentCustomEvent.DOCUMENT_DETECTION;
22
+ };
23
+ export type DocumentInstructionEscalatedEvent = InstructionEscalatedEvent<DocumentInstructionCode>;
@@ -0,0 +1,4 @@
1
+ export declare enum EyeGazeCustomEvent {
2
+ CONTROL = "eye-gaze-auto-capture:control",
3
+ STATUS_CHANGED = "eye-gaze-auto-capture:status-changed"
4
+ }
@@ -0,0 +1,21 @@
1
+ import type { InstructionChangeEvent } from './common';
2
+ import type { DetectedFace, FaceInstructionCode } from '../face';
3
+ export declare enum FaceCustomEvent {
4
+ CAMERA_PROPS_CHANGED = "face-auto-capture:camera-props-changed",
5
+ CONTROL = "face-auto-capture:control",
6
+ DETECTED_FACE_CHANGED = "face-auto-capture:detected-face-changed",
7
+ FACE_DETECTION = "face-auto-capture:face-detection",
8
+ INSTRUCTION_CHANGED = "face-auto-capture:instruction-changed",
9
+ STATE_CHANGED = "face-auto-capture:state-changed",
10
+ VIDEO_ELEMENT_SIZE = "face-auto-capture:video-element-size"
11
+ }
12
+ export type DetectedFaceChangeEvent = {
13
+ detail?: {
14
+ detectedObject: DetectedFace;
15
+ };
16
+ } & Event;
17
+ export type FaceInstructionChangeEvent = InstructionChangeEvent<FaceInstructionCode>;
18
+ export type DispatchFaceDetectionEvent = {
19
+ detection: DetectedFace;
20
+ eventName: FaceCustomEvent.FACE_DETECTION;
21
+ };
@@ -0,0 +1,8 @@
1
+ export * from './common';
2
+ export * from './document';
3
+ export * from './face';
4
+ export * from './magnifeye';
5
+ export * from './liveness';
6
+ export * from './smile';
7
+ export * from './palm';
8
+ export * from './eye-gaze';
@@ -0,0 +1,13 @@
1
+ import type { AutoCaptureError } from '../../error';
2
+ export type AnimationEndEvent = {
3
+ detail?: {
4
+ animationEnd: boolean;
5
+ };
6
+ } & Event;
7
+ export type StatusChangeEvent<Phase, State> = {
8
+ detail?: {
9
+ error?: AutoCaptureError;
10
+ phase?: Phase;
11
+ state?: State;
12
+ };
13
+ } & Event;
@@ -0,0 +1,5 @@
1
+ export declare enum MagnifEyeCustomEvent {
2
+ ANIMATION_END = "magnifeye-auto-capture:animation-end",
3
+ CONTROL = "magnifeye-auto-capture:control",
4
+ STATUS_CHANGED = "magnifeye-auto-capture:status-changed"
5
+ }
@@ -0,0 +1,16 @@
1
+ import type { InstructionChangeEvent } from './common';
2
+ import type { DetectedPalm, PalmInstructionCode } from '../palm';
3
+ export declare enum PalmCustomEvent {
4
+ CAMERA_PROPS_CHANGED = "palm-capture:camera-props-changed",
5
+ CONTROL = "palm-capture:control",
6
+ DETECTED_PALM_CHANGED = "palm-capture:detected-palm-changed",
7
+ INSTRUCTION_CHANGED = "palm-capture:instruction-changed",
8
+ STATE_CHANGED = "palm-capture:state-changed",
9
+ VIDEO_ELEMENT_SIZE = "palm-capture:video-element-size"
10
+ }
11
+ export type DetectedPalmChangeEvent = {
12
+ detail?: {
13
+ detectedObject: DetectedPalm;
14
+ };
15
+ } & Event;
16
+ export type PalmInstructionChangeEvent = InstructionChangeEvent<PalmInstructionCode>;
@@ -0,0 +1,8 @@
1
+ import type { InstructionEscalatedEvent } from './common';
2
+ import type { SmileInstructionCode } from '../smile';
3
+ export declare enum SmileCustomEvent {
4
+ CONTROL = "smile-auto-capture:control",
5
+ INSTRUCTION_ESCALATED = "smile:instruction-escalated",
6
+ STATUS_CHANGED = "smile-auto-capture:status-changed"
7
+ }
8
+ export type SmileInstructionEscalatedEvent = InstructionEscalatedEvent<SmileInstructionCode>;
@@ -0,0 +1,39 @@
1
+ import type { ObjectValues } from './common';
2
+ export declare const EyeGazeInstructionCodeValues: {
3
+ readonly WATCH_THE_OBJECT: "watch_the_object";
4
+ readonly CANDIDATE_SELECTION: "candidate_selection";
5
+ readonly FACE_TOO_CLOSE: "face_too_close";
6
+ readonly FACE_TOO_FAR: "face_too_far";
7
+ readonly FACE_CENTERING: "face_centering";
8
+ readonly FACE_NOT_PRESENT: "face_not_present";
9
+ readonly SHARPNESS_TOO_LOW: "sharpness_too_low";
10
+ readonly BRIGHTNESS_TOO_LOW: "brightness_too_low";
11
+ readonly BRIGHTNESS_TOO_HIGH: "brightness_too_high";
12
+ readonly DEVICE_PITCHED: "device_pitched";
13
+ readonly LEFT_EYE_NOT_PRESENT: "left_eye_not_present";
14
+ readonly RIGHT_EYE_NOT_PRESENT: "right_eye_not_present";
15
+ readonly MOUTH_NOT_PRESENT: "mouth_not_present";
16
+ readonly MOUTH_SCORE_TOO_HIGH: "mouth_score_too_high";
17
+ readonly MOUTH_SCORE_TOO_LOW: "mouth_score_too_low";
18
+ };
19
+ export type EyeGazeInstructionCode = ObjectValues<typeof EyeGazeInstructionCodeValues>;
20
+ export declare const EyeGazePhaseValues: {
21
+ readonly VALIDATION: "VALIDATION";
22
+ readonly COLLECTION: "COLLECTION";
23
+ };
24
+ export type EyeGazePhase = ObjectValues<typeof EyeGazePhaseValues>;
25
+ export declare const EyeGazeStateValues: {
26
+ readonly DONE: "DONE";
27
+ readonly LOADING: "LOADING";
28
+ readonly ERROR: "ERROR";
29
+ readonly WAITING: "WAITING";
30
+ readonly RUNNING: "RUNNING";
31
+ };
32
+ export type EyeGazeState = ObjectValues<typeof EyeGazeStateValues>;
33
+ export declare const Corner: {
34
+ readonly TOP_LEFT: "TOP_LEFT";
35
+ readonly TOP_RIGHT: "TOP_RIGHT";
36
+ readonly BOTTOM_RIGHT: "BOTTOM_RIGHT";
37
+ readonly BOTTOM_LEFT: "BOTTOM_LEFT";
38
+ };
39
+ export type CornerValues = ObjectValues<typeof Corner>;
@@ -0,0 +1,52 @@
1
+ import type { ImageParameters, ObjectValues, Point } from './common';
2
+ export declare const FaceInstructionCodeValues: {
3
+ readonly CANDIDATE_SELECTION: "candidate_selection";
4
+ readonly FACE_TOO_CLOSE: "face_too_close";
5
+ readonly FACE_TOO_FAR: "face_too_far";
6
+ readonly FACE_CENTERING: "face_centering";
7
+ readonly FACE_NOT_PRESENT: "face_not_present";
8
+ readonly SHARPNESS_TOO_LOW: "sharpness_too_low";
9
+ readonly BRIGHTNESS_TOO_LOW: "brightness_too_low";
10
+ readonly BRIGHTNESS_TOO_HIGH: "brightness_too_high";
11
+ readonly DEVICE_PITCHED: "device_pitched";
12
+ readonly LEFT_EYE_NOT_PRESENT: "left_eye_not_present";
13
+ readonly RIGHT_EYE_NOT_PRESENT: "right_eye_not_present";
14
+ readonly MOUTH_NOT_PRESENT: "mouth_not_present";
15
+ readonly MOUTH_SCORE_TOO_HIGH: "mouth_score_too_high";
16
+ readonly MOUTH_SCORE_TOO_LOW: "mouth_score_too_low";
17
+ };
18
+ export declare const FaceCheckToInstructionCodeMap: {
19
+ isPresent: "face_not_present";
20
+ isNotPitched: "device_pitched";
21
+ isNotSmall: "face_too_far";
22
+ isNotLarge: "face_too_close";
23
+ isNotOutOfBounds: "face_centering";
24
+ isNotDim: "brightness_too_low";
25
+ isNotBright: "brightness_too_high";
26
+ isSharp: "sharpness_too_low";
27
+ isLeftEyePresent: "left_eye_not_present";
28
+ isRightEyePresent: "right_eye_not_present";
29
+ isMouthPresent: "mouth_not_present";
30
+ isMouthScoreNotTooHigh: "mouth_score_too_high";
31
+ isMouthScoreNotTooLow: "mouth_score_too_low";
32
+ };
33
+ export type FaceInstructionCode = ObjectValues<typeof FaceInstructionCodeValues>;
34
+ export type DetectedFacePart = {
35
+ center: Point;
36
+ confidence: number;
37
+ size: number;
38
+ status: number;
39
+ };
40
+ export type DetectedFace = FaceImageParameters & DetectedFaceCorners & {
41
+ confidence: number;
42
+ faceSize: number;
43
+ leftEye: DetectedFacePart;
44
+ mouth: DetectedFacePart;
45
+ rightEye: DetectedFacePart;
46
+ };
47
+ export type DetectedFaceCorners = {
48
+ bottomRight: Point;
49
+ faceCenter: Point;
50
+ topLeft: Point;
51
+ };
52
+ export type FaceImageParameters = ImageParameters;
@@ -0,0 +1,8 @@
1
+ export * from './events';
2
+ export * from './document';
3
+ export * from './face';
4
+ export * from './common';
5
+ export * from './magnifeye';
6
+ export * from './smile';
7
+ export * from './palm';
8
+ export * from './eye-gaze';
@@ -0,0 +1,32 @@
1
+ import type { ObjectValues } from './common';
2
+ export declare const MagnifEyeInstructionCodeValues: {
3
+ readonly FIT_YOUR_EYE: "fit_your_eye";
4
+ readonly CANDIDATE_SELECTION: "candidate_selection";
5
+ readonly FACE_TOO_CLOSE: "face_too_close";
6
+ readonly FACE_TOO_FAR: "face_too_far";
7
+ readonly FACE_CENTERING: "face_centering";
8
+ readonly FACE_NOT_PRESENT: "face_not_present";
9
+ readonly SHARPNESS_TOO_LOW: "sharpness_too_low";
10
+ readonly BRIGHTNESS_TOO_LOW: "brightness_too_low";
11
+ readonly BRIGHTNESS_TOO_HIGH: "brightness_too_high";
12
+ readonly DEVICE_PITCHED: "device_pitched";
13
+ readonly LEFT_EYE_NOT_PRESENT: "left_eye_not_present";
14
+ readonly RIGHT_EYE_NOT_PRESENT: "right_eye_not_present";
15
+ readonly MOUTH_NOT_PRESENT: "mouth_not_present";
16
+ readonly MOUTH_SCORE_TOO_HIGH: "mouth_score_too_high";
17
+ readonly MOUTH_SCORE_TOO_LOW: "mouth_score_too_low";
18
+ };
19
+ export type MagnifEyeInstructionCode = ObjectValues<typeof MagnifEyeInstructionCodeValues>;
20
+ export declare enum MagnifEyePhase {
21
+ CLOSEUP = "CLOSEUP",
22
+ DISTANT = "DISTANT",
23
+ MIDDLE = "MIDDLE"
24
+ }
25
+ export declare const MagnifEyeStateValues: {
26
+ readonly DONE: "DONE";
27
+ readonly LOADING: "LOADING";
28
+ readonly ERROR: "ERROR";
29
+ readonly WAITING: "WAITING";
30
+ readonly RUNNING: "RUNNING";
31
+ };
32
+ export type MagnifEyeState = ObjectValues<typeof MagnifEyeStateValues>;
@@ -0,0 +1,44 @@
1
+ import type { DetectedCorners, ImageParameters, ObjectValues } from './common';
2
+ export declare const PalmInstructionCodeValues: {
3
+ readonly CANDIDATE_SELECTION: "candidate_selection";
4
+ readonly PALM_CENTERING: "palm_centering";
5
+ readonly PALM_NOT_PRESENT: "palm_not_present";
6
+ readonly PALM_TOO_FAR: "palm_too_far";
7
+ readonly PALM_TOO_CLOSE: "palm_too_close";
8
+ readonly SHARPNESS_TOO_LOW: "sharpness_too_low";
9
+ readonly BRIGHTNESS_TOO_LOW: "brightness_too_low";
10
+ readonly BRIGHTNESS_TOO_HIGH: "brightness_too_high";
11
+ readonly DEVICE_PITCHED: "device_pitched";
12
+ readonly TEMPLATE_EXTRACTION_QUALITY_TOO_LOW: "template_extraction_quality_too_low";
13
+ };
14
+ export declare const PalmHandPosition: {
15
+ readonly LEFT: "Left";
16
+ readonly RIGHT: "Right";
17
+ };
18
+ export declare const PalmHandOrientation: {
19
+ readonly PALMAR: "Palmar";
20
+ readonly DORSAL: "Dorsal";
21
+ };
22
+ export declare const PalmCheckToInstructionCodeMap: {
23
+ isPresent: "palm_not_present";
24
+ isNotPitched: "device_pitched";
25
+ isNotSmall: "palm_too_far";
26
+ isNotOutOfBounds: "palm_centering";
27
+ isNotDim: "brightness_too_low";
28
+ isNotBright: "brightness_too_high";
29
+ isSharp: "sharpness_too_low";
30
+ isNotLarge: "palm_too_close";
31
+ isTemplateExtractionQualityHighEnough: "template_extraction_quality_too_low";
32
+ };
33
+ export type PalmInstructionCode = ObjectValues<typeof PalmInstructionCodeValues>;
34
+ export type DetectedPalmCorners = DetectedCorners;
35
+ export type PalmImageParameters = ImageParameters;
36
+ export type PalmQualityAttributes = {
37
+ handOrientation: ObjectValues<typeof PalmHandOrientation>;
38
+ handPosition: ObjectValues<typeof PalmHandPosition>;
39
+ quality: number;
40
+ };
41
+ export type DetectedPalm = PalmQualityAttributes & PalmImageParameters & DetectedPalmCorners & {
42
+ confidence: number;
43
+ smallestEdge: number;
44
+ };
@@ -0,0 +1,36 @@
1
+ import type { ObjectValues } from './common';
2
+ export declare const SmileInstructionCodeValues: {
3
+ readonly SMILE: "smile";
4
+ readonly SMILE_CANDIDATE_SELECTION: "smile_candidate_selection";
5
+ readonly KEEP_NEUTRAL_EXPRESSION: "keep_neutral_expression";
6
+ readonly CANDIDATE_SELECTION: "candidate_selection";
7
+ readonly FACE_TOO_CLOSE: "face_too_close";
8
+ readonly FACE_TOO_FAR: "face_too_far";
9
+ readonly FACE_CENTERING: "face_centering";
10
+ readonly FACE_NOT_PRESENT: "face_not_present";
11
+ readonly SHARPNESS_TOO_LOW: "sharpness_too_low";
12
+ readonly BRIGHTNESS_TOO_LOW: "brightness_too_low";
13
+ readonly BRIGHTNESS_TOO_HIGH: "brightness_too_high";
14
+ readonly DEVICE_PITCHED: "device_pitched";
15
+ readonly LEFT_EYE_NOT_PRESENT: "left_eye_not_present";
16
+ readonly RIGHT_EYE_NOT_PRESENT: "right_eye_not_present";
17
+ readonly MOUTH_NOT_PRESENT: "mouth_not_present";
18
+ readonly MOUTH_SCORE_TOO_HIGH: "mouth_score_too_high";
19
+ readonly MOUTH_SCORE_TOO_LOW: "mouth_score_too_low";
20
+ };
21
+ export type SmileInstructionCode = ObjectValues<typeof SmileInstructionCodeValues>;
22
+ export type CustomizableSmileInstructionCode = Exclude<SmileInstructionCode, 'mouth_score_too_low' | 'mouth_score_too_high'>;
23
+ export declare const SmilePhaseValues: {
24
+ readonly NEUTRAL: "NEUTRAL";
25
+ readonly SMILE: "SMILE";
26
+ };
27
+ export type SmilePhase = ObjectValues<typeof SmilePhaseValues>;
28
+ export declare const SmileStateValues: {
29
+ readonly DONE: "DONE";
30
+ readonly LOADING: "LOADING";
31
+ readonly ERROR: "ERROR";
32
+ readonly WAITING: "WAITING";
33
+ readonly RUNNING: "RUNNING";
34
+ };
35
+ export type SmileState = ObjectValues<typeof SmileStateValues>;
36
+ export type SmileEscalatedInstructionCodes = typeof SmileInstructionCodeValues.SMILE | typeof SmileInstructionCodeValues.KEEP_NEUTRAL_EXPRESSION;