import { GatewayBases } from '../utils/gatewayFetchRewrite'; import { RuntimeGatewayUrls } from '../config/gatewayUrls'; import { RuntimeAuthBridgeConfig } from '../config/authBridgeUrls'; export type BurdenoffNativePlatform = 'ios' | 'android' | 'web'; export type HapticImpactStyle = 'light' | 'medium' | 'heavy'; export type HapticNotificationType = 'success' | 'warning' | 'error'; export type ToastDuration = 'short' | 'long'; export type AppState = 'active' | 'inactive'; export type StatusBarTheme = 'light' | 'dark'; export interface ConfirmOptions { title: string; message: string; okButtonTitle?: string; cancelButtonTitle?: string; } export interface ShareOptions { title?: string; text?: string; url?: string; } export interface SafeAreaInsets { top: number; bottom: number; left: number; right: number; } export interface DeviceInfo { platform: BurdenoffNativePlatform; model?: string; osVersion?: string; webViewVersion?: string; manufacturer?: string; isVirtual?: boolean; } export type ActionSheetButtonStyle = 'default' | 'destructive' | 'cancel'; export interface ActionSheetButton { title: string; style?: ActionSheetButtonStyle; /** Optional icon name (lucide) — used by the web fallback sheet only. */ icon?: string; } export interface ActionSheetOptions { title?: string; message?: string; options: ActionSheetButton[]; } /** * Presentation-only native preview, armed by `?__nativePreview=ios|android|pwa|desktop|off` * (persisted in sessionStorage). Lets Playwright/humans see the installed-app UI in a * plain browser. Plugin calls stay guarded by the REAL Capacitor availability, so this * never triggers native side effects. */ export type NativePreviewMode = 'ios' | 'android' | 'pwa' | 'desktop'; export interface BurdenoffNativeBridge { getPlatform(): BurdenoffNativePlatform; isNativePlatform(): boolean; impact(style?: HapticImpactStyle): Promise; notify(type: HapticNotificationType): Promise; /** Haptic selection tick (tab switch, picker change). Optional for older shells. */ selection?(): Promise; toast(message: string, duration?: ToastDuration): Promise; confirm(options: ConfirmOptions): Promise; /** * Native action sheet. Resolves the chosen option index, or `null` when the * native sheet is unavailable (caller must render its web fallback). Optional * for older shells. */ actionSheet?(options: ActionSheetOptions): Promise; copyText(text: string): Promise; share(options: ShareOptions): Promise; openExternalUrl(url: string): Promise; /** True when the platform is a presentation-only preview (see NativePreviewMode). */ isPreview?(): boolean; } export type DesktopPlatform = 'darwin' | 'win32' | 'linux'; export type DesktopTitlebarMode = 'hidden-inset' | 'native'; export type DesktopEnvironment = 'local' | 'alpha' | 'prod'; /** * Runtime config baked into the desktop build and exposed on the bridge. * * Byte-compatible with the legacy `window.Electron.runtimeConfig` * shape (see `@burdenoff/desktop-shell` `src/shared/types.ts` — the authoritative * contract), so it reuses the existing fe-libs runtime types rather than * redefining them. */ export interface DesktopRuntimeConfig { environment: DesktopEnvironment; gatewayBases: GatewayBases; gatewayUrls: RuntimeGatewayUrls; authBridge?: RuntimeAuthBridgeConfig; /** Origin the desktop window loads (custom scheme in packaged builds). */ appOrigin?: string; /** electron-updater generic feed root for this channel. */ updateFeedUrl?: string; } export type DesktopUpdateStatus = 'unsupported' | 'idle' | 'checking' | 'available' | 'downloading' | 'downloaded' | 'up-to-date' | 'error'; export interface DesktopUpdateState { status: DesktopUpdateStatus; version?: string; percent?: number; error?: string; checkedAt?: string; } export interface DesktopNotification { id?: string; title: string; body?: string; /** In-app route to navigate to when the notification is clicked. */ route?: string; silent?: boolean; } export interface DesktopQuickAction { id: string; label: string; route?: string; accelerator?: string; /** Also expose on the Windows jump list / macOS dock menu. */ jumpList?: boolean; } export interface DesktopWindowState { focused: boolean; fullScreen: boolean; maximized: boolean; } export interface DesktopThemeOptions { scheme: 'light' | 'dark' | 'system'; backgroundColor?: string; } export interface BurdenoffDesktopBridge { readonly isElectron: true; readonly platform: DesktopPlatform; readonly arch: string; readonly versions: { app: string; electron: string; chrome: string; }; readonly product: { id: string; name: string; scheme: string; appId: string; }; readonly runtimeConfig: DesktopRuntimeConfig; readonly titlebar: DesktopTitlebarMode; onDeepLink(cb: (url: string) => void): () => void; onNavigate(cb: (route: string) => void): () => void; onUpdateState(cb: (state: DesktopUpdateState) => void): () => void; onWindowState(cb: (state: DesktopWindowState) => void): () => void; openExternal(url: string): Promise; notify(notification: DesktopNotification): Promise; setBadgeCount(count: number): Promise; setTheme(theme: DesktopThemeOptions): void; setTrayQuickActions(actions: DesktopQuickAction[]): void; setLocale(locale: string): void; getUpdateState(): Promise; checkForUpdates(): Promise; installUpdate(): Promise; notifyAppReady(): Promise; window: { minimize(): void; toggleMaximize(): void; close(): void; hide(): void; focus(): void; setTitle(title: string): void; }; } export interface PushTokenEventDetail { /** * The OS push token. On `web` this is the serialised Web Push subscription * (`serializeWebPushSubscription`), which is that platform's device identity. */ value: string; /** * `web` is included because a browser subscription is registered through the * same `burdenoff:pushToken` event as the native token. Consumers that only * understand native tokens must ignore the platforms they do not handle * rather than assume the union is exhaustive at two members. */ platform: 'ios' | 'android' | 'web'; } declare global { interface Window { __burdenoffNativeBridge?: BurdenoffNativeBridge; __burdenoffDeviceInfo?: DeviceInfo; __burdenoffDesktop?: BurdenoffDesktopBridge; __burdenoffOpenExternal?: (url: string) => Promise | void; __burdenoffPushToken?: PushTokenEventDetail; electronUpdater?: { notifyAppReady(): Promise; }; } } export interface KeyboardEventDetail { keyboardHeight: number; } export interface AppStateEventDetail { isActive: boolean; } export interface NetworkStatusEventDetail { connected: boolean; connectionType?: string; } export interface StatusBarThemeEventDetail { isDark: boolean; } //# sourceMappingURL=types.d.ts.map