import { Claims } from "../Dto"; /** * Enum-like type defining the actions that can be broadcasted. * * @ignore * @category SDK * @subcategory Internal */ type Action = "sessionExpired" | "sessionCreated" | "requestLeadership"; /** * Interface representing the data structure of a channel event. * * @interface * @property {Action} action - The type of action being broadcasted. * @property {Claims=} claims - Optional claims associated with the event. * @property {boolean=} is_valid - Optional indication of the session validity. * @category SDK * @subcategory Internal */ export interface BroadcastMessage { action: Action; claims?: Claims; is_valid?: boolean; } /** * Callback type for handling broadcast messages. * * @ignore */ type Callback = (msg: BroadcastMessage) => void; /** * Manages inter-tab communication using the BroadcastChannel API. * * @category SDK * @subcategory Internal * @param {string} channelName - The name of the broadcast channel. * @param {Callback} onSessionExpired - Callback invoked when the session has expired. * @param {Callback} onSessionCreated - Callback invoked when a session is created. * @param {Callback} onLeadershipRequested - Callback invoked when a leadership request is received. */ export declare class SessionChannel { channel: BroadcastChannel; onSessionExpired: Callback; onSessionCreated: Callback; onLeadershipRequested: Callback; constructor(channelName: string, onSessionExpired: Callback, onSessionCreated: Callback, onLeadershipRequested: Callback); /** * Sends a message via the broadcast channel to inform other tabs of session changes. * * @param {BroadcastMessage} msg - The messsage to broadcast. */ post(msg: BroadcastMessage): void; /** * Handles incoming messages from the broadcast channel. * * @param {MessageEvent} event - The message event containing the broadcast data. * @private */ private handleMessage; } export {};