import { NativePreviewMode } from '../shared/native/types'; export type { NativePreviewMode } from '../shared/native/types'; /** Capacitor platform string, possibly overridden by a presentation preview. */ export type NativeShellPlatform = 'ios' | 'android' | 'web'; /** * Per-shell native configuration — the shape of each product's `native.config.json`. * * JSON-schema sketch: * ```json * { * "slug": "vibecontrols", // product slug (kebab), used for cache names etc. * "displayName": "VibeControls", // human app name (store listing / manifest name) * "appId": "com.vibecontrols.www", // iOS bundle id / Android applicationId * "electronAppId": "com.vibecontrols.desktop", // optional Electron appId (defaults to appId) * "desktopCapgoId": "...", // optional CapGo app id for the desktop updater * "envPrefix": "VIBECONTROLS", // optional env-var prefix for CI scripts * "scheme": "vibecontrols", // custom URL scheme for deep links * "brandColor": "#0c243c", // splash/manifest theme color (build-time config, not UI code) * "description": "…", * "domains": { "prodApp": "app.vibecontrols.com", "alphaApp": "alphaapp.vibecontrols.com", * "website": "vibecontrols.com", "docs": "docs.vibecontrols.com" }, * "buckets": { "prodWebsite": "…", "alphaDownloads": "…" }, * "platforms": { "capacitor": true, "electron": true, "pwa": true }, * "electronCategory": { "mac": "public.app-category.productivity", "linux": "Office" }, * "links": { "docs": "https://…", "support": "https://…", "status": "https://status.burdenoff.com" }, * "push": true, * "ota": { "channel": "production" }, * "orientation": "portrait", * "devServerPort": 5173 * } * ``` */ export interface NativeConfig { slug: string; displayName: string; appId: string; electronAppId?: string; desktopCapgoId?: string; envPrefix?: string; scheme: string; brandColor: string; description?: string; domains: { prodApp: string; alphaApp: string; website: string; docs?: string; }; buckets?: { prodWebsite?: string; alphaDownloads?: string; }; platforms: { capacitor: boolean; electron: boolean; pwa?: boolean; }; electronCategory?: { mac?: string; linux?: string; }; links?: { docs?: string; support?: string; status?: string; }; push?: boolean; /** * Browser Web Push configuration for this product. Supplied by the fleet * generator from the confidential product -> Firebase project map; stamped * into `public/manifest.json` (see `defineWebManifest`) because the service * worker cannot read build variables. Public key only — never a private one. */ webPush?: { /** VAPID application-server PUBLIC key, base64url. Client-safe. */ vapidPublicKey: string; /** Firebase project this product routes through, e.g. `burdenoff-push-4`. */ fcmProject?: string; }; ota?: { /** CapGo mobile app id (usually the Capacitor appId). */ mobileAppId?: string; channel?: string; }; orientation?: 'portrait' | 'any'; devServerPort?: number; /** Manifest `background_color` (splash + PWA). Falls back to `brandColor`. */ backgroundColor?: string; /** * Desktop slice, consumed verbatim as `DesktopProductConfig` by * `@burdenoff/desktop-shell`. Present in every generated * `native.config.json`; the flat `electronAppId` / `desktopCapgoId` / * `envPrefix` / `electronCategory` / `links` fields above are the legacy * spelling kept for older callers. */ desktop?: { product: string; productName: string; appId: string; capgoAppId?: string; scheme: string; domain: string; devServerPort?: number; envPrefix?: string; appOrigins?: { prod?: string; alpha?: string; local?: string; }; category?: { mac?: string; linux?: string; }; links?: { docs?: string; support?: string; status?: string; }; window?: { width?: number; height?: number; minWidth?: number; minHeight?: number; }; closeToTray?: { darwin?: boolean; win32?: boolean; linux?: boolean; }; iconSource?: string; legacyGlobal?: boolean; maintainer?: string; }; } /** Android hardware back-button precedence: overlay → history → exit. */ export interface BackButtonHandlers { /** Close the top-most open overlay (dialog/sheet). Return true when one was closed. */ closeTopOverlay(): boolean; /** True when there is in-app history to pop. */ canNavigateBack(): boolean; navigateBack(): void; /** Last resort: ask the user and exit the app. */ confirmExit(): void; } /** App foreground/background hooks (Capacitor `appStateChange`). */ export interface MobileRuntimeHooks { /** Called when the app returns to the foreground (refetch, resume sockets…). */ syncPendingOperations(): Promise; /** Called when the app goes to the background (flush drafts/state). */ saveState(): void; } export interface NetworkHooks { onReconnect?(): void; onDisconnect?(): void; } export interface CapacitorListenerHandleLike { remove(): Promise | void; } /** Structural subset of `@capgo/capacitor-updater`'s `CapacitorUpdater`. */ export interface CapacitorUpdaterLike { notifyAppReady(): Promise; } export interface PushTokenLike { value: string; } export interface PushNotificationSchemaLike { id?: string; title?: string; body?: string; data?: Record | null; } export interface PushActionPerformedLike { actionId?: string; notification: PushNotificationSchemaLike; } export type PushPermissionStateLike = 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'; /** Structural subset of `@capacitor/push-notifications`' `PushNotifications`. */ export interface PushNotificationsLike { checkPermissions(): Promise<{ receive: PushPermissionStateLike; }>; requestPermissions(): Promise<{ receive: PushPermissionStateLike; }>; register(): Promise; addListener(eventName: 'registration', listener: (token: PushTokenLike) => void): Promise; addListener(eventName: 'registrationError', listener: (error: { error: string; }) => void): Promise; addListener(eventName: 'pushNotificationReceived', listener: (notification: PushNotificationSchemaLike) => void): Promise; addListener(eventName: 'pushNotificationActionPerformed', listener: (action: PushActionPerformedLike) => void): Promise; } export type UpdaterLoader = () => Promise<{ CapacitorUpdater: CapacitorUpdaterLike; }>; export type PushNotificationsLoader = () => Promise<{ PushNotifications: PushNotificationsLike; }>; export interface OptionalPluginLoaders { /** `() => import('@capgo/capacitor-updater')` */ updater?: UpdaterLoader; /** `() => import('@capacitor/push-notifications')` */ pushNotifications?: PushNotificationsLoader; } export interface PushOptions { enabled: boolean; /** Called with the APNs/FCM token once registration succeeds. */ onToken?(token: string, platform: 'ios' | 'android'): void; /** Called when the user taps a notification (after the deep-link navigator ran). */ onNotificationAction?(action: PushActionPerformedLike): void; /** Called when a notification is received in the foreground. */ onNotificationReceived?(notification: PushNotificationSchemaLike): void; } export interface PwaOptions { /** Default true. Registers the service worker on web builds. */ enabled?: boolean; /** Default `/sw.js`. */ swUrl?: string; /** Default 60_000 ms. */ updateCheckIntervalMs?: number; } export interface SplashOptions { /** * When true (default), `markAppReady()` is still the shell's responsibility — * this only arms a safety timer so the splash can never stick forever. */ autoHide?: boolean; /** Default 8000 ms — safety timer that hides the splash even if the shell forgets. */ maxWaitMs?: number; } export interface AuthInterceptOptions { enabled?: boolean; /** Defaults to `['/auth/sso-deposit', '/auth/sso-relay', '/auth/sso-clear']`. */ pathPrefixes?: string[]; } export interface BootNativeShellOptions { /** Product slug, e.g. `vibecontrols`. Used for the legacy Electron global key. */ product: string; /** Human name used in dialogs (e.g. "Exit VibeControls"). */ appName: string; /** * Legacy Electron preload global (`window.`). Defaults to * `${product}Electron`. `window.__burdenoffDesktop` is always checked first. */ electronGlobalKey?: string; plugins?: OptionalPluginLoaders; push?: PushOptions; backButton?: Partial; runtimeHooks?: Partial; network?: NetworkHooks; authIntercept?: AuthInterceptOptions; splash?: SplashOptions; /** Allow `?__nativePreview=` presentation previews. Default true. */ preview?: { allow?: boolean; }; pwa?: PwaOptions; /** Desktop (Electron) shell boot — forwarded to `bootDesktopShell`. */ desktop?: { navigate?: (path: string) => void; }; } export interface NativeShellHandle { platform: NativeShellPlatform; /** Real Capacitor native OR an ios/android presentation preview. */ isNative: boolean; isPreview: boolean; previewMode: NativePreviewMode | null; /** Hide the splash screen (idempotent) and dispatch `burdenoff:appReady`. */ markAppReady(): Promise; } /** * Legacy per-product Electron preload bridge (`window.Electron`). New * desktop shells expose `window.__burdenoffDesktop` instead; both are honoured. */ export interface LegacyElectronBridge { isElectron?: boolean; openExternal?(url: string): Promise | boolean; onDeepLink?(cb: (url: string) => void): unknown; } export interface DeepLinkDetail { path: string; url: string; } export interface NetworkStatusDetail { connected: boolean; connectionType?: string; } /** `beforeinstallprompt` event (not in lib.dom). */ export interface BeforeInstallPromptEventLike extends Event { readonly platforms?: string[]; readonly userChoice?: Promise<{ outcome: 'accepted' | 'dismissed'; platform: string; }>; prompt(): Promise; } declare global { interface Window { /** Deferred `beforeinstallprompt` captured by `installPwa()` for install banners. */ __burdenoffPwaInstallPrompt?: BeforeInstallPromptEventLike | null; } } //# sourceMappingURL=types.d.ts.map