/** * @file Session Slice * @description Client-side session state management with DevTools integration * * IMPORTANT: This slice manages client-side session state only. * Authentication tokens and sensitive credentials should NEVER be stored here. * Use secure HTTP-only cookies or dedicated auth solutions for authentication. */ /** * Session state interface */ export interface SessionState { sessionId: string | null; sessionStartedAt: number | null; sessionExpiresAt: number | null; lastActivity: number | null; isSessionActive: boolean; activityTimeoutMs: number; navigationHistory: string[]; maxHistoryLength: number; deviceId: string | null; browserTabId: string | null; } /** * Session actions interface */ export interface SessionActions { /** Initialize a new session with ID and optional configuration */ initSession: (sessionId: string, options?: { expiresInMs?: number; deviceId?: string; }) => void; /** Update last activity timestamp (call on user interaction) */ updateActivity: () => void; /** End the current session and clear session data */ endSession: () => void; /** Check if session has expired (returns true if expired) */ checkSessionExpiry: () => boolean; /** Extend session expiry by additional milliseconds */ extendSession: (additionalMs: number) => void; /** Add a path to navigation history (deduplicates consecutive entries) */ addToHistory: (path: string) => void; /** Remove last occurrence of a path from history */ removeFromHistory: (path: string) => void; /** Clear all navigation history */ clearHistory: () => void; /** Get the last visited path or null if history is empty */ getLastVisitedPath: () => string | null; /** Go back in history, returns the previous path or null */ goBack: () => string | null; /** Set activity timeout duration in milliseconds */ setActivityTimeout: (timeoutMs: number) => void; /** Set maximum navigation history length */ setMaxHistoryLength: (length: number) => void; /** Set the browser tab identifier for cross-tab awareness */ setBrowserTabId: (tabId: string) => void; } /** * Session slice using createSlice factory for automatic DevTools action naming * * All actions are automatically prefixed with "session/" in DevTools, e.g.: * - session/initSession * - session/updateActivity * - session/endSession */ export declare const sessionSlice: import('zustand').StateCreator unknown>, [["zustand/immer", never], ["zustand/devtools", never]], [], SessionState & SessionActions & Record unknown>>; export type SessionSlice = SessionState & SessionActions;