@authsome/ui-core 0.1.9 → 1.0.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.
package/dist/index.d.mts DELETED
@@ -1,825 +0,0 @@
1
- import { A as AuthErrorType, a as AuthError, V as ValidationError, C as CookieData, b as AuthContext, c as AuthProvider, S as SignInRequest, d as SignUpRequest, U as UpdateUserRequest, P as PasswordChangeRequest, e as PasswordResetRequest, f as PasswordResetConfirmRequest, O as OAuthSignInRequest, g as OAuthCallbackRequest, h as OAuthProvider, M as MagicLinkRequest, i as MagicLinkVerifyRequest, j as PhoneAuthRequest, k as PhoneVerifyRequest, T as TwoFactorSetupRequest, l as TwoFactorSetupResponse, m as TwoFactorVerifyRequest, n as TwoFactorMethod, o as PasskeyRegisterRequest, p as PasskeyCredential, q as PasskeyAuthRequest, r as Organization, s as OrganizationMembership, t as User, u as Session } from './provider-DWklI8Wr.mjs';
2
- export { Q as AuthResponse, v as AuthState, a3 as Device, F as DeviceAuthorizeRequest, B as DeviceCodeVerifyRequest, E as DeviceCodeVerifyResponse, D as DeviceFlowInitiateRequest, z as DeviceFlowInitiateResponse, G as DeviceTokenPollRequest, I as DeviceTokenPollResponse, H as DeviceTokenPollStatus, $ as EnrollMFAFactorRequest, L as FieldDefinition, K as FieldType, J as FieldValidation, a5 as ListSessionsOptions, a6 as ListSessionsResponse, a1 as MFAChallengeRequest, a2 as MFAChallengeResponse, _ as MFAFactor, x as OAuthConfig, R as ProviderConfig, W as RequestContext, Z as ResendVerificationRequest, X as SendVerificationEmailRequest, w as SessionData, a4 as SessionInfo, N as SignupFieldsResponse, y as TwoFactorConfig, Y as VerifyEmailRequest, a0 as VerifyMFAFactorRequest } from './provider-DWklI8Wr.mjs';
3
- import { Storage, Observable, Unsubscribe } from './types/index.mjs';
4
- export { Listener, LocalStorageAdapter, MemoryStorageAdapter, SessionStorageAdapter } from './types/index.mjs';
5
- export { BaseAuthProvider } from './adapters/index.mjs';
6
-
7
- /**
8
- * Error handling utilities
9
- */
10
-
11
- /**
12
- * Create an auth error
13
- *
14
- * @deprecated Use `new AuthError()` directly instead
15
- */
16
- declare function createAuthError(type: AuthErrorType, message: string, details?: Record<string, unknown>, code?: string | number): AuthError;
17
- /**
18
- * Check if an error is an auth error
19
- */
20
- declare function isAuthError(error: unknown): error is AuthError;
21
- /**
22
- * Convert unknown error to auth error
23
- */
24
- declare function toAuthError(error: unknown): AuthError;
25
- /**
26
- * Check if error is a network error
27
- */
28
- declare function isNetworkError(error: unknown): boolean;
29
- /**
30
- * Check if error indicates authentication is required
31
- */
32
- declare function isUnauthenticatedError(error: unknown): boolean;
33
- /**
34
- * Check if error requires MFA
35
- */
36
- declare function isMFARequiredError(error: unknown): boolean;
37
-
38
- /**
39
- * Internationalization (i18n) types and interfaces
40
- */
41
- /**
42
- * Complete locale interface for all auth-related text
43
- */
44
- interface AuthLocale {
45
- common: {
46
- loading: string;
47
- submit: string;
48
- cancel: string;
49
- continue: string;
50
- back: string;
51
- or: string;
52
- optional: string;
53
- };
54
- auth: {
55
- signIn: string;
56
- signUp: string;
57
- signOut: string;
58
- email: string;
59
- password: string;
60
- confirmPassword: string;
61
- username: string;
62
- phone: string;
63
- rememberMe: string;
64
- forgotPassword: string;
65
- continueWith: string;
66
- orContinueWith: string;
67
- };
68
- oauth: {
69
- google: string;
70
- github: string;
71
- microsoft: string;
72
- facebook: string;
73
- apple: string;
74
- discord: string;
75
- twitter: string;
76
- linkedin: string;
77
- chooseProvider: string;
78
- signInPreferred: string;
79
- };
80
- magicLink: {
81
- sendLink: string;
82
- checkEmail: string;
83
- linkSent: string;
84
- enterEmail: string;
85
- };
86
- phone: {
87
- enterPhone: string;
88
- sendCode: string;
89
- enterCode: string;
90
- verifyPhone: string;
91
- codeLabel: string;
92
- };
93
- mfa: {
94
- required: string;
95
- selectMethod: string;
96
- verify: string;
97
- enterCode: string;
98
- sms: string;
99
- authenticator: string;
100
- email: string;
101
- };
102
- passkey: {
103
- signInWith: string;
104
- register: string;
105
- usePasskey: string;
106
- };
107
- deviceFlow: {
108
- title: string;
109
- subtitle: string;
110
- enterCode: string;
111
- enterCodeDescription: string;
112
- codeLabel: string;
113
- codePlaceholder: string;
114
- codeHint: string;
115
- verify: string;
116
- verifyCode: string;
117
- invalidCode: string;
118
- noCode: string;
119
- getCodeHelp: string;
120
- authorizationTitle: string;
121
- authorizationSubtitle: string;
122
- authorizeTitle: string;
123
- authorizeDescription: string;
124
- requestingAccess: string;
125
- codeConfirm: string;
126
- requestedPermissions: string;
127
- securityWarning: string;
128
- scopes: string;
129
- approve: string;
130
- deny: string;
131
- authorizedTitle: string;
132
- authorizedMessage: string;
133
- authorizedDescription: string;
134
- authorizedHint: string;
135
- returnToCli: string;
136
- deniedTitle: string;
137
- deniedMessage: string;
138
- deniedDescription: string;
139
- deniedHint: string;
140
- };
141
- signUp: {
142
- title: string;
143
- subtitle: string;
144
- haveAccount: string;
145
- signInLink: string;
146
- agreeToTerms: string;
147
- terms: string;
148
- };
149
- signIn: {
150
- title: string;
151
- subtitle: string;
152
- noAccount: string;
153
- signUpLink: string;
154
- enterEmail: string;
155
- };
156
- validation: {
157
- emailRequired: string;
158
- emailInvalid: string;
159
- passwordRequired: string;
160
- passwordTooShort: string;
161
- passwordRequireUppercase: string;
162
- passwordRequireLowercase: string;
163
- passwordRequireNumber: string;
164
- passwordRequireSpecial: string;
165
- passwordMismatch: string;
166
- usernameRequired: string;
167
- usernameInvalid: string;
168
- phoneRequired: string;
169
- phoneInvalid: string;
170
- codeRequired: string;
171
- codeInvalid: string;
172
- fieldRequired: string;
173
- termsRequired: string;
174
- };
175
- errors: {
176
- invalidCredentials: string;
177
- userNotFound: string;
178
- userExists: string;
179
- invalidToken: string;
180
- tokenExpired: string;
181
- networkError: string;
182
- mfaRequired: string;
183
- emailNotVerified: string;
184
- phoneNotVerified: string;
185
- rateLimitExceeded: string;
186
- unknownError: string;
187
- generic: string;
188
- };
189
- success: {
190
- signedIn: string;
191
- signedUp: string;
192
- signedOut: string;
193
- linkSent: string;
194
- codeSent: string;
195
- verified: string;
196
- welcome: string;
197
- };
198
- placeholders: {
199
- email: string;
200
- password: string;
201
- confirmPassword: string;
202
- username: string;
203
- phone: string;
204
- code: string;
205
- fullName: string;
206
- };
207
- }
208
- /**
209
- * Deep partial type for locale overrides
210
- */
211
- type DeepPartial<T> = {
212
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
213
- };
214
-
215
- /**
216
- * Validation utilities
217
- */
218
-
219
- /**
220
- * Validate email address
221
- */
222
- declare function validateEmail(email: string, locale?: AuthLocale): ValidationError | null;
223
- /**
224
- * Validate password
225
- */
226
- declare function validatePassword(password: string, options?: {
227
- minLength?: number;
228
- requireUppercase?: boolean;
229
- requireLowercase?: boolean;
230
- requireNumber?: boolean;
231
- requireSpecial?: boolean;
232
- locale?: AuthLocale;
233
- }): ValidationError | null;
234
- /**
235
- * Validate phone number
236
- */
237
- declare function validatePhone(phone: string, locale?: AuthLocale): ValidationError | null;
238
- /**
239
- * Validate username
240
- */
241
- declare function validateUsername(username: string, locale?: AuthLocale): ValidationError | null;
242
- /**
243
- * Validate 2FA code
244
- */
245
- declare function validate2FACode(code: string, locale?: AuthLocale): ValidationError | null;
246
- /**
247
- * Validate required field
248
- */
249
- declare function validateRequired(value: unknown, fieldName: string, locale?: AuthLocale): ValidationError | null;
250
-
251
- /**
252
- * Token management utilities
253
- */
254
-
255
- /**
256
- * Token manager class
257
- */
258
- declare class TokenManager {
259
- private storage;
260
- constructor(storage?: Storage);
261
- /**
262
- * Get access token
263
- */
264
- getToken(): Promise<string | null>;
265
- /**
266
- * Set access token
267
- */
268
- setToken(token: string): Promise<void>;
269
- /**
270
- * Remove access token
271
- */
272
- removeToken(): Promise<void>;
273
- /**
274
- * Get refresh token
275
- */
276
- getRefreshToken(): Promise<string | null>;
277
- /**
278
- * Set refresh token
279
- */
280
- setRefreshToken(token: string): Promise<void>;
281
- /**
282
- * Remove refresh token
283
- */
284
- removeRefreshToken(): Promise<void>;
285
- /**
286
- * Clear all tokens
287
- */
288
- clearTokens(): Promise<void>;
289
- /**
290
- * Check if token is expired
291
- */
292
- isTokenExpired(token: string): boolean;
293
- /**
294
- * Decode JWT token (without verification)
295
- */
296
- private decodeToken;
297
- }
298
-
299
- /**
300
- * Cookie utility functions
301
- * Framework-agnostic helpers for cookie parsing and serialization
302
- */
303
-
304
- /**
305
- * Parse Set-Cookie header value into CookieData
306
- * @param setCookieHeader - The Set-Cookie header value
307
- * @returns Parsed cookie data
308
- */
309
- declare function parseCookie(setCookieHeader: string): CookieData | null;
310
- /**
311
- * Extract multiple cookies from Set-Cookie headers
312
- * @param setCookieHeaders - Array of Set-Cookie header values or single string
313
- * @returns Array of parsed cookies
314
- */
315
- declare function extractCookiesFromHeaders(setCookieHeaders: string | string[]): CookieData[];
316
- /**
317
- * Serialize a CookieData object into a Set-Cookie header value
318
- * @param cookie - The cookie data to serialize
319
- * @returns Set-Cookie header value
320
- */
321
- declare function serializeCookie(cookie: CookieData): string;
322
- /**
323
- * Parse Cookie header value into key-value pairs
324
- * @param cookieHeader - The Cookie header value
325
- * @returns Object with cookie name-value pairs
326
- */
327
- declare function parseCookieOptions(cookieHeader: string): Record<string, string>;
328
- /**
329
- * Convert cookie object to Cookie header string
330
- * @param cookies - Object with cookie name-value pairs
331
- * @returns Cookie header value
332
- */
333
- declare function serializeCookies(cookies: Record<string, string>): string;
334
-
335
- /**
336
- * Locale utility functions
337
- */
338
-
339
- /**
340
- * Default locale (English)
341
- */
342
- declare const defaultLocale: AuthLocale;
343
- /**
344
- * Create a complete locale by merging overrides with the default English locale
345
- *
346
- * @param overrides - Partial locale object with custom translations
347
- * @returns Complete locale object with all required keys
348
- *
349
- * @example
350
- * ```typescript
351
- * const spanishLocale = createLocale({
352
- * auth: {
353
- * signIn: 'Iniciar sesión',
354
- * signUp: 'Registrarse',
355
- * }
356
- * });
357
- * ```
358
- */
359
- declare function createLocale(overrides?: DeepPartial<AuthLocale>): AuthLocale;
360
- /**
361
- * Interpolate template string with values
362
- *
363
- * Replaces {key} placeholders with corresponding values from the provided object.
364
- *
365
- * @param template - Template string with {key} placeholders
366
- * @param values - Object with key-value pairs for interpolation
367
- * @returns Interpolated string
368
- *
369
- * @example
370
- * ```typescript
371
- * interpolate('Hello, {name}!', { name: 'John' })
372
- * // Returns: "Hello, John!"
373
- *
374
- * interpolate('Password must be at least {min} characters', { min: '8' })
375
- * // Returns: "Password must be at least 8 characters"
376
- * ```
377
- */
378
- declare function interpolate(template: string, values: Record<string, string | number>): string;
379
-
380
- /**
381
- * Auth client configuration
382
- */
383
- interface AuthClientConfig {
384
- provider: AuthProvider;
385
- autoRefresh?: boolean;
386
- refreshInterval?: number;
387
- }
388
- /**
389
- * Auth client class
390
- */
391
- declare class AuthClient {
392
- private provider;
393
- private autoRefresh;
394
- private refreshInterval;
395
- private refreshTimer?;
396
- readonly state: Observable<AuthContext>;
397
- get adapter(): AuthProvider;
398
- constructor(config: AuthClientConfig);
399
- /**
400
- * Initialize the auth client
401
- */
402
- initialize(): Promise<void>;
403
- /**
404
- * Sign in with credentials
405
- */
406
- signIn(request: SignInRequest): Promise<void>;
407
- /**
408
- * Sign up with credentials
409
- */
410
- signUp(request: SignUpRequest): Promise<void>;
411
- /**
412
- * Sign out
413
- */
414
- signOut(): Promise<void>;
415
- /**
416
- * Update user profile
417
- */
418
- updateUser(request: UpdateUserRequest): Promise<void>;
419
- /**
420
- * Change password
421
- */
422
- changePassword(request: PasswordChangeRequest): Promise<void>;
423
- /**
424
- * Request password reset
425
- */
426
- requestPasswordReset(request: PasswordResetRequest): Promise<void>;
427
- /**
428
- * Confirm password reset
429
- */
430
- confirmPasswordReset(request: PasswordResetConfirmRequest): Promise<void>;
431
- /**
432
- * Get OAuth sign in URL
433
- */
434
- getOAuthUrl(request: OAuthSignInRequest): Promise<string>;
435
- /**
436
- * Handle OAuth callback
437
- */
438
- handleOAuthCallback(request: OAuthCallbackRequest): Promise<void>;
439
- /**
440
- * Get available OAuth providers
441
- */
442
- getOAuthProviders(): Promise<OAuthProvider[]>;
443
- /**
444
- * Send magic link
445
- */
446
- sendMagicLink(request: MagicLinkRequest): Promise<void>;
447
- /**
448
- * Verify magic link
449
- */
450
- verifyMagicLink(request: MagicLinkVerifyRequest): Promise<void>;
451
- /**
452
- * Send phone verification code
453
- */
454
- sendPhoneCode(request: PhoneAuthRequest): Promise<void>;
455
- /**
456
- * Verify phone code
457
- */
458
- verifyPhoneCode(request: PhoneVerifyRequest): Promise<void>;
459
- /**
460
- * Setup 2FA
461
- */
462
- setupTwoFactor(request: TwoFactorSetupRequest): Promise<TwoFactorSetupResponse>;
463
- /**
464
- * Verify 2FA code
465
- */
466
- verifyTwoFactor(request: TwoFactorVerifyRequest): Promise<void>;
467
- /**
468
- * Disable 2FA
469
- */
470
- disableTwoFactor(): Promise<void>;
471
- /**
472
- * Get 2FA status
473
- */
474
- getTwoFactorStatus(): Promise<TwoFactorMethod[]>;
475
- /**
476
- * Register passkey
477
- */
478
- registerPasskey(request: PasskeyRegisterRequest): Promise<PasskeyCredential>;
479
- /**
480
- * Authenticate with passkey
481
- */
482
- authenticatePasskey(request: PasskeyAuthRequest): Promise<void>;
483
- /**
484
- * List passkeys
485
- */
486
- listPasskeys(): Promise<PasskeyCredential[]>;
487
- /**
488
- * Delete passkey
489
- */
490
- deletePasskey(credentialId: string): Promise<void>;
491
- /**
492
- * Get all organizations the user belongs to
493
- * Only available if the provider supports organizations
494
- */
495
- getOrganizations(): Promise<Organization[]>;
496
- /**
497
- * Get the currently active organization
498
- * Only available if the provider supports organizations
499
- */
500
- getActiveOrganization(): Promise<Organization | null>;
501
- /**
502
- * Set the active organization and refresh user state
503
- * Only available if the provider supports organizations
504
- */
505
- setActiveOrganization(organizationId: string): Promise<void>;
506
- /**
507
- * Get organization memberships with roles and permissions
508
- * Only available if the provider supports organizations
509
- */
510
- getOrganizationMemberships(): Promise<OrganizationMembership[]>;
511
- /**
512
- * Check if the provider supports organizations
513
- */
514
- supportsOrganizations(): boolean;
515
- /**
516
- * Refresh session
517
- */
518
- refreshSession(): Promise<void>;
519
- /**
520
- * Get current user
521
- */
522
- getUser(): User | null;
523
- /**
524
- * Get current session
525
- */
526
- getSession(): Session | null;
527
- /**
528
- * Check if authenticated
529
- */
530
- isAuthenticated(): boolean;
531
- /**
532
- * Get current error
533
- */
534
- getError(): AuthError | null;
535
- /**
536
- * Clear error
537
- */
538
- clearError(): void;
539
- /**
540
- * Subscribe to auth state changes
541
- */
542
- subscribe(listener: (context: AuthContext) => void): Unsubscribe;
543
- /**
544
- * Cleanup resources
545
- */
546
- destroy(): void;
547
- private updateState;
548
- private setLoading;
549
- private handleError;
550
- private startAutoRefresh;
551
- private stopAutoRefresh;
552
- private createUnsupportedError;
553
- }
554
-
555
- /**
556
- * Authentication flow types and state machine
557
- */
558
-
559
- /**
560
- * Available authentication flow steps
561
- */
562
- declare enum FlowStep {
563
- SIGN_IN = "sign_in",
564
- SIGN_UP = "sign_up",
565
- EMAIL_PASSWORD_SIGN_IN = "email_password_sign_in",
566
- EMAIL_PASSWORD_SIGN_UP = "email_password_sign_up",
567
- OAUTH_SELECT = "oauth_select",
568
- OAUTH_CALLBACK = "oauth_callback",
569
- MAGIC_LINK_REQUEST = "magic_link_request",
570
- MAGIC_LINK_VERIFY = "magic_link_verify",
571
- MAGIC_LINK_SENT = "magic_link_sent",
572
- PHONE_REQUEST = "phone_request",
573
- PHONE_VERIFY = "phone_verify",
574
- USERNAME_SIGN_IN = "username_sign_in",
575
- USERNAME_SIGN_UP = "username_sign_up",
576
- PASSKEY_REGISTER = "passkey_register",
577
- PASSKEY_AUTHENTICATE = "passkey_authenticate",
578
- MFA_REQUIRED = "mfa_required",
579
- MFA_SETUP = "mfa_setup",
580
- MFA_VERIFY = "mfa_verify",
581
- MFA_SELECT_METHOD = "mfa_select_method",
582
- EMAIL_VERIFICATION_REQUIRED = "email_verification_required",
583
- EMAIL_VERIFICATION_SENT = "email_verification_sent",
584
- PHONE_VERIFICATION_REQUIRED = "phone_verification_required",
585
- PASSWORD_RESET_REQUEST = "password_reset_request",
586
- PASSWORD_RESET_SENT = "password_reset_sent",
587
- PASSWORD_RESET_CONFIRM = "password_reset_confirm",
588
- PASSWORD_CHANGE = "password_change",
589
- PROFILE_UPDATE = "profile_update",
590
- PROFILE_COMPLETE = "profile_complete",
591
- DEVICE_FLOW_INITIATE = "device_flow_initiate",
592
- DEVICE_CODE_ENTRY = "device_code_entry",
593
- DEVICE_CODE_VERIFY = "device_code_verify",
594
- DEVICE_AUTHORIZE = "device_authorize",
595
- DEVICE_POLLING = "device_polling",
596
- DEVICE_AUTHORIZED = "device_authorized",
597
- DEVICE_DENIED = "device_denied",
598
- SUCCESS = "success",
599
- ERROR = "error",
600
- CANCELLED = "cancelled"
601
- }
602
- /**
603
- * Flow state data that can be passed between steps
604
- */
605
- interface FlowState {
606
- currentStep: FlowStep;
607
- previousStep?: FlowStep;
608
- user?: User;
609
- session?: Session;
610
- email?: string;
611
- phone?: string;
612
- username?: string;
613
- token?: string;
614
- mfaRequired?: boolean;
615
- mfaMethods?: TwoFactorMethod[];
616
- mfaToken?: string;
617
- oauthProvider?: OAuthProvider;
618
- oauthRedirectUrl?: string;
619
- verificationRequired?: boolean;
620
- verificationToken?: string;
621
- verificationSent?: boolean;
622
- deviceCode?: string;
623
- userCode?: string;
624
- verificationUri?: string;
625
- verificationUriComplete?: string;
626
- deviceCodeExpiresIn?: number;
627
- devicePollingInterval?: number;
628
- deviceClientId?: string;
629
- deviceScopes?: string[];
630
- deviceAuthorized?: boolean;
631
- error?: AuthError;
632
- metadata?: Record<string, unknown>;
633
- }
634
- /**
635
- * Flow transition result
636
- */
637
- interface FlowTransition {
638
- nextStep: FlowStep;
639
- state: Partial<FlowState>;
640
- }
641
- /**
642
- * Flow configuration for a specific authentication journey
643
- */
644
- interface FlowConfig {
645
- name: string;
646
- description?: string;
647
- initialStep: FlowStep;
648
- allowedSteps: FlowStep[];
649
- transitions: {
650
- [key in FlowStep]?: {
651
- onSuccess?: FlowStep;
652
- onError?: FlowStep;
653
- onCancel?: FlowStep;
654
- onBack?: FlowStep;
655
- conditions?: Array<{
656
- when: (state: FlowState) => boolean;
657
- then: FlowStep;
658
- }>;
659
- };
660
- };
661
- onStepChange?: (step: FlowStep, state: FlowState) => void;
662
- onComplete?: (user: User, session: Session) => void;
663
- onError?: (error: AuthError, state: FlowState) => void;
664
- onCancel?: (state: FlowState) => void;
665
- }
666
- /**
667
- * Predefined flow configurations
668
- */
669
- declare enum FlowConfigType {
670
- SIMPLE_SIGN_IN = "simple_sign_in",
671
- SIMPLE_SIGN_UP = "simple_sign_up",
672
- SIGN_UP_WITH_EMAIL_VERIFICATION = "sign_up_with_email_verification",
673
- SIGN_IN_WITH_MFA = "sign_in_with_mfa",
674
- OAUTH_SIGN_IN = "oauth_sign_in",
675
- MAGIC_LINK_FLOW = "magic_link_flow",
676
- PHONE_AUTH_FLOW = "phone_auth_flow",
677
- COMPLETE_SIGN_UP_FLOW = "complete_sign_up_flow",// signup → verify email → complete profile
678
- SECURE_SIGN_IN_FLOW = "secure_sign_in_flow",// signin → MFA → success
679
- PASSWORD_RESET_FLOW = "password_reset_flow",
680
- EMAIL_VERIFICATION_FLOW = "email_verification_flow",
681
- DEVICE_FLOW = "device_flow",
682
- CUSTOM = "custom"
683
- }
684
- /**
685
- * Flow action types
686
- */
687
- declare enum FlowAction {
688
- START = "start",
689
- NEXT = "next",
690
- BACK = "back",
691
- CANCEL = "cancel",
692
- ERROR = "error",
693
- RESET = "reset"
694
- }
695
- /**
696
- * Flow event for state machine
697
- */
698
- interface FlowEvent {
699
- action: FlowAction;
700
- data?: Partial<FlowState>;
701
- error?: AuthError;
702
- }
703
-
704
- /**
705
- * Authentication flow state machine engine
706
- */
707
-
708
- /**
709
- * Flow engine that manages authentication flow state transitions
710
- */
711
- declare class FlowEngine {
712
- private config;
713
- private state;
714
- private history;
715
- constructor(config: FlowConfig, initialState?: Partial<FlowState>);
716
- /**
717
- * Get current flow state
718
- */
719
- getState(): FlowState;
720
- /**
721
- * Get current step
722
- */
723
- getCurrentStep(): FlowStep;
724
- /**
725
- * Check if step is allowed in this flow
726
- */
727
- isStepAllowed(step: FlowStep): boolean;
728
- /**
729
- * Transition to next step based on action
730
- */
731
- transition(event: FlowEvent): Promise<FlowState>;
732
- /**
733
- * Start or restart the flow
734
- */
735
- private handleStart;
736
- /**
737
- * Move to next step
738
- */
739
- private handleNext;
740
- /**
741
- * Go back to previous step
742
- */
743
- private handleBack;
744
- /**
745
- * Cancel the flow
746
- */
747
- private handleCancel;
748
- /**
749
- * Handle error in flow
750
- */
751
- private handleError;
752
- /**
753
- * Reset flow to initial state
754
- */
755
- private handleReset;
756
- /**
757
- * Move to a specific step
758
- */
759
- private moveToStep;
760
- /**
761
- * Get flow history
762
- */
763
- getHistory(): FlowStep[];
764
- /**
765
- * Check if can go back
766
- */
767
- canGoBack(): boolean;
768
- }
769
-
770
- /**
771
- * Predefined flow configurations
772
- */
773
-
774
- /**
775
- * Simple sign-in flow (email/password only)
776
- */
777
- declare const simpleSignInFlow: FlowConfig;
778
- /**
779
- * Sign-in with MFA support
780
- */
781
- declare const signInWithMFAFlow: FlowConfig;
782
- /**
783
- * Complete sign-up flow with email verification
784
- */
785
- declare const completeSignUpFlow: FlowConfig;
786
- /**
787
- * Magic link authentication flow
788
- */
789
- declare const magicLinkFlow: FlowConfig;
790
- /**
791
- * Phone authentication flow
792
- */
793
- declare const phoneAuthFlow: FlowConfig;
794
- /**
795
- * OAuth sign-in flow
796
- */
797
- declare const oauthSignInFlow: FlowConfig;
798
- /**
799
- * Password reset flow
800
- */
801
- declare const passwordResetFlow: FlowConfig;
802
- /**
803
- * Email verification flow
804
- */
805
- declare const emailVerificationFlow: FlowConfig;
806
- /**
807
- * Get predefined flow configuration by type
808
- */
809
- declare function getFlowConfig(type: FlowConfigType): FlowConfig;
810
- /**
811
- * Export all predefined flows
812
- */
813
- declare const predefinedFlows: {
814
- simple_sign_in: FlowConfig;
815
- sign_in_with_mfa: FlowConfig;
816
- complete_sign_up_flow: FlowConfig;
817
- magic_link_flow: FlowConfig;
818
- phone_auth_flow: FlowConfig;
819
- oauth_sign_in: FlowConfig;
820
- password_reset_flow: FlowConfig;
821
- email_verification_flow: FlowConfig;
822
- device_flow: FlowConfig;
823
- };
824
-
825
- export { AuthClient, type AuthClientConfig, AuthContext, AuthError, AuthErrorType, type AuthLocale, AuthProvider, CookieData, type DeepPartial, FlowAction, type FlowConfig, FlowConfigType, FlowEngine, type FlowEvent, type FlowState, FlowStep, type FlowTransition, MagicLinkRequest, MagicLinkVerifyRequest, OAuthCallbackRequest, OAuthProvider, OAuthSignInRequest, Observable, Organization, OrganizationMembership, PasskeyAuthRequest, PasskeyCredential, PasskeyRegisterRequest, PasswordChangeRequest, PasswordResetConfirmRequest, PasswordResetRequest, PhoneAuthRequest, PhoneVerifyRequest, Session, SignInRequest, SignUpRequest, Storage, TokenManager, TwoFactorMethod, TwoFactorSetupRequest, TwoFactorSetupResponse, TwoFactorVerifyRequest, Unsubscribe, UpdateUserRequest, User, ValidationError, completeSignUpFlow, createAuthError, createLocale, defaultLocale, emailVerificationFlow, extractCookiesFromHeaders, getFlowConfig, interpolate, isAuthError, isMFARequiredError, isNetworkError, isUnauthenticatedError, magicLinkFlow, oauthSignInFlow, parseCookie, parseCookieOptions, passwordResetFlow, phoneAuthFlow, predefinedFlows, serializeCookie, serializeCookies, signInWithMFAFlow, simpleSignInFlow, toAuthError, validate2FACode, validateEmail, validatePassword, validatePhone, validateRequired, validateUsername };