@thetechfossil/auth2 1.2.14 → 1.2.16
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 +0 -0
- package/dist/index.components.d.mts +255 -0
- package/dist/index.components.d.ts +9 -1
- package/dist/index.components.js +215 -225
- package/dist/index.components.js.map +1 -1
- package/dist/index.components.mjs +103 -113
- package/dist/index.components.mjs.map +1 -1
- package/dist/index.d.mts +566 -0
- package/dist/index.d.ts +11 -33
- package/dist/index.js +263 -267
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +113 -117
- package/dist/index.mjs.map +1 -1
- package/dist/index.next.d.mts +538 -0
- package/dist/index.next.d.ts +9 -1
- package/dist/index.next.js +277 -281
- package/dist/index.next.js.map +1 -1
- package/dist/index.next.mjs +113 -117
- package/dist/index.next.mjs.map +1 -1
- package/dist/index.next.server.d.mts +272 -0
- package/dist/index.next.server.d.ts +1 -1
- package/dist/index.next.server.js +12 -11
- package/dist/index.next.server.js.map +1 -1
- package/dist/index.next.server.mjs +12 -11
- package/dist/index.next.server.mjs.map +1 -1
- package/dist/index.node.d.mts +227 -0
- package/dist/index.node.d.ts +1 -1
- package/dist/index.node.js +8 -5
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +8 -5
- package/dist/index.node.mjs.map +1 -1
- package/next/index.js +0 -0
- package/next/index.mjs +0 -0
- package/next/package.json +0 -0
- package/next/server/package.json +0 -0
- package/next/server.js +0 -0
- package/next/server.mjs +0 -0
- package/package.json +21 -21
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
import { UpfilesClient } from '@thetechfossil/upfiles';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
interface LinkedAccount {
|
|
6
|
+
provider: 'google' | 'github';
|
|
7
|
+
providerId: string;
|
|
8
|
+
email: string;
|
|
9
|
+
avatar?: string;
|
|
10
|
+
}
|
|
11
|
+
interface User {
|
|
12
|
+
id: string;
|
|
13
|
+
_id?: string;
|
|
14
|
+
name: string;
|
|
15
|
+
email: string;
|
|
16
|
+
phoneNumber?: string;
|
|
17
|
+
avatar?: string;
|
|
18
|
+
role: string;
|
|
19
|
+
linkedAccounts?: LinkedAccount[];
|
|
20
|
+
createdAt: string;
|
|
21
|
+
updatedAt: string;
|
|
22
|
+
}
|
|
23
|
+
interface AuthResponse {
|
|
24
|
+
success: boolean;
|
|
25
|
+
message: string;
|
|
26
|
+
user?: User;
|
|
27
|
+
token?: string;
|
|
28
|
+
csrfToken?: string;
|
|
29
|
+
}
|
|
30
|
+
interface LoginData {
|
|
31
|
+
email?: string;
|
|
32
|
+
phoneNumber?: string;
|
|
33
|
+
password?: string;
|
|
34
|
+
otp?: string;
|
|
35
|
+
}
|
|
36
|
+
interface VerifyData {
|
|
37
|
+
email?: string;
|
|
38
|
+
phoneNumber?: string;
|
|
39
|
+
otp: string;
|
|
40
|
+
}
|
|
41
|
+
interface RegisterData {
|
|
42
|
+
name: string;
|
|
43
|
+
email?: string;
|
|
44
|
+
phoneNumber?: string;
|
|
45
|
+
password: string;
|
|
46
|
+
}
|
|
47
|
+
interface UpdateUserData {
|
|
48
|
+
name?: string;
|
|
49
|
+
avatar?: string;
|
|
50
|
+
email?: string;
|
|
51
|
+
username?: string;
|
|
52
|
+
phoneNumber?: string;
|
|
53
|
+
}
|
|
54
|
+
type OAuthProvider = 'google' | 'github';
|
|
55
|
+
interface OAuthConfig {
|
|
56
|
+
provider: OAuthProvider;
|
|
57
|
+
redirectUri?: string;
|
|
58
|
+
}
|
|
59
|
+
interface CsrfTokenResponse {
|
|
60
|
+
success: boolean;
|
|
61
|
+
csrfToken: string;
|
|
62
|
+
}
|
|
63
|
+
interface AuthConfig {
|
|
64
|
+
baseUrl: string;
|
|
65
|
+
localStorageKey?: string;
|
|
66
|
+
token?: string;
|
|
67
|
+
csrfEnabled?: boolean;
|
|
68
|
+
upfilesConfig?: UpfilesConfig;
|
|
69
|
+
}
|
|
70
|
+
interface UpfilesConfig {
|
|
71
|
+
baseUrl: string;
|
|
72
|
+
apiKey?: string;
|
|
73
|
+
apiKeyHeader?: 'authorization' | 'x-api-key' | 'x-up-api-key';
|
|
74
|
+
presignUrl?: string;
|
|
75
|
+
presignPath?: string;
|
|
76
|
+
folderPath?: string;
|
|
77
|
+
}
|
|
78
|
+
interface Session {
|
|
79
|
+
id: string;
|
|
80
|
+
userId?: string;
|
|
81
|
+
token?: string;
|
|
82
|
+
userAgent?: string;
|
|
83
|
+
ipAddress?: string;
|
|
84
|
+
expiresAt: string;
|
|
85
|
+
createdAt: string;
|
|
86
|
+
updatedAt?: string;
|
|
87
|
+
}
|
|
88
|
+
interface MFASetup {
|
|
89
|
+
success: boolean;
|
|
90
|
+
qrCode?: string;
|
|
91
|
+
secret?: string;
|
|
92
|
+
message: string;
|
|
93
|
+
}
|
|
94
|
+
interface AuditLog {
|
|
95
|
+
id: string;
|
|
96
|
+
userId: string;
|
|
97
|
+
action: string;
|
|
98
|
+
details?: any;
|
|
99
|
+
ipAddress?: string;
|
|
100
|
+
timestamp: string;
|
|
101
|
+
}
|
|
102
|
+
interface UseAuthReturn {
|
|
103
|
+
user: User | null;
|
|
104
|
+
isAuthenticated: boolean;
|
|
105
|
+
loading: boolean;
|
|
106
|
+
register: (data: RegisterData) => Promise<AuthResponse>;
|
|
107
|
+
login: (data: LoginData) => Promise<AuthResponse>;
|
|
108
|
+
loginWithOAuth: (provider: OAuthProvider) => void;
|
|
109
|
+
verify: (data: VerifyData) => Promise<AuthResponse>;
|
|
110
|
+
verifyEmailToken: (token: string) => Promise<AuthResponse>;
|
|
111
|
+
logout: () => Promise<void>;
|
|
112
|
+
updateProfile: (data: UpdateUserData) => Promise<AuthResponse>;
|
|
113
|
+
getProfile: () => Promise<User>;
|
|
114
|
+
getAllUsers: () => Promise<User[]>;
|
|
115
|
+
getUserById: (id: string) => Promise<User>;
|
|
116
|
+
linkOAuthProvider: (provider: OAuthProvider) => void;
|
|
117
|
+
unlinkOAuthProvider: (provider: OAuthProvider) => Promise<AuthResponse>;
|
|
118
|
+
csrfToken: string | null;
|
|
119
|
+
refreshCsrfToken: () => Promise<void>;
|
|
120
|
+
changePassword: (oldPassword: string, newPassword: string) => Promise<AuthResponse>;
|
|
121
|
+
updateAvatar: (avatar: string) => Promise<AuthResponse>;
|
|
122
|
+
uploadAndUpdateAvatar: (file: File) => Promise<AuthResponse>;
|
|
123
|
+
requestEmailChange: (newEmail: string) => Promise<AuthResponse>;
|
|
124
|
+
verifyEmailChange: (token: string) => Promise<AuthResponse>;
|
|
125
|
+
generate2FA: () => Promise<MFASetup>;
|
|
126
|
+
enable2FA: (token: string) => Promise<AuthResponse>;
|
|
127
|
+
disable2FA: (token: string) => Promise<AuthResponse>;
|
|
128
|
+
validate2FA: (token: string) => Promise<AuthResponse>;
|
|
129
|
+
getSessions: () => Promise<{
|
|
130
|
+
success: boolean;
|
|
131
|
+
sessions: Session[];
|
|
132
|
+
}>;
|
|
133
|
+
revokeSession: (sessionId: string) => Promise<AuthResponse>;
|
|
134
|
+
revokeAllSessions: () => Promise<AuthResponse>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
declare class AuthService {
|
|
138
|
+
private httpClient;
|
|
139
|
+
private config;
|
|
140
|
+
private token;
|
|
141
|
+
private upfilesClient;
|
|
142
|
+
constructor(config: AuthConfig);
|
|
143
|
+
private loadTokenFromStorage;
|
|
144
|
+
private saveTokenToStorage;
|
|
145
|
+
private removeTokenFromStorage;
|
|
146
|
+
isAuthenticated(): boolean;
|
|
147
|
+
getToken(): string | null;
|
|
148
|
+
getCurrentUser(): User | null;
|
|
149
|
+
refreshCsrfToken(): Promise<void>;
|
|
150
|
+
getCsrfToken(): string | null;
|
|
151
|
+
loginWithOAuth(provider: OAuthProvider): void;
|
|
152
|
+
linkOAuthProvider(provider: OAuthProvider): void;
|
|
153
|
+
unlinkOAuthProvider(provider: OAuthProvider): Promise<AuthResponse>;
|
|
154
|
+
login(data: LoginData): Promise<AuthResponse>;
|
|
155
|
+
register(data: RegisterData): Promise<AuthResponse>;
|
|
156
|
+
verify(data: VerifyData): Promise<AuthResponse>;
|
|
157
|
+
verifyEmailToken(token: string): Promise<AuthResponse>;
|
|
158
|
+
logout(): Promise<void>;
|
|
159
|
+
getProfile(): Promise<User>;
|
|
160
|
+
updateProfile(data: UpdateUserData): Promise<AuthResponse>;
|
|
161
|
+
getAllUsers(): Promise<User[]>;
|
|
162
|
+
getUserById(id: string): Promise<User>;
|
|
163
|
+
forgotPassword(email: string): Promise<AuthResponse>;
|
|
164
|
+
resetPassword(token: string, password: string): Promise<AuthResponse>;
|
|
165
|
+
changePassword(oldPassword: string, newPassword: string): Promise<AuthResponse>;
|
|
166
|
+
updateAvatar(avatar: string): Promise<AuthResponse>;
|
|
167
|
+
uploadAndUpdateAvatar(file: File): Promise<AuthResponse>;
|
|
168
|
+
getUpfilesClient(): UpfilesClient | null;
|
|
169
|
+
requestEmailChange(newEmail: string): Promise<AuthResponse>;
|
|
170
|
+
verifyEmailChange(token: string): Promise<AuthResponse>;
|
|
171
|
+
generate2FA(): Promise<{
|
|
172
|
+
success: boolean;
|
|
173
|
+
qrCode?: string;
|
|
174
|
+
secret?: string;
|
|
175
|
+
message: string;
|
|
176
|
+
}>;
|
|
177
|
+
enable2FA(token: string): Promise<AuthResponse>;
|
|
178
|
+
disable2FA(token: string): Promise<AuthResponse>;
|
|
179
|
+
validate2FA(token: string): Promise<AuthResponse>;
|
|
180
|
+
getSessions(): Promise<{
|
|
181
|
+
success: boolean;
|
|
182
|
+
sessions: any[];
|
|
183
|
+
}>;
|
|
184
|
+
revokeSession(sessionId: string): Promise<AuthResponse>;
|
|
185
|
+
revokeAllSessions(): Promise<AuthResponse>;
|
|
186
|
+
getAuditLogs(filters?: any): Promise<{
|
|
187
|
+
success: boolean;
|
|
188
|
+
logs: any[];
|
|
189
|
+
}>;
|
|
190
|
+
adminVerifyUser(userId: string): Promise<AuthResponse>;
|
|
191
|
+
adminForcePasswordReset(userId: string): Promise<AuthResponse>;
|
|
192
|
+
adminSuspendUser(userId: string): Promise<AuthResponse>;
|
|
193
|
+
adminActivateUser(userId: string): Promise<AuthResponse>;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
declare class HttpClient {
|
|
197
|
+
private axiosInstance;
|
|
198
|
+
private csrfToken;
|
|
199
|
+
private frontendBaseUrl;
|
|
200
|
+
private baseUrl;
|
|
201
|
+
constructor(baseUrl: string, defaultHeaders?: Record<string, string>);
|
|
202
|
+
get<T>(endpoint: string, headers?: Record<string, string>): Promise<T>;
|
|
203
|
+
post<T>(endpoint: string, data?: any, headers?: Record<string, string>): Promise<T>;
|
|
204
|
+
put<T>(endpoint: string, data?: any, headers?: Record<string, string>): Promise<T>;
|
|
205
|
+
delete<T>(endpoint: string, headers?: Record<string, string>): Promise<T>;
|
|
206
|
+
setAuthToken(token: string): void;
|
|
207
|
+
removeAuthToken(): void;
|
|
208
|
+
setCsrfToken(token: string): void;
|
|
209
|
+
getCsrfToken(): string | null;
|
|
210
|
+
removeCsrfToken(): void;
|
|
211
|
+
setFrontendBaseUrl(url: string): void;
|
|
212
|
+
getFrontendBaseUrl(): string | null;
|
|
213
|
+
removeFrontendBaseUrl(): void;
|
|
214
|
+
private refreshCsrfToken;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
interface UseAuthReturnBase {
|
|
218
|
+
user: User | null;
|
|
219
|
+
isAuthenticated: boolean;
|
|
220
|
+
loading: boolean;
|
|
221
|
+
register: (data: RegisterData) => Promise<AuthResponse>;
|
|
222
|
+
login: (data: LoginData) => Promise<AuthResponse>;
|
|
223
|
+
verify: (data: VerifyData) => Promise<AuthResponse>;
|
|
224
|
+
verifyEmailToken: (token: string) => Promise<AuthResponse>;
|
|
225
|
+
logout: () => Promise<void>;
|
|
226
|
+
updateProfile: (data: UpdateUserData) => Promise<AuthResponse>;
|
|
227
|
+
getProfile: () => Promise<User>;
|
|
228
|
+
getAllUsers: () => Promise<User[]>;
|
|
229
|
+
getUserById: (id: string) => Promise<User>;
|
|
230
|
+
uploadAndUpdateAvatar: (file: File) => Promise<AuthResponse>;
|
|
231
|
+
}
|
|
232
|
+
declare const useAuth$1: (config: AuthConfig) => UseAuthReturnBase;
|
|
233
|
+
|
|
234
|
+
interface AuthContextValue {
|
|
235
|
+
user: User | null;
|
|
236
|
+
isLoaded: boolean;
|
|
237
|
+
isSignedIn: boolean;
|
|
238
|
+
loading: boolean;
|
|
239
|
+
signIn: (data: LoginData) => Promise<AuthResponse>;
|
|
240
|
+
signUp: (data: RegisterData) => Promise<AuthResponse>;
|
|
241
|
+
signOut: () => Promise<void>;
|
|
242
|
+
verify: (data: VerifyData) => Promise<AuthResponse>;
|
|
243
|
+
verifyEmailToken: (token: string) => Promise<AuthResponse>;
|
|
244
|
+
updateProfile: (data: UpdateUserData) => Promise<AuthResponse>;
|
|
245
|
+
getProfile: () => Promise<User>;
|
|
246
|
+
signInWithOAuth: (provider: OAuthProvider) => void;
|
|
247
|
+
linkOAuthProvider: (provider: OAuthProvider) => void;
|
|
248
|
+
unlinkOAuthProvider: (provider: OAuthProvider) => Promise<AuthResponse>;
|
|
249
|
+
forgotPassword: (email: string) => Promise<AuthResponse>;
|
|
250
|
+
resetPassword: (token: string, password: string) => Promise<AuthResponse>;
|
|
251
|
+
changePassword: (oldPassword: string, newPassword: string) => Promise<AuthResponse>;
|
|
252
|
+
updateAvatar: (avatar: string) => Promise<AuthResponse>;
|
|
253
|
+
uploadAndUpdateAvatar: (file: File) => Promise<AuthResponse>;
|
|
254
|
+
requestEmailChange: (newEmail: string) => Promise<AuthResponse>;
|
|
255
|
+
verifyEmailChange: (token: string) => Promise<AuthResponse>;
|
|
256
|
+
generate2FA: () => Promise<any>;
|
|
257
|
+
enable2FA: (token: string) => Promise<AuthResponse>;
|
|
258
|
+
disable2FA: (token: string) => Promise<AuthResponse>;
|
|
259
|
+
validate2FA: (token: string) => Promise<AuthResponse>;
|
|
260
|
+
getSessions: () => Promise<any>;
|
|
261
|
+
revokeSession: (sessionId: string) => Promise<AuthResponse>;
|
|
262
|
+
revokeAllSessions: () => Promise<AuthResponse>;
|
|
263
|
+
authService: AuthService;
|
|
264
|
+
}
|
|
265
|
+
interface AuthProviderProps {
|
|
266
|
+
children: ReactNode;
|
|
267
|
+
config?: Partial<AuthConfig>;
|
|
268
|
+
}
|
|
269
|
+
declare const AuthProvider: React.FC<AuthProviderProps>;
|
|
270
|
+
declare const useAuth: () => AuthContextValue;
|
|
271
|
+
|
|
272
|
+
type Theme = 'light' | 'dark';
|
|
273
|
+
interface ThemeContextType {
|
|
274
|
+
theme: Theme;
|
|
275
|
+
mounted: boolean;
|
|
276
|
+
}
|
|
277
|
+
declare function AuthThemeProvider({ children }: {
|
|
278
|
+
children: ReactNode;
|
|
279
|
+
}): react_jsx_runtime.JSX.Element;
|
|
280
|
+
declare function useAuthTheme(): ThemeContextType;
|
|
281
|
+
|
|
282
|
+
interface LoginFormProps {
|
|
283
|
+
onSuccess?: (response: {
|
|
284
|
+
message: string;
|
|
285
|
+
email?: string;
|
|
286
|
+
token?: string;
|
|
287
|
+
success: boolean;
|
|
288
|
+
user?: any;
|
|
289
|
+
}) => void;
|
|
290
|
+
onLoginSuccess?: (email: string, needsOtpVerification: boolean) => void;
|
|
291
|
+
onRegisterClick?: () => void;
|
|
292
|
+
showRegisterLink?: boolean;
|
|
293
|
+
config?: {
|
|
294
|
+
baseUrl?: string;
|
|
295
|
+
};
|
|
296
|
+
oauthProviders?: Array<'google' | 'github'>;
|
|
297
|
+
showOAuthButtons?: boolean;
|
|
298
|
+
}
|
|
299
|
+
declare const LoginForm: React.FC<LoginFormProps>;
|
|
300
|
+
|
|
301
|
+
interface RegisterFormProps {
|
|
302
|
+
onRegisterSuccess?: () => void;
|
|
303
|
+
onLoginClick?: () => void;
|
|
304
|
+
showLoginLink?: boolean;
|
|
305
|
+
authConfig?: AuthConfig;
|
|
306
|
+
oauthProviders?: Array<'google' | 'github'>;
|
|
307
|
+
showOAuthButtons?: boolean;
|
|
308
|
+
invitationToken?: string | null;
|
|
309
|
+
}
|
|
310
|
+
declare const RegisterForm: React.FC<RegisterFormProps>;
|
|
311
|
+
|
|
312
|
+
interface OtpFormProps {
|
|
313
|
+
email: string;
|
|
314
|
+
onVerifySuccess?: () => void;
|
|
315
|
+
onBackToLogin?: () => void;
|
|
316
|
+
baseUrl?: string;
|
|
317
|
+
}
|
|
318
|
+
declare const OtpForm: React.FC<OtpFormProps>;
|
|
319
|
+
|
|
320
|
+
type AuthStep = 'login' | 'register' | 'otp';
|
|
321
|
+
interface AuthFlowProps {
|
|
322
|
+
onAuthComplete?: () => void;
|
|
323
|
+
initialStep?: AuthStep;
|
|
324
|
+
showTitle?: boolean;
|
|
325
|
+
}
|
|
326
|
+
declare const AuthFlow: React.FC<AuthFlowProps>;
|
|
327
|
+
|
|
328
|
+
interface EmailVerificationPageProps {
|
|
329
|
+
token: string;
|
|
330
|
+
onVerificationSuccess?: () => void;
|
|
331
|
+
onVerificationError?: (error: string) => void;
|
|
332
|
+
baseUrl?: string;
|
|
333
|
+
}
|
|
334
|
+
declare const EmailVerificationPage: React.FC<EmailVerificationPageProps>;
|
|
335
|
+
|
|
336
|
+
interface SignInProps {
|
|
337
|
+
redirectUrl?: string;
|
|
338
|
+
appearance?: {
|
|
339
|
+
elements?: {
|
|
340
|
+
formButtonPrimary?: React.CSSProperties;
|
|
341
|
+
card?: React.CSSProperties;
|
|
342
|
+
headerTitle?: React.CSSProperties;
|
|
343
|
+
formFieldInput?: React.CSSProperties;
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
routing?: 'path' | 'virtual';
|
|
347
|
+
path?: string;
|
|
348
|
+
}
|
|
349
|
+
declare const SignIn: React.FC<SignInProps>;
|
|
350
|
+
|
|
351
|
+
interface SignUpProps {
|
|
352
|
+
redirectUrl?: string;
|
|
353
|
+
appearance?: {
|
|
354
|
+
elements?: {
|
|
355
|
+
formButtonPrimary?: React.CSSProperties;
|
|
356
|
+
card?: React.CSSProperties;
|
|
357
|
+
headerTitle?: React.CSSProperties;
|
|
358
|
+
formFieldInput?: React.CSSProperties;
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
declare const SignUp: React.FC<SignUpProps>;
|
|
363
|
+
|
|
364
|
+
interface SignOutProps {
|
|
365
|
+
redirectUrl?: string;
|
|
366
|
+
}
|
|
367
|
+
declare const SignOut: React.FC<SignOutProps>;
|
|
368
|
+
|
|
369
|
+
interface UserButtonProps {
|
|
370
|
+
showName?: boolean;
|
|
371
|
+
appearance?: {
|
|
372
|
+
elements?: {
|
|
373
|
+
userButtonBox?: React.CSSProperties;
|
|
374
|
+
userButtonTrigger?: React.CSSProperties;
|
|
375
|
+
userButtonPopoverCard?: React.CSSProperties;
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
declare const UserButton: React.FC<UserButtonProps>;
|
|
380
|
+
|
|
381
|
+
interface ProtectedRouteProps {
|
|
382
|
+
children: ReactNode;
|
|
383
|
+
fallback?: ReactNode;
|
|
384
|
+
redirectTo?: string;
|
|
385
|
+
}
|
|
386
|
+
declare const ProtectedRoute: React.FC<ProtectedRouteProps>;
|
|
387
|
+
|
|
388
|
+
interface PublicRouteProps {
|
|
389
|
+
children: ReactNode;
|
|
390
|
+
redirectTo?: string;
|
|
391
|
+
}
|
|
392
|
+
declare const PublicRoute: React.FC<PublicRouteProps>;
|
|
393
|
+
|
|
394
|
+
interface VerifyEmailProps {
|
|
395
|
+
token?: string;
|
|
396
|
+
onSuccess?: () => void;
|
|
397
|
+
onError?: (error: string) => void;
|
|
398
|
+
}
|
|
399
|
+
declare const VerifyEmail: React.FC<VerifyEmailProps>;
|
|
400
|
+
|
|
401
|
+
interface ForgotPasswordProps {
|
|
402
|
+
appearance?: {
|
|
403
|
+
elements?: {
|
|
404
|
+
formButtonPrimary?: React.CSSProperties;
|
|
405
|
+
card?: React.CSSProperties;
|
|
406
|
+
headerTitle?: React.CSSProperties;
|
|
407
|
+
formFieldInput?: React.CSSProperties;
|
|
408
|
+
};
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
declare const ForgotPassword: React.FC<ForgotPasswordProps>;
|
|
412
|
+
|
|
413
|
+
interface ResetPasswordProps {
|
|
414
|
+
token?: string;
|
|
415
|
+
appearance?: {
|
|
416
|
+
elements?: {
|
|
417
|
+
formButtonPrimary?: React.CSSProperties;
|
|
418
|
+
card?: React.CSSProperties;
|
|
419
|
+
headerTitle?: React.CSSProperties;
|
|
420
|
+
formFieldInput?: React.CSSProperties;
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
declare const ResetPassword: React.FC<ResetPasswordProps>;
|
|
425
|
+
|
|
426
|
+
interface ChangePasswordProps {
|
|
427
|
+
onSuccess?: () => void;
|
|
428
|
+
appearance?: {
|
|
429
|
+
elements?: {
|
|
430
|
+
formButtonPrimary?: React.CSSProperties;
|
|
431
|
+
card?: React.CSSProperties;
|
|
432
|
+
headerTitle?: React.CSSProperties;
|
|
433
|
+
formFieldInput?: React.CSSProperties;
|
|
434
|
+
};
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
declare const ChangePassword: React.FC<ChangePasswordProps>;
|
|
438
|
+
|
|
439
|
+
interface UserProfileProps {
|
|
440
|
+
showAvatar?: boolean;
|
|
441
|
+
showEmailChange?: boolean;
|
|
442
|
+
showPasswordChange?: boolean;
|
|
443
|
+
upfilesConfig?: {
|
|
444
|
+
baseUrl: string;
|
|
445
|
+
apiKey?: string;
|
|
446
|
+
apiKeyHeader?: 'authorization' | 'x-api-key' | 'x-up-api-key';
|
|
447
|
+
presignUrl?: string;
|
|
448
|
+
presignPath?: string;
|
|
449
|
+
folderPath?: string;
|
|
450
|
+
projectId?: string;
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
declare const UserProfile: React.FC<UserProfileProps>;
|
|
454
|
+
|
|
455
|
+
interface PhoneInputProps {
|
|
456
|
+
value: string;
|
|
457
|
+
onChange: (value: string) => void;
|
|
458
|
+
disabled?: boolean;
|
|
459
|
+
required?: boolean;
|
|
460
|
+
placeholder?: string;
|
|
461
|
+
id?: string;
|
|
462
|
+
style?: React.CSSProperties;
|
|
463
|
+
}
|
|
464
|
+
declare const PhoneInput: React.FC<PhoneInputProps>;
|
|
465
|
+
|
|
466
|
+
interface AvatarUploaderProps {
|
|
467
|
+
onUploadComplete?: (avatarUrl: string) => void;
|
|
468
|
+
onError?: (error: Error) => void;
|
|
469
|
+
className?: string;
|
|
470
|
+
buttonClassName?: string;
|
|
471
|
+
dropzoneClassName?: string;
|
|
472
|
+
maxFileSize?: number;
|
|
473
|
+
accept?: string[];
|
|
474
|
+
upfilesConfig: {
|
|
475
|
+
baseUrl: string;
|
|
476
|
+
apiKey?: string;
|
|
477
|
+
apiKeyHeader?: 'authorization' | 'x-api-key' | 'x-up-api-key';
|
|
478
|
+
presignUrl?: string;
|
|
479
|
+
presignPath?: string;
|
|
480
|
+
folderPath?: string;
|
|
481
|
+
projectId?: string;
|
|
482
|
+
};
|
|
483
|
+
buttonText?: string;
|
|
484
|
+
}
|
|
485
|
+
declare const AvatarUploader: React.FC<AvatarUploaderProps>;
|
|
486
|
+
|
|
487
|
+
interface AvatarManagerProps {
|
|
488
|
+
open: boolean;
|
|
489
|
+
onOpenChange: (open: boolean) => void;
|
|
490
|
+
onAvatarUpdated?: (avatarUrl: string) => void;
|
|
491
|
+
onError?: (error: Error) => void;
|
|
492
|
+
title?: string;
|
|
493
|
+
description?: string;
|
|
494
|
+
className?: string;
|
|
495
|
+
gridClassName?: string;
|
|
496
|
+
maxFileSize?: number;
|
|
497
|
+
maxFiles?: number;
|
|
498
|
+
mode?: 'full' | 'browse' | 'upload';
|
|
499
|
+
showDelete?: boolean;
|
|
500
|
+
autoRecordToDb?: boolean;
|
|
501
|
+
fetchThumbnails?: boolean;
|
|
502
|
+
projectId?: string;
|
|
503
|
+
deleteUrl?: string;
|
|
504
|
+
onDelete?: (key: string) => Promise<void>;
|
|
505
|
+
upfilesConfig: {
|
|
506
|
+
baseUrl: string;
|
|
507
|
+
apiKey?: string;
|
|
508
|
+
apiKeyHeader?: 'authorization' | 'x-api-key' | 'x-up-api-key';
|
|
509
|
+
presignUrl?: string;
|
|
510
|
+
presignPath?: string;
|
|
511
|
+
folderPath?: string;
|
|
512
|
+
headers?: Record<string, string>;
|
|
513
|
+
withCredentials?: boolean;
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
declare const AvatarManager: React.FC<AvatarManagerProps>;
|
|
517
|
+
|
|
518
|
+
interface UseNextAuthReturn {
|
|
519
|
+
user: User | null;
|
|
520
|
+
isAuthenticated: boolean;
|
|
521
|
+
loading: boolean;
|
|
522
|
+
register: (data: RegisterData) => Promise<AuthResponse>;
|
|
523
|
+
login: (data: LoginData) => Promise<AuthResponse>;
|
|
524
|
+
verify: (data: VerifyData) => Promise<AuthResponse>;
|
|
525
|
+
verifyEmailToken: (token: string) => Promise<AuthResponse>;
|
|
526
|
+
logout: () => Promise<void>;
|
|
527
|
+
updateProfile: (data: UpdateUserData) => Promise<AuthResponse>;
|
|
528
|
+
getProfile: () => Promise<User>;
|
|
529
|
+
getAllUsers: () => Promise<User[]>;
|
|
530
|
+
getUserById: (id: string) => Promise<User>;
|
|
531
|
+
forgotPassword: (email: string) => Promise<AuthResponse>;
|
|
532
|
+
resetPassword: (token: string, password: string) => Promise<AuthResponse>;
|
|
533
|
+
setToken: (token: string) => void;
|
|
534
|
+
clearToken: () => void;
|
|
535
|
+
}
|
|
536
|
+
declare const useNextAuth: (config: AuthConfig) => UseNextAuthReturn;
|
|
537
|
+
|
|
538
|
+
export { type AuditLog, type AuthConfig, AuthFlow, AuthProvider, type AuthResponse, AuthService, AuthThemeProvider, AvatarManager, type AvatarManagerProps, AvatarUploader, type AvatarUploaderProps, ChangePassword, type CsrfTokenResponse, EmailVerificationPage, ForgotPassword, HttpClient, type LinkedAccount, type LoginData, LoginForm, type MFASetup, type OAuthConfig, type OAuthProvider, OtpForm, PhoneInput, ProtectedRoute, PublicRoute, type RegisterData, RegisterForm, type RegisterFormProps, ResetPassword, type Session, SignIn, SignOut, SignUp, type UpdateUserData, type UpfilesConfig, type UseAuthReturn, type User, UserButton, UserProfile, type VerifyData, VerifyEmail, useAuth, useAuth$1 as useAuthLegacy, useAuthTheme, useNextAuth };
|
package/dist/index.next.d.ts
CHANGED
|
@@ -494,8 +494,14 @@ interface AvatarManagerProps {
|
|
|
494
494
|
className?: string;
|
|
495
495
|
gridClassName?: string;
|
|
496
496
|
maxFileSize?: number;
|
|
497
|
+
maxFiles?: number;
|
|
497
498
|
mode?: 'full' | 'browse' | 'upload';
|
|
498
499
|
showDelete?: boolean;
|
|
500
|
+
autoRecordToDb?: boolean;
|
|
501
|
+
fetchThumbnails?: boolean;
|
|
502
|
+
projectId?: string;
|
|
503
|
+
deleteUrl?: string;
|
|
504
|
+
onDelete?: (key: string) => Promise<void>;
|
|
499
505
|
upfilesConfig: {
|
|
500
506
|
baseUrl: string;
|
|
501
507
|
apiKey?: string;
|
|
@@ -503,6 +509,8 @@ interface AvatarManagerProps {
|
|
|
503
509
|
presignUrl?: string;
|
|
504
510
|
presignPath?: string;
|
|
505
511
|
folderPath?: string;
|
|
512
|
+
headers?: Record<string, string>;
|
|
513
|
+
withCredentials?: boolean;
|
|
506
514
|
};
|
|
507
515
|
}
|
|
508
516
|
declare const AvatarManager: React.FC<AvatarManagerProps>;
|
|
@@ -527,4 +535,4 @@ interface UseNextAuthReturn {
|
|
|
527
535
|
}
|
|
528
536
|
declare const useNextAuth: (config: AuthConfig) => UseNextAuthReturn;
|
|
529
537
|
|
|
530
|
-
export { AuditLog, AuthConfig, AuthFlow, AuthProvider, AuthResponse, AuthService, AuthThemeProvider, AvatarManager, AvatarManagerProps, AvatarUploader, AvatarUploaderProps, ChangePassword, CsrfTokenResponse, EmailVerificationPage, ForgotPassword, HttpClient, LinkedAccount, LoginData, LoginForm, MFASetup, OAuthConfig, OAuthProvider, OtpForm, PhoneInput, ProtectedRoute, PublicRoute, RegisterData, RegisterForm, RegisterFormProps, ResetPassword, Session, SignIn, SignOut, SignUp, UpdateUserData, UpfilesConfig, UseAuthReturn, User, UserButton, UserProfile, VerifyData, VerifyEmail, useAuth, useAuth$1 as useAuthLegacy, useAuthTheme, useNextAuth };
|
|
538
|
+
export { type AuditLog, type AuthConfig, AuthFlow, AuthProvider, type AuthResponse, AuthService, AuthThemeProvider, AvatarManager, type AvatarManagerProps, AvatarUploader, type AvatarUploaderProps, ChangePassword, type CsrfTokenResponse, EmailVerificationPage, ForgotPassword, HttpClient, type LinkedAccount, type LoginData, LoginForm, type MFASetup, type OAuthConfig, type OAuthProvider, OtpForm, PhoneInput, ProtectedRoute, PublicRoute, type RegisterData, RegisterForm, type RegisterFormProps, ResetPassword, type Session, SignIn, SignOut, SignUp, type UpdateUserData, type UpfilesConfig, type UseAuthReturn, type User, UserButton, UserProfile, type VerifyData, VerifyEmail, useAuth, useAuth$1 as useAuthLegacy, useAuthTheme, useNextAuth };
|