/** * Indigenius AI Widget SDK - Type Definitions * Full TypeScript support for npm and CDN usage */ export namespace Cdial { /** * Configuration options for the Cdial Widget */ export interface CdialWidgetOptions { /** * The unique Agent ID for your AI agent */ agentId: string; /** * If true, the widget's floating UI is auto-mounted. * If false, no UI is rendered and you control everything via the API. * @default false */ mountUI?: boolean; } /** * Event types that the widget can emit */ export type CdialEventType = 'dialing' | 'connected' | 'ended' | 'error'; /** * Event callback function type */ export type EventCallback = (data?: any) => void; /** * Main Cdial Widget Class */ export class CdialWidget { public widgetTheme: any; constructor(options: CdialWidgetOptions); /** * Initialize the widget */ init(): Promise; /** * Start a call with optional theme configuration */ startCall(theme?: any): Promise; /** * End the current call */ endCall(): void; /** * Check if a call is currently ongoing */ isCalling(): boolean; /** * Register an event listener */ on(event: CdialEventType, callback: EventCallback): void; /** * Toggle the call state */ toggleCall(): void; } } /** * Named exports for convenience */ export import CdialWidget = Cdial.CdialWidget; export import CdialWidgetOptions = Cdial.CdialWidgetOptions; /** * Global declarations for CDN usage and Custom Element support */ declare global { interface Window { /** * The Cdial namespace, available globally when using CDN */ Cdial: typeof Cdial; /** * Direct access to CdialWidget class */ CdialWidget: typeof Cdial.CdialWidget; /** * Widget instance when initialized via HTML tag */ widget?: Cdial.CdialWidget; } /** * Support for tag in React/JSX */ namespace JSX { interface IntrinsicElements { 'indigenius-convai': { 'agent-id': string; [key: string]: any; }; } } /** * Support for tag in Vanilla JS/TS */ interface HTMLElementTagNameMap { "indigenius-convai": HTMLElement; } } /** * Default export of the namespace */ export default Cdial;