@thetechfossil/auth2 1.2.2 → 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.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: string;
29
+ email?: string;
30
+ phoneNumber?: string;
27
31
  password?: string;
28
32
  otp?: string;
29
33
  }
30
34
  interface VerifyData {
31
- email: string;
35
+ email?: string;
36
+ phoneNumber?: string;
32
37
  otp: string;
33
38
  }
34
39
  interface RegisterData {
35
40
  name: string;
36
- email: string;
41
+ email?: string;
42
+ phoneNumber?: string;
37
43
  password: string;
38
44
  }
39
45
  interface UpdateUserData {
40
- name: string;
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 {
@@ -56,11 +66,13 @@ interface AuthConfig {
56
66
  }
57
67
  interface Session {
58
68
  id: string;
59
- userId: string;
60
- deviceInfo?: string;
69
+ userId?: string;
70
+ token?: string;
71
+ userAgent?: string;
61
72
  ipAddress?: string;
62
- lastActive: string;
73
+ expiresAt: string;
63
74
  createdAt: string;
75
+ updatedAt?: string;
64
76
  }
65
77
  interface MFASetup {
66
78
  success: boolean;
@@ -170,6 +182,7 @@ declare class HttpClient {
170
182
  private axiosInstance;
171
183
  private csrfToken;
172
184
  private frontendBaseUrl;
185
+ private baseUrl;
173
186
  constructor(baseUrl: string, defaultHeaders?: Record<string, string>);
174
187
  get<T>(endpoint: string, headers?: Record<string, string>): Promise<T>;
175
188
  post<T>(endpoint: string, data?: any, headers?: Record<string, string>): Promise<T>;
@@ -249,6 +262,7 @@ interface RegisterFormProps {
249
262
  authConfig?: AuthConfig;
250
263
  oauthProviders?: Array<'google' | 'github'>;
251
264
  showOAuthButtons?: boolean;
265
+ invitationToken?: string | null;
252
266
  }
253
267
  declare const RegisterForm: React.FC<RegisterFormProps>;
254
268
 
@@ -256,6 +270,7 @@ interface OtpFormProps {
256
270
  email: string;
257
271
  onVerifySuccess?: () => void;
258
272
  onBackToLogin?: () => void;
273
+ baseUrl?: string;
259
274
  }
260
275
  declare const OtpForm: React.FC<OtpFormProps>;
261
276
 
@@ -385,6 +400,17 @@ interface UserProfileProps {
385
400
  }
386
401
  declare const UserProfile: React.FC<UserProfileProps>;
387
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
+
388
414
  interface UseAuthReturnBase {
389
415
  user: User | null;
390
416
  isAuthenticated: boolean;
@@ -401,16 +427,29 @@ interface UseAuthReturnBase {
401
427
  }
402
428
  declare const useAuth: (config: AuthConfig) => UseAuthReturnBase;
403
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
+
404
440
  declare const index$1_AuthFlow: typeof AuthFlow;
405
441
  declare const index$1_AuthProvider: typeof AuthProvider;
442
+ declare const index$1_AuthThemeProvider: typeof AuthThemeProvider;
406
443
  declare const index$1_ChangePassword: typeof ChangePassword;
407
444
  declare const index$1_EmailVerificationPage: typeof EmailVerificationPage;
408
445
  declare const index$1_ForgotPassword: typeof ForgotPassword;
409
446
  declare const index$1_LoginForm: typeof LoginForm;
410
447
  declare const index$1_OtpForm: typeof OtpForm;
448
+ declare const index$1_PhoneInput: typeof PhoneInput;
411
449
  declare const index$1_ProtectedRoute: typeof ProtectedRoute;
412
450
  declare const index$1_PublicRoute: typeof PublicRoute;
413
451
  declare const index$1_RegisterForm: typeof RegisterForm;
452
+ type index$1_RegisterFormProps = RegisterFormProps;
414
453
  declare const index$1_ResetPassword: typeof ResetPassword;
415
454
  declare const index$1_SignIn: typeof SignIn;
416
455
  declare const index$1_SignOut: typeof SignOut;
@@ -418,18 +457,22 @@ declare const index$1_SignUp: typeof SignUp;
418
457
  declare const index$1_UserButton: typeof UserButton;
419
458
  declare const index$1_UserProfile: typeof UserProfile;
420
459
  declare const index$1_VerifyEmail: typeof VerifyEmail;
460
+ declare const index$1_useAuthTheme: typeof useAuthTheme;
421
461
  declare namespace index$1 {
422
462
  export {
423
463
  index$1_AuthFlow as AuthFlow,
424
464
  index$1_AuthProvider as AuthProvider,
465
+ index$1_AuthThemeProvider as AuthThemeProvider,
425
466
  index$1_ChangePassword as ChangePassword,
426
467
  index$1_EmailVerificationPage as EmailVerificationPage,
427
468
  index$1_ForgotPassword as ForgotPassword,
428
469
  index$1_LoginForm as LoginForm,
429
470
  index$1_OtpForm as OtpForm,
471
+ index$1_PhoneInput as PhoneInput,
430
472
  index$1_ProtectedRoute as ProtectedRoute,
431
473
  index$1_PublicRoute as PublicRoute,
432
474
  index$1_RegisterForm as RegisterForm,
475
+ index$1_RegisterFormProps as RegisterFormProps,
433
476
  index$1_ResetPassword as ResetPassword,
434
477
  index$1_SignIn as SignIn,
435
478
  index$1_SignOut as SignOut,
@@ -439,6 +482,7 @@ declare namespace index$1 {
439
482
  index$1_VerifyEmail as VerifyEmail,
440
483
  useAuth$1 as useAuth,
441
484
  useAuth as useAuthLegacy,
485
+ index$1_useAuthTheme as useAuthTheme,
442
486
  };
443
487
  }
444
488