@baas-id/react 0.3.1 → 0.3.7

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 (73) hide show
  1. package/README.md +27 -3
  2. package/dist/esm/baas-id-react.css +1 -1
  3. package/dist/esm/chunks/ContinueFlow-BzKnkzHf.js +11597 -0
  4. package/dist/esm/chunks/provider-DqpgUBfH.js +87 -0
  5. package/dist/esm/continue.js +11 -7
  6. package/dist/esm/index.js +156 -119
  7. package/dist/esm/native.js +91 -0
  8. package/dist/esm/preview.js +220 -181
  9. package/dist/esm/workers/{detector.worker-DrerkwUk.js → detector.worker-Bpzz3rZ5.js} +1191 -1191
  10. package/dist/types/continue.d.ts +3 -0
  11. package/dist/types/index.d.ts +10 -1
  12. package/dist/types/native.d.ts +38 -0
  13. package/dist/types/react/DocumentCapture.d.ts +1 -0
  14. package/dist/types/react/FingerCapture.d.ts +20 -0
  15. package/dist/types/react/capture/api.d.ts +53 -0
  16. package/dist/types/react/capture/camera.d.ts +1 -1
  17. package/dist/types/react/capture/demo.d.ts +10 -0
  18. package/dist/types/react/capture/index.d.ts +3 -2
  19. package/dist/types/react/capture/keyframes.d.ts +8 -1
  20. package/dist/types/react/capture/torch.d.ts +14 -0
  21. package/dist/types/react/chip/ChipRead.d.ts +21 -0
  22. package/dist/types/react/chip/capability.d.ts +11 -0
  23. package/dist/types/react/chip/evidence.d.ts +9 -0
  24. package/dist/types/react/chip/provider.d.ts +42 -0
  25. package/dist/types/react/chip/useChipRead.d.ts +32 -0
  26. package/dist/types/react/chip/webNfcPresence.d.ts +2 -0
  27. package/dist/types/react/document/DocumentParts.d.ts +1 -0
  28. package/dist/types/react/document/cornerOrder.d.ts +1 -0
  29. package/dist/types/react/document/follow.d.ts +26 -0
  30. package/dist/types/react/document/resolution.d.ts +1 -0
  31. package/dist/types/react/document/review.d.ts +1 -1
  32. package/dist/types/react/document/sideCheck.d.ts +1 -0
  33. package/dist/types/react/document/steady.d.ts +0 -6
  34. package/dist/types/react/document/upright.d.ts +1 -0
  35. package/dist/types/react/document/useDocumentCapture.d.ts +23 -2
  36. package/dist/types/react/face/bestFrame.d.ts +17 -0
  37. package/dist/types/react/face/faceView.d.ts +3 -0
  38. package/dist/types/react/face/runLiveness.d.ts +2 -0
  39. package/dist/types/react/face/useFaceCapture.d.ts +6 -0
  40. package/dist/types/react/finger/FingerGuide.d.ts +14 -0
  41. package/dist/types/react/finger/detector.d.ts +39 -0
  42. package/dist/types/react/finger/qualityGate.d.ts +37 -0
  43. package/dist/types/react/finger/runFingerCapture.d.ts +77 -0
  44. package/dist/types/react/finger/upload.d.ts +10 -0
  45. package/dist/types/react/finger/useFingerCapture.d.ts +31 -0
  46. package/dist/types/react/flows/FlowShell.d.ts +2 -0
  47. package/dist/types/react/flows/experience.d.ts +4 -0
  48. package/dist/types/react/flows/index.d.ts +1 -1
  49. package/dist/types/react/flows/renewal.d.ts +27 -0
  50. package/dist/types/react/flows/session.d.ts +5 -1
  51. package/dist/types/react/flows/state.d.ts +34 -2
  52. package/dist/types/react/flows/types.d.ts +58 -0
  53. package/dist/types/react/flows/useFlowSession.d.ts +12 -2
  54. package/dist/types/react/handoff/ContinueFlow.d.ts +15 -2
  55. package/dist/types/react/handoff/ContinueOnPhone.d.ts +19 -1
  56. package/dist/types/react/handoff/api.d.ts +8 -2
  57. package/dist/types/react/handoff/phoneLink.d.ts +2 -1
  58. package/dist/types/react/i18n/types.d.ts +45 -3
  59. package/dist/types/react/preview/FlowPreview.d.ts +1 -0
  60. package/dist/types/react/telemetry/bus.d.ts +1 -1
  61. package/dist/types/react/theme/scheme.d.ts +17 -0
  62. package/dist/types/react/version.d.ts +1 -1
  63. package/dist/types/react/vision/corners.d.ts +1 -1
  64. package/dist/types/react/vision/face.d.ts +13 -0
  65. package/dist/types/react/vision/quality.d.ts +5 -2
  66. package/dist/types/react/vision/refine.d.ts +71 -0
  67. package/dist/types/react/vision/resample.d.ts +7 -0
  68. package/dist/types/react/vision/tinyDetector.d.ts +1 -0
  69. package/dist/types/react/vision/types.d.ts +3 -1
  70. package/package.json +6 -1
  71. package/dist/esm/chunks/ContinueFlow-mqBIxnlp.js +0 -9327
  72. package/dist/types/react/document/flow.d.ts +0 -52
  73. package/dist/types/react/document/latch.d.ts +0 -25
