@baas-id/react 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/LICENSE.md +176 -0
  2. package/README.md +171 -0
  3. package/THIRD_PARTY_NOTICES.md +44 -0
  4. package/dist/esm/baas-id-react.css +1 -0
  5. package/dist/esm/chunks/ContinueFlow-YFSpSOio.js +7500 -0
  6. package/dist/esm/continue.js +10 -0
  7. package/dist/esm/index.js +218 -0
  8. package/dist/esm/preview.js +368 -0
  9. package/dist/esm/workers/detector.worker-DtuL8TFY.js +22435 -0
  10. package/dist/types/continue.d.ts +3 -0
  11. package/dist/types/index.d.ts +19 -0
  12. package/dist/types/preview.d.ts +5 -0
  13. package/dist/types/react/DocumentCapture.d.ts +27 -0
  14. package/dist/types/react/FaceCapture.d.ts +19 -0
  15. package/dist/types/react/capture/ProximityMeter.d.ts +9 -0
  16. package/dist/types/react/capture/TurnGauge.d.ts +12 -0
  17. package/dist/types/react/capture/YawDial.d.ts +6 -0
  18. package/dist/types/react/capture/api.d.ts +50 -0
  19. package/dist/types/react/capture/attestation.d.ts +32 -0
  20. package/dist/types/react/capture/binding.d.ts +51 -0
  21. package/dist/types/react/capture/camera.d.ts +4 -0
  22. package/dist/types/react/capture/chrome.d.ts +24 -0
  23. package/dist/types/react/capture/demo.d.ts +2 -0
  24. package/dist/types/react/capture/errors.d.ts +18 -0
  25. package/dist/types/react/capture/frames.d.ts +18 -0
  26. package/dist/types/react/capture/index.d.ts +15 -0
  27. package/dist/types/react/capture/integrity.d.ts +32 -0
  28. package/dist/types/react/capture/keyframes.d.ts +19 -0
  29. package/dist/types/react/capture/overlays.d.ts +10 -0
  30. package/dist/types/react/capture/run.d.ts +14 -0
  31. package/dist/types/react/capture/useCaptureRun.d.ts +4 -0
  32. package/dist/types/react/document/CardFrame.d.ts +10 -0
  33. package/dist/types/react/document/DocumentParts.d.ts +49 -0
  34. package/dist/types/react/document/advisory.d.ts +47 -0
  35. package/dist/types/react/document/bestFrames.d.ts +18 -0
  36. package/dist/types/react/document/cues.d.ts +28 -0
  37. package/dist/types/react/document/flow.d.ts +52 -0
  38. package/dist/types/react/document/gate.d.ts +114 -0
  39. package/dist/types/react/document/latch.d.ts +25 -0
  40. package/dist/types/react/document/mrz.d.ts +29 -0
  41. package/dist/types/react/document/overlay.d.ts +52 -0
  42. package/dist/types/react/document/quad.d.ts +5 -0
  43. package/dist/types/react/document/resolution.d.ts +42 -0
  44. package/dist/types/react/document/review.d.ts +50 -0
  45. package/dist/types/react/document/sideCheck.d.ts +32 -0
  46. package/dist/types/react/document/telemetry.d.ts +14 -0
  47. package/dist/types/react/document/track.d.ts +36 -0
  48. package/dist/types/react/document/useDocumentCapture.d.ts +78 -0
  49. package/dist/types/react/face/FaceGuide.d.ts +22 -0
  50. package/dist/types/react/face/FaceParts.d.ts +15 -0
  51. package/dist/types/react/face/faceMesh.d.ts +68 -0
  52. package/dist/types/react/face/faceRegion.d.ts +16 -0
  53. package/dist/types/react/face/faceView.d.ts +21 -0
  54. package/dist/types/react/face/meshBench.d.ts +7 -0
  55. package/dist/types/react/face/meshCanvas.d.ts +20 -0
  56. package/dist/types/react/face/qualityGate.d.ts +59 -0
  57. package/dist/types/react/face/runLiveness.d.ts +37 -0
  58. package/dist/types/react/face/scanState.d.ts +40 -0
  59. package/dist/types/react/face/upload.d.ts +14 -0
  60. package/dist/types/react/face/useFaceCapture.d.ts +45 -0
  61. package/dist/types/react/flows/ConsentStep.d.ts +8 -0
  62. package/dist/types/react/flows/EnrollmentFlow.d.ts +2 -0
  63. package/dist/types/react/flows/FlowResult.d.ts +13 -0
  64. package/dist/types/react/flows/FlowShell.d.ts +48 -0
  65. package/dist/types/react/flows/IdentifyFlow.d.ts +2 -0
  66. package/dist/types/react/flows/ReverificationFlow.d.ts +2 -0
  67. package/dist/types/react/flows/SignInFlow.d.ts +2 -0
  68. package/dist/types/react/flows/StepIntro.d.ts +10 -0
  69. package/dist/types/react/flows/VerificationFlow.d.ts +4 -0
  70. package/dist/types/react/flows/experience.d.ts +35 -0
  71. package/dist/types/react/flows/failureDetail.d.ts +12 -0
  72. package/dist/types/react/flows/index.d.ts +6 -0
  73. package/dist/types/react/flows/session.d.ts +5 -0
  74. package/dist/types/react/flows/state.d.ts +106 -0
  75. package/dist/types/react/flows/types.d.ts +255 -0
  76. package/dist/types/react/flows/useFlowSession.d.ts +21 -0
  77. package/dist/types/react/flows.d.ts +1 -0
  78. package/dist/types/react/handoff/ContinueFlow.d.ts +28 -0
  79. package/dist/types/react/handoff/ContinueOnPhone.d.ts +60 -0
  80. package/dist/types/react/handoff/api.d.ts +41 -0
  81. package/dist/types/react/handoff/qr.d.ts +9 -0
  82. package/dist/types/react/hooks.d.ts +7 -0
  83. package/dist/types/react/i18n/en.d.ts +3 -0
  84. package/dist/types/react/i18n/es-419.d.ts +3 -0
  85. package/dist/types/react/i18n/index.d.ts +10 -0
  86. package/dist/types/react/i18n/types.d.ts +250 -0
  87. package/dist/types/react/icons.d.ts +25 -0
  88. package/dist/types/react/liveness/challenges.d.ts +26 -0
  89. package/dist/types/react/liveness/framing.d.ts +33 -0
  90. package/dist/types/react/liveness/index.d.ts +8 -0
  91. package/dist/types/react/liveness/nod.d.ts +4 -0
  92. package/dist/types/react/liveness/scoring.d.ts +29 -0
  93. package/dist/types/react/liveness/script.d.ts +7 -0
  94. package/dist/types/react/liveness/signals.d.ts +38 -0
  95. package/dist/types/react/liveness/timing.d.ts +20 -0
  96. package/dist/types/react/liveness/turn.d.ts +18 -0
  97. package/dist/types/react/preview/FlowPreview.d.ts +34 -0
  98. package/dist/types/react/preview/contrast.d.ts +17 -0
  99. package/dist/types/react/preview/specimen.d.ts +35 -0
  100. package/dist/types/react/styles/index.d.ts +0 -0
  101. package/dist/types/react/telemetry/bus.d.ts +13 -0
  102. package/dist/types/react/telemetry/device.d.ts +66 -0
  103. package/dist/types/react/telemetry/reporter.d.ts +27 -0
  104. package/dist/types/react/theme/appearance.d.ts +22 -0
  105. package/dist/types/react/version.d.ts +1 -0
  106. package/dist/types/react/vision/authenticity.d.ts +43 -0
  107. package/dist/types/react/vision/authenticityPixels.d.ts +6 -0
  108. package/dist/types/react/vision/authenticitySpecular.d.ts +2 -0
  109. package/dist/types/react/vision/cardCorners.d.ts +21 -0
  110. package/dist/types/react/vision/cardDetector.d.ts +15 -0
  111. package/dist/types/react/vision/cornerGeometry.d.ts +10 -0
  112. package/dist/types/react/vision/cornerImage.d.ts +34 -0
  113. package/dist/types/react/vision/cornerLines.d.ts +12 -0
  114. package/dist/types/react/vision/cornerScore.d.ts +17 -0
  115. package/dist/types/react/vision/corners.d.ts +60 -0
  116. package/dist/types/react/vision/detector.worker.d.ts +1 -0
  117. package/dist/types/react/vision/document.d.ts +13 -0
  118. package/dist/types/react/vision/engine.d.ts +5 -0
  119. package/dist/types/react/vision/face.d.ts +17 -0
  120. package/dist/types/react/vision/index.d.ts +7 -0
  121. package/dist/types/react/vision/modelCache.d.ts +16 -0
  122. package/dist/types/react/vision/modelsCdn.d.ts +4 -0
  123. package/dist/types/react/vision/quality.d.ts +10 -0
  124. package/dist/types/react/vision/sideClassifier.d.ts +4 -0
  125. package/dist/types/react/vision/tinyCore.d.ts +21 -0
  126. package/dist/types/react/vision/tinyDetector.d.ts +36 -0
  127. package/dist/types/react/vision/types.d.ts +62 -0
  128. package/dist/types/react/vision/warp.d.ts +18 -0
  129. package/package.json +104 -0
