@glideidentity/web-client-sdk 4.4.8-beta.1

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 (136) hide show
  1. package/README.md +938 -0
  2. package/dist/adapters/angular/client.service.d.ts +7 -0
  3. package/dist/adapters/angular/client.service.js +30 -0
  4. package/dist/adapters/angular/index.d.ts +3 -0
  5. package/dist/adapters/angular/index.js +18 -0
  6. package/dist/adapters/angular/phone-auth.service.d.ts +38 -0
  7. package/dist/adapters/angular/phone-auth.service.js +130 -0
  8. package/dist/adapters/react/index.d.ts +9 -0
  9. package/dist/adapters/react/index.js +28 -0
  10. package/dist/adapters/react/useClient.d.ts +26 -0
  11. package/dist/adapters/react/useClient.js +121 -0
  12. package/dist/adapters/react/usePhoneAuth.d.ts +23 -0
  13. package/dist/adapters/react/usePhoneAuth.js +95 -0
  14. package/dist/adapters/vanilla/client.d.ts +8 -0
  15. package/dist/adapters/vanilla/client.js +33 -0
  16. package/dist/adapters/vanilla/index.d.ts +3 -0
  17. package/dist/adapters/vanilla/index.js +18 -0
  18. package/dist/adapters/vanilla/phone-auth.d.ts +46 -0
  19. package/dist/adapters/vanilla/phone-auth.js +138 -0
  20. package/dist/adapters/vue/index.d.ts +10 -0
  21. package/dist/adapters/vue/index.js +36 -0
  22. package/dist/adapters/vue/useClient.d.ts +115 -0
  23. package/dist/adapters/vue/useClient.js +131 -0
  24. package/dist/adapters/vue/usePhoneAuth.d.ts +94 -0
  25. package/dist/adapters/vue/usePhoneAuth.js +103 -0
  26. package/dist/browser/web-client-sdk.min.js +2 -0
  27. package/dist/browser/web-client-sdk.min.js.LICENSE.txt +1 -0
  28. package/dist/browser.d.ts +7 -0
  29. package/dist/browser.js +31 -0
  30. package/dist/core/client.d.ts +22 -0
  31. package/dist/core/client.js +77 -0
  32. package/dist/core/logger.d.ts +130 -0
  33. package/dist/core/logger.js +370 -0
  34. package/dist/core/phone-auth/api-types.d.ts +525 -0
  35. package/dist/core/phone-auth/api-types.js +215 -0
  36. package/dist/core/phone-auth/client.d.ts +187 -0
  37. package/dist/core/phone-auth/client.js +1353 -0
  38. package/dist/core/phone-auth/error-utils.d.ts +110 -0
  39. package/dist/core/phone-auth/error-utils.js +350 -0
  40. package/dist/core/phone-auth/index.d.ts +7 -0
  41. package/dist/core/phone-auth/index.js +47 -0
  42. package/dist/core/phone-auth/status-types.d.ts +107 -0
  43. package/dist/core/phone-auth/status-types.js +31 -0
  44. package/dist/core/phone-auth/strategies/desktop.d.ts +113 -0
  45. package/dist/core/phone-auth/strategies/desktop.js +502 -0
  46. package/dist/core/phone-auth/strategies/index.d.ts +11 -0
  47. package/dist/core/phone-auth/strategies/index.js +15 -0
  48. package/dist/core/phone-auth/strategies/link.d.ts +81 -0
  49. package/dist/core/phone-auth/strategies/link.js +265 -0
  50. package/dist/core/phone-auth/strategies/ts43.d.ts +32 -0
  51. package/dist/core/phone-auth/strategies/ts43.js +146 -0
  52. package/dist/core/phone-auth/strategies/types.d.ts +18 -0
  53. package/dist/core/phone-auth/strategies/types.js +6 -0
  54. package/dist/core/phone-auth/type-guards.d.ts +125 -0
  55. package/dist/core/phone-auth/type-guards.js +160 -0
  56. package/dist/core/phone-auth/types.d.ts +232 -0
  57. package/dist/core/phone-auth/types.js +93 -0
  58. package/dist/core/phone-auth/ui/mobile-debug-console.d.ts +25 -0
  59. package/dist/core/phone-auth/ui/mobile-debug-console.js +288 -0
  60. package/dist/core/phone-auth/ui/modal.d.ts +84 -0
  61. package/dist/core/phone-auth/ui/modal.js +574 -0
  62. package/dist/core/phone-auth/validation-utils.d.ts +66 -0
  63. package/dist/core/phone-auth/validation-utils.js +182 -0
  64. package/dist/core/types.d.ts +62 -0
  65. package/dist/core/types.js +2 -0
  66. package/dist/core/version.d.ts +1 -0
  67. package/dist/core/version.js +5 -0
  68. package/dist/esm/adapters/angular/client.service.d.ts +7 -0
  69. package/dist/esm/adapters/angular/client.service.js +27 -0
  70. package/dist/esm/adapters/angular/index.d.ts +3 -0
  71. package/dist/esm/adapters/angular/index.js +4 -0
  72. package/dist/esm/adapters/angular/phone-auth.service.d.ts +38 -0
  73. package/dist/esm/adapters/angular/phone-auth.service.js +127 -0
  74. package/dist/esm/adapters/react/index.d.ts +9 -0
  75. package/dist/esm/adapters/react/index.js +8 -0
  76. package/dist/esm/adapters/react/useClient.d.ts +26 -0
  77. package/dist/esm/adapters/react/useClient.js +116 -0
  78. package/dist/esm/adapters/react/usePhoneAuth.d.ts +23 -0
  79. package/dist/esm/adapters/react/usePhoneAuth.js +92 -0
  80. package/dist/esm/adapters/vanilla/client.d.ts +8 -0
  81. package/dist/esm/adapters/vanilla/client.js +29 -0
  82. package/dist/esm/adapters/vanilla/index.d.ts +3 -0
  83. package/dist/esm/adapters/vanilla/index.js +4 -0
  84. package/dist/esm/adapters/vanilla/phone-auth.d.ts +46 -0
  85. package/dist/esm/adapters/vanilla/phone-auth.js +134 -0
  86. package/dist/esm/adapters/vue/index.d.ts +10 -0
  87. package/dist/esm/adapters/vue/index.js +11 -0
  88. package/dist/esm/adapters/vue/useClient.d.ts +115 -0
  89. package/dist/esm/adapters/vue/useClient.js +127 -0
  90. package/dist/esm/adapters/vue/usePhoneAuth.d.ts +94 -0
  91. package/dist/esm/adapters/vue/usePhoneAuth.js +100 -0
  92. package/dist/esm/browser.d.ts +7 -0
  93. package/dist/esm/browser.js +11 -0
  94. package/dist/esm/core/client.d.ts +22 -0
  95. package/dist/esm/core/client.js +70 -0
  96. package/dist/esm/core/logger.d.ts +130 -0
  97. package/dist/esm/core/logger.js +359 -0
  98. package/dist/esm/core/phone-auth/api-types.d.ts +525 -0
  99. package/dist/esm/core/phone-auth/api-types.js +203 -0
  100. package/dist/esm/core/phone-auth/client.d.ts +187 -0
  101. package/dist/esm/core/phone-auth/client.js +1316 -0
  102. package/dist/esm/core/phone-auth/error-utils.d.ts +110 -0
  103. package/dist/esm/core/phone-auth/error-utils.js +338 -0
  104. package/dist/esm/core/phone-auth/index.d.ts +7 -0
  105. package/dist/esm/core/phone-auth/index.js +6 -0
  106. package/dist/esm/core/phone-auth/status-types.d.ts +107 -0
  107. package/dist/esm/core/phone-auth/status-types.js +26 -0
  108. package/dist/esm/core/phone-auth/strategies/desktop.d.ts +113 -0
  109. package/dist/esm/core/phone-auth/strategies/desktop.js +496 -0
  110. package/dist/esm/core/phone-auth/strategies/index.d.ts +11 -0
  111. package/dist/esm/core/phone-auth/strategies/index.js +7 -0
  112. package/dist/esm/core/phone-auth/strategies/link.d.ts +81 -0
  113. package/dist/esm/core/phone-auth/strategies/link.js +261 -0
  114. package/dist/esm/core/phone-auth/strategies/ts43.d.ts +32 -0
  115. package/dist/esm/core/phone-auth/strategies/ts43.js +142 -0
  116. package/dist/esm/core/phone-auth/strategies/types.d.ts +18 -0
  117. package/dist/esm/core/phone-auth/strategies/types.js +5 -0
  118. package/dist/esm/core/phone-auth/type-guards.d.ts +125 -0
  119. package/dist/esm/core/phone-auth/type-guards.js +150 -0
  120. package/dist/esm/core/phone-auth/types.d.ts +232 -0
  121. package/dist/esm/core/phone-auth/types.js +76 -0
  122. package/dist/esm/core/phone-auth/ui/mobile-debug-console.d.ts +25 -0
  123. package/dist/esm/core/phone-auth/ui/mobile-debug-console.js +284 -0
  124. package/dist/esm/core/phone-auth/ui/modal.d.ts +84 -0
  125. package/dist/esm/core/phone-auth/ui/modal.js +570 -0
  126. package/dist/esm/core/phone-auth/validation-utils.d.ts +66 -0
  127. package/dist/esm/core/phone-auth/validation-utils.js +174 -0
  128. package/dist/esm/core/types.d.ts +62 -0
  129. package/dist/esm/core/types.js +1 -0
  130. package/dist/esm/core/version.d.ts +1 -0
  131. package/dist/esm/core/version.js +2 -0
  132. package/dist/esm/index.d.ts +12 -0
  133. package/dist/esm/index.js +15 -0
  134. package/dist/index.d.ts +12 -0
  135. package/dist/index.js +52 -0
  136. package/package.json +92 -0
