/** * Capacitor (mobile) runtime detection — MFE-safe, boot-order independent. * * WHY THIS EXISTS SEPARATELY FROM `platform.ts` * -------------------------------------------- * `isNative()` in `./platform` reads `window.__burdenoffNativeBridge`, which is * only published by `installNativeBridge()` during `bootNativeShell()`. Gateway * URLs are resolved at module scope in every shell's `main.tsx` — BEFORE React * renders and long before that boot step runs — so `isNative()` is still * `false` at the moment it matters most. Anything that resolves a network * target must therefore use the detector here instead. * * WHY IT DOES NOT IMPORT `@capacitor/core` * ---------------------------------------- * `shared/*` is the MFE-safe half of fe-libs: a microfrontend must never * resolve a Capacitor package (that is the whole reason `shell-native` is a * separate, shell-only subpath). Capacitor's native runtime injects a * `window.Capacitor` global into the WebView before any application script * executes, which is exactly what `@capacitor/core` itself reads — so sniffing * that global is both dependency-free and available at module-scope time. * * PRESENTATION PREVIEWS ARE DELIBERATELY NOT DETECTED HERE. * `?__nativePreview=ios|android` (see `shell-native/preview`) changes how the * app LOOKS in a normal browser. It must never change which backend the app * talks to, so it does not set `window.Capacitor` and is invisible to this * module. * * @module @burdenoff/fe-libs/shared/native/capacitor */ /** The two real Capacitor mobile platforms (`'web'` is not native). */ export type CapacitorNativePlatform = 'ios' | 'android'; /** * The real Capacitor platform, or `null` when this is not a native mobile * shell. Never returns a value for a presentation preview. */ export declare function getCapacitorPlatform(): CapacitorNativePlatform | null; /** * True when running inside a real Capacitor mobile WebView (iOS or Android). * * Three independent signals are accepted because a wrong `false` here sends a * shipped mobile app to a developer-only gateway hostname that resolves * nowhere: * 1. `Capacitor.isNativePlatform()` — the canonical check. * 2. A platform name of `ios`/`android` — correct even if (1) is missing. * 3. A `capacitor:` document protocol — the origin a shell gets when it * overrides `server.iosScheme`, and proof of a native WebView on its own. */ export declare function isCapacitorNative(): boolean; //# sourceMappingURL=capacitor.d.ts.map