@@ -0,0 +1,59 @@
1
+ import type { GuideKey } from "../i18n";
2
+ import type { FaceSignals } from "../liveness";
3
+ import type { PixelData } from "../vision/authenticity";
4
+ export interface SelfieQualityFloors {
5
+ iod_frac_min: number | null;
6
+ iod_px_min: number | null;
7
+ sharpness_min: number | null;
8
+ luma_min: number | null;
9
+ luma_max: number | null;
10
+ contrast_min: number | null;
11
+ yaw_max: number | null;
12
+ }
13
+ export declare const SELFIE_QUALITY_DEFAULTS: SelfieQualityFloors;
14
+ export declare const CROP_SIZE = 112;
15
+ export declare const QUALITY_RETAKE_MS = 6000;
16
+ export declare const QUALITY_PASS_FRAMES = 2;
17
+ export interface SelfieQualityReading {
18
+ iodFrac: number;
19
+ iodPx: number;
20
+ sharpness: number;
21
+ luma: number;
22
+ contrast: number;
23
+ yaw: number;
24
+ }
25
+ export type QualityIssue = Extract<GuideKey, "move_closer" | "hold_still" | "too_dark" | "too_bright" | "find_light" | "look_straight">;
26
+ export declare function floorsFrom(over?: Partial<Record<keyof SelfieQualityFloors, unknown>> | null): SelfieQualityFloors;
27
+ export declare function selfieQualityIssue(r: SelfieQualityReading, f: SelfieQualityFloors): QualityIssue | null;
28
+ export interface CropStats {
29
+ sharpness: number;
30
+ luma: number;
31
+ contrast: number;
32
+ }
33
+ export declare function faceCropStats(px: PixelData, box: {
34
+ x: number;
35
+ y: number;
36
+ w: number;
37
+ h: number;
38
+ }): CropStats;
39
+ export declare function readingFrom(sig: FaceSignals, stats: CropStats, frameW: number): SelfieQualityReading;
40
+ export interface QualityIo {
41
+ alive(): boolean;
42
+ wait(ms: number): Promise<void>;
43
+ now(): number;
44
+ read(): Promise<{
45
+ sig: FaceSignals;
46
+ stats: CropStats;
47
+ frameW: number;
48
+ } | null>;
49
+ }
50
+ export type QualityResult = {
51
+ ok: true;
52
+ reading: SelfieQualityReading;
53
+ } | {
54
+ ok: false;
55
+ issue: QualityIssue;
56
+ } | null;
57
+ export declare function holdForQuality(io: QualityIo, floors: SelfieQualityFloors, ui: {
58
+ guide(k: GuideKey): void;
59
+ }, tickMs: number): Promise<QualityResult>;
@@ -0,0 +1,37 @@
1
+ import type { GuideKey, Strings, TeleRecipe } from "../i18n";
2
+ import { type ChallengeKind, type FaceSignals, type LivenessTracker, type Proximity } from "../liveness";
3
+ export interface Framing {
4
+ found: boolean;
5
+ faceFrac: number;
6
+ faceW: number;
7
+ proximity: Proximity;
8
+ }
9
+ export interface LivenessIo {
10
+ alive(): boolean;
11
+ wait(ms: number): Promise<void>;
12
+ read(): Promise<FaceSignals | null>;
13
+ strings(): Strings;
14
+ now(): number;
15
+ keyframe?(tag: string): void;
16
+ }
17
+ export interface LivenessUi {
18
+ locked(): void;
19
+ step(i: number): void;
20
+ fill(centering: number): void;
21
+ framing(f: Framing): void;
22
+ guide(k: GuideKey): void;
23
+ progress(p: number): void;
24
+ yaw(yaw: number, confidence: number): void;
25
+ tele(text: TeleRecipe): void;
26
+ hold?(p: number): void;
27
+ }
28
+ export type LivenessResult = {
29
+ k: "passed";
30
+ reissues: number;
31
+ } | {
32
+ k: "failed";
33
+ reason: string;
34
+ } | {
35
+ k: "aborted";
36
+ };
37
+ export declare function runLiveness(script: ChallengeKind[], tracker: LivenessTracker, io: LivenessIo, ui: LivenessUi): Promise<LivenessResult>;
@@ -0,0 +1,40 @@
1
+ import type { GuideKey } from "../i18n";
2
+ import type { Ellipse } from "./faceView";
3
+ export type ScanState = "searching" | "position" | "distance" | "light" | "steady" | "aligned" | "challenge" | "verifying" | "done" | "error";
4
+ export declare function scanStateOf(s: {
5
+ error: string | null;
6
+ phase: string;
7
+ step: number;
8
+ total: number;
9
+ found: boolean;
10
+ guide: GuideKey | string;
11
+ }): ScanState;
12
+ export declare const isLocked: (s: ScanState) => s is "challenge" | "done" | "aligned" | "verifying";
13
+ export declare function meshLevel(s: ScanState): number;
14
+ export declare function segmentFills(s: {
15
+ step: number;
16
+ total: number;
17
+ hold: number;
18
+ progress: number;
19
+ done: boolean;
20
+ }): number[];
21
+ export declare function ellipsePerimeter(rx: number, ry: number): number;
22
+ export interface Dash {
23
+ dasharray: string;
24
+ dashoffset: number;
25
+ length: number;
26
+ }
27
+ export declare function ringSegments(fills: readonly number[], perimeter: number, gap: number): Dash[];
28
+ export declare function ellipseArc(o: Ellipse, a0: number, a1: number, n?: number): {
29
+ d: string;
30
+ length: number;
31
+ };
32
+ export declare const grow: (o: Ellipse, pad: number) => Ellipse;
33
+ export declare function cueVisible(guide: GuideKey | string, progress: number): boolean;
34
+ export declare const cueTone: (guide: GuideKey | string) => "go" | "wrong";
35
+ export declare function fillLightNext(on: boolean, guide: GuideKey | string, state: ScanState): boolean;
36
+ export declare function springEasing(stiffness?: number, damping?: number, samples?: number): {
37
+ easing: string;
38
+ ms: number;
39
+ };
40
+ export declare function serverReasonText(detail: unknown): string | null;
@@ -0,0 +1,14 @@
1
+ import { type AttestationProvider, type DeviceSignals, type Keyframe, type TimelineSummary } from "../capture";
2
+ export interface FaceEvidence {
3
+ capture: Record<string, unknown> | null;
4
+ keyframes: Blob[];
5
+ }
6
+ export declare function faceEvidence(input: {
7
+ nonce: string | null | undefined;
8
+ frame: Blob;
9
+ keyframes: readonly Keyframe[];
10
+ timeline: TimelineSummary;
11
+ device: DeviceSignals | null;
12
+ attestation?: AttestationProvider;
13
+ stream?: MediaStream | null;
14
+ }): Promise<FaceEvidence>;
@@ -0,0 +1,45 @@
1
+ import { type RefObject } from "react";
2
+ import { type EngineProgress } from "../vision";
3
+ import { type ChallengeKind } from "../liveness";
4
+ import { type GuideKey } from "../i18n";
5
+ import type { FaceCaptureProps } from "../FaceCapture";
6
+ import { PointsMotion } from "../document/track";
7
+ import { type Framing } from "./runLiveness";
8
+ export type FacePhase = "searching" | "locked" | "uploading" | "error";
9
+ export declare function useFaceCapture(props: FaceCaptureProps): {
10
+ t: import("../i18n").Strings;
11
+ source: "camera" | "demo";
12
+ script: ChallengeKind[];
13
+ step: number;
14
+ phase: FacePhase;
15
+ tele: string;
16
+ fill: number;
17
+ challengeProgress: number;
18
+ guide: GuideKey;
19
+ error: string | null;
20
+ errorDetail: unknown;
21
+ loadProgress: EngineProgress | null;
22
+ engineReady: boolean;
23
+ framing: Framing;
24
+ yaw: {
25
+ value: number;
26
+ confidence: number;
27
+ };
28
+ retry: () => void;
29
+ retriesLeft: number | null;
30
+ final: boolean;
31
+ src: {
32
+ w: number;
33
+ h: number;
34
+ };
35
+ hold: number;
36
+ motion: PointsMotion;
37
+ oval: {
38
+ cx: number;
39
+ cy: number;
40
+ rx: number;
41
+ ry: number;
42
+ };
43
+ videoRef: RefObject<HTMLVideoElement | null>;
44
+ canvasRef: RefObject<HTMLCanvasElement | null>;
45
+ };
@@ -0,0 +1,8 @@
1
+ import type { Strings } from "../i18n";
2
+ import type { ConsentChoice, ModelImprovementPrompt } from "./types";
3
+ export declare function ConsentStep({ prompt, locale, t, onChoice, }: {
4
+ prompt: ModelImprovementPrompt;
5
+ locale: string;
6
+ t: Strings;
7
+ onChoice: (c: ConsentChoice) => void;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { EnrollmentFlowProps } from "./types";
2
+ export declare function EnrollmentFlow(props: EnrollmentFlowProps): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { type Locale, type StringOverrides, type Strings } from "../i18n";
2
+ import type { VerificationResult } from "./types";
3
+ export declare function FlowResult({ result, t }: {
4
+ result: VerificationResult;
5
+ t: Strings;
6
+ }): import("react").JSX.Element;
7
+ export declare function IdentifyOutcome({ reason, locale, overrides, onRestart, t, }: {
8
+ reason: string;
9
+ locale?: Locale;
10
+ overrides?: StringOverrides;
11
+ onRestart: () => void;
12
+ t: Strings;
13
+ }): import("react").JSX.Element;
@@ -0,0 +1,48 @@
1
+ import { type ReactNode } from "react";
2
+ import { type Locale, type StringOverrides, type Strings } from "../i18n";
3
+ import { type CaptureId, type FailureCause, type FailureText, type RetakeNotice, type Side, type Step, type Thumbs } from "./state";
4
+ import type { Purpose } from "./types";
5
+ import { type Appearance } from "../theme/appearance";
6
+ export declare function FlowShell({ step, purpose, title, t, children, privacy, appearance, forceAppearance, screen, manageFocus, }: {
7
+ step: Step;
8
+ purpose: Purpose;
9
+ title: string;
10
+ t: Strings;
11
+ children: ReactNode;
12
+ privacy?: string | null;
13
+ appearance?: Appearance | null;
14
+ forceAppearance?: boolean;
15
+ screen?: string;
16
+ manageFocus?: boolean;
17
+ }): import("react").JSX.Element;
18
+ export declare function StepRail({ step, t, plan, retakes, }: {
19
+ step: Step;
20
+ t: Strings;
21
+ plan?: readonly CaptureId[];
22
+ retakes?: Partial<Record<Side, RetakeNotice>>;
23
+ }): import("react").JSX.Element;
24
+ export declare function RetakeNoticeLine({ notice, side, t }: {
25
+ notice: RetakeNotice;
26
+ side: Side;
27
+ t: Strings;
28
+ }): import("react").JSX.Element;
29
+ export declare function EvidenceTray({ thumbs, t, plan, }: {
30
+ thumbs: Thumbs;
31
+ t: Strings;
32
+ plan?: readonly CaptureId[];
33
+ }): import("react").JSX.Element;
34
+ export declare function Preparing({ label, note }: {
35
+ label: string;
36
+ note?: string;
37
+ }): import("react").JSX.Element;
38
+ export declare function Failure({ reason, verdict, cause, text, locale, overrides, onRestart, t, takeFocus, }: {
39
+ reason: string;
40
+ verdict?: "REJECTED" | "NEEDS_REVIEW";
41
+ cause?: FailureCause;
42
+ text?: FailureText;
43
+ locale?: Locale;
44
+ overrides?: StringOverrides;
45
+ onRestart: () => void;
46
+ t: Strings;
47
+ takeFocus?: boolean;
48
+ }): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { IdentifyFlowProps } from "./types";
2
+ export declare function IdentifyFlow(props: IdentifyFlowProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { ReverificationFlowProps } from "./types";
2
+ export declare function ReverificationFlow(props: ReverificationFlowProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { SignInFlowProps } from "./types";
2
+ export declare function SignInFlow(props: SignInFlowProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import type { Strings } from "../i18n";
2
+ import type { CaptureId } from "./state";
3
+ export declare function StepIntro({ step, body, t, movements, sessionMinutes, onStart, }: {
4
+ step: CaptureId;
5
+ body: string;
6
+ t: Strings;
7
+ movements?: number;
8
+ sessionMinutes?: number | null;
9
+ onStart: () => void;
10
+ }): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import type { Purpose, VerificationFlowProps } from "./types";
2
+ export declare function VerificationFlow(props: VerificationFlowProps & {
3
+ purpose: Purpose;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,35 @@
1
+ import type { Locale, StringOverrides, Strings } from "../i18n";
2
+ import type { CaptureId } from "./state";
3
+ export interface IntroText {
4
+ title?: string;
5
+ body?: string;
6
+ }
7
+ export interface TenantInstructions {
8
+ enabled?: boolean;
9
+ confirmCapture?: boolean;
10
+ front?: StepInstructions;
11
+ back?: StepInstructions;
12
+ face?: StepInstructions;
13
+ }
14
+ export interface StepInstructions {
15
+ enabled?: boolean;
16
+ en?: IntroText;
17
+ "es-419"?: IntroText;
18
+ }
19
+ export interface TenantReasonText {
20
+ title?: string;
21
+ description?: string;
22
+ action?: string;
23
+ }
24
+ export type TenantMessages = Partial<Record<Locale, Record<string, TenantReasonText>>>;
25
+ export declare function normalizeInstructions(raw: unknown): TenantInstructions | undefined;
26
+ export declare function normalizeMessages(raw: unknown): TenantMessages | undefined;
27
+ export declare function introEnabled(step: CaptureId, ins?: TenantInstructions | null): boolean;
28
+ export declare function confirmEnabled(ins?: TenantInstructions | null): boolean;
29
+ export declare function introFor(step: CaptureId, locale: Locale, t: Strings, ins?: TenantInstructions | null): Required<IntroText>;
30
+ export declare function parseIntroBody(body: string): {
31
+ paragraphs: string[];
32
+ items: string[];
33
+ };
34
+ export declare function tenantReasonOverrides(messages: TenantMessages | undefined, locale: Locale, t: Strings): StringOverrides | undefined;
35
+ export declare function mergeOverrides(tenant?: StringOverrides, host?: StringOverrides): StringOverrides | undefined;
@@ -0,0 +1,12 @@
1
+ export interface FailureText {
2
+ code: string;
3
+ reason: string;
4
+ reason_title: string;
5
+ reason_description: string;
6
+ }
7
+ export declare function hasReasonText(detail: unknown): boolean;
8
+ export declare function reasonTextOf(detail: unknown): {
9
+ title?: string;
10
+ description?: string;
11
+ } | null;
12
+ export declare function withFailureText(detail: unknown, text: FailureText): unknown;
@@ -0,0 +1,6 @@
1
+ export { EnrollmentFlow } from "./EnrollmentFlow";
2
+ export { SignInFlow } from "./SignInFlow";
3
+ export { ReverificationFlow } from "./ReverificationFlow";
4
+ export { IdentifyFlow } from "./IdentifyFlow";
5
+ export { normalizeSession, captureNonceOf } from "./session";
6
+ export type { EnrollmentFlowProps, SignInFlowProps, ReverificationFlowProps, IdentifyFlowProps, VerificationFlowProps, Purpose, IdentifyCandidate, DuplicateCandidate, ModelImprovementPrompt, ConsentChoice, OpenSessionContext, RpidSession, ApiSessionBody, SessionFlow, VerificationResult, VerificationAssessment, RpidFlowEvent, DocumentAuthenticity, ExtractionRecord, ExtractionField, Appearance, TenantInstructions, TenantMessages, SessionHandoff, HandoffOption, } from "./types";
@@ -0,0 +1,5 @@
1
+ import type { RpidSession, SessionFlow } from "./types";
2
+ export declare function normalizeFlow(raw: unknown): SessionFlow | undefined;
3
+ export declare function normalizeSession(raw: unknown): RpidSession;
4
+ export declare const captureNonceOf: (s: RpidSession | null | undefined) => string | null;
5
+ export declare function warnUnbound(s: RpidSession, source: "camera" | "demo"): void;
@@ -0,0 +1,106 @@
1
+ import type { Strings } from "../i18n";
2
+ import type { Purpose, RpidSession, SessionFlow, VerificationResult } from "./types";
3
+ export type Side = "front" | "back";
4
+ export type CaptureId = Side | "face";
5
+ export declare const FULL_ENROLLMENT: readonly CaptureId[];
6
+ export declare function captureSteps(purpose: Purpose, flow?: SessionFlow | null): CaptureId[];
7
+ export declare const isFaceOnly: (purpose: Purpose) => purpose is "signin" | "identify";
8
+ export declare const NEUTRAL_OUTCOMES: readonly string[];
9
+ export type Settlement = {
10
+ kind: "verified";
11
+ } | {
12
+ kind: "concluded";
13
+ reason: string;
14
+ verdict: "REJECTED" | "NEEDS_REVIEW";
15
+ };
16
+ export declare function settleFinalize(result: Pick<VerificationResult, "verdict" | "reason">): Settlement;
17
+ export type Step = {
18
+ k: "opening";
19
+ } | {
20
+ k: "doc";
21
+ side: Side;
22
+ } | {
23
+ k: "face";
24
+ } | {
25
+ k: "finalizing";
26
+ } | {
27
+ k: "done";
28
+ result: VerificationResult;
29
+ } | {
30
+ k: "failed";
31
+ reason: string;
32
+ verdict?: "REJECTED" | "NEEDS_REVIEW";
33
+ cause?: FailureCause;
34
+ text?: FailureText;
35
+ };
36
+ export interface FailureCause {
37
+ reason: string;
38
+ title?: string;
39
+ description?: string;
40
+ }
41
+ export interface FailureText {
42
+ title?: string;
43
+ description?: string;
44
+ }
45
+ export interface RetakeNotice {
46
+ reason: string;
47
+ title?: string;
48
+ description?: string;
49
+ from?: Side;
50
+ }
51
+ export type Thumbs = {
52
+ front?: string;
53
+ back?: string;
54
+ };
55
+ export interface FlowState {
56
+ step: Step;
57
+ session: RpidSession | null;
58
+ thumbs: Thumbs;
59
+ plan: CaptureId[];
60
+ faceRetriesLeft?: number;
61
+ retakes?: Partial<Record<Side, RetakeNotice>>;
62
+ }
63
+ export type FlowAction = {
64
+ type: "open";
65
+ } | {
66
+ type: "opened";
67
+ session: RpidSession;
68
+ purpose: Purpose;
69
+ } | {
70
+ type: "docCaptured";
71
+ side: Side;
72
+ thumb?: string;
73
+ } | {
74
+ type: "finalizing";
75
+ } | {
76
+ type: "verified";
77
+ result: VerificationResult;
78
+ } | {
79
+ type: "failed";
80
+ reason: string;
81
+ verdict?: "REJECTED" | "NEEDS_REVIEW";
82
+ cause?: FailureCause;
83
+ text?: FailureText;
84
+ } | {
85
+ type: "retake";
86
+ from: Side;
87
+ target: Side;
88
+ notice: RetakeNotice;
89
+ } | {
90
+ type: "faceRetry";
91
+ retriesLeft: number;
92
+ } | {
93
+ type: "remote";
94
+ };
95
+ export declare const INITIAL_FLOW: FlowState;
96
+ export declare function flowReducer(state: FlowState, action: FlowAction): FlowState;
97
+ export declare const isCapturing: (s: Step) => s is {
98
+ k: "doc";
99
+ side: Side;
100
+ } | {
101
+ k: "face";
102
+ };
103
+ export declare function railIndex(s: Step, plan?: readonly CaptureId[]): number;
104
+ export declare function titleFor(step: Step, purpose: Purpose, t: Strings): string;
105
+ export declare function finalizingLabel(purpose: Purpose, t: Strings): string;
106
+ export declare const stepKey: (s: Step) => string;