/** * Return value of the useInactivityWarning hook * * @example * const { isWarningActive, countdownSeconds, dismissWarning, extendSession } = useInactivityWarning(config); */ export interface UseInactivityWarningReturn { /** Whether the warning dialog should be displayed */ isWarningActive: boolean; /** Remaining seconds before session timeout (when warning is active) */ countdownSeconds: number; /** * Hides the warning dialog without resetting the inactivity timer. * The session will still expire at the original scheduled time. * Call {@link extendSession} to actually reset the timer and keep the session alive. */ dismissWarning: () => void; /** Extend the session and hide the warning */ extendSession: () => void; } /** * Configuration for the useInactivityWarning hook * * @example * { * timeoutMinutes: 30, * warningSeconds: 60, * onTimeout: async () => { await LoginService.Logout(); } * } */ export interface InactivityWarningConfig { /** Total inactivity timeout in minutes before the session is terminated. Defaults to 60. */ timeoutMinutes?: number; /** How many seconds before timeout to show the warning dialog. Defaults to 300 (5 minutes). */ warningSeconds?: number; /** Called when the inactivity timeout expires. Should handle logout and navigation. */ onTimeout: () => void | Promise; } /** * Hook to track user inactivity and show a warning before session timeout. * Listens to user activity events (mouse, keyboard, scroll, touch, click, visibilitychange) and resets the inactivity timer. * Shows a countdown warning before the session expires. * * The hook automatically calls the `onTimeout` callback when the countdown reaches zero, * allowing the parent component to handle logout and navigation. * * @remarks * The `onTimeout` callback should be wrapped in {@link useCallback} to remain stable * and prevent spurious timer resets when the callback reference changes. * * @param config - Configuration object with timeout settings and callback * @returns Object with warning state, countdown, and control functions * @throws {ReactSharedError} If `warningSeconds >= timeoutSeconds` at call time * * @example * const { isWarningActive, countdownSeconds, dismissWarning, extendSession } = useInactivityWarning({ * timeoutMinutes: 30, * warningSeconds: 60, * onTimeout: async () => { * await LoginService.Logout(); * navigate('/login'); * }, * }); */ export declare const useInactivityWarning: (config: InactivityWarningConfig) => UseInactivityWarningReturn; //# sourceMappingURL=useInactivityWarning.d.ts.map