/** * SuperleapCRM iframe SDK TypeScript Declarations * Enables bidirectional communication between embedded websites and parent CRM */ export interface SuperleapCRMEventDetail { payload: any; timestamp: string; source: string; isFromIframe: boolean; } export interface SuperleapCRMConfig { eventPrefix?: string; debug?: boolean; } export interface SuperleapCRMVersionInfo { version: string; api: string[]; eventPrefix: string; } export interface SuperleapCRMListenerCallback { ( detail: SuperleapCRMEventDetail | { type: string; [key: string]: any } ): void; } export interface SuperleapCRM { /** * Sends event to close the form * @param data - Optional data to send with close event * @returns Success status */ closeForm(data?: any): boolean; /** * Sets loading state * @param isLoading - Loading state * @param message - Optional loading message * @returns Success status */ setIsLoading(isLoading: boolean, message?: string): boolean; /** * Shows a toast notification * @param message - Toast message * @param type - Toast type: 'success', 'error', 'warning', 'info' * @param duration - Duration in milliseconds (optional) * @returns Success status */ toast( message: string, type?: "success" | "error" | "warning" | "info", duration?: number ): boolean; /** * Listen for events from the CRM * @param eventType - Event type to listen for * @param callback - Callback function * @returns Cleanup function to remove listener */ listen(eventType: string, callback: SuperleapCRMListenerCallback): () => void; /** * Listen for all events from the CRM * @param callback - Callback function for all events * @returns Cleanup function to remove listener */ listen(callback: SuperleapCRMListenerCallback): () => void; /** * Send custom event to CRM * @param eventType - Custom event type * @param data - Event data * @returns Success status */ sendCustomEvent(eventType: string, data: any): boolean; /** * Configure the bridge * @param options - Configuration options */ configure(options?: SuperleapCRMConfig): void; /** * Utility function to check if running in iframe * @returns Whether running in iframe */ isInIframe(): boolean; /** * Get version info * @returns Version information */ version(): SuperleapCRMVersionInfo; } declare global { interface Window { SuperleapCRM: SuperleapCRM; } } declare const SuperleapCRM: SuperleapCRM; export default SuperleapCRM;