// Type augmentation for fmode-ng // 扩展接口,添加缺失的方法定义 // 扩展 fmode-ng/social 的接口 declare module 'fmode-ng/social' { // 导出 WxworkCurrentChat 接口 export interface WxworkCurrentChat { type?: string; chatId?: string; group?: any; contact?: any; id?: string; [key: string]: any; } // 扩展 WxworkAuth 接口 interface WxworkAuth { currentProfile?(): Promise; currentContact?(): Promise; } // 扩展 WxworkCorp 接口 interface WxworkCorp { ticket?: { get(): Promise; }; auth?: { getuserinfo(code: string): Promise; }; externalContact?: { get(userId: string): Promise; groupChat: { get(chatId: string): Promise; addJoinWay(options: any): Promise<{ config_id?: string; [key: string]: any }>; getJoinWay(configId: string): Promise<{ join_way?: { qr_code?: string; url?: string; [key: string]: any }; [key: string]: any }>; }; }; message?: { sendText(chatId: string, content: string): Promise; sendMarkdown(options: any): Promise; sendNews(options: any): Promise; }; appchat?: { sendText(chatId: string, message: string): Promise; }; } // 扩展 WxworkSDK 接口 interface WxworkSDK { ww?: any; getCurrentChat?(): Promise; syncContact?(contactInfo: any): Promise; syncGroupChat?(groupInfo: any): Promise; getCurrentUser?(): Promise; } } // 扩展 Window,声明 window.fmode.alert/input declare global { interface Window { fmode?: { alert?: (detail: any) => Promise | any; // 新增:confirm 简化方法,入参支持字符串或配置对象,返回点击结果布尔值 confirm?: (messageOrDetail: any) => Promise; // 保留对象用法:传入配置对象,返回 Alert 的 onDidDismiss 结果 input?: ((detail: any) => Promise) // 新增字符串简化用法:与await window?.fmode?.input(message, defaultValue) 一致,返回 string 或 null & ((message: string, defaultValue?: string) => Promise); [key: string]: any; }; } } export {};