@thetechfossil/auth2 1.2.3 → 1.2.5
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.components.d.ts +14 -1
- package/dist/index.components.js +1284 -638
- package/dist/index.components.js.map +1 -1
- package/dist/index.components.mjs +1186 -543
- package/dist/index.components.mjs.map +1 -1
- package/dist/index.d.ts +48 -5
- package/dist/index.js +1364 -669
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1237 -544
- package/dist/index.mjs.map +1 -1
- package/dist/index.next.d.ts +41 -6
- package/dist/index.next.js +1382 -687
- package/dist/index.next.js.map +1 -1
- package/dist/index.next.mjs +1234 -544
- package/dist/index.next.mjs.map +1 -1
- package/dist/index.next.server.d.ts +16 -5
- package/dist/index.next.server.js +16 -9
- package/dist/index.next.server.js.map +1 -1
- package/dist/index.next.server.mjs +16 -9
- package/dist/index.next.server.mjs.map +1 -1
- package/dist/index.node.d.ts +16 -5
- package/dist/index.node.js +15 -9
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +15 -9
- package/dist/index.node.mjs.map +1 -1
- package/package.json +90 -87
- package/README.NEW.md +0 -365
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
interface LinkedAccount {
|
|
4
5
|
provider: 'google' | 'github';
|
|
@@ -7,9 +8,12 @@ interface LinkedAccount {
|
|
|
7
8
|
avatar?: string;
|
|
8
9
|
}
|
|
9
10
|
interface User {
|
|
10
|
-
|
|
11
|
+
id: string;
|
|
12
|
+
_id?: string;
|
|
11
13
|
name: string;
|
|
12
14
|
email: string;
|
|
15
|
+
phoneNumber?: string;
|
|
16
|
+
avatar?: string;
|
|
13
17
|
role: string;
|
|
14
18
|
linkedAccounts?: LinkedAccount[];
|
|
15
19
|
createdAt: string;
|
|
@@ -23,21 +27,28 @@ interface AuthResponse {
|
|
|
23
27
|
csrfToken?: string;
|
|
24
28
|
}
|
|
25
29
|
interface LoginData {
|
|
26
|
-
email
|
|
30
|
+
email?: string;
|
|
31
|
+
phoneNumber?: string;
|
|
27
32
|
password?: string;
|
|
28
33
|
otp?: string;
|
|
29
34
|
}
|
|
30
35
|
interface VerifyData {
|
|
31
|
-
email
|
|
36
|
+
email?: string;
|
|
37
|
+
phoneNumber?: string;
|
|
32
38
|
otp: string;
|
|
33
39
|
}
|
|
34
40
|
interface RegisterData {
|
|
35
41
|
name: string;
|
|
36
|
-
email
|
|
42
|
+
email?: string;
|
|
43
|
+
phoneNumber?: string;
|
|
37
44
|
password: string;
|
|
38
45
|
}
|
|
39
46
|
interface UpdateUserData {
|
|
40
|
-
name
|
|
47
|
+
name?: string;
|
|
48
|
+
avatar?: string;
|
|
49
|
+
email?: string;
|
|
50
|
+
username?: string;
|
|
51
|
+
phoneNumber?: string;
|
|
41
52
|
}
|
|
42
53
|
type OAuthProvider = 'google' | 'github';
|
|
43
54
|
interface OAuthConfig {
|
|
@@ -172,6 +183,7 @@ declare class HttpClient {
|
|
|
172
183
|
private axiosInstance;
|
|
173
184
|
private csrfToken;
|
|
174
185
|
private frontendBaseUrl;
|
|
186
|
+
private baseUrl;
|
|
175
187
|
constructor(baseUrl: string, defaultHeaders?: Record<string, string>);
|
|
176
188
|
get<T>(endpoint: string, headers?: Record<string, string>): Promise<T>;
|
|
177
189
|
post<T>(endpoint: string, data?: any, headers?: Record<string, string>): Promise<T>;
|
|
@@ -251,6 +263,7 @@ interface RegisterFormProps {
|
|
|
251
263
|
authConfig?: AuthConfig;
|
|
252
264
|
oauthProviders?: Array<'google' | 'github'>;
|
|
253
265
|
showOAuthButtons?: boolean;
|
|
266
|
+
invitationToken?: string | null;
|
|
254
267
|
}
|
|
255
268
|
declare const RegisterForm: React.FC<RegisterFormProps>;
|
|
256
269
|
|
|
@@ -258,6 +271,7 @@ interface OtpFormProps {
|
|
|
258
271
|
email: string;
|
|
259
272
|
onVerifySuccess?: () => void;
|
|
260
273
|
onBackToLogin?: () => void;
|
|
274
|
+
baseUrl?: string;
|
|
261
275
|
}
|
|
262
276
|
declare const OtpForm: React.FC<OtpFormProps>;
|
|
263
277
|
|
|
@@ -387,6 +401,17 @@ interface UserProfileProps {
|
|
|
387
401
|
}
|
|
388
402
|
declare const UserProfile: React.FC<UserProfileProps>;
|
|
389
403
|
|
|
404
|
+
interface PhoneInputProps {
|
|
405
|
+
value: string;
|
|
406
|
+
onChange: (value: string) => void;
|
|
407
|
+
disabled?: boolean;
|
|
408
|
+
required?: boolean;
|
|
409
|
+
placeholder?: string;
|
|
410
|
+
id?: string;
|
|
411
|
+
style?: React.CSSProperties;
|
|
412
|
+
}
|
|
413
|
+
declare const PhoneInput: React.FC<PhoneInputProps>;
|
|
414
|
+
|
|
390
415
|
interface UseAuthReturnBase {
|
|
391
416
|
user: User | null;
|
|
392
417
|
isAuthenticated: boolean;
|
|
@@ -403,16 +428,29 @@ interface UseAuthReturnBase {
|
|
|
403
428
|
}
|
|
404
429
|
declare const useAuth: (config: AuthConfig) => UseAuthReturnBase;
|
|
405
430
|
|
|
431
|
+
type Theme = 'light' | 'dark';
|
|
432
|
+
interface ThemeContextType {
|
|
433
|
+
theme: Theme;
|
|
434
|
+
mounted: boolean;
|
|
435
|
+
}
|
|
436
|
+
declare function AuthThemeProvider({ children }: {
|
|
437
|
+
children: ReactNode;
|
|
438
|
+
}): react_jsx_runtime.JSX.Element;
|
|
439
|
+
declare function useAuthTheme(): ThemeContextType;
|
|
440
|
+
|
|
406
441
|
declare const index$1_AuthFlow: typeof AuthFlow;
|
|
407
442
|
declare const index$1_AuthProvider: typeof AuthProvider;
|
|
443
|
+
declare const index$1_AuthThemeProvider: typeof AuthThemeProvider;
|
|
408
444
|
declare const index$1_ChangePassword: typeof ChangePassword;
|
|
409
445
|
declare const index$1_EmailVerificationPage: typeof EmailVerificationPage;
|
|
410
446
|
declare const index$1_ForgotPassword: typeof ForgotPassword;
|
|
411
447
|
declare const index$1_LoginForm: typeof LoginForm;
|
|
412
448
|
declare const index$1_OtpForm: typeof OtpForm;
|
|
449
|
+
declare const index$1_PhoneInput: typeof PhoneInput;
|
|
413
450
|
declare const index$1_ProtectedRoute: typeof ProtectedRoute;
|
|
414
451
|
declare const index$1_PublicRoute: typeof PublicRoute;
|
|
415
452
|
declare const index$1_RegisterForm: typeof RegisterForm;
|
|
453
|
+
type index$1_RegisterFormProps = RegisterFormProps;
|
|
416
454
|
declare const index$1_ResetPassword: typeof ResetPassword;
|
|
417
455
|
declare const index$1_SignIn: typeof SignIn;
|
|
418
456
|
declare const index$1_SignOut: typeof SignOut;
|
|
@@ -420,18 +458,22 @@ declare const index$1_SignUp: typeof SignUp;
|
|
|
420
458
|
declare const index$1_UserButton: typeof UserButton;
|
|
421
459
|
declare const index$1_UserProfile: typeof UserProfile;
|
|
422
460
|
declare const index$1_VerifyEmail: typeof VerifyEmail;
|
|
461
|
+
declare const index$1_useAuthTheme: typeof useAuthTheme;
|
|
423
462
|
declare namespace index$1 {
|
|
424
463
|
export {
|
|
425
464
|
index$1_AuthFlow as AuthFlow,
|
|
426
465
|
index$1_AuthProvider as AuthProvider,
|
|
466
|
+
index$1_AuthThemeProvider as AuthThemeProvider,
|
|
427
467
|
index$1_ChangePassword as ChangePassword,
|
|
428
468
|
index$1_EmailVerificationPage as EmailVerificationPage,
|
|
429
469
|
index$1_ForgotPassword as ForgotPassword,
|
|
430
470
|
index$1_LoginForm as LoginForm,
|
|
431
471
|
index$1_OtpForm as OtpForm,
|
|
472
|
+
index$1_PhoneInput as PhoneInput,
|
|
432
473
|
index$1_ProtectedRoute as ProtectedRoute,
|
|
433
474
|
index$1_PublicRoute as PublicRoute,
|
|
434
475
|
index$1_RegisterForm as RegisterForm,
|
|
476
|
+
index$1_RegisterFormProps as RegisterFormProps,
|
|
435
477
|
index$1_ResetPassword as ResetPassword,
|
|
436
478
|
index$1_SignIn as SignIn,
|
|
437
479
|
index$1_SignOut as SignOut,
|
|
@@ -441,6 +483,7 @@ declare namespace index$1 {
|
|
|
441
483
|
index$1_VerifyEmail as VerifyEmail,
|
|
442
484
|
useAuth$1 as useAuth,
|
|
443
485
|
useAuth as useAuthLegacy,
|
|
486
|
+
index$1_useAuthTheme as useAuthTheme,
|
|
444
487
|
};
|
|
445
488
|
}
|
|
446
489
|
|