import { Socket } from 'socket.io-client'; import { InitConfig, OnlineQueueStatus } from './types'; interface ConnectionState { socket: Socket | null; popupEl: HTMLElement | null; isNavigating: boolean; storageTokenKey: string | null; storageConnectKey: string | null; queueStatus: { position: number; status: OnlineQueueStatus; uuid: string; } | null; wsUrl: string | null; apiUrl: string | null; socketConfig: InitConfig['socketConfig'] | null; } declare class ConnectionJQueueSdkWeb { private static readonly CONFIG; private static state; private static ttlInterval; private static statusListeners; private static log; private static injectStyles; private static createPopup; private static removePopup; private static toggleNavigation; private static sendLeaveRequest; private static getDefaultPopupContent; private static getLoadingPopupContent; private static getAdjustedPollInterval; private static clearInterval; private static reloadPage; private static startStatusEmission; private static startCheckDisconnectedEmission; private static updateQueueStatus; private static handleStatusUpdate; private static setupSocket; /** * Adds a listener for queue status updates. * @param listener Callback function to receive status updates. */ static addStatusListener(listener: (status: NonNullable) => void): void; /** * Removes a queue status listener. * @param listener Callback function to remove. */ static removeStatusListener(listener: (status: NonNullable) => void): void; /** * Gets the current queue status. * @returns Current queue status or null if not initialized. */ static getQueueStatus(): ConnectionState['queueStatus']; /** * Initializes the J-Queue SDK with the provided configuration. * @param config Configuration for the SDK. * @returns Promise resolving to an object with a disconnect method. */ static init({ wsUrl, apiUrl, socketConfig, popupConfig, customEvents, option, }: InitConfig): Promise<{ disconnect: () => void; }>; private static cleanup; private static disconnect; /** * Initializes the SDK using attributes from the script tag. * Automatically called when the script is loaded with data-* attributes. * Supported attributes: * - data-ws-url: WebSocket URL (optional; if not provided, determined by data-mode). * - data-mode: Environment mode ('dev' or 'prod'; optional, defaults to 'prod'). * - data-api-url: API URL for queue operations. * - data-storage-token-key: sessionStorage key for queue token. * - data-storage-connect-key: sessionStorage key for connect key. * - data-connect-key: Connect key for socket query. * - data-show-loading: Show loading popup on connect ('true'/'false'). * - data-language: Language for popup ('en'/'ko'). * - data-storage-language-key: Language for popup ('en'/'ko'). * - data-text-color: Text color for popup. * - data-loader-gradient-start: Starting color for the loader gradient. * - data-loader-gradient-end: Ending color for the loader gradient. */ static initFromScriptAttributes(): void; } declare global { interface Window { ConnectionJQueueSdkWeb?: typeof ConnectionJQueueSdkWeb; } } export default ConnectionJQueueSdkWeb; export type { InitConfig, OnlineQueueStatus, PopupConfig } from './types';