@@ -0,0 +1,37 @@
1
+ import type { GuideKey } from "../i18n";
2
+ import type { FingerBox, FingerPixels, Slot } from "./detector";
3
+ export interface FingertipStats {
4
+ sharpness: number;
5
+ luma: number;
6
+ contrast: number;
7
+ glare: number;
8
+ ridge: number;
9
+ widthPx: number;
10
+ }
11
+ export type FingerGuideId = Extract<GuideKey, "no_hand" | "fingers_closer" | "fingers_back" | "fingers_together" | "hold_fingers_still" | "finger_glare" | "finger_blurry" | "show_left_hand" | "show_right_hand" | "too_dark" | "perfect">;
12
+ export interface FingerFloors {
13
+ widthPxMin: number;
14
+ slotFracMax: number;
15
+ glareMax: number;
16
+ lumaMin: number;
17
+ lumaMax: number;
18
+ ridgeMin: number;
19
+ sharpnessMin: number | null;
20
+ }
21
+ export declare const FINGER_FLOORS: FingerFloors;
22
+ export declare const RIDGE_W = 192;
23
+ export declare function ridgeScore(g: Float32Array, w: number, h: number): number;
24
+ export declare function fingertipStats(px: FingerPixels, box: {
25
+ x: number;
26
+ y: number;
27
+ w: number;
28
+ h: number;
29
+ }): FingertipStats;
30
+ export interface FingerReading {
31
+ slots: readonly Slot[];
32
+ boxes: readonly FingerBox[];
33
+ stats: ReadonlyArray<FingertipStats | null>;
34
+ hand?: "left" | "right";
35
+ }
36
+ export declare function fingertipPasses(st: FingertipStats | null, f?: FingerFloors): boolean;
37
+ export declare function fingerGate(r: FingerReading, f?: FingerFloors): FingerGuideId;
@@ -0,0 +1,77 @@
1
+ import type { FingerBox, FingerDetector, FingerGroup, FingerPixels } from "./detector";
2
+ import { type FingerFloors, type FingerGuideId, type FingertipStats } from "./qualityGate";
3
+ export declare const FINGER_TICK_MS = 90;
4
+ export declare const PRESENT_FRAMES = 3;
5
+ export declare const HOLD_FRAMES = 5;
6
+ export declare const STILL_MAX = 0.02;
7
+ export declare const FINGER_TIMEOUT_MS = 25000;
8
+ export declare const TORCH_SETTLE_MS = 350;
9
+ export interface FingerFrame<F> {
10
+ px: FingerPixels;
11
+ frame: F;
12
+ w: number;
13
+ h: number;
14
+ }
15
+ export interface FingerIo<F> {
16
+ alive(): boolean;
17
+ wait(ms: number): Promise<void>;
18
+ now(): number;
19
+ read(): Promise<FingerFrame<F> | null>;
20
+ detector: FingerDetector;
21
+ region(frame: F, box: {
22
+ x: number;
23
+ y: number;
24
+ w: number;
25
+ h: number;
26
+ }): FingerPixels | null;
27
+ keep?(frame: F): F;
28
+ encode(frame: F): Promise<Blob>;
29
+ crop(frame: F, box: {
30
+ x: number;
31
+ y: number;
32
+ w: number;
33
+ h: number;
34
+ }): Promise<Blob>;
35
+ torch?: {
36
+ supported: boolean;
37
+ on: boolean;
38
+ set(on: boolean): Promise<boolean>;
39
+ };
40
+ }
41
+ export type SlotState = "empty" | "found" | "good";
42
+ export interface FingerUi {
43
+ guide(k: FingerGuideId): void;
44
+ slots(states: SlotState[]): void;
45
+ hold(p: number): void;
46
+ stage(s: "searching" | "holding" | "torch" | "done"): void;
47
+ reading?(r: {
48
+ boxes: FingerBox[];
49
+ stats: Array<FingertipStats | null>;
50
+ guide: FingerGuideId;
51
+ }): void;
52
+ }
53
+ export interface FingerCaptureOutput {
54
+ file: Blob;
55
+ crops: Blob[];
56
+ boxes: Array<[number, number, number, number]>;
57
+ stats: FingertipStats[];
58
+ torch: {
59
+ supported: boolean;
60
+ response: number | null;
61
+ };
62
+ }
63
+ export type FingerRunResult = {
64
+ k: "captured";
65
+ out: FingerCaptureOutput;
66
+ } | {
67
+ k: "failed";
68
+ reason: "FINGER_NOT_FOUND" | "FINGER_QUALITY_LOW";
69
+ } | {
70
+ k: "aborted";
71
+ };
72
+ export declare function runFingerCapture<F>(group: FingerGroup, io: FingerIo<F>, ui: FingerUi, opts?: {
73
+ torch?: boolean;
74
+ floors?: FingerFloors;
75
+ timeoutMs?: number;
76
+ tickMs?: number;
77
+ }): Promise<FingerRunResult>;
@@ -0,0 +1,10 @@
1
+ import { type DeviceSignals, type TimelineSummary } from "../capture";
2
+ export declare function fingerEvidence(input: {
3
+ nonce: string | null | undefined;
4
+ file: Blob;
5
+ crops: readonly Blob[];
6
+ positions: readonly string[];
7
+ timeline: TimelineSummary;
8
+ device: DeviceSignals | null;
9
+ tMs?: number;
10
+ }): Promise<Record<string, unknown> | null>;
@@ -0,0 +1,31 @@
1
+ import { type RefObject } from "react";
2
+ import type { FingerCaptureProps } from "../FingerCapture";
3
+ import { type FingerGroup, type Slot } from "./detector";
4
+ import type { FingerGuideId } from "./qualityGate";
5
+ import { type SlotState } from "./runFingerCapture";
6
+ export type FingerPhase = "searching" | "holding" | "torch" | "uploading" | "done" | "error";
7
+ export declare function useFingerCapture(props: FingerCaptureProps): {
8
+ t: import("../i18n").Strings;
9
+ source: "camera" | "demo";
10
+ phase: FingerPhase;
11
+ guide: FingerGuideId;
12
+ slotStates: SlotState[];
13
+ hold: number;
14
+ group: FingerGroup;
15
+ groups: FingerGroup[];
16
+ groupAt: number;
17
+ slots: Slot[];
18
+ src: {
19
+ w: number;
20
+ h: number;
21
+ };
22
+ error: string | null;
23
+ errorDetail: unknown;
24
+ retriesLeft: number | null;
25
+ final: boolean;
26
+ torchOn: boolean;
27
+ tele: string;
28
+ retry: () => void;
29
+ videoRef: RefObject<HTMLVideoElement | null>;
30
+ canvasRef: RefObject<HTMLCanvasElement | null>;
31
+ };
@@ -23,6 +23,8 @@ export declare function StepRail({ step, t, plan, retakes, }: {
23
23
  plan?: readonly CaptureId[];
24
24
  retakes?: Partial<Record<Side, RetakeNotice>>;
25
25
  }): import("react").JSX.Element;
