@types/telegram-web-app 7.3.0 → 7.3.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.
@@ -8,7 +8,7 @@ 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: Sun, 07 Jul 2024 15:07:38 GMT
11
+ * Last updated: Sun, 07 Jul 2024 16:36:47 GMT
12
12
  * Dependencies: none
13
13
 
14
14
  # Credits
@@ -9,14 +9,14 @@ interface Telegram {
9
9
  interface WebApp {
10
10
  /**
11
11
  * A string with raw data transferred to the Web App, convenient for
12
- * validating data. WARNING: Validate data from this field before using it on
13
- * the bot's server.
12
+ * validating data. WARNING: Validate data from this field before using it
13
+ * on the bot's server.
14
14
  */
15
15
  initData: string;
16
16
  /**
17
17
  * An object with input data transferred to the Web App. WARNING: Data from
18
- * this field should not be trusted. You should only use data from initData on
19
- * the bot's server and only after it has been validated.
18
+ * this field should not be trusted. You should only use data from initData
19
+ * on the bot's server and only after it has been validated.
20
20
  */
21
21
  initDataUnsafe: WebAppInitData;
22
22
  /**
@@ -37,9 +37,9 @@ interface WebApp {
37
37
  */
38
38
  themeParams: ThemeParams;
39
39
  /**
40
- * True if the Web App is expanded to the maximum available height. False, if
41
- * the Web App occupies part of the screen and can be expanded to the full
42
- * height using the expand() method.
40
+ * True if the Web App is expanded to the maximum available height. False,
41
+ * if the Web App occupies part of the screen and can be expanded to the
42
+ * full height using the expand() method.
43
43
  */
44
44
  isExpanded: boolean;
45
45
  /**
@@ -47,10 +47,11 @@ interface WebApp {
47
47
  * CSS as the variable var(--tg-viewport-height).
48
48
  *
49
49
  * The application can display just the top part of the Web App, with its
50
- * lower part remaining outside the screen area. From this position, the user
51
- * can “pull” the Web App to its maximum height, while the bot can do the same
52
- * by calling the expand() method. As the position of the Web App changes, the
53
- * current height value of the visible area will be updated in real time.
50
+ * lower part remaining outside the screen area. From this position, the
51
+ * user can “pull” the Web App to its maximum height, while the bot can do
52
+ * the same by calling the expand() method. As the position of the Web App
53
+ * changes, the current height value of the visible area will be updated in
54
+ * real time.
54
55
  *
55
56
  * Please note that the refresh rate of this value is not sufficient to
56
57
  * smoothly follow the lower border of the window. It should not be used to
@@ -64,17 +65,17 @@ interface WebApp {
64
65
  * Also available in CSS as a variable var(--tg-viewport-stable-height).
65
66
  *
66
67
  * The application can display just the top part of the Web App, with its
67
- * lower part remaining outside the screen area. From this position, the user
68
- * can “pull” the Web App to its maximum height, while the bot can do the same
69
- * by calling the expand() method. Unlike the value of viewportHeight, the
70
- * value of viewportStableHeight does not change as the position of the Web
71
- * App changes with user gestures or during animations. The value of
72
- * viewportStableHeight will be updated after all gestures and animations are
73
- * completed and the Web App reaches its final size.
68
+ * lower part remaining outside the screen area. From this position, the
69
+ * user can “pull” the Web App to its maximum height, while the bot can do
70
+ * the same by calling the expand() method. Unlike the value of
71
+ * viewportHeight, the value of viewportStableHeight does not change as the
72
+ * position of the Web App changes with user gestures or during animations.
73
+ * The value of viewportStableHeight will be updated after all gestures and
74
+ * animations are completed and the Web App reaches its final size.
74
75
  *
75
76
  * Note the event viewportChanged with the passed parameter
76
- * isStateStable=true, which will allow you to track when the stable state of
77
- * the height of the visible area changes.
77
+ * isStateStable=true, which will allow you to track when the stable state
78
+ * of the height of the visible area changes.
78
79
  */
79
80
  viewportStableHeight: number;
80
81
  /**
@@ -86,8 +87,8 @@ interface WebApp {
86
87
  */
87
88
  backgroundColor: string;
88
89
  /**
89
- * True, if the confirmation dialog is enabled while the user is trying to close the Web App.
90
- * False, if the confirmation dialog is disabled.
90
+ * True, if the confirmation dialog is enabled while the user is trying to
91
+ * close the Web App. False, if the confirmation dialog is disabled.
91
92
  */
92
93
  isClosingConfirmationEnabled: boolean;
93
94
  /**
@@ -101,8 +102,8 @@ interface WebApp {
101
102
  */
102
103
  MainButton: MainButton;
103
104
  /**
104
- * An object for controlling the Settings item in the context menu of the Mini App
105
- * in the Telegram interface.
105
+ * An object for controlling the Settings item in the context menu of the
106
+ * Mini App in the Telegram interface.
106
107
  */
107
108
  SettingsButton: SettingsButton;
108
109
  /**
@@ -123,8 +124,8 @@ interface WebApp {
123
124
  */
124
125
  isVersionAtLeast(version: string): boolean;
125
126
  /**
126
- * A method that sets the app header color in the `#RRGGBB` format.
127
- * You can also use keywords bg_color and secondary_bg_color.
127
+ * A method that sets the app header color in the `#RRGGBB` format. You can
128
+ * also use keywords bg_color and secondary_bg_color.
128
129
  */
129
130
  // string & {} prevents this from eagerly collapsing into just string
130
131
  setHeaderColor(color: "bg_color" | "secondary_bg_color" | (string & {})): void;
@@ -134,11 +135,13 @@ interface WebApp {
134
135
  */
135
136
  setBackgroundColor(color: "bg_color" | "secondary_bg_color" | (string & {})): void;
136
137
  /**
137
- * A method that enables a confirmation dialog while the user is trying to close the Web App.
138
+ * A method that enables a confirmation dialog while the user is trying to
139
+ * close the Web App.
138
140
  */
139
141
  enableClosingConfirmation(): void;
140
142
  /**
141
- * A method that disables the confirmation dialog while the user is trying to close the Web App.
143
+ * A method that disables the confirmation dialog while the user is trying
144
+ * to close the Web App.
142
145
  */
143
146
  disableClosingConfirmation(): void;
144
147
  /**
@@ -181,29 +184,33 @@ interface WebApp {
181
184
  /**
182
185
  * A method used to send data to the bot. When this method is called, a
183
186
  * service message is sent to the bot containing the data data of the length
184
- * up to 4096 bytes, and the Web App is closed. See the field web_app_data in
185
- * the class Message.
187
+ * up to 4096 bytes, and the Web App is closed. See the field web_app_data
188
+ * in the class Message.
186
189
  *
187
- * This method is only available for Web Apps launched via a Keyboard button.
190
+ * This method is only available for Web Apps launched via a Keyboard
191
+ * button.
188
192
  */
189
193
  sendData(data: string): void;
190
194
  /**
191
- * A method that inserts the bot's username and the specified inline query in the current chat's input field.
192
- * Query may be empty, in which case only the bot's username will be inserted.
193
- * If an optional choose_chat_types parameter was passed, the client prompts the user to choose a specific chat,
194
- * then opens that chat and inserts the bot's username and the specified inline query in the input field.
195
- * You can specify which types of chats the user will be able to choose from.
196
- * It can be one or more of the following types: users, bots, groups, channels.
195
+ * A method that inserts the bot's username and the specified inline query
196
+ * in the current chat's input field. Query may be empty, in which case only
197
+ * the bot's username will be inserted. If an optional choose_chat_types
198
+ * parameter was passed, the client prompts the user to choose a specific
199
+ * chat, then opens that chat and inserts the bot's username and the
200
+ * specified inline query in the input field. You can specify which types of
201
+ * chats the user will be able to choose from. It can be one or more of the
202
+ * following types: users, bots, groups, channels.
197
203
  */
198
204
  switchInlineQuery(query: string, choose_chat_types?: Array<"users" | "bots" | "groups" | "channels">): void;
199
205
  /**
200
- * A method that opens a link in an external browser.
201
- * The Web App will not be closed.
202
- * If the optional options parameter is passed with the field
203
- * @param try_instant_view the link will be opened in Instant View mode if possible.
206
+ * A method that opens a link in an external browser. The Web App will not
207
+ * be closed. If the optional options parameter is passed with the field
208
+ * @param try_instant_view the link will be opened in Instant View mode if
209
+ * possible.
204
210
  *
205
- * Note that this method can be called only in response to user interaction with
206
- * the Web App interface (e.g. a click inside the Web App or on the main button)
211
+ * Note that this method can be called only in response to user interaction
212
+ * with the Web App interface (e.g. a click inside the Web App or on the
213
+ * main button)
207
214
  */
208
215
  openLink(url: string, options?: { try_instant_view?: boolean }): void;
209
216
  /**
@@ -222,44 +229,54 @@ interface WebApp {
222
229
  callback: (url: string, status: "paid" | "cancelled" | "failed" | "pending") => void,
223
230
  ): void;
224
231
  /**
225
- * A method that shows a native popup described by the params argument of the type PopupParams.
226
- * The Web App will receive the event popupClosed when the popup is closed. If an optional
227
- * callback parameter was passed, the callback function will be called and the field id of the
228
- * pressed button will be passed as the first argument.
232
+ * A method that shows a native popup described by the params argument of
233
+ * the type PopupParams. The Web App will receive the event popupClosed when
234
+ * the popup is closed. If an optional callback parameter was passed, the
235
+ * callback function will be called and the field id of the pressed button
236
+ * will be passed as the first argument.
229
237
  */
230
238
  showPopup(params: PopupParams, callback?: (button_id: string) => void): void;
231
239
  /**
232
- * A method that shows message in a simple alert with a 'Close' button. If an optional callback
233
- * parameter was passed, the callback function will be called when the popup is closed.
240
+ * A method that shows message in a simple alert with a 'Close' button. If
241
+ * an optional callback parameter was passed, the callback function will be
242
+ * called when the popup is closed.
234
243
  */
235
244
  showAlert(message: string, callback?: () => void): void;
236
245
  /**
237
- * A method that shows message in a simple confirmation window with 'OK' and 'Cancel' buttons.
238
- * If an optional callback parameter was passed, the callback function will be called when the
239
- * popup is closed and the first argument will be a boolean indicating whether the user
240
- * pressed the 'OK' button.
246
+ * A method that shows message in a simple confirmation window with 'OK' and
247
+ * 'Cancel' buttons. If an optional callback parameter was passed, the
248
+ * callback function will be called when the popup is closed and the first
249
+ * argument will be a boolean indicating whether the user pressed the 'OK'
250
+ * button.
241
251
  */
242
252
  showConfirm(message: string, callback?: (ok: boolean) => void): void;
243
253
  /**
244
- * A method that shows a native popup for scanning a QR code described by the params argument of the type ScanQrPopupParams.
245
- * The Web App will receive the event qrTextReceived every time the scanner catches a code with text data.
246
- * If an optional callback parameter was passed, the callback function will be called and the text from the QR
247
- * code will be passed as the first argument. Returning true inside this callback function causes the popup to be closed.
248
- * 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.
254
+ * A method that shows a native popup for scanning a QR code described by
255
+ * the params argument of the type ScanQrPopupParams. The Web App will
256
+ * receive the event qrTextReceived every time the scanner catches a code
257
+ * with text data. If an optional callback parameter was passed, the
258
+ * callback function will be called and the text from the QR code will be
259
+ * passed as the first argument. Returning true inside this callback
260
+ * function causes the popup to be closed. Starting from **Bot API 7.7**,
261
+ * the Mini App will receive the scanQrPopupClosed event if the user closes
262
+ * the native popup for scanning a QR code.
249
263
  */
250
264
  showScanQrPopup(params: ScanQrPopupParams, callback?: (data: string) => void): void;
251
265
  /**
252
- * A method that closes the native popup for scanning a QR code opened with the
253
- * showScanQrPopup method. Run it if you received valid data in the event qrTextReceived.
266
+ * A method that closes the native popup for scanning a QR code opened with
267
+ * the showScanQrPopup method. Run it if you received valid data in the
268
+ * event qrTextReceived.
254
269
  */
255
270
  closeScanQrPopup(): void;
256
271
  /**
257
- * A method that requests text from the clipboard. The Web App will receive the event clipboardTextReceived.
258
- * If an optional callback parameter was passed, the callback function will be
259
- * called and the text from the clipboard will be passed as the first argument.
272
+ * A method that requests text from the clipboard. The Web App will receive
273
+ * the event clipboardTextReceived. If an optional callback parameter was
274
+ * passed, the callback function will be called and the text from the
275
+ * clipboard will be passed as the first argument.
260
276
  *
261
- * Note: this method can be called only for Web Apps launched from the attachment menu and only
262
- * in response to a user interaction with the Web App interface (e.g. a click inside the Web App or on the main button).
277
+ * Note: this method can be called only for Web Apps launched from the
278
+ * attachment menu and only in response to a user interaction with the Web
279
+ * App interface (e.g. a click inside the Web App or on the main button).
263
280
  */
264
281
  readTextFromClipboard(callback?: (data: string | null) => void): void;
265
282
  /**
@@ -278,9 +295,9 @@ interface WebApp {
278
295
  *
279
296
  * @param callback If an optional callback parameter was passed, the
280
297
  * callback function will be called when the popup is closed and the first
281
- * argument will be a boolean indicating whether the user shared its
282
- * phone number. The second argument, contingent upon success, will be
283
- * an object detailing the shared contact information or a cancellation response.
298
+ * argument will be a boolean indicating whether the user shared its phone
299
+ * number. The second argument, contingent upon success, will be an object
300
+ * detailing the shared contact information or a cancellation response.
284
301
  */
285
302
  requestContact(
286
303
  callback?: (success: boolean, response: RequestContactResponse) => void,
@@ -289,33 +306,37 @@ interface WebApp {
289
306
  * A method that informs the Telegram app that the Web App is ready to be
290
307
  * displayed. It is recommended to call this method as early as possible, as
291
308
  * soon as all essential interface elements are loaded. Once this method is
292
- * called, the loading placeholder is hidden and the Web App is shown. If the
293
- * method is not called, the placeholder will be hidden only when the page is
294
- * fully loaded.
309
+ * called, the loading placeholder is hidden and the Web App is shown. If
310
+ * the method is not called, the placeholder will be hidden only when the
311
+ * page is fully loaded.
295
312
  */
296
313
  ready(): void;
297
314
  /**
298
- * A method that expands the Web App to the maximum available height. To find
299
- * out if the Web App is expanded to the maximum height, refer to the value of
300
- * the Telegram.WebApp.isExpanded parameter
315
+ * A method that expands the Web App to the maximum available height. To
316
+ * find out if the Web App is expanded to the maximum height, refer to the
317
+ * value of the Telegram.WebApp.isExpanded parameter
301
318
  */
302
319
  expand(): void;
303
320
  /** A method that closes the Web App. */
304
321
  close(): void;
305
322
  /**
306
323
  * `True`, if vertical swipes to close or minimize the Mini App are enabled.
307
- * `False`, if vertical swipes to close or minimize the Mini App are disabled.
308
- * In any case, the user will still be able to minimize and close the Mini App by swiping the Mini App's header.
324
+ * `False`, if vertical swipes to close or minimize the Mini App are
325
+ * disabled. In any case, the user will still be able to minimize and close
326
+ * the Mini App by swiping the Mini App's header.
309
327
  */
310
328
  isVerticalSwipesEnabled: boolean;
311
329
  /**
312
- * **Bot API 7.7+** A method that enables vertical swipes to close or minimize the Mini App.
313
- * For user convenience, it is recommended to always enable swipes unless they conflict with the Mini App's own gestures.
330
+ * **Bot API 7.7+** A method that enables vertical swipes to close or
331
+ * minimize the Mini App. For user convenience, it is recommended to always
332
+ * enable swipes unless they conflict with the Mini App's own gestures.
314
333
  */
315
334
  enableVerticalSwipes(): void;
316
335
  /**
317
- * **Bot API 7.7+** A method that disables vertical swipes to close or minimize the Mini App.
318
- * This method is useful if your Mini App uses swipe gestures that may conflict with the gestures for minimizing and closing the app.
336
+ * **Bot API 7.7+** A method that disables vertical swipes to close or
337
+ * minimize the Mini App. This method is useful if your Mini App uses swipe
338
+ * gestures that may conflict with the gestures for minimizing and closing
339
+ * the app.
319
340
  */
320
341
  disableVerticalSwipes(): void;
321
342
  }
@@ -343,74 +364,77 @@ type BiometricTokenUpdatedCallback = (eventData: { isUpdated: boolean }) => void
343
364
  */
344
365
  interface ThemeParams {
345
366
  /**
346
- * Background color in the `#RRGGBB` format.
347
- * Also available as the CSS variable `var(--tg-theme-bg-color)`.
367
+ * Background color in the `#RRGGBB` format. Also available as the CSS
368
+ * variable `var(--tg-theme-bg-color)`.
348
369
  */
349
370
  bg_color?: string;
350
371
  /**
351
- * Main text color in the `#RRGGBB` format.
352
- * Also available as the CSS variable `var(--tg-theme-text-color)`.
372
+ * Main text color in the `#RRGGBB` format. Also available as the CSS
373
+ * variable `var(--tg-theme-text-color)`.
353
374
  */
354
375
  text_color?: string;
355
376
  /**
356
- * Hint text color in the `#RRGGBB` format.
357
- * Also available as the CSS variable `var(--tg-theme-hint-color)`.
377
+ * Hint text color in the `#RRGGBB` format. Also available as the CSS
378
+ * variable `var(--tg-theme-hint-color)`.
358
379
  */
359
380
  hint_color?: string;
360
381
  /**
361
- * Link color in the `#RRGGBB` format.
362
- * Also available as the CSS variable `var(--tg-theme-link-color)`.
382
+ * Link color in the `#RRGGBB` format. Also available as the CSS variable
383
+ * `var(--tg-theme-link-color)`.
363
384
  */
364
385
  link_color?: string;
365
386
  /**
366
- * Button color in the `#RRGGBB` format.
367
- * Also available as the CSS variable `var(--tg-theme-button-color)`.
387
+ * Button color in the `#RRGGBB` format. Also available as the CSS variable
388
+ * `var(--tg-theme-button-color)`.
368
389
  */
369
390
  button_color?: string;
370
391
  /**
371
- * Button text color in the `#RRGGBB` format.
372
- * Also available as the CSS variable `var(--tg-theme-button-text-color)`.
392
+ * Button text color in the `#RRGGBB` format. Also available as the CSS
393
+ * variable `var(--tg-theme-button-text-color)`.
373
394
  */
374
395
  button_text_color?: string;
375
396
  /**
376
- * **Bot API 6.1+** Secondary background color in the `#RRGGBB` format.
377
- * Also available as the CSS variable `var(--tg-theme-secondary-bg-color)`.
397
+ * **Bot API 6.1+** Secondary background color in the `#RRGGBB` format. Also
398
+ * available as the CSS variable `var(--tg-theme-secondary-bg-color)`.
378
399
  */
379
400
  secondary_bg_color?: string;
380
401
  /**
381
- * **Bot API 7.0+** Header background color in the `#RRGGBB` format.
382
- * Also available as the CSS variable `var(--tg-theme-header-bg-color)`.
402
+ * **Bot API 7.0+** Header background color in the `#RRGGBB` format. Also
403
+ * available as the CSS variable `var(--tg-theme-header-bg-color)`.
383
404
  */
384
405
  header_bg_color?: string;
385
406
  /**
386
- * **Bot API 7.0+** Accent text color in the `#RRGGBB` format.
387
- * Also available as the CSS variable `var(--tg-theme-accent-text-color)`.
407
+ * **Bot API 7.0+** Accent text color in the `#RRGGBB` format. Also
408
+ * available as the CSS variable `var(--tg-theme-accent-text-color)`.
388
409
  */
389
410
  accent_text_color?: string;
390
411
  /**
391
- * **Bot API 7.0+** Background color for the section in the `#RRGGBB` format. It is
392
- * recommended to use this in conjunction with *secondary_bg_color*.
393
- * Also available as the CSS variable `var(--tg-theme-section-bg-color)`.
412
+ * **Bot API 7.0+** Background color for the section in the `#RRGGBB`
413
+ * format. It is recommended to use this in conjunction with
414
+ * *secondary_bg_color*. Also available as the CSS variable
415
+ * `var(--tg-theme-section-bg-color)`.
394
416
  */
395
417
  section_bg_color?: string;
396
418
  /**
397
- * **Bot API 7.0+** Header text color for the section in the `#RRGGBB` format.
398
- * Also available as the CSS variable `var(--tg-theme-section-header-text-color)`.
419
+ * **Bot API 7.0+** Header text color for the section in the `#RRGGBB`
420
+ * format. Also available as the CSS variable
421
+ * `var(--tg-theme-section-header-text-color)`.
399
422
  */
400
423
  section_header_text_color?: `#${string}`;
401
424
  /**
402
- * **Bot API 7.6+** Section separator color in the `#RRGGBB` format.
403
- * Also available as the CSS variable `var(--tg-theme-section-separator-color)`.
425
+ * **Bot API 7.6+** Section separator color in the `#RRGGBB` format. Also
426
+ * available as the CSS variable `var(--tg-theme-section-separator-color)`.
404
427
  */
405
428
  section_separator_color?: string;
406
429
  /**
407
- * **Bot API 7.0+** Subtitle text color in the `#RRGGBB` format.
408
- * Also available as the CSS variable `var(--tg-theme-subtitle-text-color)`.
430
+ * **Bot API 7.0+** Subtitle text color in the `#RRGGBB` format. Also
431
+ * available as the CSS variable `var(--tg-theme-subtitle-text-color)`.
409
432
  */
410
433
  subtitle_text_color?: string;
411
434
  /**
412
- * **Bot API 7.0+** Text color for destructive actions in the `#RRGGBB` format.
413
- * Also available as the CSS variable `var(--tg-theme-destructive-text-color)`.
435
+ * **Bot API 7.0+** Text color for destructive actions in the `#RRGGBB`
436
+ * format. Also available as the CSS variable
437
+ * `var(--tg-theme-destructive-text-color)`.
414
438
  */
415
439
  destructive_text_color?: string;
416
440
  }
@@ -428,7 +452,8 @@ interface PopupParams {
428
452
  */
429
453
  message: string;
430
454
  /**
431
- * List of buttons to be displayed in the popup, 1-3 buttons. Set to [{“type”:“close”}] by default.
455
+ * List of buttons to be displayed in the popup, 1-3 buttons. Set to
456
+ * [{“type”:“close”}] by default.
432
457
  */
433
458
  buttons?: PopupButton[];
434
459
  }
@@ -439,23 +464,25 @@ interface PopupParams {
439
464
  type PopupButton =
440
465
  & {
441
466
  /**
442
- * Identifier of the button, 0-64 characters. Set to empty string by default.
443
- * If the button is pressed, its id is returned in the callback and the popupClosed event.
467
+ * Identifier of the button, 0-64 characters. Set to empty string by
468
+ * default. If the button is pressed, its id is returned in the callback
469
+ * and the popupClosed event.
444
470
  */
445
471
  id?: string;
446
472
  /**
447
- * Type of the button. Set to default by default.
448
- * Can be one of these values:
473
+ * Type of the button. Set to default by default. Can be one of these
474
+ * values:
449
475
  * - `default`, a button with the default style,
450
476
  * - `ok`, a button with the localized text “OK”,
451
477
  * - `close`, a button with the localized text “Close”,
452
478
  * - `cancel`, a button with the localized text “Cancel”,
453
- * - `destructive`, a button with a style that indicates a destructive action (e.g. “Remove”, “Delete”, etc.).
479
+ * - `destructive`, a button with a style that indicates a destructive
480
+ * action (e.g. “Remove”, “Delete”, etc.).
454
481
  */
455
482
  type?: "default" | "ok" | "close" | "cancel" | "destructive";
456
483
  /**
457
- * The text to be displayed on the button, 0-64 characters.
458
- * Required if type is default or destructive. Irrelevant for other types.
484
+ * The text to be displayed on the button, 0-64 characters. Required if
485
+ * type is default or destructive. Irrelevant for other types.
459
486
  */
460
487
  text?: string;
461
488
  }
@@ -509,7 +536,8 @@ interface MainButton {
509
536
  /** Current button color. Set to themeParams.button_color by default. */
510
537
  color: string;
511
538
  /**
512
- * Current button text color. Set to themeParams.button_text_color by default.
539
+ * Current button text color. Set to themeParams.button_text_color by
540
+ * default.
513
541
  */
514
542
  textColor: string;
515
543
  /** Shows whether the button is visible. Set to false by default. */
@@ -528,9 +556,9 @@ interface MainButton {
528
556
  /** A method that deletes a previously set handler */
529
557
  offClick(callback: () => void): MainButton;
530
558
  /**
531
- * A method to make the button visible. Note that opening the Web App from the
532
- * attachment menu hides the main button until the user interacts with the
533
- * Web App interface.
559
+ * A method to make the button visible. Note that opening the Web App from
560
+ * the attachment menu hides the main button until the user interacts with
561
+ * the Web App interface.
534
562
  */
535
563
  show(): MainButton;
536
564
  /** A method to hide the button. */
@@ -574,8 +602,8 @@ interface MainButtonParams {
574
602
  }
575
603
 
576
604
  /**
577
- * This object controls the Settings item in the context menu of the Mini App in the
578
- * Telegram interface.
605
+ * This object controls the Settings item in the context menu of the Mini App in
606
+ * the Telegram interface.
579
607
  */
580
608
  interface SettingsButton {
581
609
  /**
@@ -583,19 +611,20 @@ interface SettingsButton {
583
611
  */
584
612
  isVisible: boolean;
585
613
  /**
586
- * **Bot API 7.0+** A method that sets the press event handler for the Settings item in
587
- * the context menu. An alias for
614
+ * **Bot API 7.0+** A method that sets the press event handler for the
615
+ * Settings item in the context menu. An alias for
588
616
  * `Telegram.WebApp.onEvent('settingsButtonClicked', callback)`
589
617
  */
590
618
  onClick(callback: () => void): SettingsButton;
591
619
  /**
592
- * **Bot API 7.0+** A method that removes the press event handler from the Settings item
593
- * in the context menu. An alias for
620
+ * **Bot API 7.0+** A method that removes the press event handler from the
621
+ * Settings item in the context menu. An alias for
594
622
  * `Telegram.WebApp.offEvent('settingsButtonClicked', callback)`
595
623
  */
596
624
  offClick(callback: () => void): SettingsButton;
597
625
  /**
598
- * **Bot API 7.0+** A method to make the Settings item in the context menu visible.
626
+ * **Bot API 7.0+** A method to make the Settings item in the context menu
627
+ * visible.
599
628
  */
600
629
  show(): SettingsButton;
601
630
  /**
@@ -641,13 +670,13 @@ interface HapticFeedback {
641
670
 
642
671
  interface CloudStorage {
643
672
  /**
644
- * A method that stores a value in the cloud storage using the
645
- * specified key.
673
+ * A method that stores a value in the cloud storage using the specified
674
+ * key.
646
675
  *
647
- * @param key The key should contain 1-128 characters, only A-Z, a-z, 0-9,
648
- * _ and - are allowed.
649
- * @param value The value should contain 0-4096 characters. You can store
650
- * up to 1024 keys in the cloud storage.
676
+ * @param key The key should contain 1-128 characters, only A-Z, a-z, 0-9, _
677
+ * and - are allowed.
678
+ * @param value The value should contain 0-4096 characters. You can store up
679
+ * to 1024 keys in the cloud storage.
651
680
  * @param callback If an optional callback parameter was passed, the
652
681
  * callback function will be called. In case of an error, the first argument
653
682
  * will contain the error. In case of success, the first argument will be
@@ -656,15 +685,15 @@ interface CloudStorage {
656
685
  */
657
686
  setItem(key: string, value: string, callback?: CloudStorageSetItemCallback): CloudStorage;
658
687
  /**
659
- * A method that receives a value from the cloud storage using
660
- * the specified key.
688
+ * A method that receives a value from the cloud storage using the specified
689
+ * key.
661
690
  *
662
- * @param key The key should contain 1-128 characters, only A-Z, a-z, 0-9,
663
- * _ and - are allowed.
664
- * @param callback In case of an error, the callback function will
665
- * be called and the first argument will contain the error. In case of
666
- * success, the first argument will be null and the value will be passed
667
- * as the second argument.
691
+ * @param key The key should contain 1-128 characters, only A-Z, a-z, 0-9, _
692
+ * and - are allowed.
693
+ * @param callback In case of an error, the callback function will be called
694
+ * and the first argument will contain the error. In case of success, the
695
+ * first argument will be null and the value will be passed as the second
696
+ * argument.
668
697
  */
669
698
  getItem(key: string, callback?: CloudStorageGetItemCallback): CloudStorage;
670
699
  /**
@@ -674,22 +703,22 @@ interface CloudStorage {
674
703
  * @param key The keys should contain 1-128 characters, only A-Z, a-z, 0-9,
675
704
  * _ and - are allowed.
676
705
  * @param callback In case of an error, the callback? function will be
677
- * called and the first argument will contain the error. In case of
678
- * success, the first argument will be null and the values will be passed
679
- * as the second argument.
706
+ * called and the first argument will contain the error. In case of success,
707
+ * the first argument will be null and the values will be passed as the
708
+ * second argument.
680
709
  */
681
710
  getItems(keys: string[], callback?: CloudStorageGetItemsCallback): CloudStorage;
682
711
  /**
683
712
  * A method that removes a value from the cloud storage using the specified
684
713
  * key.
685
714
  *
686
- * @param key The key should contain 1-128 characters, only A-Z, a-z, 0-9,
687
- * _ and - are allowed.
715
+ * @param key The key should contain 1-128 characters, only A-Z, a-z, 0-9, _
716
+ * and - are allowed.
688
717
  * @param callback If an optional callback parameter was passed, the
689
- * callback function will be called. In case of an error, the first
690
- * argument will contain the error. In case of success, the first
691
- * argument will be null and the second argument will be a boolean
692
- * indicating whether the value was removed.
718
+ * callback function will be called. In case of an error, the first argument
719
+ * will contain the error. In case of success, the first argument will be
720
+ * null and the second argument will be a boolean indicating whether the
721
+ * value was removed.
693
722
  */
694
723
  removeItem(key: string, callback?: CloudStorageRemoveItemCallback): CloudStorage;
695
724
  /**
@@ -699,10 +728,10 @@ interface CloudStorage {
699
728
  * @param key The keys should contain 1-128 characters, only A-Z, a-z, 0-9,
700
729
  * _ and - are allowed.
701
730
  * @param callback If an optional callback parameter was passed, the
702
- * callback function will be called. In case of an error, the first
703
- * argument will contain the error. In case of success, the first
704
- * argument will be null and the second argument will be a boolean
705
- * indicating whether the values were removed.
731
+ * callback function will be called. In case of an error, the first argument
732
+ * will contain the error. In case of success, the first argument will be
733
+ * null and the second argument will be a boolean indicating whether the
734
+ * values were removed.
706
735
  */
707
736
  removeItems(keys: string[], callback?: CloudStorageRemoveItemsCallback): CloudStorage;
708
737
  /**
@@ -724,8 +753,8 @@ type CloudStorageRemoveItemsCallback = (error: string | null, success: null | tr
724
753
  type CloudStorageGetKeysCallback = (error: string | null, keys: null | string[]) => void;
725
754
 
726
755
  /**
727
- * This object controls biometrics on the device. Before the first use
728
- * of this object, it needs to be initialized using the init method.
756
+ * This object controls biometrics on the device. Before the first use of this
757
+ * object, it needs to be initialized using the init method.
729
758
  */
730
759
  interface BiometricManager {
731
760
  /**
@@ -737,7 +766,8 @@ interface BiometricManager {
737
766
  */
738
767
  isBiometricAvailable: boolean;
739
768
  /**
740
- * The type of biometrics currently available on the device. Can be one of these values:
769
+ * The type of biometrics currently available on the device. Can be one of
770
+ * these values:
741
771
  * - finger, fingerprint-based biometrics,
742
772
  * - face, face-based biometrics,
743
773
  * - unknown, biometrics of an unknown type.
@@ -756,30 +786,34 @@ interface BiometricManager {
756
786
  */
757
787
  isBiometricTokenSaved: boolean;
758
788
  /**
759
- * A unique device identifier that can be used to match the token to the device.
789
+ * A unique device identifier that can be used to match the token to the
790
+ * device.
760
791
  */
761
792
  deviceId: string;
762
793
  /**
763
- * A method that initializes the BiometricManager object. It should be called before
764
- * the object's first use. If an optional callback parameter was passed, the callback
765
- * function will be called when the object is initialized.
794
+ * A method that initializes the BiometricManager object. It should be
795
+ * called before the object's first use. If an optional callback parameter
796
+ * was passed, the callback function will be called when the object is
797
+ * initialized.
766
798
  */
767
799
  init: (callback?: () => void) => BiometricManager;
768
800
  /**
769
- * A method that requests permission to use biometrics according to the params
770
- * argument of type BiometricRequestAccessParams. If an optional callback
771
- * parameter was passed, the callback function will be called and the first argument
772
- * will be a boolean indicating whether the user granted access.
801
+ * A method that requests permission to use biometrics according to the
802
+ * params argument of type BiometricRequestAccessParams. If an optional
803
+ * callback parameter was passed, the callback function will be called and
804
+ * the first argument will be a boolean indicating whether the user granted
805
+ * access.
773
806
  */
774
807
  requestAccess: (
775
808
  params: BiometricRequestAccessParams,
776
809
  callback?: BiometricRequestAccessCallback,
777
810
  ) => BiometricManager;
778
811
  /**
779
- * A method that authenticates the user using biometrics according to the params
780
- * argument of type BiometricAuthenticateParams. If an optional callback parameter
781
- * was passed, the callback function will be called and the first argument will be
782
- * a boolean indicating whether the user authenticated successfully.
812
+ * A method that authenticates the user using biometrics according to the
813
+ * params argument of type BiometricAuthenticateParams. If an optional
814
+ * callback parameter was passed, the callback function will be called and
815
+ * the first argument will be a boolean indicating whether the user
816
+ * authenticated successfully.
783
817
  *
784
818
  * If so, the second argument will be a biometric token.
785
819
  */
@@ -788,21 +822,24 @@ interface BiometricManager {
788
822
  callback?: BiometricAuthenticateCallback,
789
823
  ) => BiometricManager;
790
824
  /**
791
- * A method that updates the biometric token in secure storage on the device.
792
- * To remove the token, pass an empty string. If an optional callback parameter
793
- * was passed, the callback function will be called and the first argument will be
794
- * a boolean indicating whether the token was updated.
825
+ * A method that updates the biometric token in secure storage on the
826
+ * device. To remove the token, pass an empty string. If an optional
827
+ * callback parameter was passed, the callback function will be called and
828
+ * the first argument will be a boolean indicating whether the token was
829
+ * updated.
795
830
  */
796
831
  updateBiometricToken: (
797
832
  token: string,
798
833
  callback?: BiometricUpdateBiometricTokenCallback,
799
834
  ) => BiometricManager;
800
835
  /**
801
- * A method that opens the biometric access settings for bots. Useful when you
802
- * need to request biometrics access to users who haven't granted it yet.
836
+ * A method that opens the biometric access settings for bots. Useful when
837
+ * you need to request biometrics access to users who haven't granted it
838
+ * yet.
803
839
  *
804
- * Note that this method can be called only in response to user interaction with
805
- * the Mini App interface (e.g. a click inside the Mini App or on the main button)
840
+ * Note that this method can be called only in response to user interaction
841
+ * with the Mini App interface (e.g. a click inside the Mini App or on the
842
+ * main button)
806
843
  */
807
844
  openSettings: () => BiometricManager;
808
845
  }
@@ -812,24 +849,26 @@ type BiometricAuthenticateCallback = (isAuthenticated: boolean, biometricToken?:
812
849
  type BiometricUpdateBiometricTokenCallback = (applied: boolean) => void;
813
850
 
814
851
  /**
815
- * This object describes the native popup for requesting permission to use biometrics.
852
+ * This object describes the native popup for requesting permission to use
853
+ * biometrics.
816
854
  */
817
855
  interface BiometricRequestAccessParams {
818
856
  /**
819
- * The text to be displayed to a user in the popup describing why the bot needs
820
- * access to biometrics, 0-128 characters.
857
+ * The text to be displayed to a user in the popup describing why the bot
858
+ * needs access to biometrics, 0-128 characters.
821
859
  */
822
860
  reason?: string;
823
861
  }
824
862
 
825
863
  /**
826
- * This object describes the native popup for authenticating the user using biometrics.
864
+ * This object describes the native popup for authenticating the user using
865
+ * biometrics.
827
866
  */
828
867
  interface BiometricAuthenticateParams {
829
868
  /**
830
- * The text to be displayed to a user in the popup describing why you are asking them
831
- * to authenticate and what action you will be taking based on that authentication,
832
- * 0-128 characters.
869
+ * The text to be displayed to a user in the popup describing why you are
870
+ * asking them to authenticate and what action you will be taking based on
871
+ * that authentication, 0-128 characters.
833
872
  */
834
873
  reason?: string;
835
874
  }
@@ -840,16 +879,16 @@ interface BiometricAuthenticateParams {
840
879
  */
841
880
  interface WebAppInitData {
842
881
  /**
843
- * A unique identifier for the Web App session, required for sending messages
844
- * via the answerWebAppQuery method.
882
+ * A unique identifier for the Web App session, required for sending
883
+ * messages via the answerWebAppQuery method.
845
884
  */
846
885
  query_id?: string;
847
886
  /** An object containing data about the current user. */
848
887
  user?: WebAppUser;
849
888
  /**
850
- * An object containing data about the chat partner of the current user in the
851
- * chat where the bot was launched via the attachment menu. Returned only for
852
- * Web Apps launched via the attachment menu.
889
+ * An object containing data about the chat partner of the current user in
890
+ * the chat where the bot was launched via the attachment menu. Returned
891
+ * only for Web Apps launched via the attachment menu.
853
892
  */
854
893
  receiver?: WebAppUser;
855
894
  /**
@@ -859,21 +898,21 @@ interface WebAppInitData {
859
898
  */
860
899
  chat?: WebAppChat;
861
900
  /**
862
- * Type of the chat from which the Web App was opened.
863
- * Can be either “sender” for a private chat with the user opening the link,
864
- * “private”, “group”, “supergroup”, or “channel”.
865
- * Returned only for Web Apps launched from direct links.
901
+ * Type of the chat from which the Web App was opened. Can be either
902
+ * “sender” for a private chat with the user opening the link, “private”,
903
+ * “group”, “supergroup”, or “channel”. Returned only for Web Apps launched
904
+ * from direct links.
866
905
  */
867
906
  chat_type?: "sender" | "private" | "group" | "supergroup" | "channel";
868
907
  /**
869
- * Global identifier, uniquely corresponding to the chat from which the Web App was opened.
870
- * Returned only for Web Apps launched from a direct link.
908
+ * Global identifier, uniquely corresponding to the chat from which the Web
909
+ * App was opened. Returned only for Web Apps launched from a direct link.
871
910
  */
872
911
  chat_instance?: string;
873
912
  /**
874
- * The value of the startattach parameter, passed via link. Only returned for
875
- * Web Apps when launched from the attachment menu via link. The value of the
876
- * start_param parameter will also be passed in the GET-parameter
913
+ * The value of the startattach parameter, passed via link. Only returned
914
+ * for Web Apps when launched from the attachment menu via link. The value
915
+ * of the start_param parameter will also be passed in the GET-parameter
877
916
  * tgWebAppStartParam, so the Web App can load the correct interface right
878
917
  * away.
879
918
  */
@@ -895,11 +934,11 @@ interface WebAppInitData {
895
934
  /** This object contains the data of the Web App user. */
896
935
  interface WebAppUser {
897
936
  /**
898
- * A unique identifier for the user or bot. This number may have more than 32
899
- * significant bits and some programming languages may have difficulty/silent
900
- * defects in interpreting it. It has at most 52 significant bits, so a 64-bit
901
- * integer or a double-precision float type is safe for storing this
902
- * identifier.
937
+ * A unique identifier for the user or bot. This number may have more than
938
+ * 32 significant bits and some programming languages may have
939
+ * difficulty/silent defects in interpreting it. It has at most 52
940
+ * significant bits, so a 64-bit integer or a double-precision float type is
941
+ * safe for storing this identifier.
903
942
  */
904
943
  id: number;
905
944
  /** True, if this user is a bot. Returns in the receiver field only. */
@@ -919,8 +958,8 @@ interface WebAppUser {
919
958
  /** True, if this user allowed the bot to message them. */
920
959
  allows_write_to_pm?: true;
921
960
  /**
922
- * URL of the user’s profile photo. The photo can be in .jpeg or .svg formats.
923
- * Only returned for Web Apps launched from the attachment menu.
961
+ * URL of the user’s profile photo. The photo can be in .jpeg or .svg
962
+ * formats. Only returned for Web Apps launched from the attachment menu.
924
963
  */
925
964
  photo_url?: string;
926
965
  }
@@ -967,16 +1006,17 @@ interface ScanQrPopupParams {
967
1006
  }
968
1007
 
969
1008
  /**
970
- * This object describes contact information shared when requestContact was approved by the user.
1009
+ * This object describes contact information shared when requestContact was
1010
+ * approved by the user.
971
1011
  */
972
1012
  interface RequestContactResponseSent {
973
1013
  /** Status 'sent' indicates that contact information has been shared. */
974
1014
  status: "sent";
975
1015
  /** A status message or result as a string. */
976
1016
  response: string;
977
- /** Contains sensitive information shared upon user consent. WARNING: Data from
978
- * this field should not be trusted. You should only use data from `response` on
979
- * the bot's server and only after it has been validated. */
1017
+ /** Contains sensitive information shared upon user consent. WARNING: Data
1018
+ * from this field should not be trusted. You should only use data from
1019
+ * `response` on the bot's server and only after it has been validated. */
980
1020
  responseUnsafe: {
981
1021
  /** Authorization date for sharing contact information. */
982
1022
  auth_date: string;
@@ -1000,7 +1040,8 @@ interface RequestContactResponseSent {
1000
1040
  * This object only contains a status to indicate the cancellation.
1001
1041
  */
1002
1042
  interface RequestContactResponseCancelled {
1003
- /** Status 'cancelled', indicates that user cancelled the contact share request. */
1043
+ /** Status 'cancelled', indicates that user cancelled the contact share
1044
+ * request. */
1004
1045
  status: "cancelled";
1005
1046
  }
1006
1047
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/telegram-web-app",
3
- "version": "7.3.0",
3
+ "version": "7.3.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",
@@ -30,6 +30,6 @@
30
30
  },
31
31
  "scripts": {},
32
32
  "dependencies": {},
33
- "typesPublisherContentHash": "454635b3bca8c32e7748437927a9e968f86ea42b27df2ebebc933218e84373fa",
33
+ "typesPublisherContentHash": "9fcc5a91b3a09ca84a2f4cad0107ca63464a781a4cc3dfbf0a3eb9aa5d908916",
34
34
  "typeScriptVersion": "4.8"
35
35
  }