@authorizeearth/react 1.0.3
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/dist/index.d.mts +566 -0
- package/dist/index.d.ts +566 -0
- package/dist/index.js +689 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +680 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +61 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SDK Type Definitions
|
|
5
|
+
*
|
|
6
|
+
* Public and internal TypeScript types for the AuthorizeEarth SDK.
|
|
7
|
+
* Types marked @internal are not part of the public API.
|
|
8
|
+
*
|
|
9
|
+
* @module types
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Display mode for the verification UI.
|
|
13
|
+
*
|
|
14
|
+
* - `modal`: Centered overlay with backdrop, suitable for desktop (default)
|
|
15
|
+
* - `fullscreen`: Full viewport coverage, used automatically on mobile
|
|
16
|
+
*/
|
|
17
|
+
type DisplayMode = 'modal' | 'fullscreen';
|
|
18
|
+
/**
|
|
19
|
+
* Theme mode for the verification UI.
|
|
20
|
+
*
|
|
21
|
+
* - `light`: Light theme with white backgrounds (default)
|
|
22
|
+
* - `dark`: Dark theme with dark backgrounds (requires custom branding)
|
|
23
|
+
*
|
|
24
|
+
* Note: Dark theme requires custom branding to be configured in the
|
|
25
|
+
* AuthorizeEarth dashboard. If requested without custom branding,
|
|
26
|
+
* the SDK will automatically fall back to light mode.
|
|
27
|
+
*/
|
|
28
|
+
type Theme = 'light' | 'dark';
|
|
29
|
+
/**
|
|
30
|
+
* Configuration options for initializing the AuthorizeEarth SDK.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const config: AuthorizeEarthConfig = {
|
|
35
|
+
* sessionToken: 'sess_xxx',
|
|
36
|
+
* displayMode: 'modal',
|
|
37
|
+
* theme: 'light',
|
|
38
|
+
* onSuccess: (result) => console.log(result),
|
|
39
|
+
* onError: (error) => console.error(error),
|
|
40
|
+
* };
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
interface AuthorizeEarthConfig {
|
|
44
|
+
/**
|
|
45
|
+
* Session token obtained from your backend via the AuthorizeEarth API.
|
|
46
|
+
* Required for all verification flows.
|
|
47
|
+
*
|
|
48
|
+
* Create a session by calling POST /v1/merchant/integration/session
|
|
49
|
+
* with your API key from your backend server.
|
|
50
|
+
*/
|
|
51
|
+
sessionToken: string;
|
|
52
|
+
/**
|
|
53
|
+
* How to display the verification UI.
|
|
54
|
+
*
|
|
55
|
+
* - `modal`: Centered overlay (default, recommended for desktop)
|
|
56
|
+
* - `fullscreen`: Full viewport (automatically used on mobile)
|
|
57
|
+
*
|
|
58
|
+
* @default 'modal'
|
|
59
|
+
*/
|
|
60
|
+
displayMode?: DisplayMode;
|
|
61
|
+
/**
|
|
62
|
+
* Theme for the verification UI.
|
|
63
|
+
*
|
|
64
|
+
* Note: `dark` theme requires custom branding to be configured
|
|
65
|
+
* in your AuthorizeEarth dashboard. Without custom branding,
|
|
66
|
+
* the SDK will automatically fall back to light mode.
|
|
67
|
+
*
|
|
68
|
+
* @default 'light'
|
|
69
|
+
*/
|
|
70
|
+
theme?: Theme;
|
|
71
|
+
/**
|
|
72
|
+
* Called when verification completes successfully.
|
|
73
|
+
*
|
|
74
|
+
* @param result - Contains status, verificationId, and sessionId
|
|
75
|
+
*/
|
|
76
|
+
onSuccess?: (result: VerificationResult) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Called when an error occurs during verification.
|
|
79
|
+
*
|
|
80
|
+
* Note: Not all errors are fatal. Check `error.details.can_retry`
|
|
81
|
+
* to determine if the user can retry the current step.
|
|
82
|
+
*
|
|
83
|
+
* @param error - Contains error code, message, and optional details
|
|
84
|
+
*/
|
|
85
|
+
onError?: (error: VerificationError) => void;
|
|
86
|
+
/**
|
|
87
|
+
* Called when the user closes the verification UI.
|
|
88
|
+
* Use this to handle abandonment tracking or cleanup.
|
|
89
|
+
*/
|
|
90
|
+
onClose?: () => void;
|
|
91
|
+
/**
|
|
92
|
+
* Called for lifecycle events during the verification process.
|
|
93
|
+
* Useful for analytics, progress tracking, and debugging.
|
|
94
|
+
*
|
|
95
|
+
* @param event - Contains event type, timestamp, and optional metadata
|
|
96
|
+
*/
|
|
97
|
+
onEvent?: (event: VerificationEvent) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Enable test mode for development and testing.
|
|
100
|
+
*
|
|
101
|
+
* When true, uses the sandbox environment and requires
|
|
102
|
+
* `templateId` to be set. No real verifications are performed.
|
|
103
|
+
*
|
|
104
|
+
* @default false
|
|
105
|
+
*/
|
|
106
|
+
testMode?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Template ID for test mode sessions.
|
|
109
|
+
*
|
|
110
|
+
* Required when `testMode` is true. Specifies which verification
|
|
111
|
+
* template to use in the sandbox environment.
|
|
112
|
+
* Ignored in production mode.
|
|
113
|
+
*/
|
|
114
|
+
templateId?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Integration ID for test mode.
|
|
117
|
+
*
|
|
118
|
+
* Optional identifier to associate test sessions with a
|
|
119
|
+
* specific integration configuration.
|
|
120
|
+
* Only applies when `testMode` is true.
|
|
121
|
+
*/
|
|
122
|
+
integrationId?: string;
|
|
123
|
+
/**
|
|
124
|
+
* External hash for test mode session validation.
|
|
125
|
+
*
|
|
126
|
+
* Used to validate test sessions against expected values.
|
|
127
|
+
* Only applies when `testMode` is true.
|
|
128
|
+
*/
|
|
129
|
+
externalHash?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Simulate specific error conditions in test mode.
|
|
132
|
+
*
|
|
133
|
+
* Useful for testing your error handling logic without
|
|
134
|
+
* triggering real verification failures.
|
|
135
|
+
* Only applies when `testMode` is true.
|
|
136
|
+
*
|
|
137
|
+
* @example 'max_attempts' | 'document_expired' | 'face_mismatch'
|
|
138
|
+
*/
|
|
139
|
+
simulateError?: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Result returned upon successful verification.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* onSuccess: (result) => {
|
|
147
|
+
* if (result.status === 'verified') {
|
|
148
|
+
* grantAccess(result.verificationId);
|
|
149
|
+
* } else if (result.status === 'review_required') {
|
|
150
|
+
* showPendingMessage();
|
|
151
|
+
* }
|
|
152
|
+
* }
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
interface VerificationResult {
|
|
156
|
+
/**
|
|
157
|
+
* Final status of the verification.
|
|
158
|
+
*
|
|
159
|
+
* - `verified`: Identity confirmed, user passed all checks
|
|
160
|
+
* - `rejected`: Identity could not be verified
|
|
161
|
+
* - `review_required`: Manual review needed before final decision
|
|
162
|
+
*/
|
|
163
|
+
status: 'verified' | 'rejected' | 'review_required';
|
|
164
|
+
/**
|
|
165
|
+
* Unique identifier for this verification attempt.
|
|
166
|
+
* Use this to retrieve detailed results from the API.
|
|
167
|
+
*/
|
|
168
|
+
verificationId: string;
|
|
169
|
+
/**
|
|
170
|
+
* Session ID associated with this verification.
|
|
171
|
+
* Matches the sessionToken used to initialize the SDK.
|
|
172
|
+
*/
|
|
173
|
+
sessionId: string;
|
|
174
|
+
/**
|
|
175
|
+
* Additional data returned by the verification process.
|
|
176
|
+
* Contents vary based on your integration configuration.
|
|
177
|
+
*/
|
|
178
|
+
metadata?: Record<string, unknown>;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Error information when verification fails or encounters issues.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* onError: (error) => {
|
|
186
|
+
* if (error.details?.can_retry) {
|
|
187
|
+
* showRetryButton();
|
|
188
|
+
* } else {
|
|
189
|
+
* showFinalError(error.message);
|
|
190
|
+
* }
|
|
191
|
+
* }
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
interface VerificationError {
|
|
195
|
+
/**
|
|
196
|
+
* Machine-readable error code for programmatic handling.
|
|
197
|
+
*
|
|
198
|
+
* @example 'max_attempts' | 'document_expired' | 'session_expired'
|
|
199
|
+
*/
|
|
200
|
+
code: string;
|
|
201
|
+
/**
|
|
202
|
+
* Human-readable error description suitable for display.
|
|
203
|
+
*/
|
|
204
|
+
message: string;
|
|
205
|
+
/**
|
|
206
|
+
* Additional error context when available.
|
|
207
|
+
*
|
|
208
|
+
* May include:
|
|
209
|
+
* - `can_retry`: Whether the user can retry the current step
|
|
210
|
+
* - `attempts_remaining`: Number of attempts left (if applicable)
|
|
211
|
+
* - `category`: Error category for grouping
|
|
212
|
+
* - `is_fatal`: Whether this error ends the session
|
|
213
|
+
*/
|
|
214
|
+
details?: Record<string, unknown>;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Lifecycle event emitted during the verification process.
|
|
218
|
+
*
|
|
219
|
+
* Subscribe to events via the `onEvent` callback to track
|
|
220
|
+
* progress, implement analytics, or handle specific states.
|
|
221
|
+
*/
|
|
222
|
+
interface VerificationEvent {
|
|
223
|
+
/** The type of event that occurred. */
|
|
224
|
+
type: VerificationEventType;
|
|
225
|
+
/** Unix timestamp (ms) when the event occurred. */
|
|
226
|
+
timestamp: number;
|
|
227
|
+
/**
|
|
228
|
+
* Additional event-specific data.
|
|
229
|
+
*
|
|
230
|
+
* Contents vary by event type. For example, `step_changed`
|
|
231
|
+
* events include `stepIndex`, `stepType`, and `totalSteps`.
|
|
232
|
+
*/
|
|
233
|
+
metadata?: Record<string, unknown>;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* All possible verification event types.
|
|
237
|
+
*
|
|
238
|
+
* | Event | Description |
|
|
239
|
+
* |-------|-------------|
|
|
240
|
+
* | `open` | SDK UI has been opened |
|
|
241
|
+
* | `ready` | Iframe loaded and ready for interaction |
|
|
242
|
+
* | `step_changed` | User moved to a new verification step |
|
|
243
|
+
* | `document_captured` | Document image was captured |
|
|
244
|
+
* | `selfie_captured` | Selfie image was captured |
|
|
245
|
+
* | `liveness_complete` | Liveness verification completed |
|
|
246
|
+
* | `processing` | Verification is being processed |
|
|
247
|
+
* | `complete` | Verification flow completed |
|
|
248
|
+
* | `error` | An error occurred |
|
|
249
|
+
* | `close` | User closed the UI |
|
|
250
|
+
* | `camera_fullscreen_request` | Camera needs fullscreen access |
|
|
251
|
+
* | `camera_fullscreen_exit` | Exiting camera fullscreen |
|
|
252
|
+
* | `theme_validated` | Theme validation completed |
|
|
253
|
+
*/
|
|
254
|
+
type VerificationEventType = 'open' | 'ready' | 'step_changed' | 'document_captured' | 'selfie_captured' | 'liveness_complete' | 'processing' | 'complete' | 'error' | 'close' | 'camera_fullscreen_request' | 'camera_fullscreen_exit' | 'theme_validated';
|
|
255
|
+
/**
|
|
256
|
+
* SDK instance returned by create().
|
|
257
|
+
*
|
|
258
|
+
* Use these methods to control the verification UI lifecycle.
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* ```typescript
|
|
262
|
+
* const instance = create(config);
|
|
263
|
+
*
|
|
264
|
+
* // Open when user clicks button
|
|
265
|
+
* button.onclick = () => instance.open();
|
|
266
|
+
*
|
|
267
|
+
* // Clean up when component unmounts
|
|
268
|
+
* onUnmount(() => instance.destroy());
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
interface AuthorizeEarthInstance {
|
|
272
|
+
/**
|
|
273
|
+
* Opens the verification UI.
|
|
274
|
+
*
|
|
275
|
+
* Creates the iframe and displays it in the configured mode.
|
|
276
|
+
* No-op if already open or if the instance has been destroyed.
|
|
277
|
+
*/
|
|
278
|
+
open: () => void;
|
|
279
|
+
/**
|
|
280
|
+
* Requests to close the verification UI.
|
|
281
|
+
*
|
|
282
|
+
* Sends a close request to the iframe, which may prompt
|
|
283
|
+
* the user to confirm if verification is in progress.
|
|
284
|
+
*/
|
|
285
|
+
close: () => void;
|
|
286
|
+
/**
|
|
287
|
+
* Destroys the instance and cleans up all resources.
|
|
288
|
+
*
|
|
289
|
+
* Removes the iframe, event listeners, and DOM elements.
|
|
290
|
+
* Call this when done with the instance to prevent memory leaks.
|
|
291
|
+
* After calling destroy(), the instance cannot be reopened.
|
|
292
|
+
*/
|
|
293
|
+
destroy: () => void;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Core SDK Module
|
|
298
|
+
*
|
|
299
|
+
* Main entry point for creating and managing AuthorizeEarth
|
|
300
|
+
* verification instances. Handles iframe lifecycle, message
|
|
301
|
+
* communication, and UI state management.
|
|
302
|
+
*
|
|
303
|
+
* @module core
|
|
304
|
+
*/
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Creates a new AuthorizeEarth verification instance.
|
|
308
|
+
*
|
|
309
|
+
* This is the primary method for initializing the SDK. It returns
|
|
310
|
+
* an instance with methods to control the verification flow.
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```typescript
|
|
314
|
+
* const verification = create({
|
|
315
|
+
* sessionToken: 'sess_xxx',
|
|
316
|
+
* theme: 'light',
|
|
317
|
+
* displayMode: 'modal',
|
|
318
|
+
* onSuccess: (result) => {
|
|
319
|
+
* console.log('Verified:', result.verificationId);
|
|
320
|
+
* },
|
|
321
|
+
* onError: (error) => {
|
|
322
|
+
* console.error('Failed:', error.message);
|
|
323
|
+
* },
|
|
324
|
+
* });
|
|
325
|
+
*
|
|
326
|
+
* // Open when ready (e.g., on button click)
|
|
327
|
+
* verification.open();
|
|
328
|
+
*
|
|
329
|
+
* // Clean up when done
|
|
330
|
+
* verification.destroy();
|
|
331
|
+
* ```
|
|
332
|
+
*
|
|
333
|
+
* @param config - Configuration options for the verification
|
|
334
|
+
* @returns Instance with open, close, and destroy methods
|
|
335
|
+
*/
|
|
336
|
+
declare function create(config: AuthorizeEarthConfig): AuthorizeEarthInstance;
|
|
337
|
+
/**
|
|
338
|
+
* Creates and immediately opens a verification instance.
|
|
339
|
+
*
|
|
340
|
+
* Convenience method that combines create() and open() for
|
|
341
|
+
* simple use cases where immediate display is desired.
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```typescript
|
|
345
|
+
* start({
|
|
346
|
+
* sessionToken: 'sess_xxx',
|
|
347
|
+
* onSuccess: (result) => console.log('Success:', result),
|
|
348
|
+
* });
|
|
349
|
+
* ```
|
|
350
|
+
*
|
|
351
|
+
* @param config - Configuration options for the verification
|
|
352
|
+
*/
|
|
353
|
+
declare function start(config: AuthorizeEarthConfig): void;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* React Bindings
|
|
357
|
+
*
|
|
358
|
+
* React hook and component for integrating AuthorizeEarth
|
|
359
|
+
* identity verification into React applications.
|
|
360
|
+
*
|
|
361
|
+
* @module react
|
|
362
|
+
*/
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Configuration for the useAuthorizeEarth hook.
|
|
366
|
+
*
|
|
367
|
+
* Extends the core SDK configuration with React-specific patterns
|
|
368
|
+
* like nullable sessionToken for loading states.
|
|
369
|
+
*/
|
|
370
|
+
interface UseAuthorizeEarthConfig {
|
|
371
|
+
/**
|
|
372
|
+
* Session token from your backend.
|
|
373
|
+
*
|
|
374
|
+
* Pass `null` while the token is loading. The hook will not
|
|
375
|
+
* be ready until a valid token string is provided.
|
|
376
|
+
*/
|
|
377
|
+
sessionToken: string | null;
|
|
378
|
+
/**
|
|
379
|
+
* How to display the verification UI.
|
|
380
|
+
* @default 'modal'
|
|
381
|
+
*/
|
|
382
|
+
displayMode?: DisplayMode;
|
|
383
|
+
/**
|
|
384
|
+
* Theme for the verification UI.
|
|
385
|
+
*
|
|
386
|
+
* Note: `dark` requires custom branding configured in your
|
|
387
|
+
* AuthorizeEarth dashboard.
|
|
388
|
+
* @default 'light'
|
|
389
|
+
*/
|
|
390
|
+
theme?: Theme;
|
|
391
|
+
/** Called when verification completes successfully. */
|
|
392
|
+
onSuccess?: (result: VerificationResult) => void;
|
|
393
|
+
/** Called when an error occurs during verification. */
|
|
394
|
+
onError?: (error: VerificationError) => void;
|
|
395
|
+
/** Called when the user closes the verification UI. */
|
|
396
|
+
onClose?: () => void;
|
|
397
|
+
/** Called for lifecycle events during verification. */
|
|
398
|
+
onEvent?: (event: VerificationEvent) => void;
|
|
399
|
+
/**
|
|
400
|
+
* Enable test mode for development and testing.
|
|
401
|
+
* Requires `templateId` when true.
|
|
402
|
+
* @default false
|
|
403
|
+
*/
|
|
404
|
+
testMode?: boolean;
|
|
405
|
+
/**
|
|
406
|
+
* Template ID for test mode sessions.
|
|
407
|
+
* Required when `testMode` is true.
|
|
408
|
+
*/
|
|
409
|
+
templateId?: string;
|
|
410
|
+
/**
|
|
411
|
+
* Integration ID for test mode.
|
|
412
|
+
*/
|
|
413
|
+
integrationId?: string;
|
|
414
|
+
/**
|
|
415
|
+
* Simulate specific error conditions in test mode.
|
|
416
|
+
*/
|
|
417
|
+
simulateError?: string;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Return value from the useAuthorizeEarth hook.
|
|
421
|
+
*/
|
|
422
|
+
interface UseAuthorizeEarthReturn {
|
|
423
|
+
/**
|
|
424
|
+
* Opens the verification UI.
|
|
425
|
+
* No-op if not ready or if sessionToken is null.
|
|
426
|
+
*/
|
|
427
|
+
open: () => void;
|
|
428
|
+
/**
|
|
429
|
+
* Requests the verification UI to close.
|
|
430
|
+
*/
|
|
431
|
+
close: () => void;
|
|
432
|
+
/**
|
|
433
|
+
* Whether the SDK is initialized and ready to open.
|
|
434
|
+
* Will be false while sessionToken is null or loading.
|
|
435
|
+
*/
|
|
436
|
+
ready: boolean;
|
|
437
|
+
/**
|
|
438
|
+
* Initialization error, if any occurred.
|
|
439
|
+
* Check this before rendering to handle edge cases.
|
|
440
|
+
*/
|
|
441
|
+
error: Error | null;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* React hook for integrating AuthorizeEarth identity verification.
|
|
445
|
+
*
|
|
446
|
+
* Manages the SDK instance lifecycle, ensuring proper cleanup on
|
|
447
|
+
* unmount and when configuration changes.
|
|
448
|
+
*
|
|
449
|
+
* @example Basic usage
|
|
450
|
+
* ```tsx
|
|
451
|
+
* function VerifyButton({ sessionToken }) {
|
|
452
|
+
* const { open, ready } = useAuthorizeEarth({
|
|
453
|
+
* sessionToken,
|
|
454
|
+
* onSuccess: (result) => {
|
|
455
|
+
* console.log('Verified:', result.verificationId);
|
|
456
|
+
* },
|
|
457
|
+
* });
|
|
458
|
+
*
|
|
459
|
+
* return (
|
|
460
|
+
* <button onClick={open} disabled={!ready}>
|
|
461
|
+
* {ready ? 'Verify Identity' : 'Loading...'}
|
|
462
|
+
* </button>
|
|
463
|
+
* );
|
|
464
|
+
* }
|
|
465
|
+
* ```
|
|
466
|
+
*
|
|
467
|
+
* @example With theme and display mode
|
|
468
|
+
* ```tsx
|
|
469
|
+
* const { open, ready } = useAuthorizeEarth({
|
|
470
|
+
* sessionToken,
|
|
471
|
+
* theme: 'dark',
|
|
472
|
+
* displayMode: 'fullscreen',
|
|
473
|
+
* onSuccess: handleSuccess,
|
|
474
|
+
* onError: handleError,
|
|
475
|
+
* });
|
|
476
|
+
* ```
|
|
477
|
+
*
|
|
478
|
+
* @param config - Hook configuration options
|
|
479
|
+
* @returns Object with open/close methods and ready/error state
|
|
480
|
+
*/
|
|
481
|
+
declare function useAuthorizeEarth(config: UseAuthorizeEarthConfig): UseAuthorizeEarthReturn;
|
|
482
|
+
/**
|
|
483
|
+
* Props for the AuthorizeEarthButton component.
|
|
484
|
+
*
|
|
485
|
+
* Combines SDK configuration with standard button props.
|
|
486
|
+
*/
|
|
487
|
+
interface AuthorizeEarthButtonProps {
|
|
488
|
+
/**
|
|
489
|
+
* Session token from your backend.
|
|
490
|
+
* Pass `null` while loading - the button will be disabled.
|
|
491
|
+
*/
|
|
492
|
+
sessionToken: string | null;
|
|
493
|
+
/**
|
|
494
|
+
* How to display the verification UI.
|
|
495
|
+
* @default 'modal'
|
|
496
|
+
*/
|
|
497
|
+
displayMode?: DisplayMode;
|
|
498
|
+
/**
|
|
499
|
+
* Theme for the verification UI.
|
|
500
|
+
* @default 'light'
|
|
501
|
+
*/
|
|
502
|
+
theme?: Theme;
|
|
503
|
+
/** Called when verification completes successfully. */
|
|
504
|
+
onSuccess?: (result: VerificationResult) => void;
|
|
505
|
+
/** Called when an error occurs during verification. */
|
|
506
|
+
onError?: (error: VerificationError) => void;
|
|
507
|
+
/** Called when the user closes the verification UI. */
|
|
508
|
+
onClose?: () => void;
|
|
509
|
+
/** Called for lifecycle events during verification. */
|
|
510
|
+
onEvent?: (event: VerificationEvent) => void;
|
|
511
|
+
/** Enable test mode. Requires `templateId`. */
|
|
512
|
+
testMode?: boolean;
|
|
513
|
+
/** Template ID for test mode sessions. */
|
|
514
|
+
templateId?: string;
|
|
515
|
+
/** Integration ID for test mode. */
|
|
516
|
+
integrationId?: string;
|
|
517
|
+
/** Simulate specific error conditions in test mode. */
|
|
518
|
+
simulateError?: string;
|
|
519
|
+
/**
|
|
520
|
+
* Button content.
|
|
521
|
+
* @default 'Verify Identity'
|
|
522
|
+
*/
|
|
523
|
+
children?: React.ReactNode;
|
|
524
|
+
/** CSS class name for the button element. */
|
|
525
|
+
className?: string;
|
|
526
|
+
/** Inline styles for the button element. */
|
|
527
|
+
style?: React.CSSProperties;
|
|
528
|
+
/**
|
|
529
|
+
* Force disable the button.
|
|
530
|
+
* The button is also disabled when `!ready`.
|
|
531
|
+
*/
|
|
532
|
+
disabled?: boolean;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Pre-built button component for triggering identity verification.
|
|
536
|
+
*
|
|
537
|
+
* Wraps the useAuthorizeEarth hook with a button element,
|
|
538
|
+
* automatically handling disabled states while loading.
|
|
539
|
+
*
|
|
540
|
+
* @example Basic usage
|
|
541
|
+
* ```tsx
|
|
542
|
+
* <AuthorizeEarthButton
|
|
543
|
+
* sessionToken={sessionToken}
|
|
544
|
+
* onSuccess={(result) => console.log('Success:', result)}
|
|
545
|
+
* onError={(error) => console.error('Error:', error)}
|
|
546
|
+
* >
|
|
547
|
+
* Verify Your Identity
|
|
548
|
+
* </AuthorizeEarthButton>
|
|
549
|
+
* ```
|
|
550
|
+
*
|
|
551
|
+
* @example With theme and styling
|
|
552
|
+
* ```tsx
|
|
553
|
+
* <AuthorizeEarthButton
|
|
554
|
+
* sessionToken={sessionToken}
|
|
555
|
+
* theme="dark"
|
|
556
|
+
* displayMode="modal"
|
|
557
|
+
* className="btn btn-primary"
|
|
558
|
+
* onSuccess={handleSuccess}
|
|
559
|
+
* >
|
|
560
|
+
* Start Verification
|
|
561
|
+
* </AuthorizeEarthButton>
|
|
562
|
+
* ```
|
|
563
|
+
*/
|
|
564
|
+
declare function AuthorizeEarthButton({ sessionToken, displayMode, theme, testMode, templateId, integrationId, simulateError, onSuccess, onError, onClose, onEvent, children, className, style, disabled, }: AuthorizeEarthButtonProps): JSX.Element;
|
|
565
|
+
|
|
566
|
+
export { AuthorizeEarthButton, type AuthorizeEarthButtonProps, type AuthorizeEarthConfig, type AuthorizeEarthInstance, type DisplayMode, type Theme, type UseAuthorizeEarthConfig, type UseAuthorizeEarthReturn, type VerificationError, type VerificationEvent, type VerificationEventType, type VerificationResult, create, start, useAuthorizeEarth };
|