├── .github └── workflows │ ├── lint.yml │ └── publish.yml ├── .gitignore ├── .prettierignore ├── .prettierrc ├── LICENSE ├── README.md ├── package.json ├── src └── index.d.ts └── yarn.lock /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | pull_request: 7 | branches: [master] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | - run: corepack enable 15 | - uses: actions/setup-node@v4 16 | with: 17 | cache: yarn 18 | - run: yarn --immutable 19 | - run: yarn lint 20 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | workflow_dispatch: {} 5 | release: 6 | types: ['created'] 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | environment: npm 12 | steps: 13 | - uses: actions/checkout@v4 14 | - run: corepack enable 15 | - uses: actions/setup-node@v4 16 | with: 17 | cache: yarn 18 | - run: yarn --immutable 19 | - run: yarn npm publish --access public 20 | env: 21 | YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 22 | YARN_NPM_PUBLISH_REGISTRY: 'https://registry.npmjs.org' 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .yarn 3 | .pnp.* 4 | node_modules 5 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | yarn.lock 4 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 90, 3 | "semi": false, 4 | "singleQuote": true, 5 | "trailingComma": "none" 6 | } 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023-2024 Dmitry 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Typings for Telegram Mini Apps

2 | 3 |

4 | Version 5 | License MIT 6 | npm 7 |

8 |

9 | Telegram Bot API Version 8.0 10 |

11 |

12 | CI Lint 13 |

14 | 15 | --- 16 | 17 |

About Telegram Mini Apps

