/** Public protocol 2 API. Optional capabilities vary by host; check xb.can() before using them. */ type XbJson = null | boolean | number | string | XbJson[] | { [key: string]: XbJson }; type XbEvent = 'show' | 'hide' | 'safearea' | 'orientation' | 'theme'; type XbCapability = 'haptics' | 'share' | 'clipboard' | 'screen' | 'notify' | 'profile' | 'camera' | 'microphone' | 'contacts' | 'files' | 'windows' | 'pointer'; type XbErrorCode = 'unsupported' | 'not-declared' | 'denied' | 'gesture' | 'invalid' | 'quota' | 'busy' | 'login'; type XbSafeArea = { top: number; right: number; bottom: number; left: number }; type XbCapsule = { top: number; right: number; width: number; height: number }; type XbInfo = { readonly platform: 'android' | 'ios' | 'desktop' | 'web'; readonly orientation: 'portrait' | 'landscape'; readonly safeArea: Readonly; readonly capsule: Readonly; readonly theme: 'light' | 'dark'; readonly locale: string; readonly query: Readonly>; readonly legacySave: XbJson; readonly sdkVersion: string; }; type XbListener = (payload?: unknown) => void; interface Xb { readonly info: XbInfo; ready(): void; on(name: XbEvent, listener: XbListener): void; off(name: XbEvent, listener: XbListener): void; can(name: XbCapability): boolean; exit(): Promise; storage: { get(key: string): Promise; set(key: string, value: XbJson): Promise; remove(key: string): Promise; keys(): Promise; }; game?: { start(): Promise; progress(value: { score: number }): Promise; result(value: { score: number }): Promise; }; haptics?: { impact(kind: 'light' | 'medium' | 'heavy'): Promise; notify(kind: 'success' | 'warning' | 'error'): Promise; }; share?(value: { title: string; text?: string; image?: string; query?: Record }): Promise; clipboard?: { writeText(value: string): Promise }; screen?: { keepOn(active: boolean): Promise }; notify?: { schedule(value: { id: string; at: number; title: string; body: string; repeat?: 'daily' }): Promise; cancel(id: string): Promise; list(): Promise; }; user?: { profile(): Promise<{ openId: string; nickname?: string; avatar?: string }> }; contacts?: { pick(value: { multiple?: boolean; fields: Array<'name' | 'phone' | 'email'> }): Promise; }; files?: { save(value: { name: string; mime: string; data: unknown }): Promise }; } declare const xb: Xb; interface Window { readonly xb: Xb; }