import type { DomicileHost } from "../domicile-host"; import type { Extension, ExtensionPopup, ExtensionSettings, InstalledExtension } from "../extension"; import type { On } from "./subscribe"; export type ExtensionsListeners = { change: () => void; /** `installed` changed. */ installed: () => void; /** * An extension called `action.openPopup()`. Open `popup` as a clicked * action's popup. Parsed: throws on a request a shell cannot open. */ popup: (request: ExtensionPopup) => void; }; export type Extensions = { /** * `undefined` until the engine says. Parsed, since the engine and the SDK * ship apart: throws on an action a shell cannot draw. */ readonly list: readonly Extension[] | undefined; /** * Every installed extension, switched on or off. `undefined` until the * engine says. Parsed: throws on a row a shell cannot draw. */ readonly installed: readonly InstalledExtension[] | undefined; /** Click extension `id`'s action. One with a popup is the shell's to open. */ activate: (id: string) => void; /** * Changes `settings` on extension `id`. Rejects with an `OperationError` * for a setting the desk's config sets, or an extension not installed. */ configure: (id: string, settings: ExtensionSettings) => Promise; on: On; /** Switches extension `id` on or off. Rejects for one not installed. */ setEnabled: (id: string, enabled: boolean) => Promise; /** * Shows browser profile `profile`'s extensions in `list`, and has * `activate` click them there, on its active page: as a browser's toolbar * shows its window's profile's. Name the profile of the page last focused. * The default profile's until called, and while `profile` loads. */ setProfile: (profile: string) => void; /** * Uninstalls extension `id`. Rejects for one the desk's config installed, * which comes back on the next start. */ uninstall: (id: string) => Promise; }; export type ExtensionsHost = Pick; export declare const extensions: (host: ExtensionsHost) => Extensions;