mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
- Replace unsafe `as` cast with runtime type guard - Pass client_id as Number() per Telegram OIDC spec - Update TypeScript type to string | number
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
/// <reference types="vite/client" />
|
|
|
|
declare const __APP_VERSION__: string;
|
|
|
|
interface ImportMetaEnv {
|
|
readonly VITE_API_URL: string;
|
|
readonly VITE_TELEGRAM_BOT_USERNAME?: string;
|
|
readonly VITE_APP_NAME?: string;
|
|
readonly VITE_APP_LOGO?: string;
|
|
}
|
|
|
|
interface ImportMeta {
|
|
readonly env: ImportMetaEnv;
|
|
}
|
|
|
|
/** Telegram WebApp global — available when running inside Telegram Mini App */
|
|
interface TelegramWebAppGlobal {
|
|
onEvent?: (event: string, callback: () => void) => void;
|
|
offEvent?: (event: string, callback: () => void) => void;
|
|
}
|
|
|
|
/** Telegram Login JS SDK — loaded from https://oauth.telegram.org/js/telegram-login.js */
|
|
interface TelegramLoginGlobal {
|
|
init: (
|
|
options: {
|
|
client_id: string | number;
|
|
request_access?: string[];
|
|
lang?: string;
|
|
},
|
|
callback: (data: { id_token?: string; user?: Record<string, unknown>; error?: string }) => void,
|
|
) => void;
|
|
open: () => void;
|
|
auth: () => void;
|
|
}
|
|
|
|
interface Window {
|
|
Telegram?: {
|
|
WebApp?: TelegramWebAppGlobal;
|
|
Login?: TelegramLoginGlobal;
|
|
};
|
|
}
|