@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.
- package/LICENSE.md +176 -0
- package/README.md +171 -0
- package/THIRD_PARTY_NOTICES.md +44 -0
- package/dist/esm/baas-id-react.css +1 -0
- package/dist/esm/chunks/ContinueFlow-YFSpSOio.js +7500 -0
- package/dist/esm/continue.js +10 -0
- package/dist/esm/index.js +218 -0
- package/dist/esm/preview.js +368 -0
- package/dist/esm/workers/detector.worker-DtuL8TFY.js +22435 -0
- package/dist/types/continue.d.ts +3 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/types/preview.d.ts +5 -0
- package/dist/types/react/DocumentCapture.d.ts +27 -0
- package/dist/types/react/FaceCapture.d.ts +19 -0
- package/dist/types/react/capture/ProximityMeter.d.ts +9 -0
- package/dist/types/react/capture/TurnGauge.d.ts +12 -0
- package/dist/types/react/capture/YawDial.d.ts +6 -0
- package/dist/types/react/capture/api.d.ts +50 -0
- package/dist/types/react/capture/attestation.d.ts +32 -0
- package/dist/types/react/capture/binding.d.ts +51 -0
- package/dist/types/react/capture/camera.d.ts +4 -0
- package/dist/types/react/capture/chrome.d.ts +24 -0
- package/dist/types/react/capture/demo.d.ts +2 -0
- package/dist/types/react/capture/errors.d.ts +18 -0
- package/dist/types/react/capture/frames.d.ts +18 -0
- package/dist/types/react/capture/index.d.ts +15 -0
- package/dist/types/react/capture/integrity.d.ts +32 -0
- package/dist/types/react/capture/keyframes.d.ts +19 -0
- package/dist/types/react/capture/overlays.d.ts +10 -0
- package/dist/types/react/capture/run.d.ts +14 -0
- package/dist/types/react/capture/useCaptureRun.d.ts +4 -0
- package/dist/types/react/document/CardFrame.d.ts +10 -0
- package/dist/types/react/document/DocumentParts.d.ts +49 -0
- package/dist/types/react/document/advisory.d.ts +47 -0
- package/dist/types/react/document/bestFrames.d.ts +18 -0
- package/dist/types/react/document/cues.d.ts +28 -0
- package/dist/types/react/document/flow.d.ts +52 -0
- package/dist/types/react/document/gate.d.ts +114 -0
- package/dist/types/react/document/latch.d.ts +25 -0
- package/dist/types/react/document/mrz.d.ts +29 -0
- package/dist/types/react/document/overlay.d.ts +52 -0
- package/dist/types/react/document/quad.d.ts +5 -0
- package/dist/types/react/document/resolution.d.ts +42 -0
- package/dist/types/react/document/review.d.ts +50 -0
- package/dist/types/react/document/sideCheck.d.ts +32 -0
- package/dist/types/react/document/telemetry.d.ts +14 -0
- package/dist/types/react/document/track.d.ts +36 -0
- package/dist/types/react/document/useDocumentCapture.d.ts +78 -0
- package/dist/types/react/face/FaceGuide.d.ts +22 -0
- package/dist/types/react/face/FaceParts.d.ts +15 -0
- package/dist/types/react/face/faceMesh.d.ts +68 -0
- package/dist/types/react/face/faceRegion.d.ts +16 -0
- package/dist/types/react/face/faceView.d.ts +21 -0
- package/dist/types/react/face/meshBench.d.ts +7 -0
- package/dist/types/react/face/meshCanvas.d.ts +20 -0
- package/dist/types/react/face/qualityGate.d.ts +59 -0
- package/dist/types/react/face/runLiveness.d.ts +37 -0
- package/dist/types/react/face/scanState.d.ts +40 -0
- package/dist/types/react/face/upload.d.ts +14 -0
- package/dist/types/react/face/useFaceCapture.d.ts +45 -0
- package/dist/types/react/flows/ConsentStep.d.ts +8 -0
- package/dist/types/react/flows/EnrollmentFlow.d.ts +2 -0
- package/dist/types/react/flows/FlowResult.d.ts +13 -0
- package/dist/types/react/flows/FlowShell.d.ts +48 -0
- package/dist/types/react/flows/IdentifyFlow.d.ts +2 -0
- package/dist/types/react/flows/ReverificationFlow.d.ts +2 -0
- package/dist/types/react/flows/SignInFlow.d.ts +2 -0
- package/dist/types/react/flows/StepIntro.d.ts +10 -0
- package/dist/types/react/flows/VerificationFlow.d.ts +4 -0
- package/dist/types/react/flows/experience.d.ts +35 -0
- package/dist/types/react/flows/failureDetail.d.ts +12 -0
- package/dist/types/react/flows/index.d.ts +6 -0
- package/dist/types/react/flows/session.d.ts +5 -0
- package/dist/types/react/flows/state.d.ts +106 -0
- package/dist/types/react/flows/types.d.ts +255 -0
- package/dist/types/react/flows/useFlowSession.d.ts +21 -0
- package/dist/types/react/flows.d.ts +1 -0
- package/dist/types/react/handoff/ContinueFlow.d.ts +28 -0
- package/dist/types/react/handoff/ContinueOnPhone.d.ts +60 -0
- package/dist/types/react/handoff/api.d.ts +41 -0
- package/dist/types/react/handoff/qr.d.ts +9 -0
- package/dist/types/react/hooks.d.ts +7 -0
- package/dist/types/react/i18n/en.d.ts +3 -0
- package/dist/types/react/i18n/es-419.d.ts +3 -0
- package/dist/types/react/i18n/index.d.ts +10 -0
- package/dist/types/react/i18n/types.d.ts +250 -0
- package/dist/types/react/icons.d.ts +25 -0
- package/dist/types/react/liveness/challenges.d.ts +26 -0
- package/dist/types/react/liveness/framing.d.ts +33 -0
- package/dist/types/react/liveness/index.d.ts +8 -0
- package/dist/types/react/liveness/nod.d.ts +4 -0
- package/dist/types/react/liveness/scoring.d.ts +29 -0
- package/dist/types/react/liveness/script.d.ts +7 -0
- package/dist/types/react/liveness/signals.d.ts +38 -0
- package/dist/types/react/liveness/timing.d.ts +20 -0
- package/dist/types/react/liveness/turn.d.ts +18 -0
- package/dist/types/react/preview/FlowPreview.d.ts +34 -0
- package/dist/types/react/preview/contrast.d.ts +17 -0
- package/dist/types/react/preview/specimen.d.ts +35 -0
- package/dist/types/react/styles/index.d.ts +0 -0
- package/dist/types/react/telemetry/bus.d.ts +13 -0
- package/dist/types/react/telemetry/device.d.ts +66 -0
- package/dist/types/react/telemetry/reporter.d.ts +27 -0
- package/dist/types/react/theme/appearance.d.ts +22 -0
- package/dist/types/react/version.d.ts +1 -0
- package/dist/types/react/vision/authenticity.d.ts +43 -0
- package/dist/types/react/vision/authenticityPixels.d.ts +6 -0
- package/dist/types/react/vision/authenticitySpecular.d.ts +2 -0
- package/dist/types/react/vision/cardCorners.d.ts +21 -0
- package/dist/types/react/vision/cardDetector.d.ts +15 -0
- package/dist/types/react/vision/cornerGeometry.d.ts +10 -0
- package/dist/types/react/vision/cornerImage.d.ts +34 -0
- package/dist/types/react/vision/cornerLines.d.ts +12 -0
- package/dist/types/react/vision/cornerScore.d.ts +17 -0
- package/dist/types/react/vision/corners.d.ts +60 -0
- package/dist/types/react/vision/detector.worker.d.ts +1 -0
- package/dist/types/react/vision/document.d.ts +13 -0
- package/dist/types/react/vision/engine.d.ts +5 -0
- package/dist/types/react/vision/face.d.ts +17 -0
- package/dist/types/react/vision/index.d.ts +7 -0
- package/dist/types/react/vision/modelCache.d.ts +16 -0
- package/dist/types/react/vision/modelsCdn.d.ts +4 -0
- package/dist/types/react/vision/quality.d.ts +10 -0
- package/dist/types/react/vision/sideClassifier.d.ts +4 -0
- package/dist/types/react/vision/tinyCore.d.ts +21 -0
- package/dist/types/react/vision/tinyDetector.d.ts +36 -0
- package/dist/types/react/vision/types.d.ts +62 -0
- package/dist/types/react/vision/warp.d.ts +18 -0
- package/package.json +104 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import type { Locale, StringOverrides } from "../i18n";
|
|
2
|
+
import type { DocumentAuthenticity } from "../capture";
|
|
3
|
+
import type { SelfieQualityFloors } from "../face/qualityGate";
|
|
4
|
+
import type { Appearance } from "../theme/appearance";
|
|
5
|
+
import type { TenantInstructions, TenantMessages } from "./experience";
|
|
6
|
+
export type { Appearance, TenantInstructions, TenantMessages };
|
|
7
|
+
export type { DocumentAuthenticity };
|
|
8
|
+
export interface ExtractionField {
|
|
9
|
+
value: unknown;
|
|
10
|
+
sources: string[];
|
|
11
|
+
agreed?: boolean;
|
|
12
|
+
candidates?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
export interface ExtractionRecord {
|
|
15
|
+
schema_version: string;
|
|
16
|
+
fields: Record<string, ExtractionField>;
|
|
17
|
+
sources: Array<{
|
|
18
|
+
kind: string;
|
|
19
|
+
format?: string;
|
|
20
|
+
raw?: unknown;
|
|
21
|
+
valid?: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
portrait: {
|
|
24
|
+
present: boolean;
|
|
25
|
+
box: number[] | null;
|
|
26
|
+
image: string | null;
|
|
27
|
+
detector: string | null;
|
|
28
|
+
score?: number | null;
|
|
29
|
+
faces_found?: number;
|
|
30
|
+
ghosts?: Array<{
|
|
31
|
+
box: number[];
|
|
32
|
+
score: number;
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
35
|
+
checks: {
|
|
36
|
+
cross_source_agreement: boolean | null;
|
|
37
|
+
conflicts: string[];
|
|
38
|
+
sources_present: string[];
|
|
39
|
+
};
|
|
40
|
+
warnings?: string[];
|
|
41
|
+
extraction?: {
|
|
42
|
+
side: string;
|
|
43
|
+
barcode_engine: string;
|
|
44
|
+
symbols_found: number;
|
|
45
|
+
symbologies: string[];
|
|
46
|
+
mrz_found: boolean;
|
|
47
|
+
elapsed_ms: number;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface RpidSession {
|
|
51
|
+
sessionId: string;
|
|
52
|
+
captureToken: string;
|
|
53
|
+
challengeScript?: string[];
|
|
54
|
+
expiresInS?: number;
|
|
55
|
+
flow?: SessionFlow;
|
|
56
|
+
}
|
|
57
|
+
export interface ApiSessionBody {
|
|
58
|
+
session_id: string;
|
|
59
|
+
capture_token: string;
|
|
60
|
+
challenge_script?: string[];
|
|
61
|
+
expires_in_s?: number;
|
|
62
|
+
flow?: {
|
|
63
|
+
document?: boolean;
|
|
64
|
+
document_sides?: "front_back" | "front";
|
|
65
|
+
locale?: Locale | "auto";
|
|
66
|
+
liveness?: boolean;
|
|
67
|
+
appearance?: Appearance;
|
|
68
|
+
instructions?: TenantInstructions;
|
|
69
|
+
messages?: TenantMessages;
|
|
70
|
+
quality?: {
|
|
71
|
+
selfie?: Record<string, number | null> | null;
|
|
72
|
+
} | null;
|
|
73
|
+
capture?: {
|
|
74
|
+
v?: number;
|
|
75
|
+
nonce?: string;
|
|
76
|
+
} | null;
|
|
77
|
+
handoff?: {
|
|
78
|
+
mode?: "auto" | "suggest";
|
|
79
|
+
ttl_s?: number;
|
|
80
|
+
copy?: Partial<Record<Locale, {
|
|
81
|
+
title?: string;
|
|
82
|
+
body?: string;
|
|
83
|
+
}>>;
|
|
84
|
+
role?: "phone";
|
|
85
|
+
tenant?: string;
|
|
86
|
+
code_hint?: string;
|
|
87
|
+
};
|
|
88
|
+
progress?: boolean;
|
|
89
|
+
test?: boolean;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export interface SessionFlow {
|
|
93
|
+
document?: boolean;
|
|
94
|
+
documentSides?: "front_back" | "front";
|
|
95
|
+
locale?: Locale;
|
|
96
|
+
appearance?: Appearance;
|
|
97
|
+
instructions?: TenantInstructions;
|
|
98
|
+
messages?: TenantMessages;
|
|
99
|
+
quality?: {
|
|
100
|
+
selfie?: Partial<Record<keyof SelfieQualityFloors, number | null>> | null;
|
|
101
|
+
} | null;
|
|
102
|
+
capture?: {
|
|
103
|
+
v?: number;
|
|
104
|
+
nonce?: string;
|
|
105
|
+
} | null;
|
|
106
|
+
handoff?: SessionHandoff;
|
|
107
|
+
progress?: boolean;
|
|
108
|
+
test?: boolean;
|
|
109
|
+
}
|
|
110
|
+
export interface SessionHandoff {
|
|
111
|
+
mode?: "auto" | "suggest";
|
|
112
|
+
ttlS?: number;
|
|
113
|
+
copy?: Partial<Record<Locale, {
|
|
114
|
+
title?: string;
|
|
115
|
+
body?: string;
|
|
116
|
+
}>>;
|
|
117
|
+
role?: "phone";
|
|
118
|
+
tenant?: string;
|
|
119
|
+
codeHint?: string;
|
|
120
|
+
}
|
|
121
|
+
export type HandoffOption = false | {
|
|
122
|
+
mode?: "auto" | "suggest";
|
|
123
|
+
device?: "mobile" | "tablet" | "desktop";
|
|
124
|
+
};
|
|
125
|
+
export interface VerificationResult {
|
|
126
|
+
verdict: "VERIFIED" | "REJECTED" | "NEEDS_REVIEW";
|
|
127
|
+
purpose: Purpose;
|
|
128
|
+
reason: string | null;
|
|
129
|
+
score: number | null;
|
|
130
|
+
assurance: string;
|
|
131
|
+
policy_version: string;
|
|
132
|
+
verification_token?: string;
|
|
133
|
+
test?: boolean;
|
|
134
|
+
handoff?: {
|
|
135
|
+
continue_on: "desktop";
|
|
136
|
+
};
|
|
137
|
+
assessment?: VerificationAssessment;
|
|
138
|
+
candidates?: IdentifyCandidate[];
|
|
139
|
+
duplicates?: DuplicateCandidate[];
|
|
140
|
+
subject_ref?: string | null;
|
|
141
|
+
}
|
|
142
|
+
export interface IdentifyCandidate {
|
|
143
|
+
subject_ref: string;
|
|
144
|
+
score: number;
|
|
145
|
+
enrolled_at?: string;
|
|
146
|
+
}
|
|
147
|
+
export interface DuplicateCandidate {
|
|
148
|
+
subject_ref: string;
|
|
149
|
+
score: number;
|
|
150
|
+
}
|
|
151
|
+
export interface VerificationAssessment {
|
|
152
|
+
decision: "verified" | "rejected" | "needs_review";
|
|
153
|
+
risk?: number;
|
|
154
|
+
reason?: string;
|
|
155
|
+
}
|
|
156
|
+
export type RpidFlowEvent = {
|
|
157
|
+
type: "session.created";
|
|
158
|
+
sessionId: string;
|
|
159
|
+
purpose: Purpose;
|
|
160
|
+
bound: boolean;
|
|
161
|
+
} | {
|
|
162
|
+
type: "session.failed";
|
|
163
|
+
reason: string;
|
|
164
|
+
} | {
|
|
165
|
+
type: "document.captured";
|
|
166
|
+
side: "front" | "back";
|
|
167
|
+
authenticity?: DocumentAuthenticity;
|
|
168
|
+
} | {
|
|
169
|
+
type: "document.extracted";
|
|
170
|
+
side: "front" | "back";
|
|
171
|
+
record: ExtractionRecord;
|
|
172
|
+
} | {
|
|
173
|
+
type: "document.rejected";
|
|
174
|
+
reason: string;
|
|
175
|
+
retriesLeft?: number;
|
|
176
|
+
authenticity?: DocumentAuthenticity;
|
|
177
|
+
} | {
|
|
178
|
+
type: "document.retake";
|
|
179
|
+
side: "front" | "back";
|
|
180
|
+
target: "front" | "back";
|
|
181
|
+
reason: string;
|
|
182
|
+
mismatches?: string[];
|
|
183
|
+
} | {
|
|
184
|
+
type: "face.captured";
|
|
185
|
+
} | {
|
|
186
|
+
type: "face.rejected";
|
|
187
|
+
reason: string;
|
|
188
|
+
retriesLeft?: number;
|
|
189
|
+
} | {
|
|
190
|
+
type: "processing.started";
|
|
191
|
+
} | {
|
|
192
|
+
type: "verification.completed";
|
|
193
|
+
assurance: string;
|
|
194
|
+
score: number | null;
|
|
195
|
+
assessment?: VerificationAssessment;
|
|
196
|
+
} | {
|
|
197
|
+
type: "handoff.created";
|
|
198
|
+
codeHint: string;
|
|
199
|
+
expiresInS: number;
|
|
200
|
+
} | {
|
|
201
|
+
type: "handoff.claimed";
|
|
202
|
+
device: string | null;
|
|
203
|
+
} | {
|
|
204
|
+
type: "handoff.finished";
|
|
205
|
+
verdict: string;
|
|
206
|
+
} | {
|
|
207
|
+
type: "handoff.revoked";
|
|
208
|
+
reason: "continue_here" | "cancel";
|
|
209
|
+
} | {
|
|
210
|
+
type: "verification.rejected";
|
|
211
|
+
reason: string;
|
|
212
|
+
verdict?: "REJECTED" | "NEEDS_REVIEW";
|
|
213
|
+
assessment?: VerificationAssessment;
|
|
214
|
+
};
|
|
215
|
+
export interface ModelImprovementPrompt {
|
|
216
|
+
text: string;
|
|
217
|
+
version: string;
|
|
218
|
+
language?: string;
|
|
219
|
+
learnMoreUrl?: string;
|
|
220
|
+
learnMoreLabel?: string;
|
|
221
|
+
}
|
|
222
|
+
export interface ConsentChoice {
|
|
223
|
+
modelImprovement: boolean;
|
|
224
|
+
version: string;
|
|
225
|
+
language: string;
|
|
226
|
+
acceptedAt: string;
|
|
227
|
+
}
|
|
228
|
+
export interface OpenSessionContext {
|
|
229
|
+
consent?: ConsentChoice;
|
|
230
|
+
}
|
|
231
|
+
export interface VerificationFlowProps {
|
|
232
|
+
apiUrl: string;
|
|
233
|
+
openSession: (signal?: AbortSignal, context?: OpenSessionContext) => Promise<RpidSession | ApiSessionBody>;
|
|
234
|
+
consent?: {
|
|
235
|
+
modelImprovement?: ModelImprovementPrompt;
|
|
236
|
+
};
|
|
237
|
+
privacyNote?: string | null;
|
|
238
|
+
modelsUrl?: string;
|
|
239
|
+
detector?: "tiny" | "legacy";
|
|
240
|
+
source?: "camera" | "demo";
|
|
241
|
+
locale?: Locale;
|
|
242
|
+
strings?: StringOverrides;
|
|
243
|
+
challengeMs?: number;
|
|
244
|
+
debug?: boolean;
|
|
245
|
+
onVerified: (result: VerificationResult) => void | Promise<void>;
|
|
246
|
+
onFailed?: (reason: string, detail?: unknown) => void;
|
|
247
|
+
onEvent?: (event: RpidFlowEvent) => void;
|
|
248
|
+
handoff?: HandoffOption;
|
|
249
|
+
diagnostics?: boolean;
|
|
250
|
+
}
|
|
251
|
+
export type Purpose = "enrollment" | "signin" | "reverification" | "identify";
|
|
252
|
+
export type EnrollmentFlowProps = VerificationFlowProps;
|
|
253
|
+
export type SignInFlowProps = VerificationFlowProps;
|
|
254
|
+
export type ReverificationFlowProps = VerificationFlowProps;
|
|
255
|
+
export type IdentifyFlowProps = VerificationFlowProps;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type RpidClientConfig } from "../capture";
|
|
2
|
+
import { type FlowState, type Side } from "./state";
|
|
3
|
+
import type { SideRetake } from "../DocumentCapture";
|
|
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 & {
|
|
6
|
+
purpose: Purpose;
|
|
7
|
+
consentChoice?: ConsentChoice | null;
|
|
8
|
+
}): {
|
|
9
|
+
state: FlowState;
|
|
10
|
+
t: import("../i18n").Strings;
|
|
11
|
+
locale: import("../i18n").Locale;
|
|
12
|
+
overrides: import("../i18n").StringOverrides | undefined;
|
|
13
|
+
config: RpidClientConfig | null;
|
|
14
|
+
restart: () => undefined;
|
|
15
|
+
docCaptured: (side: Side, serverResult: unknown, thumb?: string) => void;
|
|
16
|
+
captureRejected: (kind: "document" | "face", reason: string, detail?: unknown) => void;
|
|
17
|
+
faceCaptured: () => Promise<void>;
|
|
18
|
+
docRetake: (r: SideRetake) => void;
|
|
19
|
+
remoteResult: (result: VerificationResult) => Promise<void>;
|
|
20
|
+
failWith: (code: string) => void;
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./flows/index";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type Locale, type StringOverrides, type Strings } from "../i18n";
|
|
2
|
+
import type { RpidFlowEvent } from "../flows/types";
|
|
3
|
+
export declare function readHandoffCode(search?: string, pathname?: string, hash?: string): string | null;
|
|
4
|
+
export interface ContinueFlowProps {
|
|
5
|
+
apiUrl: string;
|
|
6
|
+
code: string | null;
|
|
7
|
+
modelsUrl?: string;
|
|
8
|
+
locale?: Locale;
|
|
9
|
+
strings?: StringOverrides;
|
|
10
|
+
privacyNote?: string | null;
|
|
11
|
+
source?: "camera" | "demo";
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
onEvent?: (e: RpidFlowEvent) => void;
|
|
14
|
+
onDone?: (outcome: {
|
|
15
|
+
verdict: string;
|
|
16
|
+
reason: string | null;
|
|
17
|
+
}) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function ContinueFlow({ apiUrl, code, modelsUrl, locale: hostLocale, strings, privacyNote, source, debug, onEvent, onDone, }: ContinueFlowProps): import("react").JSX.Element;
|
|
20
|
+
export declare function ContinueConfirmView({ t, tenant, codeHint, onContinue }: {
|
|
21
|
+
t: Strings;
|
|
22
|
+
tenant: string;
|
|
23
|
+
codeHint: string;
|
|
24
|
+
onContinue?: () => void;
|
|
25
|
+
}): import("react").JSX.Element;
|
|
26
|
+
export declare function ContinueDoneView({ t }: {
|
|
27
|
+
t: Strings;
|
|
28
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Strings } from "../i18n";
|
|
2
|
+
import { type HandoffStatus } from "./api";
|
|
3
|
+
import type { RpidClientConfig } from "../capture";
|
|
4
|
+
import type { ApiSessionBody, Purpose, RpidFlowEvent, RpidSession, VerificationResult } from "../flows/types";
|
|
5
|
+
import { type Locale, type StringOverrides } from "../i18n";
|
|
6
|
+
import type { Appearance } from "../theme/appearance";
|
|
7
|
+
export type HandoffMode = "auto" | "suggest";
|
|
8
|
+
export interface HandoffCopy {
|
|
9
|
+
title?: string;
|
|
10
|
+
body?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const POLL_MS = 2000;
|
|
13
|
+
export interface HandoffPanelProps {
|
|
14
|
+
config: RpidClientConfig;
|
|
15
|
+
t: Strings;
|
|
16
|
+
mode?: HandoffMode;
|
|
17
|
+
copy?: HandoffCopy | null;
|
|
18
|
+
onResult: (result: VerificationResult) => void;
|
|
19
|
+
onContinueHere?: () => void;
|
|
20
|
+
onError?: (code: string) => void;
|
|
21
|
+
onEvent?: (e: RpidFlowEvent) => void;
|
|
22
|
+
pollMs?: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function HandoffPanel({ config, t, mode, copy, onResult, onContinueHere, onError, onEvent, pollMs, }: HandoffPanelProps): import("react").JSX.Element;
|
|
25
|
+
export interface HandoffViewProps {
|
|
26
|
+
t: Strings;
|
|
27
|
+
mode: HandoffMode;
|
|
28
|
+
copy?: HandoffCopy | null;
|
|
29
|
+
link: {
|
|
30
|
+
url: string;
|
|
31
|
+
codeHint: string;
|
|
32
|
+
tenant: string;
|
|
33
|
+
} | null;
|
|
34
|
+
leftMs: number;
|
|
35
|
+
expired: boolean;
|
|
36
|
+
failed: boolean;
|
|
37
|
+
phase: HandoffStatus["phase"];
|
|
38
|
+
device: string | null;
|
|
39
|
+
copied?: "ok" | "fail" | null;
|
|
40
|
+
linkId?: string;
|
|
41
|
+
onCopy?: () => void;
|
|
42
|
+
onNewCode?: () => void;
|
|
43
|
+
onContinueHere?: () => void;
|
|
44
|
+
}
|
|
45
|
+
export declare function HandoffView({ t, mode, copy, link, leftMs, expired, failed, phase, device, copied, linkId, onCopy, onNewCode, onContinueHere, }: HandoffViewProps): import("react").JSX.Element;
|
|
46
|
+
export interface ContinueOnPhoneProps {
|
|
47
|
+
apiUrl: string;
|
|
48
|
+
session: RpidSession | ApiSessionBody;
|
|
49
|
+
purpose?: Purpose;
|
|
50
|
+
mode?: HandoffMode;
|
|
51
|
+
locale?: Locale;
|
|
52
|
+
strings?: StringOverrides;
|
|
53
|
+
privacyNote?: string | null;
|
|
54
|
+
onResult: (result: VerificationResult) => void;
|
|
55
|
+
onContinueHere?: () => void;
|
|
56
|
+
onError?: (code: string) => void;
|
|
57
|
+
onEvent?: (e: RpidFlowEvent) => void;
|
|
58
|
+
appearance?: Appearance | null;
|
|
59
|
+
}
|
|
60
|
+
export declare function ContinueOnPhone(props: ContinueOnPhoneProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { RpidClientConfig } from "../capture";
|
|
2
|
+
import type { ClientEvent } from "../telemetry/bus";
|
|
3
|
+
import type { DeviceSnapshot } from "../telemetry/device";
|
|
4
|
+
type Json = Record<string, unknown>;
|
|
5
|
+
export interface HandoffCode {
|
|
6
|
+
code: string;
|
|
7
|
+
url: string;
|
|
8
|
+
expiresAt: string;
|
|
9
|
+
expiresInS: number;
|
|
10
|
+
codeHint: string;
|
|
11
|
+
tenant: string;
|
|
12
|
+
}
|
|
13
|
+
export type HandoffPhase = "waiting" | "connected" | "capturing" | "finished";
|
|
14
|
+
export interface HandoffStatus {
|
|
15
|
+
status: "none" | "pending" | "claimed" | "expired" | "revoked";
|
|
16
|
+
phase: HandoffPhase | null;
|
|
17
|
+
codeHint: string | null;
|
|
18
|
+
expiresAt: string | null;
|
|
19
|
+
device: string | null;
|
|
20
|
+
claimedAt: string | null;
|
|
21
|
+
result: Json | null;
|
|
22
|
+
sessionExpired: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function createHandoff(cfg: RpidClientConfig, device?: string, signal?: AbortSignal): Promise<HandoffCode>;
|
|
25
|
+
export declare function handoffStatus(cfg: RpidClientConfig, signal?: AbortSignal): Promise<HandoffStatus>;
|
|
26
|
+
export declare function revokeHandoff(cfg: RpidClientConfig, reason: "continue_here" | "cancel"): Promise<void>;
|
|
27
|
+
export interface HandoffPeek {
|
|
28
|
+
tenant: string;
|
|
29
|
+
codeHint: string;
|
|
30
|
+
expiresAt: string;
|
|
31
|
+
expiresInS: number;
|
|
32
|
+
purpose: string;
|
|
33
|
+
locale?: string;
|
|
34
|
+
appearance?: unknown;
|
|
35
|
+
}
|
|
36
|
+
export declare function peekHandoff(apiUrl: string, code: string, signal?: AbortSignal): Promise<HandoffPeek>;
|
|
37
|
+
export declare function claimHandoff(apiUrl: string, code: string, device?: string, signal?: AbortSignal): Promise<Json>;
|
|
38
|
+
export declare function reportProgress(cfg: RpidClientConfig, step: "front" | "back" | "face"): Promise<void>;
|
|
39
|
+
export declare function postDevice(cfg: RpidClientConfig, snapshot: DeviceSnapshot): Promise<void>;
|
|
40
|
+
export declare function postClientEvents(cfg: RpidClientConfig, events: ClientEvent[], beacon?: boolean): void;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const QR_MAX_VERSION = 10;
|
|
2
|
+
export interface QrMatrix {
|
|
3
|
+
size: number;
|
|
4
|
+
version: number;
|
|
5
|
+
mask: number;
|
|
6
|
+
modules: boolean[][];
|
|
7
|
+
}
|
|
8
|
+
export declare function encodeQr(text: string, mask?: number): QrMatrix;
|
|
9
|
+
export declare function qrPath(m: QrMatrix, margin?: number): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
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";
|
|
3
|
+
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;
|
|
6
|
+
export declare function attemptsText(t: Strings, retriesLeft: number | null | undefined): string | null;
|
|
7
|
+
export declare function faceRetryText(t: Strings, retriesLeft: number): string;
|
|
8
|
+
export declare const LOCALES: readonly Locale[];
|
|
9
|
+
export declare function browserLocale(languages?: readonly string[]): Locale | undefined;
|
|
10
|
+
export declare function resolveLocale(host?: Locale | null, tenant?: Locale | "auto" | null, languages?: readonly string[]): Locale;
|