@glideidentity/web-client-sdk 4.4.8-beta.1 → 4.4.8-beta.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/adapters/react/usePhoneAuth.d.ts +1 -1
- package/dist/adapters/vue/useClient.d.ts +3 -3
- package/dist/adapters/vue/usePhoneAuth.d.ts +1 -1
- package/dist/browser/web-client-sdk.min.js +1 -1
- package/dist/core/phone-auth/api-types.d.ts +112 -27
- package/dist/core/phone-auth/client.d.ts +13 -11
- package/dist/core/phone-auth/client.js +263 -248
- package/dist/core/phone-auth/index.d.ts +1 -1
- package/dist/core/phone-auth/index.js +7 -2
- package/dist/core/phone-auth/strategies/desktop.d.ts +1 -0
- package/dist/core/phone-auth/strategies/desktop.js +64 -18
- package/dist/core/phone-auth/strategies/link.js +97 -5
- package/dist/core/phone-auth/type-guards.d.ts +61 -43
- package/dist/core/phone-auth/type-guards.js +82 -44
- package/dist/core/phone-auth/ui/modal.js +14 -1
- package/dist/core/version.js +1 -1
- package/dist/esm/adapters/react/usePhoneAuth.d.ts +1 -1
- package/dist/esm/adapters/vue/useClient.d.ts +3 -3
- package/dist/esm/adapters/vue/usePhoneAuth.d.ts +1 -1
- package/dist/esm/core/phone-auth/api-types.d.ts +112 -27
- package/dist/esm/core/phone-auth/client.d.ts +13 -11
- package/dist/esm/core/phone-auth/client.js +263 -248
- package/dist/esm/core/phone-auth/index.d.ts +1 -1
- package/dist/esm/core/phone-auth/index.js +3 -1
- package/dist/esm/core/phone-auth/strategies/desktop.d.ts +1 -0
- package/dist/esm/core/phone-auth/strategies/desktop.js +64 -18
- package/dist/esm/core/phone-auth/strategies/link.js +97 -5
- package/dist/esm/core/phone-auth/type-guards.d.ts +61 -43
- package/dist/esm/core/phone-auth/type-guards.js +76 -41
- package/dist/esm/core/phone-auth/ui/modal.js +14 -1
- package/dist/esm/core/version.js +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +3 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -2
- package/package.json +1 -1
|
@@ -386,16 +386,30 @@ export declare function isLinkData(data: any): data is LinkData;
|
|
|
386
386
|
* Check if response is an error
|
|
387
387
|
*/
|
|
388
388
|
export declare function isErrorResponse(response: any): response is ErrorResponse;
|
|
389
|
+
/**
|
|
390
|
+
* Execution mode for authentication flow
|
|
391
|
+
*/
|
|
392
|
+
export type ExecutionMode = 'standard' | 'extended';
|
|
389
393
|
/**
|
|
390
394
|
* Options for invokeSecurePrompt to control UI behavior
|
|
391
395
|
*/
|
|
392
396
|
export interface InvokeOptions {
|
|
393
397
|
/**
|
|
394
|
-
*
|
|
395
|
-
*
|
|
398
|
+
* Prevents SDK from showing its own UI components.
|
|
399
|
+
* Only affects Desktop strategy (shows modal by default).
|
|
400
|
+
* Link/TS43 never show SDK UI, so this has no effect on them.
|
|
401
|
+
*
|
|
396
402
|
* @default false
|
|
397
403
|
*/
|
|
398
|
-
|
|
404
|
+
preventDefaultUI?: boolean;
|
|
405
|
+
/**
|
|
406
|
+
* Controls the response type:
|
|
407
|
+
* - 'standard': Returns credential when complete (Promise<AuthCredential>)
|
|
408
|
+
* - 'extended': Returns control methods + credential promise
|
|
409
|
+
*
|
|
410
|
+
* @default 'standard'
|
|
411
|
+
*/
|
|
412
|
+
executionMode?: ExecutionMode;
|
|
399
413
|
/**
|
|
400
414
|
* UI theme to use for modals and components
|
|
401
415
|
* @default 'dark'
|
|
@@ -420,7 +434,7 @@ export interface InvokeOptions {
|
|
|
420
434
|
error?: any;
|
|
421
435
|
}) => void;
|
|
422
436
|
/**
|
|
423
|
-
* Options for customizing the modal UI (only used when
|
|
437
|
+
* Options for customizing the modal UI (only used when preventDefaultUI=false)
|
|
424
438
|
* Simplified to only include commonly used options
|
|
425
439
|
*/
|
|
426
440
|
modalOptions?: {
|
|
@@ -440,7 +454,7 @@ export interface InvokeOptions {
|
|
|
440
454
|
closeOnEscape?: boolean;
|
|
441
455
|
};
|
|
442
456
|
/**
|
|
443
|
-
* Callback functions for UI events (only used when
|
|
457
|
+
* Callback functions for UI events (only used when preventDefaultUI=false)
|
|
444
458
|
*/
|
|
445
459
|
callbacks?: {
|
|
446
460
|
/** Called when modal is opened */
|
|
@@ -454,35 +468,106 @@ export interface InvokeOptions {
|
|
|
454
468
|
/** Called on error */
|
|
455
469
|
onError?: (error: Error) => void;
|
|
456
470
|
};
|
|
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
|
/**
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
*
|
|
472
|
+
* Custom polling endpoint for Desktop/Link strategies
|
|
473
|
+
* Overrides the SDK configured endpoint and backend-provided status URL
|
|
474
|
+
* Useful for testing or using a proxy endpoint
|
|
475
|
+
* @example '/api/phone-auth/status' or 'https://custom-polling.example.com/status'
|
|
476
|
+
*/
|
|
477
|
+
pollingEndpoint?: string;
|
|
478
|
+
/**
|
|
479
|
+
* Custom polling interval in milliseconds
|
|
480
|
+
* @default 2000 (2 seconds)
|
|
474
481
|
*/
|
|
475
|
-
|
|
482
|
+
pollingInterval?: number;
|
|
476
483
|
/**
|
|
477
|
-
*
|
|
478
|
-
*
|
|
479
|
-
* - For TS43: invokes Digital Credentials API (returns credential)
|
|
480
|
-
* - For Desktop: not used (QR code is shown)
|
|
484
|
+
* Maximum number of polling attempts before timeout
|
|
485
|
+
* @default 30 (1 minute with 2s interval)
|
|
481
486
|
*/
|
|
482
|
-
|
|
487
|
+
maxPollingAttempts?: number;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Authentication credential result
|
|
491
|
+
*/
|
|
492
|
+
export interface AuthCredential {
|
|
493
|
+
/** Authentication credential token */
|
|
494
|
+
credential: string;
|
|
495
|
+
/** Phone number if available */
|
|
496
|
+
phone_number?: PhoneNumber;
|
|
483
497
|
/** Session information */
|
|
484
498
|
session: SessionInfo;
|
|
499
|
+
/** Whether authentication was successful */
|
|
500
|
+
authenticated: boolean;
|
|
485
501
|
}
|
|
502
|
+
/**
|
|
503
|
+
* Base interface for extended mode responses
|
|
504
|
+
*/
|
|
505
|
+
export interface ExtendedResponse {
|
|
506
|
+
/** Authentication strategy */
|
|
507
|
+
strategy: AuthenticationStrategy;
|
|
508
|
+
/** Session information */
|
|
509
|
+
session: SessionInfo;
|
|
510
|
+
/** Promise that resolves to the credential */
|
|
511
|
+
credential: Promise<AuthCredential>;
|
|
512
|
+
/** Cancel the authentication flow */
|
|
513
|
+
cancel: () => void;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Extended response for Desktop strategy
|
|
517
|
+
*/
|
|
518
|
+
export interface DesktopExtendedResponse extends ExtendedResponse {
|
|
519
|
+
strategy: 'desktop';
|
|
520
|
+
/** QR code data for custom UI */
|
|
521
|
+
qr_code_data: {
|
|
522
|
+
/** iOS QR code image */
|
|
523
|
+
ios_qr_image?: string;
|
|
524
|
+
/** Android QR code image */
|
|
525
|
+
android_qr_image?: string;
|
|
526
|
+
/** Generic QR code image */
|
|
527
|
+
qr_code?: string;
|
|
528
|
+
/** Challenge pattern */
|
|
529
|
+
challenge?: any;
|
|
530
|
+
};
|
|
531
|
+
/** Start or restart polling */
|
|
532
|
+
start_polling: () => Promise<AuthCredential>;
|
|
533
|
+
/** Stop polling */
|
|
534
|
+
stop_polling: () => void;
|
|
535
|
+
/** Whether currently polling */
|
|
536
|
+
is_polling: boolean;
|
|
537
|
+
/** Modal reference if UI was shown */
|
|
538
|
+
modal_ref?: any;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Extended response for Link strategy
|
|
542
|
+
*/
|
|
543
|
+
export interface LinkExtendedResponse extends ExtendedResponse {
|
|
544
|
+
strategy: 'link';
|
|
545
|
+
/** Additional data for Link strategy */
|
|
546
|
+
data: {
|
|
547
|
+
/** App URL that was opened */
|
|
548
|
+
app_url: string;
|
|
549
|
+
};
|
|
550
|
+
/** Re-open the app link */
|
|
551
|
+
trigger: () => void;
|
|
552
|
+
/** Start or restart polling */
|
|
553
|
+
start_polling?: () => Promise<AuthCredential>;
|
|
554
|
+
/** Stop polling */
|
|
555
|
+
stop_polling?: () => void;
|
|
556
|
+
/** Whether currently polling */
|
|
557
|
+
is_polling?: boolean;
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Extended response for TS43 strategy
|
|
561
|
+
*/
|
|
562
|
+
export interface TS43ExtendedResponse extends ExtendedResponse {
|
|
563
|
+
strategy: 'ts43';
|
|
564
|
+
/** Re-trigger credential request */
|
|
565
|
+
trigger: () => Promise<void>;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Combined type for all extended responses
|
|
569
|
+
*/
|
|
570
|
+
export type AnyExtendedResponse = DesktopExtendedResponse | LinkExtendedResponse | TS43ExtendedResponse;
|
|
486
571
|
declare const _default: {
|
|
487
572
|
USE_CASE: {
|
|
488
573
|
readonly GET_PHONE_NUMBER: "GetPhoneNumber";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PrepareResponse, GetPhoneNumberResponse, VerifyPhoneNumberResponse, SecureCredentialResponse, SessionInfo, InvokeOptions,
|
|
1
|
+
import type { PrepareResponse, GetPhoneNumberResponse, VerifyPhoneNumberResponse, SecureCredentialResponse, SessionInfo, InvokeOptions, AuthCredential, AnyExtendedResponse } from './api-types';
|
|
2
2
|
import type { AuthConfig, PhoneAuthOptions, PhoneAuthResult } from './types';
|
|
3
3
|
import type { DesktopAuthOptions } from './strategies/desktop';
|
|
4
4
|
export declare class PhoneAuthClient {
|
|
@@ -86,25 +86,27 @@ export declare class PhoneAuthClient {
|
|
|
86
86
|
* });
|
|
87
87
|
* ```
|
|
88
88
|
*
|
|
89
|
-
* @example
|
|
89
|
+
* @example Extended Mode (returns control methods)
|
|
90
90
|
* ```typescript
|
|
91
|
-
* // Get
|
|
91
|
+
* // Get control methods for custom implementation
|
|
92
92
|
* const result = await phoneAuth.invokeSecurePrompt(prepareResult, {
|
|
93
|
-
*
|
|
93
|
+
* executionMode: 'extended',
|
|
94
|
+
* preventDefaultUI: true // Desktop: no modal
|
|
94
95
|
* });
|
|
95
96
|
*
|
|
96
|
-
* if (result.strategy === '
|
|
97
|
-
* //
|
|
98
|
-
*
|
|
99
|
-
*
|
|
97
|
+
* if (result.strategy === 'desktop') {
|
|
98
|
+
* // Show custom QR UI
|
|
99
|
+
* showCustomQR(result.qr_code_data);
|
|
100
|
+
* // Start polling
|
|
101
|
+
* await result.start_polling();
|
|
100
102
|
* }
|
|
101
103
|
* ```
|
|
102
104
|
*
|
|
103
105
|
* @param prepareResponse - Response from prepare() with strategy and data
|
|
104
|
-
* @param options - Control UI behavior
|
|
105
|
-
* @returns Credential or
|
|
106
|
+
* @param options - Control UI behavior and response type
|
|
107
|
+
* @returns Credential or ExtendedResponse based on executionMode
|
|
106
108
|
*/
|
|
107
|
-
invokeSecurePrompt(prepareResponse: PrepareResponse, options?: InvokeOptions | DesktopAuthOptions): Promise<SecureCredentialResponse['vp_token'] |
|
|
109
|
+
invokeSecurePrompt(prepareResponse: PrepareResponse, options?: InvokeOptions | DesktopAuthOptions): Promise<AuthCredential | SecureCredentialResponse['vp_token'] | AnyExtendedResponse>;
|
|
108
110
|
/**
|
|
109
111
|
* Step 3A: Get phone number from credential
|
|
110
112
|
*
|