@authsome/ui-core 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Framework-agnostic authentication core for AuthSome UI.
4
4
 
5
+ > **Note:** Version 0.1.1+ includes fixes for workspace dependency resolution in published packages.
6
+
5
7
  ## Installation
6
8
 
7
9
  ```bash
@@ -1,4 +1,4 @@
1
- import { c as AuthProvider, z as ProviderConfig, S as SignInRequest, y as AuthResponse, d as SignUpRequest, t as User, u as Session, 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, a as AuthError } from '../provider-DXf_a2WT.mjs';
1
+ import { c as AuthProvider, C as ProviderConfig, S as SignInRequest, B as AuthResponse, d as SignUpRequest, t as User, u as Session, 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, a as AuthError } from '../provider-C8km9A8U.mjs';
2
2
 
3
3
  /**
4
4
  * Base auth provider implementation
@@ -1,4 +1,4 @@
1
- import { c as AuthProvider, z as ProviderConfig, S as SignInRequest, y as AuthResponse, d as SignUpRequest, t as User, u as Session, 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, a as AuthError } from '../provider-DXf_a2WT.js';
1
+ import { c as AuthProvider, C as ProviderConfig, S as SignInRequest, B as AuthResponse, d as SignUpRequest, t as User, u as Session, 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, a as AuthError } from '../provider-C8km9A8U.js';
2
2
 
3
3
  /**
4
4
  * Base auth provider implementation
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AuthErrorType, a as AuthError, V as ValidationError, 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-DXf_a2WT.mjs';
2
- export { y as AuthResponse, v as AuthState, w as OAuthConfig, z as ProviderConfig, x as TwoFactorConfig } from './provider-DXf_a2WT.mjs';
1
+ import { A as AuthErrorType, a as AuthError, V as ValidationError, 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-C8km9A8U.mjs';
2
+ export { B as AuthResponse, v as AuthState, y as FieldDefinition, F as FieldValidation, w as OAuthConfig, C as ProviderConfig, z as SignupFieldsResponse, x as TwoFactorConfig } from './provider-C8km9A8U.mjs';
3
3
  import { Storage, Observable, Unsubscribe } from './types/index.mjs';
4
4
  export { Listener, LocalStorageAdapter, MemoryStorageAdapter, SessionStorageAdapter } from './types/index.mjs';
5
5
  export { BaseAuthProvider } from './adapters/index.mjs';
@@ -35,6 +35,149 @@ declare function isUnauthenticatedError(error: unknown): boolean;
35
35
  */
36
36
  declare function isMFARequiredError(error: unknown): boolean;
37
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
+ signUp: {
108
+ title: string;
109
+ subtitle: string;
110
+ haveAccount: string;
111
+ signInLink: string;
112
+ agreeToTerms: string;
113
+ terms: string;
114
+ };
115
+ signIn: {
116
+ title: string;
117
+ subtitle: string;
118
+ noAccount: string;
119
+ signUpLink: string;
120
+ enterEmail: string;
121
+ };
122
+ validation: {
123
+ emailRequired: string;
124
+ emailInvalid: string;
125
+ passwordRequired: string;
126
+ passwordTooShort: string;
127
+ passwordRequireUppercase: string;
128
+ passwordRequireLowercase: string;
129
+ passwordRequireNumber: string;
130
+ passwordRequireSpecial: string;
131
+ passwordMismatch: string;
132
+ usernameRequired: string;
133
+ usernameInvalid: string;
134
+ phoneRequired: string;
135
+ phoneInvalid: string;
136
+ codeRequired: string;
137
+ codeInvalid: string;
138
+ fieldRequired: string;
139
+ termsRequired: string;
140
+ };
141
+ errors: {
142
+ invalidCredentials: string;
143
+ userNotFound: string;
144
+ userExists: string;
145
+ invalidToken: string;
146
+ tokenExpired: string;
147
+ networkError: string;
148
+ mfaRequired: string;
149
+ emailNotVerified: string;
150
+ phoneNotVerified: string;
151
+ rateLimitExceeded: string;
152
+ unknownError: string;
153
+ generic: string;
154
+ };
155
+ success: {
156
+ signedIn: string;
157
+ signedUp: string;
158
+ signedOut: string;
159
+ linkSent: string;
160
+ codeSent: string;
161
+ verified: string;
162
+ welcome: string;
163
+ };
164
+ placeholders: {
165
+ email: string;
166
+ password: string;
167
+ confirmPassword: string;
168
+ username: string;
169
+ phone: string;
170
+ code: string;
171
+ fullName: string;
172
+ };
173
+ }
174
+ /**
175
+ * Deep partial type for locale overrides
176
+ */
177
+ type DeepPartial<T> = {
178
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
179
+ };
180
+
38
181
  /**
39
182
  * Validation utilities
40
183
  */
@@ -42,7 +185,7 @@ declare function isMFARequiredError(error: unknown): boolean;
42
185
  /**
43
186
  * Validate email address
44
187
  */
45
- declare function validateEmail(email: string): ValidationError | null;
188
+ declare function validateEmail(email: string, locale?: AuthLocale): ValidationError | null;
46
189
  /**
47
190
  * Validate password
48
191
  */
@@ -52,23 +195,24 @@ declare function validatePassword(password: string, options?: {
52
195
  requireLowercase?: boolean;
53
196
  requireNumber?: boolean;
54
197
  requireSpecial?: boolean;
198
+ locale?: AuthLocale;
55
199
  }): ValidationError | null;
56
200
  /**
57
201
  * Validate phone number
58
202
  */
59
- declare function validatePhone(phone: string): ValidationError | null;
203
+ declare function validatePhone(phone: string, locale?: AuthLocale): ValidationError | null;
60
204
  /**
61
205
  * Validate username
62
206
  */
63
- declare function validateUsername(username: string): ValidationError | null;
207
+ declare function validateUsername(username: string, locale?: AuthLocale): ValidationError | null;
64
208
  /**
65
209
  * Validate 2FA code
66
210
  */
67
- declare function validate2FACode(code: string): ValidationError | null;
211
+ declare function validate2FACode(code: string, locale?: AuthLocale): ValidationError | null;
68
212
  /**
69
213
  * Validate required field
70
214
  */
71
- declare function validateRequired(value: unknown, fieldName: string): ValidationError | null;
215
+ declare function validateRequired(value: unknown, fieldName: string, locale?: AuthLocale): ValidationError | null;
72
216
 
73
217
  /**
74
218
  * Token management utilities
@@ -118,6 +262,51 @@ declare class TokenManager {
118
262
  private decodeToken;
119
263
  }
120
264
 
265
+ /**
266
+ * Locale utility functions
267
+ */
268
+
269
+ /**
270
+ * Default locale (English)
271
+ */
272
+ declare const defaultLocale: AuthLocale;
273
+ /**
274
+ * Create a complete locale by merging overrides with the default English locale
275
+ *
276
+ * @param overrides - Partial locale object with custom translations
277
+ * @returns Complete locale object with all required keys
278
+ *
279
+ * @example
280
+ * ```typescript
281
+ * const spanishLocale = createLocale({
282
+ * auth: {
283
+ * signIn: 'Iniciar sesión',
284
+ * signUp: 'Registrarse',
285
+ * }
286
+ * });
287
+ * ```
288
+ */
289
+ declare function createLocale(overrides?: DeepPartial<AuthLocale>): AuthLocale;
290
+ /**
291
+ * Interpolate template string with values
292
+ *
293
+ * Replaces {key} placeholders with corresponding values from the provided object.
294
+ *
295
+ * @param template - Template string with {key} placeholders
296
+ * @param values - Object with key-value pairs for interpolation
297
+ * @returns Interpolated string
298
+ *
299
+ * @example
300
+ * ```typescript
301
+ * interpolate('Hello, {name}!', { name: 'John' })
302
+ * // Returns: "Hello, John!"
303
+ *
304
+ * interpolate('Password must be at least {min} characters', { min: '8' })
305
+ * // Returns: "Password must be at least 8 characters"
306
+ * ```
307
+ */
308
+ declare function interpolate(template: string, values: Record<string, string | number>): string;
309
+
121
310
  /**
122
311
  * Auth client configuration
123
312
  */
@@ -135,6 +324,7 @@ declare class AuthClient {
135
324
  private refreshInterval;
136
325
  private refreshTimer?;
137
326
  readonly state: Observable<AuthContext>;
327
+ get adapter(): AuthProvider;
138
328
  constructor(config: AuthClientConfig);
139
329
  /**
140
330
  * Initialize the auth client
@@ -537,4 +727,4 @@ declare const predefinedFlows: {
537
727
  password_reset_flow: FlowConfig;
538
728
  };
539
729
 
540
- export { AuthClient, type AuthClientConfig, AuthContext, AuthError, AuthErrorType, AuthProvider, 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, getFlowConfig, isAuthError, isMFARequiredError, isNetworkError, isUnauthenticatedError, magicLinkFlow, oauthSignInFlow, passwordResetFlow, phoneAuthFlow, predefinedFlows, signInWithMFAFlow, simpleSignInFlow, toAuthError, validate2FACode, validateEmail, validatePassword, validatePhone, validateRequired, validateUsername };
730
+ export { AuthClient, type AuthClientConfig, AuthContext, AuthError, AuthErrorType, type AuthLocale, AuthProvider, 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, getFlowConfig, interpolate, isAuthError, isMFARequiredError, isNetworkError, isUnauthenticatedError, magicLinkFlow, oauthSignInFlow, passwordResetFlow, phoneAuthFlow, predefinedFlows, signInWithMFAFlow, simpleSignInFlow, toAuthError, validate2FACode, validateEmail, validatePassword, validatePhone, validateRequired, validateUsername };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AuthErrorType, a as AuthError, V as ValidationError, 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-DXf_a2WT.js';
2
- export { y as AuthResponse, v as AuthState, w as OAuthConfig, z as ProviderConfig, x as TwoFactorConfig } from './provider-DXf_a2WT.js';
1
+ import { A as AuthErrorType, a as AuthError, V as ValidationError, 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-C8km9A8U.js';
2
+ export { B as AuthResponse, v as AuthState, y as FieldDefinition, F as FieldValidation, w as OAuthConfig, C as ProviderConfig, z as SignupFieldsResponse, x as TwoFactorConfig } from './provider-C8km9A8U.js';
3
3
  import { Storage, Observable, Unsubscribe } from './types/index.js';
4
4
  export { Listener, LocalStorageAdapter, MemoryStorageAdapter, SessionStorageAdapter } from './types/index.js';
5
5
  export { BaseAuthProvider } from './adapters/index.js';
@@ -35,6 +35,149 @@ declare function isUnauthenticatedError(error: unknown): boolean;
35
35
  */
36
36
  declare function isMFARequiredError(error: unknown): boolean;
37
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
+ signUp: {
108
+ title: string;
109
+ subtitle: string;
110
+ haveAccount: string;
111
+ signInLink: string;
112
+ agreeToTerms: string;
113
+ terms: string;
114
+ };
115
+ signIn: {
116
+ title: string;
117
+ subtitle: string;
118
+ noAccount: string;
119
+ signUpLink: string;
120
+ enterEmail: string;
121
+ };
122
+ validation: {
123
+ emailRequired: string;
124
+ emailInvalid: string;
125
+ passwordRequired: string;
126
+ passwordTooShort: string;
127
+ passwordRequireUppercase: string;
128
+ passwordRequireLowercase: string;
129
+ passwordRequireNumber: string;
130
+ passwordRequireSpecial: string;
131
+ passwordMismatch: string;
132
+ usernameRequired: string;
133
+ usernameInvalid: string;
134
+ phoneRequired: string;
135
+ phoneInvalid: string;
136
+ codeRequired: string;
137
+ codeInvalid: string;
138
+ fieldRequired: string;
139
+ termsRequired: string;
140
+ };
141
+ errors: {
142
+ invalidCredentials: string;
143
+ userNotFound: string;
144
+ userExists: string;
145
+ invalidToken: string;
146
+ tokenExpired: string;
147
+ networkError: string;
148
+ mfaRequired: string;
149
+ emailNotVerified: string;
150
+ phoneNotVerified: string;
151
+ rateLimitExceeded: string;
152
+ unknownError: string;
153
+ generic: string;
154
+ };
155
+ success: {
156
+ signedIn: string;
157
+ signedUp: string;
158
+ signedOut: string;
159
+ linkSent: string;
160
+ codeSent: string;
161
+ verified: string;
162
+ welcome: string;
163
+ };
164
+ placeholders: {
165
+ email: string;
166
+ password: string;
167
+ confirmPassword: string;
168
+ username: string;
169
+ phone: string;
170
+ code: string;
171
+ fullName: string;
172
+ };
173
+ }
174
+ /**
175
+ * Deep partial type for locale overrides
176
+ */
177
+ type DeepPartial<T> = {
178
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
179
+ };
180
+
38
181
  /**
39
182
  * Validation utilities
40
183
  */
@@ -42,7 +185,7 @@ declare function isMFARequiredError(error: unknown): boolean;
42
185
  /**
43
186
  * Validate email address
44
187
  */
45
- declare function validateEmail(email: string): ValidationError | null;
188
+ declare function validateEmail(email: string, locale?: AuthLocale): ValidationError | null;
46
189
  /**
47
190
  * Validate password
48
191
  */
@@ -52,23 +195,24 @@ declare function validatePassword(password: string, options?: {
52
195
  requireLowercase?: boolean;
53
196
  requireNumber?: boolean;
54
197
  requireSpecial?: boolean;
198
+ locale?: AuthLocale;
55
199
  }): ValidationError | null;
56
200
  /**
57
201
  * Validate phone number
58
202
  */
59
- declare function validatePhone(phone: string): ValidationError | null;
203
+ declare function validatePhone(phone: string, locale?: AuthLocale): ValidationError | null;
60
204
  /**
61
205
  * Validate username
62
206
  */
63
- declare function validateUsername(username: string): ValidationError | null;
207
+ declare function validateUsername(username: string, locale?: AuthLocale): ValidationError | null;
64
208
  /**
65
209
  * Validate 2FA code
66
210
  */
67
- declare function validate2FACode(code: string): ValidationError | null;
211
+ declare function validate2FACode(code: string, locale?: AuthLocale): ValidationError | null;
68
212
  /**
69
213
  * Validate required field
70
214
  */
71
- declare function validateRequired(value: unknown, fieldName: string): ValidationError | null;
215
+ declare function validateRequired(value: unknown, fieldName: string, locale?: AuthLocale): ValidationError | null;
72
216
 
73
217
  /**
74
218
  * Token management utilities
@@ -118,6 +262,51 @@ declare class TokenManager {
118
262
  private decodeToken;
119
263
  }
120
264
 
265
+ /**
266
+ * Locale utility functions
267
+ */
268
+
269
+ /**
270
+ * Default locale (English)
271
+ */
272
+ declare const defaultLocale: AuthLocale;
273
+ /**
274
+ * Create a complete locale by merging overrides with the default English locale
275
+ *
276
+ * @param overrides - Partial locale object with custom translations
277
+ * @returns Complete locale object with all required keys
278
+ *
279
+ * @example
280
+ * ```typescript
281
+ * const spanishLocale = createLocale({
282
+ * auth: {
283
+ * signIn: 'Iniciar sesión',
284
+ * signUp: 'Registrarse',
285
+ * }
286
+ * });
287
+ * ```
288
+ */
289
+ declare function createLocale(overrides?: DeepPartial<AuthLocale>): AuthLocale;
290
+ /**
291
+ * Interpolate template string with values
292
+ *
293
+ * Replaces {key} placeholders with corresponding values from the provided object.
294
+ *
295
+ * @param template - Template string with {key} placeholders
296
+ * @param values - Object with key-value pairs for interpolation
297
+ * @returns Interpolated string
298
+ *
299
+ * @example
300
+ * ```typescript
301
+ * interpolate('Hello, {name}!', { name: 'John' })
302
+ * // Returns: "Hello, John!"
303
+ *
304
+ * interpolate('Password must be at least {min} characters', { min: '8' })
305
+ * // Returns: "Password must be at least 8 characters"
306
+ * ```
307
+ */
308
+ declare function interpolate(template: string, values: Record<string, string | number>): string;
309
+
121
310
  /**
122
311
  * Auth client configuration
123
312
  */
@@ -135,6 +324,7 @@ declare class AuthClient {
135
324
  private refreshInterval;
136
325
  private refreshTimer?;
137
326
  readonly state: Observable<AuthContext>;
327
+ get adapter(): AuthProvider;
138
328
  constructor(config: AuthClientConfig);
139
329
  /**
140
330
  * Initialize the auth client
@@ -537,4 +727,4 @@ declare const predefinedFlows: {
537
727
  password_reset_flow: FlowConfig;
538
728
  };
539
729
 
540
- export { AuthClient, type AuthClientConfig, AuthContext, AuthError, AuthErrorType, AuthProvider, 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, getFlowConfig, isAuthError, isMFARequiredError, isNetworkError, isUnauthenticatedError, magicLinkFlow, oauthSignInFlow, passwordResetFlow, phoneAuthFlow, predefinedFlows, signInWithMFAFlow, simpleSignInFlow, toAuthError, validate2FACode, validateEmail, validatePassword, validatePhone, validateRequired, validateUsername };
730
+ export { AuthClient, type AuthClientConfig, AuthContext, AuthError, AuthErrorType, type AuthLocale, AuthProvider, 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, getFlowConfig, interpolate, isAuthError, isMFARequiredError, isNetworkError, isUnauthenticatedError, magicLinkFlow, oauthSignInFlow, passwordResetFlow, phoneAuthFlow, predefinedFlows, signInWithMFAFlow, simpleSignInFlow, toAuthError, validate2FACode, validateEmail, validatePassword, validatePhone, validateRequired, validateUsername };