fix(miniapp): bundle telegram webapp sdk

This commit is contained in:
2026-03-11 16:21:22 +04:00
parent e211ab9391
commit 69a914711f
4 changed files with 12 additions and 24 deletions

View File

@@ -1,31 +1,12 @@
export interface TelegramWebAppUser {
id: number
first_name?: string
username?: string
language_code?: string
}
import WebApp from '@twa-dev/sdk'
export interface TelegramWebApp {
initData: string
initDataUnsafe?: {
user?: TelegramWebAppUser
}
ready?: () => void
expand?: () => void
}
declare global {
interface Window {
Telegram?: {
WebApp?: TelegramWebApp
}
}
}
export type TelegramWebApp = typeof WebApp
export type TelegramWebAppUser = NonNullable<NonNullable<TelegramWebApp['initDataUnsafe']>['user']>
export function getTelegramWebApp(): TelegramWebApp | undefined {
if (typeof window === 'undefined') {
return undefined
}
return window.Telegram?.WebApp
return WebApp
}