@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
|
@@ -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;
|
|
@@ -18,10 +19,11 @@ export interface HandoffPanelProps {
|
|
|
18
19
|
onResult: (result: VerificationResult) => void;
|
|
19
20
|
onContinueHere?: () => void;
|
|
20
21
|
onError?: (code: string) => void;
|
|
22
|
+
onFailed?: (code: string, detail?: unknown) => void;
|
|
21
23
|
onEvent?: (e: RpidFlowEvent) => void;
|
|
22
24
|
pollMs?: number;
|
|
23
25
|
}
|
|
24
|
-
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;
|
|
25
27
|
export interface HandoffViewProps {
|
|
26
28
|
t: Strings;
|
|
27
29
|
mode: HandoffMode;
|
|
@@ -41,8 +43,20 @@ export interface HandoffViewProps {
|
|
|
41
43
|
onCopy?: () => void;
|
|
42
44
|
onNewCode?: () => void;
|
|
43
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;
|
|
44
53
|
}
|
|
45
|
-
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;
|
|
55
|
+
export declare function CodeChip({ t, code, instruction }: {
|
|
56
|
+
t: Strings;
|
|
57
|
+
code: string;
|
|
58
|
+
instruction: string;
|
|
59
|
+
}): import("react").JSX.Element;
|
|
46
60
|
export interface ContinueOnPhoneProps {
|
|
47
61
|
apiUrl: string;
|
|
48
62
|
session: RpidSession | ApiSessionBody;
|
|
@@ -54,7 +68,9 @@ export interface ContinueOnPhoneProps {
|
|
|
54
68
|
onResult: (result: VerificationResult) => void;
|
|
55
69
|
onContinueHere?: () => void;
|
|
56
70
|
onError?: (code: string) => void;
|
|
71
|
+
onFailed?: (code: string, detail?: unknown) => void;
|
|
57
72
|
onEvent?: (e: RpidFlowEvent) => void;
|
|
58
73
|
appearance?: Appearance | null;
|
|
74
|
+
colorScheme?: ColorScheme;
|
|
59
75
|
}
|
|
60
76
|
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>;
|
|
@@ -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>;
|
|
@@ -31,11 +35,21 @@ export interface HandoffPeek {
|
|
|
31
35
|
expiresInS: number;
|
|
32
36
|
purpose: string;
|
|
33
37
|
locale?: string;
|
|
38
|
+
formality?: "formal" | "informal";
|
|
34
39
|
appearance?: unknown;
|
|
35
40
|
}
|
|
36
|
-
export
|
|
37
|
-
|
|
41
|
+
export interface CallLanguage {
|
|
42
|
+
locale?: string;
|
|
43
|
+
formality?: "formal" | "informal";
|
|
44
|
+
}
|
|
45
|
+
export declare function peekHandoff(apiUrl: string, code: string, signal?: AbortSignal, lang?: CallLanguage): Promise<HandoffPeek>;
|
|
46
|
+
export declare function claimHandoff(apiUrl: string, code: string, device?: string, signal?: AbortSignal, lang?: CallLanguage): Promise<Json>;
|
|
38
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;
|
|
39
53
|
export declare function postDevice(cfg: RpidClientConfig, snapshot: DeviceSnapshot): Promise<void>;
|
|
40
54
|
export declare function postClientEvents(cfg: RpidClientConfig, events: ClientEvent[], beacon?: boolean): void;
|
|
41
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;
|
|
@@ -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;
|
|
@@ -118,6 +120,14 @@ export interface Strings {
|
|
|
118
120
|
fieldNumber: string;
|
|
119
121
|
fieldBirth: string;
|
|
120
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;
|
|
121
131
|
};
|
|
122
132
|
retake: {
|
|
123
133
|
action: string;
|
|
@@ -188,6 +198,14 @@ export interface Strings {
|
|
|
188
198
|
capturing: string;
|
|
189
199
|
finished: string;
|
|
190
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;
|
|
191
209
|
stepWaiting: string;
|
|
192
210
|
stepConnected: string;
|
|
193
211
|
stepCapturing: string;
|
|
@@ -201,6 +219,9 @@ export interface Strings {
|
|
|
201
219
|
doneTitle: string;
|
|
202
220
|
doneBody: string;
|
|
203
221
|
linkErrorTitle: string;
|
|
222
|
+
codeLabel: string;
|
|
223
|
+
codeConfirmDesktop: string;
|
|
224
|
+
codeConfirmPhone: string;
|
|
204
225
|
};
|
|
205
226
|
flow: {
|
|
206
227
|
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" | "orientation_fixed" | "face_tracking";
|
|
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.
|
|
1
|
+
export declare const SDK_VERSION = "0.3.0";
|
|
@@ -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-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,7 @@
|
|
|
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 ORIENT_VOTE_MIN = 0.6;
|
|
4
5
|
export declare const TINY_INPUT = 224;
|
|
5
6
|
export declare const TINY_GRID = 28;
|
|
6
7
|
export declare const FOUND_PEAK = 0.03;
|
|
@@ -20,14 +21,16 @@ export interface CornerPeak {
|
|
|
20
21
|
}
|
|
21
22
|
export declare function decodeHeatmaps(hm: ArrayLike<number>, G?: number): CornerPeak[];
|
|
22
23
|
export declare function frontProbability(logits: ArrayLike<number>): number;
|
|
24
|
+
export declare function orientProbabilities(logits: ArrayLike<number> | undefined | null): [number, number, number, number] | null;
|
|
23
25
|
export interface TinyReading {
|
|
24
26
|
quad: Quad;
|
|
25
27
|
conf: [number, number, number, number];
|
|
26
28
|
pFront: number;
|
|
27
29
|
found: boolean;
|
|
28
30
|
present: boolean;
|
|
31
|
+
orient: [number, number, number, number] | null;
|
|
29
32
|
}
|
|
30
|
-
export declare function readTiny(hm: ArrayLike<number>, sideLogits: ArrayLike<number>, w: number, h: number): TinyReading;
|
|
33
|
+
export declare function readTiny(hm: ArrayLike<number>, sideLogits: ArrayLike<number>, w: number, h: number, orientLogits?: ArrayLike<number> | null): TinyReading;
|
|
31
34
|
export declare function plausible(q: Quad, w: number, h: number): boolean;
|
|
32
35
|
export declare function tinyDetection(r: TinyReading, w: number, h: number, ms?: number): CardDetection;
|
|
33
36
|
export declare function rectifyCanvas(crop: HTMLCanvasElement, quad: Quad, margin: number, maxLong: number): HTMLCanvasElement;
|
|
@@ -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;
|
|
@@ -39,6 +40,10 @@ export interface DocumentEngine {
|
|
|
39
40
|
detectCard(source: HTMLCanvasElement | HTMLVideoElement, srcW?: number, srcH?: number, opts?: DetectOptions): Promise<CardDetection>;
|
|
40
41
|
rectify(crop: HTMLCanvasElement, quad: Quad, margin: number, maxLong: number): Promise<HTMLCanvasElement>;
|
|
41
42
|
classifySide(crop: HTMLCanvasElement): Promise<SideResult>;
|
|
43
|
+
cropTurn?(card: HTMLCanvasElement): Promise<{
|
|
44
|
+
upsideDown: boolean;
|
|
45
|
+
margin: number;
|
|
46
|
+
} | null>;
|
|
42
47
|
}
|
|
43
48
|
export interface DetectOptions {
|
|
44
49
|
corners?: {
|
|
@@ -53,6 +58,7 @@ export interface FaceEngine {
|
|
|
53
58
|
rx: number;
|
|
54
59
|
ry: number;
|
|
55
60
|
}): Promise<FaceSignals>;
|
|
61
|
+
faces?(source: HTMLCanvasElement): Promise<import("./face").FaceDetection[]>;
|
|
56
62
|
}
|
|
57
63
|
export interface EngineProgress {
|
|
58
64
|
fraction: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baas-id/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
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.",
|