/** * InAppBrowserEscaper - A TypeScript library to help users escape from in-app browsers * * This library detects when users are browsing within in-app browsers (like Instagram, * Facebook, Telegram, etc.) and provides utilities to help them open the content in * their default browser for a better experience. */ export interface BrowserInfo { isInApp: boolean; platform: string; userAgent: string; appName?: string; } export interface EscapeOptions { /** Custom message to display in the modal */ message?: string; /** Text for the action button */ buttonText?: string; /** * Show a modal for user interaction (default: false) * - When true: Shows modal with instructions and action button * - When false: Automatically attempts to redirect to external browser */ showModal?: boolean; /** URL to redirect to (defaults to current URL) */ fallbackUrl?: string; /** Force escape attempt even if not in an in-app browser */ force?: boolean; /** Show quick visual instructions overlay */ showQuickInstructions?: boolean; /** Enable debug logging to console (default: false) */ debug?: boolean; } /** * Detects if the current browsing session is within an in-app browser */ export declare class InAppBrowserDetector { private static readonly IN_APP_PATTERNS; /** * Analyzes the current browser environment */ static analyze(): BrowserInfo; /** * Detects iOS Safari in-app browser (SFSafariViewController) */ private static isIOSSafariInApp; /** * Detects Android WebView browsers (generic in-app browsers) */ private static isAndroidWebView; /** * Checks if currently in an in-app browser */ static isInAppBrowser(): boolean; /** * Gets the detected app name if in an in-app browser */ static getAppName(): string | undefined; private static getPlatform; } /** * Provides escape utilities for in-app browsers */ export declare class InAppBrowserEscaper { private static defaultOptions; /** * Internal debug logger - only logs when debug mode is enabled */ private static debugLog; /** * Emits browser-visible debug events. Useful for mobile in-app browsers where console access is hard. */ private static emitDebugEvent; /** * Internal debug warning - only logs when debug mode is enabled */ private static debugWarn; /** * Attempts to escape from the in-app browser * * Behavior: * - showModal: false (default) → Auto-redirects to external browser * - showModal: true → Shows modal with instructions and action button * - force: true → Attempts redirect even outside detected in-app browsers * - debug: true → Enables console logging for debugging */ static escape(options?: EscapeOptions): boolean; /** * Shows a modal with escape instructions */ private static showEscapeModal; /** * Creates the escape modal element */ private static createModal; /** * Gets platform-specific escape instructions */ private static getEscapeInstructions; /** * Performs the redirect to open in external browser */ private static performRedirect; /** * Executes strategies sequentially with small delays */ private static executeStrategiesSequentially; /** * Gets redirect strategies based on platform and app */ private static getRedirectStrategies; /** * Checks whether the detected browser needs a tap-only Instagram iOS navigation path. */ private static requiresInstagramIOSGesture; /** * Checks whether the browser currently exposes an active user gesture. */ private static hasActiveUserGesture; /** * Opens Instagram iOS external browser from a user tap. * Keep this intentionally simple: copy the URL as a backup, then navigate * synchronously inside the tap so the iOS user gesture is preserved. * No delay, no modal removal, no strategy fallbacks. */ private static openInstagramIOSFromTap; /** * Gets the primary iOS redirect URL for the detected in-app browser. */ private static getIOSRedirectUrl; /** * Closes the escape modal */ private static closeModal; /** * Utility method to copy URL to clipboard */ static copyUrlToClipboard(url?: string): Promise; /** * Shows quick instructions overlay */ private static showQuickInstructions; } export default InAppBrowserEscaper; //# sourceMappingURL=index.d.ts.map