import type { UserWithToken } from '../types.js'; export declare const TAB_SESSION_EVENT_TYPES: { readonly EXPIRED: "session-expired"; readonly LOGGED_OUT: "session-logged-out"; readonly REFRESHED: "session-refreshed"; }; export type TabSessionEventType = (typeof TAB_SESSION_EVENT_TYPES)[keyof typeof TAB_SESSION_EVENT_TYPES]; export type TabSessionMessage = { expiredTokenAt: number; sentAt: number; sourceTabID: string; type: typeof TAB_SESSION_EVENT_TYPES.EXPIRED; } | { refreshStartedAt: number; sentAt: number; session: UserWithToken; sourceTabID: string; type: typeof TAB_SESSION_EVENT_TYPES.REFRESHED; } | { sentAt: number; sourceTabID: string; type: typeof TAB_SESSION_EVENT_TYPES.LOGGED_OUT; }; export type TabSessionEvent = { expiredTokenAt: number; type: typeof TAB_SESSION_EVENT_TYPES.EXPIRED; } | { refreshStartedAt: number; session: UserWithToken; type: typeof TAB_SESSION_EVENT_TYPES.REFRESHED; } | { type: typeof TAB_SESSION_EVENT_TYPES.LOGGED_OUT; }; export type TabSessionReconciliationOptions = { isTabSessionEventStale: () => boolean; }; export type TabSessionReconciliationResult = { expirationMs: number; status: 'authenticated'; user: T; } | { status: 'indeterminate'; } | { status: 'unauthenticated'; }; export type CreateTabSessionSyncArgs = { getTokenExpirationMs: () => number | undefined; now?: () => number; onSessionExpired: (expiredTokenAt: number) => void; onSessionLoggedOut: () => void; onSessionRefreshed: (session: UserWithToken) => void; onTabSessionUnauthenticated: () => void; reconcileSession: (options: TabSessionReconciliationOptions) => Promise; sourceTabID: string; }; export type TabSessionPublication = { affectedExpirationMs: 0; sentAt: number; sourceTabID: string; type: typeof TAB_SESSION_EVENT_TYPES.LOGGED_OUT; } | { affectedExpirationMs: number; refreshStartedAt: number; sentAt: number; sourceTabID: string; type: typeof TAB_SESSION_EVENT_TYPES.REFRESHED; } | { affectedExpirationMs: number; sentAt: number; sourceTabID: string; type: typeof TAB_SESSION_EVENT_TYPES.EXPIRED; }; export type TabSessionLogoutPublication = Extract; export type TabSessionLifecycleOrder = TabSessionPublication; export type TabSessionStorageNotification = { isBroadcastChannelFallback?: true; } & (({ settlesSentAt: number; } & TabSessionLogoutPublication) | Extract | Extract); export type WriteStorageNotification = (args: { notification: TabSessionStorageNotification; }) => void; export type OnExpiredSession = (args: { lifecycleOrder: TabSessionLifecycleOrder; message: Extract; }) => void; export type OnLoggedOutSession = (args: { lifecycleOrder: TabSessionLifecycleOrder; }) => void; export type OnRefreshedSession = (args: { lifecycleOrder: TabSessionLifecycleOrder; message: Extract; }) => void; export type ReconcileStorageSession = (args: { notification: TabSessionStorageNotification; }) => void; //# sourceMappingURL=types.d.ts.map