26
+ export declare function watchModality(): () => void;
27
+ export declare function focusTitle(el: HTMLElement): void;
26
28
  export declare function RetakeNoticeLine({ notice, side, t }: {
27
29
  notice: RetakeNotice;
28
30
  side: Side;
@@ -10,11 +10,14 @@ export interface TenantInstructions {
10
10
  front?: StepInstructions;
11
11
  back?: StepInstructions;
12
12
  face?: StepInstructions;
13
+ chip?: StepInstructions;
14
+ finger?: StepInstructions;
13
15
  }
14
16
  export interface StepInstructions {
15
17
  enabled?: boolean;
16
18
  en?: IntroText;
17
19
  "es-419"?: IntroText;
20
+ unreadableHint?: boolean;
18
21
  }
19
22
  export interface TenantReasonText {
20
23
  title?: string;
@@ -26,6 +29,7 @@ export declare function normalizeInstructions(raw: unknown): TenantInstructions
26
29
  export declare function normalizeMessages(raw: unknown): TenantMessages | undefined;
27
30
  export declare function introEnabled(step: CaptureId, ins?: TenantInstructions | null): boolean;
28
31
  export declare function confirmEnabled(ins?: TenantInstructions | null): boolean;
32
+ export declare function unreadableHintEnabled(ins?: TenantInstructions | null): boolean;
29
33
  export declare function introFor(step: CaptureId, locale: Locale, t: Strings, ins?: TenantInstructions | null): Required<IntroText>;
30
34
  export declare function parseIntroBody(body: string): {
31
35
  paragraphs: string[];
@@ -3,4 +3,4 @@ export { SignInFlow } from "./SignInFlow";
3
3
  export { ReverificationFlow } from "./ReverificationFlow";
4
4
  export { IdentifyFlow } from "./IdentifyFlow";
5
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";
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, SessionChip, SessionFinger, FingerPosition, StepId, } from "./types";
@@ -0,0 +1,27 @@
1
+ export declare const DEFAULT_SESSION_TTL_S = 900;
2
+ export declare const RENEW_MARGIN_MS = 60000;
3
+ export declare const MAX_SILENT_RENEWALS = 8;
4
+ export declare const MAX_IDLE_MS: number;
5
+ export type RenewReason = "expiring" | "resume" | "start" | "expired";
6
+ export type RenewOutcome = "renewed" | "failed" | "unsupported" | "aborted" | "skipped";
7
+ export interface SessionLife {
8
+ openedAt: number;
9
+ ttlMs: number;
10
+ silent: number;
11
+ touchedAt: number;
12
+ }
13
+ export declare function lifeOf(openedAt: number, expiresInS?: number, prev?: SessionLife | null, silent?: boolean): SessionLife;
14
+ export declare const expiresAtOf: (l: SessionLife) => number;
15
+ export declare const marginOf: (l: SessionLife) => number;
16
+ export declare const renewDueAt: (l: SessionLife) => number;
17
+ export declare const needsRenewal: (l: SessionLife, now: number) => boolean;
18
+ export declare const maySilentlyRenew: (l: SessionLife, now: number) => boolean;
19
+ export declare function useKeepFresh({ active, sessionId, life, renew, touch }: {
20
+ active: boolean;
21
+ sessionId: string;
22
+ life: {
23
+ readonly current: SessionLife | null;
24
+ };
25
+ renew: (why: RenewReason) => Promise<RenewOutcome>;
26
+ touch: () => void;
27
+ }): void;
@@ -1,4 +1,8 @@
1
- import type { RpidSession, SessionFlow } from "./types";
1
+ import type { FingerPosition, RpidSession, SessionChip, SessionFinger, SessionFlow, StepId } from "./types";
2
+ export declare const FINGER_POSITIONS: readonly FingerPosition[];
3
+ export declare function normalizeSteps(raw: unknown): StepId[] | undefined;
4
+ export declare function normalizeChip(raw: unknown): SessionChip | undefined;
5
+ export declare function normalizeFinger(raw: unknown): SessionFinger | undefined;
2
6
  export declare function normalizeFlow(raw: unknown): SessionFlow | undefined;
3
7
  export declare function normalizeSession(raw: unknown): RpidSession;
4
8
  export declare const captureNonceOf: (s: RpidSession | null | undefined) => string | null;
@@ -1,9 +1,17 @@
1
1
  import type { Strings } from "../i18n";
2
- import type { Purpose, RpidSession, SessionFlow, VerificationResult } from "./types";
2
+ import type { ExtractionRecord, Purpose, RpidSession, SessionFlow, VerificationResult } from "./types";
3
3
  export type Side = "front" | "back";
4
- export type CaptureId = Side | "face";
4
+ export type CaptureId = Side | "chip" | "finger" | "face";
5
+ export declare const ALL_STEPS: readonly CaptureId[];
5
6
  export declare const FULL_ENROLLMENT: readonly CaptureId[];
6
7
  export declare function captureSteps(purpose: Purpose, flow?: SessionFlow | null): CaptureId[];
8
+ export interface ChipAccess {
9
+ documentNumber: string;
10
+ birthDate: string;
11
+ expiryDate: string;
12
+ }
13
+ export declare function yymmdd(v: unknown): string | null;
14
+ export declare function chipAccessOf(record: ExtractionRecord | null | undefined): ChipAccess | null;
7
15
  export declare const isFaceOnly: (purpose: Purpose) => purpose is "signin" | "identify";
8
16
  export declare const NEUTRAL_OUTCOMES: readonly string[];
9
17
  export type Settlement = {
@@ -14,13 +22,19 @@ export type Settlement = {
14
22
  verdict: "REJECTED" | "NEEDS_REVIEW";
15
23
  };
16
24
  export declare function settleFinalize(result: Pick<VerificationResult, "verdict" | "reason">): Settlement;
25
+ export declare const toStep: (id: CaptureId) => Step;
26
+ export declare const idOf: (s: Step) => CaptureId | null;
17
27
  export type Step = {
18
28
  k: "opening";
19
29
  } | {
20
30
  k: "doc";
21
31
  side: Side;
32
+ } | {
33
+ k: "chip";
22
34
  } | {
23
35
  k: "face";
36
+ } | {
37
+ k: "finger";
24
38
  } | {
25
39
  k: "finalizing";
26
40
  } | {
@@ -58,7 +72,10 @@ export interface FlowState {
58
72
  thumbs: Thumbs;
59
73
  plan: CaptureId[];
60
74
  faceRetriesLeft?: number;
75
+ fingerRetriesLeft?: number;
61
76
  retakes?: Partial<Record<Side, RetakeNotice>>;
77
+ chain?: string;
78
+ chipAccess?: ChipAccess;
62
79
  }
63
80
  export type FlowAction = {
64
81
  type: "open";
@@ -66,10 +83,17 @@ export type FlowAction = {
66
83
  type: "opened";
67
84
  session: RpidSession;
68
85
  purpose: Purpose;
86
+ } | {
87
+ type: "renewed";
88
+ session: RpidSession;
69
89
  } | {
70
90
  type: "docCaptured";
71
91
  side: Side;
72
92
  thumb?: string;
93
+ record?: ExtractionRecord | null;
94
+ } | {
95
+ type: "stepDone";
96
+ id: "chip" | "finger" | "face";
73
97
  } | {
74
98
  type: "finalizing";
75
99
  } | {
@@ -89,6 +113,9 @@ export type FlowAction = {
89
113
  } | {
90
114
  type: "faceRetry";
91
115
  retriesLeft: number;
116
+ } | {
117
+ type: "fingerRetry";
118
+ retriesLeft: number;
92
119
  } | {
93
120
  type: "remote";
94
121
  };
@@ -97,9 +124,14 @@ export declare function flowReducer(state: FlowState, action: FlowAction): FlowS
97
124
  export declare const isCapturing: (s: Step) => s is {
98
125
  k: "doc";
99
126
  side: Side;
127
+ } | {
128
+ k: "chip";
100
129
  } | {
101
130
  k: "face";
131
+ } | {
132
+ k: "finger";
102
133
  };
134
+ export declare const lastStep: (plan: readonly CaptureId[]) => CaptureId;
103
135
  export declare function railIndex(s: Step, plan?: readonly CaptureId[]): number;
104
136
  export declare function titleFor(step: Step, purpose: Purpose, t: Strings): string;
105
137
  export declare function finalizingLabel(purpose: Purpose, t: Strings): string;
@@ -4,6 +4,8 @@ import type { DocumentAuthenticity } from "../capture";
4
4
  import type { SelfieQualityFloors } from "../face/qualityGate";
5
5
  import type { Appearance } from "../theme/appearance";
6
6
  import type { TenantInstructions, TenantMessages } from "./experience";
7
+ import type { ChipReader } from "../chip/provider";
8
+ import type { FingerDetector } from "../finger/detector";
7
9
  export type { Appearance, TenantInstructions, TenantMessages };
8
10
  export type { DocumentAuthenticity };
9
11
  export interface ExtractionField {
@@ -88,8 +90,29 @@ export interface ApiSessionBody {
88
90
  };
89
91
  progress?: boolean;
90
92
  test?: boolean;
93
+ steps?: StepId[];
94
+ chip?: {
95
+ required?: boolean;
96
+ aa_challenge?: string;
97
+ data_groups?: string[];
98
+ } | null;
99
+ finger?: {
100
+ fingers?: FingerPosition[];
101
+ torch?: boolean;
102
+ } | null;
91
103
  };
92
104
  }
105
+ export type StepId = "front" | "back" | "chip" | "face" | "finger";
106
+ export type FingerPosition = "right_index" | "right_middle" | "right_ring" | "right_little" | "left_index" | "left_middle" | "left_ring" | "left_little" | "right_thumb" | "left_thumb";
107
+ export interface SessionChip {
108
+ required: boolean;
109
+ aaChallenge?: string;
110
+ dataGroups: string[];
111
+ }
112
+ export interface SessionFinger {
113
+ fingers: FingerPosition[];
114
+ torch: boolean;
115
+ }
93
116
  export interface SessionFlow {
94
117
  document?: boolean;
95
118
  documentSides?: "front_back" | "front";
@@ -108,6 +131,9 @@ export interface SessionFlow {
108
131
  handoff?: SessionHandoff;
109
132
  progress?: boolean;
110
133
  test?: boolean;
134
+ steps?: StepId[];
135
+ chip?: SessionChip;
136
+ finger?: SessionFinger;
111
137
  }
112
138
  export interface SessionHandoff {
113
139
  mode?: "auto" | "suggest";
@@ -160,6 +186,13 @@ export type RpidFlowEvent = {
160
186
  sessionId: string;
161
187
  purpose: Purpose;
162
188
  bound: boolean;
189
+ renewed?: true;
190
+ } | {
191
+ type: "session.renewed";
192
+ sessionId: string;
193
+ previousSessionId: string;
194
+ purpose: Purpose;
195
+ reason: "expiring" | "resume" | "start" | "expired";
163
196
  } | {
164
197
  type: "session.failed";
165
198
  reason: string;
@@ -182,6 +215,26 @@ export type RpidFlowEvent = {
182
215
  target: "front" | "back";
183
216
  reason: string;
184
217
  mismatches?: string[];
218
+ } | {
219
+ type: "chip.read";
220
+ access: "bac" | "pace";
221
+ dataGroups: string[];
222
+ activeAuth: boolean;
223
+ } | {
224
+ type: "chip.unavailable";
225
+ reason: string;
226
+ chipRequired: boolean;
227
+ } | {
228
+ type: "chip.rejected";
229
+ reason: string;
230
+ retriesLeft?: number;
231
+ } | {
232
+ type: "finger.captured";
233
+ fingers: string[];
234
+ } | {
235
+ type: "finger.rejected";
236
+ reason: string;
237
+ retriesLeft?: number;
185
238
  } | {
186
239
  type: "face.captured";
187
240
  } | {
@@ -229,10 +282,13 @@ export interface ConsentChoice {
229
282
  }
230
283
  export interface OpenSessionContext {
231
284
  consent?: ConsentChoice;
285
+ previousSessionId?: string;
286
+ renewal?: boolean;
232
287
  }
233
288
  export interface VerificationFlowProps {
234
289
  apiUrl: string;
235
290
  openSession: (signal?: AbortSignal, context?: OpenSessionContext) => Promise<RpidSession | ApiSessionBody>;
291
+ sessionRenewal?: boolean;
236
292
  consent?: {
237
293
  modelImprovement?: ModelImprovementPrompt;
238
294
  };
@@ -251,6 +307,8 @@ export interface VerificationFlowProps {
251
307
  onEvent?: (event: RpidFlowEvent) => void;
252
308
  handoff?: HandoffOption;
253
309
  diagnostics?: boolean;
310
+ chipReader?: ChipReader;
311
+ fingerDetector?: FingerDetector;
254
312
  }
255
313
  export type Purpose = "enrollment" | "signin" | "reverification" | "identify";
256
314
  export type EnrollmentFlowProps = VerificationFlowProps;
@@ -1,8 +1,10 @@
1
1
  import { type RpidClientConfig } from "../capture";
2
2
  import { type FlowState, type Side } from "./state";
3
+ import type { ChipOutcome } from "../chip/useChipRead";
3
4
  import type { SideRetake } from "../DocumentCapture";
5
+ import { type RenewOutcome, type RenewReason, type SessionLife } from "./renewal";
4
6
  import type { ConsentChoice, Purpose, VerificationFlowProps, VerificationResult } from "./types";
5
- export declare function useFlowSession({ purpose, apiUrl, openSession, locale, strings: overrides, formality: formalityProp, onVerified, onFailed, onEvent, source, consentChoice, diagnostics, }: VerificationFlowProps & {
7
+ export declare function useFlowSession({ purpose, apiUrl, openSession, locale, strings: overrides, formality: formalityProp, onVerified, onFailed, onEvent, source, consentChoice, diagnostics, sessionRenewal, }: VerificationFlowProps & {
6
8
  purpose: Purpose;
7
9
  consentChoice?: ConsentChoice | null;
8
10
  }): {
@@ -14,9 +16,17 @@ export declare function useFlowSession({ purpose, apiUrl, openSession, locale, s
14
16
  config: RpidClientConfig | null;
15
17
  restart: () => undefined;
16
18
  docCaptured: (side: Side, serverResult: unknown, thumb?: string) => void;
17
- captureRejected: (kind: "document" | "face", reason: string, detail?: unknown) => void;
19
+ captureRejected: (kind: "document" | "face" | "chip" | "finger", reason: string, detail?: unknown) => void;
18
20
  faceCaptured: () => Promise<void>;
21
+ chipDone: (outcome: ChipOutcome) => void;
22
+ fingerCaptured: (serverResult: unknown) => void;
19
23
  docRetake: (r: SideRetake) => void;
20
24
  remoteResult: (result: VerificationResult) => Promise<void>;
21
25
  failWith: (code: string) => void;
26
+ life: import("react").MutableRefObject<SessionLife | null>;
27
+ renew: (why: RenewReason, loud?: boolean) => Promise<RenewOutcome>;
28
+ touch: () => void;
29
+ beforeCapture: (unused: boolean) => true | Promise<boolean>;
30
+ preparing: boolean;
31
+ renewalOn: () => boolean;
22
32
  };
@@ -1,7 +1,14 @@
1
1
  import { type Formality, type Locale, type StringOverrides, type Strings } from "../i18n";
2
2
  import type { RpidFlowEvent } from "../flows/types";
3
3
  import type { ColorScheme } from "../theme/scheme";
4
+ import type { ChipReader } from "../chip/provider";
5
+ import type { FingerDetector } from "../finger/detector";
4
6
  export declare function readHandoffCode(search?: string, pathname?: string, hash?: string): string | null;
7
+ export declare function readLastLook(now?: number): {
8
+ locale?: string;
9
+ formality?: Formality;
10
+ } | null;
11
+ export declare const CONTINUE_DEFAULT_LOCALE: Locale;
5
12
  export interface ContinueFlowProps {
6
13
  apiUrl: string;
7
14
  code: string | null;
@@ -18,15 +25,21 @@ export interface ContinueFlowProps {
18
25
  verdict: string;
19
26
  reason: string | null;
20
27
  }) => void;
28
+ onLanguage?: (language: {
29
+ locale: Locale;
30
+ formality: Formality;
31
+ }) => void;
32
+ chipReader?: ChipReader;
33
+ fingerDetector?: FingerDetector;
21
34
  }
22
- export declare function ContinueFlow({ apiUrl, code, modelsUrl, locale: hostLocale, strings, formality, colorScheme, privacyNote, source, debug, onEvent, onDone, }: ContinueFlowProps): import("react").JSX.Element;
35
+ export declare function ContinueFlow({ apiUrl, code, modelsUrl, locale: hostLocale, strings, formality, colorScheme, privacyNote, source, debug, onEvent, onDone, onLanguage, chipReader, fingerDetector, }: ContinueFlowProps): import("react").JSX.Element;
23
36
  export declare function ContinueConfirmView({ t, tenant, codeHint, onContinue }: {
24
37
  t: Strings;
25
38
  tenant: string;
26
39
  codeHint: string;
27
40
  onContinue?: () => void;
28
41
  }): import("react").JSX.Element;
29
- export type DoneStep = "front" | "back" | "face";
42
+ export type DoneStep = "front" | "back" | "chip" | "face" | "finger";
30
43
  export declare function ContinueDoneView({ t, tenant, codeHint, steps }: {
31
44
  t: Strings;
32
45
  tenant?: string | null;
@@ -11,6 +11,11 @@ export interface HandoffCopy {
11
11
  body?: string;
12
12
  }
13
13
  export declare const POLL_MS = 2000;
14
+ export declare function linkOnce(config: RpidClientConfig, previous: {
15
+ sessionId: string;
16
+ captureToken: string;
17
+ }): void;
18
+ export declare function resetLinkedPairs(): void;
14
19
  export interface HandoffPanelProps {
15
20
  config: RpidClientConfig;
16
21
  t: Strings;
@@ -23,6 +28,16 @@ export interface HandoffPanelProps {
23
28
  onEvent?: (e: RpidFlowEvent) => void;
24
29
  pollMs?: number;
25
30
  }
31
+ export declare const FOLLOW_KEY = "rpid.handoff.follow";
32
+ interface FollowRecord {
33
+ apiUrl: string;
34
+ sessionId: string;
35
+ captureToken: string;
36
+ at: number;
37
+ }
38
+ export declare function rememberFollow(cfg: RpidClientConfig): void;
39
+ export declare function forgetFollow(sessionId?: string): void;
40
+ export declare function readFollow(): FollowRecord | null;
26
41
  export declare function HandoffPanel({ config, t, mode, copy, onResult, onContinueHere, onError, onFailed, onEvent, pollMs, }: HandoffPanelProps): import("react").JSX.Element;
27
42
  export interface HandoffViewProps {
28
43
  t: Strings;
@@ -50,8 +65,10 @@ export interface HandoffViewProps {
50
65
  final: boolean;
51
66
  } | null;
52
67
  onAgain?: () => void;
68
+ retrying?: boolean;
69
+ resumed?: boolean;
53
70
  }
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;
71
+ export declare function HandoffView({ t, mode, copy, link, leftMs, expired, failed, phase, device, copied, linkId, onCopy, onNewCode, onContinueHere, stopped, onAgain, retrying, resumed, }: HandoffViewProps): import("react").JSX.Element;
55
72
  export declare function CodeChip({ t, code, instruction }: {
56
73
  t: Strings;
57
74
  code: string;
@@ -74,3 +91,4 @@ export interface ContinueOnPhoneProps {
74
91
  colorScheme?: ColorScheme;
75
92
  }
76
93
  export declare function ContinueOnPhone(props: ContinueOnPhoneProps): import("react").JSX.Element;
94
+ export {};
@@ -28,6 +28,10 @@ export interface HandoffStatus {
28
28
  export declare function createHandoff(cfg: RpidClientConfig, device?: string, signal?: AbortSignal): Promise<HandoffCode>;
29
29
  export declare function handoffStatus(cfg: RpidClientConfig, signal?: AbortSignal): Promise<HandoffStatus>;
30
30
  export declare function revokeHandoff(cfg: RpidClientConfig, reason: "continue_here" | "cancel"): Promise<void>;
31
+ export declare function linkSession(cfg: RpidClientConfig, previous: {
32
+ sessionId: string;
33
+ captureToken: string;
34
+ }): Promise<boolean>;
31
35
  export interface HandoffPeek {
32
36
  tenant: string;
33
37
  codeHint: string;
@@ -43,10 +47,12 @@ export interface CallLanguage {
43
47
  formality?: "formal" | "informal";
44
48
  }
45
49
  export declare function peekHandoff(apiUrl: string, code: string, signal?: AbortSignal, lang?: CallLanguage): Promise<HandoffPeek>;
50
+ export declare function refusalLanguage(e: unknown): CallLanguage | null;
46
51
  export declare function claimHandoff(apiUrl: string, code: string, device?: string, signal?: AbortSignal, lang?: CallLanguage): Promise<Json>;
47
- export declare function reportProgress(cfg: RpidClientConfig, step: "front" | "back" | "face"): Promise<void>;
52
+ export type ProgressStep = "front" | "back" | "chip" | "face" | "finger";
53
+ export declare function reportProgress(cfg: RpidClientConfig, step: ProgressStep): Promise<void>;
48
54
  export declare function reportPhone(cfg: RpidClientConfig, event: "heartbeat" | "failed" | "abandoned", info?: {
49
- step?: "front" | "back" | "face";
55
+ step?: ProgressStep;
50
56
  reason?: string;
51
57
  final?: boolean;
52
58
  }, beacon?: boolean): void;
@@ -1,7 +1,8 @@
1
1
  import type { RpidClientConfig } from "../capture";
2
+ import { type ProgressStep } from "./api";
2
3
  export declare const HEARTBEAT_MS = 10000;
3
4
  export interface PhoneFailure {
4
5
  reason: string;
5
6
  final: boolean;
6
7
  }
7
- export declare function usePhoneLink(cfg: RpidClientConfig | null, step: "front" | "back" | "face" | null, failure: PhoneFailure | null, finished: boolean): void;
8
+ export declare function usePhoneLink(cfg: RpidClientConfig | null, step: ProgressStep | null, failure: PhoneFailure | null, finished: boolean): void;