18 | 19 | --- 20 | 21 | ## Usage 22 | 23 | ### Installation 24 | 25 | via `npm` : 26 | 27 | ```bash 28 | npm install telegram-webapps --save-dev 29 | ``` 30 | 31 | via `yarn` : 32 | 33 | ```bash 34 | yarn add -D telegram-webapps 35 | ``` 36 | 37 | via `pnpm` : 38 | 39 | ```bash 40 | pnpm add -D telegram-webapps 41 | ``` 42 | 43 | ### Use typings 44 | 45 | Include the types file inside your [ `tsconfig.json` ](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) file like this: 46 | 47 | ```diff 48 | { 49 | "compilerOptions": { 50 | "types": [ 51 | + "./node_modules/telegram-webapps" 52 | ] 53 | } 54 | } 55 | ``` 56 | 57 | Use `Telegram` constant inside your client-side code to get `WebApp` object: 58 | 59 | ```typescript 60 | // informs the Telegram app that the Web App is ready to be displayed 61 | Telegram.WebApp.ready() 62 | ``` 63 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "telegram-webapps", 3 | "version": "8.0.5", 4 | "description": "Typings for Telegram Mini Apps", 5 | "keywords": [ 6 | "telegram", 7 | "telegram-webapps", 8 | "telegram-web-apps", 9 | "telegram-miniapps", 10 | "telegram-mini-apps", 11 | "telegram-bot", 12 | "typescript", 13 | "types", 14 | "typings" 15 | ], 16 | "homepage": "https://github.com/DavisDmitry/telegram-webapps", 17 | "license": "MIT", 18 | "author": "Dmitry Davis ", 19 | "files": [ 20 | "src" 21 | ], 22 | "types": "src/index.d.ts", 23 | "repository": { 24 | "type": "git", 25 | "url": "https://github.com/DavisDmitry/telegram-webapps.git" 26 | }, 27 | "packageManager": "yarn@4.8.1+sha512.bc946f2a022d7a1a38adfc15b36a66a3807a67629789496c3714dd1703d2e6c6b1c69ff9ec3b43141ac7a1dd853b7685638eb0074300386a59c18df351ef8ff6", 28 | "scripts": { 29 | "lint": "prettier --check src", 30 | "format": "prettier -w src" 31 | }, 32 | "devDependencies": { 33 | "prettier": "^3.5.3", 34 | "typescript": "^5.8.2" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/index.d.ts: -------------------------------------------------------------------------------- 1 | interface BasePopupButton { 2 | /** 3 | * Identifier of the button, 0-64 characters. Set to empty string by 4 | * default. 5 | * 6 | * If the button is pressed, its *id* is returned in the callback and the 7 | * *popupClosed* event. 8 | */ 9 | id?: string 10 | } 11 | 12 | interface DefaultDestructivePopupButton extends BasePopupButton { 13 | /** 14 | * Type of the button. Set to *default* by default. 15 | * 16 | * Can be one of these values: 17 | * - *default*, a button with the default style, 18 | * - *destructive*, a button with a style that indicates a destructive action (e.g. 19 | * “Remove”, “Delete”, etc.). 20 | */ 21 | type?: 'default' | 'destructive' 22 | /** 23 | * The text to be displayed on the button, 0-64 characters. 24 | */ 25 | text: string 26 | } 27 | 28 | interface OkCloseCancelPopupButton extends BasePopupButton { 29 | /** 30 | * Type of the button. 31 | * 32 | * Can be one of these values: 33 | * - *ok*, a button with the localized text “OK”, 34 | * - *close*, a button with the localized text “Close”, 35 | * - *cancel*, a button with the localized text “Cancel”. 36 | */ 37 | type: 'ok' | 'close' | 'cancel' 38 | } 39 | 40 | export declare namespace TelegramWebApps { 41 | /** 42 | * To connect your Web App to the Telegram client, place the script telegram-web-app.js 43 | * in the `` tag before any other scripts, using this code: 44 | * ```html 45 | * 46 | * ``` 47 | * Once the script is connected, a `window.Telegram.WebApp` object will become available 48 | * with the following fields 49 | */ 50 | interface WebApp { 51 | /** 52 | * A string with raw data transferred to the Web App, convenient for validating data. 53 | * 54 | * **WARNING:** Validate data from this field before using it on the bot's server. 55 | */ 56 | readonly initData: string 57 | /** 58 | * An object with input data transferred to the Web App. 59 | * 60 | * **WARNING:** Data from this field should not be trusted. You should only use data 61 | * from initData on the bot's server and only after it has been validated. 62 | */ 63 | readonly initDataUnsafe: WebAppInitData 64 | /** 65 | * The version of the Bot API available in the user's Telegram app. 66 | */ 67 | readonly version: string 68 | /** 69 | * The name of the platform of the user's Telegram app. 70 | */ 71 | readonly platform: 72 | | 'android' 73 | | 'android_x' 74 | | 'ios' 75 | | 'macos' 76 | | 'tdesktop' 77 | | 'weba' 78 | | 'webk' 79 | | 'unigram' 80 | | 'unknown' 81 | /** 82 | * The color scheme currently used in the Telegram app. 83 | * 84 | * Also available as the CSS variable `var(--tg-color-scheme)`. 85 | */ 86 | readonly colorScheme: ColorScheme 87 | /** 88 | * An object containing the current theme settings used in the Telegram app. 89 | */ 90 | readonly themeParams: ThemeParams 91 | /** 92 | * `Bot API 8.0+` *True*, if the Mini App is currently active. *False*, if the Mini 93 | * App is minimized. 94 | */ 95 | readonly isActive: boolean 96 | /** 97 | * *True*, if the Web App is expanded to the maximum available height. *False*, if the 98 | * Web App occupies part of the screen and can be expanded to the full height using 99 | * the **expand()** method. 100 | */ 101 | readonly isExpanded: string 102 | /** 103 | * The current height of the visible area of the Web App. Also available in CSS as 104 | * the variable `var(--tg-viewport-height)`. 105 | * 106 | * The application can display just the top part of the Web App, with its lower part 107 | * remaining outside the screen area. From this position, the user can “pull” the Web 108 | * App to its maximum height, while the bot can do the same by calling the 109 | * **expand()** method. As the position of the Web App changes, the current height 110 | * value of the visible area will be updated in real time. 111 | * 112 | * Please note that the refresh rate of this value is not sufficient to smoothly 113 | * follow the lower border of the window. It should not be used to pin interface 114 | * elements to the bottom of the visible area. It's more appropriate to use the value 115 | * of the `viewportStableHeight` field for this purpose. 116 | */ 117 | readonly viewportHeight: number 118 | /** 119 | * The height of the visible area of the Web App in its last stable state. Also 120 | * available in CSS as a variable `var(--tg-viewport-stable-height)`. 121 | * 122 | * The application can display just the top part of the Web App, with its lower part 123 | * remaining outside the screen area. From this position, the user can “pull” the Web 124 | * App to its maximum height, while the bot can do the same by calling the 125 | * **expand()** method. Unlike the value of `viewportHeight`, the value of 126 | * `viewportStableHeight` does not change as the position of the Web App changes with 127 | * user gestures or during animations. The value of `viewportStableHeight` will be 128 | * updated after all gestures and animations are completed and the Web App reaches its 129 | * final size. 130 | * 131 | * *Note the event `viewportChanged` with the passed parameter `isStateStable=true`, 132 | * which will allow you to track when the stable state of the height of the visible 133 | * area changes.* 134 | */ 135 | readonly viewportStableHeight: number 136 | /** 137 | * Current header color in the `#RRGGBB` format. 138 | */ 139 | readonly headerColor: string 140 | /** 141 | * Current background color in the `#RRGGBB` format. 142 | */ 143 | readonly backgroundColor: string 144 | /** 145 | * Current bottom bar color in the `#RRGGBB` format. 146 | */ 147 | readonly bottomBarColor: string 148 | /** 149 | * *True*, if the confirmation dialog is enabled while the user is trying to close the 150 | * Web App. *False*, if the confirmation dialog is disabled. 151 | */ 152 | readonly isClosingConfirmationEnabled: boolean 153 | /** 154 | * An object representing the device's safe area insets, accounting for system UI 155 | * elements like notches or navigation bars. 156 | */ 157 | readonly safeAreaInset: SafeAreaInset 158 | /** 159 | * An object representing the safe area for displaying content within the app, free 160 | * from overlapping Telegram UI elements. 161 | */ 162 | readonly contentSafeAreaInset: ContentSafeAreaInset 163 | /** 164 | * An object for controlling the back button which can be displayed in the header of 165 | * the Web App in the Telegram interface. 166 | */ 167 | readonly BackButton: BackButton 168 | /** 169 | * An object for controlling the main button, which is displayed at the bottom of the 170 | * Web App in the Telegram interface. 171 | */ 172 | readonly MainButton: BottomButton 173 | /** 174 | * An object for controlling the secondary button, which is displayed at the bottom of 175 | * the Mini App in the Telegram interface. 176 | */ 177 | readonly SecondaryButton: BottomButton 178 | /** 179 | * An object for controlling the Settings item in the context menu of the Mini App in 180 | * the Telegram interface. 181 | */ 182 | readonly SettingsButton: SettingsButton 183 | /** 184 | * An object for controlling haptic feedback. 185 | */ 186 | readonly HapticFeedback: HapticFeedback 187 | /** 188 | * An object for controlling cloud storage. 189 | */ 190 | readonly CloudStorage: CloudStorage 191 | /** 192 | * An object for controlling biometrics on the device. 193 | */ 194 | readonly BiometricManager: BiometricManager 195 | /** 196 | * An object for accessing accelerometer data on the device. 197 | */ 198 | readonly Accelerometer: Accelerometer 199 | /** 200 | * An object for accessing device orientation data on the device. 201 | */ 202 | readonly DeviceOrientation: DeviceOrientation 203 | /** 204 | * An object for accessing gyroscope data on the device. 205 | */ 206 | readonly Gyroscope: Gyroscope 207 | /** 208 | * An object for controlling location on the device 209 | */ 210 | readonly LocationManager: LocationManager 211 | /** 212 | * Returns true if the user's app supports a version of the Bot API that is equal to 213 | * or higher than the version passed as the parameter. 214 | */ 215 | isVersionAtLeast(version: string): boolean 216 | /** 217 | * `Bot API 6.1+` A method that sets the app header color in the `#RRGGBB` format. You 218 | * can also use keywords *bg_color* and *secondary_bg_color*. 219 | * 220 | * Up to `Bot API 6.9` You can only pass *Telegram.WebApp.themeParams.bg_color* or 221 | * *Telegram.WebApp.themeParams.secondary_bg_color* as a color or *bg_color*, 222 | * *secondary_bg_color* keywords. 223 | */ 224 | setHeaderColor(color: string): void 225 | /** 226 | * `Bot API 6.1+` A method that sets the app background color in the `#RRGGBB` format 227 | * or you can use keywords *bg_color*, *secondary_bg_color* instead. 228 | */ 229 | setBackgroundColor(color: string): void 230 | /** 231 | * `Bot API 7.10+` A method that sets the app's bottom bar color in the `#RRGGBB` 232 | * format. You can also use the keywords *bg_color*, *secondary_bg_color* and 233 | * *bottom_bar_bg_color*. 234 | */ 235 | setBottomBarColor(color: string): void 236 | /** 237 | * `Bot API 6.2+` A method that enables a confirmation dialog while the user is trying 238 | * to close the Web App. 239 | */ 240 | enableClosingConfirmation(): void 241 | /** 242 | * `Bot API 6.2+` A method that disables the confirmation dialog while the user is 243 | * trying to close the Web App. 244 | */ 245 | disableClosingConfirmation(): void 246 | /** 247 | * A method that sets the app event handler. 248 | * 249 | * `Bot API 8.0+` Occurs when the Mini App becomes active (e.g., opened from minimized 250 | * state or selected among tabs). 251 | * 252 | * *eventHandler* receives no parameters. 253 | */ 254 | onEvent(eventType: 'activated', callback: () => void): void 255 | /** 256 | * A method that sets the app event handler. 257 | * 258 | * `Bot API 8.0+` Occurs when the Mini App becomes inactive (e.g., minimized or moved 259 | * to an inactive tab). 260 | * 261 | * *eventHandler* receives no parameters. 262 | */ 263 | onEvent(eventType: 'deactivated', callback: () => void): void 264 | /** 265 | * A method that sets the app event handler. 266 | * 267 | * Event occurs whenever theme settings are changed in the user's Telegram app (including 268 | * switching to night mode). 269 | * 270 | * *eventHandler* receives no parameters, new theme settings and color scheme can be 271 | * received via *this.themeParams* and *this.colorScheme* respectively. 272 | */ 273 | onEvent( 274 | eventType: 'themeChanged', 275 | eventHandler: (this: { themeParams: ThemeParams; colorScheme: ColorScheme }) => void 276 | ): void 277 | /** 278 | * A method that sets the app event handler. 279 | * 280 | * Event occurs when the visible section of the Web App is changed. 281 | * 282 | * *eventHandler* receives an object with the single field *isStateStable*. If 283 | * *isStateStable* is true, the resizing of the Web App is finished. If it is false, 284 | * the resizing is ongoing (the user is expanding or collapsing the Web App or an 285 | * animated object is playing). The current value of the visible section’s height is 286 | * available in *this.viewportHeight*. 287 | */ 288 | onEvent(eventType: 'viewportChanged', eventHandler: ViewportChangedEventHandler): void 289 | /** 290 | * A method that sets the app event handler. 291 | * 292 | * `Bot API 8.0+` Occurs when the device's safe area insets change (e.g., due to 293 | * orientation change or screen adjustments). 294 | * 295 | * *eventHandler* receives no parameters. The current inset values can be accessed via 296 | * *this.safeAreaInset*. 297 | */ 298 | onEvent(eventType: 'safeAreaChanged', eventHandler: SafeAreaChangedEventHandler): void 299 | /** 300 | * A method that sets the app event handler. 301 | * 302 | * `Bot API 8.0+` Occurs when the safe area for content changes (e.g., due to 303 | * orientation change or screen adjustments). 304 | * 305 | * *eventHandler* receives no parameters. The current inset values can be accessed via 306 | * *this.contentSafeAreaInset*. 307 | */ 308 | onEvent( 309 | eventType: 'contentSafeAreaChanged', 310 | eventHandler: ContentSafeAreaChangedEventHandler 311 | ): void 312 | /** 313 | * A method that sets the app event handler. 314 | * 315 | * Event occurs when the main button is pressed. 316 | */ 317 | onEvent(eventType: 'mainButtonClicked', eventHandler: () => void): void 318 | /** 319 | * A method that sets the app event handler. 320 | * 321 | * `Bot API 7.10+` Occurs when the secondary button is pressed. 322 | */ 323 | onEvent(eventType: 'secondaryButtonClicked', eventHandler: () => void): void 324 | /** 325 | * A method that sets the app event handler. 326 | * 327 | * `Bot API 6.1+` Event occurrs when the back button is pressed. 328 | */ 329 | onEvent(eventType: 'backButtonClicked', eventHandler: () => void): void 330 | /** 331 | * A method that sets the app event handler. 332 | * 333 | * `Bot API 6.1+` Event occurrs when the Settings item in context menu is pressed. 334 | */ 335 | onEvent(eventType: 'settingsButtonClicked', eventHandler: () => void): void 336 | /** 337 | * A method that sets the app event handler. 338 | * 339 | * `Bot API 6.1+` Event occurrs when the opened invoice is closed. 340 | * 341 | * *eventHandler* receives an object with the two fields: *url* – invoice link 342 | * provided and *status* – one of the invoice statuses: 343 | * - **paid** – invoice was paid successfully, 344 | * - **cancelled** – user closed this invoice without paying, 345 | * - **failed** – user tried to pay, but the payment was failed, 346 | * - **pending** – the payment is still processing. The bot will receive a service 347 | * message about a successful payment when the payment is successfully paid. 348 | */ 349 | onEvent(eventType: 'invoiceClosed', eventHandler: InvoiceClosedEventHandler): void 350 | /** 351 | * A method that sets the app event handler. 352 | * 353 | * `Bot API 6.2+` Event occurrs when the opened popup is closed. 354 | * 355 | * *eventHandler* receives an object with the single field *button_id* – the value of 356 | * the field *id* of the pressed button. If no buttons were pressed, the field 357 | * *button_id* will be *null*. 358 | */ 359 | onEvent(eventType: 'popupClosed', eventHandler: PopupClosedEventHandler): void 360 | /** 361 | * A method that sets the app event handler. 362 | * 363 | * `Bot API 6.4+` Event occurs when the QR code scanner catches a code with text data. 364 | * 365 | * *eventHandler* receives an object with the single field *data* containing text data 366 | * from the QR code. 367 | */ 368 | onEvent(eventType: 'qrTextReceived', eventHandler: QrTextReceivedEventHandler): void 369 | /** 370 | * `Bot API 7.7+` Occurs when the QR code scanner popup is closed by the user. 371 | * 372 | * *eventHandler* receives no parameters. 373 | */ 374 | onEvent(eventType: 'scanQrPopupClosed', eventHandler: () => void): void 375 | /** 376 | * A method that sets the app event handler. 377 | * 378 | * `Bot API 6.4+` Event occurrs when the `readTextFromClipboard` method is called. 379 | * 380 | * *eventHandler* receives an object with the single field *data* containing text data 381 | * from the clipboard. If the clipboard contains non-text data, the field *data* will 382 | * be an empty string. If the Web App has no access to the clipboard, the field *data* 383 | * will be *null*. 384 | */ 385 | onEvent( 386 | eventType: 'clipboardTextReceived', 387 | eventHandler: ClipboardTextReceivedEventHandler 388 | ): void 389 | /** 390 | * A method that sets the app event handler. 391 | * 392 | * `Bot API 6.9+` Occurs when the write permission was requested. 393 | * 394 | * *eventHandler* receives an object with the single field *status* containing one of 395 | * the statuses: 396 | * - **allowed** – user granted write permission to the bot, 397 | * - **cancelled** – user declined this request. 398 | */ 399 | onEvent( 400 | eventType: 'writeAccessRequested', 401 | eventHandler: (status: 'allowed' | 'cancelled') => void 402 | ): void 403 | /** 404 | * A method that sets the app event handler. 405 | * 406 | * `Bot API 6.9+` Occurrs when the user's phone number was requested. 407 | * 408 | * *eventHandler* receives an object with the single field status containing one of 409 | * the statuses: 410 | * - **sent** – user shared their phone number with the bot, 411 | * - **cancelled** – user declined this request. 412 | */ 413 | onEvent( 414 | eventType: 'contactRequested', 415 | eventHandler: (status: 'sent' | 'cancelled') => void 416 | ): void 417 | /** 418 | * A method that sets the app event handler. 419 | * 420 | * `Bot API 7.2+` Occurs whenever `BiometricManager` object is changed 421 | * 422 | * *eventHandler* receives no parameters. 423 | */ 424 | onEvent(eventType: 'biometricManagerUpdated', eventHandler: () => void): void 425 | /** 426 | * A method that sets the app event handler. 427 | * 428 | * `Bot API 7.2+` Occurs whenever biometric authentication was requested. 429 | * 430 | * *eventHandler* receives an object with the field *isAuthenticated* containing a 431 | * boolean indicating whether the user was authenticated successfully. If 432 | * *isAuthenticated* is true, the field *biometricToken() will contain the biometric 433 | * token stored in secure storage on the device. 434 | */ 435 | onEvent( 436 | eventType: 'biometricAuthRequested', 437 | eventHandler: BiometricAuthRequestedEventHandler 438 | ): void 439 | /** 440 | * A method that sets the app event handler. 441 | * 442 | * `Bot API 7.2+` Occurs whenever the biometric token was updated. 443 | * 444 | * *eventHandler* receives an object with the single field *isUpdated*, containing a 445 | * boolean indicating whether the token was updated. 446 | */ 447 | onEvent( 448 | eventType: 'biometricTokenUpdated', 449 | eventHandler: BiometricTokenUpdatedEventHandler 450 | ): void 451 | /** 452 | * A method that sets the app event handler. 453 | * 454 | * `Bot API 8.0+` Occurs whenever the Mini App enters or exits fullscreen mode. 455 | * 456 | * *eventHandler* receives no parameters. The current fullscreen state can be checked 457 | * via *this.isFullscreen*. 458 | */ 459 | onEvent( 460 | eventType: 'fullscreenChanged', 461 | eventHandler: FullscreenChangedEventHandler 462 | ): void 463 | /** 464 | * A method that sets the app event handler. 465 | * 466 | * `Bot API 8.0+` Occurs if a request to enter fullscreen mode fails. 467 | * 468 | * *eventHandler* receives an object with the single field *error, describing the 469 | * reason for the failure. Possible values for error are: 470 | * - **UNSUPPORTED** – Fullscreen mode is not supported on this device or platform. 471 | * - **ALREADY_FULLSCREEN** – The Mini App is already in fullscreen mode. 472 | */ 473 | onEvent( 474 | eventType: 'fullscreenFailed', 475 | eventHandler: FullscreenFailedEventHandler 476 | ): void 477 | /** 478 | * A method that sets the app event handler. 479 | * 480 | * `Bot API 8.0+` Occurs when the Mini App is successfully added to the home screen. 481 | * 482 | * *eventHandler* receives no parameters. 483 | */ 484 | onEvent(eventType: 'homeScreenAdded', eventHandler: () => void): void 485 | /** 486 | * A method that sets the app event handler. 487 | * 488 | * `Bot API 8.0+` Occurs after checking the home screen status. 489 | * 490 | * *eventHandler* receives an object with the field *status*, which is a string 491 | * indicating the current home screen status. Possible values for *status* are: 492 | * - **unsupported** – the feature is not supported, and it is not possible to add the 493 | * icon to the home screen, 494 | * - **unknown** – the feature is supported, and the icon can be added, but it is not 495 | * possible to determine if the icon has already been added, 496 | * - **added** – the icon has already been added to the home screen, 497 | * - **missed** – the icon has not been added to the home screen. 498 | */ 499 | onEvent( 500 | eventType: 'homeScreenChecked', 501 | eventHandler: HomeScreenCheckedEventHandler 502 | ): void 503 | /** 504 | * A method that sets the app event handler. 505 | * 506 | * `Bot API 8.0+` Occurs when accelerometer tracking has started successfully. 507 | * 508 | * *eventHandler* receives no parameters. 509 | */ 510 | onEvent(eventType: 'accelerometerStarted', eventHandler: () => void): void 511 | /** 512 | * A method that sets the app event handler. 513 | * 514 | * `Bot API 8.0+` Occurs when accelerometer tracking has stopped. 515 | * 516 | * *eventHandler* receives no parameters. 517 | */ 518 | onEvent(eventType: 'accelerometerStopped', eventHandler: () => void): void 519 | /** 520 | * A method that sets the app event handler. 521 | * 522 | * `Bot API 8.0`+ Occurs with the specified frequency after calling the `start` 523 | * method, sending the current accelerometer data. 524 | * 525 | * *eventHandler* receives no parameters, the current acceleration values can be 526 | * received via *this.x*, *this.y* and *this.z* respectively. 527 | */ 528 | onEvent( 529 | eventType: 'accelerometerChanged', 530 | eventHandler: AccelerometerChangedEventHandler 531 | ): void 532 | /** 533 | * A method that sets the app event handler. 534 | * 535 | * `Bot API 8.0+` Occurs if a request to start accelerometer tracking fails. 536 | * 537 | * *eventHandler* receives an object with the single field *error*, describing the 538 | * reason for the failure. Possible values for *error* are: 539 | * - **UNSUPPORTED** – Accelerometer tracking is not supported on this device or 540 | * platform. 541 | */ 542 | onEvent( 543 | eventType: 'accelerometerFailed', 544 | eventHandler: AccelerometerFailedEventHandler 545 | ): void 546 | /** 547 | * A method that sets the app event handler. 548 | * 549 | * `Bot API 8.0+` Occurs when device orientation tracking has started successfully. 550 | * 551 | * *eventHandler* receives no parameters. 552 | */ 553 | onEvent(eventType: 'deviceOrientationStarted', eventHandler: () => void): void 554 | /** 555 | * A method that sets the app event handler. 556 | * 557 | * `Bot API 8.0+` Occurs when device orientation tracking has stopped. 558 | * 559 | * *eventHandler* receives no parameters. 560 | */ 561 | onEvent(eventType: 'deviceOrientationStopped', eventHandler: () => void): void 562 | /** 563 | * A method that sets the app event handler. 564 | * 565 | * `Bot API 8.0+` Occurs with the specified frequency after calling the `start` 566 | * method, sending the current orientation data. 567 | * 568 | * *eventHandler* receives no parameters, the current device orientation values can 569 | * be received via *this.alpha*, *this.beta* and *this.gamma* respectively. 570 | */ 571 | onEvent( 572 | eventType: 'deviceOrientationChanged', 573 | eventHandler: DeviceOrientationChangedEventHandler 574 | ): void 575 | /** 576 | * A method that sets the app event handler. 577 | * 578 | * `Bot API 8.0+` Occurs if a request to start device orientation tracking fails. 579 | * 580 | * *eventHandler* receives an object with the single field *error*, describing the 581 | * reason for the failure. Possible values for *error* are: 582 | * - **UNSUPPORTED** – Device orientation tracking is not supported on this device or 583 | * platform. 584 | */ 585 | onEvent( 586 | eventType: 'deviceOrientationFailed', 587 | eventHandler: DeviceOrientationFailedEventHandler 588 | ): void 589 | /** 590 | * A method that sets the app event handler. 591 | * 592 | * `Bot API 8.0+` Occurs when gyroscope tracking has started successfully. 593 | * 594 | * *eventHandler* receives no parameters. 595 | */ 596 | onEvent(eventType: 'gyroscopeStarted', eventHandler: () => void): void 597 | /** 598 | * A method that sets the app event handler. 599 | * 600 | * `Bot API 8.0+` Occurs when gyroscope tracking has stopped. 601 | * 602 | * *eventHandler* receives no parameters. 603 | */ 604 | onEvent(eventType: 'gyroscopeStopped', eventHandler: () => void): void 605 | /** 606 | * A method that sets the app event handler. 607 | * 608 | * `Bot API 8.0+` Occurs with the specified frequency after calling the `start` 609 | * method, sending the current gyroscope data. 610 | * 611 | * *eventHandler* receives no parameters, the current rotation rates can be received 612 | * via *this.x*, *this.y* and *this.z* respectively. 613 | */ 614 | onEvent( 615 | eventType: 'gyroscopeChanged', 616 | eventHandler: GyroscopeChangedEventHandler 617 | ): void 618 | /** 619 | * A method that sets the app event handler. 620 | * 621 | * `Bot API 8.0+` Occurs if a request to start gyroscope tracking fails. 622 | * 623 | * *eventHandler* receives an object with the single field *error*, describing the 624 | * reason for the failure. Possible values for *error* are: 625 | * - **UNSUPPORTED** – Gyroscope tracking is not supported on this device or platform. 626 | */ 627 | onEvent(eventType: 'gyroscopeFailed', eventHandler: GyroscopeFailedEventHandler): void 628 | /** 629 | * A method that sets the app event handler. 630 | * 631 | * `Bot API 8.0+` Occurs whenever LocationManager object is changed. 632 | * 633 | * *eventHandler* receives no parameters. 634 | */ 635 | onEvent(eventType: 'locationManagerUpdated', eventHandler: () => void): void 636 | /** 637 | * A method that sets the app event handler. 638 | * 639 | * `Bot API 8.0+` Occurs when location data is requested. 640 | * 641 | * *eventHandler* receives an object with the single field *locationData* of type 642 | * LocationData, containing the current location information. 643 | */ 644 | onEvent( 645 | eventType: 'locationRequested', 646 | eventHandler: LocationRequestedEventHandler 647 | ): void 648 | /** 649 | * A method that sets the app event handler. 650 | * 651 | * `Bot API 8.0+` Occurs when the message is successfully shared by the user. 652 | * 653 | * *eventHandler* receives no parameters. 654 | */ 655 | onEvent(eventType: 'shareMessageSent', eventHandler: () => void): void 656 | /** 657 | * A method that sets the app event handler. 658 | * 659 | * `Bot API 8.0+` Occurs if sharing the message fails. 660 | * 661 | * *eventHandler* receives an object with the single field *error*, describing the 662 | * reason for the failure. Possible values for *error* are: 663 | * - **UNSUPPORTED** – The feature is not supported by the client. 664 | * - **MESSAGE_EXPIRED** – The message could not be retrieved because it has expired. 665 | * - **MESSAGE_SEND_FAILED** – An error occurred while attempting to send the message. 666 | * - **USER_DECLINED** – The user closed the dialog without sharing the message. 667 | * - **UNKNOWN_ERROR** – An unknown error occurred. 668 | */ 669 | onEvent( 670 | eventType: 'shareMessageFailed', 671 | eventHandler: ShareMessageFailedEventHandler 672 | ): void 673 | /** 674 | * A method that sets the app event handler. 675 | * 676 | * `Bot API 8.0+` Occurs when the emoji status is successfully set. 677 | * 678 | * *eventHandler* receives no parameters. 679 | */ 680 | onEvent(eventType: 'emojiStatusSet', eventHandler: () => void): void 681 | /** 682 | * A method that sets the app event handler. 683 | * 684 | * `Bot API 8.0+` Occurs if setting the emoji status fails. 685 | * 686 | * *eventHandler* receives an object with the single field *error*, describing the 687 | * reason for the failure. Possible values for *error* are: 688 | * - **UNSUPPORTED** – The feature is not supported by the client. 689 | * - **SUGGESTED_EMOJI_INVALID** – One or more emoji identifiers are invalid. 690 | * - **DURATION_INVALID** – The specified duration is invalid. 691 | * - **USER_DECLINED** – The user closed the dialog without setting a status. 692 | * - **SERVER_ERROR** – A server error occurred when attempting to set the status. 693 | * - **UNKNOWN_ERROR** – An unknown error occurred. 694 | */ 695 | onEvent( 696 | eventType: 'emojiStatusFailed', 697 | eventHandler: EmojiStatusFailedEventHandler 698 | ): void 699 | /** 700 | * A method that sets the app event handler. 701 | * 702 | * `Bot API 8.0+` Occurs when the write permission was requested. 703 | * 704 | * *eventHandler* receives an object with the single field *status* containing one of 705 | * the statuses: 706 | * - **allowed** – user granted emoji status permission to the bot, 707 | * - **cancelled** – user declined this request. 708 | */ 709 | onEvent( 710 | eventType: 'emojiStatusAccessRequested', 711 | eventHandler: EmojiStatusAccessRequestedEventHandler 712 | ): void 713 | /** 714 | * A method that sets the app event handler. 715 | * 716 | * `Bot API 8.0+` Occurs when the user responds to the file download request. 717 | * 718 | * *eventHandler* receives an object with the single field *status* containing one of 719 | * the statuses: 720 | * - **downloading** – the file download has started, 721 | * - **cancelled** – user declined this request. 722 | */ 723 | onEvent( 724 | eventType: 'fileDownloadRequested', 725 | eventHandler: FileDownloadRequestedEventHandler 726 | ): void 727 | /** 728 | * A method that deletes a previously set event handler. 729 | */ 730 | offEvent( 731 | eventType: 732 | | 'activated' 733 | | 'deactivated' 734 | | 'themeChanged' 735 | | 'mainButtonClicked' 736 | | 'secondaryButtonClicked' 737 | | 'backButtonClicked' 738 | | 'settingsButtonClicked' 739 | | 'biometricManagerUpdated' 740 | | 'homeScreenAdded' 741 | | 'accelerometerStarted' 742 | | 'accelerometerStopped' 743 | | 'deviceOrientationStarted' 744 | | 'deviceOrientationStopped' 745 | | 'gyroscopeStarted' 746 | | 'gyroscopeStopped' 747 | | 'locationManagerUpdated' 748 | | 'shareMessageSent' 749 | | 'emojiStatusSet', 750 | eventHandler: () => void 751 | ): void 752 | /** 753 | * A method that deletes a previously set event handler. 754 | */ 755 | offEvent( 756 | eventType: 'viewportChanged', 757 | eventHandler: ViewportChangedEventHandler 758 | ): void 759 | /** 760 | * A method that deletes a previously set event handler. 761 | */ 762 | offEvent( 763 | eventType: 'safeAreaChanged', 764 | eventHandler: SafeAreaChangedEventHandler 765 | ): void 766 | /** 767 | * A method that deletes a previously set event handler. 768 | */ 769 | offEvent( 770 | eventType: 'contentSafeAreaChanged', 771 | eventHandler: ContentSafeAreaChangedEventHandler 772 | ): void 773 | /** 774 | * A method that deletes a previously set event handler. 775 | */ 776 | offEvent(eventType: 'invoiceClosed', eventHandler: InvoiceClosedEventHandler): void 777 | /** 778 | * A method that deletes a previously set event handler. 779 | */ 780 | offEvent(eventType: 'popupClosed', eventHandler: PopupClosedEventHandler): void 781 | /** 782 | * A method that deletes a previously set event handler. 783 | */ 784 | offEvent(eventType: 'qrTextReceived', eventHandler: QrTextReceivedEventHandler): void 785 | /** 786 | * A method that deletes a previously set event handler. 787 | */ 788 | offEvent( 789 | eventType: 'clipboardTextReceived', 790 | eventHandler: ClipboardTextReceivedEventHandler 791 | ): void 792 | /** 793 | * A method that deletes a previously set event handler. 794 | */ 795 | offEvent( 796 | eventType: 'biometricAuthRequested', 797 | eventHandler: BiometricAuthRequestedEventHandler 798 | ): void 799 | /** 800 | * A method that deletes a previously set event handler. 801 | */ 802 | offEvent( 803 | eventType: 'biometricTokenUpdated', 804 | eventHandler: BiometricTokenUpdatedEventHandler 805 | ): void 806 | /** 807 | * A method that deletes a previously set event handler. 808 | */ 809 | offEvent( 810 | eventType: 'fullscreenChanged', 811 | eventHandler: FullscreenChangedEventHandler 812 | ): void 813 | /** 814 | * A method that deletes a previously set event handler. 815 | */ 816 | offEvent( 817 | eventType: 'fullscreenFailed', 818 | eventHandler: FullscreenFailedEventHandler 819 | ): void 820 | /** 821 | * A method that deletes a previously set event handler. 822 | */ 823 | offEvent( 824 | eventType: 'homeScreenChecked', 825 | eventHandler: HomeScreenCheckedEventHandler 826 | ): void 827 | /** 828 | * A method that deletes a previously set event handler. 829 | */ 830 | offEvent( 831 | eventType: 'accelerometerChanged', 832 | eventHandler: AccelerometerChangedEventHandler 833 | ): void 834 | /** 835 | * A method that deletes a previously set event handler. 836 | */ 837 | offEvent( 838 | eventType: 'accelerometerFailed', 839 | eventHandler: AccelerometerFailedEventHandler 840 | ): void 841 | /** 842 | * A method that deletes a previously set event handler. 843 | */ 844 | offEvent( 845 | eventType: 'deviceOrientationChanged', 846 | eventHandler: DeviceOrientationChangedEventHandler 847 | ): void 848 | /** 849 | * A method that deletes a previously set event handler. 850 | */ 851 | offEvent( 852 | eventType: 'deviceOrientationFailed', 853 | eventHandler: DeviceOrientationFailedEventHandler 854 | ): void 855 | /** 856 | * A method that deletes a previously set event handler. 857 | */ 858 | offEvent( 859 | eventType: 'gyroscopeChanged', 860 | eventHandler: GyroscopeChangedEventHandler 861 | ): void 862 | /** 863 | * A method that deletes a previously set event handler. 864 | */ 865 | offEvent( 866 | eventType: 'gyroscopeFailed', 867 | eventHandler: GyroscopeFailedEventHandler 868 | ): void 869 | /** 870 | * A method that deletes a previously set event handler. 871 | */ 872 | offEvent( 873 | eventType: 'locationRequested', 874 | eventHandler: LocationRequestedEventHandler 875 | ): void 876 | /** 877 | * A method that deletes a previously set event handler. 878 | */ 879 | offEvent( 880 | eventType: 'shareMessageFailed', 881 | eventHandler: ShareMessageFailedEventHandler 882 | ): void 883 | /** 884 | * A method that deletes a previously set event handler. 885 | */ 886 | offEvent( 887 | eventType: 'emojiStatusFailed', 888 | eventHandler: EmojiStatusFailedEventHandler 889 | ): void 890 | /** 891 | * A method that deletes a previously set event handler. 892 | */ 893 | offEvent( 894 | eventType: 'emojiStatusAccessRequested', 895 | eventHandler: EmojiStatusAccessRequestedEventHandler 896 | ): void 897 | /** 898 | * A method that deletes a previously set event handler. 899 | */ 900 | offEvent( 901 | eventType: 'fileDownloadRequested', 902 | eventHandler: FileDownloadRequestedEventHandler 903 | ): void 904 | /** 905 | * A method used to send data to the bot. When this method is called, a service 906 | * message is sent to the bot containing the data *data* of the length up to 4096 907 | * bytes, and the Web App is closed. See the field *web_app_data* in the class 908 | * Message. 909 | * 910 | * *This method is only available for Web Apps launched via a Keyboard button.* 911 | */ 912 | sendData(data: string): void 913 | /** 914 | * `Bot API 6.7+` A method that inserts the bot's username and the specified inline 915 | * *query* in the current chat's input field. Query may be empty, in which case only 916 | * the bot's username will be inserted. If an optional *choose_chat_types* parameter 917 | * was passed, the client prompts the user to choose a specific chat, then opens that 918 | * chat and inserts the bot's username and the specified inline query in the input 919 | * field. You can specify which types of chats the user will be able to choose from. 920 | */ 921 | switchInlineQuery( 922 | query: string, 923 | choose_chat_types?: ('users' | 'bots' | 'groups' | 'channels')[] 924 | ): void 925 | /** 926 | * A method that opens a link in an external browser. The Web App will *not* be 927 | * closed. 928 | * 929 | * `Bot API 6.4+` If the optional *options* parameter is passed with the field 930 | * *try_instant_view=true*, the link will be opened in Instant View mode if possible. 931 | * 932 | * *Note that this method can be called only in response to user interaction with the 933 | * Web App interface (e.g. a click inside the Web App or on the main button)* 934 | */ 935 | openLink(url: string, options?: { try_instant_view: boolean }): void 936 | /** 937 | * A method that opens a telegram link inside Telegram app. The Web App *will* be 938 | * closed. 939 | */ 940 | openTelegramLink(url: string): void 941 | /** 942 | * `Bot API 6.1+` A method that opens an invoice using the link *url*. The Web App 943 | * will receive the event *invoiceClosed* when the invoice is closed. If an optional 944 | * *callback* parameter was passed, the *callback* function will be called and the 945 | * invoice status will be passed as the first argument. 946 | */ 947 | openInvoice( 948 | url: string, 949 | callback?: (status: 'paid' | 'cancelled' | 'failed' | 'pending') => void 950 | ): void 951 | /** 952 | * `Bot API 7.8+` A method that opens the native story editor with the media specified 953 | * in the *media_url* parameter as an HTTPS URL. An optional *params* argument of the 954 | * type StoryShareParams describes additional sharing settings. 955 | */ 956 | shareToStory(media_url: string, params?: StoryShareParams): void 957 | /** 958 | * `Bot API 8.0+` A method that opens a dialog allowing the user to share a message 959 | * provided by the bot. If an optional *callback* parameter is provided, the 960 | * *callback* function will be called with a boolean as the first argument, indicating 961 | * whether the message was successfully sent. The message id passed to this method 962 | * must belong to a PreparedInlineMessage previously obtained via the Bot API method 963 | * savePreparedInlineMessage. 964 | */ 965 | shareMessage(message_id: string, callback?: (sent: boolean) => void): void 966 | /** 967 | * `Bot API 8.0+` A method that opens a dialog allowing the user to set the specified 968 | * custom emoji as their status. An optional *params* argument of type 969 | * EmojiStatusParams specifies additional settings, such as duration. If an optional 970 | * *callback* parameter is provided, the callback function will be called with a 971 | * boolean as the first argument, indicating whether the status was set. 972 | * 973 | * *Note: this method opens a native dialog and cannot be used to set the emoji status 974 | * without manual user interaction. For fully programmatic changes, you should instead 975 | * use the Bot API method setUserEmojiStatus after obtaining authorization to do so 976 | * via the Mini App method requestEmojiStatusAccess.* 977 | */ 978 | setEmojiStatus( 979 | custom_emoji_id: string, 980 | params?: EmojiStatusParams, 981 | callback?: (set: boolean) => void 982 | ): void 983 | /** 984 | * `Bot API 8.0+` A method that shows a native popup requesting permission for the bot 985 | * to manage user's emoji status. If an optional *callback* parameter was passed, the 986 | * *callback* function will be called when the popup is closed and the first argument 987 | * will be a boolean indicating whether the user granted this access. 988 | */ 989 | requestEmojiStatusAccess(callback?: (accessGranted: boolean) => void): void 990 | /** 991 | * `Bot API 8.0+` A method that displays a native popup prompting the user to download 992 | * a file specified by the *params* argument of type DownloadFileParams. If an 993 | * optional *callback* parameter is provided, the *callback* function will be called 994 | * when the popup is closed, with the first argument as a boolean indicating whether 995 | * the user accepted the download request. 996 | */ 997 | downloadFile(params: DownloadFileParams, callback?: (accepted: boolean) => void): void 998 | /** 999 | * `Bot API 6.2+` A method that shows a native popup described by the *params* 1000 | * argument of the type PopupParams. The Web App will receive the event *popupClosed* 1001 | * when the popup is closed. If an optional *callback* parameter was passed, the 1002 | * *callback* function will be called and the field *id* of the pressed button will be 1003 | * passed as the first argument. 1004 | */ 1005 | showPopup(params: PopupParams, callback?: (id: string) => void): void 1006 | /** 1007 | * `Bot API 6.2+` A method that shows *message* in a simple alert with a 'Close' 1008 | * button. If an optional *callback* parameter was passed, the *callback* function 1009 | * will be called when the popup is closed. 1010 | */ 1011 | showAlert(message: string, callback?: () => void): void 1012 | /** 1013 | * `Bot API 6.2+` A method that shows *message* in a simple confirmation window with 1014 | * 'OK' and 'Cancel' buttons. If an optional *callback* parameter was passed, the 1015 | * *callback* function will be called when the popup is closed and the first argument 1016 | * will be a boolean indicating whether the user pressed the 'OK' button. 1017 | */ 1018 | showConfirm(message: string, callback?: (okPressed: boolean) => void): void 1019 | /** 1020 | * `Bot API 6.4+` A method that shows a native popup for scanning a QR code described 1021 | * by the *params* argument of the type ScanQrPopupParams. The Mini App will receive 1022 | * the event *qrTextReceived* every time the scanner catches a code with text data. If 1023 | * an optional *callback* parameter was passed, the *callback* function will be called 1024 | * and the text from the QR code will be passed as the first argument. Returning 1025 | * *true* inside this callback function causes the popup to be closed. Starting from 1026 | * `Bot API 7.7`, the Mini App will receive the *scanQrPopupClosed* event if the user 1027 | * closes the native popup for scanning a QR code. 1028 | */ 1029 | showScanQrPopup(params: ScanQrPopupParams, callback?: (data: string) => boolean): void 1030 | /** 1031 | * `Bot API 6.4+` A method that closes the native popup for scanning a QR code opened 1032 | * with the *showScanQrPopup* method. Run it if you received valid data in the event 1033 | * *qrTextReceived*. 1034 | */ 1035 | closeScanQrPopup(): void 1036 | /** 1037 | * `Bot API 6.4+` A method that requests text from the clipboard. The Web App will 1038 | * receive the event *clipboardTextReceived*. If an optional *callback* parameter was 1039 | * passed, the *callback* function will be called and the text from the clipboard will 1040 | * be passed as the first argument. 1041 | * 1042 | * *Note: this method can be called only for Web Apps launched from the attachment 1043 | * menu and only in response to a user interaction with the Web App interface (e.g. a 1044 | * click inside the Web App or on the main button).* 1045 | */ 1046 | readTextFromClipboard(callback?: (text: string) => void): void 1047 | /** 1048 | * `Bot API 6.9+` A method that shows a native popup requesting permission for the bot 1049 | * to send messages to the user. If an optional *callback* parameter was passed, the 1050 | * *callback* function will be called when the popup is closed and the first argument 1051 | * will be a boolean indicating whether the user granted this access. 1052 | */ 1053 | requestWriteAccess(callback?: (accessGranted: boolean) => void): void 1054 | /** 1055 | * `Bot API 6.9+` A method that shows a native popup prompting the user for their 1056 | * phone number. If an optional *callback* parameter was passed, the *callback* 1057 | * function will be called when the popup is closed and the first argument will be a 1058 | * boolean indicating whether the user shared its phone number. 1059 | */ 1060 | requestContact(callback?: (phoneNumberShared: boolean) => void): void 1061 | /** 1062 | * A method that informs the Telegram app that the Web App is ready to be displayed. 1063 | * 1064 | * It is recommended to call this method as early as possible, as soon as all 1065 | * essential interface elements are loaded. Once this method is called, the loading 1066 | * placeholder is hidden and the Web App is shown. 1067 | * 1068 | * If the method is not called, the placeholder will be hidden only when the page is 1069 | * fully loaded. 1070 | */ 1071 | ready(): boolean 1072 | /** 1073 | * A method that expands the Web App to the maximum available height. To find out if 1074 | * the Web App is expanded to the maximum height, refer to the value of the 1075 | * *Telegram.WebApp.isExpanded* parameter 1076 | */ 1077 | expand(): void 1078 | /** 1079 | * A method that closes the Web App. 1080 | */ 1081 | close(): void 1082 | /** 1083 | * *True*, if the Mini App is currently being displayed in fullscreen mode. 1084 | */ 1085 | readonly isFullscreen: boolean 1086 | /** 1087 | * *True*, if the Mini App’s orientation is currently locked. *False*, if orientation 1088 | * changes freely based on the device’s rotation. 1089 | */ 1090 | readonly isOrientationLocked: boolean 1091 | /** 1092 | * *True*, if vertical swipes to close or minimize the Mini App are enabled. *False*, 1093 | * if vertical swipes to close or minimize the Mini App are disabled. In any case, the 1094 | * user will still be able to minimize and close the Mini App by swiping the Mini 1095 | * App's header. 1096 | */ 1097 | readonly isVerticalSwipesEnabled: boolean 1098 | /** 1099 | * `Bot API 7.7+` A method that enables vertical swipes to close or minimize the Mini 1100 | * App. For user convenience, it is recommended to always enable swipes unless they 1101 | * conflict with the Mini App's own gestures. 1102 | */ 1103 | enableVerticalSwipes(): void 1104 | /** 1105 | * `Bot API 7.7+` A method that disables vertical swipes to close or minimize the Mini 1106 | * App. This method is useful if your Mini App uses swipe gestures that may conflict 1107 | * with the gestures for minimizing and closing the app. 1108 | */ 1109 | disableVerticalSwipes(): void 1110 | /** 1111 | * `Bot API 8.0+` A method that requests opening the Mini App in fullscreen mode. 1112 | * Although the header is transparent in fullscreen mode, it is recommended that the 1113 | * Mini App sets the header color using the *setHeaderColor* method. This color helps 1114 | * determine a contrasting color for the status bar and other UI controls. 1115 | */ 1116 | requestFullscreen(): void 1117 | /** 1118 | * `Bot API 8.0+` A method that requests exiting fullscreen mode. 1119 | */ 1120 | exitFullscreen(): void 1121 | /** 1122 | * `Bot API 8.0+` A method that locks the Mini App’s orientation to its current mode 1123 | * (either portrait or landscape). Once locked, the orientation remains fixed, 1124 | * regardless of device rotation. This is useful if a stable orientation is needed 1125 | * during specific interactions. 1126 | */ 1127 | lockOrientation(): void 1128 | /** 1129 | * `Bot API 8.0+` A method that unlocks the Mini App’s orientation, allowing it to 1130 | * follow the device's rotation freely. Use this to restore automatic orientation 1131 | * adjustments based on the device orientation. 1132 | */ 1133 | unlockOrientation(): void 1134 | /** 1135 | * `Bot API 8.0+` A method that prompts the user to add the Mini App to the home 1136 | * screen. After successfully adding the icon, the `homeScreenAdded` event will be 1137 | * triggered if supported by the device. Note that if the device cannot determine the 1138 | * installation status, the event may not be received even if the icon has been added. 1139 | */ 1140 | addToHomeScreen(): void 1141 | /** 1142 | * `Bot API 8.0+` A method that checks if adding to the home screen is supported and 1143 | * if the Mini App has already been added. If an optional *callback* parameter is 1144 | * provided, the callback function will be called with a single argument *status*, 1145 | * which is a string indicating the home screen status. Possible values for *status* 1146 | * are: 1147 | * - **unsupported** – the feature is not supported, and it is not possible to add the 1148 | * icon to the home screen, 1149 | * - **unknown** – the feature is supported, and the icon can be added, but it is not 1150 | * possible to determine if the icon has already been added, 1151 | * - **added** – the icon has already been added to the home screen, 1152 | * - **missed** – the icon has not been added to the home screen. 1153 | */ 1154 | checkHomeScreenStatus( 1155 | callback?: (status: 'unsupported' | 'unknown' | 'added' | 'missed') => void 1156 | ): void 1157 | } 1158 | 1159 | /** 1160 | * Web Apps can adjust the appearance of the interface to match the Telegram user's app 1161 | * in real time. This object contains the user's current theme settings 1162 | */ 1163 | interface ThemeParams { 1164 | /** 1165 | * Background color in the `#RRGGBB` format. 1166 | * 1167 | * Also available as the CSS variable `var(--tg-theme-bg-color)`. 1168 | */ 1169 | bg_color?: string 1170 | /** 1171 | * Main text color in the `#RRGGBB` format. 1172 | * 1173 | * Also available as the CSS variable `var(--tg-theme-text-color)`. 1174 | */ 1175 | text_color: string 1176 | /** 1177 | * Hint text color in the `#RRGGBB` format. 1178 | * 1179 | * Also available as the CSS variable `var(--tg-theme-hint-color)`. 1180 | */ 1181 | hint_color?: string 1182 | /** 1183 | * Link color in the `#RRGGBB` format. 1184 | * 1185 | * Also available as the CSS variable `var(--tg-theme-link-color)`. 1186 | */ 1187 | link_color?: string 1188 | /** 1189 | * Button color in the `#RRGGBB` format. 1190 | * 1191 | * Also available as the CSS variable `var(--tg-theme-button-color)`. 1192 | */ 1193 | button_color?: string 1194 | /** 1195 | * Button text color in the `#RRGGBB` format. 1196 | * 1197 | * Also available as the CSS variable `var(--tg-theme-button-text-color)`. 1198 | */ 1199 | button_text_color?: string 1200 | /** 1201 | * `Bot API 6.1+` Secondary background color in the `#RRGGBB` format. 1202 | * 1203 | * Also available as the CSS variable `var(--tg-theme-secondary-bg-color)`. 1204 | */ 1205 | secondary_bg_color?: string 1206 | /** 1207 | * `Bot API 7.0+` Header background color in the `#RRGGBB` format. 1208 | * 1209 | * Also available as the CSS variable `var(--tg-theme-header-bg-color)`. 1210 | */ 1211 | header_bg_color?: string 1212 | /** 1213 | * `Bot API 7.10+` Bottom background color in the `#RRGGBB` format. 1214 | * 1215 | * Also available as the CSS variable `var(--tg-theme-bottom-bar-bg-color)`. 1216 | */ 1217 | bottom_bar_bg_color?: string 1218 | /** 1219 | * `Bot API 7.0+` Accent text color in the `#RRGGBB` format. 1220 | * 1221 | * Also available as the CSS variable `var(--tg-theme-accent-text-color)`. 1222 | */ 1223 | accent_text_color?: string 1224 | /** 1225 | * `Bot API 7.0+` Background color for the section in the `#RRGGBB` format. It is 1226 | * recommended to use this in conjunction with *secondary_bg_color*. 1227 | * 1228 | * Also available as the CSS variable `var(--tg-theme-section-bg-color)`. 1229 | */ 1230 | section_bg_color?: string 1231 | /** 1232 | * `Bot API 7.0+` Header text color for the section in the `#RRGGBB` format. 1233 | * 1234 | * Also available as the CSS variable `var(--tg-theme-section-header-text-color)`. 1235 | */ 1236 | section_header_text_color?: `#${string}` 1237 | /** 1238 | * `Bot API 7.6+` Section separator color in the `#RRGGBB` format. 1239 | * 1240 | * Also available as the CSS variable `var(--tg-theme-section-separator-color)`. 1241 | */ 1242 | section_separator_color?: `#${string}` 1243 | /** 1244 | * `Bot API 7.0+` Subtitle text color in the `#RRGGBB` format. 1245 | * 1246 | * Also available as the CSS variable `var(--tg-theme-subtitle-text-color)`. 1247 | */ 1248 | subtitle_text_color?: string 1249 | /** 1250 | * `Bot API 7.0+` Text color for destructive actions in the `#RRGGBB` format. 1251 | * 1252 | * Also available as the CSS variable `var(--tg-theme-destructive-text-color)`. 1253 | */ 1254 | destructive_text_color?: string 1255 | } 1256 | 1257 | /** 1258 | * This object describes additional sharing settings for the native story editor. 1259 | */ 1260 | interface StoryShareParams { 1261 | /** 1262 | * The caption to be added to the media, 0-200 characters for regular users and 0-2048 1263 | * characters for premium subscribers. 1264 | */ 1265 | text?: string 1266 | /** 1267 | * An object that describes a widget link to be included in the story. Note that only 1268 | * premium subscribers can post stories with links. 1269 | */ 1270 | widget_link?: StoryWidgetLink 1271 | } 1272 | 1273 | /** 1274 | * This object describes a widget link to be included in the story. 1275 | */ 1276 | 1277 | interface StoryWidgetLink { 1278 | /** 1279 | * The URL to be included in the story. 1280 | */ 1281 | url: string 1282 | /** 1283 | * The name to be displayed for the widget link, 0-48 characters. 1284 | */ 1285 | name?: string 1286 | } 1287 | 1288 | /** 1289 | * This object describes the native popup. 1290 | */ 1291 | interface PopupParams { 1292 | /** 1293 | * The text to be displayed in the popup title, 0-64 characters. 1294 | */ 1295 | title?: string 1296 | /** 1297 | * The message to be displayed in the body of the popup, 1-256 characters. 1298 | */ 1299 | message: string 1300 | /** 1301 | * List of buttons to be displayed in the popup, 1-3 buttons. Set to 1302 | * *[{“type”:“close”}]* by default. 1303 | */ 1304 | buttons: PopupButton[] 1305 | } 1306 | 1307 | /** 1308 | * This object describes the native popup for scanning QR codes. 1309 | */ 1310 | interface ScanQrPopupParams { 1311 | /** 1312 | * The text to be displayed under the 'Scan QR' heading, 0-64 characters. 1313 | */ 1314 | text?: string 1315 | } 1316 | 1317 | /** 1318 | * This object describes the native popup button. 1319 | */ 1320 | type PopupButton = DefaultDestructivePopupButton | OkCloseCancelPopupButton 1321 | 1322 | /** 1323 | * This object describes additional settings for setting an emoji status. 1324 | */ 1325 | interface EmojiStatusParams { 1326 | /** 1327 | * The duration for which the status will remain set, in seconds. 1328 | */ 1329 | duration?: number 1330 | } 1331 | 1332 | /** 1333 | * This object describes the parameters for the file download request. 1334 | */ 1335 | interface DownloadFileParams { 1336 | /** 1337 | * The HTTPS URL of the file to be downloaded. 1338 | */ 1339 | url: string 1340 | /** 1341 | * The suggested name for the downloaded file. 1342 | */ 1343 | file_name: string 1344 | } 1345 | 1346 | /** 1347 | * This object represents the system-defined safe area insets, providing padding values 1348 | * to ensure content remains within visible boundaries, avoiding overlap with system UI 1349 | * elements like notches or navigation bars. 1350 | */ 1351 | interface SafeAreaInset { 1352 | /** 1353 | * The top inset in pixels, representing the space to avoid at the top of the screen. 1354 | * Also available as the CSS variable `var(--tg-safe-area-inset-top)`. 1355 | */ 1356 | top: number 1357 | /** 1358 | * The bottom inset in pixels, representing the space to avoid at the bottom of the 1359 | * screen. Also available as the CSS variable `var(--tg-safe-area-inset-bottom)`. 1360 | */ 1361 | bottom: number 1362 | /** 1363 | * The left inset in pixels, representing the space to avoid on the left side of the 1364 | * screen. Also available as the CSS variable `var(--tg-safe-area-inset-left)`. 1365 | */ 1366 | left: number 1367 | /** 1368 | * The right inset in pixels, representing the space to avoid on the right side of the 1369 | * screen. Also available as the CSS variable `var(--tg-safe-area-inset-right)`. 1370 | */ 1371 | right: number 1372 | } 1373 | 1374 | /** 1375 | * This object represents the content-defined safe area insets, providing padding values 1376 | * to ensure content remains within visible boundaries, avoiding overlap with Telegram 1377 | * UI elements. 1378 | */ 1379 | interface ContentSafeAreaInset { 1380 | /** 1381 | * The top inset in pixels, representing the space to avoid at the top of the content 1382 | * area. Also available as the CSS variable `var(--tg-content-safe-area-inset-top)`. 1383 | */ 1384 | top: number 1385 | /** 1386 | * The bottom inset in pixels, representing the space to avoid at the bottom of the 1387 | * content area. Also available as the CSS variable 1388 | * `var(--tg-content-safe-area-inset-bottom)`. 1389 | */ 1390 | bottom: number 1391 | /** 1392 | * The left inset in pixels, representing the space to avoid on the left side of the 1393 | * content area. Also available as the CSS variable 1394 | * `var(--tg-content-safe-area-inset-left)`. 1395 | */ 1396 | left: number 1397 | /** 1398 | * The right inset in pixels, representing the space to avoid on the right side of the 1399 | * content area. Also available as the CSS variable 1400 | * `var(--tg-content-safe-area-inset-right)`. 1401 | */ 1402 | right: number 1403 | } 1404 | 1405 | /** 1406 | * This object controls the back button, which can be displayed in the header of the Web 1407 | * App in the Telegram interface. 1408 | */ 1409 | interface BackButton { 1410 | /** 1411 | * Shows whether the button is visible. Set to *false* by default. 1412 | */ 1413 | isVisible: boolean 1414 | /** 1415 | * `Bot API 6.1+` A method that sets the button press event handler. An alias for 1416 | * `Telegram.WebApp.onEvent('backButtonClicked', callback)` 1417 | */ 1418 | onClick(callback: () => void): BackButton 1419 | /** 1420 | * `Bot API 6.1+` A method that removes the button press event handler. An alias for 1421 | * `Telegram.WebApp.offEvent('backButtonClicked', callback)` 1422 | */ 1423 | offClick(callback: () => void): BackButton 1424 | /** 1425 | * `Bot API 6.1+` A method to make the button active and visible. 1426 | */ 1427 | show(): BackButton 1428 | /** 1429 | * `Bot API 6.1+` A method to hide the button. 1430 | */ 1431 | hide(): BackButton 1432 | } 1433 | 1434 | /** 1435 | * This object controls the button that is displayed at the bottom of the Mini App in 1436 | * the Telegram interface. 1437 | */ 1438 | interface BottomButton { 1439 | /** 1440 | * Type of the button. It can be either *main* for the main button or *secondary* for 1441 | * the secondary button. 1442 | */ 1443 | readonly type: 'main' | 'secondary' 1444 | /** 1445 | * Current button text. Set to *Continue* for the main button and *Cancel* for the 1446 | * secondary button by default. 1447 | */ 1448 | text: string 1449 | /** 1450 | * Current button color. Set to *themeParams.button_color* for the main button and 1451 | * *themeParams.bottom_bar_bg_color* for the secondary button by default. 1452 | */ 1453 | color: string 1454 | /** 1455 | * Current button text color. Set to *themeParams.button_text_color* for the main 1456 | * button and *themeParams.button_color* for the secondary button by default. 1457 | */ 1458 | textColor: string 1459 | /** 1460 | * Shows whether the button is visible. Set to *false* by default. 1461 | */ 1462 | isVisible: boolean 1463 | /** 1464 | * Shows whether the button is active. Set to *true* by default. 1465 | */ 1466 | isActive: boolean 1467 | /** 1468 | * `Bot API 7.10+` Shows whether the button has a shine effect. Set to *false* by 1469 | * default. 1470 | */ 1471 | hasShineEffect: boolean 1472 | /** 1473 | * `Bot API 7.10+` Position of the secondary button. Not defined for the main button. 1474 | * It applies only if both the main and secondary buttons are visible. Set to *left* 1475 | * by default. 1476 | * Supported values: 1477 | * - *left*, displayed to the left of the main button, 1478 | * - *right*, displayed to the right of the main button. 1479 | * - *top*, displayed above the main button, 1480 | * - *bottom*, displayed below the main button. 1481 | */ 1482 | position: 'left' | 'right' | 'top' | 'bottom' 1483 | /** 1484 | * Shows whether the button is displaying a loading indicator. 1485 | */ 1486 | readonly isProgressVisible: boolean 1487 | /** 1488 | * A method to set the button text. 1489 | */ 1490 | setText(text: string): BottomButton 1491 | /** 1492 | * A method that sets the button press event handler. An alias for 1493 | * `Telegram.WebApp.onEvent('mainButtonClicked', callback)` 1494 | */ 1495 | onClick(callback: () => void): BottomButton 1496 | /** 1497 | * A method that removes the button press event handler. An alias for 1498 | * `Telegram.WebApp.offEvent('mainButtonClicked', callback)` 1499 | */ 1500 | offClick(callback: () => void): BottomButton 1501 | /** 1502 | * A method to make the button visible. 1503 | * 1504 | * *Note that opening the Web App from the attachment menu hides the main button until 1505 | * the user interacts with the Web App interface.* 1506 | */ 1507 | show(): BottomButton 1508 | /** 1509 | * A method to hide the button. 1510 | */ 1511 | hide(): BottomButton 1512 | /** 1513 | * A method to enable the button. 1514 | */ 1515 | enable(): BottomButton 1516 | /** 1517 | * A method to disable the button. 1518 | */ 1519 | disable(): BottomButton 1520 | /** 1521 | * A method to show a loading indicator on the button. 1522 | * 1523 | * It is recommended to display loading progress if the action tied to the button may 1524 | * take a long time. By default, the button is disabled while the action is in 1525 | * progress. If the parameter `leaveActive=true` is passed, the button remains 1526 | * enabled. 1527 | */ 1528 | showProgress(leaveActive?: boolean): BottomButton 1529 | /** 1530 | * A method to hide the loading indicator. 1531 | */ 1532 | hideProgress(): BottomButton 1533 | /** 1534 | * A method to set the button parameters. The *params* parameter is an object 1535 | * containing one or several fields that need to be changed: 1536 | * 1537 | * **text** - button text; 1538 | * 1539 | * **color** - button color; 1540 | * 1541 | * **text_color** - button text color; 1542 | * 1543 | * **has_shine_effect** - `Bot API 7.10+` enable shine effect; 1544 | * 1545 | * **position** - `Bot API 7.10+` position of the secondary button; 1546 | * 1547 | * **is_active** - enable the button; 1548 | * 1549 | * **is_visible** - show the button. 1550 | */ 1551 | setParams(params: { 1552 | text?: string 1553 | color?: string 1554 | text_color?: string 1555 | has_shine_effect?: boolean 1556 | position?: 'left' | 'right' | 'top' | 'bottom' 1557 | is_active?: boolean 1558 | is_visible?: boolean 1559 | }): BottomButton 1560 | } 1561 | 1562 | /** 1563 | * This object controls the Settings item in the context menu of the Mini App in the 1564 | * Telegram interface. 1565 | */ 1566 | interface SettingsButton { 1567 | /** 1568 | * Shows whether the context menu item is visible. Set to **false** by default. 1569 | */ 1570 | isVisible: boolean 1571 | /** 1572 | * `Bot API 7.0+` A method that sets the press event handler for the Settings item in 1573 | * the context menu. An alias for 1574 | * `Telegram.WebApp.onEvent('settingsButtonClicked', callback)` 1575 | */ 1576 | onClick(callback: () => void): SettingsButton 1577 | /** 1578 | * `Bot API 7.0+` A method that removes the press event handler from the Settings item 1579 | * in the context menu. An alias for 1580 | * `Telegram.WebApp.offEvent('settingsButtonClicked', callback)` 1581 | */ 1582 | offClick(callback: () => void): SettingsButton 1583 | /** 1584 | * `Bot API 7.0+` A method to make the Settings item in the context menu visible. 1585 | */ 1586 | show(): SettingsButton 1587 | /** 1588 | * `Bot API 7.0+` A method to hide the Settings item in the context menu. 1589 | */ 1590 | hide(): SettingsButton 1591 | } 1592 | 1593 | /** 1594 | * This object controls haptic feedback. 1595 | */ 1596 | interface HapticFeedback { 1597 | /** 1598 | * `Bot API 6.1+` A method tells that an impact occurred. The Telegram app may play 1599 | * the appropriate haptics based on style value passed. Style can be one of these 1600 | * values: 1601 | * - *light*, indicates a collision between small or lightweight UI objects, 1602 | * - *medium*, indicates a collision between medium-sized or medium-weight UI objects, 1603 | * - *heavy*, indicates a collision between large or heavyweight UI objects, 1604 | * - *rigid*, indicates a collision between hard or inflexible UI objects, 1605 | * - *soft*, indicates a collision between soft or flexible UI objects. 1606 | */ 1607 | impactOccurred(style: 'light' | 'medium' | 'heavy' | 'rigid' | 'soft'): HapticFeedback 1608 | /** 1609 | * `Bot API 6.1+` A method tells that a task or action has succeeded, failed, or 1610 | * produced a warning. The Telegram app may play the appropriate haptics based on type 1611 | * value passed. Type can be one of these values: 1612 | * - *error*, indicates that a task or action has failed, 1613 | * - *success*, indicates that a task or action has completed successfully, 1614 | * - *warning*, indicates that a task or action produced a warning. 1615 | */ 1616 | notificationOccurred(type: 'error' | 'success' | 'warning'): HapticFeedback 1617 | /** 1618 | * `Bot API 6.1+` A method tells that the user has changed a selection. The Telegram 1619 | * app may play the appropriate haptics. 1620 | * 1621 | * *Do not use this feedback when the user makes or confirms a selection; use it only 1622 | * when the selection changes.* 1623 | */ 1624 | selectionChanged(): HapticFeedback 1625 | } 1626 | 1627 | /** 1628 | * This object controls the cloud storage. Each bot can store up to 1024 items per user 1629 | * in the cloud storage. 1630 | */ 1631 | interface CloudStorage { 1632 | /** 1633 | * `Bot API 6.9+` A method that stores a value in the cloud storage using the 1634 | * specified key. The key should contain 1-128 characters, only `A-Z`, `a-z`, `0-9`, 1635 | * `_` and `-` are allowed. The value should contain 0-4096 characters. You can store 1636 | * up to 1024 keys in the cloud storage. If an optional *callback* parameter was 1637 | * passed, the *callback* function will be called. In case of an error, the first 1638 | * argument will contain the error. In case of success, the first argument will be 1639 | * *null* and the second argument will be a boolean indicating whether the value was 1640 | * stored. 1641 | */ 1642 | setItem( 1643 | key: string, 1644 | value: string, 1645 | callback?: ((error: Error) => void) | ((error: null, valueStored: boolean) => void) 1646 | ): CloudStorage 1647 | /** 1648 | * `Bot API 6.9+` A method that receives a value from the cloud storage using the 1649 | * specified key. The key should contain 1-128 characters, only `A-Z`, `a-z`, `0-9`, 1650 | * `_` and `-` are allowed. In case of an error, the *callback* function will be 1651 | * called and the first argument will contain the error. In case of success, the first 1652 | * argument will be *null* and the value will be passed as the second argument. 1653 | */ 1654 | getItem( 1655 | key: string, 1656 | callback: ((error: Error) => void) | ((error: null, value: string) => void) 1657 | ): CloudStorage 1658 | /** 1659 | * `Bot API 6.9+` A method that receives values from the cloud storage using the 1660 | * specified keys. The keys should contain 1-128 characters, only `A-Z`, `a-z`, `0-9`, 1661 | * `_` and `-` are allowed. In case of an error, the *callback* function will be 1662 | * called and the first argument will contain the error. In case of success, the first 1663 | * argument will be *null* and the values will be passed as the second argument. 1664 | */ 1665 | getItems( 1666 | keys: string[], 1667 | callback: ((error: Error) => void) | ((error: null, values: string[]) => void) 1668 | ): CloudStorage 1669 | /** 1670 | * `Bot API 6.9+` A method that removes a value from the cloud storage using the 1671 | * specified key. The key should contain 1-128 characters, only `A-Z`, `a-z`, `0-9`, 1672 | * `_` and `-` are allowed. If an optional *callback* parameter was passed, the 1673 | * *callback* function will be called. In case of an error, the first argument will 1674 | * contain the error. In case of success, the first argument will be *null* and the 1675 | * second argument will be a boolean indicating whether the value was removed. 1676 | */ 1677 | removeItem( 1678 | key: string, 1679 | callback?: ((error: Error) => void) | ((error: null, valueRemove: boolean) => void) 1680 | ): CloudStorage 1681 | /** 1682 | * `Bot API 6.9+` A method that removes values from the cloud storage using the 1683 | * specified keys. The keys should contain 1-128 characters, only `A-Z`, `a-z`, `0-9`, 1684 | * `_` and `-` are allowed. If an optional *callback* parameter was passed, the 1685 | * *callback* function will be called. In case of an error, the first argument will 1686 | * contain the error. In case of success, the first argument will be *null* and the 1687 | * second argument will be a boolean indicating whether the values were removed. 1688 | */ 1689 | removeItems( 1690 | keys: string[], 1691 | callback?: 1692 | | ((error: Error) => void) 1693 | | ((error: null, valuesRemoved: boolean) => void) 1694 | ): CloudStorage 1695 | /** 1696 | * `Bot API 6.9+` A method that receives the list of all keys stored in the cloud 1697 | * storage. In case of an error, the *callback* function will be called and the first 1698 | * argument will contain the error. In case of success, the first argument will be 1699 | * *null* and the list of keys will be passed as the second argument. 1700 | */ 1701 | getKeys( 1702 | callback: ((error: Error) => void) | ((error: null, keys: string[]) => void) 1703 | ): CloudStorage 1704 | } 1705 | 1706 | /** 1707 | * This object controls biometrics on the device. Before the first use of this object, 1708 | * it needs to be initialized using the init method. 1709 | */ 1710 | interface BiometricManager { 1711 | /** 1712 | * `Bot API 7.2+` Shows whether biometrics object is initialized. 1713 | */ 1714 | readonly isInited: boolean 1715 | /** 1716 | * `Bot API 7.2+` Shows whether biometrics is available on the current device. 1717 | */ 1718 | readonly isBiometricAvailable: boolean 1719 | /** 1720 | * `Bot API 7.2+` The type of biometrics currently available on the device. 1721 | * 1722 | * Can be one of these values: 1723 | * - *finger*, fingerprint-based biometrics, 1724 | * - *face*, face-based biometrics, 1725 | * - *unknown*, biometrics of an unknown type. 1726 | */ 1727 | readonly biometricType: 'finger' | 'face' | 'unknown' 1728 | /** 1729 | * `Bot API 7.2+` Shows whether permission to use biometrics has been requested. 1730 | */ 1731 | readonly isAccessRequested: boolean 1732 | /** 1733 | * `Bot API 7.2+` Shows whether permission to use biometrics has been granted. 1734 | */ 1735 | readonly isAccessGranted: boolean 1736 | /** 1737 | * `Bot API 7.2+` Shows whether the token is saved in secure storage on the device. 1738 | */ 1739 | readonly isBiometricTokenSaved: boolean 1740 | /** 1741 | * `Bot API 7.2+` A unique device identifier that can be used to match the token to 1742 | * the device. 1743 | */ 1744 | readonly deviceId: string 1745 | /** 1746 | * `Bot API 7.2+` A method that initializes the BiometricManager object. It should be 1747 | * called before the object's first use. If an optional *callback* parameter was 1748 | * passed, the *callback* function will be called when the object is initialized. 1749 | */ 1750 | init(callback?: () => void): BiometricManager 1751 | /** 1752 | * `Bot API 7.2+` A method that requests permission to use biometrics according to the 1753 | * *params* argument of type `BiometricRequestAccessParams`. If an optional *callback* 1754 | * parameter was passed, the *callback* function will be called and the first argument 1755 | * will be a boolean indicating whether the user granted access. 1756 | */ 1757 | requestAccess( 1758 | params: BiometricRequestAccessParams, 1759 | callback?: (accessGranted: boolean) => void 1760 | ): BiometricManager 1761 | /** 1762 | * `Bot API 7.2+` A method that authenticates the user using biometrics according to 1763 | * the *params* argument of type `BiometricAuthenticateParams`. If an optional 1764 | * *callback* parameter was passed, the *callback* function will be called and the 1765 | * first argument will be a boolean indicating whether the user authenticated 1766 | * successfully. If so, the second argument will be a biometric token. 1767 | */ 1768 | authenticate( 1769 | params: BiometricAuthenticateParams, 1770 | callback?: (authenticatedSuccessfully: true, token: string) => void 1771 | ): BiometricManager 1772 | authenticate( 1773 | params: BiometricAuthenticateParams, 1774 | callback?: (authenticatedSuccessfully: false) => void 1775 | ): BiometricManager 1776 | /** 1777 | * `Bot API 7.2+` A method that updates the biometric token in secure storage on the 1778 | * device. To remove the token, pass an empty string. If an optional *callback* 1779 | * parameter was passed, the *callback* function will be called and the first argument 1780 | * will be a boolean indicating whether the token was updated. 1781 | */ 1782 | updateBiometricToken( 1783 | token: string, 1784 | callback?: (tokenPassed: boolean) => void 1785 | ): BiometricManager 1786 | /** 1787 | * `Bot API 7.2+` A method that opens the biometric access settings for bots. Useful 1788 | * when you need to request biometrics access to users who haven't granted it yet. 1789 | * 1790 | * *Note that this method can be called only in response to user interaction with the 1791 | * Mini App interface (e.g. a click inside the Mini App or on the main button)* 1792 | */ 1793 | openSettings(): BiometricManager 1794 | } 1795 | 1796 | /** 1797 | * This object describes the native popup for requesting permission to use biometrics. 1798 | */ 1799 | interface BiometricRequestAccessParams { 1800 | /** 1801 | * The text to be displayed to a user in the popup describing why the bot needs access 1802 | * to biometrics, 0-128 characters. 1803 | */ 1804 | reason?: string 1805 | } 1806 | 1807 | /** 1808 | * This object describes the native popup for authenticating the user using biometrics. 1809 | */ 1810 | interface BiometricAuthenticateParams { 1811 | /** 1812 | * The text to be displayed to a user in the popup describing why you are asking them 1813 | * to authenticate and what action you will be taking based on that authentication, 1814 | * 0-128 characters. 1815 | */ 1816 | reason?: string 1817 | } 1818 | 1819 | /** 1820 | * This object provides access to accelerometer data on the device. 1821 | */ 1822 | interface Accelerometer { 1823 | /** 1824 | * Indicates whether accelerometer tracking is currently active. 1825 | */ 1826 | isStarted: boolean 1827 | /** 1828 | * The current acceleration in the X-axis, measured in m/s². 1829 | */ 1830 | x: number 1831 | /** 1832 | * The current acceleration in the Y-axis, measured in m/s². 1833 | */ 1834 | y: number 1835 | /** 1836 | * The current acceleration in the Z-axis, measured in m/s². 1837 | */ 1838 | z: number 1839 | /** 1840 | * `Bot API 8.0+` Starts tracking accelerometer data using *params* of type 1841 | * AccelerometerStartParams. If an optional *callback* parameter is provided, the 1842 | * *callback* function will be called with a boolean indicating whether tracking was 1843 | * successfully started. 1844 | */ 1845 | start( 1846 | params: AccelerometerParams, 1847 | callback?: (started: boolean) => void 1848 | ): Accelerometer 1849 | /** 1850 | * `Bot API 8.0+` Stops tracking accelerometer data. If an optional *callback* 1851 | * parameter is provided, the *callback* function will be called with a boolean 1852 | * indicating whether tracking was successfully stopped. 1853 | */ 1854 | stop(callback?: (stopped: boolean) => void): Accelerometer 1855 | } 1856 | 1857 | /** 1858 | * This object defines the parameters for starting accelerometer tracking. 1859 | */ 1860 | interface AccelerometerParams { 1861 | /** 1862 | * The refresh rate in milliseconds, with acceptable values ranging from 20 to 1000. 1863 | * Set to 1000 by default. Note that *refresh_rate* may not be supported on all 1864 | * platforms, so the actual tracking frequency may differ from the specified value. 1865 | */ 1866 | refresh_rate?: number 1867 | } 1868 | 1869 | /** 1870 | * This object provides access to orientation data on the device. 1871 | */ 1872 | interface DeviceOrientation { 1873 | /** 1874 | * Indicates whether device orientation tracking is currently active. 1875 | */ 1876 | isStarted: boolean 1877 | /** 1878 | * A boolean that indicates whether or not the device is providing orientation data in 1879 | * absolute values. 1880 | */ 1881 | absolute: boolean 1882 | /** 1883 | * The rotation around the Z-axis, measured in radians. 1884 | */ 1885 | alpha: number 1886 | /** 1887 | * The rotation around the X-axis, measured in radians. 1888 | */ 1889 | beta: number 1890 | /** 1891 | * The rotation around the Y-axis, measured in radians. 1892 | */ 1893 | gamma: number 1894 | /** 1895 | * `Bot API 8.0+` Starts tracking device orientation data using *params* of type 1896 | * DeviceOrientationStartParams. If an optional *callback* parameter is provided, the 1897 | * *callback* function will be called with a boolean indicating whether tracking was 1898 | * successfully started. 1899 | */ 1900 | start( 1901 | params: DeviceOrientationParams, 1902 | callback?: (started: boolean) => void 1903 | ): DeviceOrientation 1904 | /** 1905 | * `Bot API 8.0+` Stops tracking device orientation data. If an optional *callback* 1906 | * parameter is provided, the *callback* function will be called with a boolean 1907 | * indicating whether tracking was successfully stopped. 1908 | */ 1909 | stop(callback?: (stopped: boolean) => void): DeviceOrientation 1910 | } 1911 | 1912 | /** 1913 | * This object defines the parameters for starting device orientation tracking. 1914 | */ 1915 | interface DeviceOrientationParams { 1916 | /** 1917 | * The refresh rate in milliseconds, with acceptable values ranging from 20 to 1000. 1918 | * Set to 1000 by default. Note that *refresh_rate* may not be supported on all 1919 | * platforms, so the actual tracking frequency may differ from the specified value. 1920 | */ 1921 | refresh_rate?: number 1922 | /** 1923 | * Pass *true* to receive absolute orientation data, allowing you to determine the 1924 | * device's attitude relative to magnetic north. Use this option if implementing 1925 | * features like a compass in your app. If relative data is sufficient, pass *false*. 1926 | * Set to *false* by default. 1927 | * 1928 | * **Note**: Keep in mind that some devices may not support absolute orientation data. 1929 | * In such cases, you will receive relative data even if *need_absolute=true* is 1930 | * passed. Check the *DeviceOrientation.absolute* parameter to determine whether the 1931 | * data provided is absolute or relative. 1932 | */ 1933 | need_absolute?: boolean 1934 | } 1935 | 1936 | /** 1937 | * This object provides access to gyroscope data on the device. 1938 | */ 1939 | interface Gyroscope { 1940 | /** 1941 | * Indicates whether gyroscope tracking is currently active. 1942 | */ 1943 | isStarted: boolean 1944 | /** 1945 | * The current rotation rate around the X-axis, measured in rad/s. 1946 | */ 1947 | x: number 1948 | /** 1949 | * The current rotation rate around the Y-axis, measured in rad/s. 1950 | */ 1951 | y: number 1952 | /** 1953 | * The current rotation rate around the Z-axis, measured in rad/s. 1954 | */ 1955 | z: number 1956 | /** 1957 | * `Bot API 8.0+` Starts tracking gyroscope data using *params* of type 1958 | * GyroscopeStartParams. If an optional *callback* parameter is provided, the 1959 | * *callback* function will be called with a boolean indicating whether tracking was 1960 | * successfully started. 1961 | */ 1962 | start(params: GyroscopeParams, callback?: (started: boolean) => void): Gyroscope 1963 | /** 1964 | * `Bot API 8.0+` Stops tracking gyroscope data. If an optional *callback* parameter 1965 | * is provided, the *callback* function will be called with a boolean indicating 1966 | * whether tracking was successfully stopped. 1967 | */ 1968 | stop(callback?: (stopped: boolean) => void): Gyroscope 1969 | } 1970 | 1971 | /** 1972 | * This object defines the parameters for starting gyroscope tracking. 1973 | */ 1974 | interface GyroscopeParams { 1975 | /** 1976 | * The refresh rate in milliseconds, with acceptable values ranging from 20 to 1000. 1977 | * Set to 1000 by default. Note that *refresh_rate* may not be supported on all 1978 | * platforms, so the actual tracking frequency may differ from the specified value. 1979 | */ 1980 | refresh_rate?: number 1981 | } 1982 | 1983 | /** 1984 | * This object controls location access on the device. Before the first use of this 1985 | * object, it needs to be initialized using the *init* method. 1986 | */ 1987 | interface LocationManager { 1988 | /** 1989 | * Shows whether the LocationManager object has been initialized. 1990 | */ 1991 | isInited: boolean 1992 | /** 1993 | * Shows whether location services are available on the current device. 1994 | */ 1995 | isLocationAvailable: boolean 1996 | /** 1997 | * Shows whether permission to use location has been requested. 1998 | */ 1999 | isAccessRequested: boolean 2000 | /** 2001 | * Shows whether permission to use location has been granted. 2002 | */ 2003 | isAccessGranted: boolean 2004 | /** 2005 | * `Bot API 8.0+` A method that initializes the LocationManager object. It should be 2006 | * called before the object's first use. If an optional *callback* parameter is 2007 | * provided, the callback function will be called when the object is initialized. 2008 | */ 2009 | init(callback?: () => void): LocationManager 2010 | /** 2011 | * `Bot API 8.0+` A method that requests location data. The *callback* function will 2012 | * be called with *null* as the first argument if access to location was not granted, 2013 | * or an object of type LocationData as the first argument if access was successful. 2014 | */ 2015 | getLocation(callback: (data: LocationData | null) => void): LocationManager 2016 | /** 2017 | * `Bot API 8.0+` A method that opens the location access settings for bots. Useful 2018 | * when you need to request location access from users who haven't granted it yet. 2019 | * 2020 | * *Note that this method can be called only in response to user interaction with the 2021 | * Mini App interface (e.g., a click inside the Mini App or on the main button).* 2022 | */ 2023 | openSettings(): LocationManager 2024 | } 2025 | 2026 | /** 2027 | * This object contains data about the current location. 2028 | */ 2029 | interface LocationData { 2030 | /** 2031 | * Latitude in degrees. 2032 | */ 2033 | latitude: number 2034 | /** 2035 | * Longitude in degrees. 2036 | */ 2037 | longitude: number 2038 | /** 2039 | * Altitude above sea level in meters. *null* if altitude data is not available on 2040 | * the device. 2041 | */ 2042 | altitude: number | null 2043 | /** 2044 | * The direction the device is moving in degrees (0 = North, 90 = East, 180 = South, 2045 | * 270 = West). *null* if course data is not available on the device. 2046 | */ 2047 | course: number | null 2048 | /** 2049 | * The speed of the device in m/s. *null* if speed data is not available on the 2050 | * device. 2051 | */ 2052 | speed: number | null 2053 | /** 2054 | * Accuracy of the latitude and longitude values in meters. *null* if horizontal 2055 | * accuracy data is not available on the device. 2056 | */ 2057 | horizontal_accuracy: number | null 2058 | /** 2059 | * Accuracy of the altitude value in meters. *null* if vertical accuracy data is not 2060 | * available on the device. 2061 | */ 2062 | vertical_accuracy: number | null 2063 | /** 2064 | * Accuracy of the course value in degrees. *null* if course accuracy data is not 2065 | * available on the device. 2066 | */ 2067 | course_accuracy: number | null 2068 | /** 2069 | * Accuracy of the speed value in m/s. *null* if speed accuracy data is not available 2070 | * on the device. 2071 | */ 2072 | speed_accuracy: number | null 2073 | } 2074 | 2075 | /** 2076 | * This object contains data that is transferred to the Web App when it is opened. It is 2077 | * empty if the Web App was launched from a keyboard button. 2078 | */ 2079 | interface WebAppInitData { 2080 | /** 2081 | * A unique identifier for the Web App session, required for sending messages via the 2082 | * answerWebAppQuery method. 2083 | */ 2084 | readonly query_id?: string 2085 | /** 2086 | * An object containing data about the current user. 2087 | */ 2088 | readonly user?: WebAppUser 2089 | /** 2090 | * An object containing data about the chat partner of the current user in the chat 2091 | * where the bot was launched via the attachment menu. Returned only for private chats 2092 | * and only for Web Apps launched via the attachment menu. 2093 | */ 2094 | readonly receiver?: WebAppUser 2095 | /** 2096 | * An object containing data about the chat where the bot was launched via the 2097 | * attachment menu. Returned for supergroups, channels and group chats – only for Web 2098 | * Apps launched via the attachment menu. 2099 | */ 2100 | readonly chat?: WebAppChat 2101 | /** 2102 | * Type of the chat from which the Mini App was opened. Can be either “sender” for a 2103 | * private chat with the user opening the link, “private”, “group”, “supergroup”, or 2104 | * “channel”. Returned only for Mini Apps launched from direct links. 2105 | */ 2106 | readonly chat_type?: 'sender' | 'private' | 'group' | 'supergroup' | 'channel' 2107 | /** 2108 | * Global identifier, uniquely corresponding to the chat from which the Mini App was 2109 | * opened. Returned only for Mini Apps launched from a direct link. 2110 | */ 2111 | readonly chat_instance?: string 2112 | /** 2113 | * The value of the *startattach* parameter, passed via link. Only returned for Web 2114 | * Apps when launched from the attachment menu via link. 2115 | * 2116 | * The value of the `start_param` parameter will also be passed in the GET-parameter 2117 | * `tgWebAppStartParam`, so the Web App can load the correct interface right away. 2118 | */ 2119 | readonly start_param?: string 2120 | /** 2121 | * Time in seconds, after which a message can be sent via the answerWebAppQuery 2122 | * method. 2123 | */ 2124 | readonly can_send_after?: number 2125 | /** 2126 | * Unix time when the form was opened. 2127 | */ 2128 | readonly auth_date: number 2129 | /** 2130 | * A hash of all passed parameters, which the bot server can use to check their 2131 | * validity. 2132 | */ 2133 | readonly hash: string 2134 | } 2135 | 2136 | /** 2137 | * This object contains the data of the Web App user. 2138 | */ 2139 | interface WebAppUser { 2140 | /** 2141 | * A unique identifier for the user or bot. This number may have more than 32 2142 | * significant bits and some programming languages may have difficulty/silent defects 2143 | * in interpreting it. It has at most 52 significant bits, so a 64-bit integer or a 2144 | * double-precision float type is safe for storing this identifier. 2145 | */ 2146 | readonly id: number 2147 | /** 2148 | * *True*, if this user is a bot. Returns in the receiver field only. 2149 | */ 2150 | readonly is_bot?: boolean 2151 | /** 2152 | * First name of the user or bot. 2153 | */ 2154 | readonly first_name: string 2155 | /** 2156 | * Last name of the user or bot. 2157 | */ 2158 | readonly last_name?: string 2159 | /** 2160 | * Username of the user or bot. 2161 | */ 2162 | readonly username?: string 2163 | /** 2164 | * IETF language tag of the user's language. Returns in user field only. 2165 | */ 2166 | readonly language_code?: string 2167 | /** 2168 | * *True*, if this user is a Telegram Premium user 2169 | */ 2170 | readonly is_premium?: true 2171 | /** 2172 | * *True*, if this user added the bot to the attachment menu. 2173 | */ 2174 | readonly added_to_attachment_menu?: true 2175 | /** 2176 | * *True*, if this user allowed the bot to message them. 2177 | */ 2178 | readonly allows_write_to_pm?: true 2179 | /** 2180 | * URL of the user’s profile photo. The photo can be in .jpeg or .svg formats. 2181 | */ 2182 | readonly photo_url?: string 2183 | } 2184 | 2185 | /** 2186 | * This object represents a chat. 2187 | */ 2188 | interface WebAppChat { 2189 | /** 2190 | * Unique identifier for this chat. This number may have more than 32 significant bits 2191 | * and some programming languages may have difficulty/silent defects in interpreting 2192 | * it. But it has at most 52 significant bits, so a signed 64-bit integer or 2193 | * double-precision float type are safe for storing this identifier. 2194 | */ 2195 | readonly id: number 2196 | /** 2197 | * Type of chat 2198 | */ 2199 | readonly type: 'group' | 'supergroup' | 'channel' 2200 | /** 2201 | * Title of the chat 2202 | */ 2203 | readonly title: string 2204 | /** 2205 | * Username of the chat 2206 | */ 2207 | readonly username?: string 2208 | /** 2209 | * URL of the chat’s photo. The photo can be in .jpeg or .svg formats. Only returned 2210 | * for Web Apps launched from the attachment menu. 2211 | */ 2212 | readonly photo_url?: string 2213 | } 2214 | 2215 | type ColorScheme = 'light' | 'dark' 2216 | type ViewportChangedEventHandler = ( 2217 | this: { viewportHeight: number }, 2218 | params: { isStateStable: boolean } 2219 | ) => void 2220 | type SafeAreaChangedEventHandler = (this: { safeAreInset: SafeAreaInset }) => void 2221 | type ContentSafeAreaChangedEventHandler = (this: { 2222 | contentSafeAreaInset: ContentSafeAreaInset 2223 | }) => void 2224 | type InvoiceClosedEventHandler = (params: { 2225 | url: string 2226 | status: 'paid' | 'cancelled' | 'failed' | 'pending' 2227 | }) => void 2228 | type PopupClosedEventHandler = (params: { button_id: string | null }) => void 2229 | type QrTextReceivedEventHandler = (params: { data: string }) => void 2230 | type ClipboardTextReceivedEventHandler = (params: { data: string | null }) => void 2231 | type BiometricAuthRequestedEventHandler = ( 2232 | params: { isAuthenticated: true; biometricToken: string } | { isAuthenticated: false } 2233 | ) => void 2234 | type BiometricTokenUpdatedEventHandler = (params: { isUpdated: boolean }) => void 2235 | type FullscreenChangedEventHandler = (this: { isFullscreen: boolean }) => void 2236 | type FullscreenFailedEventHandler = (params: { 2237 | error: 'UNSUPPORTED' | 'ALREADY_FULLSCREEN' 2238 | }) => void 2239 | type HomeScreenCheckedEventHandler = (params: { 2240 | status: 'unsupported' | 'unknown' | 'added' | 'missed' 2241 | }) => void 2242 | type AccelerometerChangedEventHandler = (this: { 2243 | x: number 2244 | y: number 2245 | z: number 2246 | }) => void 2247 | type AccelerometerFailedEventHandler = (params: { error: 'UNSUPPORTED' }) => void 2248 | type DeviceOrientationChangedEventHandler = (this: { 2249 | alpha: number 2250 | beta: number 2251 | gamma: number 2252 | }) => void 2253 | type DeviceOrientationFailedEventHandler = (params: { error: 'UNSUPPORTED' }) => void 2254 | type GyroscopeChangedEventHandler = (this: { x: number; y: number; z: number }) => void 2255 | type GyroscopeFailedEventHandler = (params: { error: 'UNSUPPORTED' }) => void 2256 | type LocationRequestedEventHandler = (params: { locationData: LocationData }) => void 2257 | type ShareMessageFailedEventHandler = (params: { 2258 | error: 2259 | | 'UNSUPPORTED' 2260 | | 'MESSAGE_EXPIRED' 2261 | | 'MESSAGE_SEND_FAILED' 2262 | | 'USER_DECLINED' 2263 | | 'UNKNOWN_ERROR' 2264 | }) => void 2265 | type EmojiStatusFailedEventHandler = (params: { 2266 | error: 2267 | | 'UNSUPPORTED' 2268 | | 'SUGGESTED_EMOJI_INVALID' 2269 | | 'DURATION_INVALID' 2270 | | 'USER_DECLINED' 2271 | | 'SERVER_ERROR' 2272 | | 'UNKNOWN_ERROR' 2273 | }) => void 2274 | type EmojiStatusAccessRequestedEventHandler = (params: { 2275 | status: 'allowed' | 'cancelled' 2276 | }) => void 2277 | type FileDownloadRequestedEventHandler = (params: { 2278 | status: 'downloading' | 'cancelled' 2279 | }) => void 2280 | } 2281 | 2282 | declare global { 2283 | const Telegram: { WebApp: TelegramWebApps.WebApp } 2284 | } 2285 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # This file is generated by running "yarn install" inside your project. 2 | # Manual changes might be lost - proceed with caution! 3 | 4 | __metadata: 5 | version: 8 6 | cacheKey: 10c0 7 | 8 | "prettier@npm:^3.5.3": 9 | version: 3.5.3 10 | resolution: "prettier@npm:3.5.3" 11 | bin: 12 | prettier: bin/prettier.cjs 13 | checksum: 10c0/3880cb90b9dc0635819ab52ff571518c35bd7f15a6e80a2054c05dbc8a3aa6e74f135519e91197de63705bcb38388ded7e7230e2178432a1468005406238b877 14 | languageName: node 15 | linkType: hard 16 | 17 | "telegram-webapps@workspace:.": 18 | version: 0.0.0-use.local 19 | resolution: "telegram-webapps@workspace:." 20 | dependencies: 21 | prettier: "npm:^3.5.3" 22 | typescript: "npm:^5.8.2" 23 | languageName: unknown 24 | linkType: soft 25 | 26 | "typescript@npm:^5.8.2": 27 | version: 5.8.2 28 | resolution: "typescript@npm:5.8.2" 29 | bin: 30 | tsc: bin/tsc 31 | tsserver: bin/tsserver 32 | checksum: 10c0/5c4f6fbf1c6389b6928fe7b8fcd5dc73bb2d58cd4e3883f1d774ed5bd83b151cbac6b7ecf11723de56d4676daeba8713894b1e9af56174f2f9780ae7848ec3c6 33 | languageName: node 34 | linkType: hard 35 | 36 | "typescript@patch:typescript@npm%3A^5.8.2#optional!builtin": 37 | version: 5.8.2 38 | resolution: "typescript@patch:typescript@npm%3A5.8.2#optional!builtin::version=5.8.2&hash=5786d5" 39 | bin: 40 | tsc: bin/tsc 41 | tsserver: bin/tsserver 42 | checksum: 10c0/5448a08e595cc558ab321e49d4cac64fb43d1fa106584f6ff9a8d8e592111b373a995a1d5c7f3046211c8a37201eb6d0f1566f15cdb7a62a5e3be01d087848e2 43 | languageName: node 44 | linkType: hard 45 | --------------------------------------------------------------------------------