@mesob/auth-react 0.1.0 → 0.2.0
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/components/auth/{auth-page-layout.d.ts → auth-layout.d.ts} +3 -3
- package/dist/components/auth/{auth-page-layout.js → auth-layout.js} +4 -4
- package/dist/components/auth/auth-layout.js.map +1 -0
- package/dist/components/auth/countdown.js +15 -6
- package/dist/components/auth/countdown.js.map +1 -1
- package/dist/components/auth/forgot-password.d.ts +1 -9
- package/dist/components/auth/forgot-password.js +267 -43
- package/dist/components/auth/forgot-password.js.map +1 -1
- package/dist/components/auth/reset-password-form.d.ts +2 -10
- package/dist/components/auth/reset-password-form.js +366 -118
- package/dist/components/auth/reset-password-form.js.map +1 -1
- package/dist/components/auth/sign-in.d.ts +2 -10
- package/dist/components/auth/sign-in.js +358 -130
- package/dist/components/auth/sign-in.js.map +1 -1
- package/dist/components/auth/sign-up.d.ts +2 -10
- package/dist/components/auth/sign-up.js +379 -131
- package/dist/components/auth/sign-up.js.map +1 -1
- package/dist/components/auth/verification-form.d.ts +2 -16
- package/dist/components/auth/verification-form.js +15 -6
- package/dist/components/auth/verification-form.js.map +1 -1
- package/dist/components/auth/verify-email.d.ts +10 -0
- package/dist/components/auth/{pages/verify-email-page.js → verify-email.js} +54 -34
- package/dist/components/auth/verify-email.js.map +1 -0
- package/dist/components/auth/verify-phone.d.ts +11 -0
- package/dist/components/auth/{pages/verify-phone-page.js → verify-phone.js} +53 -46
- package/dist/components/auth/verify-phone.js.map +1 -0
- package/dist/components/error-boundary.d.ts +2 -2
- package/dist/components/iam/permissions.d.ts +5 -0
- package/dist/components/iam/{permissions/permissions-page.js → permissions.js} +29 -13
- package/dist/components/iam/permissions.js.map +1 -0
- package/dist/components/iam/roles.d.ts +5 -0
- package/dist/components/iam/{roles/roles-page.js → roles.js} +29 -13
- package/dist/components/iam/roles.js.map +1 -0
- package/dist/components/iam/sessions.d.ts +5 -0
- package/dist/components/iam/{sessions/sessions-page.js → sessions.js} +13 -11
- package/dist/components/iam/sessions.js.map +1 -0
- package/dist/components/iam/tenants.d.ts +5 -0
- package/dist/components/iam/{tenants/tenants-page.js → tenants.js} +13 -11
- package/dist/components/iam/tenants.js.map +1 -0
- package/dist/components/iam/users.d.ts +5 -0
- package/dist/components/iam/{users/users-page.js → users.js} +13 -11
- package/dist/components/iam/users.js.map +1 -0
- package/dist/components/profile/account.d.ts +5 -0
- package/dist/components/profile/account.js +66 -0
- package/dist/components/profile/account.js.map +1 -0
- package/dist/components/profile/change-email-form.d.ts +5 -0
- package/dist/components/profile/change-email-form.js +721 -0
- package/dist/components/profile/change-email-form.js.map +1 -0
- package/dist/components/profile/change-password-form.d.ts +5 -0
- package/dist/components/profile/change-password-form.js +256 -0
- package/dist/components/profile/change-password-form.js.map +1 -0
- package/dist/components/profile/change-phone-form.d.ts +5 -0
- package/dist/components/profile/change-phone-form.js +758 -0
- package/dist/components/profile/change-phone-form.js.map +1 -0
- package/dist/components/profile/change-profile.d.ts +9 -0
- package/dist/components/profile/change-profile.js +37 -0
- package/dist/components/profile/change-profile.js.map +1 -0
- package/dist/components/profile/otp-verification-modal.d.ts +15 -0
- package/dist/components/profile/otp-verification-modal.js +261 -0
- package/dist/components/profile/otp-verification-modal.js.map +1 -0
- package/dist/components/profile/request-change-email-form.d.ts +10 -0
- package/dist/components/profile/request-change-email-form.js +293 -0
- package/dist/components/profile/request-change-email-form.js.map +1 -0
- package/dist/components/profile/request-change-phone-form.d.ts +10 -0
- package/dist/components/profile/request-change-phone-form.js +331 -0
- package/dist/components/profile/request-change-phone-form.js.map +1 -0
- package/dist/components/profile/security.d.ts +5 -0
- package/dist/components/profile/security.js +1439 -0
- package/dist/components/profile/security.js.map +1 -0
- package/dist/components/profile/verify-change-email-form.d.ts +11 -0
- package/dist/components/profile/verify-change-email-form.js +402 -0
- package/dist/components/profile/verify-change-email-form.js.map +1 -0
- package/dist/components/profile/verify-change-phone-form.d.ts +11 -0
- package/dist/components/profile/verify-change-phone-form.js +406 -0
- package/dist/components/profile/verify-change-phone-form.js.map +1 -0
- package/dist/components/shared/{data-table/data-table.js → data-table.js} +2 -2
- package/dist/components/shared/data-table.js.map +1 -0
- package/dist/index.d.ts +42 -88
- package/dist/index.js +2297 -1299
- package/dist/index.js.map +1 -1
- package/dist/types-D3s9oE-5.d.ts +75 -0
- package/dist/verification-form-ipSRTtQB.d.ts +22 -0
- package/package.json +3 -2
- package/dist/components/auth/auth-page-layout.js.map +0 -1
- package/dist/components/auth/pages/forgot-password-page.d.ts +0 -6
- package/dist/components/auth/pages/forgot-password-page.js +0 -362
- package/dist/components/auth/pages/forgot-password-page.js.map +0 -1
- package/dist/components/auth/pages/reset-password-page.d.ts +0 -9
- package/dist/components/auth/pages/reset-password-page.js +0 -514
- package/dist/components/auth/pages/reset-password-page.js.map +0 -1
- package/dist/components/auth/pages/sign-in-page.d.ts +0 -8
- package/dist/components/auth/pages/sign-in-page.js +0 -565
- package/dist/components/auth/pages/sign-in-page.js.map +0 -1
- package/dist/components/auth/pages/sign-up-page.d.ts +0 -9
- package/dist/components/auth/pages/sign-up-page.js +0 -518
- package/dist/components/auth/pages/sign-up-page.js.map +0 -1
- package/dist/components/auth/pages/verify-email-page.d.ts +0 -10
- package/dist/components/auth/pages/verify-email-page.js.map +0 -1
- package/dist/components/auth/pages/verify-phone-page.d.ts +0 -11
- package/dist/components/auth/pages/verify-phone-page.js.map +0 -1
- package/dist/components/iam/permissions/permissions-page.d.ts +0 -5
- package/dist/components/iam/permissions/permissions-page.js.map +0 -1
- package/dist/components/iam/roles/roles-page.d.ts +0 -5
- package/dist/components/iam/roles/roles-page.js.map +0 -1
- package/dist/components/iam/sessions/sessions-page.d.ts +0 -5
- package/dist/components/iam/sessions/sessions-page.js.map +0 -1
- package/dist/components/iam/tenants/tenants-page.d.ts +0 -5
- package/dist/components/iam/tenants/tenants-page.js.map +0 -1
- package/dist/components/iam/users/users-page.d.ts +0 -5
- package/dist/components/iam/users/users-page.js.map +0 -1
- package/dist/components/profile/profile-page.d.ts +0 -8
- package/dist/components/profile/profile-page.js +0 -163
- package/dist/components/profile/profile-page.js.map +0 -1
- package/dist/components/shared/data-table/data-table.js.map +0 -1
- package/dist/handle-error-BqDMxnQZ.d.ts +0 -8
- /package/dist/components/shared/{data-table/data-table.d.ts → data-table.d.ts} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,107 +1,49 @@
|
|
|
1
1
|
export { AuthCard } from './components/auth/auth-card.js';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
2
|
+
export { ForgotPassword } from './components/auth/forgot-password.js';
|
|
3
|
+
export { ResetPasswordForm } from './components/auth/reset-password-form.js';
|
|
4
|
+
export { SignIn } from './components/auth/sign-in.js';
|
|
5
|
+
export { SignUp } from './components/auth/sign-up.js';
|
|
6
|
+
export { A as AuthErrorContent, V as VerificationForm, h as handleError } from './verification-form-ipSRTtQB.js';
|
|
7
|
+
export { VerifyEmail } from './components/auth/verify-email.js';
|
|
8
|
+
export { VerifyPhone } from './components/auth/verify-phone.js';
|
|
9
9
|
export { AuthErrorBoundary, ErrorBoundary } from './components/error-boundary.js';
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
10
|
+
export { Permissions } from './components/iam/permissions.js';
|
|
11
|
+
export { Roles } from './components/iam/roles.js';
|
|
12
|
+
export { Sessions } from './components/iam/sessions.js';
|
|
13
|
+
export { Tenants } from './components/iam/tenants.js';
|
|
14
|
+
export { Users } from './components/iam/users.js';
|
|
15
|
+
export { Account } from './components/profile/account.js';
|
|
16
|
+
export { Security } from './components/profile/security.js';
|
|
17
|
+
export { DataTable, DataTableColumn } from './components/shared/data-table.js';
|
|
17
18
|
export { AuthFormSkeleton } from './components/skeletons/auth-form-skeleton.js';
|
|
18
19
|
export { ProfileSkeleton } from './components/skeletons/profile-skeleton.js';
|
|
19
20
|
export { TableSkeleton } from './components/skeletons/table-skeleton.js';
|
|
20
21
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
21
22
|
import { ReactNode } from 'react';
|
|
22
|
-
|
|
23
|
+
import { A as AuthClientConfig, a as AuthResponse, U as User, S as Session } from './types-D3s9oE-5.js';
|
|
24
|
+
export { b as UserRole } from './types-D3s9oE-5.js';
|
|
23
25
|
|
|
24
26
|
declare function useSessionCookieName(): string;
|
|
25
27
|
|
|
26
28
|
declare function useTranslator(namespace?: string): (key: string, params?: Record<string, string | number>) => string;
|
|
27
29
|
|
|
28
|
-
type UIConfig = {
|
|
29
|
-
logo: React.ReactNode;
|
|
30
|
-
name: React.ReactNode;
|
|
31
|
-
logoImage?: string;
|
|
32
|
-
};
|
|
33
|
-
type FeaturesConfig = {
|
|
34
|
-
enableSignup?: boolean;
|
|
35
|
-
enablePasswordReset?: boolean;
|
|
36
|
-
enableEmailSignup?: boolean;
|
|
37
|
-
enablePhoneSignup?: boolean;
|
|
38
|
-
enableSocialSignup?: boolean;
|
|
39
|
-
socialProviders?: string[];
|
|
40
|
-
};
|
|
41
|
-
type NavigationConfig = {
|
|
42
|
-
locale?: string;
|
|
43
|
-
defaultRedirectUrl?: string;
|
|
44
|
-
onNavigate?: (path: string) => void;
|
|
45
|
-
linkComponent?: React.ComponentType<React.ComponentProps<'a'> & {
|
|
46
|
-
href: string;
|
|
47
|
-
}>;
|
|
48
|
-
links?: {
|
|
49
|
-
signIn?: string;
|
|
50
|
-
signUp?: string;
|
|
51
|
-
forgotPassword?: string;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
type AuthClientConfig = {
|
|
55
|
-
baseURL: string;
|
|
56
|
-
ui: UIConfig;
|
|
57
|
-
features?: FeaturesConfig;
|
|
58
|
-
navigation?: NavigationConfig;
|
|
59
|
-
messages?: Record<string, unknown>;
|
|
60
|
-
cookiePrefix?: string;
|
|
61
|
-
};
|
|
62
|
-
type UserRole = {
|
|
63
|
-
id: string;
|
|
64
|
-
roleId: string;
|
|
65
|
-
code: string;
|
|
66
|
-
name: string;
|
|
67
|
-
description: string;
|
|
68
|
-
};
|
|
69
|
-
type User = {
|
|
70
|
-
id: string;
|
|
71
|
-
tenantId: string;
|
|
72
|
-
fullName: string;
|
|
73
|
-
email: string | null;
|
|
74
|
-
phone: string | null;
|
|
75
|
-
handle: string;
|
|
76
|
-
image: string | null;
|
|
77
|
-
emailVerified: boolean;
|
|
78
|
-
phoneVerified: boolean;
|
|
79
|
-
lastSignInAt: string | null;
|
|
80
|
-
userRoles?: UserRole[];
|
|
81
|
-
};
|
|
82
|
-
type Session = {
|
|
83
|
-
id: string;
|
|
84
|
-
expiresAt: string;
|
|
85
|
-
createdAt?: string;
|
|
86
|
-
userAgent: string | null;
|
|
87
|
-
ip: string | null;
|
|
88
|
-
};
|
|
89
|
-
type AuthResponse = {
|
|
90
|
-
user: User;
|
|
91
|
-
session: Session;
|
|
92
|
-
sessionToken: string;
|
|
93
|
-
sessionExpiresAt: string;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
30
|
type OpenApiHooks = any;
|
|
97
|
-
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Cookie is httpOnly and cannot be read client-side.
|
|
33
|
+
* Use `useSession().isAuthenticated` instead.
|
|
34
|
+
* This function always returns false on client.
|
|
35
|
+
*/
|
|
36
|
+
declare function hasAuthCookie(_cookieName: string): boolean;
|
|
37
|
+
type AuthStatus = 'loading' | 'authenticated' | 'unauthenticated';
|
|
38
|
+
type AuthState = {
|
|
98
39
|
user: User | null;
|
|
99
40
|
session: Session | null;
|
|
100
|
-
|
|
101
|
-
isAuthenticated: boolean;
|
|
41
|
+
status: AuthStatus;
|
|
102
42
|
error: Error | null;
|
|
103
43
|
};
|
|
104
|
-
type SessionContextValue =
|
|
44
|
+
type SessionContextValue = AuthState & {
|
|
45
|
+
isLoading: boolean;
|
|
46
|
+
isAuthenticated: boolean;
|
|
105
47
|
refresh: () => Promise<void>;
|
|
106
48
|
signOut: () => Promise<void>;
|
|
107
49
|
};
|
|
@@ -113,11 +55,23 @@ type ApiContextValue = {
|
|
|
113
55
|
};
|
|
114
56
|
type ConfigContextValue = {
|
|
115
57
|
config: AuthClientConfig;
|
|
58
|
+
cookieName: string;
|
|
116
59
|
t: (key: string, params?: Record<string, string | number>) => string;
|
|
117
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* Get session state including user, session, and auth status.
|
|
63
|
+
* - `status`: 'loading' | 'authenticated' | 'unauthenticated'
|
|
64
|
+
* - `isLoading`: true while fetching session
|
|
65
|
+
* - `isAuthenticated`: true if user and session exist
|
|
66
|
+
*/
|
|
118
67
|
declare function useSession(): SessionContextValue;
|
|
119
68
|
declare function useApi(): ApiContextValue;
|
|
120
69
|
declare function useConfig(): ConfigContextValue;
|
|
70
|
+
/**
|
|
71
|
+
* @deprecated Cookie is httpOnly, can't be checked client-side.
|
|
72
|
+
* Use `useSession().isAuthenticated` instead.
|
|
73
|
+
*/
|
|
74
|
+
declare function useHasAuthCookie(): boolean;
|
|
121
75
|
type MesobAuthProviderProps = {
|
|
122
76
|
config: AuthClientConfig;
|
|
123
77
|
children: ReactNode;
|
|
@@ -128,4 +82,4 @@ declare const getSessionCookieName: (config: AuthClientConfig) => string;
|
|
|
128
82
|
|
|
129
83
|
declare function normalizePhone(phone: string): string;
|
|
130
84
|
|
|
131
|
-
export {
|
|
85
|
+
export { AuthClientConfig, AuthResponse, type AuthStatus, MesobAuthProvider, Session, User, getSessionCookieName, hasAuthCookie, normalizePhone, useApi, useConfig, useHasAuthCookie, useHasAuthCookie as useIsAuthenticated, useSession, useSessionCookieName, useTranslator };
|