import type { MessageEventLike, PostTarget, Transport, WindowLike } from "./types.js"; /** Native platform detected for the current WebView. */ export type NativePlatform = "ios" | "android"; /** * Detect whether the content is running inside a native WebView that exposes the * RevenueCat host channel. * * - iOS if `typeof window.webkit.messageHandlers.rcWebComponents.postMessage === "function"`. * - Android if `typeof window.rcWebComponents.postMessage === "function"`. * - otherwise `null` (plain web). */ export declare function detectNativeHost(win: WindowLike | undefined): NativePlatform | null; /** * Web transport: today's behavior. Listens for `message` events on `self` and * posts to a target window/origin. Origin/source are surfaced on each inbound * event so the bridge can enforce them. */ export declare class WindowTransport implements Transport { readonly trustedPeer = false; private readonly self; private listener; constructor(self: WindowLike); subscribe(onFrame: (event: MessageEventLike) => void): void; post(frame: unknown, target: PostTarget): void; destroy(): void; } /** * Native transport (iOS WKWebView / Android WebView). The native host is the sole * trusted peer. * * - JS -> native: `postMessage(JSON.stringify(frame))` — ALWAYS a string, for * Android `@JavascriptInterface` / `WebMessageListener` compatibility. * - native -> JS: native calls the installed global * `window.__rcWebComponentsReceive(data)` with a JSON string or a parsed object. */ export declare class NativeTransport implements Transport { readonly trustedPeer = true; private readonly globals; private readonly platform; constructor(win: WindowLike, platform?: NativePlatform); subscribe(onFrame: (event: MessageEventLike) => void): void; post(frame: unknown, _target: PostTarget): void; destroy(): void; } //# sourceMappingURL=transport.d.ts.map