import { EventEmitter } from "eventemitter3";
import { ObiClient } from "@obi/obi-client";
import type { Identity } from "@obi/obi-client";
import { Command, CommandType, Config } from "./types";
export declare const PLAN_URL_PARAM = "49206C6F7665204F6269_session";
export declare const STORAGE_KEY = "obi-url-params";
export declare const HEARTBEAT_STORAGE_KEY = "obi-client-heartbeat";
export type ObiSDKEvents = {
    initialised: () => void;
    error: (err: Error) => void;
    showMenu: (showMenu: boolean) => void;
    showSidePanel: (show: boolean) => void;
    preferHostPip: (value: boolean) => void;
    configUpdated: () => void;
    showMessage: (payload: {
        text: string;
        autoCloseMs?: number;
    }) => void;
    startSessionRequested: (options: {
        withMicrophone?: boolean;
        isDeepPlanStart?: boolean;
    }) => void;
};
export type InitialiseArgs = {
    queuedCommands?: Command[];
};
export declare class ObiSDK extends EventEmitter<ObiSDKEvents> {
    client: ObiClient | null;
    isActive: boolean;
    primaryColour: string;
    passivePlanUuid: string | null;
    widgetDisplay?: string;
    completedWidgetDisplay?: string;
    widgetPosition?: string;
    autoOpenPlanUuid: string | null;
    showSidePanel: boolean;
    preferHostPip: boolean;
    skipCourseDialog: boolean;
    tutorBaseUrl: string;
    tutorProductAlias: string;
    /** Obi REST API base URL; `obiWidgetConfig.apiBaseUrl` overrides before ObiClient is constructed. */
    apiBaseUrl: string;
    graphemes?: any;
    commandLog: any[];
    private commandQueue;
    /** HACK: Need to prevent initialisation from being called if resumed. */
    private _resumed;
    private heartbeatInterval;
    private bufferedIdentityPayload;
    private hasCompletedFirstRealInitialise;
    private initialiseInFlight;
    /**
     * Creates a client that should persist for the lifetime of the SDK.
     * Resumes an ongoing session if one exists.
     */
    constructor(appToken?: string);
    private resolveApiBaseUrl;
    hydratePreInitialiseWindowConfig(config?: Partial<Config> & {
        user?: Identity | null;
    }): void;
    createClient(appToken: string): Promise<void>;
    /**
     * Act on server-provided engagement.style when available, respecting stop conditions
     * and URL blacklist gating.
     */
    private _maybeActOnServerEngagement;
    initialise(args?: InitialiseArgs): Promise<void>;
    /**
     * Update the SDK configuration. This is typically called before a plan starts,
     * but it is possible to update the configuration during a plan.
     */
    updateConfig(config: Config): Promise<void>;
    consumeAutoOpenPlanUuid(): string | null;
    updateAppToken(appToken?: string): Promise<void>;
    /**
     * Update the SDK activity state. Activity controls whether the SDK is continuously
     * visible or not.
     * Ignores updates if the active state is undefined or the same as the current active state.
     */
    updateActive(isActive?: boolean): void;
    /**
     * Update the SDK primary colour. This is typically called before a plan starts,
     * but it is possible to update the primary colour during a plan.
     * Ignores updates if the primary colour is undefined or the same as the current primary colour.
     */
    updatePrimaryColour(primaryColour?: string): void;
    updateWidgetDisplay(widgetDisplay?: string): void;
    updateCompletedWidgetDisplay(completedWidgetDisplay?: string): void;
    updateWidgetPosition(widgetPosition?: string): void;
    /**
     * Update the identity of the onboardee. This is typically called before a plan starts,
     * but it is possible to update the identity during a plan.
     * Ignores updates if the identity is undefined or the same as the current identity.
     */
    updateIdentity(identity?: Identity | null): Promise<void>;
    updateShowMenu(showMenu?: boolean): Promise<void>;
    updateShowSidePanel(show: boolean): void;
    /**
     * Say a message to the onboardee.
     */
    say(message: string): Promise<void>;
    /**
     * Start a new session.
     * @param options - Optional configuration including withMicrophone to auto-enable microphone
     */
    startSession(options?: {
        withMicrophone?: boolean;
    }): Promise<void>;
    /**
     * Dispatch all queued commands in the order they were added.
     * TODO: Passing in the planuuid is not cool.
     */
    dispatchCommandQueue(): Promise<void>;
    /**
     * This gets set on the window object by the loader script. It is used as an abstraction to allow
     * users to call commands without having to wait for the client to be ready. This works in tandem
     * with the loader script, which will queue any commands that are called before the client is ready.
     */
    dispatchCommand: (commandType: CommandType, args: any) => Promise<void>;
    /**
     * Parse passive initiation parameters from the URL and/or local storage.
     * Passive initiation parameters are values that indicate a plan & app token to use immediately.
     */
    parsePassiveParams(): null | undefined;
    private normaliseIdentity;
    private buildInitialisePayload;
    private replaceClient;
    shouldEagerStartAtLoad(queuedCommands?: Command[]): boolean;
    enqueueQueuedCommands(queuedCommands?: Command[]): Promise<void>;
    private shouldEagerInitialiseAtLoad;
    private ensureFirstRealInitialise;
    private runInitialise;
    mountWidget(): void;
    /**
     * Display a transient popover message above the widget.
     * Does not open menus or alter session/plan state.
     */
    showMessage(message: string, options?: {
        autoCloseMs?: number;
    }): void;
    captureScreen(): Promise<string>;
    save(): void;
    load(): string | null;
    private parsePersistedSessionMetadata;
    private isPersistedSessionStale;
    private parseTimestampMs;
    private readHeartbeat;
    private trackStaleSessionDiscard;
    private startHeartbeat;
    private stopHeartbeat;
    private writeHeartbeat;
    private clearHeartbeat;
    private clearCachedClient;
}
