@corti/dictation-web
Version:
Web component for Corti Dictation
151 lines (150 loc) • 5.51 kB
TypeScript
import type { Corti, CortiAuth } from "@corti/sdk";
import { LitElement } from "lit";
import type { ConfigurableSettings, ProxyOptions, RecordingState } from "../types.js";
import "../contexts/dictation-context.js";
import "./recording-button.js";
import "./settings-menu.js";
export declare class CortiDictation extends LitElement {
static styles: import("lit").CSSResult;
/**
* Latest access token
*/
accessToken?: string;
/**
* Authentication configuration with optional refresh mechanism.
*/
authConfig?: CortiAuth.AuthTokenDerivable;
/**
* WebSocket URL for proxy connection. When provided, uses CortiWebSocketProxyClient instead of CortiClient.
*/
socketUrl?: string;
/**
* Socket proxy configuration object. When provided, uses CortiWebSocketProxyClient instead of CortiClient.
*/
socketProxy?: ProxyOptions;
/**
* List of all language codes available for use with the Web Component.
* Default list depends on the accessToken
*/
set languagesSupported(value: Corti.TranscribeSupportedLanguage[] | undefined);
get languagesSupported(): Corti.TranscribeSupportedLanguage[];
_languagesSupported?: Corti.TranscribeSupportedLanguage[];
/**
* Which settings should be available in the UI.
* If an empty array is passed, the settings will be disabled entirely.
* Options are language and devices
*/
settingsEnabled: ConfigurableSettings[];
/**
* When false (default), allows the start/stop button from taking focus when clicked,
* disabling textareas or other input elements to maintain focus.
* Set to "true" to allow the button to receive focus on click.
*/
allowButtonFocus: boolean;
/**
* Overrides any device selection and instead uses getDisplayMedia to stream system audio.
* Should only be used for debugging.
*/
debug_displayAudio: boolean;
/**
* Configuration settings for dictation
*/
set dictationConfig(value: Corti.TranscribeConfig);
get dictationConfig(): Corti.TranscribeConfig;
_dictationConfig: Corti.TranscribeConfig;
/**
* List of available recording devices
*/
set devices(value: MediaDeviceInfo[] | undefined);
get devices(): MediaDeviceInfo[];
_devices?: MediaDeviceInfo[];
/**
* The selected device used for recording (MediaDeviceInfo).
*/
set selectedDevice(value: MediaDeviceInfo | undefined);
get selectedDevice(): MediaDeviceInfo | undefined;
_selectedDevice?: MediaDeviceInfo;
/**
* Current state of recording (stopped, recording, initializing and stopping, ).
*/
get recordingState(): RecordingState;
/**
* Push-to-talk keybinding for keyboard shortcut. Single key only (e.g., "Space", "k", "meta", "ctrl").
* Combinations with "+" are not supported.
* Keydown starts recording, keyup stops recording.
* Defaults to "Space" if keybinding is in settingsEnabled, otherwise undefined
*/
set pushToTalkKeybinding(value: string | null | undefined);
get pushToTalkKeybinding(): string | null | undefined;
_pushToTalkKeybinding?: string | null;
/**
* Toggle-to-talk keybinding for keyboard shortcut. Single key only (e.g., "`", "k", "meta", "ctrl").
* Combinations with "+" are not supported.
* Pressing the key toggles recording on/off.
* Defaults to "`" if keybinding is in settingsEnabled, otherwise undefined
*/
set toggleToTalkKeybinding(value: string | null | undefined);
get toggleToTalkKeybinding(): string | null | undefined;
_toggleToTalkKeybinding?: string | null;
/**
* Set the latest access token.
* @returns ServerConfig with environment, tenant, and accessToken
* @deprecated Use 'accessToken' property instead.
*/
setAccessToken(token: string): {
accessToken: string | undefined;
environment: undefined;
tenant: undefined;
} | {
accessToken: string;
environment: string;
tenant: string;
};
/**
* Set the auth configuration for OAuth flows.
* @returns Promise with ServerConfig containing environment, tenant, and accessToken
* @deprecated Use 'authConfig' property instead.
*/
setAuthConfig(config: CortiAuth.AuthTokenDerivable): Promise<{
accessToken: string | undefined;
environment: undefined;
tenant: undefined;
} | {
accessToken: string;
environment: string;
tenant: string;
} | {
accessToken: undefined;
environment: undefined;
tenant: undefined;
}>;
/**
* Starts a recording.
*/
startRecording(): void;
/**
* Stops a recording.
*/
stopRecording(): void;
/**
* Starts or stops recording. Convenience layer on top of the start/stop methods.
*/
toggleRecording(): void;
/**
* Opens the WebSocket connection without starting recording.
* Use this to pre-establish the connection before recording starts.
*/
openConnection(): Promise<void>;
/**
* Closes the WebSocket connection by sending "end" and waiting for "ended".
* Call this to receive "usage" statistics or when done with the connection.
*/
closeConnection(): Promise<void>;
render(): import("lit-html").TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
"corti-dictation": CortiDictation;
}
}