import { edger } from "../index"; export type EdgerSDK = typeof edger; interface GenericCmdProxyPayload { [key: string]: any; } export type EdgerCmdProxyPaylod = EdgerCMDProxyData | EdgerNotifyParams | EdgerUniversalPayParams | EdgerPayQueryOrderParams | AppsPayload | EdgerOrientationParams | EdgerReqPermsParams | Array | null | GenericCmdProxyPayload; export type EdgerOrientationValue = 'landscape' | 'portrait'; export type EdgerOrientationAction = 'lock' | 'unlock'; export type EdgerAppId = number; export type EdgerNotifyCMD = 'info' | 'warning' | 'error' | 'success'; export type JobActionCMD = 'start' | 'pause' | 'resume' | 'cancel' | 'retry' | 'done' | 'error' | 'progress'; export type ToastActionCMD = 'action'; export type AudioPlayerActionCMD = 'interrupt' | 'change' | 'position' | 'status' | 'action'; export type MultiplePanelActionCMD = 'change' | 'selected' | 'status' | 'action'; export type AlbumActionCMD = 'change'; export type DialogCMD = 'close' | 'select'; export type MobileCMD = 'volumeChange'; export type MediaActionCMD = 'change' | 'close' | 'status' | 'action' | 'casterControls'; export type ServiceActionCMD = 'pause' | 'resume' | 'status' | 'delete'; export type SSDPActionCMD = 'status'; export type CasterActionCMD = 'status'; export type FilePreviewActionCMD = 'status'; export type ShareActionCMD = 'status'; type InternalJobActionCMD = 'event_job_start' | 'event_job_pause' | 'event_job_resume' | 'event_job_cancel' | 'event_job_done' | 'event_job_error' | 'event_job_progress' | 'event_job_timeout'; type InternalAlbumCMD = 'event_album_change'; type InternalMediaCMD = 'event_media_player_change' | 'event_media_player_delete' | 'event_media_player_export'; type InternalServiceCMD = 'event_service_pause' | 'event_service_resume' | 'event_service_status' | 'event_service_delete'; export type EdgerActionCMD = InternalMediaCMD | InternalJobActionCMD | InternalAlbumCMD | InternalServiceCMD | CasterActionCMD | SSDPActionCMD | ServiceActionCMD | DialogCMD | AlbumActionCMD | JobActionCMD | 'active' | 'deactive' | 'login' | 'logout' | 'pay' | 'orientation' | 'network' | 'swipe' | 'token' | 'permission' | 'wallpaper' | 'theme' | 'language' | 'safeArea' | 'download' | 'verify' | 'keyboardHeight' | 'connect_mode'; export declare enum EdgerDeliverStrategy { onlyTop = 1, preferTop = 2, desktop = 3 } export type EdgerCMD = string; export interface CallAppResult { installed: boolean; } export interface CallThirdParty { schemeUrl: string; packageName: string; failUrl: string; } export interface EdgerEmitData { cmd: EdgerCMD; uid?: string; payload?: T; ts?: number; scope?: string; } export interface EdgerCMDProxyOption { timeout?: number; ignoreResponse?: boolean; deliverStrategy?: EdgerDeliverStrategy; disableTimeout?: boolean; } export interface EdgerCMDProxyData { target?: any; data?: any; letter?: any; type?: string; message?: string; } interface EdgerNotifyParams { message: string; level: EdgerNotifyCMD; } export type EdgerCMDList = { [key in EdgerActionCMD]: EdgerFunction[]; }; export interface Contact { name: string; phone: string; descPinyin: string; descShort: string; } export type EdgerNotify = { [name in EdgerNotifyCMD]: (msg: string) => void; }; export interface VolumeInfo { volume: number; } export interface NetworkInfo { /** 手机网路类型 */ type: 'none' | 'wifi' | 'mobile'; /** 手机 IP */ ip: string; /** WIFI 的 SSID */ ssid: string; /** 其他未知信息 */ [key: string]: any; } export type EdgerMobile = { qrscan: (options?: ScannerOptions) => Promise; qrscanStop: () => void; contacts: () => Promise; version: () => Promise; }; export type FileStatus = 'waiting' | 'downloading' | 'success' | 'failure'; export interface FileState extends FileProgress { status: FileStatus; path: string; } export interface FileProgress { id: string; progress: number; total: number; loaded: number; } export interface FileDownloadInfo { id: string; status: FileStatus; path: string; } export interface EdgerApp { open: (target: { id: string; [propName: string]: any; }, letter?: EdgerLetter) => Promise<{ success: boolean; error?: { code: 'E1000' | 'E2000' | string; msg: string; }; }>; letter: () => Promise; appworld: (id: string) => Promise<{ success: boolean; error: { code: 'E1000' | 'E2000' | string; msg: string; }; }>; browser: (url: string) => Promise<{ success: boolean; error?: string; }>; callThirdPartyApp: (url: string) => Promise<{ success: boolean; error?: string; }>; } export interface EdgerPermission { request: (config: EdgerReqPermsParams) => Promise<{ success: boolean; }>; fetch: () => Promise>; } export interface EdgerOrientation { state: () => Promise<{ orientation: EdgerOrientationValue; }>; lock: (data: EdgerOrientationValue) => Promise<{ orientation: EdgerOrientationValue; }>; unlock: () => Promise<{ orientation: EdgerOrientationValue; }>; } export interface EdgerPayment { pay: (data: EdgerUniversalPayParams) => Promise; } export interface EdgerFunction extends Function { __edger_uid__?: string; __edger_done__?: boolean; } export interface EdgerPermissionResult { advnwc: boolean; ainn: boolean; alarm: boolean; alldevs: boolean; account: boolean; coap: boolean; lora: boolean; mediacenter: { readable: boolean; writable: boolean; removable: boolean; }; mqtt: { publish: boolean; subscribe: boolean; }; network: boolean; notify: boolean; printer: boolean; rtsp: boolean; auxstorage: boolean; vpn: boolean; display: boolean; share: boolean; wallpaper: boolean; devices: Array; vehicle: { cockpit: boolean; diagnostics: boolean; drive: boolean; geolocation: boolean; media: boolean; }; phone: { camera: boolean; microphone: boolean; geolocation: boolean; browser: boolean; contacts: boolean; file: boolean; media: boolean; }; } export interface EdgerFunctionOnAction { (action: EdgerActionCMD, handler: (arg: any) => void): void; } export interface EdgerUniversalPayParams { app_no: string; mch_no: string; description: string; mch_trade_no: string; time_expire: string; extra: string; notify_url: string; amount_total: number; amount_currency: 'CNY'; nonce: string; sign: string; sign_type: string; } export interface EdgerPayResult { success: boolean; } export interface EdgerPayQueryOrderParams { payOrderId: string; } export interface EdgerPayFunction extends EdgerFunction { (data: EdgerUniversalPayParams): void; } export interface EdgerPayQueryOrderFunction extends EdgerFunction { (data: EdgerPayQueryOrderParams): Promise; } interface AppsPayload { appids: EdgerAppId[]; ico: boolean; } export interface EdgerOrientationParams { type: EdgerOrientationAction; orientation?: EdgerOrientationValue; } export type EdgerReqPermsType = 'devices' | 'permissions' | 'vehicle' | 'phone'; export type DevicesCode = string; export type PermissionsCode = 'share' | 'alarm' | 'wallpaper' | 'account' | 'network' | 'advnwc' | 'alldevs' | 'lora' | 'coap' | 'ainn' | 'rtsp' | 'display' | 'printer' | 'auxstorage' | 'vpn' | 'notify' | 'mqtt.publish' | 'mqtt.subscribe' | 'mediacenter.readable' | 'mediacenter.writable' | 'mediacenter.removable'; export type VehicleCode = 'cockpit' | 'diagnostics' | 'drive' | 'geolocation' | 'media'; export type PhoneCode = "geolocation" | "media" | "microphone" | "camera" | "browser" | "file"; export interface EdgerReqPermsParams { code: Array; type: EdgerReqPermsType; } export type EdgerFetchPermissions = EdgerReqPermsParams[]; export interface EdgerNetworkStatus { connected: boolean; connectionType: 'wifi' | 'cellular' | 'none' | 'unknown'; } export interface EdgerVersion { version: [number, number, number]; } export interface AppVersion { version: [number, number, number]; } export interface EdgerToken { token: string; srand: string; } export interface EdgerTheme { theme: 'dark' | 'light'; } export interface EdgerLetter { type: string; from?: string; msg: any; } export interface EdgerEnv { env: 'browser' | 'edgerapp' | 'miniapp' | 'electron'; brand: string; id: string; osVersion: string; appVersion: string; platform: string; } export interface DeviceInfo { name: string; deviceId: string; deviceModel: string; diskFree: number; diskTotal: number; isVirtual: boolean; manufacturer: string; memUsed: number; operatingSystem: string; model: string; osVersion: string; platform: string; webViewVersion: string; } export interface EdgerAppInfo { appid: number; pkgName: string | number; name: string; ico: { big: string; small: string; big64?: string; small64?: string; }; version: EdgerVersion; running: boolean; privilege: boolean; locked: boolean; experimental: boolean; develop: boolean; } export interface EdgerUserInfo { acoid: string; nickname: string; profile: string; } export interface ScannerOptions { prompt?: string; showTorchButton?: boolean; } export interface ScanResult { format: 'QR_CODE' | 'DATA_MATRIX' | 'UPC_E' | 'UPC_A' | 'EAN_8' | 'EAN_13' | 'CODE_128' | 'CODE_39' | 'CODE_93' | 'CODABAR' | 'ITF' | 'RSS14' | 'RSS_EXPANDED' | 'PDF_417' | 'AZTEC' | 'MSI'; text: string; } export interface SafeArea { top?: number; left?: number; right?: number; bottom?: number; } export interface EdgerLayout { safeArea: () => Promise<{ safeAreaInsets: SafeArea; }>; } export interface RouteParams { url?: string; current?: string; routePosition?: number; back?: string; forward?: string; mark: string; title: string; } export interface EdgerPasswordVerifyResult { success: boolean; } export interface MediaSelectorOptions { accept: 'image/*' | 'video/*' | '*'; multiple: boolean; } export type FileType = 'video' | 'livephoto' | 'livephoto#mov' | 'picture' | 'file' | 'directory' | string; export interface MediaDetail { url: string; mov?: { type: string; size: number; path: string; url: string; }; thumbnail: { type: string; size?: number; path: string; url: string; }; detail: { latitude?: number; longitude?: number; altitude?: number; width: number; height: number; duration?: number; }; } export interface FileSelectorOptions { multiple: boolean; } export interface FileInfo { id: string; name: string; path: string; size: number; type: FileType; mtime: number; birthtime: number; } export interface MediaFileInfo extends FileInfo { media: MediaDetail; } export interface MediaInfo { position?: number; functions: string[]; sourceFrame?: { height: number; offsetX: number; offsetY: number; width: number; }; files: MediaFileInfo[]; } export interface FileSaveRequest { path: string; destPath: string; fileName?: string; } export interface AppLayout { [key: string]: RectInfo; } export type RectInfo = { x: number; y: number; w: number; h: number; }; export interface BasePermissionText { type: EdgerReqPermsType; code: PermissionsCode | VehicleCode | PhoneCode; } export interface PermissionText extends BasePermissionText { dialogContent?: string; drawerContent?: string; } export interface PermissionTextResult { success: boolean; } export type AllowNavigatePages = '/version' | '/download-management'; export interface NavigateParams { path: AllowNavigatePages; queryParams?: { [key: string]: any; }; } export {};