@koraidv/react 1.5.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.
@@ -0,0 +1,299 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React, { ReactNode } from 'react';
3
+ import { KoraIDV, Configuration, VerificationStep, Verification, LivenessSession, LivenessChallenge, KoraError, DocumentType, DocumentQualityResponse } from '@koraidv/core';
4
+
5
+ /**
6
+ * KoraIDV context value
7
+ */
8
+ interface KoraIDVContextValue {
9
+ sdk: KoraIDV;
10
+ isConfigured: boolean;
11
+ }
12
+ /**
13
+ * KoraIDV Provider props
14
+ */
15
+ interface KoraIDVProviderProps {
16
+ /**
17
+ * API key for authentication
18
+ */
19
+ apiKey: string;
20
+ /**
21
+ * Tenant ID
22
+ */
23
+ tenantId: string;
24
+ /**
25
+ * Additional configuration options
26
+ */
27
+ config?: Partial<Omit<Configuration, 'apiKey' | 'tenantId'>>;
28
+ /**
29
+ * Children components
30
+ */
31
+ children: ReactNode;
32
+ }
33
+ /**
34
+ * KoraIDV Provider component
35
+ *
36
+ * Wraps your application and provides access to KoraIDV SDK
37
+ *
38
+ * @example
39
+ * ```tsx
40
+ * <KoraIDVProvider apiKey="ck_live_xxx" tenantId="tenant-uuid">
41
+ * <App />
42
+ * </KoraIDVProvider>
43
+ * ```
44
+ */
45
+ declare function KoraIDVProvider({ apiKey, tenantId, config, children, }: KoraIDVProviderProps): react_jsx_runtime.JSX.Element;
46
+
47
+ /**
48
+ * Verification state
49
+ */
50
+ interface VerificationState {
51
+ step: VerificationStep;
52
+ verification: Verification | null;
53
+ livenessSession: LivenessSession | null;
54
+ currentChallenge: LivenessChallenge | null;
55
+ completedChallenges: number;
56
+ isLoading: boolean;
57
+ error: KoraError | null;
58
+ }
59
+ /**
60
+ * useKoraIDV hook return value
61
+ */
62
+ interface UseKoraIDVReturn {
63
+ /**
64
+ * Current verification state
65
+ */
66
+ state: VerificationState;
67
+ /**
68
+ * Start a new verification
69
+ */
70
+ startVerification: (externalId: string, tier?: string) => Promise<void>;
71
+ /**
72
+ * Resume an existing verification
73
+ */
74
+ resumeVerification: (verificationId: string) => Promise<void>;
75
+ /**
76
+ * Accept consent and proceed
77
+ */
78
+ acceptConsent: () => void;
79
+ /**
80
+ * Select document type
81
+ */
82
+ selectDocumentType: (type: DocumentType) => void;
83
+ /**
84
+ * Check document quality before uploading
85
+ */
86
+ checkDocumentQuality: (imageData: Blob) => Promise<DocumentQualityResponse>;
87
+ /**
88
+ * Upload document image
89
+ */
90
+ uploadDocument: (imageData: Blob, side: 'front' | 'back') => Promise<boolean>;
91
+ /**
92
+ * Upload selfie image
93
+ */
94
+ uploadSelfie: (imageData: Blob) => Promise<boolean>;
95
+ /**
96
+ * Start liveness session
97
+ */
98
+ startLiveness: () => Promise<void>;
99
+ /**
100
+ * Submit liveness challenge
101
+ */
102
+ submitChallenge: (imageData: Blob) => Promise<boolean>;
103
+ /**
104
+ * Complete verification
105
+ */
106
+ complete: () => Promise<Verification | null>;
107
+ /**
108
+ * Cancel verification
109
+ */
110
+ cancel: () => void;
111
+ /**
112
+ * Reset state for retry
113
+ */
114
+ retry: () => void;
115
+ /**
116
+ * SDK instance
117
+ */
118
+ sdk: KoraIDV;
119
+ }
120
+ /**
121
+ * Hook for managing KoraIDV verification flow
122
+ *
123
+ * @example
124
+ * ```tsx
125
+ * function VerificationPage() {
126
+ * const { state, startVerification, uploadDocument } = useKoraIDV();
127
+ *
128
+ * useEffect(() => {
129
+ * startVerification('user-123');
130
+ * }, []);
131
+ *
132
+ * // Render based on state.step
133
+ * }
134
+ * ```
135
+ */
136
+ declare function useKoraIDV(): UseKoraIDVReturn;
137
+
138
+ /**
139
+ * VerificationFlow component props
140
+ */
141
+ interface VerificationFlowProps {
142
+ externalId: string;
143
+ tier?: 'basic' | 'standard' | 'enhanced';
144
+ documentTypes?: DocumentType[];
145
+ onComplete?: (verification: Verification) => void;
146
+ onError?: (error: KoraError) => void;
147
+ onCancel?: () => void;
148
+ className?: string;
149
+ style?: React.CSSProperties;
150
+ }
151
+ /**
152
+ * Complete verification flow component
153
+ */
154
+ declare function VerificationFlow({ externalId, tier, documentTypes, onComplete, onError, onCancel, className, style, }: VerificationFlowProps): react_jsx_runtime.JSX.Element;
155
+
156
+ interface ConsentScreenProps {
157
+ onAccept: () => void;
158
+ onDecline: () => void;
159
+ }
160
+ declare function ConsentScreen({ onAccept, onDecline }: ConsentScreenProps): react_jsx_runtime.JSX.Element;
161
+
162
+ interface CountryInfo {
163
+ id: string;
164
+ name: string;
165
+ flagEmoji: string;
166
+ documentTypes: string[];
167
+ }
168
+ interface CountrySelectionScreenProps {
169
+ countries?: CountryInfo[];
170
+ onSelect: (country: CountryInfo) => void;
171
+ onCancel: () => void;
172
+ }
173
+ declare function CountrySelectionScreen({ countries, onSelect, onCancel }: CountrySelectionScreenProps): react_jsx_runtime.JSX.Element;
174
+
175
+ interface DocumentSelectionScreenProps {
176
+ documentTypes?: DocumentType[];
177
+ selectedCountry?: CountryInfo | null;
178
+ onSelect: (type: DocumentType) => void;
179
+ onCancel: () => void;
180
+ }
181
+ declare function DocumentSelectionScreen({ documentTypes, selectedCountry, onSelect, onCancel, }: DocumentSelectionScreenProps): react_jsx_runtime.JSX.Element;
182
+
183
+ interface DocumentCaptureScreenProps {
184
+ side: 'front' | 'back';
185
+ documentType?: string;
186
+ requiresBack?: boolean;
187
+ onQualityCheck?: (imageData: Blob) => Promise<DocumentQualityResponse>;
188
+ onCapture: (imageData: Blob) => Promise<boolean>;
189
+ onCancel: () => void;
190
+ }
191
+ declare function DocumentCaptureScreen({ side, documentType, requiresBack, onQualityCheck, onCapture, onCancel, }: DocumentCaptureScreenProps): react_jsx_runtime.JSX.Element;
192
+
193
+ interface SelfieCaptureScreenProps {
194
+ onCapture: (imageData: Blob) => Promise<boolean>;
195
+ onCancel: () => void;
196
+ }
197
+ declare function SelfieCaptureScreen({ onCapture, onCancel }: SelfieCaptureScreenProps): react_jsx_runtime.JSX.Element;
198
+
199
+ interface LivenessScreenProps {
200
+ session: LivenessSession | null;
201
+ currentChallenge: LivenessChallenge | null;
202
+ completedChallenges: number;
203
+ onChallengeComplete: (imageData: Blob) => Promise<boolean>;
204
+ onStart: () => Promise<void>;
205
+ onComplete: () => Promise<any>;
206
+ onCancel: () => void;
207
+ }
208
+ declare function LivenessScreen({ session, currentChallenge, completedChallenges, onChallengeComplete, onStart, onComplete, onCancel, }: LivenessScreenProps): react_jsx_runtime.JSX.Element;
209
+
210
+ type ResultPageMode = 'detailed' | 'simplified';
211
+ interface ResultScreenProps {
212
+ verification: Verification;
213
+ onDone: () => void;
214
+ onRetry?: () => void;
215
+ /**
216
+ * Result page mode. "simplified" shows only pass/fail/review with no metrics or scores;
217
+ * "detailed" (default) shows the full breakdown. Overrides the tenant-level
218
+ * `result_page_mode` setting when provided.
219
+ */
220
+ resultPageMode?: ResultPageMode;
221
+ /** @deprecated Use `resultPageMode="simplified"` instead. */
222
+ simplified?: boolean;
223
+ /** Custom messages for simplified mode */
224
+ customMessages?: {
225
+ successTitle?: string;
226
+ successMessage?: string;
227
+ failedTitle?: string;
228
+ failedMessage?: string;
229
+ reviewTitle?: string;
230
+ reviewMessage?: string;
231
+ };
232
+ }
233
+ declare function ResultScreen({ verification, onDone, onRetry, resultPageMode, simplified, customMessages }: ResultScreenProps): react_jsx_runtime.JSX.Element;
234
+
235
+ interface ErrorScreenProps {
236
+ error: KoraError;
237
+ onRetry: () => void;
238
+ onCancel: () => void;
239
+ }
240
+ declare function ErrorScreen({ error, onRetry, onCancel }: ErrorScreenProps): react_jsx_runtime.JSX.Element;
241
+
242
+ /** Handoff session from the identity service */
243
+ interface HandoffSession {
244
+ token: string;
245
+ captureUrl: string;
246
+ expiresAt: string;
247
+ expiresIn: number;
248
+ }
249
+ interface QrHandoffScreenProps {
250
+ /** Handoff session containing the QR token and capture URL */
251
+ session: HandoffSession;
252
+ /** Called when the mobile capture completes */
253
+ onMobileCaptureComplete: () => void;
254
+ /** Called when the user chooses to continue on this device */
255
+ onContinueOnDevice: () => void;
256
+ /** Called when the session expires */
257
+ onExpired: () => void;
258
+ /** Called to refresh the session (generate new QR) */
259
+ onRefresh: () => void;
260
+ /** EventSource for SSE status updates */
261
+ eventSource?: EventSource | null;
262
+ }
263
+ /**
264
+ * QR Handoff Screen — displays a QR code for the user to scan with their
265
+ * mobile phone to continue the verification capture on a better camera.
266
+ */
267
+ declare function QrHandoffScreen({ session, onMobileCaptureComplete, onContinueOnDevice, onExpired, onRefresh, eventSource, }: QrHandoffScreenProps): react_jsx_runtime.JSX.Element;
268
+
269
+ interface StepProgressBarProps {
270
+ total: number;
271
+ current: number;
272
+ isDark?: boolean;
273
+ }
274
+ declare function StepProgressBar({ total, current, isDark }: StepProgressBarProps): react_jsx_runtime.JSX.Element;
275
+ interface ScoreCardProps {
276
+ score: number;
277
+ badge: string;
278
+ gradient: string;
279
+ }
280
+ declare function ScoreCard({ score, badge, gradient }: ScoreCardProps): react_jsx_runtime.JSX.Element;
281
+ type MetricStatus = 'pass' | 'fail' | 'borderline';
282
+ interface ScoreMetricRowProps {
283
+ label: string;
284
+ score: number;
285
+ icon: string;
286
+ status: MetricStatus;
287
+ message?: string;
288
+ }
289
+ declare function ScoreMetricRow({ label, score, icon, status, message }: ScoreMetricRowProps): react_jsx_runtime.JSX.Element;
290
+ interface ProcessingStep {
291
+ label: string;
292
+ status: 'done' | 'active' | 'pending';
293
+ }
294
+ interface ProcessingScreenProps {
295
+ steps: ProcessingStep[];
296
+ }
297
+ declare function ProcessingScreen({ steps }: ProcessingScreenProps): react_jsx_runtime.JSX.Element;
298
+
299
+ export { ConsentScreen, type CountryInfo, CountrySelectionScreen, DocumentCaptureScreen, DocumentSelectionScreen, ErrorScreen, type KoraIDVContextValue, KoraIDVProvider, LivenessScreen, ProcessingScreen, QrHandoffScreen, ResultScreen, ScoreCard, ScoreMetricRow, SelfieCaptureScreen, StepProgressBar, VerificationFlow, type VerificationFlowProps, useKoraIDV };
@@ -0,0 +1,299 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React, { ReactNode } from 'react';
3
+ import { KoraIDV, Configuration, VerificationStep, Verification, LivenessSession, LivenessChallenge, KoraError, DocumentType, DocumentQualityResponse } from '@koraidv/core';
4
+
5
+ /**
6
+ * KoraIDV context value
7
+ */
8
+ interface KoraIDVContextValue {
9
+ sdk: KoraIDV;
10
+ isConfigured: boolean;
11
+ }
12
+ /**
13
+ * KoraIDV Provider props
14
+ */
15
+ interface KoraIDVProviderProps {
16
+ /**
17
+ * API key for authentication
18
+ */
19
+ apiKey: string;
20
+ /**
21
+ * Tenant ID
22
+ */
23
+ tenantId: string;
24
+ /**
25
+ * Additional configuration options
26
+ */
27
+ config?: Partial<Omit<Configuration, 'apiKey' | 'tenantId'>>;
28
+ /**
29
+ * Children components
30
+ */
31
+ children: ReactNode;
32
+ }
33
+ /**
34
+ * KoraIDV Provider component
35
+ *
36
+ * Wraps your application and provides access to KoraIDV SDK
37
+ *
38
+ * @example
39
+ * ```tsx
40
+ * <KoraIDVProvider apiKey="ck_live_xxx" tenantId="tenant-uuid">
41
+ * <App />
42
+ * </KoraIDVProvider>
43
+ * ```
44
+ */
45
+ declare function KoraIDVProvider({ apiKey, tenantId, config, children, }: KoraIDVProviderProps): react_jsx_runtime.JSX.Element;
46
+
47
+ /**
48
+ * Verification state
49
+ */
50
+ interface VerificationState {
51
+ step: VerificationStep;
52
+ verification: Verification | null;
53
+ livenessSession: LivenessSession | null;
54
+ currentChallenge: LivenessChallenge | null;
55
+ completedChallenges: number;
56
+ isLoading: boolean;
57
+ error: KoraError | null;
58
+ }
59
+ /**
60
+ * useKoraIDV hook return value
61
+ */
62
+ interface UseKoraIDVReturn {
63
+ /**
64
+ * Current verification state
65
+ */
66
+ state: VerificationState;
67
+ /**
68
+ * Start a new verification
69
+ */
70
+ startVerification: (externalId: string, tier?: string) => Promise<void>;
71
+ /**
72
+ * Resume an existing verification
73
+ */
74
+ resumeVerification: (verificationId: string) => Promise<void>;
75
+ /**
76
+ * Accept consent and proceed
77
+ */
78
+ acceptConsent: () => void;
79
+ /**
80
+ * Select document type
81
+ */
82
+ selectDocumentType: (type: DocumentType) => void;
83
+ /**
84
+ * Check document quality before uploading
85
+ */
86
+ checkDocumentQuality: (imageData: Blob) => Promise<DocumentQualityResponse>;
87
+ /**
88
+ * Upload document image
89
+ */
90
+ uploadDocument: (imageData: Blob, side: 'front' | 'back') => Promise<boolean>;
91
+ /**
92
+ * Upload selfie image
93
+ */
94
+ uploadSelfie: (imageData: Blob) => Promise<boolean>;
95
+ /**
96
+ * Start liveness session
97
+ */
98
+ startLiveness: () => Promise<void>;
99
+ /**
100
+ * Submit liveness challenge
101
+ */
102
+ submitChallenge: (imageData: Blob) => Promise<boolean>;
103
+ /**
104
+ * Complete verification
105
+ */
106
+ complete: () => Promise<Verification | null>;
107
+ /**
108
+ * Cancel verification
109
+ */
110
+ cancel: () => void;
111
+ /**
112
+ * Reset state for retry
113
+ */
114
+ retry: () => void;
115
+ /**
116
+ * SDK instance
117
+ */
118
+ sdk: KoraIDV;
119
+ }
120
+ /**
121
+ * Hook for managing KoraIDV verification flow
122
+ *
123
+ * @example
124
+ * ```tsx
125
+ * function VerificationPage() {
126
+ * const { state, startVerification, uploadDocument } = useKoraIDV();
127
+ *
128
+ * useEffect(() => {
129
+ * startVerification('user-123');
130
+ * }, []);
131
+ *
132
+ * // Render based on state.step
133
+ * }
134
+ * ```
135
+ */
136
+ declare function useKoraIDV(): UseKoraIDVReturn;
137
+
138
+ /**
139
+ * VerificationFlow component props
140
+ */
141
+ interface VerificationFlowProps {
142
+ externalId: string;
143
+ tier?: 'basic' | 'standard' | 'enhanced';
144
+ documentTypes?: DocumentType[];
145
+ onComplete?: (verification: Verification) => void;
146
+ onError?: (error: KoraError) => void;
147
+ onCancel?: () => void;
148
+ className?: string;
149
+ style?: React.CSSProperties;
150
+ }
151
+ /**
152
+ * Complete verification flow component
153
+ */
154
+ declare function VerificationFlow({ externalId, tier, documentTypes, onComplete, onError, onCancel, className, style, }: VerificationFlowProps): react_jsx_runtime.JSX.Element;
155
+
156
+ interface ConsentScreenProps {
157
+ onAccept: () => void;
158
+ onDecline: () => void;
159
+ }
160
+ declare function ConsentScreen({ onAccept, onDecline }: ConsentScreenProps): react_jsx_runtime.JSX.Element;
161
+
162
+ interface CountryInfo {
163
+ id: string;
164
+ name: string;
165
+ flagEmoji: string;
166
+ documentTypes: string[];
167
+ }
168
+ interface CountrySelectionScreenProps {
169
+ countries?: CountryInfo[];
170
+ onSelect: (country: CountryInfo) => void;
171
+ onCancel: () => void;
172
+ }
173
+ declare function CountrySelectionScreen({ countries, onSelect, onCancel }: CountrySelectionScreenProps): react_jsx_runtime.JSX.Element;
174
+
175
+ interface DocumentSelectionScreenProps {
176
+ documentTypes?: DocumentType[];
177
+ selectedCountry?: CountryInfo | null;
178
+ onSelect: (type: DocumentType) => void;
179
+ onCancel: () => void;
180
+ }
181
+ declare function DocumentSelectionScreen({ documentTypes, selectedCountry, onSelect, onCancel, }: DocumentSelectionScreenProps): react_jsx_runtime.JSX.Element;
182
+
183
+ interface DocumentCaptureScreenProps {
184
+ side: 'front' | 'back';
185
+ documentType?: string;
186
+ requiresBack?: boolean;
187
+ onQualityCheck?: (imageData: Blob) => Promise<DocumentQualityResponse>;
188
+ onCapture: (imageData: Blob) => Promise<boolean>;
189
+ onCancel: () => void;
190
+ }
191
+ declare function DocumentCaptureScreen({ side, documentType, requiresBack, onQualityCheck, onCapture, onCancel, }: DocumentCaptureScreenProps): react_jsx_runtime.JSX.Element;
192
+
193
+ interface SelfieCaptureScreenProps {
194
+ onCapture: (imageData: Blob) => Promise<boolean>;
195
+ onCancel: () => void;
196
+ }
197
+ declare function SelfieCaptureScreen({ onCapture, onCancel }: SelfieCaptureScreenProps): react_jsx_runtime.JSX.Element;
198
+
199
+ interface LivenessScreenProps {
200
+ session: LivenessSession | null;
201
+ currentChallenge: LivenessChallenge | null;
202
+ completedChallenges: number;
203
+ onChallengeComplete: (imageData: Blob) => Promise<boolean>;
204
+ onStart: () => Promise<void>;
205
+ onComplete: () => Promise<any>;
206
+ onCancel: () => void;
207
+ }
208
+ declare function LivenessScreen({ session, currentChallenge, completedChallenges, onChallengeComplete, onStart, onComplete, onCancel, }: LivenessScreenProps): react_jsx_runtime.JSX.Element;
209
+
210
+ type ResultPageMode = 'detailed' | 'simplified';
211
+ interface ResultScreenProps {
212
+ verification: Verification;
213
+ onDone: () => void;
214
+ onRetry?: () => void;
215
+ /**
216
+ * Result page mode. "simplified" shows only pass/fail/review with no metrics or scores;
217
+ * "detailed" (default) shows the full breakdown. Overrides the tenant-level
218
+ * `result_page_mode` setting when provided.
219
+ */
220
+ resultPageMode?: ResultPageMode;
221
+ /** @deprecated Use `resultPageMode="simplified"` instead. */
222
+ simplified?: boolean;
223
+ /** Custom messages for simplified mode */
224
+ customMessages?: {
225
+ successTitle?: string;
226
+ successMessage?: string;
227
+ failedTitle?: string;
228
+ failedMessage?: string;
229
+ reviewTitle?: string;
230
+ reviewMessage?: string;
231
+ };
232
+ }
233
+ declare function ResultScreen({ verification, onDone, onRetry, resultPageMode, simplified, customMessages }: ResultScreenProps): react_jsx_runtime.JSX.Element;
234
+
235
+ interface ErrorScreenProps {
236
+ error: KoraError;
237
+ onRetry: () => void;
238
+ onCancel: () => void;
239
+ }
240
+ declare function ErrorScreen({ error, onRetry, onCancel }: ErrorScreenProps): react_jsx_runtime.JSX.Element;
241
+
242
+ /** Handoff session from the identity service */
243
+ interface HandoffSession {
244
+ token: string;
245
+ captureUrl: string;
246
+ expiresAt: string;
247
+ expiresIn: number;
248
+ }
249
+ interface QrHandoffScreenProps {
250
+ /** Handoff session containing the QR token and capture URL */
251
+ session: HandoffSession;
252
+ /** Called when the mobile capture completes */
253
+ onMobileCaptureComplete: () => void;
254
+ /** Called when the user chooses to continue on this device */
255
+ onContinueOnDevice: () => void;
256
+ /** Called when the session expires */
257
+ onExpired: () => void;
258
+ /** Called to refresh the session (generate new QR) */
259
+ onRefresh: () => void;
260
+ /** EventSource for SSE status updates */
261
+ eventSource?: EventSource | null;
262
+ }
263
+ /**
264
+ * QR Handoff Screen — displays a QR code for the user to scan with their
265
+ * mobile phone to continue the verification capture on a better camera.
266
+ */
267
+ declare function QrHandoffScreen({ session, onMobileCaptureComplete, onContinueOnDevice, onExpired, onRefresh, eventSource, }: QrHandoffScreenProps): react_jsx_runtime.JSX.Element;
268
+
269
+ interface StepProgressBarProps {
270
+ total: number;
271
+ current: number;
272
+ isDark?: boolean;
273
+ }
274
+ declare function StepProgressBar({ total, current, isDark }: StepProgressBarProps): react_jsx_runtime.JSX.Element;
275
+ interface ScoreCardProps {
276
+ score: number;
277
+ badge: string;
278
+ gradient: string;
279
+ }
280
+ declare function ScoreCard({ score, badge, gradient }: ScoreCardProps): react_jsx_runtime.JSX.Element;
281
+ type MetricStatus = 'pass' | 'fail' | 'borderline';
282
+ interface ScoreMetricRowProps {
283
+ label: string;
284
+ score: number;
285
+ icon: string;
286
+ status: MetricStatus;
287
+ message?: string;
288
+ }
289
+ declare function ScoreMetricRow({ label, score, icon, status, message }: ScoreMetricRowProps): react_jsx_runtime.JSX.Element;
290
+ interface ProcessingStep {
291
+ label: string;
292
+ status: 'done' | 'active' | 'pending';
293
+ }
294
+ interface ProcessingScreenProps {
295
+ steps: ProcessingStep[];
296
+ }
297
+ declare function ProcessingScreen({ steps }: ProcessingScreenProps): react_jsx_runtime.JSX.Element;
298
+
299
+ export { ConsentScreen, type CountryInfo, CountrySelectionScreen, DocumentCaptureScreen, DocumentSelectionScreen, ErrorScreen, type KoraIDVContextValue, KoraIDVProvider, LivenessScreen, ProcessingScreen, QrHandoffScreen, ResultScreen, ScoreCard, ScoreMetricRow, SelfieCaptureScreen, StepProgressBar, VerificationFlow, type VerificationFlowProps, useKoraIDV };