@types/telegram-web-app 6.9.3 → 7.0.0

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: Tue, 07 Nov 2023 15:11:36 GMT
11
+ * Last updated: Sun, 04 Feb 2024 10:07:03 GMT
12
12
  * Dependencies: none
13
13
 
14
14
  # Credits
@@ -100,6 +100,11 @@ interface WebApp {
100
100
  * bottom of the Web App in the Telegram interface.
101
101
  */
102
102
  MainButton: MainButton;
103
+ /**
104
+ * An object for controlling the Settings item in the context menu of the Mini App
105
+ * in the Telegram interface.
106
+ */
107
+ SettingsButton: SettingsButton;
103
108
  /**
104
109
  * An object for controlling haptic feedback.
105
110
  */
@@ -234,7 +239,7 @@ interface WebApp {
234
239
  * popup is closed and the first argument will be a boolean indicating whether the user
235
240
  * pressed the 'OK' button.
236
241
  */
237
- showConfirm(message: string, callback?: (ok?: boolean) => void): void;
242
+ showConfirm(message: string, callback?: (ok: boolean) => void): void;
238
243
  /**
239
244
  * A method that shows a native popup for scanning a QR code described by the params argument of the type ScanQrPopupParams.
240
245
  * The Web App will receive the event qrTextReceived every time the scanner catches a code with text data.
@@ -302,40 +307,71 @@ interface WebApp {
302
307
  */
303
308
  interface ThemeParams {
304
309
  /**
305
- * Background color in the #RRGGBB format. Also available as the CSS variable
306
- * var(--tg-theme-bg-color).
310
+ * Background color in the `#RRGGBB` format.
311
+ * Also available as the CSS variable `var(--tg-theme-bg-color)`.
312
+ */
313
+ bg_color?: string;
314
+ /**
315
+ * Main text color in the `#RRGGBB` format.
316
+ * Also available as the CSS variable `var(--tg-theme-text-color)`.
317
+ */
318
+ text_color?: string;
319
+ /**
320
+ * Hint text color in the `#RRGGBB` format.
321
+ * Also available as the CSS variable `var(--tg-theme-hint-color)`.
322
+ */
323
+ hint_color?: string;
324
+ /**
325
+ * Link color in the `#RRGGBB` format.
326
+ * Also available as the CSS variable `var(--tg-theme-link-color)`.
307
327
  */
308
- bg_color: string;
328
+ link_color?: string;
309
329
  /**
310
- * Main text color in the #RRGGBB format. Also available as the CSS variable
311
- * var(--tg-theme-text-color).
330
+ * Button color in the `#RRGGBB` format.
331
+ * Also available as the CSS variable `var(--tg-theme-button-color)`.
312
332
  */
313
- text_color: string;
333
+ button_color?: string;
314
334
  /**
315
- * Hint text color in the #RRGGBB format. Also available as the CSS variable
316
- * var(--tg-theme-hint-color).
335
+ * Button text color in the `#RRGGBB` format.
336
+ * Also available as the CSS variable `var(--tg-theme-button-text-color)`.
317
337
  */
318
- hint_color: string;
338
+ button_text_color?: string;
319
339
  /**
320
- * Link color in the #RRGGBB format. Also available as the CSS variable
321
- * var(--tg-theme-link-color).
340
+ * **Bot API 6.1+** Secondary background color in the `#RRGGBB` format.
341
+ * Also available as the CSS variable `var(--tg-theme-secondary-bg-color)`.
322
342
  */
323
- link_color: string;
343
+ secondary_bg_color?: string;
324
344
  /**
325
- * Button color in the #RRGGBB format. Also available as the CSS variable
326
- * var(--tg-theme-button-color).
345
+ * **Bot API 7.0+** Header background color in the `#RRGGBB` format.
346
+ * Also available as the CSS variable `var(--tg-theme-header-bg-color)`.
327
347
  */
328
- button_color: string;
348
+ header_bg_color?: string;
329
349
  /**
330
- * Button text color in the #RRGGBB format. Also available as the CSS variable
331
- * var(--tg-theme-button-text-color).
350
+ * **Bot API 7.0+** Accent text color in the `#RRGGBB` format.
351
+ * Also available as the CSS variable `var(--tg-theme-accent-text-color)`.
332
352
  */
333
- button_text_color: string;
353
+ accent_text_color?: string;
334
354
  /**
335
- * Optional. Bot API 6.1+ Secondary background color in the #RRGGBB format.
336
- * Also available as the CSS variable var(--tg-theme-secondary-bg-color).
355
+ * **Bot API 7.0+** Background color for the section in the `#RRGGBB` format. It is
356
+ * recommended to use this in conjunction with *secondary_bg_color*.
357
+ * Also available as the CSS variable `var(--tg-theme-section-bg-color)`.
337
358
  */
338
- secondary_bg_color: string;
359
+ section_bg_color?: string;
360
+ /**
361
+ * **Bot API 7.0+** Header text color for the section in the `#RRGGBB` format.
362
+ * Also available as the CSS variable `var(--tg-theme-section-header-text-color)`.
363
+ */
364
+ section_header_text_color?: `#${string}`;
365
+ /**
366
+ * **Bot API 7.0+** Subtitle text color in the `#RRGGBB` format.
367
+ * Also available as the CSS variable `var(--tg-theme-subtitle-text-color)`.
368
+ */
369
+ subtitle_text_color?: string;
370
+ /**
371
+ * **Bot API 7.0+** Text color for destructive actions in the `#RRGGBB` format.
372
+ * Also available as the CSS variable `var(--tg-theme-destructive-text-color)`.
373
+ */
374
+ destructive_text_color?: string;
339
375
  }
340
376
 
341
377
  /**
@@ -496,6 +532,37 @@ interface MainButtonParams {
496
532
  is_visible?: boolean;
497
533
  }
498
534
 
535
+ /**
536
+ * This object controls the Settings item in the context menu of the Mini App in the
537
+ * Telegram interface.
538
+ */
539
+ interface SettingsButton {
540
+ /**
541
+ * Shows whether the context menu item is visible. Set to false by default.
542
+ */
543
+ isVisible: boolean;
544
+ /**
545
+ * **Bot API 7.0+** A method that sets the press event handler for the Settings item in
546
+ * the context menu. An alias for
547
+ * `Telegram.WebApp.onEvent('settingsButtonClicked', callback)`
548
+ */
549
+ onClick(callback: () => void): SettingsButton;
550
+ /**
551
+ * **Bot API 7.0+** A method that removes the press event handler from the Settings item
552
+ * in the context menu. An alias for
553
+ * `Telegram.WebApp.offEvent('settingsButtonClicked', callback)`
554
+ */
555
+ offClick(callback: () => void): SettingsButton;
556
+ /**
557
+ * **Bot API 7.0+** A method to make the Settings item in the context menu visible.
558
+ */
559
+ show(): SettingsButton;
560
+ /**
561
+ * **Bot API 7.0+** A method to hide the Settings item in the context menu.
562
+ */
563
+ hide(): SettingsButton;
564
+ }
565
+
499
566
  /**
500
567
  * This object controls haptic feedback.
501
568
  */
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/telegram-web-app",
3
- "version": "6.9.3",
3
+ "version": "7.0.0",
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,7 +30,6 @@
30
30
  },
31
31
  "scripts": {},
32
32
  "dependencies": {},
33
- "typesPublisherContentHash": "643c9f2e4e2f451051a00f0ba45c9870a1ebe7232849e2e11fe0cc2cd0967824",
34
- "typeScriptVersion": "4.5",
35
- "nonNpm": true
33
+ "typesPublisherContentHash": "268c74054d2f36d843d570017d3e167f71be94be3621b7ad5e6ec33c95bd93be",
34
+ "typeScriptVersion": "4.6"
36
35
  }