analytica-frontend-lib 1.0.68 → 1.0.70
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/Auth/index.d.mts +218 -0
- package/dist/Auth/index.d.ts +218 -0
- package/dist/Auth/index.js +190 -0
- package/dist/Auth/index.js.map +1 -0
- package/dist/Auth/index.mjs +166 -0
- package/dist/Auth/index.mjs.map +1 -0
- package/dist/Tab/index.d.mts +37 -0
- package/dist/Tab/index.d.ts +37 -0
- package/dist/Tab/index.js +182 -0
- package/dist/Tab/index.js.map +1 -0
- package/dist/Tab/index.mjs +161 -0
- package/dist/Tab/index.mjs.map +1 -0
- package/dist/index.css +87 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +316 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +314 -1
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +87 -0
- package/dist/styles.css.map +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode, ComponentType } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Interface básica para tokens de autenticação
|
|
6
|
+
*/
|
|
7
|
+
interface AuthTokens {
|
|
8
|
+
token: string;
|
|
9
|
+
refreshToken: string;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Interface básica para usuário
|
|
14
|
+
*/
|
|
15
|
+
interface AuthUser {
|
|
16
|
+
id: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
email?: string;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Interface básica para informações de sessão
|
|
23
|
+
*/
|
|
24
|
+
interface SessionInfo {
|
|
25
|
+
institutionId?: string;
|
|
26
|
+
profileId?: string;
|
|
27
|
+
schoolId?: string;
|
|
28
|
+
schoolYearId?: string;
|
|
29
|
+
classId?: string;
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Interface para o estado de autenticação
|
|
34
|
+
*/
|
|
35
|
+
interface AuthState {
|
|
36
|
+
isAuthenticated: boolean;
|
|
37
|
+
isLoading: boolean;
|
|
38
|
+
user?: AuthUser | null;
|
|
39
|
+
sessionInfo?: SessionInfo | null;
|
|
40
|
+
tokens?: AuthTokens | null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Interface para as funções de autenticação
|
|
44
|
+
*/
|
|
45
|
+
interface AuthContextType extends AuthState {
|
|
46
|
+
checkAuth: () => Promise<boolean>;
|
|
47
|
+
signOut: () => void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Props do AuthProvider
|
|
51
|
+
*/
|
|
52
|
+
interface AuthProviderProps {
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
/**
|
|
55
|
+
* Função para verificar se o usuário está autenticado
|
|
56
|
+
* Deve retornar uma Promise<boolean>
|
|
57
|
+
*/
|
|
58
|
+
checkAuthFn?: () => Promise<boolean> | boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Função para fazer logout
|
|
61
|
+
*/
|
|
62
|
+
signOutFn?: () => void;
|
|
63
|
+
/**
|
|
64
|
+
* Estado de autenticação inicial
|
|
65
|
+
*/
|
|
66
|
+
initialAuthState?: Partial<AuthState>;
|
|
67
|
+
/**
|
|
68
|
+
* Função para obter dados do usuário (opcional)
|
|
69
|
+
*/
|
|
70
|
+
getUserFn?: () => AuthUser | null | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Função para obter informações da sessão (opcional)
|
|
73
|
+
*/
|
|
74
|
+
getSessionFn?: () => SessionInfo | null | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Função para obter tokens (opcional)
|
|
77
|
+
*/
|
|
78
|
+
getTokensFn?: () => AuthTokens | null | undefined;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Provider de autenticação que gerencia o estado global de auth
|
|
82
|
+
* Compatível com qualquer store (Zustand, Redux, Context, etc.)
|
|
83
|
+
*/
|
|
84
|
+
declare const AuthProvider: ({ children, checkAuthFn, signOutFn, initialAuthState, getUserFn, getSessionFn, getTokensFn, }: AuthProviderProps) => react_jsx_runtime.JSX.Element;
|
|
85
|
+
/**
|
|
86
|
+
* Hook para usar o contexto de autenticação
|
|
87
|
+
*/
|
|
88
|
+
declare const useAuth: () => AuthContextType;
|
|
89
|
+
/**
|
|
90
|
+
* Props do ProtectedRoute
|
|
91
|
+
*/
|
|
92
|
+
interface ProtectedRouteProps {
|
|
93
|
+
children: ReactNode;
|
|
94
|
+
/**
|
|
95
|
+
* Path para redirecionamento quando não autenticado
|
|
96
|
+
*/
|
|
97
|
+
redirectTo?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Componente de loading personalizado
|
|
100
|
+
*/
|
|
101
|
+
loadingComponent?: ReactNode;
|
|
102
|
+
/**
|
|
103
|
+
* Função adicional de verificação (ex: verificar permissões específicas)
|
|
104
|
+
*/
|
|
105
|
+
additionalCheck?: (authState: AuthState) => boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Componente para proteger rotas que requerem autenticação
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```tsx
|
|
112
|
+
* <ProtectedRoute redirectTo="/login">
|
|
113
|
+
* <PainelPage />
|
|
114
|
+
* </ProtectedRoute>
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
declare const ProtectedRoute: ({ children, redirectTo, loadingComponent, additionalCheck, }: ProtectedRouteProps) => react_jsx_runtime.JSX.Element;
|
|
118
|
+
/**
|
|
119
|
+
* Props do PublicRoute
|
|
120
|
+
*/
|
|
121
|
+
interface PublicRouteProps {
|
|
122
|
+
children: ReactNode;
|
|
123
|
+
/**
|
|
124
|
+
* Path para redirecionamento
|
|
125
|
+
*/
|
|
126
|
+
redirectTo?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Se deve redirecionar quando usuário estiver autenticado
|
|
129
|
+
*/
|
|
130
|
+
redirectIfAuthenticated?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Se deve verificar autenticação antes de renderizar
|
|
133
|
+
*/
|
|
134
|
+
checkAuthBeforeRender?: boolean;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Componente para rotas públicas (login, recuperação de senha, etc.)
|
|
138
|
+
* Opcionalmente redireciona se o usuário já estiver autenticado
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```tsx
|
|
142
|
+
* <PublicRoute redirectTo="/painel" redirectIfAuthenticated={true}>
|
|
143
|
+
* <LoginPage />
|
|
144
|
+
* </PublicRoute>
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
declare const PublicRoute: ({ children, redirectTo, redirectIfAuthenticated, checkAuthBeforeRender, }: PublicRouteProps) => react_jsx_runtime.JSX.Element;
|
|
148
|
+
/**
|
|
149
|
+
* HOC para proteger componentes com autenticação
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```tsx
|
|
153
|
+
* const ProtectedComponent = withAuth(MyComponent, {
|
|
154
|
+
* fallback: "/login",
|
|
155
|
+
* loadingComponent: <CustomSpinner />
|
|
156
|
+
* });
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
declare const withAuth: <P extends object>(Component: ComponentType<P>, options?: Omit<ProtectedRouteProps, "children">) => (props: P) => react_jsx_runtime.JSX.Element;
|
|
160
|
+
/**
|
|
161
|
+
* Hook para guard de autenticação com verificações customizadas
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```tsx
|
|
165
|
+
* const { canAccess, isLoading } = useAuthGuard({
|
|
166
|
+
* requireAuth: true,
|
|
167
|
+
* customCheck: (user) => user?.role === 'admin'
|
|
168
|
+
* });
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
declare const useAuthGuard: (options?: {
|
|
172
|
+
requireAuth?: boolean;
|
|
173
|
+
customCheck?: (authState: AuthState) => boolean;
|
|
174
|
+
}) => {
|
|
175
|
+
canAccess: boolean;
|
|
176
|
+
isLoading: boolean;
|
|
177
|
+
authState: AuthContextType;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Hook para verificar autenticação em rotas específicas
|
|
181
|
+
* Útil para verificações condicionais dentro de componentes
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```tsx
|
|
185
|
+
* const { isAuthenticated, redirectToLogin } = useRouteAuth();
|
|
186
|
+
*
|
|
187
|
+
* if (!isAuthenticated) {
|
|
188
|
+
* return redirectToLogin();
|
|
189
|
+
* }
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
declare const useRouteAuth: (fallbackPath?: string) => {
|
|
193
|
+
isAuthenticated: boolean;
|
|
194
|
+
isLoading: boolean;
|
|
195
|
+
redirectToLogin: () => react_jsx_runtime.JSX.Element;
|
|
196
|
+
};
|
|
197
|
+
declare const _default: {
|
|
198
|
+
AuthProvider: ({ children, checkAuthFn, signOutFn, initialAuthState, getUserFn, getSessionFn, getTokensFn, }: AuthProviderProps) => react_jsx_runtime.JSX.Element;
|
|
199
|
+
ProtectedRoute: ({ children, redirectTo, loadingComponent, additionalCheck, }: ProtectedRouteProps) => react_jsx_runtime.JSX.Element;
|
|
200
|
+
PublicRoute: ({ children, redirectTo, redirectIfAuthenticated, checkAuthBeforeRender, }: PublicRouteProps) => react_jsx_runtime.JSX.Element;
|
|
201
|
+
withAuth: <P extends object>(Component: ComponentType<P>, options?: Omit<ProtectedRouteProps, "children">) => (props: P) => react_jsx_runtime.JSX.Element;
|
|
202
|
+
useAuth: () => AuthContextType;
|
|
203
|
+
useAuthGuard: (options?: {
|
|
204
|
+
requireAuth?: boolean;
|
|
205
|
+
customCheck?: (authState: AuthState) => boolean;
|
|
206
|
+
}) => {
|
|
207
|
+
canAccess: boolean;
|
|
208
|
+
isLoading: boolean;
|
|
209
|
+
authState: AuthContextType;
|
|
210
|
+
};
|
|
211
|
+
useRouteAuth: (fallbackPath?: string) => {
|
|
212
|
+
isAuthenticated: boolean;
|
|
213
|
+
isLoading: boolean;
|
|
214
|
+
redirectToLogin: () => react_jsx_runtime.JSX.Element;
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export { type AuthContextType, AuthProvider, type AuthProviderProps, type AuthState, type AuthTokens, type AuthUser, ProtectedRoute, type ProtectedRouteProps, PublicRoute, type PublicRouteProps, type SessionInfo, _default as default, useAuth, useAuthGuard, useRouteAuth, withAuth };
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode, ComponentType } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Interface básica para tokens de autenticação
|
|
6
|
+
*/
|
|
7
|
+
interface AuthTokens {
|
|
8
|
+
token: string;
|
|
9
|
+
refreshToken: string;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Interface básica para usuário
|
|
14
|
+
*/
|
|
15
|
+
interface AuthUser {
|
|
16
|
+
id: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
email?: string;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Interface básica para informações de sessão
|
|
23
|
+
*/
|
|
24
|
+
interface SessionInfo {
|
|
25
|
+
institutionId?: string;
|
|
26
|
+
profileId?: string;
|
|
27
|
+
schoolId?: string;
|
|
28
|
+
schoolYearId?: string;
|
|
29
|
+
classId?: string;
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Interface para o estado de autenticação
|
|
34
|
+
*/
|
|
35
|
+
interface AuthState {
|
|
36
|
+
isAuthenticated: boolean;
|
|
37
|
+
isLoading: boolean;
|
|
38
|
+
user?: AuthUser | null;
|
|
39
|
+
sessionInfo?: SessionInfo | null;
|
|
40
|
+
tokens?: AuthTokens | null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Interface para as funções de autenticação
|
|
44
|
+
*/
|
|
45
|
+
interface AuthContextType extends AuthState {
|
|
46
|
+
checkAuth: () => Promise<boolean>;
|
|
47
|
+
signOut: () => void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Props do AuthProvider
|
|
51
|
+
*/
|
|
52
|
+
interface AuthProviderProps {
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
/**
|
|
55
|
+
* Função para verificar se o usuário está autenticado
|
|
56
|
+
* Deve retornar uma Promise<boolean>
|
|
57
|
+
*/
|
|
58
|
+
checkAuthFn?: () => Promise<boolean> | boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Função para fazer logout
|
|
61
|
+
*/
|
|
62
|
+
signOutFn?: () => void;
|
|
63
|
+
/**
|
|
64
|
+
* Estado de autenticação inicial
|
|
65
|
+
*/
|
|
66
|
+
initialAuthState?: Partial<AuthState>;
|
|
67
|
+
/**
|
|
68
|
+
* Função para obter dados do usuário (opcional)
|
|
69
|
+
*/
|
|
70
|
+
getUserFn?: () => AuthUser | null | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Função para obter informações da sessão (opcional)
|
|
73
|
+
*/
|
|
74
|
+
getSessionFn?: () => SessionInfo | null | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Função para obter tokens (opcional)
|
|
77
|
+
*/
|
|
78
|
+
getTokensFn?: () => AuthTokens | null | undefined;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Provider de autenticação que gerencia o estado global de auth
|
|
82
|
+
* Compatível com qualquer store (Zustand, Redux, Context, etc.)
|
|
83
|
+
*/
|
|
84
|
+
declare const AuthProvider: ({ children, checkAuthFn, signOutFn, initialAuthState, getUserFn, getSessionFn, getTokensFn, }: AuthProviderProps) => react_jsx_runtime.JSX.Element;
|
|
85
|
+
/**
|
|
86
|
+
* Hook para usar o contexto de autenticação
|
|
87
|
+
*/
|
|
88
|
+
declare const useAuth: () => AuthContextType;
|
|
89
|
+
/**
|
|
90
|
+
* Props do ProtectedRoute
|
|
91
|
+
*/
|
|
92
|
+
interface ProtectedRouteProps {
|
|
93
|
+
children: ReactNode;
|
|
94
|
+
/**
|
|
95
|
+
* Path para redirecionamento quando não autenticado
|
|
96
|
+
*/
|
|
97
|
+
redirectTo?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Componente de loading personalizado
|
|
100
|
+
*/
|
|
101
|
+
loadingComponent?: ReactNode;
|
|
102
|
+
/**
|
|
103
|
+
* Função adicional de verificação (ex: verificar permissões específicas)
|
|
104
|
+
*/
|
|
105
|
+
additionalCheck?: (authState: AuthState) => boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Componente para proteger rotas que requerem autenticação
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```tsx
|
|
112
|
+
* <ProtectedRoute redirectTo="/login">
|
|
113
|
+
* <PainelPage />
|
|
114
|
+
* </ProtectedRoute>
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
declare const ProtectedRoute: ({ children, redirectTo, loadingComponent, additionalCheck, }: ProtectedRouteProps) => react_jsx_runtime.JSX.Element;
|
|
118
|
+
/**
|
|
119
|
+
* Props do PublicRoute
|
|
120
|
+
*/
|
|
121
|
+
interface PublicRouteProps {
|
|
122
|
+
children: ReactNode;
|
|
123
|
+
/**
|
|
124
|
+
* Path para redirecionamento
|
|
125
|
+
*/
|
|
126
|
+
redirectTo?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Se deve redirecionar quando usuário estiver autenticado
|
|
129
|
+
*/
|
|
130
|
+
redirectIfAuthenticated?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Se deve verificar autenticação antes de renderizar
|
|
133
|
+
*/
|
|
134
|
+
checkAuthBeforeRender?: boolean;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Componente para rotas públicas (login, recuperação de senha, etc.)
|
|
138
|
+
* Opcionalmente redireciona se o usuário já estiver autenticado
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```tsx
|
|
142
|
+
* <PublicRoute redirectTo="/painel" redirectIfAuthenticated={true}>
|
|
143
|
+
* <LoginPage />
|
|
144
|
+
* </PublicRoute>
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
declare const PublicRoute: ({ children, redirectTo, redirectIfAuthenticated, checkAuthBeforeRender, }: PublicRouteProps) => react_jsx_runtime.JSX.Element;
|
|
148
|
+
/**
|
|
149
|
+
* HOC para proteger componentes com autenticação
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```tsx
|
|
153
|
+
* const ProtectedComponent = withAuth(MyComponent, {
|
|
154
|
+
* fallback: "/login",
|
|
155
|
+
* loadingComponent: <CustomSpinner />
|
|
156
|
+
* });
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
declare const withAuth: <P extends object>(Component: ComponentType<P>, options?: Omit<ProtectedRouteProps, "children">) => (props: P) => react_jsx_runtime.JSX.Element;
|
|
160
|
+
/**
|
|
161
|
+
* Hook para guard de autenticação com verificações customizadas
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```tsx
|
|
165
|
+
* const { canAccess, isLoading } = useAuthGuard({
|
|
166
|
+
* requireAuth: true,
|
|
167
|
+
* customCheck: (user) => user?.role === 'admin'
|
|
168
|
+
* });
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
declare const useAuthGuard: (options?: {
|
|
172
|
+
requireAuth?: boolean;
|
|
173
|
+
customCheck?: (authState: AuthState) => boolean;
|
|
174
|
+
}) => {
|
|
175
|
+
canAccess: boolean;
|
|
176
|
+
isLoading: boolean;
|
|
177
|
+
authState: AuthContextType;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Hook para verificar autenticação em rotas específicas
|
|
181
|
+
* Útil para verificações condicionais dentro de componentes
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```tsx
|
|
185
|
+
* const { isAuthenticated, redirectToLogin } = useRouteAuth();
|
|
186
|
+
*
|
|
187
|
+
* if (!isAuthenticated) {
|
|
188
|
+
* return redirectToLogin();
|
|
189
|
+
* }
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
declare const useRouteAuth: (fallbackPath?: string) => {
|
|
193
|
+
isAuthenticated: boolean;
|
|
194
|
+
isLoading: boolean;
|
|
195
|
+
redirectToLogin: () => react_jsx_runtime.JSX.Element;
|
|
196
|
+
};
|
|
197
|
+
declare const _default: {
|
|
198
|
+
AuthProvider: ({ children, checkAuthFn, signOutFn, initialAuthState, getUserFn, getSessionFn, getTokensFn, }: AuthProviderProps) => react_jsx_runtime.JSX.Element;
|
|
199
|
+
ProtectedRoute: ({ children, redirectTo, loadingComponent, additionalCheck, }: ProtectedRouteProps) => react_jsx_runtime.JSX.Element;
|
|
200
|
+
PublicRoute: ({ children, redirectTo, redirectIfAuthenticated, checkAuthBeforeRender, }: PublicRouteProps) => react_jsx_runtime.JSX.Element;
|
|
201
|
+
withAuth: <P extends object>(Component: ComponentType<P>, options?: Omit<ProtectedRouteProps, "children">) => (props: P) => react_jsx_runtime.JSX.Element;
|
|
202
|
+
useAuth: () => AuthContextType;
|
|
203
|
+
useAuthGuard: (options?: {
|
|
204
|
+
requireAuth?: boolean;
|
|
205
|
+
customCheck?: (authState: AuthState) => boolean;
|
|
206
|
+
}) => {
|
|
207
|
+
canAccess: boolean;
|
|
208
|
+
isLoading: boolean;
|
|
209
|
+
authState: AuthContextType;
|
|
210
|
+
};
|
|
211
|
+
useRouteAuth: (fallbackPath?: string) => {
|
|
212
|
+
isAuthenticated: boolean;
|
|
213
|
+
isLoading: boolean;
|
|
214
|
+
redirectToLogin: () => react_jsx_runtime.JSX.Element;
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export { type AuthContextType, AuthProvider, type AuthProviderProps, type AuthState, type AuthTokens, type AuthUser, ProtectedRoute, type ProtectedRouteProps, PublicRoute, type PublicRouteProps, type SessionInfo, _default as default, useAuth, useAuthGuard, useRouteAuth, withAuth };
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/Auth/Auth.tsx
|
|
21
|
+
var Auth_exports = {};
|
|
22
|
+
__export(Auth_exports, {
|
|
23
|
+
AuthProvider: () => AuthProvider,
|
|
24
|
+
ProtectedRoute: () => ProtectedRoute,
|
|
25
|
+
PublicRoute: () => PublicRoute,
|
|
26
|
+
default: () => Auth_default,
|
|
27
|
+
useAuth: () => useAuth,
|
|
28
|
+
useAuthGuard: () => useAuthGuard,
|
|
29
|
+
useRouteAuth: () => useRouteAuth,
|
|
30
|
+
withAuth: () => withAuth
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(Auth_exports);
|
|
33
|
+
var import_react = require("react");
|
|
34
|
+
var import_react_router_dom = require("react-router-dom");
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var AuthContext = (0, import_react.createContext)(void 0);
|
|
37
|
+
var AuthProvider = ({
|
|
38
|
+
children,
|
|
39
|
+
checkAuthFn,
|
|
40
|
+
signOutFn,
|
|
41
|
+
initialAuthState = {},
|
|
42
|
+
getUserFn,
|
|
43
|
+
getSessionFn,
|
|
44
|
+
getTokensFn
|
|
45
|
+
}) => {
|
|
46
|
+
const [authState, setAuthState] = (0, import_react.useState)({
|
|
47
|
+
isAuthenticated: false,
|
|
48
|
+
isLoading: true,
|
|
49
|
+
...initialAuthState
|
|
50
|
+
});
|
|
51
|
+
const checkAuth = (0, import_react.useCallback)(async () => {
|
|
52
|
+
try {
|
|
53
|
+
setAuthState((prev) => ({ ...prev, isLoading: true }));
|
|
54
|
+
if (!checkAuthFn) {
|
|
55
|
+
setAuthState((prev) => ({
|
|
56
|
+
...prev,
|
|
57
|
+
isAuthenticated: false,
|
|
58
|
+
isLoading: false
|
|
59
|
+
}));
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
const isAuth = await checkAuthFn();
|
|
63
|
+
setAuthState((prev) => ({
|
|
64
|
+
...prev,
|
|
65
|
+
isAuthenticated: isAuth,
|
|
66
|
+
isLoading: false,
|
|
67
|
+
user: getUserFn ? getUserFn() : prev.user,
|
|
68
|
+
sessionInfo: getSessionFn ? getSessionFn() : prev.sessionInfo,
|
|
69
|
+
tokens: getTokensFn ? getTokensFn() : prev.tokens
|
|
70
|
+
}));
|
|
71
|
+
return isAuth;
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.error("Erro ao verificar autentica\xE7\xE3o:", error);
|
|
74
|
+
setAuthState((prev) => ({
|
|
75
|
+
...prev,
|
|
76
|
+
isAuthenticated: false,
|
|
77
|
+
isLoading: false
|
|
78
|
+
}));
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}, [checkAuthFn, getUserFn, getSessionFn, getTokensFn]);
|
|
82
|
+
const signOut = (0, import_react.useCallback)(() => {
|
|
83
|
+
if (signOutFn) {
|
|
84
|
+
signOutFn();
|
|
85
|
+
}
|
|
86
|
+
setAuthState((prev) => ({
|
|
87
|
+
...prev,
|
|
88
|
+
isAuthenticated: false,
|
|
89
|
+
user: void 0,
|
|
90
|
+
sessionInfo: void 0,
|
|
91
|
+
tokens: void 0
|
|
92
|
+
}));
|
|
93
|
+
}, [signOutFn]);
|
|
94
|
+
(0, import_react.useEffect)(() => {
|
|
95
|
+
checkAuth();
|
|
96
|
+
}, [checkAuth]);
|
|
97
|
+
const contextValue = (0, import_react.useMemo)(
|
|
98
|
+
() => ({
|
|
99
|
+
...authState,
|
|
100
|
+
checkAuth,
|
|
101
|
+
signOut
|
|
102
|
+
}),
|
|
103
|
+
[authState, checkAuth, signOut]
|
|
104
|
+
);
|
|
105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AuthContext.Provider, { value: contextValue, children });
|
|
106
|
+
};
|
|
107
|
+
var useAuth = () => {
|
|
108
|
+
const context = (0, import_react.useContext)(AuthContext);
|
|
109
|
+
if (context === void 0) {
|
|
110
|
+
throw new Error("useAuth deve ser usado dentro de um AuthProvider");
|
|
111
|
+
}
|
|
112
|
+
return context;
|
|
113
|
+
};
|
|
114
|
+
var ProtectedRoute = ({
|
|
115
|
+
children,
|
|
116
|
+
redirectTo = "/",
|
|
117
|
+
loadingComponent,
|
|
118
|
+
additionalCheck
|
|
119
|
+
}) => {
|
|
120
|
+
const { isAuthenticated, isLoading, ...authState } = useAuth();
|
|
121
|
+
const defaultLoadingComponent = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-text-950 text-lg", children: "Carregando..." }) });
|
|
122
|
+
if (isLoading) {
|
|
123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: loadingComponent || defaultLoadingComponent });
|
|
124
|
+
}
|
|
125
|
+
if (!isAuthenticated) {
|
|
126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Navigate, { to: redirectTo, replace: true });
|
|
127
|
+
}
|
|
128
|
+
if (additionalCheck && !additionalCheck({ isAuthenticated, isLoading, ...authState })) {
|
|
129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Navigate, { to: redirectTo, replace: true });
|
|
130
|
+
}
|
|
131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
132
|
+
};
|
|
133
|
+
var PublicRoute = ({
|
|
134
|
+
children,
|
|
135
|
+
redirectTo = "/painel",
|
|
136
|
+
redirectIfAuthenticated = false,
|
|
137
|
+
checkAuthBeforeRender = false
|
|
138
|
+
}) => {
|
|
139
|
+
const { isAuthenticated, isLoading } = useAuth();
|
|
140
|
+
if (checkAuthBeforeRender && isLoading) {
|
|
141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-text-950 text-lg", children: "Carregando..." }) });
|
|
142
|
+
}
|
|
143
|
+
if (isAuthenticated && redirectIfAuthenticated) {
|
|
144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Navigate, { to: redirectTo, replace: true });
|
|
145
|
+
}
|
|
146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
147
|
+
};
|
|
148
|
+
var withAuth = (Component, options = {}) => {
|
|
149
|
+
return (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProtectedRoute, { ...options, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...props }) });
|
|
150
|
+
};
|
|
151
|
+
var useAuthGuard = (options = {}) => {
|
|
152
|
+
const authState = useAuth();
|
|
153
|
+
const { requireAuth = true, customCheck } = options;
|
|
154
|
+
const canAccess = !authState.isLoading && (requireAuth ? authState.isAuthenticated && (!customCheck || customCheck(authState)) : !authState.isAuthenticated || !customCheck || customCheck(authState));
|
|
155
|
+
return {
|
|
156
|
+
canAccess,
|
|
157
|
+
isLoading: authState.isLoading,
|
|
158
|
+
authState
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
var useRouteAuth = (fallbackPath = "/") => {
|
|
162
|
+
const { isAuthenticated, isLoading } = useAuth();
|
|
163
|
+
const location = (0, import_react_router_dom.useLocation)();
|
|
164
|
+
const redirectToLogin = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Navigate, { to: fallbackPath, state: { from: location }, replace: true });
|
|
165
|
+
return {
|
|
166
|
+
isAuthenticated,
|
|
167
|
+
isLoading,
|
|
168
|
+
redirectToLogin
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
var Auth_default = {
|
|
172
|
+
AuthProvider,
|
|
173
|
+
ProtectedRoute,
|
|
174
|
+
PublicRoute,
|
|
175
|
+
withAuth,
|
|
176
|
+
useAuth,
|
|
177
|
+
useAuthGuard,
|
|
178
|
+
useRouteAuth
|
|
179
|
+
};
|
|
180
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
181
|
+
0 && (module.exports = {
|
|
182
|
+
AuthProvider,
|
|
183
|
+
ProtectedRoute,
|
|
184
|
+
PublicRoute,
|
|
185
|
+
useAuth,
|
|
186
|
+
useAuthGuard,
|
|
187
|
+
useRouteAuth,
|
|
188
|
+
withAuth
|
|
189
|
+
});
|
|
190
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Auth/Auth.tsx"],"sourcesContent":["import {\n createContext,\n useContext,\n useEffect,\n useState,\n ReactNode,\n ComponentType,\n useCallback,\n useMemo,\n} from 'react';\nimport { useLocation, Navigate } from 'react-router-dom';\n\n/**\n * Interface básica para tokens de autenticação\n */\nexport interface AuthTokens {\n token: string;\n refreshToken: string;\n [key: string]: unknown;\n}\n\n/**\n * Interface básica para usuário\n */\nexport interface AuthUser {\n id: string;\n name?: string;\n email?: string;\n [key: string]: unknown;\n}\n\n/**\n * Interface básica para informações de sessão\n */\nexport interface SessionInfo {\n institutionId?: string;\n profileId?: string;\n schoolId?: string;\n schoolYearId?: string;\n classId?: string;\n [key: string]: unknown;\n}\n\n/**\n * Interface para o estado de autenticação\n */\nexport interface AuthState {\n isAuthenticated: boolean;\n isLoading: boolean;\n user?: AuthUser | null;\n sessionInfo?: SessionInfo | null;\n tokens?: AuthTokens | null;\n}\n\n/**\n * Interface para as funções de autenticação\n */\nexport interface AuthContextType extends AuthState {\n checkAuth: () => Promise<boolean>;\n signOut: () => void;\n}\n\n/**\n * Context de autenticação\n */\nconst AuthContext = createContext<AuthContextType | undefined>(undefined);\n\n/**\n * Props do AuthProvider\n */\nexport interface AuthProviderProps {\n children: ReactNode;\n /**\n * Função para verificar se o usuário está autenticado\n * Deve retornar uma Promise<boolean>\n */\n checkAuthFn?: () => Promise<boolean> | boolean;\n /**\n * Função para fazer logout\n */\n signOutFn?: () => void;\n /**\n * Estado de autenticação inicial\n */\n initialAuthState?: Partial<AuthState>;\n /**\n * Função para obter dados do usuário (opcional)\n */\n getUserFn?: () => AuthUser | null | undefined;\n /**\n * Função para obter informações da sessão (opcional)\n */\n getSessionFn?: () => SessionInfo | null | undefined;\n /**\n * Função para obter tokens (opcional)\n */\n getTokensFn?: () => AuthTokens | null | undefined;\n}\n\n/**\n * Provider de autenticação que gerencia o estado global de auth\n * Compatível com qualquer store (Zustand, Redux, Context, etc.)\n */\nexport const AuthProvider = ({\n children,\n checkAuthFn,\n signOutFn,\n initialAuthState = {},\n getUserFn,\n getSessionFn,\n getTokensFn,\n}: AuthProviderProps) => {\n const [authState, setAuthState] = useState<AuthState>({\n isAuthenticated: false,\n isLoading: true,\n ...initialAuthState,\n });\n\n const checkAuth = useCallback(async (): Promise<boolean> => {\n try {\n setAuthState((prev) => ({ ...prev, isLoading: true }));\n\n // Se não há função de verificação, assume como não autenticado\n if (!checkAuthFn) {\n setAuthState((prev) => ({\n ...prev,\n isAuthenticated: false,\n isLoading: false,\n }));\n return false;\n }\n\n const isAuth = await checkAuthFn();\n\n setAuthState((prev) => ({\n ...prev,\n isAuthenticated: isAuth,\n isLoading: false,\n user: getUserFn ? getUserFn() : prev.user,\n sessionInfo: getSessionFn ? getSessionFn() : prev.sessionInfo,\n tokens: getTokensFn ? getTokensFn() : prev.tokens,\n }));\n\n return isAuth;\n } catch (error) {\n console.error('Erro ao verificar autenticação:', error);\n setAuthState((prev) => ({\n ...prev,\n isAuthenticated: false,\n isLoading: false,\n }));\n return false;\n }\n }, [checkAuthFn, getUserFn, getSessionFn, getTokensFn]);\n\n const signOut = useCallback(() => {\n if (signOutFn) {\n signOutFn();\n }\n setAuthState((prev) => ({\n ...prev,\n isAuthenticated: false,\n user: undefined,\n sessionInfo: undefined,\n tokens: undefined,\n }));\n }, [signOutFn]);\n\n useEffect(() => {\n checkAuth();\n }, [checkAuth]);\n\n const contextValue = useMemo(\n (): AuthContextType => ({\n ...authState,\n checkAuth,\n signOut,\n }),\n [authState, checkAuth, signOut]\n );\n\n return (\n <AuthContext.Provider value={contextValue}>{children}</AuthContext.Provider>\n );\n};\n\n/**\n * Hook para usar o contexto de autenticação\n */\nexport const useAuth = (): AuthContextType => {\n const context = useContext(AuthContext);\n if (context === undefined) {\n throw new Error('useAuth deve ser usado dentro de um AuthProvider');\n }\n return context;\n};\n\n/**\n * Props do ProtectedRoute\n */\nexport interface ProtectedRouteProps {\n children: ReactNode;\n /**\n * Path para redirecionamento quando não autenticado\n */\n redirectTo?: string;\n /**\n * Componente de loading personalizado\n */\n loadingComponent?: ReactNode;\n /**\n * Função adicional de verificação (ex: verificar permissões específicas)\n */\n additionalCheck?: (authState: AuthState) => boolean;\n}\n\n/**\n * Componente para proteger rotas que requerem autenticação\n *\n * @example\n * ```tsx\n * <ProtectedRoute redirectTo=\"/login\">\n * <PainelPage />\n * </ProtectedRoute>\n * ```\n */\nexport const ProtectedRoute = ({\n children,\n redirectTo = '/',\n loadingComponent,\n additionalCheck,\n}: ProtectedRouteProps) => {\n const { isAuthenticated, isLoading, ...authState } = useAuth();\n\n // Componente de loading padrão\n const defaultLoadingComponent = (\n <div className=\"flex items-center justify-center min-h-screen\">\n <div className=\"text-text-950 text-lg\">Carregando...</div>\n </div>\n );\n\n // Mostrar loading enquanto verifica autenticação\n if (isLoading) {\n return <>{loadingComponent || defaultLoadingComponent}</>;\n }\n\n // Verificar autenticação básica\n if (!isAuthenticated) {\n return <Navigate to={redirectTo} replace />;\n }\n\n // Verificação adicional (ex: permissões)\n if (\n additionalCheck &&\n !additionalCheck({ isAuthenticated, isLoading, ...authState })\n ) {\n return <Navigate to={redirectTo} replace />;\n }\n\n return <>{children}</>;\n};\n\n/**\n * Props do PublicRoute\n */\nexport interface PublicRouteProps {\n children: ReactNode;\n /**\n * Path para redirecionamento\n */\n redirectTo?: string;\n /**\n * Se deve redirecionar quando usuário estiver autenticado\n */\n redirectIfAuthenticated?: boolean;\n /**\n * Se deve verificar autenticação antes de renderizar\n */\n checkAuthBeforeRender?: boolean;\n}\n\n/**\n * Componente para rotas públicas (login, recuperação de senha, etc.)\n * Opcionalmente redireciona se o usuário já estiver autenticado\n *\n * @example\n * ```tsx\n * <PublicRoute redirectTo=\"/painel\" redirectIfAuthenticated={true}>\n * <LoginPage />\n * </PublicRoute>\n * ```\n */\nexport const PublicRoute = ({\n children,\n redirectTo = '/painel',\n redirectIfAuthenticated = false,\n checkAuthBeforeRender = false,\n}: PublicRouteProps) => {\n const { isAuthenticated, isLoading } = useAuth();\n\n // Se deve aguardar verificação de auth antes de renderizar\n if (checkAuthBeforeRender && isLoading) {\n return (\n <div className=\"flex items-center justify-center min-h-screen\">\n <div className=\"text-text-950 text-lg\">Carregando...</div>\n </div>\n );\n }\n\n // Redirecionar se já autenticado e configurado para isso\n if (isAuthenticated && redirectIfAuthenticated) {\n return <Navigate to={redirectTo} replace />;\n }\n\n return <>{children}</>;\n};\n\n/**\n * HOC para proteger componentes com autenticação\n *\n * @example\n * ```tsx\n * const ProtectedComponent = withAuth(MyComponent, {\n * fallback: \"/login\",\n * loadingComponent: <CustomSpinner />\n * });\n * ```\n */\nexport const withAuth = <P extends object>(\n Component: ComponentType<P>,\n options: Omit<ProtectedRouteProps, 'children'> = {}\n) => {\n return (props: P) => (\n <ProtectedRoute {...options}>\n <Component {...props} />\n </ProtectedRoute>\n );\n};\n\n/**\n * Hook para guard de autenticação com verificações customizadas\n *\n * @example\n * ```tsx\n * const { canAccess, isLoading } = useAuthGuard({\n * requireAuth: true,\n * customCheck: (user) => user?.role === 'admin'\n * });\n * ```\n */\nexport const useAuthGuard = (\n options: {\n requireAuth?: boolean;\n customCheck?: (authState: AuthState) => boolean;\n } = {}\n) => {\n const authState = useAuth();\n const { requireAuth = true, customCheck } = options;\n\n const canAccess =\n !authState.isLoading &&\n (requireAuth\n ? authState.isAuthenticated && (!customCheck || customCheck(authState))\n : !authState.isAuthenticated || !customCheck || customCheck(authState));\n\n return {\n canAccess,\n isLoading: authState.isLoading,\n authState,\n };\n};\n\n/**\n * Hook para verificar autenticação em rotas específicas\n * Útil para verificações condicionais dentro de componentes\n *\n * @example\n * ```tsx\n * const { isAuthenticated, redirectToLogin } = useRouteAuth();\n *\n * if (!isAuthenticated) {\n * return redirectToLogin();\n * }\n * ```\n */\nexport const useRouteAuth = (fallbackPath = '/') => {\n const { isAuthenticated, isLoading } = useAuth();\n const location = useLocation();\n\n const redirectToLogin = () => (\n <Navigate to={fallbackPath} state={{ from: location }} replace />\n );\n\n return {\n isAuthenticated,\n isLoading,\n redirectToLogin,\n };\n};\n\nexport default {\n AuthProvider,\n ProtectedRoute,\n Publ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