import { AsyncOperationStatusPayload } from '@bringg/types';
import Session from '../Services/Identity/Session';
export declare const UPDATE_ASYNC_OPERATION_REALTIME_EVENT = "async operation status";
type Handler<T> = (payload: AsyncOperationStatusPayload<T>) => unknown;
type AddListenerOptions<TPayload> = AddRegularListenerOptions<TPayload> | AddOnceListenerOptions<TPayload>;
type AddRegularListenerOptions<TPayload> = {
    requestId: string;
    handler: Handler<TPayload>;
    signal: AbortSignal;
    once?: false;
};
type AddOnceListenerOptions<TPayload> = {
    requestId: string;
    handler: Handler<TPayload>;
    signal?: AbortSignal;
    once: true;
};
export declare class AsyncOperationStatus {
    cleanupInterval: number;
    unsubscribe: () => void;
    static UNACKED_MESSAGES_TTL: number;
    private readonly unackedStatusUpdates;
    private readonly listeners;
    private readonly realtimeSubscriptions;
    constructor(session: Session);
    listenToEvent(): void;
    addListener<TPayload>({ requestId, handler, signal, once }: AddListenerOptions<TPayload>): void;
    private _addListener;
    private _once;
    /**
     * This is suitable for cases where the user send a request in HTTP and should get the response in realtime
     */
    waitForResponse<TPayload>({ requestId, signal, timeoutInMs }: {
        requestId: string;
        signal?: AbortSignal;
        timeoutInMs?: number;
    }): Promise<TPayload>;
    cleanupUnackedMessageThatPassedTTL: () => void;
    hasUnackedStatusUpdates(): boolean;
    private unregisterCleanUnackedMessage;
    cleanup(): void;
}
export {};
