@baas-id/react 0.2.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.
- package/LICENSE.md +176 -0
- package/README.md +171 -0
- package/THIRD_PARTY_NOTICES.md +44 -0
- package/dist/esm/baas-id-react.css +1 -0
- package/dist/esm/chunks/ContinueFlow-YFSpSOio.js +7500 -0
- package/dist/esm/continue.js +10 -0
- package/dist/esm/index.js +218 -0
- package/dist/esm/preview.js +368 -0
- package/dist/esm/workers/detector.worker-DtuL8TFY.js +22435 -0
- package/dist/types/continue.d.ts +3 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/types/preview.d.ts +5 -0
- package/dist/types/react/DocumentCapture.d.ts +27 -0
- package/dist/types/react/FaceCapture.d.ts +19 -0
- package/dist/types/react/capture/ProximityMeter.d.ts +9 -0
- package/dist/types/react/capture/TurnGauge.d.ts +12 -0
- package/dist/types/react/capture/YawDial.d.ts +6 -0
- package/dist/types/react/capture/api.d.ts +50 -0
- package/dist/types/react/capture/attestation.d.ts +32 -0
- package/dist/types/react/capture/binding.d.ts +51 -0
- package/dist/types/react/capture/camera.d.ts +4 -0
- package/dist/types/react/capture/chrome.d.ts +24 -0
- package/dist/types/react/capture/demo.d.ts +2 -0
- package/dist/types/react/capture/errors.d.ts +18 -0
- package/dist/types/react/capture/frames.d.ts +18 -0
- package/dist/types/react/capture/index.d.ts +15 -0
- package/dist/types/react/capture/integrity.d.ts +32 -0
- package/dist/types/react/capture/keyframes.d.ts +19 -0
- package/dist/types/react/capture/overlays.d.ts +10 -0
- package/dist/types/react/capture/run.d.ts +14 -0
- package/dist/types/react/capture/useCaptureRun.d.ts +4 -0
- package/dist/types/react/document/CardFrame.d.ts +10 -0
- package/dist/types/react/document/DocumentParts.d.ts +49 -0
- package/dist/types/react/document/advisory.d.ts +47 -0
- package/dist/types/react/document/bestFrames.d.ts +18 -0
- package/dist/types/react/document/cues.d.ts +28 -0
- package/dist/types/react/document/flow.d.ts +52 -0
- package/dist/types/react/document/gate.d.ts +114 -0
- package/dist/types/react/document/latch.d.ts +25 -0
- package/dist/types/react/document/mrz.d.ts +29 -0
- package/dist/types/react/document/overlay.d.ts +52 -0
- package/dist/types/react/document/quad.d.ts +5 -0
- package/dist/types/react/document/resolution.d.ts +42 -0
- package/dist/types/react/document/review.d.ts +50 -0
- package/dist/types/react/document/sideCheck.d.ts +32 -0
- package/dist/types/react/document/telemetry.d.ts +14 -0
- package/dist/types/react/document/track.d.ts +36 -0
- package/dist/types/react/document/useDocumentCapture.d.ts +78 -0
- package/dist/types/react/face/FaceGuide.d.ts +22 -0
- package/dist/types/react/face/FaceParts.d.ts +15 -0
- package/dist/types/react/face/faceMesh.d.ts +68 -0
- package/dist/types/react/face/faceRegion.d.ts +16 -0
- package/dist/types/react/face/faceView.d.ts +21 -0
- package/dist/types/react/face/meshBench.d.ts +7 -0
- package/dist/types/react/face/meshCanvas.d.ts +20 -0
- package/dist/types/react/face/qualityGate.d.ts +59 -0
- package/dist/types/react/face/runLiveness.d.ts +37 -0
- package/dist/types/react/face/scanState.d.ts +40 -0
- package/dist/types/react/face/upload.d.ts +14 -0
- package/dist/types/react/face/useFaceCapture.d.ts +45 -0
- package/dist/types/react/flows/ConsentStep.d.ts +8 -0
- package/dist/types/react/flows/EnrollmentFlow.d.ts +2 -0
- package/dist/types/react/flows/FlowResult.d.ts +13 -0
- package/dist/types/react/flows/FlowShell.d.ts +48 -0
- package/dist/types/react/flows/IdentifyFlow.d.ts +2 -0
- package/dist/types/react/flows/ReverificationFlow.d.ts +2 -0
- package/dist/types/react/flows/SignInFlow.d.ts +2 -0
- package/dist/types/react/flows/StepIntro.d.ts +10 -0
- package/dist/types/react/flows/VerificationFlow.d.ts +4 -0
- package/dist/types/react/flows/experience.d.ts +35 -0
- package/dist/types/react/flows/failureDetail.d.ts +12 -0
- package/dist/types/react/flows/index.d.ts +6 -0
- package/dist/types/react/flows/session.d.ts +5 -0
- package/dist/types/react/flows/state.d.ts +106 -0
- package/dist/types/react/flows/types.d.ts +255 -0
- package/dist/types/react/flows/useFlowSession.d.ts +21 -0
- package/dist/types/react/flows.d.ts +1 -0
- package/dist/types/react/handoff/ContinueFlow.d.ts +28 -0
- package/dist/types/react/handoff/ContinueOnPhone.d.ts +60 -0
- package/dist/types/react/handoff/api.d.ts +41 -0
- package/dist/types/react/handoff/qr.d.ts +9 -0
- package/dist/types/react/hooks.d.ts +7 -0
- package/dist/types/react/i18n/en.d.ts +3 -0
- package/dist/types/react/i18n/es-419.d.ts +3 -0
- package/dist/types/react/i18n/index.d.ts +10 -0
- package/dist/types/react/i18n/types.d.ts +250 -0
- package/dist/types/react/icons.d.ts +25 -0
- package/dist/types/react/liveness/challenges.d.ts +26 -0
- package/dist/types/react/liveness/framing.d.ts +33 -0
- package/dist/types/react/liveness/index.d.ts +8 -0
- package/dist/types/react/liveness/nod.d.ts +4 -0
- package/dist/types/react/liveness/scoring.d.ts +29 -0
- package/dist/types/react/liveness/script.d.ts +7 -0
- package/dist/types/react/liveness/signals.d.ts +38 -0
- package/dist/types/react/liveness/timing.d.ts +20 -0
- package/dist/types/react/liveness/turn.d.ts +18 -0
- package/dist/types/react/preview/FlowPreview.d.ts +34 -0
- package/dist/types/react/preview/contrast.d.ts +17 -0
- package/dist/types/react/preview/specimen.d.ts +35 -0
- package/dist/types/react/styles/index.d.ts +0 -0
- package/dist/types/react/telemetry/bus.d.ts +13 -0
- package/dist/types/react/telemetry/device.d.ts +66 -0
- package/dist/types/react/telemetry/reporter.d.ts +27 -0
- package/dist/types/react/theme/appearance.d.ts +22 -0
- package/dist/types/react/version.d.ts +1 -0
- package/dist/types/react/vision/authenticity.d.ts +43 -0
- package/dist/types/react/vision/authenticityPixels.d.ts +6 -0
- package/dist/types/react/vision/authenticitySpecular.d.ts +2 -0
- package/dist/types/react/vision/cardCorners.d.ts +21 -0
- package/dist/types/react/vision/cardDetector.d.ts +15 -0
- package/dist/types/react/vision/cornerGeometry.d.ts +10 -0
- package/dist/types/react/vision/cornerImage.d.ts +34 -0
- package/dist/types/react/vision/cornerLines.d.ts +12 -0
- package/dist/types/react/vision/cornerScore.d.ts +17 -0
- package/dist/types/react/vision/corners.d.ts +60 -0
- package/dist/types/react/vision/detector.worker.d.ts +1 -0
- package/dist/types/react/vision/document.d.ts +13 -0
- package/dist/types/react/vision/engine.d.ts +5 -0
- package/dist/types/react/vision/face.d.ts +17 -0
- package/dist/types/react/vision/index.d.ts +7 -0
- package/dist/types/react/vision/modelCache.d.ts +16 -0
- package/dist/types/react/vision/modelsCdn.d.ts +4 -0
- package/dist/types/react/vision/quality.d.ts +10 -0
- package/dist/types/react/vision/sideClassifier.d.ts +4 -0
- package/dist/types/react/vision/tinyCore.d.ts +21 -0
- package/dist/types/react/vision/tinyDetector.d.ts +36 -0
- package/dist/types/react/vision/types.d.ts +62 -0
- package/dist/types/react/vision/warp.d.ts +18 -0
- package/package.json +104 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { Quality } from "../capture";
|
|
2
|
+
import type { CropQuality } from "../vision";
|
|
3
|
+
import { type SpecularSignature } from "../vision/authenticity";
|
|
4
|
+
export { type AuthenticityCue, type CardReading, authenticityCue, cardIssue, holdFraction, paperCue, screenCue } from "./cues";
|
|
5
|
+
export { type AuthenticityTelemetry, heuristicTelemetry, mlTelemetry } from "./telemetry";
|
|
6
|
+
export declare const TICK_MS = 160;
|
|
7
|
+
export declare const ML_TICK_MS = 300;
|
|
8
|
+
export declare const LOCK_FRAMES = 4;
|
|
9
|
+
export declare const LOCK_SHUTTER_MS = 450;
|
|
10
|
+
export declare const HOLD_MS = 1600;
|
|
11
|
+
export declare const MIN_CARD_AREA = 0.14;
|
|
12
|
+
export declare const CARD_AR_MIN = 1.25;
|
|
13
|
+
export declare const CARD_AR_MAX = 2.05;
|
|
14
|
+
export declare const TILT_HOLD_MAX = 35;
|
|
15
|
+
export declare const LOW_CONTRAST_GRACE_MS = 3000;
|
|
16
|
+
export declare const MANUAL_SHUTTER_MS = 10000;
|
|
17
|
+
export declare const DAMAGED_RETRY_LIMIT = 1;
|
|
18
|
+
export declare const TERMINAL_DOC_REASONS: readonly string[];
|
|
19
|
+
export declare function docRejection(reason: string, damagedBefore: number): {
|
|
20
|
+
code: string;
|
|
21
|
+
terminal: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare const REJECTION_NOTICE_MS = 4000;
|
|
24
|
+
export type Phase = "loading" | "searching" | "adjusting" | "steady" | "locked" | "uploading" | "review" | "retake" | "error";
|
|
25
|
+
export type Tone = "info" | "ok" | "warn";
|
|
26
|
+
export declare const GUIDE: {
|
|
27
|
+
loading: {
|
|
28
|
+
key: "loading";
|
|
29
|
+
tone: "info";
|
|
30
|
+
};
|
|
31
|
+
no_card: {
|
|
32
|
+
key: "no_card";
|
|
33
|
+
tone: "info";
|
|
34
|
+
};
|
|
35
|
+
too_far: {
|
|
36
|
+
key: "too_far";
|
|
37
|
+
tone: "warn";
|
|
38
|
+
};
|
|
39
|
+
bad_framing: {
|
|
40
|
+
key: "bad_framing";
|
|
41
|
+
tone: "warn";
|
|
42
|
+
};
|
|
43
|
+
tilt_less: {
|
|
44
|
+
key: "tilt_less";
|
|
45
|
+
tone: "warn";
|
|
46
|
+
};
|
|
47
|
+
low_contrast: {
|
|
48
|
+
key: "low_contrast";
|
|
49
|
+
tone: "warn";
|
|
50
|
+
};
|
|
51
|
+
screen_suspected: {
|
|
52
|
+
key: "screen_suspected";
|
|
53
|
+
tone: "info";
|
|
54
|
+
};
|
|
55
|
+
paper_suspected: {
|
|
56
|
+
key: "paper_suspected";
|
|
57
|
+
tone: "info";
|
|
58
|
+
};
|
|
59
|
+
wrong_side_front: {
|
|
60
|
+
key: "wrong_side_front";
|
|
61
|
+
tone: "warn";
|
|
62
|
+
};
|
|
63
|
+
wrong_side_back: {
|
|
64
|
+
key: "wrong_side_back";
|
|
65
|
+
tone: "warn";
|
|
66
|
+
};
|
|
67
|
+
blurred: {
|
|
68
|
+
key: "blurred";
|
|
69
|
+
tone: "warn";
|
|
70
|
+
};
|
|
71
|
+
glare: {
|
|
72
|
+
key: "glare";
|
|
73
|
+
tone: "warn";
|
|
74
|
+
};
|
|
75
|
+
too_dark: {
|
|
76
|
+
key: "too_dark";
|
|
77
|
+
tone: "warn";
|
|
78
|
+
};
|
|
79
|
+
too_bright: {
|
|
80
|
+
key: "too_bright";
|
|
81
|
+
tone: "warn";
|
|
82
|
+
};
|
|
83
|
+
steady: {
|
|
84
|
+
key: "steady";
|
|
85
|
+
tone: "ok";
|
|
86
|
+
};
|
|
87
|
+
uploading: {
|
|
88
|
+
key: "uploading";
|
|
89
|
+
tone: "info";
|
|
90
|
+
};
|
|
91
|
+
mrz_reading: {
|
|
92
|
+
key: "mrz_reading";
|
|
93
|
+
tone: "info";
|
|
94
|
+
};
|
|
95
|
+
mrz_unreadable: {
|
|
96
|
+
key: "mrz_unreadable";
|
|
97
|
+
tone: "warn";
|
|
98
|
+
};
|
|
99
|
+
mrz_verified: {
|
|
100
|
+
key: "mrz_verified";
|
|
101
|
+
tone: "ok";
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
export type GuideId = keyof typeof GUIDE;
|
|
105
|
+
export type Guidance = (typeof GUIDE)[GuideId];
|
|
106
|
+
export interface Chip {
|
|
107
|
+
label: "sharpness" | "glare" | "light" | "gloss";
|
|
108
|
+
state: "idle" | "pass" | "fail";
|
|
109
|
+
}
|
|
110
|
+
export declare const IDLE_CHIPS: Chip[];
|
|
111
|
+
export declare const heuristicOk: (q: Quality) => boolean;
|
|
112
|
+
export declare const heuristicChips: (q: Quality) => Chip[];
|
|
113
|
+
export declare const glossChip: (s?: SpecularSignature | null) => Chip;
|
|
114
|
+
export declare const cropChips: (q: CropQuality, specular?: SpecularSignature | null) => Chip[];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AnchoredQuad } from "./flow";
|
|
2
|
+
import { type Box, type Quad } from "./overlay";
|
|
3
|
+
export declare const EDGE_WEIGHT = 0.85;
|
|
4
|
+
export declare const EDGE_HOLD_MS = 700;
|
|
5
|
+
export declare const EDGE_HOLD_IOU = 0.6;
|
|
6
|
+
export type OutlineKind = "edges" | "box";
|
|
7
|
+
export type Locks = [boolean, boolean, boolean, boolean];
|
|
8
|
+
export interface CornerReading {
|
|
9
|
+
box: Box;
|
|
10
|
+
corners?: Quad | null;
|
|
11
|
+
locks?: Locks;
|
|
12
|
+
}
|
|
13
|
+
export declare function iou(a: Box, b: Box): number;
|
|
14
|
+
export declare class CornerLatch {
|
|
15
|
+
readonly anchored: AnchoredQuad;
|
|
16
|
+
private kind;
|
|
17
|
+
private lastEdges;
|
|
18
|
+
private lockState;
|
|
19
|
+
constructor(anchored: AnchoredQuad);
|
|
20
|
+
read(r: CornerReading, t: number): void;
|
|
21
|
+
get mode(): OutlineKind | null;
|
|
22
|
+
get locks(): Locks;
|
|
23
|
+
hint(t: number): Quad | null;
|
|
24
|
+
reset(): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { MrzProbe } from "../capture";
|
|
2
|
+
export declare const MRZ_PROBE_MS = 1100;
|
|
3
|
+
export declare const MRZ_GRACE_MS = 5200;
|
|
4
|
+
export declare const MRZ_READINGS_MAX = 7;
|
|
5
|
+
export type MrzStage = "idle" | "reading" | "unreadable" | "verified" | "absent";
|
|
6
|
+
export type MrzDecision = {
|
|
7
|
+
kind: "hold";
|
|
8
|
+
guide: "mrz_reading" | "mrz_unreadable";
|
|
9
|
+
} | {
|
|
10
|
+
kind: "release";
|
|
11
|
+
becameAbsent: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare class MrzGate {
|
|
14
|
+
inFlight: boolean;
|
|
15
|
+
lastAt: number;
|
|
16
|
+
verified: boolean;
|
|
17
|
+
seen: boolean;
|
|
18
|
+
unavailable: boolean;
|
|
19
|
+
readonly readings: string[];
|
|
20
|
+
readonly enabled: boolean;
|
|
21
|
+
constructor(enabled: boolean);
|
|
22
|
+
get initialStage(): MrzStage;
|
|
23
|
+
private get active();
|
|
24
|
+
claimProbe(now: number): boolean;
|
|
25
|
+
settle(res: MrzProbe | null): MrzStage | null;
|
|
26
|
+
abandon(): void;
|
|
27
|
+
decide(now: number, goodSince: number): MrzDecision;
|
|
28
|
+
reset(): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type Pt = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
|
5
|
+
export type Quad = [Pt, Pt, Pt, Pt];
|
|
6
|
+
export type Box = {
|
|
7
|
+
left: number;
|
|
8
|
+
top: number;
|
|
9
|
+
right: number;
|
|
10
|
+
bottom: number;
|
|
11
|
+
};
|
|
12
|
+
export interface ViewMap {
|
|
13
|
+
srcW: number;
|
|
14
|
+
srcH: number;
|
|
15
|
+
viewW: number;
|
|
16
|
+
viewH: number;
|
|
17
|
+
fit?: "cover" | "contain";
|
|
18
|
+
mirror?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const ID1_ASPECT: number;
|
|
21
|
+
export declare const ID1_RADIUS: number;
|
|
22
|
+
export declare const TARGET_WIDTH = 0.84;
|
|
23
|
+
export declare const OUTLINE_PAD = 0.02;
|
|
24
|
+
export declare const SMOOTHING = 0.5;
|
|
25
|
+
export declare const JUMP = 0.12;
|
|
26
|
+
export declare const LOST_TICKS = 2;
|
|
27
|
+
export declare function fitTransform(m: ViewMap): {
|
|
28
|
+
scale: number;
|
|
29
|
+
dx: number;
|
|
30
|
+
dy: number;
|
|
31
|
+
};
|
|
32
|
+
export declare function toView(p: Pt, m: ViewMap): Pt;
|
|
33
|
+
export declare function toSource(p: Pt, m: ViewMap): Pt;
|
|
34
|
+
export declare const boxQuad: (b: Box) => Quad;
|
|
35
|
+
export declare function mapQuad(q: Quad, m: ViewMap): Quad | null;
|
|
36
|
+
export declare function sourceBox(q: Quad, m: ViewMap): Box;
|
|
37
|
+
export declare const cssToBacking: (p: Pt, dpr: number) => Pt;
|
|
38
|
+
export declare function targetQuad(viewW: number, viewH: number, width?: number): Quad;
|
|
39
|
+
export declare const centroid: (q: Quad) => Pt;
|
|
40
|
+
export declare function expandQuad(q: Quad, pad?: number): Quad;
|
|
41
|
+
export declare const lerpQuad: (a: Quad, b: Quad, t: number) => Quad;
|
|
42
|
+
export declare const quadShift: (a: Quad, b: Quad) => number;
|
|
43
|
+
export declare class QuadTracker {
|
|
44
|
+
private quad;
|
|
45
|
+
private pending;
|
|
46
|
+
private misses;
|
|
47
|
+
seen(q: Quad): Quad;
|
|
48
|
+
missed(): Quad | null;
|
|
49
|
+
reset(): void;
|
|
50
|
+
}
|
|
51
|
+
export declare function roundedQuadPath(q: Quad, r: number): string;
|
|
52
|
+
export declare const quadWidth: (q: Quad) => number;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type CornerOptions, type CornerResult, type Gray, type Planes } from "../vision/corners";
|
|
2
|
+
import type { Box, Quad } from "./overlay";
|
|
3
|
+
export { grayOf, planesOf, findCorners, type CornerResult, type Gray, type Planes } from "../vision/corners";
|
|
4
|
+
export declare function refineQuad(g: Gray | Planes, box: Box, opts?: CornerOptions): Quad | null;
|
|
5
|
+
export declare const cornersOf: (g: Gray | Planes, box: Box, opts?: CornerOptions) => CornerResult;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface Box {
|
|
2
|
+
left: number;
|
|
3
|
+
top: number;
|
|
4
|
+
right: number;
|
|
5
|
+
bottom: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const WORK_LONG_SIDE = 1280;
|
|
8
|
+
export declare const UPLOAD_LONG_MAX = 1600;
|
|
9
|
+
export declare const UPLOAD_MARGIN = 0.03;
|
|
10
|
+
export declare const UPLOAD_JPEG_QUALITY = 0.9;
|
|
11
|
+
export declare const EXTRA_JPEG_QUALITY = 0.85;
|
|
12
|
+
export declare const EXTRA_JPEG_QUALITY_LOW = 0.75;
|
|
13
|
+
export declare const UPLOAD_BUDGET_BYTES = 1500000;
|
|
14
|
+
export declare const IOD_PER_CARD_PX = 0.062;
|
|
15
|
+
export declare const SERVER_IOD_MIN = 39;
|
|
16
|
+
export declare const CARD_PX_GOAL = 1000;
|
|
17
|
+
export declare const CARD_PX_FLOOR = 680;
|
|
18
|
+
export declare const FILL_ASK = 0.8;
|
|
19
|
+
export declare const FILL_MAX = 0.92;
|
|
20
|
+
export declare const ID1_ASPECT: number;
|
|
21
|
+
export declare function fitLong(w: number, h: number, long: number): {
|
|
22
|
+
w: number;
|
|
23
|
+
h: number;
|
|
24
|
+
k: number;
|
|
25
|
+
};
|
|
26
|
+
export declare const workSize: (w: number, h: number) => {
|
|
27
|
+
w: number;
|
|
28
|
+
h: number;
|
|
29
|
+
k: number;
|
|
30
|
+
};
|
|
31
|
+
export declare function scaleBox(b: Box, kx: number, ky?: number): Box;
|
|
32
|
+
export declare function uploadRect(b: Box, W: number, H: number, margin?: number): Box;
|
|
33
|
+
export declare function uploadSize(r: Box, maxLong?: number): {
|
|
34
|
+
w: number;
|
|
35
|
+
h: number;
|
|
36
|
+
};
|
|
37
|
+
export declare const cardLongPx: (b: Box) => number;
|
|
38
|
+
export declare function cardPxInUpload(b: Box, W: number, H: number): number;
|
|
39
|
+
export declare const expectedIod: (px: number) => number;
|
|
40
|
+
export declare const maxCardLongPx: (W: number, H: number) => number;
|
|
41
|
+
export declare function requiredCardPx(W: number, H: number): number;
|
|
42
|
+
export declare function extrasThatFit(primaryBytes: number, extraBytes: readonly number[], budget?: number): number;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Strings } from "../i18n";
|
|
2
|
+
export interface ExtractionLike {
|
|
3
|
+
fields?: Record<string, {
|
|
4
|
+
value?: unknown;
|
|
5
|
+
sources?: string[];
|
|
6
|
+
agreed?: boolean;
|
|
7
|
+
} | undefined>;
|
|
8
|
+
sources?: Array<{
|
|
9
|
+
kind?: string;
|
|
10
|
+
valid?: boolean | null;
|
|
11
|
+
raw?: unknown;
|
|
12
|
+
}>;
|
|
13
|
+
portrait?: {
|
|
14
|
+
present?: boolean;
|
|
15
|
+
box?: number[] | null;
|
|
16
|
+
} | null;
|
|
17
|
+
}
|
|
18
|
+
export interface ReviewRegion {
|
|
19
|
+
key: string;
|
|
20
|
+
label: string;
|
|
21
|
+
l: number;
|
|
22
|
+
t: number;
|
|
23
|
+
w: number;
|
|
24
|
+
h: number;
|
|
25
|
+
}
|
|
26
|
+
export interface ReviewField {
|
|
27
|
+
key: string;
|
|
28
|
+
label: string;
|
|
29
|
+
value: string;
|
|
30
|
+
confirmed: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface Review {
|
|
33
|
+
regions: ReviewRegion[];
|
|
34
|
+
fields: ReviewField[];
|
|
35
|
+
}
|
|
36
|
+
export declare function maskNumber(v: string): string;
|
|
37
|
+
export declare function reviewOf(x: ExtractionLike | null | undefined, imgW: number, imgH: number, t: Strings): Review;
|
|
38
|
+
export declare const hasReview: (r: Review) => boolean;
|
|
39
|
+
export interface CardInset {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
}
|
|
43
|
+
export declare function cardInset(margin: number, aspect?: number): CardInset;
|
|
44
|
+
export interface ReviewView {
|
|
45
|
+
image: string;
|
|
46
|
+
aspect: number;
|
|
47
|
+
review: Review;
|
|
48
|
+
confirm: boolean;
|
|
49
|
+
outline: CardInset | null;
|
|
50
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Side } from "../flows/state";
|
|
2
|
+
import type { Strings } from "../i18n";
|
|
3
|
+
export interface SideCopy {
|
|
4
|
+
reason: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
mismatches: string[];
|
|
8
|
+
action?: string;
|
|
9
|
+
}
|
|
10
|
+
export type SideOutcome = {
|
|
11
|
+
kind: "ok";
|
|
12
|
+
} | ({
|
|
13
|
+
kind: "retake";
|
|
14
|
+
target: Side;
|
|
15
|
+
} & SideCopy) | ({
|
|
16
|
+
kind: "hint";
|
|
17
|
+
suggest: "continue" | "retake";
|
|
18
|
+
} & SideCopy);
|
|
19
|
+
export declare function sideOutcomeOf(side: Side, res: unknown): SideOutcome;
|
|
20
|
+
export declare function fallbackCopy(o: Exclude<SideOutcome, {
|
|
21
|
+
kind: "ok";
|
|
22
|
+
}>, side: Side, t: Strings): {
|
|
23
|
+
title: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
export declare function retakeText(o: Exclude<SideOutcome, {
|
|
27
|
+
kind: "ok";
|
|
28
|
+
}>, side: Side, t: Strings): {
|
|
29
|
+
title: string;
|
|
30
|
+
description: string;
|
|
31
|
+
fields: string | null;
|
|
32
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Strings } from "../i18n";
|
|
2
|
+
import type { Quality } from "../capture";
|
|
3
|
+
import type { CropQuality } from "../vision";
|
|
4
|
+
import { type SpecularSignature } from "../vision/authenticity";
|
|
5
|
+
import type { AuthenticityCue } from "./cues";
|
|
6
|
+
export interface AuthenticityTelemetry {
|
|
7
|
+
grid: number;
|
|
8
|
+
specular: SpecularSignature;
|
|
9
|
+
corner: number | null;
|
|
10
|
+
cue: AuthenticityCue | null;
|
|
11
|
+
texture?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function mlTelemetry(t: Strings, cardConf: number, isFront: boolean, sideConf: number, q: Pick<CropQuality, "blurScore" | "brightness">, moire: number, auth?: AuthenticityTelemetry): string;
|
|
14
|
+
export declare function heuristicTelemetry(t: Strings, side: "front" | "back", q: Quality, ok: boolean): string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Pt, Quad } from "./overlay";
|
|
2
|
+
export declare const PREDICT_MAX_MS = 220;
|
|
3
|
+
export declare const LOST_MS = 700;
|
|
4
|
+
export declare const TRACK_JUMP = 0.16;
|
|
5
|
+
export declare const ALPHA_REST = 0.45;
|
|
6
|
+
export declare const ALPHA_MOVING = 0.92;
|
|
7
|
+
export declare const betaFor: (alpha: number) => number;
|
|
8
|
+
export declare const SPEED_FULL = 0.5;
|
|
9
|
+
export declare const SPEED_DEADBAND = 0.02;
|
|
10
|
+
export declare const SPEED_MAX = 4;
|
|
11
|
+
export declare const MIN_VELOCITY_DT = 12;
|
|
12
|
+
export declare class PointsMotion {
|
|
13
|
+
private readonly jump;
|
|
14
|
+
private p;
|
|
15
|
+
private v;
|
|
16
|
+
private t;
|
|
17
|
+
private pending;
|
|
18
|
+
private lastSeen;
|
|
19
|
+
constructor(jump?: number);
|
|
20
|
+
seen(pts: readonly Pt[], t: number): void;
|
|
21
|
+
pointsAt(now: number): Pt[] | null;
|
|
22
|
+
tracking(now: number): boolean;
|
|
23
|
+
reset(): void;
|
|
24
|
+
private adopt;
|
|
25
|
+
}
|
|
26
|
+
export declare class QuadMotion extends PointsMotion {
|
|
27
|
+
seenQuad(q: Quad, t: number): void;
|
|
28
|
+
at(now: number): Quad | null;
|
|
29
|
+
}
|
|
30
|
+
export interface QuadSource {
|
|
31
|
+
at(now: number): Quad | null;
|
|
32
|
+
info?(): {
|
|
33
|
+
kind: "edges" | "box" | null;
|
|
34
|
+
locks: readonly [boolean, boolean, boolean, boolean];
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type EngineProgress } from "../vision";
|
|
2
|
+
import type { DocumentCaptureProps } from "../DocumentCapture";
|
|
3
|
+
import { type Chip, type Guidance, type Phase } from "./gate";
|
|
4
|
+
import { type MrzStage } from "./mrz";
|
|
5
|
+
import { type Advisory } from "./advisory";
|
|
6
|
+
import { type Box, type Quad } from "./overlay";
|
|
7
|
+
import { type QuadSource } from "./track";
|
|
8
|
+
import { type ReviewView } from "./review";
|
|
9
|
+
export interface SnapshotFrom {
|
|
10
|
+
l: number;
|
|
11
|
+
t: number;
|
|
12
|
+
r: number;
|
|
13
|
+
b: number;
|
|
14
|
+
}
|
|
15
|
+
export interface Snapshot {
|
|
16
|
+
url: string;
|
|
17
|
+
aspect: number;
|
|
18
|
+
from: SnapshotFrom | null;
|
|
19
|
+
}
|
|
20
|
+
export declare const LOCK_MS = 520;
|
|
21
|
+
export declare const REVIEW_MS = 2600;
|
|
22
|
+
export declare function cutUpload(full: HTMLCanvasElement, b: Box): HTMLCanvasElement;
|
|
23
|
+
export interface UploadCandidate {
|
|
24
|
+
canvas: HTMLCanvasElement;
|
|
25
|
+
quad: Quad | null;
|
|
26
|
+
}
|
|
27
|
+
export declare function cutCard(full: HTMLCanvasElement, b: Box, quad?: Quad | null): UploadCandidate;
|
|
28
|
+
export declare function useDocumentCapture(props: DocumentCaptureProps): {
|
|
29
|
+
t: import("../i18n").Strings;
|
|
30
|
+
videoRef: import("react").RefObject<HTMLVideoElement>;
|
|
31
|
+
canvasRef: import("react").RefObject<HTMLCanvasElement>;
|
|
32
|
+
source: "camera" | "demo";
|
|
33
|
+
phase: Phase;
|
|
34
|
+
guide: Guidance;
|
|
35
|
+
chips: Chip[];
|
|
36
|
+
holdPct: number;
|
|
37
|
+
tracking: boolean;
|
|
38
|
+
track: QuadSource;
|
|
39
|
+
hint: Advisory | null;
|
|
40
|
+
error: string | null;
|
|
41
|
+
tele: string;
|
|
42
|
+
retake: ({
|
|
43
|
+
kind: "retake";
|
|
44
|
+
target: import("../flows/state").Side;
|
|
45
|
+
} & import("./sideCheck").SideCopy) | ({
|
|
46
|
+
kind: "hint";
|
|
47
|
+
suggest: "continue" | "retake";
|
|
48
|
+
} & import("./sideCheck").SideCopy) | null;
|
|
49
|
+
finalCopy: {
|
|
50
|
+
title?: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
} | null;
|
|
53
|
+
retakeAgain: () => void | undefined;
|
|
54
|
+
retakeProceed: () => void | undefined;
|
|
55
|
+
confirmUse: () => void | undefined;
|
|
56
|
+
confirmRetake: () => void | undefined;
|
|
57
|
+
loadProgress: EngineProgress | null;
|
|
58
|
+
engineReady: boolean;
|
|
59
|
+
mrz: {
|
|
60
|
+
found: boolean;
|
|
61
|
+
raw_text?: string | null;
|
|
62
|
+
type?: string | null;
|
|
63
|
+
valid?: boolean;
|
|
64
|
+
fields_valid?: boolean;
|
|
65
|
+
score?: number | null;
|
|
66
|
+
checks?: Record<string, boolean>;
|
|
67
|
+
failed?: string[];
|
|
68
|
+
fields?: Record<string, string | null>;
|
|
69
|
+
} | null;
|
|
70
|
+
mrzStage: MrzStage;
|
|
71
|
+
retry: () => void;
|
|
72
|
+
retriesLeft: number | null;
|
|
73
|
+
final: boolean;
|
|
74
|
+
manualReady: boolean;
|
|
75
|
+
shutter: () => void | undefined;
|
|
76
|
+
review: ReviewView | null;
|
|
77
|
+
snapshot: Snapshot | null;
|
|
78
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { GuideKey, Strings } from "../i18n";
|
|
2
|
+
import { type Ellipse } from "./faceView";
|
|
3
|
+
import type { PointsMotion } from "../document/track";
|
|
4
|
+
import { type ScanState } from "./scanState";
|
|
5
|
+
export type FaceGuideState = "neutral" | "aligned" | "capturing" | "done" | "warn";
|
|
6
|
+
export type FaceCue = "turn_left" | "turn_right" | "move_closer" | null;
|
|
7
|
+
export declare function FaceGuide({ src, oval, motion, state, scan, fills, progress, cue, guide, errorKey, t, }: {
|
|
8
|
+
src: {
|
|
9
|
+
w: number;
|
|
10
|
+
h: number;
|
|
11
|
+
};
|
|
12
|
+
oval: Ellipse;
|
|
13
|
+
motion: PointsMotion;
|
|
14
|
+
state: FaceGuideState;
|
|
15
|
+
scan: ScanState;
|
|
16
|
+
fills: number[];
|
|
17
|
+
progress: number;
|
|
18
|
+
cue: FaceCue;
|
|
19
|
+
guide: GuideKey;
|
|
20
|
+
errorKey?: string | null;
|
|
21
|
+
t: Strings;
|
|
22
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Strings } from "../i18n";
|
|
2
|
+
import type { ChallengeKind } from "../liveness";
|
|
3
|
+
export declare function ChallengeList({ script, step, t }: {
|
|
4
|
+
script: ChallengeKind[];
|
|
5
|
+
step: number;
|
|
6
|
+
t: Strings;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
export declare function faceGuideStateOf(s: {
|
|
9
|
+
error: string | null;
|
|
10
|
+
phase: string;
|
|
11
|
+
step: number;
|
|
12
|
+
total: number;
|
|
13
|
+
found: boolean;
|
|
14
|
+
guide: string;
|
|
15
|
+
}): "neutral" | "aligned" | "capturing" | "done" | "warn";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Pt } from "../document/overlay";
|
|
2
|
+
import type { FaceMark } from "./faceView";
|
|
3
|
+
export declare const MESH_DEPTH = 0.78;
|
|
4
|
+
export declare const MESH_EYE: {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
r: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const MESH_NOSE: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const MESH_MOUTH: {
|
|
14
|
+
y: number;
|
|
15
|
+
rx: number;
|
|
16
|
+
ry: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const YAW_LIMIT = 1.05;
|
|
19
|
+
export declare function halfWidth(y: number): number;
|
|
20
|
+
export declare function surfaceZ(x: number, y: number): number;
|
|
21
|
+
export interface FaceMesh {
|
|
22
|
+
dots: Float32Array;
|
|
23
|
+
count: number;
|
|
24
|
+
lines: Float32Array[];
|
|
25
|
+
}
|
|
26
|
+
export declare const DOT_STRIDE = 5;
|
|
27
|
+
export declare function featureLines(): Float32Array[];
|
|
28
|
+
export declare function buildFaceMesh(spacing?: number): FaceMesh;
|
|
29
|
+
export interface FacePose {
|
|
30
|
+
cx: number;
|
|
31
|
+
cy: number;
|
|
32
|
+
rx: number;
|
|
33
|
+
ry: number;
|
|
34
|
+
roll: number;
|
|
35
|
+
yaw: number;
|
|
36
|
+
}
|
|
37
|
+
export declare function poseOf(mark: FaceMark): FacePose;
|
|
38
|
+
export interface Projected extends Pt {
|
|
39
|
+
facing: number;
|
|
40
|
+
}
|
|
41
|
+
export declare function projectPoint(p: FacePose, x: number, y: number, z: number, out: Projected): Projected;
|
|
42
|
+
export declare function poseCentre(p: FacePose): Pt;
|
|
43
|
+
export declare function smoothstep(e0: number, e1: number, v: number): number;
|
|
44
|
+
export declare function revealAlpha(d: number, t: number): number;
|
|
45
|
+
export declare function sweepGlow(y: number, s: number, width?: number): number;
|
|
46
|
+
export declare function sweepY(t: number): number;
|
|
47
|
+
export declare function latitude(y: number, n?: number): Float32Array;
|
|
48
|
+
export declare class OneEuro {
|
|
49
|
+
private readonly minCutoff;
|
|
50
|
+
private readonly beta;
|
|
51
|
+
private readonly dCutoff;
|
|
52
|
+
private x;
|
|
53
|
+
private dx;
|
|
54
|
+
private t;
|
|
55
|
+
constructor(minCutoff?: number, beta?: number, dCutoff?: number);
|
|
56
|
+
private static alpha;
|
|
57
|
+
filter(v: number, t: number): number;
|
|
58
|
+
reset(): void;
|
|
59
|
+
}
|
|
60
|
+
export declare class PointsEuro {
|
|
61
|
+
private readonly minCutoff;
|
|
62
|
+
private readonly beta;
|
|
63
|
+
private fx;
|
|
64
|
+
private fy;
|
|
65
|
+
constructor(minCutoff?: number, beta?: number);
|
|
66
|
+
filter(pts: readonly Pt[], t: number): Pt[];
|
|
67
|
+
reset(): void;
|
|
68
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FaceSignals } from "../liveness";
|
|
2
|
+
import type { ProbeRegion } from "../capture";
|
|
3
|
+
export declare function faceRegion(s: Pick<FaceSignals, "faceFrac" | "cx" | "cy" | "geom"> | null, W: number, H: number): ProbeRegion | number;
|
|
4
|
+
export declare function faceBox(s: Pick<FaceSignals, "faceFrac" | "cx" | "cy" | "geom">, W: number, H: number, pad?: number): ProbeRegion;
|
|
5
|
+
export declare const OVAL_WIDTH = 0.76;
|
|
6
|
+
export declare const OVAL_ASPECT = 1.3;
|
|
7
|
+
export declare const OVAL_CY = 0.45;
|
|
8
|
+
export declare function ovalFor(v: {
|
|
9
|
+
videoWidth: number;
|
|
10
|
+
videoHeight: number;
|
|
11
|
+
}): {
|
|
12
|
+
cx: number;
|
|
13
|
+
cy: number;
|
|
14
|
+
rx: number;
|
|
15
|
+
ry: number;
|
|
16
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Pt, type ViewMap } from "../document/overlay";
|
|
2
|
+
import type { FaceGeometry } from "../liveness";
|
|
3
|
+
export interface Ellipse {
|
|
4
|
+
cx: number;
|
|
5
|
+
cy: number;
|
|
6
|
+
rx: number;
|
|
7
|
+
ry: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const faceViewMap: (srcW: number, srcH: number, viewW: number, viewH: number) => ViewMap;
|
|
10
|
+
export declare function ovalToView(o: Ellipse, m: ViewMap): Ellipse;
|
|
11
|
+
export declare function trackPoints(g: FaceGeometry): Pt[];
|
|
12
|
+
export interface FaceMark {
|
|
13
|
+
face: Ellipse;
|
|
14
|
+
eyes: [Pt, Pt];
|
|
15
|
+
nose: Pt;
|
|
16
|
+
mouth?: Pt;
|
|
17
|
+
ears?: [Pt, Pt];
|
|
18
|
+
}
|
|
19
|
+
export declare function faceMarkToView(pts: readonly Pt[], srcW: number, srcH: number, m: ViewMap): FaceMark | null;
|
|
20
|
+
export declare const ovalFill: (faceW: number, oval: Ellipse) => number;
|
|
21
|
+
export declare function ellipsePath(e: Ellipse): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type FaceMesh, type FacePose } from "./faceMesh";
|
|
2
|
+
export interface MeshFrame {
|
|
3
|
+
alpha: number;
|
|
4
|
+
tone: string;
|
|
5
|
+
reveal: number;
|
|
6
|
+
sweep: number | null;
|
|
7
|
+
sweepFade: number;
|
|
8
|
+
contours: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class MeshPainter {
|
|
11
|
+
private readonly mesh;
|
|
12
|
+
private readonly px;
|
|
13
|
+
private readonly py;
|
|
14
|
+
private readonly pr;
|
|
15
|
+
private readonly pb;
|
|
16
|
+
private readonly tmp;
|
|
17
|
+
constructor(mesh: FaceMesh);
|
|
18
|
+
draw(ctx: CanvasRenderingContext2D, pose: FacePose, f: MeshFrame): void;
|
|
19
|
+
private trace;
|
|
20
|
+
}
|