Files
bedolaga-cabinet/src/vite-env.d.ts
c0mrade 7413837faf feat(cabinet): bulletproof Close button + kill the /login flash on the service-unavailable screen
Two Telegram-Mini-App follow-ups to the backend-unavailable screen:

- Reliable "Close" button (Telegram only) that actually EXITS the Mini App
  instead of routing back. closeTelegramApp() tries the legacy
  window.Telegram.WebApp.close() global (telegram-web-app.js), then the SDK
  closeMiniApp(), then the raw postEvent('web_app_close') — all emit the same
  close event, so it can't silently fail. Guarded so the first path never
  silently no-ops.
- Eliminate the flash of the /login page before the outage screen. On the
  bootstrap path (the app has never reached the backend) reportPossibleBackendDown()
  now flips the screen IMMEDIATELY and synchronously instead of waiting on the
  confirm probe, so the overlay is up before isLoading flips and /login can never
  paint uncovered. Add an eager checkBackendOnStartup() liveness ping at launch
  (parallel with auth) so even the no-stored-token / fresh-Telegram path that
  makes no early request shows the screen at once. The confirm-probe still guards
  already-loaded sessions from a one-off blip.

i18n close key added in ru/en/zh/fa.
2026-06-04 13:06:05 +03:00

46 lines
1.3 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;
/** Optional override for the backend liveness URL (defaults to `<origin>/health/unified`). */
readonly VITE_HEALTH_URL?: 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;
/** Closes the Mini App (injected by telegram-web-app.js). */
close?: () => 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;
};
}