analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
75 lines • 2.28 kB
TypeScript
/**
* Interface representing user authentication tokens.
*/
export interface AuthTokens {
token: string;
refreshToken: string;
[key: string]: unknown;
}
/**
* Interface representing a user profile.
*/
export interface UserProfile {
id: string;
name?: string;
email?: string;
[key: string]: unknown;
}
/**
* Interface representing a user.
*/
export interface User {
id: string;
name?: string;
email?: string;
[key: string]: unknown;
}
/**
* Interface representing session information from the API.
*/
export interface SessionInfo {
sessionId: string;
userId: string;
profileId: string;
institutionId: string;
schoolId: string;
schoolYearId: string;
classId: string;
subjects: string[];
schools: string[];
[key: string]: unknown;
}
/**
* Interface defining the authentication state.
*/
export interface AuthState {
user: User | null;
tokens: AuthTokens | null;
isAuthenticated: boolean;
profiles: UserProfile[];
selectedProfile: UserProfile | null;
sessionInfo: SessionInfo | null;
setUser: (user: User | null) => void;
setTokens: (tokens: AuthTokens | null) => void;
setProfiles: (profiles: UserProfile[]) => void;
setSelectedProfile: (profile: UserProfile | null) => void;
setSessionInfo: (sessionInfo: SessionInfo | null) => void;
signIn: (user: User, tokens: AuthTokens, profiles: UserProfile[]) => void;
signOut: () => void;
updateUserSession: (sessionData: Partial<User>) => void;
}
/**
* Zustand store for managing authentication state with persistence.
*/
export declare const useAuthStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<AuthState>, "persist"> & {
persist: {
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<AuthState, unknown>>) => void;
clearStorage: () => void;
rehydrate: () => Promise<void> | void;
hasHydrated: () => boolean;
onHydrate: (fn: (state: AuthState) => void) => () => void;
onFinishHydration: (fn: (state: AuthState) => void) => () => void;
getOptions: () => Partial<import("zustand/middleware").PersistOptions<AuthState, unknown>>;
};
}>;
//# sourceMappingURL=authStore.d.ts.map