UNPKG

analytica-frontend-lib

Version:

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

42 lines 1.31 kB
/** * API client interface that the hook accepts * Compatible with axios-like clients */ export interface ApiClient { post: <T = unknown>(url: string, data?: unknown) => Promise<{ data: T; }>; get: <T = unknown>(url: string) => Promise<{ data: T; }>; } /** * Options for the useDraftAutoSave hook */ export interface UseDraftAutoSaveOptions { /** The API client (axios instance or similar) */ apiClient: ApiClient; /** Whether draft auto-save is enabled (typically true for ATIVIDADE, false for SIMULADO) */ enabled: boolean; /** Optional: custom endpoint pattern. Default: '/activities/{activityId}/draft' */ endpoint?: string; } /** * Hook that sets up automatic draft saving for the quiz. * * Features: * - Saves draft when navigating between questions (Avançar/Voltar) * - Saves draft when page visibility changes (tab switch, minimize) * - Loads and applies existing drafts when quiz starts * * @example * ```tsx * // In your QuizWrapper component: * useDraftAutoSave({ * apiClient: api, // your axios instance * enabled: quizType === QUIZ_TYPE.ATIVIDADE, * }); * ``` */ export declare function useDraftAutoSave({ apiClient, enabled, endpoint, }: UseDraftAutoSaveOptions): void; //# sourceMappingURL=useDraftAutoSave.d.ts.map