@baas-id/react 0.2.9 → 0.3.1
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/README.md +2 -2
- package/THIRD_PARTY_NOTICES.md +1 -0
- package/dist/esm/baas-id-react.css +1 -1
- package/dist/esm/chunks/ContinueFlow-mqBIxnlp.js +9327 -0
- package/dist/esm/continue.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/preview.js +22 -22
- package/dist/esm/workers/{detector.worker-DtuL8TFY.js → detector.worker-DrerkwUk.js} +1054 -1054
- package/dist/types/react/capture/api.d.ts +13 -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 +1 -1
- package/dist/types/react/document/CardFrame.d.ts +11 -0
- package/dist/types/react/document/DocumentParts.d.ts +4 -0
- package/dist/types/react/document/cornerOrder.d.ts +11 -2
- 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 +1 -1
- package/dist/types/react/document/steady.d.ts +1 -0
- package/dist/types/react/document/track.d.ts +5 -0
- package/dist/types/react/document/useDocumentCapture.d.ts +3 -0
- package/dist/types/react/face/FaceGuide.d.ts +3 -1
- package/dist/types/react/face/faceFollow.d.ts +32 -0
- package/dist/types/react/handoff/ContinueFlow.d.ts +5 -1
- package/dist/types/react/handoff/ContinueOnPhone.d.ts +11 -2
- package/dist/types/react/handoff/api.d.ts +10 -1
- package/dist/types/react/handoff/phoneLink.d.ts +7 -0
- package/dist/types/react/i18n/types.d.ts +23 -0
- package/dist/types/react/telemetry/bus.d.ts +1 -1
- package/dist/types/react/version.d.ts +1 -1
- 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 +10 -2
- package/dist/types/react/vision/types.d.ts +10 -1
- package/package.json +1 -1
- package/dist/esm/chunks/ContinueFlow-APeYfGFQ.js +0 -8359
|
@@ -24,6 +24,18 @@ export declare function uploadCaptureSignal(cfg: RpidClientConfig, kind: "docume
|
|
|
24
24
|
export declare function uploadCapture(cfg: RpidClientConfig, kind: "document" | "face", blob: Blob, side?: "front" | "back", meta?: Record<string, unknown>, mrzReadings?: string[]): Promise<any>;
|
|
25
25
|
export declare function finalizeSessionSignal(cfg: RpidClientConfig, signal?: AbortSignal): Promise<any>;
|
|
26
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
|
+
}
|
|
27
39
|
export interface MrzProbe {
|
|
28
40
|
available: boolean;
|
|
29
41
|
mrz: {
|
|
@@ -36,6 +48,7 @@ export interface MrzProbe {
|
|
|
36
48
|
checks?: Record<string, boolean>;
|
|
37
49
|
failed?: string[];
|
|
38
50
|
fields?: Record<string, string | null>;
|
|
51
|
+
layout?: MrzLayout | null;
|
|
39
52
|
};
|
|
40
53
|
screen?: {
|
|
41
54
|
available: boolean;
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
export { uploadCapture, finalizeSession, probeDocument, uploadCaptureSignal, finalizeSessionSignal, probeDocumentSignal, errorCode, isAbort, rejectionOf, authenticityOf, apiHeaders, langHeaders, withLanguage, type RpidClientConfig, type MrzProbe, type CaptureUpload, type Rejection, type DocumentAuthenticity, } from "./api";
|
|
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
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";
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { Strings } from "../i18n";
|
|
2
|
+
import { type Quad } from "./overlay";
|
|
2
3
|
import type { QuadSource } from "./track";
|
|
3
4
|
export type FrameState = "searching" | "tracking" | "holding" | "locked";
|
|
5
|
+
export interface OutlinePath {
|
|
6
|
+
d: string;
|
|
7
|
+
length: number;
|
|
8
|
+
corners: Array<[number, number]>;
|
|
9
|
+
sides: number[];
|
|
10
|
+
}
|
|
11
|
+
export declare function outlinePath(q: Quad, radius: number): OutlinePath;
|
|
12
|
+
export type Dash = readonly [string, string];
|
|
13
|
+
export declare function dashOnly(from: number, to: number, length: number): Dash;
|
|
14
|
+
export declare function dashProgress(o: OutlinePath, pct: number): Dash;
|
|
4
15
|
export declare function CardFrame({ source, pct, state, label, t, }: {
|
|
5
16
|
source: QuadSource | null;
|
|
6
17
|
pct: number;
|
|
@@ -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;
|
|
@@ -8,6 +8,8 @@ export declare function canonicalQuad(q: Quad): {
|
|
|
8
8
|
export declare function alignToPrevious(q: Quad, prev: Quad | null): Quad;
|
|
9
9
|
export declare function modelRotation(model: Quad, ordered: Quad): number | null;
|
|
10
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;
|
|
11
13
|
export declare class OrientationVote {
|
|
12
14
|
private readonly n;
|
|
13
15
|
private readonly share;
|
|
@@ -19,11 +21,18 @@ export declare class OrientationVote {
|
|
|
19
21
|
get value(): number | null;
|
|
20
22
|
shift(by: number): void;
|
|
21
23
|
reset(): void;
|
|
24
|
+
private held;
|
|
25
|
+
lock(k: number): void;
|
|
26
|
+
get locked(): boolean;
|
|
22
27
|
}
|
|
23
28
|
export declare class CornerOrder {
|
|
24
29
|
private prev;
|
|
25
30
|
readonly orient: OrientationVote;
|
|
26
|
-
read(raw: Quad, fromModel: boolean): Quad;
|
|
31
|
+
read(raw: Quad, fromModel: boolean, orient?: readonly number[] | null): Quad;
|
|
32
|
+
private canonLock;
|
|
27
33
|
rotationFor(stable: Quad): number;
|
|
28
|
-
|
|
34
|
+
settle(held: Quad, k: number): number;
|
|
35
|
+
flip(stable: Quad): number;
|
|
36
|
+
orientQuad(q: Quad): Quad;
|
|
37
|
+
reset(full?: boolean): void;
|
|
29
38
|
}
|
|
@@ -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 {
|
|
@@ -10,7 +10,7 @@ export declare class CaptureStats {
|
|
|
10
10
|
private coach;
|
|
11
11
|
private mode;
|
|
12
12
|
constructor(t0: number);
|
|
13
|
-
frame(found: boolean, confidence: number, veto?: "geometry" | "edges" | "content"): void;
|
|
13
|
+
frame(found: boolean, confidence: number, veto?: "geometry" | "edges" | "content" | "face", relaxed?: "held" | "stable"): void;
|
|
14
14
|
outline(mode: "edges" | "box" | null): void;
|
|
15
15
|
tick(gate: Gate | null, pFront: number | null, motion: number | null, stillOk: boolean | null, hold: number, coach: string): void;
|
|
16
16
|
searching(coach: string): void;
|
|
@@ -19,6 +19,8 @@ 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;
|
|
22
24
|
export declare const FLIP_MANUAL_MS = 15000;
|
|
23
25
|
export declare function cutUpload(full: HTMLCanvasElement, b: Box): HTMLCanvasElement;
|
|
24
26
|
export interface UploadCandidate {
|
|
@@ -67,6 +69,7 @@ export declare function useDocumentCapture(props: DocumentCaptureProps): {
|
|
|
67
69
|
checks?: Record<string, boolean>;
|
|
68
70
|
failed?: string[];
|
|
69
71
|
fields?: Record<string, string | null>;
|
|
72
|
+
layout?: import("../capture").MrzLayout | null;
|
|
70
73
|
} | null;
|
|
71
74
|
mrzStage: MrzStage;
|
|
72
75
|
retry: () => void;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { GuideKey, Strings } from "../i18n";
|
|
2
2
|
import { type Ellipse } from "./faceView";
|
|
3
|
+
import type { PointsMotion } from "../document/track";
|
|
3
4
|
import { type ScanState } from "./scanState";
|
|
4
5
|
export type FaceGuideState = "neutral" | "aligned" | "capturing" | "done" | "warn";
|
|
5
6
|
export type FaceCue = "turn_left" | "turn_right" | "move_closer" | null;
|
|
6
|
-
export declare function FaceGuide({ src, oval, state, scan, fills, progress, cue, guide, errorKey, t, }: {
|
|
7
|
+
export declare function FaceGuide({ src, oval, state, scan, fills, progress, cue, guide, errorKey, t, motion, }: {
|
|
8
|
+
motion?: PointsMotion | null;
|
|
7
9
|
src: {
|
|
8
10
|
w: number;
|
|
9
11
|
h: 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
|
+
}
|
|
@@ -26,6 +26,10 @@ export declare function ContinueConfirmView({ t, tenant, codeHint, onContinue }:
|
|
|
26
26
|
codeHint: string;
|
|
27
27
|
onContinue?: () => void;
|
|
28
28
|
}): import("react").JSX.Element;
|
|
29
|
-
export
|
|
29
|
+
export type DoneStep = "front" | "back" | "face";
|
|
30
|
+
export declare function ContinueDoneView({ t, tenant, codeHint, steps }: {
|
|
30
31
|
t: Strings;
|
|
32
|
+
tenant?: string | null;
|
|
33
|
+
codeHint?: string | null;
|
|
34
|
+
steps?: readonly DoneStep[];
|
|
31
35
|
}): import("react").JSX.Element;
|
|
@@ -19,10 +19,11 @@ export interface HandoffPanelProps {
|
|
|
19
19
|
onResult: (result: VerificationResult) => void;
|
|
20
20
|
onContinueHere?: () => void;
|
|
21
21
|
onError?: (code: string) => void;
|
|
22
|
+
onFailed?: (code: string, detail?: unknown) => void;
|
|
22
23
|
onEvent?: (e: RpidFlowEvent) => void;
|
|
23
24
|
pollMs?: number;
|
|
24
25
|
}
|
|
25
|
-
export declare function HandoffPanel({ config, t, mode, copy, onResult, onContinueHere, onError, onEvent, pollMs, }: HandoffPanelProps): import("react").JSX.Element;
|
|
26
|
+
export declare function HandoffPanel({ config, t, mode, copy, onResult, onContinueHere, onError, onFailed, onEvent, pollMs, }: HandoffPanelProps): import("react").JSX.Element;
|
|
26
27
|
export interface HandoffViewProps {
|
|
27
28
|
t: Strings;
|
|
28
29
|
mode: HandoffMode;
|
|
@@ -42,8 +43,15 @@ export interface HandoffViewProps {
|
|
|
42
43
|
onCopy?: () => void;
|
|
43
44
|
onNewCode?: () => void;
|
|
44
45
|
onContinueHere?: () => void;
|
|
46
|
+
stopped?: {
|
|
47
|
+
kind: "failed" | "abandoned";
|
|
48
|
+
title: string | null;
|
|
49
|
+
body: string | null;
|
|
50
|
+
final: boolean;
|
|
51
|
+
} | null;
|
|
52
|
+
onAgain?: () => void;
|
|
45
53
|
}
|
|
46
|
-
export declare function HandoffView({ t, mode, copy, link, leftMs, expired, failed, phase, device, copied, linkId, onCopy, onNewCode, onContinueHere, }: HandoffViewProps): import("react").JSX.Element;
|
|
54
|
+
export declare function HandoffView({ t, mode, copy, link, leftMs, expired, failed, phase, device, copied, linkId, onCopy, onNewCode, onContinueHere, stopped, onAgain, }: HandoffViewProps): import("react").JSX.Element;
|
|
47
55
|
export declare function CodeChip({ t, code, instruction }: {
|
|
48
56
|
t: Strings;
|
|
49
57
|
code: string;
|
|
@@ -60,6 +68,7 @@ export interface ContinueOnPhoneProps {
|
|
|
60
68
|
onResult: (result: VerificationResult) => void;
|
|
61
69
|
onContinueHere?: () => void;
|
|
62
70
|
onError?: (code: string) => void;
|
|
71
|
+
onFailed?: (code: string, detail?: unknown) => void;
|
|
63
72
|
onEvent?: (e: RpidFlowEvent) => void;
|
|
64
73
|
appearance?: Appearance | null;
|
|
65
74
|
colorScheme?: ColorScheme;
|
|
@@ -10,7 +10,7 @@ export interface HandoffCode {
|
|
|
10
10
|
codeHint: string;
|
|
11
11
|
tenant: string;
|
|
12
12
|
}
|
|
13
|
-
export type HandoffPhase = "waiting" | "connected" | "capturing" | "finished";
|
|
13
|
+
export type HandoffPhase = "waiting" | "connected" | "capturing" | "finished" | "failed" | "abandoned";
|
|
14
14
|
export interface HandoffStatus {
|
|
15
15
|
status: "none" | "pending" | "claimed" | "expired" | "revoked";
|
|
16
16
|
phase: HandoffPhase | null;
|
|
@@ -20,6 +20,10 @@ export interface HandoffStatus {
|
|
|
20
20
|
claimedAt: string | null;
|
|
21
21
|
result: Json | null;
|
|
22
22
|
sessionExpired: boolean;
|
|
23
|
+
reason: string | null;
|
|
24
|
+
reasonTitle: string | null;
|
|
25
|
+
reasonDescription: string | null;
|
|
26
|
+
final: boolean;
|
|
23
27
|
}
|
|
24
28
|
export declare function createHandoff(cfg: RpidClientConfig, device?: string, signal?: AbortSignal): Promise<HandoffCode>;
|
|
25
29
|
export declare function handoffStatus(cfg: RpidClientConfig, signal?: AbortSignal): Promise<HandoffStatus>;
|
|
@@ -41,6 +45,11 @@ export interface CallLanguage {
|
|
|
41
45
|
export declare function peekHandoff(apiUrl: string, code: string, signal?: AbortSignal, lang?: CallLanguage): Promise<HandoffPeek>;
|
|
42
46
|
export declare function claimHandoff(apiUrl: string, code: string, device?: string, signal?: AbortSignal, lang?: CallLanguage): Promise<Json>;
|
|
43
47
|
export declare function reportProgress(cfg: RpidClientConfig, step: "front" | "back" | "face"): Promise<void>;
|
|
48
|
+
export declare function reportPhone(cfg: RpidClientConfig, event: "heartbeat" | "failed" | "abandoned", info?: {
|
|
49
|
+
step?: "front" | "back" | "face";
|
|
50
|
+
reason?: string;
|
|
51
|
+
final?: boolean;
|
|
52
|
+
}, beacon?: boolean): void;
|
|
44
53
|
export declare function postDevice(cfg: RpidClientConfig, snapshot: DeviceSnapshot): Promise<void>;
|
|
45
54
|
export declare function postClientEvents(cfg: RpidClientConfig, events: ClientEvent[], beacon?: boolean): void;
|
|
46
55
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RpidClientConfig } from "../capture";
|
|
2
|
+
export declare const HEARTBEAT_MS = 10000;
|
|
3
|
+
export interface PhoneFailure {
|
|
4
|
+
reason: string;
|
|
5
|
+
final: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function usePhoneLink(cfg: RpidClientConfig | null, step: "front" | "back" | "face" | null, failure: PhoneFailure | null, finished: boolean): void;
|
|
@@ -120,6 +120,14 @@ export interface Strings {
|
|
|
120
120
|
fieldNumber: string;
|
|
121
121
|
fieldBirth: string;
|
|
122
122
|
fieldExpiry: string;
|
|
123
|
+
fieldNationality: string;
|
|
124
|
+
regionMrz: string;
|
|
125
|
+
mrzReading: string;
|
|
126
|
+
mrzDetected: string;
|
|
127
|
+
mrzVerified: string;
|
|
128
|
+
mrzUnreadable: string;
|
|
129
|
+
mrzNone: string;
|
|
130
|
+
turnedUpright: string;
|
|
123
131
|
};
|
|
124
132
|
retake: {
|
|
125
133
|
action: string;
|
|
@@ -190,6 +198,21 @@ export interface Strings {
|
|
|
190
198
|
capturing: string;
|
|
191
199
|
finished: string;
|
|
192
200
|
keepOpen: string;
|
|
201
|
+
phoneFailedTitle: string;
|
|
202
|
+
phoneFailedBody: string;
|
|
203
|
+
retryOnPhone: string;
|
|
204
|
+
useThisComputer: string;
|
|
205
|
+
phoneClosedTitle: string;
|
|
206
|
+
phoneClosedBody: string;
|
|
207
|
+
resumeOnPhone: string;
|
|
208
|
+
continueHereShort: string;
|
|
209
|
+
doneHeading: string;
|
|
210
|
+
doneSent: string;
|
|
211
|
+
doneOnComputer: string;
|
|
212
|
+
doneFor: string;
|
|
213
|
+
doneCode: string;
|
|
214
|
+
doneClose: string;
|
|
215
|
+
doneCloseHint: string;
|
|
193
216
|
stepWaiting: string;
|
|
194
217
|
stepConnected: string;
|
|
195
218
|
stepCapturing: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ClientEventType = "camera_permission" | "camera_error" | "camera_not_found" | "camera_started" | "model_load_start" | "model_load_done" | "model_load_failed" | "model_load_timeout" | "engine_unavailable" | "visibility" | "step_shown" | "retry" | "abandoned" | "flow_failed" | "handoff_shown" | "continue_here" | "capture_review_shown" | "capture_confirmed" | "capture_retaken" | "detector_stats" | "detector_summary";
|
|
1
|
+
export type ClientEventType = "camera_permission" | "camera_error" | "camera_not_found" | "camera_started" | "model_load_start" | "model_load_done" | "model_load_failed" | "model_load_timeout" | "engine_unavailable" | "visibility" | "step_shown" | "retry" | "abandoned" | "flow_failed" | "handoff_shown" | "continue_here" | "capture_review_shown" | "capture_confirmed" | "capture_retaken" | "detector_stats" | "detector_summary" | "orientation_fixed" | "face_tracking";
|
|
2
2
|
export interface ClientEvent {
|
|
3
3
|
type: ClientEventType;
|
|
4
4
|
t?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.
|
|
1
|
+
export declare const SDK_VERSION = "0.3.1";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const MODELS_VERSION = "v-
|
|
1
|
+
export declare const MODELS_VERSION = "v-9debdb36923f";
|
|
2
2
|
export declare const MODELS_CDN = "https://baaslatam.com/sdk-models";
|
|
3
|
-
export declare const DEFAULT_MODELS_URL = "https://baaslatam.com/sdk-models/v-
|
|
3
|
+
export declare const DEFAULT_MODELS_URL = "https://baaslatam.com/sdk-models/v-9debdb36923f";
|
|
4
4
|
export declare const modelsUrlOf: (url?: string | null) => string;
|
|
@@ -11,11 +11,14 @@ export interface TinyPhases {
|
|
|
11
11
|
where: "worker" | "main";
|
|
12
12
|
backendName: string;
|
|
13
13
|
}
|
|
14
|
+
export interface TinyOut {
|
|
15
|
+
hm: Float32Array;
|
|
16
|
+
side: Float32Array;
|
|
17
|
+
orient?: Float32Array;
|
|
18
|
+
}
|
|
14
19
|
export interface TinyCore {
|
|
15
|
-
run(pixels: Parameters<TF["browser"]["fromPixels"]>[0]): Promise<
|
|
16
|
-
hm: Float32Array;
|
|
17
|
-
side: Float32Array;
|
|
18
|
-
}>;
|
|
20
|
+
run(pixels: Parameters<TF["browser"]["fromPixels"]>[0]): Promise<TinyOut>;
|
|
19
21
|
phases: TinyPhases;
|
|
20
22
|
}
|
|
21
23
|
export declare function loadTinyCore(tf: TF, urls: string[], where: "worker" | "main", blank: () => Parameters<TF["browser"]["fromPixels"]>[0], onProgress?: (f: number) => void, backends?: string[]): Promise<TinyCore>;
|
|
24
|
+
export declare function sortOutputs(data: Float32Array[]): TinyOut;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { type Quad } from "./corners";
|
|
2
2
|
import type { CardDetection, DocumentEngine, ProgressFn } from "./types";
|
|
3
|
-
export declare const TINY_FOLDERS: readonly ["card-tinydet-r4"];
|
|
3
|
+
export declare const TINY_FOLDERS: readonly ["card-tinydet-r6", "card-tinydet-r4"];
|
|
4
|
+
export declare const RELAX_STREAK = 3;
|
|
5
|
+
export declare const RELAX_MOTION = 0.04;
|
|
6
|
+
export declare const RELAX_DETAIL = 0.25;
|
|
7
|
+
export declare const RELAX_SIDES = 2;
|
|
8
|
+
export declare const FACE_FILL_MAX = 0.2;
|
|
9
|
+
export declare const ORIENT_VOTE_MIN = 0.6;
|
|
4
10
|
export declare const TINY_INPUT = 224;
|
|
5
11
|
export declare const TINY_GRID = 28;
|
|
6
12
|
export declare const FOUND_PEAK = 0.03;
|
|
@@ -20,14 +26,16 @@ export interface CornerPeak {
|
|
|
20
26
|
}
|
|
21
27
|
export declare function decodeHeatmaps(hm: ArrayLike<number>, G?: number): CornerPeak[];
|
|
22
28
|
export declare function frontProbability(logits: ArrayLike<number>): number;
|
|
29
|
+
export declare function orientProbabilities(logits: ArrayLike<number> | undefined | null): [number, number, number, number] | null;
|
|
23
30
|
export interface TinyReading {
|
|
24
31
|
quad: Quad;
|
|
25
32
|
conf: [number, number, number, number];
|
|
26
33
|
pFront: number;
|
|
27
34
|
found: boolean;
|
|
28
35
|
present: boolean;
|
|
36
|
+
orient: [number, number, number, number] | null;
|
|
29
37
|
}
|
|
30
|
-
export declare function readTiny(hm: ArrayLike<number>, sideLogits: ArrayLike<number>, w: number, h: number): TinyReading;
|
|
38
|
+
export declare function readTiny(hm: ArrayLike<number>, sideLogits: ArrayLike<number>, w: number, h: number, orientLogits?: ArrayLike<number> | null): TinyReading;
|
|
31
39
|
export declare function plausible(q: Quad, w: number, h: number): boolean;
|
|
32
40
|
export declare function tinyDetection(r: TinyReading, w: number, h: number, ms?: number): CardDetection;
|
|
33
41
|
export declare function rectifyCanvas(crop: HTMLCanvasElement, quad: Quad, margin: number, maxLong: number): HTMLCanvasElement;
|
|
@@ -13,7 +13,8 @@ export interface CardDetection {
|
|
|
13
13
|
};
|
|
14
14
|
weak?: boolean;
|
|
15
15
|
corners?: FrameCorners;
|
|
16
|
-
veto?: "geometry" | "edges" | "content";
|
|
16
|
+
veto?: "geometry" | "edges" | "content" | "face";
|
|
17
|
+
relaxed?: "held" | "stable";
|
|
17
18
|
}
|
|
18
19
|
export interface SideResult {
|
|
19
20
|
isFront: boolean;
|
|
@@ -40,11 +41,19 @@ export interface DocumentEngine {
|
|
|
40
41
|
detectCard(source: HTMLCanvasElement | HTMLVideoElement, srcW?: number, srcH?: number, opts?: DetectOptions): Promise<CardDetection>;
|
|
41
42
|
rectify(crop: HTMLCanvasElement, quad: Quad, margin: number, maxLong: number): Promise<HTMLCanvasElement>;
|
|
42
43
|
classifySide(crop: HTMLCanvasElement): Promise<SideResult>;
|
|
44
|
+
cropTurn?(card: HTMLCanvasElement): Promise<{
|
|
45
|
+
upsideDown: boolean;
|
|
46
|
+
margin: number;
|
|
47
|
+
} | null>;
|
|
43
48
|
}
|
|
44
49
|
export interface DetectOptions {
|
|
45
50
|
corners?: {
|
|
46
51
|
ks: number;
|
|
47
52
|
hint?: Quad | null;
|
|
53
|
+
faces?: (source: HTMLCanvasElement) => Promise<Array<{
|
|
54
|
+
topLeft: [number, number];
|
|
55
|
+
bottomRight: [number, number];
|
|
56
|
+
}>>;
|
|
48
57
|
};
|
|
49
58
|
}
|
|
50
59
|
export interface FaceEngine {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baas-id/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "BaaS identity verification for React: guided ID and face capture with on-device quality gating, server-side verdicts, phone handoff. Requires a BaaS account.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "BaaS, S.A.",
|