export {};
declare global {
interface TelegramWebApp {
openLink(url: string): void;
openTelegramLink(url: string): void;
close(): void;
expand(): void;
ready(): void;
sendData(data: string): void;
showAlert(message: string, callback?: () => void): void;
showConfirm(message: string, callback?: (confirmed: boolean) => void): void;
MainButton: {
text: string;
color: string;
textColor: string;
isVisible: boolean;
isActive: boolean;
setText(text: string): void;
show(): void;
hide(): void;
onClick(callback: () => void): void;
offClick(callback: () => void): void;
};
BackButton: {
isVisible: boolean;
show(): void;
hide(): void;
onClick(callback: () => void): void;
};
initData: string;
initDataUnsafe: {
user?: {
id: number;
first_name: string;
last_name?: string;
username?: string;
language_code?: string;
};
auth_date?: number;
hash?: string;
};
colorScheme: 'light' | 'dark';
themeParams: {
bg_color?: string;
text_color?: string;
hint_color?: string;
link_color?: string;
button_color?: string;
button_text_color?: string;
secondary_bg_color?: string;
};
isExpanded: boolean;
viewportHeight: number;
viewportStableHeight: number;
platform: string;
version: string;
}
interface Window {
Telegram: {
WebApp: TelegramWebApp;
};
}
}
// Расширяем глобальный тип Telegram
declare global {
const Telegram: {
WebApp: TelegramWebApp;
};
}