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