From 0d79268b00a58402147299c57ce86aaf1d7098db Mon Sep 17 00:00:00 2001 From: Dmitry <56270217+DavisDmitry@users.noreply.github.com> Date: Sun, 7 Jul 2024 16:47:30 +0500 Subject: [PATCH] Update Bot API version 7.7 (#20) --- README.md | 2 +- package.json | 2 +- src/index.d.ts | 31 +++++++++++++++++++++++++++++-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index dbe6a87..5247770 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ npm

-Telegram Bot API Version 7.6 +Telegram Bot API Version 7.7

CI Lint diff --git a/package.json b/package.json index b8b8299..bea95a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "telegram-webapps", - "version": "7.6.0", + "version": "7.7.0", "description": "Typings for Telegram Mini Apps", "keywords": [ "telegram", diff --git a/src/index.d.ts b/src/index.d.ts index ef547a0..06603cc 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -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. * @@ -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 /** @@ -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 } /**