// Chrome extension API types
declare global {
interface Window {
chrome?: {
runtime?: {
sendMessage?: (message: ExtensionMessage | ChatbotExtensionMessage, callback?: (response: unknown) => void) => void;
};
};
chatbotNavigationHandlers?: ((target: string, action: string, description: string) => void)[];
}
}
const SVG_PLACEHOLDER = encodeURIComponent(`
`);
export const DEFAULT_PLACEHOLDER_DATA_URI = `data:image/svg+xml;utf8,${SVG_PLACEHOLDER}`;
export type Mode = 'chat-first' | 'video-first';
export interface WidgetConfig {
personaId?: string;
replicaId?: string;
conversationalContext?: string;
maxCallSeconds?: number; // default 15
participantLeftTimeout?: number; // default 0
mode?: Mode; // default chat-first
theme?: string;
container?: string | HTMLElement;
fullScreenOnVideo?: boolean; // default true
chatEnabled?: boolean; // default true
chatSessionId?: string; // for local persistence keying
apiBase?: string; // future proxy
headers?: Record;
videoPlaceholderSrc?: string;
// Development mode
enableMockMode?: boolean; // Use mock responses for development testing
// Visibility controls
showChat?: boolean;
showVideo?: boolean;
// Size and positioning
size?: 'minimal' | 'medium' | 'large';
startSize?: 'minimal' | 'medium' | 'large';
sizeOverride?: 'minimal' | 'medium' | 'large' | undefined;
sizeRules?: Record; // e.g., {"mobile": "minimal", "desktop": "large"}
autoSize?: boolean;
position?: { x: number; y: number };
enableDrag?: boolean;
enableResize?: boolean;
// Overlay configuration
overlayBackdrop?: 'blur' | 'gradient';
}
// Import types that are used in the global declaration
import type { ExtensionMessage, ChatbotExtensionMessage } from '@buzztrail/shared-types';