@types/telegram-web-app 7.8.1 → 7.10.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, 27 Aug 2024 08:38:05 GMT
11
+ * Last updated: Mon, 23 Sep 2024 21:07:32 GMT
12
12
  * Dependencies: none
13
13
 
14
14
  # Credits
@@ -37,14 +37,14 @@ interface WebApp {
37
37
  */
38
38
  themeParams: ThemeParams;
39
39
  /**
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
40
+ * True if the Web App is expanded to the maximum available height.
41
+ * False, if the Web App occupies part of the screen and can be expanded to the
42
42
  * full height using the expand() method.
43
43
  */
44
44
  isExpanded: boolean;
45
45
  /**
46
- * The current height of the visible area of the Web App. Also available in
47
- * CSS as the variable var(--tg-viewport-height).
46
+ * The current height of the visible area of the Web App.
47
+ * Also available in 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
50
  * lower part remaining outside the screen area. From this position, the
@@ -86,6 +86,10 @@ interface WebApp {
86
86
  * Current background color in the #RRGGBB format.
87
87
  */
88
88
  backgroundColor: string;
89
+ /**
90
+ * Current bottom bar color in the #RRGGBB format.
91
+ */
92
+ bottomBarColor: string;
89
93
  /**
90
94
  * True, if the confirmation dialog is enabled while the user is trying to
91
95
  * close the Web App. False, if the confirmation dialog is disabled.
@@ -100,7 +104,12 @@ interface WebApp {
100
104
  * An object for controlling the main button, which is displayed at the
101
105
  * bottom of the Web App in the Telegram interface.
102
106
  */
103
- MainButton: MainButton;
107
+ MainButton: BottomButton;
108
+ /**
109
+ * An object for controlling the secondary button,
110
+ * which is displayed at the bottom of the Mini App in the Telegram interface.
111
+ */
112
+ SecondaryButton: BottomButton;
104
113
  /**
105
114
  * An object for controlling the Settings item in the context menu of the
106
115
  * Mini App in the Telegram interface.
@@ -133,7 +142,12 @@ interface WebApp {
133
142
  * A method that sets the app background color in the `#RRGGBB` format or
134
143
  * you can use keywords bg_color, secondary_bg_color instead.
135
144
  */
136
- setBackgroundColor(color: "bg_color" | "secondary_bg_color" | (string & {})): void;
145
+ setBackgroundColor(color: "bg_color" | "secondary_bg_color" | "bottom_bar_bg_color" | (string & {})): void;
146
+ /**
147
+ * A method that sets the app's bottom bar color in the #RRGGBB format.
148
+ * You can also use the keywords bg_color, secondary_bg_color and bottom_bar_bg_color.
149
+ */
150
+ setBottomBarColor(color: "bg_color" | "secondary_bg_color" | (string & {})): void;
137
151
  /**
138
152
  * A method that enables a confirmation dialog while the user is trying to
139
153
  * close the Web App.
@@ -150,6 +164,7 @@ interface WebApp {
150
164
  */
151
165
  onEvent(eventType: "themeChanged", eventHandler: ThemeChangedCallback): void;
152
166
  onEvent(eventType: "mainButtonClicked", eventHandler: MainButtonClickedCallback): void;
167
+ onEvent(eventType: "secondaryButtonClicked", eventHandler: SecondaryButtonClickedCallback): void;
153
168
  onEvent(eventType: "backButtonClicked", eventHandler: BackButtonClickedCallback): void;
154
169
  onEvent(eventType: "settingsButtonClicked", eventHandler: SettingsButtonClickedCallback): void;
155
170
  onEvent(eventType: "popupClosed", eventHandler: PopupClosedCallback): void;
@@ -348,6 +363,7 @@ interface WebApp {
348
363
  type ThemeChangedCallback = () => void;
349
364
  type ViewportChangedCallback = (eventData: { isStateStable: boolean }) => void;
350
365
  type MainButtonClickedCallback = () => void;
366
+ type SecondaryButtonClickedCallback = () => void;
351
367
  type BackButtonClickedCallback = () => void;
352
368
  type SettingsButtonClickedCallback = () => void;
353
369
  type InvoiceClosedCallback = (eventData: { url: string; status: "paid" | "cancelled" | "failed" | "pending" }) => void;
@@ -368,77 +384,79 @@ type BiometricTokenUpdatedCallback = (eventData: { isUpdated: boolean }) => void
368
384
  */
369
385
  interface ThemeParams {
370
386
  /**
371
- * Background color in the `#RRGGBB` format. Also available as the CSS
372
- * variable `var(--tg-theme-bg-color)`.
387
+ * Background color in the `#RRGGBB` format.
388
+ * Also available as the CSS variable `var(--tg-theme-bg-color)`.
373
389
  */
374
390
  bg_color?: string;
375
391
  /**
376
- * Main text color in the `#RRGGBB` format. Also available as the CSS
377
- * variable `var(--tg-theme-text-color)`.
392
+ * Main text color in the `#RRGGBB` format.
393
+ * Also available as the CSS variable `var(--tg-theme-text-color)`.
378
394
  */
379
395
  text_color?: string;
380
396
  /**
381
- * Hint text color in the `#RRGGBB` format. Also available as the CSS
382
- * variable `var(--tg-theme-hint-color)`.
397
+ * Hint text color in the `#RRGGBB` format.
398
+ * Also available as the CSS variable `var(--tg-theme-hint-color)`.
383
399
  */
384
400
  hint_color?: string;
385
401
  /**
386
- * Link color in the `#RRGGBB` format. Also available as the CSS variable
387
- * `var(--tg-theme-link-color)`.
402
+ * Link color in the `#RRGGBB` format.
403
+ * Also available as the CSS variable `var(--tg-theme-link-color)`.
388
404
  */
389
405
  link_color?: string;
390
406
  /**
391
- * Button color in the `#RRGGBB` format. Also available as the CSS variable
392
- * `var(--tg-theme-button-color)`.
407
+ * Button color in the `#RRGGBB` format.
408
+ * Also available as the CSS variable `var(--tg-theme-button-color)`.
393
409
  */
394
410
  button_color?: string;
395
411
  /**
396
- * Button text color in the `#RRGGBB` format. Also available as the CSS
397
- * variable `var(--tg-theme-button-text-color)`.
412
+ * Button text color in the `#RRGGBB` format.
413
+ * Also available as the CSS variable `var(--tg-theme-button-text-color)`.
398
414
  */
399
415
  button_text_color?: string;
400
416
  /**
401
- * **Bot API 6.1+** Secondary background color in the `#RRGGBB` format. Also
402
- * available as the CSS variable `var(--tg-theme-secondary-bg-color)`.
417
+ * **Bot API 6.1+** Secondary background color in the `#RRGGBB` format.
418
+ * Also available as the CSS variable `var(--tg-theme-secondary-bg-color)`.
403
419
  */
404
420
  secondary_bg_color?: string;
405
421
  /**
406
- * **Bot API 7.0+** Header background color in the `#RRGGBB` format. Also
407
- * available as the CSS variable `var(--tg-theme-header-bg-color)`.
422
+ * **Bot API 7.0+** Header background color in the `#RRGGBB` format.
423
+ * Also available as the CSS variable `var(--tg-theme-header-bg-color)`.
408
424
  */
409
425
  header_bg_color?: string;
410
426
  /**
411
- * **Bot API 7.0+** Accent text color in the `#RRGGBB` format. Also
412
- * available as the CSS variable `var(--tg-theme-accent-text-color)`.
427
+ * **Bot API 7.10+** Bottom background color in the #RRGGBB format.
428
+ * Also available as the CSS variable var(--tg-theme-bottom-bar-bg-color).
429
+ */
430
+ bottom_bar_bg_color?: string;
431
+ /**
432
+ * **Bot API 7.0+** Accent text color in the `#RRGGBB` format.
433
+ * Also available as the CSS variable `var(--tg-theme-accent-text-color)`.
413
434
  */
414
435
  accent_text_color?: string;
415
436
  /**
416
- * **Bot API 7.0+** Background color for the section in the `#RRGGBB`
417
- * format. It is recommended to use this in conjunction with
418
- * *secondary_bg_color*. Also available as the CSS variable
419
- * `var(--tg-theme-section-bg-color)`.
437
+ * **Bot API 7.0+** Background color for the section in the `#RRGGBB` format.
438
+ * It is recommended to use this in conjunction with *secondary_bg_color*.
439
+ * Also available as the CSS variable `var(--tg-theme-section-bg-color)`.
420
440
  */
421
441
  section_bg_color?: string;
422
442
  /**
423
- * **Bot API 7.0+** Header text color for the section in the `#RRGGBB`
424
- * format. Also available as the CSS variable
425
- * `var(--tg-theme-section-header-text-color)`.
443
+ * **Bot API 7.0+** Header text color for the section in the `#RRGGBB` format.
444
+ * Also available as the CSS variable `var(--tg-theme-section-header-text-color)`.
426
445
  */
427
446
  section_header_text_color?: `#${string}`;
428
447
  /**
429
- * **Bot API 7.6+** Section separator color in the `#RRGGBB` format. Also
430
- * available as the CSS variable `var(--tg-theme-section-separator-color)`.
448
+ * **Bot API 7.6+** Section separator color in the `#RRGGBB` format.
449
+ * Also available as the CSS variable `var(--tg-theme-section-separator-color)`.
431
450
  */
432
451
  section_separator_color?: string;
433
452
  /**
434
- * **Bot API 7.0+** Subtitle text color in the `#RRGGBB` format. Also
435
- * available as the CSS variable `var(--tg-theme-subtitle-text-color)`.
453
+ * **Bot API 7.0+** Subtitle text color in the `#RRGGBB` format.
454
+ * Also available as the CSS variable `var(--tg-theme-subtitle-text-color)`.
436
455
  */
437
456
  subtitle_text_color?: string;
438
457
  /**
439
- * **Bot API 7.0+** Text color for destructive actions in the `#RRGGBB`
440
- * format. Also available as the CSS variable
441
- * `var(--tg-theme-destructive-text-color)`.
458
+ * **Bot API 7.0+** Text color for destructive actions in the `#RRGGBB` format.
459
+ * Also available as the CSS variable `var(--tg-theme-destructive-text-color)`.
442
460
  */
443
461
  destructive_text_color?: string;
444
462
  }
@@ -534,7 +552,7 @@ interface BackButton {
534
552
  * This object controls the main button, which is displayed at the bottom of the
535
553
  * Web App in the Telegram interface.
536
554
  */
537
- interface MainButton {
555
+ interface BottomButton {
538
556
  /** Current button text. Set to CONTINUE by default. */
539
557
  text: string;
540
558
  /** Current button color. Set to themeParams.button_color by default. */
@@ -551,35 +569,35 @@ interface MainButton {
551
569
  /** Readonly. Shows whether the button is displaying a loading indicator. */
552
570
  isProgressVisible: boolean;
553
571
  /** A method to set the button text. */
554
- setText(text: string): MainButton;
572
+ setText(text: string): BottomButton;
555
573
  /**
556
574
  * A method that sets the button press event handler. An alias for
557
575
  * Telegram.WebApp.onEvent('mainButtonClicked', callback)
558
576
  */
559
- onClick(callback: () => void): MainButton;
577
+ onClick(callback: () => void): BottomButton;
560
578
  /** A method that deletes a previously set handler */
561
- offClick(callback: () => void): MainButton;
579
+ offClick(callback: () => void): BottomButton;
562
580
  /**
563
581
  * A method to make the button visible. Note that opening the Web App from
564
582
  * the attachment menu hides the main button until the user interacts with
565
583
  * the Web App interface.
566
584
  */
567
- show(): MainButton;
585
+ show(): BottomButton;
568
586
  /** A method to hide the button. */
569
- hide(): MainButton;
587
+ hide(): BottomButton;
570
588
  /** A method to enable the button. */
571
- enable(): MainButton;
589
+ enable(): BottomButton;
572
590
  /** A method to disable the button. */
573
- disable(): MainButton;
591
+ disable(): BottomButton;
574
592
  /**
575
593
  * A method to show a loading indicator on the button. It is recommended to
576
594
  * display loading progress if the action tied to the button may take a long
577
595
  * time. By default, the button is disabled while the action is in progress.
578
596
  * If the parameter leaveActive=true is passed, the button remains enabled.
579
597
  */
580
- showProgress(leaveActive?: boolean): MainButton;
598
+ showProgress(leaveActive?: boolean): BottomButton;
581
599
  /** A method to hide the loading indicator. */
582
- hideProgress(): MainButton;
600
+ hideProgress(): BottomButton;
583
601
  /**
584
602
  * A method to set the button parameters. The params parameter is an object
585
603
  * containing one or several fields that need to be changed:
@@ -589,7 +607,7 @@ interface MainButton {
589
607
  * - is_active - enable the button;
590
608
  * - is_visible - show the button.
591
609
  */
592
- setParams(params: MainButtonParams): MainButton;
610
+ setParams(params: MainButtonParams): BottomButton;
593
611
  }
594
612
 
595
613
  interface MainButtonParams {
@@ -998,7 +1016,6 @@ interface WebAppChat {
998
1016
  */
999
1017
  photo_url?: string;
1000
1018
  }
1001
-
1002
1019
  /**
1003
1020
  * This object describes the native popup for scanning QR codes.
1004
1021
  */
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/telegram-web-app",
3
- "version": "7.8.1",
3
+ "version": "7.10.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,6 +30,6 @@
30
30
  },
31
31
  "scripts": {},
32
32
  "dependencies": {},
33
- "typesPublisherContentHash": "3f9df69fcf7dbdf27910ae44891131cb0bbdfa364e1428ffd8371500c55a5f4c",
33
+ "typesPublisherContentHash": "38678344cea34aee56f9870a8fbb857f15523ac82cf25ef19c8d485bdc5c41a4",
34
34
  "typeScriptVersion": "4.8"
35
35
  }