@types/telegram-web-app 9.0.0 → 9.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- telegram-web-app/README.md +2 -2
- telegram-web-app/index.d.ts +411 -295
- telegram-web-app/package.json +8 -3
telegram-web-app/README.md
CHANGED
|
@@ -8,8 +8,8 @@ This package contains type definitions for telegram-web-app (https://telegram.or
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/telegram-web-app.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Mon, 01 Dec 2025 21:01:57 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
|
|
14
14
|
# Credits
|
|
15
|
-
These definitions were written by [KnorpelSenf](https://github.com/KnorpelSenf), [MKRhere](https://github.com/MKRhere),
|
|
15
|
+
These definitions were written by [KnorpelSenf](https://github.com/KnorpelSenf), [MKRhere](https://github.com/MKRhere), [deptyped](https://github.com/deptyped), and [sidorko](https://github.com/sidorko).
|
telegram-web-app/index.d.ts
CHANGED
|
@@ -12,208 +12,338 @@ export interface Telegram {
|
|
|
12
12
|
|
|
13
13
|
export interface WebApp {
|
|
14
14
|
/**
|
|
15
|
-
* A string with raw data transferred to the Web App,
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* A string with raw data transferred to the Web App,
|
|
16
|
+
* convenient for {@link https://core.telegram.org/bots/webapps#validating-data-received-via-the-mini-app| validating data}.
|
|
17
|
+
*
|
|
18
|
+
* **WARNING:** {@link https://core.telegram.org/bots/webapps#validating-data-received-via-the-mini-app| Validate data} from this field before using it on the bot's server.
|
|
18
19
|
*/
|
|
19
20
|
initData: string;
|
|
21
|
+
|
|
20
22
|
/**
|
|
21
|
-
* An object with input data transferred to the
|
|
22
|
-
*
|
|
23
|
-
*
|
|
23
|
+
* An object with input data transferred to the Mini App.
|
|
24
|
+
*
|
|
25
|
+
* **WARNING:** Data from this field should not be trusted.
|
|
26
|
+
* You should only use data from {@link initData} on the bot's server and only after it has been {@link https://core.telegram.org/bots/webapps#validating-data-received-via-the-mini-app| validated}.
|
|
24
27
|
*/
|
|
25
28
|
initDataUnsafe: WebAppInitData;
|
|
29
|
+
|
|
26
30
|
/**
|
|
27
31
|
* The version of the Bot API available in the user's Telegram app.
|
|
28
32
|
*/
|
|
29
33
|
version: string;
|
|
34
|
+
|
|
30
35
|
/**
|
|
31
36
|
* The name of the platform of the user's Telegram app.
|
|
32
37
|
*/
|
|
33
38
|
platform: string;
|
|
39
|
+
|
|
34
40
|
/**
|
|
35
|
-
* The color scheme currently used in the Telegram app.
|
|
36
|
-
* “dark”.
|
|
41
|
+
* The color scheme currently used in the Telegram app.
|
|
42
|
+
* Either “light” or “dark”.
|
|
43
|
+
*
|
|
44
|
+
* @see available as the CSS variable `var(--tg-color-scheme)`.
|
|
37
45
|
*/
|
|
38
46
|
colorScheme: "light" | "dark";
|
|
47
|
+
|
|
39
48
|
/**
|
|
40
49
|
* An object containing the current theme settings used in the Telegram app.
|
|
41
50
|
*/
|
|
42
51
|
themeParams: ThemeParams;
|
|
52
|
+
|
|
43
53
|
/**
|
|
44
|
-
*
|
|
54
|
+
* *True*, if the Mini App is currently active.
|
|
55
|
+
* *False*, if the Mini App is minimized.
|
|
45
56
|
*
|
|
46
|
-
*
|
|
47
|
-
* False, if the Mini App is minimized.
|
|
57
|
+
* @since Bot API 8.0+
|
|
48
58
|
*/
|
|
49
59
|
isActive: boolean;
|
|
60
|
+
|
|
50
61
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* full height using the expand() method.
|
|
62
|
+
* *True*, if the Mini App is expanded to the maximum available height.
|
|
63
|
+
* (False*, if the Mini App occupies part of the screen and can be expanded to the full height using the {@link expand| expand()} method.
|
|
54
64
|
*/
|
|
55
65
|
isExpanded: boolean;
|
|
66
|
+
|
|
56
67
|
/**
|
|
57
|
-
* The current height of the visible area of the
|
|
58
|
-
*
|
|
68
|
+
* The current height of the visible area of the Mini App.
|
|
69
|
+
*
|
|
70
|
+
* The application can display just the top part of the Mini App,
|
|
71
|
+
* with its lower part remaining outside the screen area.
|
|
72
|
+
* From this position, the user can “pull” the Mini App to its maximum height,
|
|
73
|
+
* while the bot can do the same by calling the {@link expand| expand()} method.
|
|
74
|
+
* As the position of the Mini App changes,
|
|
75
|
+
* the current height value of the visible area will be updated in real time.
|
|
59
76
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* the same by calling the expand() method. As the position of the Web App
|
|
64
|
-
* changes, the current height value of the visible area will be updated in
|
|
65
|
-
* real time.
|
|
77
|
+
* Please note that the refresh rate of this value is not sufficient to smoothly follow the lower border of the window.
|
|
78
|
+
* It should not be used to pin interface elements to the bottom of the visible area.
|
|
79
|
+
* It's more appropriate to use the value of the {@link viewportStableHeight} field for this purpose.
|
|
66
80
|
*
|
|
67
|
-
*
|
|
68
|
-
* smoothly follow the lower border of the window. It should not be used to
|
|
69
|
-
* pin interface elements to the bottom of the visible area. It's more
|
|
70
|
-
* appropriate to use the value of the viewportStableHeight field for this
|
|
71
|
-
* purpose.
|
|
81
|
+
* @see Available in CSS as the variable `var(--tg-viewport-height)`.
|
|
72
82
|
*/
|
|
73
83
|
viewportHeight: number;
|
|
84
|
+
|
|
74
85
|
/**
|
|
75
|
-
* The height of the visible area of the
|
|
76
|
-
*
|
|
86
|
+
* The height of the visible area of the Mini App in its last stable state.
|
|
87
|
+
*
|
|
88
|
+
* The application can display just the top part of the Mini App,
|
|
89
|
+
* with its lower part remaining outside the screen area.
|
|
90
|
+
* From this position, the user can “pull” the Mini App to its maximum height,
|
|
91
|
+
* while the bot can do the same by calling the {@link expand| expand()} method.
|
|
92
|
+
* Unlike the value of {@link viewportHeight}, the value of {@link viewportStableHeight} does not change as the position of the Mini App changes with user gestures or during animations.
|
|
93
|
+
* The value of {@link viewportStableHeight} will be updated after all gestures and animations are completed and the Mini App reaches its final size.
|
|
77
94
|
*
|
|
78
|
-
* The
|
|
79
|
-
*
|
|
80
|
-
* user can “pull” the Web App to its maximum height, while the bot can do
|
|
81
|
-
* the same by calling the expand() method. Unlike the value of
|
|
82
|
-
* viewportHeight, the value of viewportStableHeight does not change as the
|
|
83
|
-
* position of the Web App changes with user gestures or during animations.
|
|
84
|
-
* The value of viewportStableHeight will be updated after all gestures and
|
|
85
|
-
* animations are completed and the Web App reaches its final size.
|
|
95
|
+
* @remarks The event viewportChanged with the passed parameter `isStateStable=true`,
|
|
96
|
+
* which will allow you to track when the stable state of the height of the visible area changes.
|
|
86
97
|
*
|
|
87
|
-
*
|
|
88
|
-
* isStateStable=true, which will allow you to track when the stable state
|
|
89
|
-
* of the height of the visible area changes.
|
|
98
|
+
* @see Available in CSS as a variable `var(--tg-viewport-stable-height)`.
|
|
90
99
|
*/
|
|
91
100
|
viewportStableHeight: number;
|
|
101
|
+
|
|
92
102
|
/**
|
|
93
|
-
* Current header color in the
|
|
103
|
+
* Current header color in the `#RRGGBB` format.
|
|
94
104
|
*/
|
|
95
105
|
headerColor: string;
|
|
106
|
+
|
|
96
107
|
/**
|
|
97
|
-
* Current background color in the
|
|
108
|
+
* Current background color in the `#RRGGBB` format.
|
|
98
109
|
*/
|
|
99
110
|
backgroundColor: string;
|
|
111
|
+
|
|
100
112
|
/**
|
|
101
|
-
* Current bottom bar color in the
|
|
113
|
+
* Current bottom bar color in the `#RRGGBB` format.
|
|
102
114
|
*/
|
|
103
115
|
bottomBarColor: string;
|
|
116
|
+
|
|
104
117
|
/**
|
|
105
|
-
* True
|
|
106
|
-
*
|
|
118
|
+
* *True*, if the confirmation dialog is enabled while the user is trying to close the Mini App.
|
|
119
|
+
* *False*, if the confirmation dialog is disabled.
|
|
107
120
|
*/
|
|
108
121
|
isClosingConfirmationEnabled: boolean;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* *True*, if vertical swipes to close or minimize the Mini App are enabled.
|
|
125
|
+
* *False*, if vertical swipes to close or minimize the Mini App are disabled.
|
|
126
|
+
* In any case, the user will still be able to minimize and close the Mini App by swiping the Mini App's header.
|
|
127
|
+
*/
|
|
128
|
+
isVerticalSwipesEnabled: boolean;
|
|
129
|
+
|
|
109
130
|
/**
|
|
110
|
-
* True
|
|
131
|
+
* *True*, if the Mini App is currently being displayed in fullscreen mode.
|
|
111
132
|
*/
|
|
112
133
|
isFullscreen: boolean;
|
|
134
|
+
|
|
113
135
|
/**
|
|
114
|
-
* True
|
|
115
|
-
* False
|
|
136
|
+
* *True*, if the Mini App’s orientation is currently locked.
|
|
137
|
+
* *False*, if orientation changes freely based on the device’s rotation.
|
|
116
138
|
*/
|
|
117
139
|
isOrientationLocked: boolean;
|
|
140
|
+
|
|
118
141
|
/**
|
|
119
142
|
* An object representing the device's safe area insets,
|
|
120
143
|
* accounting for system UI elements like notches or navigation bars.
|
|
121
144
|
*/
|
|
122
145
|
safeAreaInset: SafeAreaInset;
|
|
146
|
+
|
|
123
147
|
/**
|
|
124
148
|
* An object representing the safe area for displaying content within the app,
|
|
125
149
|
* free from overlapping Telegram UI elements.
|
|
126
150
|
*/
|
|
127
151
|
contentSafeAreaInset: ContentSafeAreaInset;
|
|
152
|
+
|
|
128
153
|
/**
|
|
129
|
-
* An object for controlling the back button
|
|
130
|
-
* header of the
|
|
154
|
+
* An object for controlling the back button,
|
|
155
|
+
* which can be displayed in the header of the Mini App in the Telegram interface.
|
|
131
156
|
*/
|
|
132
157
|
BackButton: BackButton;
|
|
158
|
+
|
|
133
159
|
/**
|
|
134
|
-
* An object for controlling the main button,
|
|
135
|
-
* bottom of the
|
|
160
|
+
* An object for controlling the main button,
|
|
161
|
+
* which is displayed at the bottom of the Mini App in the Telegram interface.
|
|
136
162
|
*/
|
|
137
163
|
MainButton: BottomButton;
|
|
164
|
+
|
|
138
165
|
/**
|
|
139
166
|
* An object for controlling the secondary button,
|
|
140
167
|
* which is displayed at the bottom of the Mini App in the Telegram interface.
|
|
141
168
|
*/
|
|
142
169
|
SecondaryButton: BottomButton;
|
|
170
|
+
|
|
143
171
|
/**
|
|
144
|
-
* An object for controlling the Settings item in the context menu of the
|
|
145
|
-
* Mini App in the Telegram interface.
|
|
172
|
+
* An object for controlling the Settings item in the context menu of the Mini App in the Telegram interface.
|
|
146
173
|
*/
|
|
147
174
|
SettingsButton: SettingsButton;
|
|
175
|
+
|
|
148
176
|
/**
|
|
149
177
|
* An object for controlling haptic feedback.
|
|
150
178
|
*/
|
|
151
179
|
HapticFeedback: HapticFeedback;
|
|
180
|
+
|
|
152
181
|
/**
|
|
153
182
|
* An object for controlling cloud storage.
|
|
154
183
|
*/
|
|
155
184
|
CloudStorage: CloudStorage;
|
|
185
|
+
|
|
156
186
|
/**
|
|
157
187
|
* An object for controlling biometrics on the device.
|
|
158
188
|
*/
|
|
159
189
|
BiometricManager: BiometricManager;
|
|
190
|
+
|
|
160
191
|
/**
|
|
161
|
-
* An object for accessing
|
|
192
|
+
* An object for accessing accelerometer data on the device.
|
|
162
193
|
*/
|
|
163
194
|
Accelerometer: Accelerometer;
|
|
195
|
+
|
|
164
196
|
/**
|
|
165
197
|
* An object for accessing device orientation data on the device.
|
|
166
198
|
*/
|
|
167
199
|
DeviceOrientation: DeviceOrientation;
|
|
200
|
+
|
|
168
201
|
/**
|
|
169
202
|
* An object for accessing gyroscope data on the device.
|
|
170
203
|
*/
|
|
171
204
|
Gyroscope: Gyroscope;
|
|
205
|
+
|
|
172
206
|
/**
|
|
173
207
|
* An object for controlling location on the device.
|
|
174
208
|
*/
|
|
175
209
|
LocationManager: LocationManager;
|
|
210
|
+
|
|
176
211
|
/**
|
|
177
212
|
* An object for storing and retrieving data from the device's local storage.
|
|
178
213
|
*/
|
|
179
214
|
DeviceStorage: DeviceStorage;
|
|
215
|
+
|
|
180
216
|
/**
|
|
181
217
|
* An object for storing and retrieving data from the device's secure storage.
|
|
182
218
|
*/
|
|
183
219
|
SecureStorage: SecureStorage;
|
|
220
|
+
|
|
184
221
|
/**
|
|
185
|
-
* Returns true if the user's app supports a version of the Bot API
|
|
186
|
-
* equal to or higher than the version passed as the parameter.
|
|
222
|
+
* Returns true if the user's app supports a version of the Bot API
|
|
223
|
+
* that is equal to or higher than the version passed as the parameter.
|
|
187
224
|
*/
|
|
188
225
|
isVersionAtLeast(version: string): boolean;
|
|
226
|
+
|
|
189
227
|
/**
|
|
190
228
|
* A method that sets the app header color in the `#RRGGBB` format.
|
|
191
|
-
* You can also use keywords bg_color and secondary_bg_color
|
|
229
|
+
* You can also use keywords `bg_color` and `secondary_bg_color`.
|
|
230
|
+
*
|
|
231
|
+
* Up to Bot API 6.9 You can only pass Telegram.WebApp.themeParams.bg_color
|
|
232
|
+
* or Telegram.WebApp.themeParams.secondary_bg_color as a color
|
|
233
|
+
* or bg_color, secondary_bg_color keywords.
|
|
234
|
+
*
|
|
235
|
+
* @since Bot API 6.1+
|
|
192
236
|
*/
|
|
193
237
|
setHeaderColor(color: "bg_color" | "secondary_bg_color" | (string & {})): void;
|
|
238
|
+
|
|
194
239
|
/**
|
|
195
|
-
* A method that sets the app background color in the `#RRGGBB` format
|
|
196
|
-
*
|
|
240
|
+
* A method that sets the app background color in the `#RRGGBB` format.
|
|
241
|
+
* You can also use keywords `bg_color` and `secondary_bg_color`.
|
|
242
|
+
*
|
|
243
|
+
* @since Bot API 6.1+
|
|
197
244
|
*/
|
|
198
245
|
setBackgroundColor(color: "bg_color" | "secondary_bg_color" | "bottom_bar_bg_color" | (string & {})): void;
|
|
246
|
+
|
|
199
247
|
/**
|
|
200
|
-
* A method that sets the app's bottom bar color in the
|
|
201
|
-
* You can also use the keywords bg_color
|
|
248
|
+
* A method that sets the app's bottom bar color in the `#RRGGBB` format.
|
|
249
|
+
* You can also use the keywords `bg_color`, `secondary_bg_color`, and `bottom_bar_bg_color`.
|
|
250
|
+
* This color is also applied to the navigation bar on Android.
|
|
251
|
+
*
|
|
252
|
+
* @since Bot API 7.10+
|
|
202
253
|
*/
|
|
203
254
|
setBottomBarColor(color: "bg_color" | "secondary_bg_color" | (string & {})): void;
|
|
255
|
+
|
|
204
256
|
/**
|
|
205
|
-
* A method that enables a confirmation dialog while the user is trying to
|
|
206
|
-
*
|
|
257
|
+
* A method that enables a confirmation dialog while the user is trying to close the Mini App.
|
|
258
|
+
*
|
|
259
|
+
* @since Bot API 6.2+
|
|
207
260
|
*/
|
|
208
261
|
enableClosingConfirmation(): void;
|
|
262
|
+
|
|
209
263
|
/**
|
|
210
|
-
* A method that disables the confirmation dialog while the user is trying
|
|
211
|
-
*
|
|
264
|
+
* A method that disables the confirmation dialog while the user is trying to close the Mini App.
|
|
265
|
+
*
|
|
266
|
+
* @since Bot API 6.2+
|
|
212
267
|
*/
|
|
213
268
|
disableClosingConfirmation(): void;
|
|
269
|
+
|
|
214
270
|
/**
|
|
215
|
-
* A method that
|
|
216
|
-
*
|
|
271
|
+
* A method that enables vertical swipes to close or minimize the Mini App.
|
|
272
|
+
* For user convenience, it is recommended to always enable swipes unless they conflict with the Mini App's own gestures.
|
|
273
|
+
*
|
|
274
|
+
* @since Bot API 7.7+
|
|
275
|
+
*/
|
|
276
|
+
enableVerticalSwipes(): void;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* A method that disables vertical swipes to close or minimize the Mini App.
|
|
280
|
+
* This method is useful if your Mini App uses swipe gestures that may conflict with the gestures for minimizing and closing the app.
|
|
281
|
+
*
|
|
282
|
+
* @since Bot API 7.7+
|
|
283
|
+
*/
|
|
284
|
+
disableVerticalSwipes(): void;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* A method that requests opening the Mini App in fullscreen mode.
|
|
288
|
+
* Although the header is transparent in fullscreen mode,
|
|
289
|
+
* it is recommended that the Mini App sets the header color using the setHeaderColor method.
|
|
290
|
+
* This color helps determine a contrasting color for the status bar and other UI controls.
|
|
291
|
+
*
|
|
292
|
+
* @since Bot API 8.0+
|
|
293
|
+
*/
|
|
294
|
+
requestFullscreen(): void;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* A method that requests exiting fullscreen mode.
|
|
298
|
+
*
|
|
299
|
+
* @since Bot API 8.0+
|
|
300
|
+
*/
|
|
301
|
+
exitFullscreen(): void;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* A method that locks the Mini App’s orientation to its current mode (either portrait or landscape).
|
|
305
|
+
* Once locked, the orientation remains fixed, regardless of device rotation.
|
|
306
|
+
* This is useful if a stable orientation is needed during specific interactions.
|
|
307
|
+
*
|
|
308
|
+
* @since Bot API 8.0+
|
|
309
|
+
*/
|
|
310
|
+
lockOrientation(): void;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* A method that unlocks the Mini App’s orientation, allowing it to follow the device's rotation freely.
|
|
314
|
+
* Use this to restore automatic orientation adjustments based on the device orientation.
|
|
315
|
+
*
|
|
316
|
+
* @since Bot API 8.0+
|
|
317
|
+
*/
|
|
318
|
+
unlockOrientation(): void;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* A method that prompts the user to add the Mini App to the home screen.
|
|
322
|
+
* After successfully adding the icon, the homeScreenAdded event will be triggered if supported by the device.
|
|
323
|
+
*
|
|
324
|
+
* @remarks That if the device cannot determine the installation status, the event may not be received even if the icon has been added.
|
|
325
|
+
*
|
|
326
|
+
* @since Bot API 8.0+
|
|
327
|
+
*/
|
|
328
|
+
addToHomeScreen(): void;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* A method that checks if adding to the home screen is supported and if the Mini App has already been added.
|
|
332
|
+
* If an optional callback parameter is provided, the callback function will be called with a single argument status,
|
|
333
|
+
* which is a string indicating the home screen status.
|
|
334
|
+
*
|
|
335
|
+
* Possible values for status are:
|
|
336
|
+
* - **unsupported** – the feature is not supported, and it is not possible to add the icon to the home screen,
|
|
337
|
+
* - **unknown** – the feature is supported, and the icon can be added, but it is not possible to determine if the icon has already been added,
|
|
338
|
+
* - **added** – the icon has already been added to the home screen,
|
|
339
|
+
* - **missed** – the icon has not been added to the home screen.
|
|
340
|
+
*
|
|
341
|
+
* @since Bot API 8.0+
|
|
342
|
+
*/
|
|
343
|
+
checkHomeScreenStatus(callback?: (status: "unsupported" | "unknown" | "added" | "missed") => void): void;
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* A method that sets the app event handler. Check the list of available events.
|
|
217
347
|
*/
|
|
218
348
|
onEvent(eventType: "activated", eventHandler: ActivatedCallback): void;
|
|
219
349
|
onEvent(eventType: "deactivated", eventHandler: DeactivatedCallback): void;
|
|
@@ -260,7 +390,9 @@ export interface WebApp {
|
|
|
260
390
|
onEvent(eventType: "emojiStatusAccessRequested", eventHandler: EmojiStatusAccessRequestedCallback): void;
|
|
261
391
|
onEvent(eventType: "fileDownloadRequested", eventHandler: FileDownloadRequestedCallback): void;
|
|
262
392
|
|
|
263
|
-
/**
|
|
393
|
+
/**
|
|
394
|
+
* A method that deletes a previously set event handler.
|
|
395
|
+
*/
|
|
264
396
|
offEvent(eventType: "activated", eventHandler: ActivatedCallback): void;
|
|
265
397
|
offEvent(eventType: "deactivated", eventHandler: DeactivatedCallback): void;
|
|
266
398
|
offEvent(eventType: "themeChanged", eventHandler: ThemeChangedCallback): void;
|
|
@@ -307,253 +439,202 @@ export interface WebApp {
|
|
|
307
439
|
offEvent(eventType: "fileDownloadRequested", eventHandler: FileDownloadRequestedCallback): void;
|
|
308
440
|
|
|
309
441
|
/**
|
|
310
|
-
* A method used to send data to the bot.
|
|
311
|
-
* service message is sent to the bot containing the data data of the length
|
|
312
|
-
* up to 4096 bytes, and the Web App is closed. See the field web_app_data
|
|
313
|
-
* in the class Message.
|
|
442
|
+
* A method used to send data to the bot.
|
|
443
|
+
* When this method is called, a service message is sent to the bot containing the data *data* of the length up to 4096 bytes, and the Mini App is closed. See the field web_app_data in the class Message.
|
|
314
444
|
*
|
|
315
|
-
* This method is only available for
|
|
316
|
-
* button.
|
|
445
|
+
* *This method is only available for Mini Apps launched via a {@link https://core.telegram.org/bots/webapps#keyboard-button-mini-apps| Keyboard button}.*
|
|
317
446
|
*/
|
|
318
447
|
sendData(data: string): void;
|
|
448
|
+
|
|
319
449
|
/**
|
|
320
|
-
* A method that inserts the bot's username and the specified inline query
|
|
321
|
-
*
|
|
322
|
-
* the
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
450
|
+
* A method that inserts the bot's username and the specified inline query in the current chat's input field.
|
|
451
|
+
* Query may be empty, in which case only the bot's username will be inserted.
|
|
452
|
+
* If an optional choose_chat_types parameter was passed, the client prompts the user to choose a specific chat,
|
|
453
|
+
* then opens that chat and inserts the bot's username and the specified inline query in the input field.
|
|
454
|
+
* You can specify which types of chats the user will be able to choose from.
|
|
455
|
+
* It can be one or more of the following types: users, bots, groups, channels.
|
|
456
|
+
*
|
|
457
|
+
* @since Bot API 6.7+
|
|
328
458
|
*/
|
|
329
|
-
switchInlineQuery(query: string, choose_chat_types?:
|
|
459
|
+
switchInlineQuery(query: string, choose_chat_types?: ("users" | "bots" | "groups" | "channels")[]): void;
|
|
460
|
+
|
|
330
461
|
/**
|
|
331
|
-
* A method that opens a link in an external browser. The
|
|
332
|
-
*
|
|
333
|
-
* @param try_instant_view the link will be opened in Instant View mode if
|
|
334
|
-
* possible.
|
|
462
|
+
* A method that opens a link in an external browser. The Mini App will not be closed.
|
|
463
|
+
* Bot API 6.4+ If the optional options parameter is passed with the field try_instant_view=true, the link will be opened in Instant View mode if possible.
|
|
335
464
|
*
|
|
336
|
-
*
|
|
337
|
-
* with the Web App interface (e.g. a click inside the Web App or on the
|
|
338
|
-
* main button)
|
|
465
|
+
* @remarks That this method can be called only in response to user interaction with the Mini App interface (e.g. a click inside the Mini App or on the main button)
|
|
339
466
|
*/
|
|
340
467
|
openLink(url: string, options?: { try_instant_view?: boolean }): void;
|
|
468
|
+
|
|
341
469
|
/**
|
|
342
|
-
* A method that opens a telegram link inside Telegram app. The
|
|
343
|
-
*
|
|
470
|
+
* A method that opens a telegram link inside the Telegram app. The Mini App will not be closed after this method is called.
|
|
471
|
+
*
|
|
472
|
+
* Up to Bot API 7.0 The Mini App will be closed after this method is called.
|
|
344
473
|
*/
|
|
345
474
|
openTelegramLink(url: string): void;
|
|
475
|
+
|
|
346
476
|
/**
|
|
347
|
-
* A method that opens an invoice using the link url.
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
477
|
+
* A method that opens an invoice using the link url.
|
|
478
|
+
* The Mini App will receive the event invoiceClosed when the invoice is closed.
|
|
479
|
+
* If an optional callback parameter was passed,
|
|
480
|
+
* the callback function will be called and the invoice status will be passed as the first argument.
|
|
481
|
+
*
|
|
482
|
+
* @since Bot API 6.1+
|
|
351
483
|
*/
|
|
352
484
|
openInvoice(url: string, callback: (status: "paid" | "cancelled" | "failed" | "pending") => void): void;
|
|
485
|
+
|
|
353
486
|
/**
|
|
354
|
-
* A method that
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
* will be passed as the first argument.
|
|
359
|
-
*/
|
|
360
|
-
showPopup(params: PopupParams, callback?: (button_id: string) => void): void;
|
|
361
|
-
/**
|
|
362
|
-
* A method that shows message in a simple alert with a 'Close' button. If
|
|
363
|
-
* an optional callback parameter was passed, the callback function will be
|
|
364
|
-
* called when the popup is closed.
|
|
365
|
-
*/
|
|
366
|
-
showAlert(message: string, callback?: () => void): void;
|
|
367
|
-
/**
|
|
368
|
-
* A method that shows message in a simple confirmation window with 'OK' and
|
|
369
|
-
* 'Cancel' buttons. If an optional callback parameter was passed, the
|
|
370
|
-
* callback function will be called when the popup is closed and the first
|
|
371
|
-
* argument will be a boolean indicating whether the user pressed the 'OK'
|
|
372
|
-
* button.
|
|
373
|
-
*/
|
|
374
|
-
showConfirm(message: string, callback?: (ok: boolean) => void): void;
|
|
375
|
-
/**
|
|
376
|
-
* A method that shows a native popup for scanning a QR code described by
|
|
377
|
-
* the params argument of the type ScanQrPopupParams. The Web App will
|
|
378
|
-
* receive the event qrTextReceived every time the scanner catches a code
|
|
379
|
-
* with text data. If an optional callback parameter was passed, the
|
|
380
|
-
* callback function will be called and the text from the QR code will be
|
|
381
|
-
* passed as the first argument. Returning true inside this callback
|
|
382
|
-
* function causes the popup to be closed. Starting from **Bot API 7.7**,
|
|
383
|
-
* the Mini App will receive the scanQrPopupClosed event if the user closes
|
|
384
|
-
* the native popup for scanning a QR code.
|
|
385
|
-
*/
|
|
386
|
-
showScanQrPopup(params: ScanQrPopupParams, callback?: (data: string) => void): void;
|
|
387
|
-
/**
|
|
388
|
-
* A method that closes the native popup for scanning a QR code opened with
|
|
389
|
-
* the showScanQrPopup method. Run it if you received valid data in the
|
|
390
|
-
* event qrTextReceived.
|
|
487
|
+
* A method that opens the native story editor with the media specified in the media_url parameter as an HTTPS URL.
|
|
488
|
+
* An optional params argument of the type StoryShareParams describes additional sharing settings.
|
|
489
|
+
*
|
|
490
|
+
* @since Bot API 7.8+
|
|
391
491
|
*/
|
|
392
|
-
closeScanQrPopup(): void;
|
|
393
|
-
/** A method that opens the native story editor with the media specified in
|
|
394
|
-
* the media_url parameter as an HTTPS URL. An optional params argument of
|
|
395
|
-
* the type StoryShareParams describes additional sharing settings. */
|
|
396
492
|
shareToStory(media_url: string, params?: StoryShareParams): void;
|
|
493
|
+
|
|
397
494
|
/**
|
|
398
|
-
*
|
|
495
|
+
* A method that opens a dialog allowing the user to share a message provided by the bot.
|
|
496
|
+
* If an optional callback parameter is provided,
|
|
497
|
+
* the callback function will be called with a boolean as the first argument,
|
|
498
|
+
* indicating whether the message was successfully sent.
|
|
499
|
+
* The message id passed to this method must belong to a PreparedInlineMessage previously obtained via the Bot API method savePreparedInlineMessage.
|
|
399
500
|
*
|
|
400
|
-
*
|
|
401
|
-
* If an optional callback parameter is provided,
|
|
402
|
-
* the callback function will be called with a boolean as the first argument,
|
|
403
|
-
* indicating whether the message was successfully sent.
|
|
501
|
+
* @since Bot API 8.0+
|
|
404
502
|
*/
|
|
405
503
|
shareMessage(msg_id: number, callback?: (success: boolean) => void): void;
|
|
504
|
+
|
|
406
505
|
/**
|
|
407
|
-
*
|
|
506
|
+
* A method that opens a dialog allowing the user to set the specified custom emoji as their status.
|
|
507
|
+
* An optional params argument of type EmojiStatusParams specifies additional settings, such as duration.
|
|
508
|
+
* If an optional callback parameter is provided,
|
|
509
|
+
* the callback function will be called with a boolean as the first argument,
|
|
510
|
+
* indicating whether the status was set.
|
|
408
511
|
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
* If an optional callback parameter is provided,
|
|
412
|
-
* the callback function will be called with a boolean as the first argument,
|
|
413
|
-
* indicating whether the status was set.
|
|
512
|
+
* Note: this method opens a native dialog and cannot be used to set the emoji status without manual user interaction.
|
|
513
|
+
* For fully programmatic changes, you should instead use the Bot API method setUserEmojiStatus after obtaining authorization to do so via the Mini App method requestEmojiStatusAccess.
|
|
414
514
|
*
|
|
415
|
-
*
|
|
416
|
-
* For fully programmatic changes, you should instead use the Bot API method setUserEmojiStatus
|
|
417
|
-
* after obtaining authorization to do so via the Mini App method requestEmojiStatusAccess.
|
|
515
|
+
* @since Bot API 8.0+
|
|
418
516
|
*/
|
|
419
517
|
setEmojiStatus(custom_emoji_id: string, params?: EmojiStatusParams, callback?: (success: boolean) => void): void;
|
|
518
|
+
|
|
420
519
|
/**
|
|
421
|
-
*
|
|
520
|
+
* A method that shows a native popup requesting permission for the bot to manage user's emoji status.
|
|
521
|
+
* If an optional callback parameter was passed, the callback function will be called when the popup is closed and the first argument will be a boolean indicating whether the user granted this access.
|
|
422
522
|
*
|
|
423
|
-
*
|
|
424
|
-
* If an optional callback parameter was passed,
|
|
425
|
-
* the callback function will be called when the popup is closed
|
|
426
|
-
* and the first argument will be a boolean indicating whether the user granted this access.
|
|
523
|
+
* @since Bot API 8.0+
|
|
427
524
|
*/
|
|
428
525
|
requestEmojiStatusAccess(callback?: (success: boolean) => void): void;
|
|
526
|
+
|
|
429
527
|
/**
|
|
430
|
-
*
|
|
528
|
+
* A method that displays a native popup prompting the user to download a file specified by the params argument of type DownloadFileParams. If an optional callback parameter is provided, the callback function will be called when the popup is closed, with the first argument as a boolean indicating whether the user accepted the download request.
|
|
431
529
|
*
|
|
432
|
-
*
|
|
433
|
-
* specified by the params argument of type DownloadFileParams.
|
|
434
|
-
* If an optional callback parameter is provided,
|
|
435
|
-
* the callback function will be called when the popup is closed,
|
|
436
|
-
* with the first argument as a boolean indicating whether the user accepted the download request.
|
|
530
|
+
* @since Bot API 8.0+
|
|
437
531
|
*/
|
|
438
532
|
downloadFile(params: DownloadFileParams, callback?: (success: boolean) => void): void;
|
|
533
|
+
|
|
439
534
|
/**
|
|
440
|
-
* A method that
|
|
441
|
-
* The Web App will receive the event clipboardTextReceived.
|
|
442
|
-
* If an optional callback parameter was passed,
|
|
443
|
-
* the callback function will be called and the text from the clipboard will be passed as the first argument.
|
|
535
|
+
* A method that hides the on-screen keyboard, if it is currently visible. Does nothing if the keyboard is not active.
|
|
444
536
|
*
|
|
445
|
-
*
|
|
446
|
-
* attachment menu and only in response to a user interaction with the Web
|
|
447
|
-
* App interface (e.g. a click inside the Web App or on the main button).
|
|
537
|
+
* @since Bot API 9.1+
|
|
448
538
|
*/
|
|
449
|
-
|
|
539
|
+
hideKeyboard(): void;
|
|
540
|
+
|
|
450
541
|
/**
|
|
451
|
-
* A method that shows a native popup
|
|
452
|
-
*
|
|
542
|
+
* A method that shows a native popup described by the params argument of the type PopupParams.
|
|
543
|
+
* The Mini App will receive the event popupClosed when the popup is closed.
|
|
544
|
+
* If an optional callback parameter was passed, the callback function will be called
|
|
545
|
+
* and the field id of the pressed button will be passed as the first argument.
|
|
453
546
|
*
|
|
454
|
-
* @
|
|
455
|
-
* callback function will be called when the popup is closed and the first
|
|
456
|
-
* argument will be a boolean indicating whether the user granted this
|
|
457
|
-
* access.
|
|
547
|
+
* @since Bot API 6.2+
|
|
458
548
|
*/
|
|
459
|
-
|
|
549
|
+
showPopup(params: PopupParams, callback?: (button_id: string) => void): void;
|
|
550
|
+
|
|
460
551
|
/**
|
|
461
|
-
* A method that shows a
|
|
462
|
-
*
|
|
552
|
+
* A method that shows message in a simple confirmation window with 'OK' and 'Cancel' buttons.
|
|
553
|
+
* If an optional callback parameter was passed, the callback function will be called when the popup is closed and the first argument will be a boolean indicating whether the user pressed the 'OK' button.
|
|
463
554
|
*
|
|
464
|
-
* @
|
|
465
|
-
* callback function will be called when the popup is closed and the first
|
|
466
|
-
* argument will be a boolean indicating whether the user shared its phone
|
|
467
|
-
* number. The second argument, contingent upon success, will be an object
|
|
468
|
-
* detailing the shared contact information or a cancellation response.
|
|
469
|
-
*/
|
|
470
|
-
requestContact(callback?: (success: boolean, response: RequestContactResponse) => void): void;
|
|
471
|
-
/**
|
|
472
|
-
* A method that informs the Telegram app that the Web App is ready to be
|
|
473
|
-
* displayed. It is recommended to call this method as early as possible, as
|
|
474
|
-
* soon as all essential interface elements are loaded. Once this method is
|
|
475
|
-
* called, the loading placeholder is hidden and the Web App is shown. If
|
|
476
|
-
* the method is not called, the placeholder will be hidden only when the
|
|
477
|
-
* page is fully loaded.
|
|
555
|
+
* @since Bot API 6.2+
|
|
478
556
|
*/
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
* A method that expands the Web App to the maximum available height. To
|
|
482
|
-
* find out if the Web App is expanded to the maximum height, refer to the
|
|
483
|
-
* value of the Telegram.WebApp.isExpanded parameter
|
|
484
|
-
*/
|
|
485
|
-
expand(): void;
|
|
486
|
-
/** A method that closes the Web App. */
|
|
487
|
-
close(): void;
|
|
557
|
+
showAlert(message: string, callback?: () => void): void;
|
|
558
|
+
|
|
488
559
|
/**
|
|
489
|
-
*
|
|
490
|
-
*
|
|
491
|
-
*
|
|
492
|
-
*
|
|
560
|
+
* A method that shows message in a simple confirmation window with 'OK' and 'Cancel' buttons.
|
|
561
|
+
* If an optional callback parameter was passed, the callback function will be called when the popup is closed and the first argument will be a boolean indicating whether the user pressed the 'OK' button.
|
|
562
|
+
*
|
|
563
|
+
* @since Bot API 6.2+
|
|
493
564
|
*/
|
|
494
|
-
|
|
565
|
+
showConfirm(message: string, callback?: (success: boolean) => void): void;
|
|
566
|
+
|
|
495
567
|
/**
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
568
|
+
* A method that shows a native popup for scanning a QR code described by the params argument of the type ScanQrPopupParams.
|
|
569
|
+
* The Mini App will receive the event qrTextReceived every time the scanner catches a code with text data.
|
|
570
|
+
* If an optional callback parameter was passed,
|
|
571
|
+
* the callback function will be called and the text from the QR code will be passed as the first argument.
|
|
572
|
+
* Returning true inside this callback function causes the popup to be closed.
|
|
573
|
+
* 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.
|
|
574
|
+
*
|
|
575
|
+
* @since Bot API 6.4+
|
|
500
576
|
*/
|
|
501
|
-
|
|
577
|
+
showScanQrPopup(params: ScanQrPopupParams, callback?: (data: string) => void): void;
|
|
578
|
+
|
|
502
579
|
/**
|
|
503
|
-
*
|
|
504
|
-
*
|
|
505
|
-
*
|
|
506
|
-
*
|
|
580
|
+
* A method that closes the native popup for scanning a QR code opened with the showScanQrPopup method.
|
|
581
|
+
* Run it if you received valid data in the event qrTextReceived.
|
|
582
|
+
*
|
|
583
|
+
* @since Bot API 6.4+
|
|
507
584
|
*/
|
|
508
|
-
|
|
585
|
+
closeScanQrPopup(): void;
|
|
586
|
+
|
|
509
587
|
/**
|
|
510
|
-
*
|
|
588
|
+
* A method that requests text from the clipboard.
|
|
589
|
+
* The Mini App will receive the event clipboardTextReceived.
|
|
590
|
+
* If an optional callback parameter was passed,
|
|
591
|
+
* the callback function will be called and the text from the clipboard will be passed as the first argument.
|
|
511
592
|
*
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
*
|
|
515
|
-
*
|
|
593
|
+
* @remarks This method can be called only for Mini Apps launched from the attachment menu
|
|
594
|
+
* and only in response to a user interaction with the Mini App interface
|
|
595
|
+
* (e.g. a click inside the Mini App or on the main button).
|
|
596
|
+
*
|
|
597
|
+
* @since Bot API 6.4+
|
|
516
598
|
*/
|
|
517
|
-
|
|
599
|
+
readTextFromClipboard(callback?: (data: string | null) => void): void;
|
|
600
|
+
|
|
518
601
|
/**
|
|
519
|
-
*
|
|
602
|
+
* A method that shows a native popup requesting permission for the bot to send messages to the user.
|
|
603
|
+
* If an optional callback parameter was passed,
|
|
604
|
+
* the callback function will be called when the popup is closed and the first argument will be a boolean indicating whether the user granted this access.
|
|
520
605
|
*
|
|
521
|
-
*
|
|
606
|
+
* @since Bot API 6.9+
|
|
522
607
|
*/
|
|
523
|
-
|
|
608
|
+
requestWriteAccess(callback?: (success: boolean) => void): void;
|
|
609
|
+
|
|
524
610
|
/**
|
|
525
|
-
*
|
|
611
|
+
* A method that shows a native popup prompting the user for their phone number.
|
|
612
|
+
* If an optional callback parameter was passed,
|
|
613
|
+
* the callback function will be called when the popup is closed and the first argument will be a boolean indicating whether the user shared its phone number.
|
|
526
614
|
*
|
|
527
|
-
*
|
|
528
|
-
* Once locked, the orientation remains fixed, regardless of device rotation.
|
|
529
|
-
* This is useful if a stable orientation is needed during specific interactions.
|
|
615
|
+
* @since Bot API 6.9+
|
|
530
616
|
*/
|
|
531
|
-
|
|
617
|
+
requestContact(callback?: (success: boolean, response: RequestContactResponse) => void): void;
|
|
618
|
+
|
|
532
619
|
/**
|
|
533
|
-
*
|
|
534
|
-
*
|
|
535
|
-
*
|
|
536
|
-
*
|
|
620
|
+
* A method that informs the Telegram app that the Mini App is ready to be displayed.
|
|
621
|
+
* It is recommended to call this method as early as possible, as soon as all essential interface elements are loaded.
|
|
622
|
+
* Once this method is called, the loading placeholder is hidden and the Mini App is shown.
|
|
623
|
+
* If the method is not called, the placeholder will be hidden only when the page is fully loaded.
|
|
537
624
|
*/
|
|
538
|
-
|
|
625
|
+
ready(): void;
|
|
626
|
+
|
|
539
627
|
/**
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
* After successfully adding the icon, the homeScreenAdded event will be triggered if supported by the device.
|
|
544
|
-
* Note that if the device cannot determine the installation status,
|
|
545
|
-
* the event may not be received even if the icon has been added.
|
|
628
|
+
* A method that expands the Mini App to the maximum available height.
|
|
629
|
+
* To find out if the Mini App is expanded to the maximum height,
|
|
630
|
+
* refer to the value of the {@link isExpanded| Telegram.WebApp.isExpanded} parameter
|
|
546
631
|
*/
|
|
547
|
-
|
|
632
|
+
expand(): void;
|
|
633
|
+
|
|
548
634
|
/**
|
|
549
|
-
*
|
|
550
|
-
*
|
|
551
|
-
* A method that checks if adding to the home screen is supported and if the Mini App has already been added.
|
|
552
|
-
* If an optional callback parameter is provided,
|
|
553
|
-
* the callback function will be called with a single argument status,
|
|
554
|
-
* which is a string indicating the home screen status.
|
|
635
|
+
* A method that closes the Mini App.
|
|
555
636
|
*/
|
|
556
|
-
|
|
637
|
+
close(): void;
|
|
557
638
|
}
|
|
558
639
|
|
|
559
640
|
export type ActivatedCallback = () => void;
|
|
@@ -628,103 +709,130 @@ export type FileDownloadRequestedCallback = (eventData: {
|
|
|
628
709
|
}) => void;
|
|
629
710
|
|
|
630
711
|
/**
|
|
631
|
-
*
|
|
632
|
-
*
|
|
633
|
-
* settings:
|
|
712
|
+
* Mini Apps can adjust the appearance of the interface to match the Telegram user's app in real time.
|
|
713
|
+
* This object contains the user's current theme setting
|
|
634
714
|
*/
|
|
635
715
|
export interface ThemeParams {
|
|
636
716
|
/**
|
|
637
717
|
* Background color in the `#RRGGBB` format.
|
|
638
|
-
*
|
|
718
|
+
*
|
|
719
|
+
* @see Available as the CSS variable `var(--tg-theme-bg-color)`.
|
|
639
720
|
*/
|
|
640
721
|
bg_color?: string;
|
|
722
|
+
|
|
641
723
|
/**
|
|
642
724
|
* Main text color in the `#RRGGBB` format.
|
|
643
|
-
*
|
|
725
|
+
*
|
|
726
|
+
* @see Available as the CSS variable `var(--tg-theme-text-color)`.
|
|
644
727
|
*/
|
|
645
728
|
text_color?: string;
|
|
729
|
+
|
|
646
730
|
/**
|
|
647
731
|
* Hint text color in the `#RRGGBB` format.
|
|
648
|
-
*
|
|
732
|
+
*
|
|
733
|
+
* @see Available as the CSS variable `var(--tg-theme-hint-color)`.
|
|
649
734
|
*/
|
|
650
735
|
hint_color?: string;
|
|
736
|
+
|
|
651
737
|
/**
|
|
652
738
|
* Link color in the `#RRGGBB` format.
|
|
653
|
-
*
|
|
739
|
+
*
|
|
740
|
+
* @see Available as the CSS variable `var(--tg-theme-link-color)`.
|
|
654
741
|
*/
|
|
655
742
|
link_color?: string;
|
|
743
|
+
|
|
656
744
|
/**
|
|
657
745
|
* Button color in the `#RRGGBB` format.
|
|
658
|
-
*
|
|
746
|
+
*
|
|
747
|
+
* @see Available as the CSS variable `var(--tg-theme-button-color)`.
|
|
659
748
|
*/
|
|
660
749
|
button_color?: string;
|
|
750
|
+
|
|
661
751
|
/**
|
|
662
752
|
* Button text color in the `#RRGGBB` format.
|
|
663
|
-
*
|
|
753
|
+
*
|
|
754
|
+
* @see Available as the CSS variable `var(--tg-theme-button-text-color)`.
|
|
664
755
|
*/
|
|
665
756
|
button_text_color?: string;
|
|
757
|
+
|
|
666
758
|
/**
|
|
667
|
-
* **Bot API 6.1+**
|
|
668
|
-
*
|
|
669
759
|
* Secondary background color in the `#RRGGBB` format.
|
|
670
|
-
*
|
|
760
|
+
*
|
|
761
|
+
* @since Bot API 6.1+
|
|
762
|
+
*
|
|
763
|
+
* @see Available as the CSS variable `var(--tg-theme-secondary-bg-color)`.
|
|
671
764
|
*/
|
|
672
765
|
secondary_bg_color?: string;
|
|
766
|
+
|
|
673
767
|
/**
|
|
674
|
-
* **Bot API 7.0+**
|
|
675
|
-
*
|
|
676
768
|
* Header background color in the `#RRGGBB` format.
|
|
677
|
-
*
|
|
769
|
+
*
|
|
770
|
+
* @since Bot API 7.0+
|
|
771
|
+
*
|
|
772
|
+
* @see Available as the CSS variable `var(--tg-theme-header-bg-color)`.
|
|
678
773
|
*/
|
|
679
774
|
header_bg_color?: string;
|
|
775
|
+
|
|
680
776
|
/**
|
|
681
|
-
*
|
|
777
|
+
* Bottom background color in the `#RRGGBB` format.
|
|
778
|
+
*
|
|
779
|
+
* @since Bot API 7.10+
|
|
682
780
|
*
|
|
683
|
-
*
|
|
684
|
-
* Also available as the CSS variable var(--tg-theme-bottom-bar-bg-color).
|
|
781
|
+
* @see Available as the CSS variable `var(--tg-theme-bottom-bar-bg-color)`.
|
|
685
782
|
*/
|
|
686
783
|
bottom_bar_bg_color?: string;
|
|
784
|
+
|
|
687
785
|
/**
|
|
688
|
-
* **Bot API 7.0+**
|
|
689
|
-
*
|
|
690
786
|
* Accent text color in the `#RRGGBB` format.
|
|
691
|
-
*
|
|
787
|
+
*
|
|
788
|
+
* @since Bot API 7.0+
|
|
789
|
+
*
|
|
790
|
+
* @see Available as the CSS variable `var(--tg-theme-accent-text-color)`.
|
|
692
791
|
*/
|
|
693
792
|
accent_text_color?: string;
|
|
793
|
+
|
|
694
794
|
/**
|
|
695
|
-
*
|
|
795
|
+
* Section background color in the `#RRGGBB` format.
|
|
796
|
+
*
|
|
797
|
+
* @since Bot API 7.0+
|
|
696
798
|
*
|
|
697
|
-
*
|
|
698
|
-
* It is recommended to use this in conjunction with *secondary_bg_color*.
|
|
699
|
-
* Also available as the CSS variable `var(--tg-theme-section-bg-color)`.
|
|
799
|
+
* @see Available as the CSS variable `var(--tg-theme-section-bg-color)`.
|
|
700
800
|
*/
|
|
701
801
|
section_bg_color?: string;
|
|
802
|
+
|
|
702
803
|
/**
|
|
703
|
-
*
|
|
804
|
+
* Section header text color in the `#RRGGBB` format.
|
|
805
|
+
*
|
|
806
|
+
* @since Bot API 7.0+
|
|
704
807
|
*
|
|
705
|
-
*
|
|
706
|
-
* Also available as the CSS variable `var(--tg-theme-section-header-text-color)`.
|
|
808
|
+
* @see Available as the CSS variable `var(--tg-theme-section-header-text-color)`.
|
|
707
809
|
*/
|
|
708
|
-
section_header_text_color?:
|
|
810
|
+
section_header_text_color?: string;
|
|
811
|
+
|
|
709
812
|
/**
|
|
710
|
-
* **Bot API 7.6+**
|
|
711
|
-
*
|
|
712
813
|
* Section separator color in the `#RRGGBB` format.
|
|
713
|
-
*
|
|
814
|
+
*
|
|
815
|
+
* @since Bot API 7.6+
|
|
816
|
+
*
|
|
817
|
+
* @see Available as the CSS variable `var(--tg-theme-section-separator-color)`.
|
|
714
818
|
*/
|
|
715
819
|
section_separator_color?: string;
|
|
820
|
+
|
|
716
821
|
/**
|
|
717
|
-
* **Bot API 7.0+**
|
|
718
|
-
*
|
|
719
822
|
* Subtitle text color in the `#RRGGBB` format.
|
|
720
|
-
*
|
|
823
|
+
*
|
|
824
|
+
* @since Bot API 7.0+
|
|
825
|
+
*
|
|
826
|
+
* @see Available as the CSS variable `var(--tg-theme-subtitle-text-color)`.
|
|
721
827
|
*/
|
|
722
828
|
subtitle_text_color?: string;
|
|
829
|
+
|
|
723
830
|
/**
|
|
724
|
-
*
|
|
831
|
+
* Destructive text color in the `#RRGGBB` format.
|
|
725
832
|
*
|
|
726
|
-
*
|
|
727
|
-
*
|
|
833
|
+
* @since Bot API 7.0+
|
|
834
|
+
*
|
|
835
|
+
* @see Available as the CSS variable `var(--tg-theme-destructive-text-color)`.
|
|
728
836
|
*/
|
|
729
837
|
destructive_text_color?: string;
|
|
730
838
|
}
|
|
@@ -795,23 +903,31 @@ export interface BackButton {
|
|
|
795
903
|
*/
|
|
796
904
|
isVisible: boolean;
|
|
797
905
|
/**
|
|
798
|
-
*
|
|
799
|
-
*
|
|
906
|
+
* **Bot API 6.1+**
|
|
907
|
+
*
|
|
908
|
+
* A method that sets the button press event handler.
|
|
909
|
+
* An alias for `Telegram.WebApp.onEvent('backButtonClicked', callback)`
|
|
800
910
|
*/
|
|
801
911
|
onClick(callback: () => void): BackButton;
|
|
802
912
|
/**
|
|
803
|
-
*
|
|
804
|
-
*
|
|
913
|
+
* **Bot API 6.1+**
|
|
914
|
+
*
|
|
915
|
+
* A method that removes the button press event handler.
|
|
916
|
+
* An alias for `Telegram.WebApp.offEvent('backButtonClicked', callback)`
|
|
805
917
|
*/
|
|
806
918
|
offClick(callback: () => void): BackButton;
|
|
807
919
|
/**
|
|
920
|
+
* **Bot API 6.1+**
|
|
921
|
+
*
|
|
808
922
|
* A method to make the button active and visible.
|
|
809
923
|
*/
|
|
810
|
-
show():
|
|
924
|
+
show(): BackButton;
|
|
811
925
|
/**
|
|
926
|
+
* **Bot API 6.1+**
|
|
927
|
+
*
|
|
812
928
|
* A method to hide the button.
|
|
813
929
|
*/
|
|
814
|
-
hide():
|
|
930
|
+
hide(): BackButton;
|
|
815
931
|
}
|
|
816
932
|
|
|
817
933
|
/**
|
telegram-web-app/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/telegram-web-app",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.1.1",
|
|
4
4
|
"description": "TypeScript definitions for telegram-web-app",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/telegram-web-app",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
"name": "deptyped",
|
|
20
20
|
"githubUsername": "deptyped",
|
|
21
21
|
"url": "https://github.com/deptyped"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "sidorko",
|
|
25
|
+
"githubUsername": "sidorko",
|
|
26
|
+
"url": "https://github.com/sidorko"
|
|
22
27
|
}
|
|
23
28
|
],
|
|
24
29
|
"main": "",
|
|
@@ -31,6 +36,6 @@
|
|
|
31
36
|
"scripts": {},
|
|
32
37
|
"dependencies": {},
|
|
33
38
|
"peerDependencies": {},
|
|
34
|
-
"typesPublisherContentHash": "
|
|
35
|
-
"typeScriptVersion": "5.
|
|
39
|
+
"typesPublisherContentHash": "c942da54059cdd792567429adafb556da1f1b2be1b66b00c2f2bcfada4b04578",
|
|
40
|
+
"typeScriptVersion": "5.2"
|
|
36
41
|
}
|