telegram-webapps-types-new
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -6,2 +6,8 @@ export declare namespace TelegramWebApps { | ||
type openLinkOptions = { | ||
try_instant_view?: Boolean; | ||
} | ||
type IInvoiceStatus = 'paid' | 'cancelled' | 'failed' | 'pending'; | ||
type IEventTypes = { | ||
@@ -13,3 +19,3 @@ themeChanged: () => void; | ||
settingsButtonClicked: () => void; | ||
invoiceClosed: (event: { url: string; status: 'paid' | 'cancelled' | 'failed' | 'pending' }) => void; | ||
invoiceClosed: (event: { url: string; status: IInvoiceStatus }) => void; | ||
popupClosed: (event: { button_id: string | null }) => void; | ||
@@ -132,3 +138,3 @@ qrTextReceived: (event: { data: string }) => void; | ||
*/ | ||
offEvent<K extends keyof IEventTypes>(eventType: K, eventHandler: () => void): void; | ||
offEvent<K extends keyof IEventTypes>(eventType: K, callback: IEventTypes[K]): void; | ||
/** | ||
@@ -141,3 +147,3 @@ * A method used to send data to the bot. | ||
*/ | ||
sendData(data: any): void; | ||
sendData(data: string): void; | ||
/** | ||
@@ -179,3 +185,3 @@ * A method that inserts the bot's username and the specified inline query in the current chat's input field. | ||
*/ | ||
openInvoice(url: string, callback?: (invoice_status: string) => void): void; | ||
openInvoice(url: string, callback?: (invoice_status: IInvoiceStatus) => void): void; | ||
/** | ||
@@ -251,2 +257,6 @@ * Bot API 6.2+ | ||
/** | ||
* Mini Apps can adjust the appearance of the interface to match the Telegram user's app in real time. | ||
* This object contains the user's current theme settings | ||
*/ | ||
interface ThemeParams { | ||
@@ -326,4 +336,51 @@ /** | ||
destructive_text_color?: string; | ||
} | ||
} | ||
interface PopupParams { | ||
/** | ||
* Optional. The text to be displayed in the popup title, 0-64 characters. | ||
*/ | ||
title?: String; | ||
/** | ||
* The message to be displayed in the body of the popup, 1-256 characters. | ||
*/ | ||
message: String; | ||
/** | ||
* Optional. List of buttons to be displayed in the popup, 1-3 buttons. | ||
* Set to [{“type”:“close”}] by default. | ||
*/ | ||
buttons?: PopupButton[]; | ||
} | ||
interface ScanQrPopupParams { | ||
/** | ||
* Optional. The text to be displayed under the 'Scan QR' heading, 0-64 characters. | ||
*/ | ||
text?: String; | ||
} | ||
interface PopupButton { | ||
/** | ||
* Optional. Identifier of the button, 0-64 characters. | ||
* Set to empty string by default. | ||
* If the button is pressed, its id is returned in the callback and the popupClosed event. | ||
*/ | ||
id?: String; | ||
/** | ||
* Optional. Type of the button. Set to default by default. | ||
* Can be one of these values: | ||
* - default, a button with the default style, | ||
* - ok, a button with the localized text “OK”, | ||
* - close, a button with the localized text “Close”, | ||
* - cancel, a button with the localized text “Cancel”, | ||
* - destructive, a button with a style that indicates a destructive action (e.g. “Remove”, “Delete”, etc.). | ||
*/ | ||
type?: "default" | "ok" | "close" | "cancel" | "destructive"; | ||
/** | ||
* Optional. The text to be displayed on the button, 0-64 characters. | ||
* Required if type is default or destructive. Irrelevant for other types. | ||
*/ | ||
text?: String; | ||
} | ||
interface BackButton { | ||
@@ -680,54 +737,2 @@ /** | ||
} | ||
interface PopupParams { | ||
/** | ||
* Optional. The text to be displayed in the popup title, 0-64 characters. | ||
*/ | ||
title?: String; | ||
/** | ||
* The message to be displayed in the body of the popup, 1-256 characters. | ||
*/ | ||
message: String; | ||
/** | ||
* Optional. List of buttons to be displayed in the popup, 1-3 buttons. | ||
* Set to [{“type”:“close”}] by default. | ||
*/ | ||
buttons?: PopupButton[]; | ||
} | ||
interface PopupButton { | ||
/** | ||
* Optional. Identifier of the button, 0-64 characters. | ||
* Set to empty string by default. | ||
* If the button is pressed, its id is returned in the callback and the popupClosed event. | ||
*/ | ||
id?: String; | ||
/** | ||
* Optional. Type of the button. Set to default by default. | ||
* Can be one of these values: | ||
* - default, a button with the default style, | ||
* - ok, a button with the localized text “OK”, | ||
* - close, a button with the localized text “Close”, | ||
* - cancel, a button with the localized text “Cancel”, | ||
* - destructive, a button with a style that indicates a destructive action (e.g. “Remove”, “Delete”, etc.). | ||
*/ | ||
type?: String; | ||
/** | ||
* Optional. The text to be displayed on the button, 0-64 characters. | ||
* Required if type is default or destructive. Irrelevant for other types. | ||
*/ | ||
text?: String; | ||
} | ||
interface ScanQrPopupParams { | ||
/** | ||
* Optional. The text to be displayed under the 'Scan QR' heading, 0-64 characters. | ||
*/ | ||
text?: String; | ||
} | ||
interface openLinkOptions { | ||
try_instant_view?: Boolean; | ||
} | ||
} | ||
@@ -734,0 +739,0 @@ |
{ | ||
"name": "telegram-webapps-types-new", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "TypeScript typings for Telegram Web Apps for Bots. See https://core.telegram.org/bots/webapps", | ||
@@ -5,0 +5,0 @@ "scripts": { |
33591
714