import { Client } from '@xmpp/client';
import { xmppSettingsInterface } from '../types/types';
type HistorySource = 'active' | 'send_ack' | 'background' | 'default';
interface HistoryOptions {
    coalesceRoom?: boolean;
    skipIfPreloaded?: boolean;
    source?: HistorySource;
}
export type XmppCredentialsProvider = () => Promise<{
    username: string;
    password: string;
}>;
export declare class XmppClient {
    client: Client;
    xmppSettings?: xmppSettingsInterface;
    devServer: string | undefined;
    host: string;
    service: string;
    conference: string;
    username: string;
    status: 'offline' | 'connecting' | 'online' | 'error';
    password: string;
    reconnectAttempts: number;
    maxReconnectAttempts: number;
    reconnectDelay: number;
    maxReconnectDelay: number;
    private lastReconnectAt;
    suppressReconnect: boolean;
    private reconnectTimer;
    private reconnecting;
    lastAuthError: 'not-authorized' | null;
    private credentialsProvider;
    private credentialsRefreshInFlight;
    private onOnlineCallback;
    presencesReady: boolean;
    disableLastRead: boolean;
    private activeRoomJID;
    private activeRoomBoostUntil;
    private softPauseUntil;
    private mamInFlightByRoom;
    private maxInFlightHistory;
    private softPauseAfterSendMs;
    private activeRoomBoostTtlMs;
    private alwaysPrioritizeActiveRoom;
    checkOnline(): any;
    /**
     * Inject (or replace) the callback used by reconnect() to fetch fresh
     * XMPP credentials after a `not-authorized` SASL failure. The provider
     * is responsible for refreshing whatever upstream token is needed
     * (REST JWT, /users/client, etc.) and returning the resulting
     * username + password.
     */
    setCredentialsProvider(provider: XmppCredentialsProvider | null): void;
    /** Install a callback invoked on every successful 'online'. The provider
     * uses it to re-join MUC rooms after a reconnect. */
    setOnOnline(cb: (() => void) | null): void;
    /** Swap in fresh credentials before the next reconnect. */
    updateCredentials(username: string, password: string): void;
    constructor(username: string, password: string, xmppSettings?: xmppSettingsInterface | string);
    setActiveRoomJid(roomJID: string | null): void;
    promoteRoomHistory(_roomJID: string): void;
    /**
     * Active-room gate is "open" whenever the boost has expired OR there's
     * room for more concurrent MAM fetches. Scheduler uses this to backoff.
     */
    isActiveRoomGateOpen(): boolean;
    /** Called right before a critical send. Soft-pauses background MAM. */
    onCriticalSend(roomJID: string, _messageId?: string): void;
    /**
     * Higher-priority presence than presenceInRoomStanza. For now just
     * delegates — kept distinct so callers don't change when full priority
     * lanes land later.
     */
    prioritizeRoomPresence(roomJID: string): Promise<boolean>;
    /**
     * Queued history fetch. Coalesces by room: if the same room already has
     * a higher-priority request in flight, return that promise. Honors
     * `skipIfPreloaded` by checking redux state (lazy import to avoid cycle).
     */
    enqueueHistoryTask(params: {
        chatJID: string;
        max: number;
        before?: number;
        id?: string;
        source?: HistorySource;
    }): Promise<any>;
    private sourceRank;
    initializeClient(): void;
    private onDisconnect?;
    private onOnline?;
    private onError?;
    private onStanza?;
    attachEventListeners(): void;
    detachEventListeners(): void;
    /**
     * Resolves once status === 'online' or rejects when status === 'error'.
     * Mirrors the web client's `ensureConnected` helper.
     */
    waitForOnline(timeoutMs?: number): Promise<void>;
    ensureConnected(timeout?: number): Promise<void>;
    scheduleReconnect(): void;
    /**
     * Force an immediate reconnect, resetting the backoff counter. Called
     * by the provider when NetInfo reports the network came back or the app
     * returned to the foreground — we don't want to wait out the existing
     * exponential delay (or a maxed-out attempt count) in those cases.
     */
    forceReconnect(): void;
    reconnect(): Promise<void>;
    /**
     * Single-flight wrapper around credentialsProvider. Multiple concurrent
     * reconnect() calls (e.g. from the provider's reconnect effect firing
     * twice quickly) share one in-flight request and update `this.password`
     * exactly once.
     */
    private refreshCredentialsOnce;
    disconnect(options?: {
        suppressReconnect?: boolean;
    }): Promise<void>;
    close(): Promise<void>;
    getRoomsStanza: () => Promise<void>;
    createRoomStanza(title: string, description: string, to?: string): Promise<string>;
    inviteRoomRequestStanza(to: string, roomJid: string): Promise<void>;
    leaveTheRoomStanza: (roomJID: string) => void;
    presenceInRoomStanza: (roomJID: string) => void;
    getHistoryStanza: (chatJID: string, max: number, before?: number, id?: string, options?: HistoryOptions) => Promise<any>;
    getLastMessageArchiveStanza(roomJID: string): void;
    setRoomImageStanza: (roomJid: string, roomThumbnail: string, type: string, roomBackground?: string) => void;
    getRoomInfoStanza: (roomJID: string) => void;
    getRoomMembersStanza: (roomJID: string) => void;
    /**
     * True when the underlying stream is live enough to actually put a
     * stanza on the wire. Used to gate sends: when false we buffer instead
     * of firing a fire-and-forget stanza into a dead/half-open socket
     * (which is silently dropped and only caught by the 30s watchdog).
     */
    private isStreamReady;
    /** Replay buffered sends against this (now-online) client, in order. */
    flushPendingSends(): void;
    sendMessage: (roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string, customId?: string) => boolean;
    deleteMessageStanza(room: string, msgId: string): void;
    editMessageStanza(room: string, msgId: string, text: string): void;
    sendTypingRequestStanza(chatId: string, fullName: string, start: boolean): void;
    getChatsPrivateStoreRequestStanza: () => Promise<unknown>;
    actionSetTimestampToPrivateStoreStanza(chatId: string, timestamp: number, chats?: string[]): Promise<void>;
    flushLastViewedToPrivateStoreStanza(rooms: Record<string, any> | null | undefined, opts?: {
        visibleRoomJID?: string | null;
        onlyIfNoUnread?: boolean;
    }): Promise<boolean>;
    sendMediaMessageStanza(roomJID: string, data: any, customId?: string): string | undefined;
    setVCardStanza(_xmppUsername: string): void;
    createPrivateRoomStanza(title: string, description: string, to: string): Promise<string>;
    sendMessageReactionStanza(_messageId: string, _roomJid: string, _reactionsList: string[], _reactionSymbol?: string): void;
    sendTextMessageWithTranslateTagStanza(roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string, _langSource?: string, customId?: string): void;
}
export default XmppClient;
//# sourceMappingURL=xmppClient.d.ts.map