import { defineBoot } from '#q-app/wrappers'
import type { WebApp } from "@twa-dev/types"

declare global {
  interface Window {
    Telegram: {
      WebApp: WebApp
    }
  }
}

export default defineBoot(({ app }) => {
  if (window.Telegram?.WebApp) {
    const webApp = window.Telegram.WebApp
    webApp.ready()
    app.config.globalProperties.$tg = webApp
    app.provide('tg', webApp)
  }
})
