export declare function getElaspedTime(): string; /** * Why a voice turn could not start or finish. * * These used to be `console.log` lines, which meant a visitor who denied the * microphone prompt saw the recording UI simply do nothing — no error, no * explanation, and nothing an embedder could react to. The recorder now reports * a code plus a message written for the person holding the microphone. */ export type AudioRecordingErrorCode = /** No `mediaDevices`/`getUserMedia` — an old browser, or a non-secure origin. */ 'UNSUPPORTED_BROWSER' /** The visitor dismissed or blocked the permission prompt. */ | 'PERMISSION_DENIED' /** No input device is attached. */ | 'NO_MICROPHONE' /** A device exists but another application holds it. */ | 'DEVICE_BUSY' /** The recorder was asked to start or stop from a state that forbids it. */ | 'RECORDER_FAILED' /** The finished clip exceeds what the SDK will upload — see MAX_AUDIO_UPLOAD_BYTES. */ | 'RECORDING_TOO_LARGE' /** The clip contains no audio — a container header and nothing else. */ | 'RECORDING_EMPTY'; export type AudioRecordingError = { code: AudioRecordingErrorCode; message: string; }; /** * Largest recorded clip the widget will upload, in bytes. * * An SDK-side default, not a negotiated one: `capabilities.speechToText` * advertises `via` but **no size ceiling**, so there is nothing from the server * to enforce. 25 MB matches the common provider limit (Whisper's) and is far * below the 500 MB global request-body ceiling that is otherwise the only bound * — the recorder's own cap is one hour of wall time, which can produce a clip * far larger than any transcription provider accepts. * * Rejecting locally means the visitor gets an immediate, accurate message rather * than waiting out a long upload for a provider-side failure. If CORE later * advertises an audio ceiling, prefer it over this constant. */ export declare const MAX_AUDIO_UPLOAD_BYTES: number; /** * Starts the audio recording. * * `onError` receives a classified failure so the caller can render it. Without * it the failure is silent — the previous behaviour, kept only so the parameter * stays optional for existing call sites. */ export declare function startAudioRecording(onRecordingStart: (value: boolean) => void, onUnsupportedBrowser: (value: boolean) => void, setElapsedTime: (value: string) => void, onError?: (error: AudioRecordingError) => void): void; /** * Stop the currently started audio recording and hand the clip to the caller. * * A clip over `MAX_AUDIO_UPLOAD_BYTES` is rejected here rather than uploaded: * the recorder's own ceiling is an hour of wall time, which produces something * no transcription provider will accept, and discovering that after the upload * wastes the visitor's bandwidth and tells them nothing useful. */ export declare function stopAudioRecording(addRecordingToPreviews: null | ((blob: Blob) => void), onError?: (error: AudioRecordingError) => void): void; /** Cancel the currently started audio recording */ export declare function cancelAudioRecording(): void; type AudioRecorder = { audioBlobs: Blob[]; mediaRecorder: MediaRecorder | null; streamBeingCaptured: MediaStream | null; start: () => Promise; stop: () => Promise; cancel: () => void; stopStream: () => void; resetRecordingProperties: () => void; }; export declare const audioRecorder: AudioRecorder; export {};