@@ -0,0 +1,525 @@
1
+ /**
2
+ * Glide Phone Authentication API Types
3
+ *
4
+ * This file is copied from the master API specification at /glide-api-types.ts
5
+ * It defines the exact contract that ALL implementations must follow.
6
+ *
7
+ * NAMING CONVENTION:
8
+ * - ALL TYPES USE snake_case FOR API COMMUNICATION
9
+ * - Frontend SDKs should use snake_case throughout for consistency
10
+ * - This eliminates conversion errors and makes debugging easier
11
+ * - While not idiomatic JavaScript, it matches the API exactly
12
+ */
13
+ /** E.164 format phone number: "+1234567890" */
14
+ export type PhoneNumber = string;
15
+ /** ISO 8601 timestamp: "2024-01-15T09:30:00Z" */
16
+ export type Timestamp = string;
17
+ /** RFC 4122 UUID: "550e8400-e29b-41d4-a716-446655440000" */
18
+ export type UUID = string;
19
+ /**
20
+ * Session information used across all operations
21
+ * Maintains state between prepare and process steps
22
+ */
23
+ export interface SessionInfo {
24
+ /** Unique session identifier */
25
+ session_key: string;
26
+ /** Security nonce */
27
+ nonce?: string;
28
+ /** Encryption key for secure operations */
29
+ enc_key?: string;
30
+ /** Additional metadata from server */
31
+ metadata?: Record<string, string>;
32
+ }
33
+ /**
34
+ * Public Land Mobile Network identifiers
35
+ * Identifies the carrier network
36
+ */
37
+ export interface PLMN {
38
+ /** Mobile Country Code (exactly 3 digits) */
39
+ mcc: string;
40
+ /** Mobile Network Code (2-3 digits) */
41
+ mnc: string;
42
+ }
43
+ /**
44
+ * User consent information for privacy compliance
45
+ */
46
+ export interface ConsentData {
47
+ /** What the user is consenting to */
48
+ consent_text: string;
49
+ /** URL to privacy policy */
50
+ policy_link: string;
51
+ /** Brief policy description */
52
+ policy_text: string;
53
+ }
54
+ /**
55
+ * Browser/client information for strategy selection
56
+ */
57
+ export interface ClientInfo {
58
+ /** navigator.userAgent */
59
+ user_agent: string;
60
+ /** navigator.platform */
61
+ platform: string;
62
+ }
63
+ export declare const USE_CASE: {
64
+ readonly GET_PHONE_NUMBER: "GetPhoneNumber";
65
+ readonly VERIFY_PHONE_NUMBER: "VerifyPhoneNumber";
66
+ };
67
+ export type UseCase = typeof USE_CASE[keyof typeof USE_CASE];
68
+ export declare const AUTHENTICATION_STRATEGY: {
69
+ readonly TS43: "ts43";
70
+ readonly LINK: "link";
71
+ readonly DESKTOP: "desktop";
72
+ };
73
+ export type AuthenticationStrategy = typeof AUTHENTICATION_STRATEGY[keyof typeof AUTHENTICATION_STRATEGY];
74
+ /**
75
+ * Advanced options for prepare requests
76
+ * Contains optional configuration for special features and future extensibility
77
+ */
78
+ export interface PrepareOptions {
79
+ /**
80
+ * Parent session ID for desktop-mobile binding.
81
+ * When a mobile device scans a desktop QR code, the mobile session (child)
82
+ * links back to the desktop session (parent)
83
+ */
84
+ parent_session_id?: string;
85
+ /**
86
+ * UI theme preference for consistency across all authentication touchpoints.
87
+ * Affects SDK modals, mobile app, and OAuth callback pages.
88
+ * @default 'dark'
89
+ */
90
+ theme?: 'dark' | 'light';
91
+ /** Additional options can be added here for future extensibility */
92
+ [key: string]: any;
93
+ }
94
+ /**
95
+ * Request to prepare authentication session
96
+ * Note: nonce and id are auto-generated by SDKs if not provided
97
+ */
98
+ export interface PrepareRequest {
99
+ /** Use case for this authentication (optional when parent_session_id is provided - inherited from parent) */
100
+ use_case?: UseCase;
101
+ /** One of these is required (or parent_session_id in options) */
102
+ /** E.164 format phone number */
103
+ phone_number?: PhoneNumber;
104
+ /** Alternative to phone_number */
105
+ plmn?: PLMN;
106
+ /** Optional: Auto-generated by SDKs if not provided */
107
+ /** Unique nonce (SDK generates secure random if not provided) */
108
+ nonce?: string;
109
+ /** Request identifier (SDK generates unique ID if not provided) */
110
+ id?: string;
111
+ /** Optional fields */
112
+ /** User consent information */
113
+ consent_data?: ConsentData;
114
+ /** Client information for strategy selection */
115
+ client_info?: ClientInfo;
116
+ /** Advanced options for special features */
117
+ options?: PrepareOptions;
118
+ }
119
+ /**
120
+ * Response from prepare authentication
121
+ */
122
+ export interface PrepareResponse {
123
+ /** Selected authentication strategy */
124
+ authentication_strategy: AuthenticationStrategy;
125
+ /** Session information for subsequent requests - named 'session' consistently */
126
+ session: SessionInfo;
127
+ /** Strategy-specific data */
128
+ data: TS43Data | LinkData | DesktopData;
129
+ }
130
+ /**
131
+ * TS43 strategy data
132
+ */
133
+ export interface TS43Data {
134
+ protocol: string;
135
+ data: {
136
+ nonce: string;
137
+ response_mode: string;
138
+ response_type: string;
139
+ dcql_query: {
140
+ credentials: Array<{
141
+ id: string;
142
+ format: string;
143
+ meta: {
144
+ vct_values: string[];
145
+ credential_authorization_jwt: string;
146
+ };
147
+ claims?: string[];
148
+ }>;
149
+ };
150
+ };
151
+ }
152
+ /**
153
+ * Link strategy data
154
+ */
155
+ export interface LinkData {
156
+ /** URL to redirect user to */
157
+ url: string;
158
+ /** URL to return to after authentication */
159
+ return_url?: string;
160
+ /** Status URL for polling authentication status */
161
+ status_url?: string;
162
+ /** Additional parameters */
163
+ params?: Record<string, string>;
164
+ }
165
+ /**
166
+ * Desktop strategy data
167
+ * Used for QR code-based authentication from desktop browsers
168
+ */
169
+ export interface DesktopData {
170
+ /** Protocol version for QR authentication */
171
+ protocol?: string;
172
+ /** Inner data container with QR code details */
173
+ data?: {
174
+ /** QR code image as base64 data URI (data:image/png;base64,...) */
175
+ qr_code_image?: string;
176
+ /** Alternative field name for QR code (for compatibility) */
177
+ qr_code?: string;
178
+ /** iOS-specific QR code image */
179
+ ios_qr_image?: string;
180
+ /** Android-specific QR code image */
181
+ android_qr_image?: string;
182
+ /** iOS authentication URL */
183
+ ios_url?: string;
184
+ /** Android authentication URL */
185
+ android_url?: string;
186
+ /** Unique session identifier for the QR code */
187
+ session_id?: string;
188
+ /** Status polling URL */
189
+ status_url?: string;
190
+ /** Mobile authentication URL */
191
+ url?: string;
192
+ /** Polling interval in milliseconds (default: 2000) */
193
+ polling_interval?: number;
194
+ /** QR code expiration time in seconds */
195
+ expires_in?: number;
196
+ };
197
+ /** Legacy flat structure support */
198
+ /** QR code image as base64 data URI (data:image/png;base64,...) */
199
+ qr_code_image?: string;
200
+ /** Alternative field name for QR code (for compatibility) */
201
+ qr_code?: string;
202
+ /** iOS-specific QR code image */
203
+ ios_qr_image?: string;
204
+ /** Android-specific QR code image */
205
+ android_qr_image?: string;
206
+ /** iOS authentication URL */
207
+ ios_url?: string;
208
+ /** Android authentication URL */
209
+ android_url?: string;
210
+ /** Unique session identifier for the QR code */
211
+ session_id?: string;
212
+ /** Polling endpoint to check authentication status */
213
+ polling_endpoint?: string;
214
+ /** Status polling URL */
215
+ status_url?: string;
216
+ /** Polling interval in milliseconds (default: 2000) */
217
+ polling_interval?: number;
218
+ /** QR code expiration time in seconds */
219
+ expires_in?: number;
220
+ /** Optional deep link URL for mobile app */
221
+ deep_link?: string;
222
+ /** Mobile authentication URL */
223
+ url?: string;
224
+ }
225
+ /**
226
+ * Response from browser's Digital Credentials API
227
+ * This type is only used in frontend SDKs
228
+ */
229
+ export interface SecureCredentialResponse {
230
+ vp_token: {
231
+ [aggregator_id: string]: string | string[];
232
+ };
233
+ }
234
+ /**
235
+ * Base type for processing credential requests
236
+ * Both GetPhoneNumber and VerifyPhoneNumber use the same request structure
237
+ * but are kept as separate types for:
238
+ * - Future extensibility (each may add unique fields)
239
+ * - Clear API semantics (distinct operations)
240
+ * - Type safety (prevents accidental misuse)
241
+ */
242
+ /**
243
+ * Request to get phone number
244
+ */
245
+ export interface GetPhoneNumberRequest {
246
+ /** Session from PrepareResponse - consistent naming */
247
+ session: SessionInfo;
248
+ /** Credential string extracted from SecureCredentialResponse.vp_token[id] */
249
+ credential: string;
250
+ /** Use case must be 'GetPhoneNumber' - required for server routing */
251
+ use_case: typeof USE_CASE.GET_PHONE_NUMBER;
252
+ }
253
+ /**
254
+ * Response with phone number
255
+ */
256
+ export interface GetPhoneNumberResponse {
257
+ /** E.164 format phone number */
258
+ phone_number: PhoneNumber;
259
+ /** Audience from TS43 (optional) */
260
+ aud?: string;
261
+ }
262
+ /**
263
+ * Request to verify phone number
264
+ * Note: Similar to GetPhoneNumberRequest but with different use_case value
265
+ */
266
+ export interface VerifyPhoneNumberRequest {
267
+ /** Session from PrepareResponse - consistent naming */
268
+ session: SessionInfo;
269
+ /** Credential string extracted from SecureCredentialResponse.vp_token[id] */
270
+ credential: string;
271
+ /** Use case must be 'VerifyPhoneNumber' - required for server routing */
272
+ use_case: typeof USE_CASE.VERIFY_PHONE_NUMBER;
273
+ }
274
+ /**
275
+ * Response from phone number verification
276
+ */
277
+ export interface VerifyPhoneNumberResponse {
278
+ /** The phone number that was verified */
279
+ phone_number: PhoneNumber;
280
+ /** Whether verification was successful */
281
+ verified: boolean;
282
+ /** Audience from TS43 (optional) */
283
+ aud?: string;
284
+ }
285
+ /**
286
+ * Error codes - MUST match server implementation
287
+ */
288
+ export declare const ERROR_CODE: {
289
+ readonly INVALID_PHONE_NUMBER: "INVALID_PHONE_NUMBER";
290
+ readonly MISSING_REQUIRED_FIELD: "MISSING_REQUIRED_FIELD";
291
+ readonly INVALID_USE_CASE: "INVALID_USE_CASE";
292
+ readonly INVALID_SESSION: "INVALID_SESSION";
293
+ readonly SESSION_EXPIRED: "SESSION_EXPIRED";
294
+ readonly CARRIER_NOT_ELIGIBLE: "CARRIER_NOT_ELIGIBLE";
295
+ readonly UNSUPPORTED_PLATFORM: "UNSUPPORTED_PLATFORM";
296
+ readonly PHONE_NUMBER_MISMATCH: "PHONE_NUMBER_MISMATCH";
297
+ readonly INVALID_CREDENTIAL: "INVALID_CREDENTIAL";
298
+ readonly VERIFICATION_FAILED: "VERIFICATION_FAILED";
299
+ readonly USE_CASE_MISMATCH: "USE_CASE_MISMATCH";
300
+ readonly RATE_LIMIT_EXCEEDED: "RATE_LIMIT_EXCEEDED";
301
+ readonly INTERNAL_SERVER_ERROR: "INTERNAL_SERVER_ERROR";
302
+ readonly SERVICE_UNAVAILABLE: "SERVICE_UNAVAILABLE";
303
+ };
304
+ export type ErrorCode = typeof ERROR_CODE[keyof typeof ERROR_CODE];
305
+ /**
306
+ * Error messages - User-friendly messages for each error code
307
+ */
308
+ export declare const ERROR_MESSAGES: Record<ErrorCode, string>;
309
+ /**
310
+ * HTTP status codes for each error
311
+ */
312
+ export declare const ERROR_STATUS_CODES: Record<ErrorCode, number>;
313
+ /**
314
+ * Additional error details
315
+ */
316
+ export interface ErrorDetails {
317
+ /** Field that caused the error */
318
+ field?: string;
319
+ /** Detailed reason for the error */
320
+ reason?: string;
321
+ /** Carrier name for carrier-specific errors */
322
+ carrier_name?: string;
323
+ /** Seconds until retry allowed (for rate limits) */
324
+ retry_after?: number;
325
+ /** Additional context */
326
+ [key: string]: any;
327
+ }
328
+ /**
329
+ * Standard error response format
330
+ */
331
+ export interface ErrorResponse {
332
+ /** Machine-readable error code */
333
+ code: ErrorCode;
334
+ /** User-friendly error message */
335
+ message: string;
336
+ /** Request tracking ID */
337
+ request_id?: UUID;
338
+ /** ISO 8601 timestamp */
339
+ timestamp?: Timestamp;
340
+ /** Distributed tracing ID */
341
+ trace_id?: string;
342
+ /** Span ID for tracing */
343
+ span_id?: string;
344
+ /** Service that generated the error */
345
+ service?: string;
346
+ /** Additional error context */
347
+ details?: ErrorDetails;
348
+ }
349
+ /**
350
+ * E.164 phone number validation regex
351
+ */
352
+ export declare const E164_REGEX: RegExp;
353
+ /**
354
+ * Validate phone number format
355
+ */
356
+ export declare function validatePhoneNumber(phone: string): boolean;
357
+ /**
358
+ * Validate PLMN format
359
+ */
360
+ export declare function validatePLMN(plmn: PLMN): boolean;
361
+ /**
362
+ * Validate session info
363
+ */
364
+ export declare function validateSession(session: SessionInfo): boolean;
365
+ /**
366
+ * Validate use case
367
+ */
368
+ export declare function validateUseCase(useCase: string): useCase is UseCase;
369
+ /**
370
+ * Create error response helper
371
+ */
372
+ export declare function createErrorResponse(code: ErrorCode, details?: ErrorDetails, requestId?: string): ErrorResponse;
373
+ /**
374
+ * Get HTTP status code for error
375
+ */
376
+ export declare function getErrorStatusCode(code: ErrorCode): number;
377
+ /**
378
+ * Check if data is TS43 strategy data
379
+ */
380
+ export declare function isTS43Data(data: any): data is TS43Data;
381
+ /**
382
+ * Check if data is Link strategy data
383
+ */
384
+ export declare function isLinkData(data: any): data is LinkData;
385
+ /**
386
+ * Check if response is an error
387
+ */
388
+ export declare function isErrorResponse(response: any): response is ErrorResponse;
389
+ /**
390
+ * Options for invokeSecurePrompt to control UI behavior
391
+ */
392
+ export interface InvokeOptions {
393
+ /**
394
+ * If true, returns raw data without showing any UI
395
+ * If false/undefined, shows appropriate UI (modal/button)
396
+ * @default false
397
+ */
398
+ headless?: boolean;
399
+ /**
400
+ * UI theme to use for modals and components
401
+ * @default 'dark'
402
+ */
403
+ theme?: 'dark' | 'light';
404
+ /**
405
+ * Whether to automatically trigger the authentication
406
+ * - For Link: automatically opens App Clip URL on invocation
407
+ * - For TS43: attempts to trigger credential API (may fail due to browser restrictions)
408
+ * - For Desktop: N/A (QR code is shown)
409
+ * @default true
410
+ */
411
+ autoTrigger?: boolean;
412
+ /**
413
+ * Called when trigger is attempted (for Link/TS43)
414
+ * @param data Information about the trigger attempt
415
+ */
416
+ onTriggerAttempt?: (data: {
417
+ strategy: string;
418
+ url?: string;
419
+ success?: boolean;
420
+ error?: any;
421
+ }) => void;
422
+ /**
423
+ * Options for customizing the modal UI (only used when headless=false)
424
+ * Simplified to only include commonly used options
425
+ */
426
+ modalOptions?: {
427
+ /** CSS class to add to the modal container */
428
+ className?: string;
429
+ /** Title text for the modal */
430
+ title?: string;
431
+ /** Description text for the modal */
432
+ description?: string;
433
+ /** Button text */
434
+ buttonText?: string;
435
+ /** Whether to show close button @default true */
436
+ showCloseButton?: boolean;
437
+ /** Allow closing modal by clicking backdrop/overlay @default true */
438
+ closeOnBackdrop?: boolean;
439
+ /** Allow closing modal by pressing Escape key @default true */
440
+ closeOnEscape?: boolean;
441
+ };
442
+ /**
443
+ * Callback functions for UI events (only used when headless=false)
444
+ */
445
+ callbacks?: {
446
+ /** Called when modal is opened */
447
+ onOpen?: () => void;
448
+ /** Called when modal is closed */
449
+ onClose?: () => void;
450
+ /** Called when authentication starts */
451
+ onAuthStart?: () => void;
452
+ /** Called when authentication completes */
453
+ onAuthComplete?: (result: any) => void;
454
+ /** Called on error */
455
+ onError?: (error: Error) => void;
456
+ };
457
+ }
458
+ /**
459
+ * Result returned in headless mode
460
+ */
461
+ export interface HeadlessResult {
462
+ /** The authentication strategy being used */
463
+ strategy: AuthenticationStrategy;
464
+ /** For Link strategy: the URL to open */
465
+ url?: string;
466
+ /** For Desktop strategy: the QR code data */
467
+ qrCode?: string;
468
+ /** For TS43: the credential request data */
469
+ credentialRequest?: any;
470
+ /**
471
+ * Promise that resolves when authentication completes
472
+ * - For Link/Desktop: polls for completion
473
+ * - For TS43: not used (trigger returns credential directly)
474
+ */
475
+ pollingPromise?: Promise<any>;
476
+ /**
477
+ * Function to trigger authentication action
478
+ * - For Link: opens App Clip URL (can be called multiple times)
479
+ * - For TS43: invokes Digital Credentials API (returns credential)
480
+ * - For Desktop: not used (QR code is shown)
481
+ */
482
+ trigger?: (() => void) | (() => Promise<any>);
483
+ /** Session information */
484
+ session: SessionInfo;
485
+ }
486
+ declare const _default: {
487
+ USE_CASE: {
488
+ readonly GET_PHONE_NUMBER: "GetPhoneNumber";
489
+ readonly VERIFY_PHONE_NUMBER: "VerifyPhoneNumber";
490
+ };
491
+ AUTHENTICATION_STRATEGY: {
492
+ readonly TS43: "ts43";
493
+ readonly LINK: "link";
494
+ readonly DESKTOP: "desktop";
495
+ };
496
+ ERROR_CODE: {
497
+ readonly INVALID_PHONE_NUMBER: "INVALID_PHONE_NUMBER";
498
+ readonly MISSING_REQUIRED_FIELD: "MISSING_REQUIRED_FIELD";
499
+ readonly INVALID_USE_CASE: "INVALID_USE_CASE";
500
+ readonly INVALID_SESSION: "INVALID_SESSION";
501
+ readonly SESSION_EXPIRED: "SESSION_EXPIRED";
502
+ readonly CARRIER_NOT_ELIGIBLE: "CARRIER_NOT_ELIGIBLE";
503
+ readonly UNSUPPORTED_PLATFORM: "UNSUPPORTED_PLATFORM";
504
+ readonly PHONE_NUMBER_MISMATCH: "PHONE_NUMBER_MISMATCH";
505
+ readonly INVALID_CREDENTIAL: "INVALID_CREDENTIAL";
506
+ readonly VERIFICATION_FAILED: "VERIFICATION_FAILED";
507
+ readonly USE_CASE_MISMATCH: "USE_CASE_MISMATCH";
508
+ readonly RATE_LIMIT_EXCEEDED: "RATE_LIMIT_EXCEEDED";
509
+ readonly INTERNAL_SERVER_ERROR: "INTERNAL_SERVER_ERROR";
510
+ readonly SERVICE_UNAVAILABLE: "SERVICE_UNAVAILABLE";
511
+ };
512
+ ERROR_MESSAGES: Record<ErrorCode, string>;
513
+ ERROR_STATUS_CODES: Record<ErrorCode, number>;
514
+ E164_REGEX: RegExp;
515
+ validatePhoneNumber: typeof validatePhoneNumber;
516
+ validatePLMN: typeof validatePLMN;
517
+ validateSession: typeof validateSession;
518
+ validateUseCase: typeof validateUseCase;
519
+ isTS43Data: typeof isTS43Data;
520
+ isLinkData: typeof isLinkData;
521
+ isErrorResponse: typeof isErrorResponse;
522
+ createErrorResponse: typeof createErrorResponse;
523
+ getErrorStatusCode: typeof getErrorStatusCode;
524
+ };
525
+ export default _default;