UNPKG

analytica-frontend-lib

Version:

Repositório público dos componentes utilizados nas plataformas da Analytica Ensino

54 lines 1.99 kB
import type { MyDataResponse } from '../types/user'; /** * API client interface for user store */ export interface UserStoreApiClient { get: <T>(url: string) => Promise<{ data: T; }>; } /** * Configuration for creating a user store */ export interface CreateUserStoreConfig { apiClient: UserStoreApiClient; storageKey?: string; cacheTTL?: number; } /** * Cache state for user data */ interface UserDataCache { data: MyDataResponse | null; cachedUserId: string | null; lastFetched: number | null; isLoading: boolean; error: string | null; } /** * User store state interface */ export interface UserStoreState extends UserDataCache { fetchUserData: (force?: boolean) => Promise<void>; clearUserData: () => void; setLoading: (loading: boolean) => void; setError: (error: string | null) => void; } /** * Factory function to create a user store with dependency injection */ export declare function createUserStore(config: CreateUserStoreConfig): import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<UserStoreState>, "setState" | "persist"> & { setState(partial: UserStoreState | Partial<UserStoreState> | ((state: UserStoreState) => UserStoreState | Partial<UserStoreState>), replace?: false | undefined): unknown; setState(state: UserStoreState | ((state: UserStoreState) => UserStoreState), replace: true): unknown; persist: { setOptions: (options: Partial<import("zustand/middleware").PersistOptions<UserStoreState, unknown, unknown>>) => void; clearStorage: () => void; rehydrate: () => Promise<void> | void; hasHydrated: () => boolean; onHydrate: (fn: (state: UserStoreState) => void) => () => void; onFinishHydration: (fn: (state: UserStoreState) => void) => () => void; getOptions: () => Partial<import("zustand/middleware").PersistOptions<UserStoreState, unknown, unknown>>; }; }>; export {}; //# sourceMappingURL=userStore.d.ts.map