/// <reference types="node" />
import MessageChannel from '../common/channelproviders/MessageChannel';
import { ParamsBase, ProviderInfoBase } from '../common/channelproviders/MessagingConfig';
import MessageServiceState from '../enums/MessageServiceState';
import EventEmitter from 'events';
export interface InitializeApplicationOptions {
    messageServiceUrl?: string;
    /**
     * Set to true to bypass localStorage check.
     */
    force?: boolean;
}
interface InitializeResponse {
    machineid: string;
}
/**
 * This class is a bit shady since it primarily exists because of testing. An alternative might be a poor man's
 * version of dependency injection where our reconnecter friend is passed in as a constructor argument.
 */
export declare class Reconnecter {
    private readonly _messageService;
    private readonly _maxReconnectAttempts;
    private readonly _maxReconnectDelayMilliseconds;
    constructor(messageService: MessageService, maxReconnectAttempts: number, maxReconnectDelayMilliseconds: number);
    beginReconnectLoop(): Promise<void>;
}
/**
 * Class responsible for all direct interactions with app.
 */
export declare class MessageService extends EventEmitter {
    private _state;
    private _provider;
    private _messageChannel;
    private _initPromise;
    private _initializeApplicationOptions;
    private readonly _maxReconnectAttempts;
    private readonly _maxReconnectDelayMilliseconds;
    private _force;
    constructor(maxReconnectAttempts: number, maxReconnectDelayMilliseconds: number);
    private getMessageChannelFactory;
    private fetchMessageChannel;
    get state(): MessageServiceState;
    updateState(newState: MessageServiceState): void;
    get messageChannel(): MessageChannel<ParamsBase<ProviderInfoBase>>;
    private createMessageServiceUrl;
    private manipulateAppMessageSettings;
    setSessionActive(appData: any): void;
    private waitForActiveSession;
    private setupAppRegistration;
    private listenForReconnectTrigger;
    private setupAppRegistrationOrTimeout;
    private doInitialization;
    /**
     * When a launch happens successfully for the first time after the force flag is used we add a
     * SigniantAppInstalled local storage record which tells us that the app has successfully launched once
     * on this machine which in turn implies that the App has been installed.
     *
     * Technically a user can use the SDK once and then uninstall the app, so we are left in an inconsistent state
     * but the expectation is this situation should be rare.
     *
     * @private
     */
    private isAppMarkedAsInstalled;
    /**
     * This slightly weird structure is to protect the message service from multiple
     * concurrent initialization attempts while it is initializing. This way multiple callers can wait
     * for the initialization to complete without triggering multiple competing initializations.
     */
    initializeApplication(initializeApplicationOptions?: InitializeApplicationOptions): Promise<void | InitializeResponse>;
}
declare const _default: MessageService;
export default _default;
//# sourceMappingURL=messageService.d.ts.map