@baas-id/react 0.2.3 → 0.3.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.
- package/LICENSE.md +1 -3
- package/README.md +8 -4
- package/THIRD_PARTY_NOTICES.md +8 -5
- package/dist/esm/baas-id-react.css +1 -1
- package/dist/esm/chunks/ContinueFlow-vn9wv0tZ.js +9147 -0
- package/dist/esm/continue.js +1 -1
- package/dist/esm/index.js +129 -147
- package/dist/esm/preview.js +183 -225
- package/dist/esm/workers/{detector.worker-DtuL8TFY.js → detector.worker-DrerkwUk.js} +1054 -1054
- package/dist/types/continue.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/preview.d.ts +2 -1
- package/dist/types/react/DocumentCapture.d.ts +1 -0
- package/dist/types/react/capture/api.d.ts +18 -0
- package/dist/types/react/capture/camera.d.ts +1 -0
- package/dist/types/react/capture/debugCapture.d.ts +31 -0
- package/dist/types/react/capture/debugLog.d.ts +25 -0
- package/dist/types/react/capture/index.d.ts +2 -2
- package/dist/types/react/document/DocumentParts.d.ts +4 -0
- package/dist/types/react/document/cornerOrder.d.ts +38 -0
- package/dist/types/react/document/gate.d.ts +5 -1
- package/dist/types/react/document/mrz.d.ts +4 -1
- package/dist/types/react/document/mrzMap.d.ts +19 -0
- package/dist/types/react/document/review.d.ts +29 -0
- package/dist/types/react/document/stats.d.ts +20 -0
- package/dist/types/react/document/steady.d.ts +90 -0
- package/dist/types/react/document/track.d.ts +5 -0
- package/dist/types/react/document/upright.d.ts +5 -0
- package/dist/types/react/document/useDocumentCapture.d.ts +5 -0
- package/dist/types/react/face/FaceGuide.d.ts +2 -2
- package/dist/types/react/face/faceFollow.d.ts +32 -0
- package/dist/types/react/face/scanState.d.ts +0 -1
- package/dist/types/react/flows/FlowResult.d.ts +3 -2
- package/dist/types/react/flows/FlowShell.d.ts +6 -3
- package/dist/types/react/flows/types.d.ts +5 -1
- package/dist/types/react/flows/useFlowSession.d.ts +2 -1
- package/dist/types/react/handoff/ContinueFlow.d.ts +5 -2
- package/dist/types/react/handoff/ContinueOnPhone.d.ts +18 -2
- package/dist/types/react/handoff/api.d.ts +18 -4
- package/dist/types/react/handoff/phoneLink.d.ts +7 -0
- package/dist/types/react/i18n/es-419-formal.d.ts +3 -0
- package/dist/types/react/i18n/index.d.ts +6 -4
- package/dist/types/react/i18n/types.d.ts +22 -1
- package/dist/types/react/preview/FlowPreview.d.ts +4 -1
- package/dist/types/react/telemetry/bus.d.ts +1 -1
- package/dist/types/react/theme/appearance.d.ts +4 -2
- package/dist/types/react/theme/scheme.d.ts +23 -0
- package/dist/types/react/version.d.ts +1 -1
- package/dist/types/react/vision/cardEvidence.d.ts +29 -0
- package/dist/types/react/vision/corners.d.ts +1 -0
- package/dist/types/react/vision/modelsCdn.d.ts +2 -2
- package/dist/types/react/vision/tinyCore.d.ts +7 -4
- package/dist/types/react/vision/tinyDetector.d.ts +5 -2
- package/dist/types/react/vision/types.d.ts +6 -0
- package/package.json +1 -1
- package/dist/esm/chunks/ContinueFlow-BaQtq48R.js +0 -7500
- package/dist/types/react/face/faceMesh.d.ts +0 -68
- package/dist/types/react/face/meshBench.d.ts +0 -7
- package/dist/types/react/face/meshCanvas.d.ts +0 -20
package/dist/types/continue.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { ContinueFlow, readHandoffCode, type ContinueFlowProps } from "./react/handoff/ContinueFlow";
|
|
2
2
|
export { DEFAULT_MODELS_URL, MODELS_VERSION } from "./react/vision/modelsCdn";
|
|
3
|
-
export { getStrings, LOCALES, type Locale, type Strings, type StringOverrides } from "./react/i18n";
|
|
3
|
+
export { getStrings, LOCALES, type Locale, type Strings, type StringOverrides, type Formality } from "./react/i18n";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { EnrollmentFlow, SignInFlow, ReverificationFlow, IdentifyFlow, normalizeSession, captureNonceOf, type ApiSessionBody, type EnrollmentFlowProps, type SignInFlowProps, type ReverificationFlowProps, type IdentifyFlowProps, type Purpose, type IdentifyCandidate, type DuplicateCandidate, type VerificationFlowProps, type RpidSession, type SessionFlow, type VerificationResult, type VerificationAssessment, type DocumentAuthenticity, type RpidFlowEvent, type ExtractionRecord, type ExtractionField, type Appearance, type TenantInstructions, type TenantMessages, type SessionHandoff, type HandoffOption, } from "./react/flows";
|
|
2
|
+
export type { ColorScheme } from "./react/theme/scheme";
|
|
2
3
|
export { ContinueOnPhone, HandoffPanel, HandoffView, type ContinueOnPhoneProps, type HandoffMode, type HandoffCopy, } from "./react/handoff/ContinueOnPhone";
|
|
3
4
|
export { ContinueFlow, readHandoffCode, type ContinueFlowProps } from "./react/handoff/ContinueFlow";
|
|
4
5
|
export { createHandoff, handoffStatus, revokeHandoff, peekHandoff, claimHandoff, type HandoffCode, type HandoffStatus, type HandoffPhase, type HandoffPeek, } from "./react/handoff/api";
|
|
@@ -15,5 +16,4 @@ export { webAttestation, nativeAttestation, requestHash, type AttestationProvide
|
|
|
15
16
|
export { preload, loadDocumentEngine, loadFaceEngine, cropQuality, DEFAULT_DETECTOR, type DetectorChoice, DEFAULT_MODELS_URL, MODELS_VERSION, modelsUrlOf, specularSignature, gridPeriodicity, cornerRadius, type PixelData, type CropSample, type CardOutline, type SpecularSignature, type CardDetection, type SideResult, type CropQuality, type FaceCentering, type EngineProgress, type ProgressFn, } from "./react/vision";
|
|
16
17
|
export { EngineLoading, ProcessingOverlay, ProximityMeter, TurnGauge, YawDial, turnGaugeFrom, } from "./react/capture";
|
|
17
18
|
export { proximityOf, distanceHintOf, distanceTrackPos, centeringFrom, centerBlocker, YAW_TARGET, CENTER_MIN, CONTAIN_MIN, FACE_W_MIN, FACE_W_MAX, FACE_W_COMFORT_MIN, FACE_W_COMFORT_MAX, faceWidthOf, type Proximity, type CenterBlocker, } from "./react/liveness";
|
|
18
|
-
export { getStrings, reasonEntry, resolveLocale, browserLocale, DEFAULT_LOCALE, LOCALES, type Locale, type Strings, type StringOverrides, type Reason, type ClientReason, type ServerReason, type ReasonEntry, type Recovery, type GuideKey, type EngineStage, type DistanceHint, } from "./react/i18n";
|
|
19
|
-
export { meshBenchmark, type MeshBench } from "./react/face/meshBench";
|
|
19
|
+
export { getStrings, reasonEntry, resolveLocale, browserLocale, DEFAULT_LOCALE, LOCALES, formalityOverrides, ES_FORMAL, type Formality, type Locale, type Strings, type StringOverrides, type Reason, type ClientReason, type ServerReason, type ReasonEntry, type Recovery, type GuideKey, type EngineStage, type DistanceHint, } from "./react/i18n";
|
package/dist/types/preview.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { FlowPreview, type FlowPreviewProps, type PreviewScreen, type PreviewChallenge, type PreviewHandoff, } from "./react/preview/FlowPreview";
|
|
2
2
|
export { appearanceStyle, appearanceGroups, FONT_STACKS, SDK_DEFAULTS, type Appearance, type ColorKey, type SafeFont, } from "./react/theme/appearance";
|
|
3
|
+
export { darkPalette, liftOn, DARK, type ColorScheme } from "./react/theme/scheme";
|
|
3
4
|
export { contrastChecks, contrastRatio, DEFAULT_COLORS, DEFAULT_RADIUS, CONTRAST_PAIRS, type ContrastCheck, } from "./react/preview/contrast";
|
|
4
5
|
export { parseIntroBody, introFor, type TenantInstructions, type TenantMessages } from "./react/flows/experience";
|
|
5
|
-
export { getStrings, LOCALES, type Locale, type Strings } from "./react/i18n";
|
|
6
|
+
export { getStrings, LOCALES, type Locale, type Strings, type Formality } from "./react/i18n";
|
|
@@ -19,6 +19,7 @@ export interface DocumentCaptureProps {
|
|
|
19
19
|
documentFrames?: number;
|
|
20
20
|
captureNonce?: string | null;
|
|
21
21
|
confirmCapture?: boolean;
|
|
22
|
+
flip?: boolean;
|
|
22
23
|
detector?: "tiny" | "legacy";
|
|
23
24
|
onCaptured: (serverResult: unknown, thumbnailDataUrl?: string) => void;
|
|
24
25
|
onRejected?: (reason: string, detail?: unknown) => void;
|
|
@@ -3,7 +3,12 @@ export interface RpidClientConfig {
|
|
|
3
3
|
apiUrl: string;
|
|
4
4
|
sessionId: string;
|
|
5
5
|
captureToken: string;
|
|
6
|
+
locale?: string;
|
|
7
|
+
formality?: "formal" | "informal";
|
|
6
8
|
}
|
|
9
|
+
export declare function apiHeaders(cfg: Pick<RpidClientConfig, "captureToken" | "locale" | "formality">): Record<string, string>;
|
|
10
|
+
export declare function langHeaders(locale?: string, formality?: "formal" | "informal"): Record<string, string>;
|
|
11
|
+
export declare const withLanguage: (cfg: RpidClientConfig, locale?: string, formality?: "formal" | "informal") => RpidClientConfig;
|
|
7
12
|
export type Json = Record<string, unknown>;
|
|
8
13
|
export interface CaptureUpload {
|
|
9
14
|
side?: "front" | "back";
|
|
@@ -19,6 +24,18 @@ export declare function uploadCaptureSignal(cfg: RpidClientConfig, kind: "docume
|
|
|
19
24
|
export declare function uploadCapture(cfg: RpidClientConfig, kind: "document" | "face", blob: Blob, side?: "front" | "back", meta?: Record<string, unknown>, mrzReadings?: string[]): Promise<any>;
|
|
20
25
|
export declare function finalizeSessionSignal(cfg: RpidClientConfig, signal?: AbortSignal): Promise<any>;
|
|
21
26
|
export declare function finalizeSession(cfg: RpidClientConfig): Promise<any>;
|
|
27
|
+
export interface MrzLayout {
|
|
28
|
+
rotation: 0 | 180;
|
|
29
|
+
orientation_source?: "mrz" | null;
|
|
30
|
+
type?: string | null;
|
|
31
|
+
image: [number, number];
|
|
32
|
+
box: number[] | null;
|
|
33
|
+
lines: number[][];
|
|
34
|
+
fields: Record<string, {
|
|
35
|
+
box: number[];
|
|
36
|
+
valid: boolean | null;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
22
39
|
export interface MrzProbe {
|
|
23
40
|
available: boolean;
|
|
24
41
|
mrz: {
|
|
@@ -31,6 +48,7 @@ export interface MrzProbe {
|
|
|
31
48
|
checks?: Record<string, boolean>;
|
|
32
49
|
failed?: string[];
|
|
33
50
|
fields?: Record<string, string | null>;
|
|
51
|
+
layout?: MrzLayout | null;
|
|
34
52
|
};
|
|
35
53
|
screen?: {
|
|
36
54
|
available: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type CameraProfile = "default" | "document";
|
|
2
2
|
export declare function cameraConstraints(facing: "environment" | "user", profile: CameraProfile): MediaTrackConstraints;
|
|
3
|
+
export declare function parkCamera(stream: MediaStream, facing: "environment" | "user", profile: CameraProfile, graceMs?: number): void;
|
|
3
4
|
export declare function openCamera(video: HTMLVideoElement, facing?: "environment" | "user", profile?: CameraProfile): Promise<MediaStream>;
|
|
4
5
|
export declare function stopStream(stream: MediaStream | null | undefined): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type RpidClientConfig } from "./api";
|
|
2
|
+
export interface DebugCaptureStatus {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
max_fps?: number;
|
|
5
|
+
long_side?: number;
|
|
6
|
+
quality?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function debugCaptureOf(cfg: RpidClientConfig): Promise<DebugCaptureStatus>;
|
|
9
|
+
export declare function resetDebugCapture(): void;
|
|
10
|
+
type Meta = Record<string, unknown>;
|
|
11
|
+
export declare class DebugRecorder {
|
|
12
|
+
private cfg;
|
|
13
|
+
private step;
|
|
14
|
+
private t0;
|
|
15
|
+
private status;
|
|
16
|
+
private last;
|
|
17
|
+
private seq;
|
|
18
|
+
private inflight;
|
|
19
|
+
private scratch;
|
|
20
|
+
readonly ready: Promise<void>;
|
|
21
|
+
constructor(cfg: RpidClientConfig | null, step: "front" | "back" | "face", t0?: number);
|
|
22
|
+
get on(): boolean;
|
|
23
|
+
offer(source: CanvasImageSource & {
|
|
24
|
+
width?: number;
|
|
25
|
+
height?: number;
|
|
26
|
+
videoWidth?: number;
|
|
27
|
+
videoHeight?: number;
|
|
28
|
+
}, meta: Meta, now?: number, force?: boolean): void;
|
|
29
|
+
}
|
|
30
|
+
export declare const r2: (v: number | null | undefined, d?: number) => number | null;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type RpidClientConfig } from "./api";
|
|
2
|
+
export type DebugEntry = Record<string, string | number | boolean | null | Array<string | number | null>>;
|
|
3
|
+
export declare function scrub(s: unknown, max?: number): string;
|
|
4
|
+
declare class DebugLog {
|
|
5
|
+
private cfg;
|
|
6
|
+
private queue;
|
|
7
|
+
private sent;
|
|
8
|
+
private seq;
|
|
9
|
+
private timer;
|
|
10
|
+
private undo;
|
|
11
|
+
private t0;
|
|
12
|
+
get on(): boolean;
|
|
13
|
+
start(cfg: RpidClientConfig): Promise<boolean>;
|
|
14
|
+
stop(): void;
|
|
15
|
+
add(e: DebugEntry): void;
|
|
16
|
+
perf(step: string, data: Record<string, number | string | null>): void;
|
|
17
|
+
camera(step: string, track: MediaStreamTrack | null | undefined): void;
|
|
18
|
+
flush(beacon: boolean): void;
|
|
19
|
+
private realFetch;
|
|
20
|
+
private hookConsole;
|
|
21
|
+
private hookErrors;
|
|
22
|
+
private hookFetch;
|
|
23
|
+
}
|
|
24
|
+
export declare const debugLog: DebugLog;
|
|
25
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { uploadCapture, finalizeSession, probeDocument, uploadCaptureSignal, finalizeSessionSignal, probeDocumentSignal, errorCode, isAbort, rejectionOf, authenticityOf, type RpidClientConfig, type MrzProbe, type CaptureUpload, type Rejection, type DocumentAuthenticity, } from "./api";
|
|
2
|
-
export { openCamera, stopStream, cameraConstraints, type CameraProfile } from "./camera";
|
|
1
|
+
export { uploadCapture, finalizeSession, probeDocument, uploadCaptureSignal, finalizeSessionSignal, probeDocumentSignal, errorCode, isAbort, rejectionOf, authenticityOf, apiHeaders, langHeaders, withLanguage, type RpidClientConfig, type MrzProbe, type MrzLayout, type CaptureUpload, type Rejection, type DocumentAuthenticity, } from "./api";
|
|
2
|
+
export { openCamera, parkCamera, stopStream, cameraConstraints, type CameraProfile } from "./camera";
|
|
3
3
|
export { analyzeFrame, moireProbe, grabFrame, canvasToJpeg, thumbnailOf, readPixels, haptic, type Quality, type ProbeRegion, } from "./frames";
|
|
4
4
|
export { demoDocumentFrame, demoFaceFrame } from "./demo";
|
|
5
5
|
export { createCaptureRun, frameLoop, nextFrame, type CaptureRun, type TickResult } from "./run";
|
|
@@ -24,6 +24,10 @@ export declare function CaptureReview({ image, aspect, review, t, confirm, outli
|
|
|
24
24
|
confirm?: boolean;
|
|
25
25
|
outline?: CardInset | null;
|
|
26
26
|
}): import("react").JSX.Element;
|
|
27
|
+
export declare function MrzOverlay({ mrz, t }: {
|
|
28
|
+
mrz: NonNullable<Review["mrz"]>;
|
|
29
|
+
t: Strings;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
27
31
|
export declare function ReviewSheet({ review, t, confirm }: {
|
|
28
32
|
review: Review;
|
|
29
33
|
t: Strings;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Quad } from "../vision/corners";
|
|
2
|
+
export declare function signedArea(q: Quad): number;
|
|
3
|
+
export declare const rotateQuad: (q: Quad, k: number) => Quad;
|
|
4
|
+
export declare function canonicalQuad(q: Quad): {
|
|
5
|
+
quad: Quad;
|
|
6
|
+
reflected: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function alignToPrevious(q: Quad, prev: Quad | null): Quad;
|
|
9
|
+
export declare function modelRotation(model: Quad, ordered: Quad): number | null;
|
|
10
|
+
export declare function geometricRotation(ordered: Quad): number;
|
|
11
|
+
export declare const HEAD_MIN = 0.6;
|
|
12
|
+
export declare function headRotation(canonical: Quad, stable: Quad, orient: readonly number[]): number | null;
|
|
13
|
+
export declare class OrientationVote {
|
|
14
|
+
private readonly n;
|
|
15
|
+
private readonly share;
|
|
16
|
+
private readonly min;
|
|
17
|
+
private xs;
|
|
18
|
+
private k;
|
|
19
|
+
constructor(n?: number, share?: number, min?: number);
|
|
20
|
+
push(k: number | null): number | null;
|
|
21
|
+
get value(): number | null;
|
|
22
|
+
shift(by: number): void;
|
|
23
|
+
reset(): void;
|
|
24
|
+
private held;
|
|
25
|
+
lock(k: number): void;
|
|
26
|
+
get locked(): boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare class CornerOrder {
|
|
29
|
+
private prev;
|
|
30
|
+
readonly orient: OrientationVote;
|
|
31
|
+
read(raw: Quad, fromModel: boolean, orient?: readonly number[] | null): Quad;
|
|
32
|
+
private canonLock;
|
|
33
|
+
rotationFor(stable: Quad): number;
|
|
34
|
+
settle(held: Quad, k: number): number;
|
|
35
|
+
flip(stable: Quad): number;
|
|
36
|
+
orientQuad(q: Quad): Quad;
|
|
37
|
+
reset(full?: boolean): void;
|
|
38
|
+
}
|
|
@@ -12,7 +12,7 @@ export declare const MIN_CARD_AREA = 0.14;
|
|
|
12
12
|
export declare const CARD_AR_MIN = 1.25;
|
|
13
13
|
export declare const CARD_AR_MAX = 2.05;
|
|
14
14
|
export declare const TILT_HOLD_MAX = 35;
|
|
15
|
-
export declare const LOW_CONTRAST_GRACE_MS =
|
|
15
|
+
export declare const LOW_CONTRAST_GRACE_MS = 2000;
|
|
16
16
|
export declare const MANUAL_SHUTTER_MS = 10000;
|
|
17
17
|
export declare const DAMAGED_RETRY_LIMIT = 1;
|
|
18
18
|
export declare const TERMINAL_DOC_REASONS: readonly string[];
|
|
@@ -64,6 +64,10 @@ export declare const GUIDE: {
|
|
|
64
64
|
key: "wrong_side_back";
|
|
65
65
|
tone: "warn";
|
|
66
66
|
};
|
|
67
|
+
turn_over: {
|
|
68
|
+
key: "turn_over";
|
|
69
|
+
tone: "info";
|
|
70
|
+
};
|
|
67
71
|
blurred: {
|
|
68
72
|
key: "blurred";
|
|
69
73
|
tone: "warn";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MrzProbe } from "../capture";
|
|
1
|
+
import type { MrzLayout, MrzProbe } from "../capture";
|
|
2
2
|
export declare const MRZ_PROBE_MS = 1100;
|
|
3
3
|
export declare const MRZ_GRACE_MS = 5200;
|
|
4
4
|
export declare const MRZ_READINGS_MAX = 7;
|
|
@@ -18,6 +18,8 @@ export declare class MrzGate {
|
|
|
18
18
|
unavailable: boolean;
|
|
19
19
|
readonly readings: string[];
|
|
20
20
|
readonly enabled: boolean;
|
|
21
|
+
settledAbsent: boolean;
|
|
22
|
+
layout: MrzLayout | null;
|
|
21
23
|
constructor(enabled: boolean);
|
|
22
24
|
get initialStage(): MrzStage;
|
|
23
25
|
private get active();
|
|
@@ -27,3 +29,4 @@ export declare class MrzGate {
|
|
|
27
29
|
decide(now: number, goodSince: number): MrzDecision;
|
|
28
30
|
reset(): void;
|
|
29
31
|
}
|
|
32
|
+
export declare function finalMrzStage(extraction: unknown, live: MrzStage): MrzStage | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { MrzLayout } from "../capture";
|
|
2
|
+
import type { Pt, Quad } from "./overlay";
|
|
3
|
+
export interface CardRect {
|
|
4
|
+
key: string;
|
|
5
|
+
uv: [Pt, Pt, Pt, Pt];
|
|
6
|
+
valid?: boolean | null;
|
|
7
|
+
}
|
|
8
|
+
export interface MrzMap {
|
|
9
|
+
zone: CardRect | null;
|
|
10
|
+
lines: CardRect[];
|
|
11
|
+
fields: CardRect[];
|
|
12
|
+
center: Pt | null;
|
|
13
|
+
}
|
|
14
|
+
export declare function invert3(m: number[]): number[] | null;
|
|
15
|
+
export declare function cardToQuad(q: Quad, p: Pt): Pt;
|
|
16
|
+
export declare function boxToSent(b: number[], W: number, H: number, rotation: number): [Pt, Pt, Pt, Pt];
|
|
17
|
+
export declare function mapLayout(layout: MrzLayout | null | undefined, quad: Quad | null): MrzMap | null;
|
|
18
|
+
export declare const upsideDown: (m: MrzMap | null) => boolean;
|
|
19
|
+
export declare function turnMap(m: MrzMap): MrzMap;
|
|
@@ -9,11 +9,26 @@ export interface ExtractionLike {
|
|
|
9
9
|
kind?: string;
|
|
10
10
|
valid?: boolean | null;
|
|
11
11
|
raw?: unknown;
|
|
12
|
+
format?: string | null;
|
|
12
13
|
}>;
|
|
13
14
|
portrait?: {
|
|
14
15
|
present?: boolean;
|
|
15
16
|
box?: number[] | null;
|
|
16
17
|
} | null;
|
|
18
|
+
orientation?: {
|
|
19
|
+
rotation?: number;
|
|
20
|
+
source?: string;
|
|
21
|
+
} | null;
|
|
22
|
+
mrz_layout?: {
|
|
23
|
+
rotation?: number;
|
|
24
|
+
orientation_source?: string | null;
|
|
25
|
+
image?: number[];
|
|
26
|
+
lines?: number[][];
|
|
27
|
+
fields?: Record<string, {
|
|
28
|
+
box?: number[];
|
|
29
|
+
valid?: boolean | null;
|
|
30
|
+
} | undefined>;
|
|
31
|
+
} | null;
|
|
17
32
|
}
|
|
18
33
|
export interface ReviewRegion {
|
|
19
34
|
key: string;
|
|
@@ -29,11 +44,25 @@ export interface ReviewField {
|
|
|
29
44
|
value: string;
|
|
30
45
|
confirmed: boolean;
|
|
31
46
|
}
|
|
47
|
+
export interface ReviewMrzField extends ReviewRegion {
|
|
48
|
+
value: string;
|
|
49
|
+
valid: boolean | null;
|
|
50
|
+
n: number;
|
|
51
|
+
field: string;
|
|
52
|
+
}
|
|
53
|
+
export interface ReviewMrz {
|
|
54
|
+
status: "verified" | "unreadable";
|
|
55
|
+
lines: ReviewRegion[];
|
|
56
|
+
fields: ReviewMrzField[];
|
|
57
|
+
}
|
|
32
58
|
export interface Review {
|
|
33
59
|
regions: ReviewRegion[];
|
|
34
60
|
fields: ReviewField[];
|
|
61
|
+
mrz?: ReviewMrz | null;
|
|
62
|
+
turned?: 0 | 180;
|
|
35
63
|
}
|
|
36
64
|
export declare function maskNumber(v: string): string;
|
|
65
|
+
export declare function turnOf(x: ExtractionLike | null | undefined): 0 | 180;
|
|
37
66
|
export declare function reviewOf(x: ExtractionLike | null | undefined, imgW: number, imgH: number, t: Strings): Review;
|
|
38
67
|
export declare const hasReview: (r: Review) => boolean;
|
|
39
68
|
export interface CardInset {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const GATES: readonly ["found", "side", "fill", "shape", "sharp", "glare", "light", "still"];
|
|
2
|
+
export type Gate = (typeof GATES)[number];
|
|
3
|
+
export declare function gateOf(issue: string): Gate;
|
|
4
|
+
export declare class CaptureStats {
|
|
5
|
+
private readonly t0;
|
|
6
|
+
private w;
|
|
7
|
+
private all;
|
|
8
|
+
private lastOutline;
|
|
9
|
+
private hold;
|
|
10
|
+
private coach;
|
|
11
|
+
private mode;
|
|
12
|
+
constructor(t0: number);
|
|
13
|
+
frame(found: boolean, confidence: number, veto?: "geometry" | "edges" | "content"): void;
|
|
14
|
+
outline(mode: "edges" | "box" | null): void;
|
|
15
|
+
tick(gate: Gate | null, pFront: number | null, motion: number | null, stillOk: boolean | null, hold: number, coach: string): void;
|
|
16
|
+
searching(coach: string): void;
|
|
17
|
+
flush(now: number): Record<string, number | string | number[]>;
|
|
18
|
+
summary(now: number, outcome: "capture" | "closed", ttc: number | null): Record<string, number | string | number[] | null>;
|
|
19
|
+
}
|
|
20
|
+
export declare const statsDue: (openMs: number, sinceLastMs: number) => boolean;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { Quad } from "../vision/corners";
|
|
2
|
+
export declare const PRESENCE_ON = 4;
|
|
3
|
+
export declare const PRESENCE_OFF = 7;
|
|
4
|
+
export declare class Presence {
|
|
5
|
+
private readonly onN;
|
|
6
|
+
private readonly offM;
|
|
7
|
+
private on;
|
|
8
|
+
private hits;
|
|
9
|
+
private misses;
|
|
10
|
+
constructor(onN?: number, offM?: number);
|
|
11
|
+
read(found: boolean): boolean;
|
|
12
|
+
get value(): boolean;
|
|
13
|
+
reset(): void;
|
|
14
|
+
}
|
|
15
|
+
export declare class SideVote {
|
|
16
|
+
private readonly n;
|
|
17
|
+
private xs;
|
|
18
|
+
constructor(n?: number);
|
|
19
|
+
push(pFront: number): number;
|
|
20
|
+
get value(): number;
|
|
21
|
+
reset(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare const HOLD_MAX_DROP = 0.15;
|
|
24
|
+
export declare class HoldMeter {
|
|
25
|
+
private readonly holdMs;
|
|
26
|
+
private readonly drainPerS;
|
|
27
|
+
private readonly maxDrop;
|
|
28
|
+
private pct;
|
|
29
|
+
private last;
|
|
30
|
+
constructor(holdMs: number, drainPerS?: number, maxDrop?: number);
|
|
31
|
+
good(now: number): number;
|
|
32
|
+
bad(now: number): number;
|
|
33
|
+
get value(): number;
|
|
34
|
+
reset(): void;
|
|
35
|
+
}
|
|
36
|
+
export declare const STILL_FRAC = 0.018;
|
|
37
|
+
export declare const STILL_FRAC_MAX = 0.03;
|
|
38
|
+
export declare const STILL_RELAX_MS = 1500;
|
|
39
|
+
export declare const STILL_WINDOW_MS = 500;
|
|
40
|
+
export declare const STILL_WINDOW_FAST_MS = 350;
|
|
41
|
+
export declare const STILL_FAST_CONF = 0.9;
|
|
42
|
+
export declare class Stillness {
|
|
43
|
+
private readonly windowMs;
|
|
44
|
+
private readonly frac;
|
|
45
|
+
private h;
|
|
46
|
+
constructor(windowMs?: number, frac?: number);
|
|
47
|
+
push(q: Quad, t: number): void;
|
|
48
|
+
spread(now: number, windowMs?: number): number | null;
|
|
49
|
+
still(now: number, opts?: {
|
|
50
|
+
windowMs?: number;
|
|
51
|
+
frac?: number;
|
|
52
|
+
}): boolean;
|
|
53
|
+
reset(): void;
|
|
54
|
+
}
|
|
55
|
+
export declare const stillFrac: (fullForMs: number, relaxed?: boolean) => number;
|
|
56
|
+
export interface Coach<K> {
|
|
57
|
+
key: K;
|
|
58
|
+
changed: boolean;
|
|
59
|
+
}
|
|
60
|
+
export declare class CoachGate<K extends string> {
|
|
61
|
+
private readonly minGapMs;
|
|
62
|
+
private readonly settleMs;
|
|
63
|
+
private shown;
|
|
64
|
+
private pending;
|
|
65
|
+
private pendingSince;
|
|
66
|
+
private lastChange;
|
|
67
|
+
constructor(minGapMs?: number, settleMs?: number);
|
|
68
|
+
propose(key: K, now: number): Coach<K>;
|
|
69
|
+
force(key: K, now: number): Coach<K>;
|
|
70
|
+
get value(): K | null;
|
|
71
|
+
reset(): void;
|
|
72
|
+
}
|
|
73
|
+
export declare class OneEuro {
|
|
74
|
+
private readonly minCutoff;
|
|
75
|
+
private readonly beta;
|
|
76
|
+
private readonly dCutoff;
|
|
77
|
+
private x;
|
|
78
|
+
private dx;
|
|
79
|
+
private t;
|
|
80
|
+
constructor(minCutoff?: number, beta?: number, dCutoff?: number);
|
|
81
|
+
private static a;
|
|
82
|
+
filter(v: number, t: number): number;
|
|
83
|
+
reset(): void;
|
|
84
|
+
}
|
|
85
|
+
export declare class CornerFilter {
|
|
86
|
+
private f;
|
|
87
|
+
constructor(minCutoff?: number, beta?: number);
|
|
88
|
+
filter(q: Quad, t: number): Quad;
|
|
89
|
+
reset(): void;
|
|
90
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FaceDetection } from "../vision/face";
|
|
2
|
+
export type Turn = 0 | 90 | 180 | 270;
|
|
3
|
+
export declare function rotateCanvas(src: HTMLCanvasElement, deg: Turn): HTMLCanvasElement;
|
|
4
|
+
export declare function uprightFace(f: FaceDetection): boolean;
|
|
5
|
+
export declare function portraitTurn(crop: HTMLCanvasElement, faces: (c: HTMLCanvasElement) => Promise<FaceDetection[]>): Promise<Turn | null>;
|
|
@@ -19,6 +19,9 @@ export interface Snapshot {
|
|
|
19
19
|
}
|
|
20
20
|
export declare const LOCK_MS = 520;
|
|
21
21
|
export declare const REVIEW_MS = 2600;
|
|
22
|
+
export declare const CROP_TURN_MIN = 1;
|
|
23
|
+
export declare const OUTLINE_BETA = 0.015;
|
|
24
|
+
export declare const FLIP_MANUAL_MS = 15000;
|
|
22
25
|
export declare function cutUpload(full: HTMLCanvasElement, b: Box): HTMLCanvasElement;
|
|
23
26
|
export interface UploadCandidate {
|
|
24
27
|
canvas: HTMLCanvasElement;
|
|
@@ -66,12 +69,14 @@ export declare function useDocumentCapture(props: DocumentCaptureProps): {
|
|
|
66
69
|
checks?: Record<string, boolean>;
|
|
67
70
|
failed?: string[];
|
|
68
71
|
fields?: Record<string, string | null>;
|
|
72
|
+
layout?: import("../capture").MrzLayout | null;
|
|
69
73
|
} | null;
|
|
70
74
|
mrzStage: MrzStage;
|
|
71
75
|
retry: () => void;
|
|
72
76
|
retriesLeft: number | null;
|
|
73
77
|
final: boolean;
|
|
74
78
|
manualReady: boolean;
|
|
79
|
+
manualOnly: boolean;
|
|
75
80
|
shutter: () => void | undefined;
|
|
76
81
|
review: ReviewView | null;
|
|
77
82
|
snapshot: Snapshot | null;
|
|
@@ -4,13 +4,13 @@ import type { PointsMotion } from "../document/track";
|
|
|
4
4
|
import { type ScanState } from "./scanState";
|
|
5
5
|
export type FaceGuideState = "neutral" | "aligned" | "capturing" | "done" | "warn";
|
|
6
6
|
export type FaceCue = "turn_left" | "turn_right" | "move_closer" | null;
|
|
7
|
-
export declare function FaceGuide({ src, oval,
|
|
7
|
+
export declare function FaceGuide({ src, oval, state, scan, fills, progress, cue, guide, errorKey, t, motion, }: {
|
|
8
|
+
motion?: PointsMotion | null;
|
|
8
9
|
src: {
|
|
9
10
|
w: number;
|
|
10
11
|
h: number;
|
|
11
12
|
};
|
|
12
13
|
oval: Ellipse;
|
|
13
|
-
motion: PointsMotion;
|
|
14
14
|
state: FaceGuideState;
|
|
15
15
|
scan: ScanState;
|
|
16
16
|
fills: number[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Ellipse } from "./faceView";
|
|
2
|
+
export declare const SNAP_FROM = 1;
|
|
3
|
+
export declare class FaceFollow {
|
|
4
|
+
private f;
|
|
5
|
+
private blend;
|
|
6
|
+
private last;
|
|
7
|
+
step(face: Ellipse | null, oval: Ellipse, locked: boolean, now: number): {
|
|
8
|
+
e: Ellipse;
|
|
9
|
+
alpha: number;
|
|
10
|
+
dashed: boolean;
|
|
11
|
+
} | null;
|
|
12
|
+
reset(): void;
|
|
13
|
+
}
|
|
14
|
+
export declare class FaceTrackStats {
|
|
15
|
+
frames: number;
|
|
16
|
+
found: number;
|
|
17
|
+
private prev;
|
|
18
|
+
private jit;
|
|
19
|
+
private t0;
|
|
20
|
+
alignedMs: number | null;
|
|
21
|
+
frame(center: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
} | null, aligned: boolean, now: number): void;
|
|
25
|
+
summary(): {
|
|
26
|
+
frames: number;
|
|
27
|
+
found: number;
|
|
28
|
+
rate: number;
|
|
29
|
+
jitterPx: number | null;
|
|
30
|
+
alignedMs: number | null;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -10,7 +10,6 @@ export declare function scanStateOf(s: {
|
|
|
10
10
|
guide: GuideKey | string;
|
|
11
11
|
}): ScanState;
|
|
12
12
|
export declare const isLocked: (s: ScanState) => s is "challenge" | "done" | "aligned" | "verifying";
|
|
13
|
-
export declare function meshLevel(s: ScanState): number;
|
|
14
13
|
export declare function segmentFills(s: {
|
|
15
14
|
step: number;
|
|
16
15
|
total: number;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { type Locale, type StringOverrides, type Strings } from "../i18n";
|
|
1
|
+
import { type Formality, type Locale, type StringOverrides, type Strings } from "../i18n";
|
|
2
2
|
import type { VerificationResult } from "./types";
|
|
3
3
|
export declare function FlowResult({ result, t }: {
|
|
4
4
|
result: VerificationResult;
|
|
5
5
|
t: Strings;
|
|
6
6
|
}): import("react").JSX.Element;
|
|
7
|
-
export declare function IdentifyOutcome({ reason, locale, overrides, onRestart, t, }: {
|
|
7
|
+
export declare function IdentifyOutcome({ reason, locale, overrides, formality, onRestart, t, }: {
|
|
8
8
|
reason: string;
|
|
9
9
|
locale?: Locale;
|
|
10
10
|
overrides?: StringOverrides;
|
|
11
|
+
formality?: Formality;
|
|
11
12
|
onRestart: () => void;
|
|
12
13
|
t: Strings;
|
|
13
14
|
}): import("react").JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import { type Locale, type StringOverrides, type Strings } from "../i18n";
|
|
2
|
+
import { type Formality, type Locale, type StringOverrides, type Strings } from "../i18n";
|
|
3
3
|
import { type CaptureId, type FailureCause, type FailureText, type RetakeNotice, type Side, type Step, type Thumbs } from "./state";
|
|
4
4
|
import type { Purpose } from "./types";
|
|
5
5
|
import { type Appearance } from "../theme/appearance";
|
|
6
|
-
|
|
6
|
+
import { type ColorScheme } from "../theme/scheme";
|
|
7
|
+
export declare function FlowShell({ step, purpose, title, t, children, privacy, appearance, forceAppearance, screen, manageFocus, colorScheme, }: {
|
|
7
8
|
step: Step;
|
|
8
9
|
purpose: Purpose;
|
|
9
10
|
title: string;
|
|
@@ -14,6 +15,7 @@ export declare function FlowShell({ step, purpose, title, t, children, privacy,
|
|
|
14
15
|
forceAppearance?: boolean;
|
|
15
16
|
screen?: string;
|
|
16
17
|
manageFocus?: boolean;
|
|
18
|
+
colorScheme?: ColorScheme;
|
|
17
19
|
}): import("react").JSX.Element;
|
|
18
20
|
export declare function StepRail({ step, t, plan, retakes, }: {
|
|
19
21
|
step: Step;
|
|
@@ -35,7 +37,8 @@ export declare function Preparing({ label, note }: {
|
|
|
35
37
|
label: string;
|
|
36
38
|
note?: string;
|
|
37
39
|
}): import("react").JSX.Element;
|
|
38
|
-
export declare function Failure({ reason, verdict, cause, text, locale, overrides, onRestart, t, takeFocus, }: {
|
|
40
|
+
export declare function Failure({ reason, verdict, cause, text, locale, overrides, formality, onRestart, t, takeFocus, }: {
|
|
41
|
+
formality?: Formality;
|
|
39
42
|
reason: string;
|
|
40
43
|
verdict?: "REJECTED" | "NEEDS_REVIEW";
|
|
41
44
|
cause?: FailureCause;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ColorScheme } from "../theme/scheme";
|
|
2
|
+
import type { Formality, Locale, StringOverrides } from "../i18n";
|
|
2
3
|
import type { DocumentAuthenticity } from "../capture";
|
|
3
4
|
import type { SelfieQualityFloors } from "../face/qualityGate";
|
|
4
5
|
import type { Appearance } from "../theme/appearance";
|
|
@@ -93,6 +94,7 @@ export interface SessionFlow {
|
|
|
93
94
|
document?: boolean;
|
|
94
95
|
documentSides?: "front_back" | "front";
|
|
95
96
|
locale?: Locale;
|
|
97
|
+
formality?: Formality;
|
|
96
98
|
appearance?: Appearance;
|
|
97
99
|
instructions?: TenantInstructions;
|
|
98
100
|
messages?: TenantMessages;
|
|
@@ -240,6 +242,8 @@ export interface VerificationFlowProps {
|
|
|
240
242
|
source?: "camera" | "demo";
|
|
241
243
|
locale?: Locale;
|
|
242
244
|
strings?: StringOverrides;
|
|
245
|
+
formality?: Formality;
|
|
246
|
+
colorScheme?: ColorScheme;
|
|
243
247
|
challengeMs?: number;
|
|
244
248
|
debug?: boolean;
|
|
245
249
|
onVerified: (result: VerificationResult) => void | Promise<void>;
|
|
@@ -2,10 +2,11 @@ import { type RpidClientConfig } from "../capture";
|
|
|
2
2
|
import { type FlowState, type Side } from "./state";
|
|
3
3
|
import type { SideRetake } from "../DocumentCapture";
|
|
4
4
|
import type { ConsentChoice, Purpose, VerificationFlowProps, VerificationResult } from "./types";
|
|
5
|
-
export declare function useFlowSession({ purpose, apiUrl, openSession, locale, strings: overrides, onVerified, onFailed, onEvent, source, consentChoice, diagnostics, }: VerificationFlowProps & {
|
|
5
|
+
export declare function useFlowSession({ purpose, apiUrl, openSession, locale, strings: overrides, formality: formalityProp, onVerified, onFailed, onEvent, source, consentChoice, diagnostics, }: VerificationFlowProps & {
|
|
6
6
|
purpose: Purpose;
|
|
7
7
|
consentChoice?: ConsentChoice | null;
|
|
8
8
|
}): {
|
|
9
|
+
formality: import("../i18n").Formality;
|
|
9
10
|
state: FlowState;
|
|
10
11
|
t: import("../i18n").Strings;
|
|
11
12
|
locale: import("../i18n").Locale;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type Locale, type StringOverrides, type Strings } from "../i18n";
|
|
1
|
+
import { type Formality, type Locale, type StringOverrides, type Strings } from "../i18n";
|
|
2
2
|
import type { RpidFlowEvent } from "../flows/types";
|
|
3
|
+
import type { ColorScheme } from "../theme/scheme";
|
|
3
4
|
export declare function readHandoffCode(search?: string, pathname?: string, hash?: string): string | null;
|
|
4
5
|
export interface ContinueFlowProps {
|
|
5
6
|
apiUrl: string;
|
|
@@ -7,6 +8,8 @@ export interface ContinueFlowProps {
|
|
|
7
8
|
modelsUrl?: string;
|
|
8
9
|
locale?: Locale;
|
|
9
10
|
strings?: StringOverrides;
|
|
11
|
+
formality?: Formality;
|
|
12
|
+
colorScheme?: ColorScheme;
|
|
10
13
|
privacyNote?: string | null;
|
|
11
14
|
source?: "camera" | "demo";
|
|
12
15
|
debug?: boolean;
|
|
@@ -16,7 +19,7 @@ export interface ContinueFlowProps {
|
|
|
16
19
|
reason: string | null;
|
|
17
20
|
}) => void;
|
|
18
21
|
}
|
|
19
|
-
export declare function ContinueFlow({ apiUrl, code, modelsUrl, locale: hostLocale, strings, privacyNote, source, debug, onEvent, onDone, }: ContinueFlowProps): import("react").JSX.Element;
|
|
22
|
+
export declare function ContinueFlow({ apiUrl, code, modelsUrl, locale: hostLocale, strings, formality, colorScheme, privacyNote, source, debug, onEvent, onDone, }: ContinueFlowProps): import("react").JSX.Element;
|
|
20
23
|
export declare function ContinueConfirmView({ t, tenant, codeHint, onContinue }: {
|
|
21
24
|
t: Strings;
|
|
22
25
|
tenant: string;
|