import Client from './client'; /** * Interface representing a promise executor used in a promise. */ export interface PromiseExecutor { resolve: (value: any) => void; reject: (error: any) => void; } /** * Handles communication with the Safari extension using JSON-RPC over custom events. */ export declare class SafariClient implements Client { private keepAliveInterval; private promiseExecutors; private lastPing; private lastPong; private safariExtensionEnabled; private subscribedTransferActivity; /** * Initializes the SafariExtensionHandler instance. * Sets up the promise executor map and starts listening to extension events. */ constructor(); /** * Sends a JSON-RPC request to the Safari extension. * @param method The method name to invoke on the extension. * @param payload Optional payload for the request. * @returns A Promise that resolves with the response from the extension. */ request: (method: string, payload?: any) => Promise; /** * Monitors transfer activity. * @returns A Promise that resolves with the response from the extension. */ monitorTransferActivity(): Promise; /** * Builds a JSON-RPC request object with a unique identifier. * @param method The method name to invoke on the extension. * @param payload Optional parameters for the method. * @returns The constructed JSON-RPC request object. */ private buildRPCRequest; /** * Dispatches a custom event to the document to communicate with the Safari extension. * @param type The type of Safari extension event to dispatch. * @param request Optional JSON-RPC request payload to send with the event. */ private dispatchEvent; /** * Dispatches a custom event to the document to communicate with the Safari extension. * @param type The type of Safari extension event to dispatch. * @param method The method name to invoke on the extension. * @param payload Optional parameters for the method. */ private dispatchPromiseEvent; /** * Handles incoming JSON-RPC responses from the Safari extension. * Resolves or rejects promises based on the response. * @param response The JSON-RPC response object received from the extension. */ private handleResponse; /** * Listens for 'AsperaDesktop.Response' events. */ private listenResponseEvents; /** * Listens for 'AsperaDesktop.TransferActivity' events. */ private listenTransferActivityEvents; /** * Listens for 'AsperaDesktop.Status' events. */ private listenStatusEvents; /** * Listens for 'isAppAlive' events. This was introduced in version 1.0.9. */ private listenClientStatusEvents; /** * Listens for 'AsperaDesktop.Pong' events. */ private listenPongEvents; /** * Sends a keep alive ping according to the defined interval. */ private keepAlive; /** * Listens for Safari extension status changes. * If the extension was disabled and enabled again after initializing the SDK, it * will call 'monitorTransferActivity' to resume transfer activities. */ private safariExtensionStatusChanged; /** * Checks if the last pong received was longer than the max interval. */ private checkSafariExtensionStatus; } export declare const safariClient: SafariClient; declare const _default: { safariClient: SafariClient; }; export default _default;