@baas-id/react 0.2.2 → 0.2.9
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 +10 -6
- package/THIRD_PARTY_NOTICES.md +7 -5
- package/dist/esm/baas-id-react.css +1 -1
- package/dist/esm/chunks/ContinueFlow-APeYfGFQ.js +8359 -0
- package/dist/esm/continue.js +1 -1
- package/dist/esm/index.js +129 -147
- package/dist/esm/preview.js +183 -225
- 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 +5 -0
- package/dist/types/react/capture/camera.d.ts +1 -0
- package/dist/types/react/capture/index.d.ts +2 -2
- package/dist/types/react/document/cornerOrder.d.ts +29 -0
- package/dist/types/react/document/gate.d.ts +5 -1
- package/dist/types/react/document/stats.d.ts +20 -0
- package/dist/types/react/document/steady.d.ts +89 -0
- package/dist/types/react/document/upright.d.ts +5 -0
- package/dist/types/react/document/useDocumentCapture.d.ts +2 -0
- package/dist/types/react/face/FaceGuide.d.ts +1 -3
- 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 +7 -0
- package/dist/types/react/handoff/api.d.ts +8 -3
- 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 +6 -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/modelsCdn.d.ts +2 -2
- package/dist/types/react/vision/types.d.ts +2 -0
- package/package.json +7 -7
- package/dist/esm/chunks/ContinueFlow-YFSpSOio.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
|
@@ -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 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";
|
|
@@ -0,0 +1,29 @@
|
|
|
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 class OrientationVote {
|
|
12
|
+
private readonly n;
|
|
13
|
+
private readonly share;
|
|
14
|
+
private readonly min;
|
|
15
|
+
private xs;
|
|
16
|
+
private k;
|
|
17
|
+
constructor(n?: number, share?: number, min?: number);
|
|
18
|
+
push(k: number | null): number | null;
|
|
19
|
+
get value(): number | null;
|
|
20
|
+
shift(by: number): void;
|
|
21
|
+
reset(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare class CornerOrder {
|
|
24
|
+
private prev;
|
|
25
|
+
readonly orient: OrientationVote;
|
|
26
|
+
read(raw: Quad, fromModel: boolean): Quad;
|
|
27
|
+
rotationFor(stable: Quad): number;
|
|
28
|
+
reset(): void;
|
|
29
|
+
}
|
|
@@ -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";
|
|
@@ -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,89 @@
|
|
|
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
|
+
filter(q: Quad, t: number): Quad;
|
|
88
|
+
reset(): void;
|
|
89
|
+
}
|
|
@@ -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,7 @@ 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 FLIP_MANUAL_MS = 15000;
|
|
22
23
|
export declare function cutUpload(full: HTMLCanvasElement, b: Box): HTMLCanvasElement;
|
|
23
24
|
export interface UploadCandidate {
|
|
24
25
|
canvas: HTMLCanvasElement;
|
|
@@ -72,6 +73,7 @@ export declare function useDocumentCapture(props: DocumentCaptureProps): {
|
|
|
72
73
|
retriesLeft: number | null;
|
|
73
74
|
final: boolean;
|
|
74
75
|
manualReady: boolean;
|
|
76
|
+
manualOnly: boolean;
|
|
75
77
|
shutter: () => void | undefined;
|
|
76
78
|
review: ReviewView | null;
|
|
77
79
|
snapshot: Snapshot | null;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import type { GuideKey, Strings } from "../i18n";
|
|
2
2
|
import { type Ellipse } from "./faceView";
|
|
3
|
-
import type { PointsMotion } from "../document/track";
|
|
4
3
|
import { type ScanState } from "./scanState";
|
|
5
4
|
export type FaceGuideState = "neutral" | "aligned" | "capturing" | "done" | "warn";
|
|
6
5
|
export type FaceCue = "turn_left" | "turn_right" | "move_closer" | null;
|
|
7
|
-
export declare function FaceGuide({ src, oval,
|
|
6
|
+
export declare function FaceGuide({ src, oval, state, scan, fills, progress, cue, guide, errorKey, t, }: {
|
|
8
7
|
src: {
|
|
9
8
|
w: number;
|
|
10
9
|
h: number;
|
|
11
10
|
};
|
|
12
11
|
oval: Ellipse;
|
|
13
|
-
motion: PointsMotion;
|
|
14
12
|
state: FaceGuideState;
|
|
15
13
|
scan: ScanState;
|
|
16
14
|
fills: number[];
|
|
@@ -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;
|
|
@@ -4,6 +4,7 @@ import type { RpidClientConfig } from "../capture";
|
|
|
4
4
|
import type { ApiSessionBody, Purpose, RpidFlowEvent, RpidSession, VerificationResult } from "../flows/types";
|
|
5
5
|
import { type Locale, type StringOverrides } from "../i18n";
|
|
6
6
|
import type { Appearance } from "../theme/appearance";
|
|
7
|
+
import type { ColorScheme } from "../theme/scheme";
|
|
7
8
|
export type HandoffMode = "auto" | "suggest";
|
|
8
9
|
export interface HandoffCopy {
|
|
9
10
|
title?: string;
|
|
@@ -43,6 +44,11 @@ export interface HandoffViewProps {
|
|
|
43
44
|
onContinueHere?: () => void;
|
|
44
45
|
}
|
|
45
46
|
export declare function HandoffView({ t, mode, copy, link, leftMs, expired, failed, phase, device, copied, linkId, onCopy, onNewCode, onContinueHere, }: HandoffViewProps): import("react").JSX.Element;
|
|
47
|
+
export declare function CodeChip({ t, code, instruction }: {
|
|
48
|
+
t: Strings;
|
|
49
|
+
code: string;
|
|
50
|
+
instruction: string;
|
|
51
|
+
}): import("react").JSX.Element;
|
|
46
52
|
export interface ContinueOnPhoneProps {
|
|
47
53
|
apiUrl: string;
|
|
48
54
|
session: RpidSession | ApiSessionBody;
|
|
@@ -56,5 +62,6 @@ export interface ContinueOnPhoneProps {
|
|
|
56
62
|
onError?: (code: string) => void;
|
|
57
63
|
onEvent?: (e: RpidFlowEvent) => void;
|
|
58
64
|
appearance?: Appearance | null;
|
|
65
|
+
colorScheme?: ColorScheme;
|
|
59
66
|
}
|
|
60
67
|
export declare function ContinueOnPhone(props: ContinueOnPhoneProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type RpidClientConfig } from "../capture/api";
|
|
2
2
|
import type { ClientEvent } from "../telemetry/bus";
|
|
3
3
|
import type { DeviceSnapshot } from "../telemetry/device";
|
|
4
4
|
type Json = Record<string, unknown>;
|
|
@@ -31,10 +31,15 @@ export interface HandoffPeek {
|
|
|
31
31
|
expiresInS: number;
|
|
32
32
|
purpose: string;
|
|
33
33
|
locale?: string;
|
|
34
|
+
formality?: "formal" | "informal";
|
|
34
35
|
appearance?: unknown;
|
|
35
36
|
}
|
|
36
|
-
export
|
|
37
|
-
|
|
37
|
+
export interface CallLanguage {
|
|
38
|
+
locale?: string;
|
|
39
|
+
formality?: "formal" | "informal";
|
|
40
|
+
}
|
|
41
|
+
export declare function peekHandoff(apiUrl: string, code: string, signal?: AbortSignal, lang?: CallLanguage): Promise<HandoffPeek>;
|
|
42
|
+
export declare function claimHandoff(apiUrl: string, code: string, device?: string, signal?: AbortSignal, lang?: CallLanguage): Promise<Json>;
|
|
38
43
|
export declare function reportProgress(cfg: RpidClientConfig, step: "front" | "back" | "face"): Promise<void>;
|
|
39
44
|
export declare function postDevice(cfg: RpidClientConfig, snapshot: DeviceSnapshot): Promise<void>;
|
|
40
45
|
export declare function postClientEvents(cfg: RpidClientConfig, events: ClientEvent[], beacon?: boolean): void;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { Locale, ReasonEntry, StringOverrides, Strings } from "./types";
|
|
2
|
-
export type { TeleRecipe, Locale, ClientReason, ServerReason, Reason, Recovery, ReasonEntry, GuideKey, EngineStage, DistanceHint, Strings, StringOverrides, } from "./types";
|
|
1
|
+
import type { Formality, Locale, ReasonEntry, StringOverrides, Strings } from "./types";
|
|
2
|
+
export type { TeleRecipe, Locale, ClientReason, ServerReason, Reason, Recovery, ReasonEntry, GuideKey, EngineStage, DistanceHint, Strings, StringOverrides, Formality, } from "./types";
|
|
3
|
+
export { ES_FORMAL } from "./es-419-formal";
|
|
3
4
|
export declare const DEFAULT_LOCALE: Locale;
|
|
4
|
-
export declare function getStrings(locale?: Locale, overrides?: StringOverrides): Strings;
|
|
5
|
-
export declare function reasonEntry(code: string | null | undefined, locale?: Locale, overrides?: StringOverrides): ReasonEntry;
|
|
5
|
+
export declare function getStrings(locale?: Locale, overrides?: StringOverrides, formality?: Formality): Strings;
|
|
6
|
+
export declare function reasonEntry(code: string | null | undefined, locale?: Locale, overrides?: StringOverrides, formality?: Formality): ReasonEntry;
|
|
6
7
|
export declare function attemptsText(t: Strings, retriesLeft: number | null | undefined): string | null;
|
|
7
8
|
export declare function faceRetryText(t: Strings, retriesLeft: number): string;
|
|
8
9
|
export declare const LOCALES: readonly Locale[];
|
|
10
|
+
export declare function formalityOverrides(locale: Locale, formality?: Formality | null): StringOverrides | undefined;
|
|
9
11
|
export declare function browserLocale(languages?: readonly string[]): Locale | undefined;
|
|
10
12
|
export declare function resolveLocale(host?: Locale | null, tenant?: Locale | "auto" | null, languages?: readonly string[]): Locale;
|
|
@@ -2,13 +2,14 @@ export type Locale = "en" | "es-419";
|
|
|
2
2
|
export type ClientReason = "CAMERA_UNAVAILABLE" | "ENGINE_UNAVAILABLE" | "UPLOAD_FAILED" | "SESSION_OPEN_FAILED" | "MOVEMENT_TIMEOUT" | "RECENTER_TIMEOUT" | "MOIRE_SUSPECTED" | "SPOOF_SUSPECTED" | "MOVEMENT_DISCONTINUOUS" | "PATTERN_SUSPECTED" | "LOW_QUALITY" | "DOC_DAMAGED_REPEATED";
|
|
3
3
|
export type ServerReason = "DOC_QUALITY_LOW" | "DOC_SIDE_MISMATCH" | "PORTRAIT_NOT_FOUND" | "FACE_MISMATCH" | "TEMPLATE_STALE" | "FACE_NOT_FOUND" | "FACE_MISSING" | "DOCUMENT_MISSING" | "PAD_REJECTED" | "NOT_ENROLLED" | "ALREADY_ENROLLED" | "SESSION_EXPIRED" | "SESSION_FINALIZED" | "SESSION_NOT_FOUND" | "WRONG_PURPOSE" | "CAPTURE_TOKEN_INVALID" | "CAPTURE_TOKEN_EXPIRED" | "CAPTURE_TOKEN_SESSION_MISMATCH" | "CREDENTIALS_REQUIRED" | "INVALID_API_KEY" | "RPID_UNREACHABLE" | "RETRIES_EXHAUSTED" | "FACE_RETRY" | "AI_ASSESSMENT" | "DOC_SCREEN_REPLAY" | "DOC_PAPER_COPY" | "DOC_TAMPERED" | "DOC_DAMAGED" | "DOC_SIDES_INCONSISTENT" | "DOC_FIELDS_CHANGED" | "DUPLICATE_SUSPECT" | "MATCH_FOUND" | "NO_MATCH" | "AMBIGUOUS_MATCH" | "DOC_BACK_MISMATCH" | "DOC_BACK_UNREADABLE" | "REPLAY_SUSPECTED" | "INJECTION_SUSPECTED" | "CHALLENGE_UNVERIFIED" | "PAD_SUSPECTED" | "HANDOFF_CODE_INVALID" | "HANDOFF_CODE_EXPIRED" | "HANDOFF_CODE_USED" | "HANDOFF_REVOKED" | "HANDOFF_ACTIVE" | "HANDOFF_DISABLED" | "HANDOFF_ALREADY_CLAIMED" | "HANDOFF_RATE_LIMITED" | "CAPTURE_TOKEN_REVOKED";
|
|
4
4
|
export type Reason = ClientReason | ServerReason;
|
|
5
|
+
export type Formality = "informal" | "formal";
|
|
5
6
|
export type Recovery = "retry" | "restart" | "support";
|
|
6
7
|
export interface ReasonEntry {
|
|
7
8
|
message: string;
|
|
8
9
|
recovery: Recovery;
|
|
9
10
|
title?: string;
|
|
10
11
|
}
|
|
11
|
-
export type GuideKey = "no_face" | "no_card" | "too_dark" | "too_bright" | "hold_still" | "move_closer" | "move_back" | "recenter" | "perfect" | "ready" | "find_light" | "look_straight" | "loading" | "too_far" | "bad_framing" | "screen_suspected" | "paper_suspected" | "tilt_less" | "low_contrast" | "wrong_side_front" | "wrong_side_back" | "blurred" | "glare" | "steady" | "uploading" | "mrz_reading" | "mrz_unreadable" | "mrz_verified" | "closer_more" | "done_short" | "abrupt" | "a_bit_more" | "nod_start" | "nod_return" | "turn_left" | "turn_right" | "turn_wrong_left" | "turn_wrong_right" | "turn_slower" | "turn_lost" | "turn_return_center" | "turn_done" | "turn_hold_steady" | "turn_going_well" | "turn_almost" | "turn_complete" | "recenter_front" | "recenter_center" | "try_other_movement";
|
|
12
|
+
export type GuideKey = "no_face" | "no_card" | "too_dark" | "too_bright" | "hold_still" | "move_closer" | "move_back" | "recenter" | "perfect" | "ready" | "find_light" | "look_straight" | "loading" | "too_far" | "bad_framing" | "screen_suspected" | "paper_suspected" | "tilt_less" | "low_contrast" | "wrong_side_front" | "wrong_side_back" | "turn_over" | "blurred" | "glare" | "steady" | "uploading" | "mrz_reading" | "mrz_unreadable" | "mrz_verified" | "closer_more" | "done_short" | "abrupt" | "a_bit_more" | "nod_start" | "nod_return" | "turn_left" | "turn_right" | "turn_wrong_left" | "turn_wrong_right" | "turn_slower" | "turn_lost" | "turn_return_center" | "turn_done" | "turn_hold_steady" | "turn_going_well" | "turn_almost" | "turn_complete" | "recenter_front" | "recenter_center" | "try_other_movement";
|
|
12
13
|
export type EngineStage = "starting" | "downloading" | "warming" | "downloading_face" | "ready";
|
|
13
14
|
export type DistanceHint = "too_far" | "bit_far" | "ideal" | "bit_close" | "too_close";
|
|
14
15
|
export interface Strings {
|
|
@@ -104,6 +105,7 @@ export interface Strings {
|
|
|
104
105
|
reviewNone: string;
|
|
105
106
|
verify: string;
|
|
106
107
|
confirmed: string;
|
|
108
|
+
shutterManualNote: string;
|
|
107
109
|
confirmTitle: string;
|
|
108
110
|
confirmTitleFront: string;
|
|
109
111
|
confirmTitleBack: string;
|
|
@@ -201,6 +203,9 @@ export interface Strings {
|
|
|
201
203
|
doneTitle: string;
|
|
202
204
|
doneBody: string;
|
|
203
205
|
linkErrorTitle: string;
|
|
206
|
+
codeLabel: string;
|
|
207
|
+
codeConfirmDesktop: string;
|
|
208
|
+
codeConfirmPhone: string;
|
|
204
209
|
};
|
|
205
210
|
flow: {
|
|
206
211
|
stepFront: string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { type Locale } from "../i18n";
|
|
1
|
+
import { type Formality, type Locale } from "../i18n";
|
|
2
2
|
import { type TenantInstructions } from "../flows/experience";
|
|
3
3
|
import { type CaptureId } from "../flows/state";
|
|
4
4
|
import type { Purpose } from "../flows/types";
|
|
5
5
|
import { type Appearance } from "../theme/appearance";
|
|
6
|
+
import type { ColorScheme } from "../theme/scheme";
|
|
6
7
|
export type PreviewScreen = "intro" | "capture" | "success" | "error" | "handoff" | "continue" | "continueDone";
|
|
7
8
|
export interface PreviewHandoff {
|
|
8
9
|
mode?: "auto" | "suggest";
|
|
@@ -21,7 +22,9 @@ export interface FlowPreviewProps {
|
|
|
21
22
|
challenge?: PreviewChallenge;
|
|
22
23
|
purpose?: Purpose;
|
|
23
24
|
locale: Locale;
|
|
25
|
+
formality?: Formality;
|
|
24
26
|
appearance?: Appearance | null;
|
|
27
|
+
colorScheme?: ColorScheme;
|
|
25
28
|
instructions?: TenantInstructions | null;
|
|
26
29
|
messages?: unknown;
|
|
27
30
|
errorCode?: 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";
|
|
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";
|
|
2
2
|
export interface ClientEvent {
|
|
3
3
|
type: ClientEventType;
|
|
4
4
|
t?: number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from "react";
|
|
2
|
+
import { type ColorScheme } from "./scheme";
|
|
2
3
|
export type ColorKey = "primary" | "positive" | "caution" | "danger" | "surface" | "text" | "overlay";
|
|
3
4
|
export type SafeFont = "inherit" | "system" | "humanist" | "geometric" | "grotesque" | "rounded" | "serif";
|
|
4
5
|
export interface Appearance {
|
|
@@ -12,11 +13,12 @@ export interface Appearance {
|
|
|
12
13
|
mesh?: string;
|
|
13
14
|
};
|
|
14
15
|
lowLightFill?: boolean;
|
|
16
|
+
colorScheme?: ColorScheme;
|
|
15
17
|
}
|
|
16
18
|
export declare const FONT_STACKS: Record<SafeFont, string>;
|
|
17
19
|
export declare const SDK_DEFAULTS: Record<string, string>;
|
|
18
|
-
export declare function appearanceGroups(a: Appearance | null | undefined): Array<Record<string, string>>;
|
|
20
|
+
export declare function appearanceGroups(a: Appearance | null | undefined, scheme?: "light" | "dark"): Array<Record<string, string>>;
|
|
19
21
|
export declare function hostSet(name: string, computed: string | null | undefined): boolean;
|
|
20
|
-
export declare function appearanceStyle(a: Appearance | null | undefined, read?: (name: string) => string | null | undefined, force?: boolean): CSSProperties;
|
|
22
|
+
export declare function appearanceStyle(a: Appearance | null | undefined, read?: (name: string) => string | null | undefined, force?: boolean, scheme?: "light" | "dark"): CSSProperties;
|
|
21
23
|
export declare function safeLogoUrl(a: Appearance | null | undefined): string | null;
|
|
22
24
|
export declare function normalizeAppearance(raw: unknown): Appearance | undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Appearance } from "./appearance";
|
|
2
|
+
export type ColorScheme = "light" | "dark" | "auto";
|
|
3
|
+
export declare const DARK: {
|
|
4
|
+
readonly surface: "#0F1A21";
|
|
5
|
+
readonly ink: "#EEF3F5";
|
|
6
|
+
readonly muted: "#A9B8C0";
|
|
7
|
+
};
|
|
8
|
+
export declare const DARK_TEXT_MIN = 6;
|
|
9
|
+
export declare function mixHex(a: string, b: string, t: number): string;
|
|
10
|
+
export declare function liftOn(color: string, ground?: string, min?: number): string;
|
|
11
|
+
export declare function darkPalette(a?: Appearance | null): {
|
|
12
|
+
surface: "#0F1A21";
|
|
13
|
+
ink: "#EEF3F5";
|
|
14
|
+
muted: "#A9B8C0";
|
|
15
|
+
accent: string;
|
|
16
|
+
positive: string;
|
|
17
|
+
caution: string;
|
|
18
|
+
negative: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function darkGroups(a?: Appearance | null): Array<Record<string, string>>;
|
|
21
|
+
export declare const DARK_DERIVED: Record<string, string>;
|
|
22
|
+
export declare function useColorScheme(pref: ColorScheme | undefined): "light" | "dark";
|
|
23
|
+
export declare const isColorScheme: (v: unknown) => v is ColorScheme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.2.
|
|
1
|
+
export declare const SDK_VERSION = "0.2.9";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Quad } from "./corners";
|
|
2
|
+
export interface Rgba {
|
|
3
|
+
data: ArrayLike<number>;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
export interface Evidence {
|
|
8
|
+
sides: [number, number, number, number];
|
|
9
|
+
sidesOk: number;
|
|
10
|
+
detail: number;
|
|
11
|
+
isotropy: number;
|
|
12
|
+
vivid: number;
|
|
13
|
+
ok: boolean;
|
|
14
|
+
reason: "geometry" | "edges" | "content" | null;
|
|
15
|
+
}
|
|
16
|
+
export declare const SIDE_MIN = 0.4;
|
|
17
|
+
export declare const SIDES_NEEDED = 3;
|
|
18
|
+
export declare const AREA_MAX = 0.95;
|
|
19
|
+
export declare const DETAIL_MIN = 0.035;
|
|
20
|
+
export declare const ISOTROPY_MIN = 0.18;
|
|
21
|
+
export declare const VIVID_MAX = 0.45;
|
|
22
|
+
export declare function geometryOk(q: Quad, W: number, H: number): boolean;
|
|
23
|
+
export declare function sideEvidence(gray: Float32Array, W: number, H: number, q: Quad): [number, number, number, number];
|
|
24
|
+
export declare function contentEvidence(px: Rgba, q: Quad): {
|
|
25
|
+
detail: number;
|
|
26
|
+
isotropy: number;
|
|
27
|
+
vivid: number;
|
|
28
|
+
};
|
|
29
|
+
export declare function cardEvidence(px: Rgba, q: Quad, qFrame: Quad, frameW: number, frameH: number): Evidence;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const MODELS_VERSION = "v-
|
|
1
|
+
export declare const MODELS_VERSION = "v-68335fb410d8";
|
|
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-68335fb410d8";
|
|
4
4
|
export declare const modelsUrlOf: (url?: string | null) => string;
|
|
@@ -13,6 +13,7 @@ export interface CardDetection {
|
|
|
13
13
|
};
|
|
14
14
|
weak?: boolean;
|
|
15
15
|
corners?: FrameCorners;
|
|
16
|
+
veto?: "geometry" | "edges" | "content";
|
|
16
17
|
}
|
|
17
18
|
export interface SideResult {
|
|
18
19
|
isFront: boolean;
|
|
@@ -53,6 +54,7 @@ export interface FaceEngine {
|
|
|
53
54
|
rx: number;
|
|
54
55
|
ry: number;
|
|
55
56
|
}): Promise<FaceSignals>;
|
|
57
|
+
faces?(source: HTMLCanvasElement): Promise<import("./face").FaceDetection[]>;
|
|
56
58
|
}
|
|
57
59
|
export interface EngineProgress {
|
|
58
60
|
fraction: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baas-id/react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
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.",
|
|
@@ -10,13 +10,9 @@
|
|
|
10
10
|
"email": "support@reporting-pal.com"
|
|
11
11
|
}
|
|
12
12
|
],
|
|
13
|
-
"homepage": "https://baaslatam.com/
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "https://baaslatam.com/desarrolladores"
|
|
17
|
-
},
|
|
13
|
+
"homepage": "https://baaslatam.com/developers",
|
|
18
14
|
"bugs": {
|
|
19
|
-
"url": "https://
|
|
15
|
+
"url": "https://github.com/baas-id/react/issues",
|
|
20
16
|
"email": "support@reporting-pal.com"
|
|
21
17
|
},
|
|
22
18
|
"keywords": [
|
|
@@ -100,5 +96,9 @@
|
|
|
100
96
|
"publishConfig": {
|
|
101
97
|
"access": "public",
|
|
102
98
|
"provenance": true
|
|
99
|
+
},
|
|
100
|
+
"repository": {
|
|
101
|
+
"type": "git",
|
|
102
|
+
"url": "git+https://github.com/baas-id/react.git"
|
|
103
103
|
}
|
|
104
104
|
}
|