@twilio/flex-ui
Version:
Twilio Flex UI
46 lines (45 loc) • 1.72 kB
TypeScript
import { SyncClient } from "twilio-sync";
interface ValidateArgs {
syncClient: SyncClient;
workerSid: string;
handleOtherSessionDetected: Function;
handleCurrentSessionInvalidated: Function;
handleOtherSessionsInvalidated: Function;
handleCurrentSessionValidated: Function;
}
declare class SingleSessionGuard {
private client;
private record;
private interval?;
private localTabValidationTimeout?;
private callbacks;
private _broadcastChannel;
private initialized;
private DOCUMENT_NAME;
initialLocationParams: string;
get broadcastChannel(): BroadcastChannel;
initAndValidate({ syncClient, workerSid, handleOtherSessionDetected, handleCurrentSessionInvalidated, handleCurrentSessionValidated, handleOtherSessionsInvalidated }: ValidateArgs): Promise<void>;
private fetchDocument;
private getRemoteDocumentValue;
private validate;
isCurrentSession: (sessionId: string) => boolean;
invalidateOtherSessions: () => Promise<void>;
private handleCurrentSessionValidated;
private handleOtherSessionDetected;
updateRecordIsOnCall(onACall: boolean): void;
shutdown(soft?: boolean): void;
refreshPageWithInitialParams: () => void;
private listenForOtherSessionsTakingOver;
private getDeviceSid;
private approveSession;
private updateRecord;
private onOtherTabsMessagesWhenLoading;
private checkForLocalInstances;
private onOtherTabsMessages;
private getServerTime;
private isRecordOutdated;
private postLocalInstanceResponse;
}
export declare const singleSessionGuard: SingleSessionGuard;
export declare const _SingleSessionGuardConstructor: typeof SingleSessionGuard;
export {};