UNPKG

@dfsol/platform-detector

Version:

Universal platform detector for web, PWA, TWA, Telegram Mini Apps, Capacitor.js, and native mobile applications with @tma.js SDK support

73 lines 1.87 kB
/** * @tma.js SDK integration utilities * Supports @tma.js/sdk package */ /** * Interface for @tma.js SDK */ export interface TmaJsSdkInstance { initData?: { raw: () => string | undefined; parsed: any; }; miniApp?: { ready: () => void; headerColor?: string; backgroundColor?: string; platform?: string; }; viewport?: { height: number; stableHeight: number; isExpanded: boolean; }; themeParams?: { backgroundColor?: string; textColor?: string; hintColor?: string; linkColor?: string; buttonColor?: string; buttonTextColor?: string; }; version?: string; } /** * Check if @tma.js SDK is available */ export declare function isTmaJsSdkAvailable(): boolean; /** * Try to get @tma.js SDK instance * Returns null if SDK is not available */ export declare function getTmaJsSdk(): TmaJsSdkInstance | null; /** * Check if running in Telegram Mini App via @tma.js SDK * Flexible detection for both web and native Telegram apps */ export declare function isTelegramViaTmaJs(): boolean; /** * Get Telegram platform from @tma.js SDK */ export declare function getTelegramPlatformFromTmaJs(): string | null; /** * Get init data from @tma.js SDK */ export declare function getTelegramInitDataFromTmaJs(): string | null; /** * Get viewport info from @tma.js SDK */ export declare function getViewportFromTmaJs(): { height: number; stableHeight: number; isExpanded: boolean; } | null; /** * Get theme params from @tma.js SDK */ export declare function getThemeParamsFromTmaJs(): Record<string, string> | null; /** * Initialize @tma.js SDK if available * This should be called early in the app lifecycle */ export declare function initializeTmaJs(): boolean; //# sourceMappingURL=tma-sdk.d.ts.map