| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- // 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<any>;
- currentContact?(): Promise<any>;
- }
-
- // 扩展 WxworkCorp 接口
- interface WxworkCorp {
- ticket?: {
- get(): Promise<any>;
- };
- auth?: {
- getuserinfo(code: string): Promise<any>;
- };
- externalContact?: {
- get(userId: string): Promise<any>;
- groupChat: {
- get(chatId: string): Promise<any>;
- 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<any>;
- sendMarkdown(options: any): Promise<any>;
- sendNews(options: any): Promise<any>;
- };
- appchat?: {
- sendText(chatId: string, message: string): Promise<any>;
- };
- }
- // 扩展 WxworkSDK 接口
- interface WxworkSDK {
- ww?: any;
- getCurrentChat?(): Promise<any>;
- syncContact?(contactInfo: any): Promise<any>;
- syncGroupChat?(groupInfo: any): Promise<any>;
- getCurrentUser?(): Promise<any>;
- }
- }
- // 扩展 Window,声明 window.fmode.alert/input
- declare global {
- interface Window {
- fmode?: {
- alert?: (detail: any) => Promise<any> | any;
- // 新增:confirm 简化方法,入参支持字符串或配置对象,返回点击结果布尔值
- confirm?: (messageOrDetail: any) => Promise<boolean>;
- // 保留对象用法:传入配置对象,返回 Alert 的 onDidDismiss 结果
- input?: ((detail: any) => Promise<any>)
- // 新增字符串简化用法:与await window?.fmode?.input(message, defaultValue) 一致,返回 string 或 null
- & ((message: string, defaultValue?: string) => Promise<string | null>);
- [key: string]: any;
- };
- }
- }
- export {};
|