Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Bot API version 7.7 #20

Merged
merged 1 commit into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<a href="https://npmjs.com/package/telegram-webapps"><img alt="npm" src="https://img.shields.io/npm/dt/telegram-webapps"/></a>
</p>
<p align="center">
<a href="https://core.telegram.org/bots/webapps"><img alt="Telegram Bot API Version 7.6" src="https://img.shields.io/badge/Telegram%20Bot%20API-7.6-blue.svg?logo=telegram"/></a>
<a href="https://core.telegram.org/bots/webapps"><img alt="Telegram Bot API Version 7.7" src="https://img.shields.io/badge/Telegram%20Bot%20API-7.7-blue.svg?logo=telegram"/></a>
</p>
<p align="center">
<a href="https://github.com/DavisDmitry/telegram-webapps/actions/workflows/lint.yml"><img alt="CI Lint" src="https://github.com/DavisDmitry/telegram-webapps/actions/workflows/lint.yml/badge.svg"/></a>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "telegram-webapps",
"version": "7.6.0",
"version": "7.7.0",
"description": "Typings for Telegram Mini Apps",
"keywords": [
"telegram",
Expand Down
31 changes: 29 additions & 2 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,12 @@ export declare namespace TelegramWebApps {
* from the QR code.
*/
onEvent(eventType: 'qrTextReceived', eventHandler: QrTextReceivedEventHandler): void
/**
* `Bot API 7.7+` Occurs when the QR code scanner popup is closed by the user.
*
* *eventHandler* receives no parameters.
*/
onEvent(eventType: 'scanQrPopupClosed', eventHandler: () => void): void
/**
* A method that sets the app event handler.
*
Expand Down Expand Up @@ -462,11 +468,13 @@ export declare namespace TelegramWebApps {
showConfirm(message: string, callback?: (okPressed: boolean) => void): void
/**
* `Bot API 6.4+` A method that shows a native popup for scanning a QR code described
* by the *params* argument of the type ScanQrPopupParams. The Web App will receive
* by the *params* argument of the type ScanQrPopupParams. The Mini App will receive
* the event *qrTextReceived* every time the scanner catches a code with text data. If
* an optional *callback* parameter was passed, the *callback* function will be called
* and the text from the QR code will be passed as the first argument. Returning
* *true* inside this callback function causes the popup to be closed.
* *true* inside this callback function causes the popup to be closed. Starting from
* `Bot API 7.7`, the Mini App will receive the *scanQrPopupClosed* event if the user
* closes the native popup for scanning a QR code.
*/
showScanQrPopup(params: ScanQrPopupParams, callback?: (data: string) => boolean): void
/**
Expand Down Expand Up @@ -521,6 +529,25 @@ export declare namespace TelegramWebApps {
* A method that closes the Web App.
*/
close(): void
/**
* *True*, if vertical swipes to close or minimize the Mini App are enabled. *False*,
* if vertical swipes to close or minimize the Mini App are disabled. In any case, the
* user will still be able to minimize and close the Mini App by swiping the Mini
* App's header.
*/
readonly isVerticalSwipesEnabled: boolean
/**
* `Bot API 7.7+` A method that enables vertical swipes to close or minimize the Mini
* App. For user convenience, it is recommended to always enable swipes unless they
* conflict with the Mini App's own gestures.
*/
enableVerticalSwipes(): void
/**
* `Bot API 7.7+` A method that disables vertical swipes to close or minimize the Mini
* App. This method is useful if your Mini App uses swipe gestures that may conflict
* with the gestures for minimizing and closing the app.
*/
disableVerticalSwipes(): void
}

/**
Expand Down