@types/telegram-web-app 6.9.0 → 6.9.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: Tue, 26 Sep 2023 22:35:04 GMT
11
+ * Last updated: Wed, 27 Sep 2023 20:35:06 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `Telegram`
14
14
 
@@ -38,7 +38,7 @@ interface WebApp {
38
38
  * The color scheme currently used in the Telegram app. Either “light” or
39
39
  * “dark”. Also available as the CSS variable var(--tg-color-scheme).
40
40
  */
41
- colorScheme: 'light' | 'dark';
41
+ colorScheme: "light" | "dark";
42
42
  /**
43
43
  * An object containing the current theme settings used in the Telegram app.
44
44
  */
@@ -123,13 +123,14 @@ interface WebApp {
123
123
  /**
124
124
  * A method that sets the app header color in the `#RRGGBB` format.
125
125
  * You can also use keywords bg_color and secondary_bg_color.
126
- */ // string & {} prevents this from eagerly collapsing into just string
127
- setHeaderColor(color: 'bg_color' | 'secondary_bg_color' | (string & {})): void;
126
+ */
127
+ // string & {} prevents this from eagerly collapsing into just string
128
+ setHeaderColor(color: "bg_color" | "secondary_bg_color" | (string & {})): void;
128
129
  /**
129
130
  * A method that sets the app background color in the `#RRGGBB` format or
130
131
  * you can use keywords bg_color, secondary_bg_color instead.
131
132
  */
132
- setBackgroundColor(color: 'bg_color' | 'secondary_bg_color' | (string & {})): void;
133
+ setBackgroundColor(color: "bg_color" | "secondary_bg_color" | (string & {})): void;
133
134
  /**
134
135
  * A method that enables a confirmation dialog while the user is trying to close the Web App.
135
136
  */
@@ -143,41 +144,41 @@ interface WebApp {
143
144
  * events.
144
145
  */
145
146
  onEvent(
146
- eventType: 'themeChanged' | 'mainButtonClicked' | 'backButtonClicked' | 'settingsButtonClicked',
147
+ eventType: "themeChanged" | "mainButtonClicked" | "backButtonClicked" | "settingsButtonClicked",
147
148
  eventHandler: () => void,
148
149
  ): void;
149
- onEvent(eventType: 'popupClosed', eventHandler: (eventData: { button_id: string | null }) => void): void;
150
- onEvent(eventType: 'viewportChanged', eventHandler: (eventData: { isStateStable: boolean }) => void): void;
150
+ onEvent(eventType: "popupClosed", eventHandler: (eventData: { button_id: string | null }) => void): void;
151
+ onEvent(eventType: "viewportChanged", eventHandler: (eventData: { isStateStable: boolean }) => void): void;
151
152
  onEvent(
152
- eventType: 'invoiceClosed',
153
- eventHandler: (eventData: { url: string; status: 'paid' | 'cancelled' | 'failed' | 'pending' }) => void,
153
+ eventType: "invoiceClosed",
154
+ eventHandler: (eventData: { url: string; status: "paid" | "cancelled" | "failed" | "pending" }) => void,
154
155
  ): void;
155
- onEvent(eventType: 'qrTextReceived', eventHandler: (eventData: { data: string }) => void): void;
156
- onEvent(eventType: 'clipboardTextReceived', eventHandler: (eventData: { data: string | null }) => void): void;
156
+ onEvent(eventType: "qrTextReceived", eventHandler: (eventData: { data: string }) => void): void;
157
+ onEvent(eventType: "clipboardTextReceived", eventHandler: (eventData: { data: string | null }) => void): void;
157
158
  onEvent(
158
- eventType: 'writeAccessRequested',
159
- eventHandler: (eventData: { status: 'allowed' | 'cancelled' }) => void,
159
+ eventType: "writeAccessRequested",
160
+ eventHandler: (eventData: { status: "allowed" | "cancelled" }) => void,
160
161
  ): void;
161
- onEvent(eventType: 'contactRequested', eventHandler: (eventData: { status: 'sent' | 'cancelled' }) => void): void;
162
+ onEvent(eventType: "contactRequested", eventHandler: (eventData: { status: "sent" | "cancelled" }) => void): void;
162
163
 
163
164
  /** A method that deletes a previously set event handler. */
164
165
  offEvent(
165
- eventType: 'themeChanged' | 'mainButtonClicked' | 'backButtonClicked' | 'settingsButtonClicked',
166
+ eventType: "themeChanged" | "mainButtonClicked" | "backButtonClicked" | "settingsButtonClicked",
166
167
  eventHandler: () => void,
167
168
  ): void;
168
- offEvent(eventType: 'popupClosed', eventHandler: (eventData: { button_id: string | null }) => void): void;
169
- offEvent(eventType: 'viewportChanged', eventHandler: (eventData: { isStateStable: boolean }) => void): void;
169
+ offEvent(eventType: "popupClosed", eventHandler: (eventData: { button_id: string | null }) => void): void;
170
+ offEvent(eventType: "viewportChanged", eventHandler: (eventData: { isStateStable: boolean }) => void): void;
170
171
  offEvent(
171
- eventType: 'invoiceClosed',
172
- eventHandler: (eventData: { url: string; status: 'paid' | 'cancelled' | 'failed' | 'pending' }) => void,
172
+ eventType: "invoiceClosed",
173
+ eventHandler: (eventData: { url: string; status: "paid" | "cancelled" | "failed" | "pending" }) => void,
173
174
  ): void;
174
- offEvent(eventType: 'qrTextReceived', eventHandler: (eventData: { data: string }) => void): void;
175
- offEvent(eventType: 'clipboardTextReceived', eventHandler: (eventData: { data: string | null }) => void): void;
175
+ offEvent(eventType: "qrTextReceived", eventHandler: (eventData: { data: string }) => void): void;
176
+ offEvent(eventType: "clipboardTextReceived", eventHandler: (eventData: { data: string | null }) => void): void;
176
177
  offEvent(
177
- eventType: 'writeAccessRequested',
178
- eventHandler: (eventData: { status: 'allowed' | 'cancelled' }) => void,
178
+ eventType: "writeAccessRequested",
179
+ eventHandler: (eventData: { status: "allowed" | "cancelled" }) => void,
179
180
  ): void;
180
- offEvent(eventType: 'contactRequested', eventHandler: (eventData: { status: 'sent' | 'cancelled' }) => void): void;
181
+ offEvent(eventType: "contactRequested", eventHandler: (eventData: { status: "sent" | "cancelled" }) => void): void;
181
182
 
182
183
  /**
183
184
  * A method used to send data to the bot. When this method is called, a
@@ -196,7 +197,7 @@ interface WebApp {
196
197
  * You can specify which types of chats the user will be able to choose from.
197
198
  * It can be one or more of the following types: users, bots, groups, channels.
198
199
  */
199
- switchInlineQuery(query: string, choose_chat_types?: Array<'users' | 'bots' | 'groups' | 'channels'>): void;
200
+ switchInlineQuery(query: string, choose_chat_types?: Array<"users" | "bots" | "groups" | "channels">): void;
200
201
  /**
201
202
  * A method that opens a link in an external browser.
202
203
  * The Web App will not be closed.
@@ -220,7 +221,7 @@ interface WebApp {
220
221
  */
221
222
  openInvoice(
222
223
  url: string,
223
- callback: (url: string, status: 'paid' | 'cancelled' | 'failed' | 'pending') => void,
224
+ callback: (url: string, status: "paid" | "cancelled" | "failed" | "pending") => void,
224
225
  ): void;
225
226
  /**
226
227
  * A method that shows a native popup described by the params argument of the type PopupParams.
@@ -365,37 +366,39 @@ interface PopupParams {
365
366
  /**
366
367
  * This object describes the native popup button.
367
368
  */
368
- type PopupButton = {
369
- /**
370
- * Identifier of the button, 0-64 characters. Set to empty string by default.
371
- * If the button is pressed, its id is returned in the callback and the popupClosed event.
372
- */
373
- id?: string;
374
- /**
375
- * Type of the button. Set to default by default.
376
- * Can be one of these values:
377
- * - `default`, a button with the default style,
378
- * - `ok`, a button with the localized text “OK”,
379
- * - `close`, a button with the localized text “Close”,
380
- * - `cancel`, a button with the localized text “Cancel”,
381
- * - `destructive`, a button with a style that indicates a destructive action (e.g. Remove”, “Delete”, etc.).
382
- */
383
- type?: 'default' | 'ok' | 'close' | 'cancel' | 'destructive';
384
- /**
385
- * The text to be displayed on the button, 0-64 characters.
386
- * Required if type is default or destructive. Irrelevant for other types.
387
- */
388
- text?: string;
389
- } & (
390
- | {
391
- type: 'default' | 'destructive';
392
- text: string;
393
- }
394
- | {
395
- type: 'ok' | 'close' | 'cancel';
396
- text?: string;
397
- }
398
- );
369
+ type PopupButton =
370
+ & {
371
+ /**
372
+ * Identifier of the button, 0-64 characters. Set to empty string by default.
373
+ * If the button is pressed, its id is returned in the callback and the popupClosed event.
374
+ */
375
+ id?: string;
376
+ /**
377
+ * Type of the button. Set to default by default.
378
+ * Can be one of these values:
379
+ * - `default`, a button with the default style,
380
+ * - `ok`, a button with the localized text “OK”,
381
+ * - `close`, a button with the localized text “Close”,
382
+ * - `cancel`, a button with the localized textCancel”,
383
+ * - `destructive`, a button with a style that indicates a destructive action (e.g. “Remove”, “Delete”, etc.).
384
+ */
385
+ type?: "default" | "ok" | "close" | "cancel" | "destructive";
386
+ /**
387
+ * The text to be displayed on the button, 0-64 characters.
388
+ * Required if type is default or destructive. Irrelevant for other types.
389
+ */
390
+ text?: string;
391
+ }
392
+ & (
393
+ | {
394
+ type: "default" | "destructive";
395
+ text: string;
396
+ }
397
+ | {
398
+ type: "ok" | "close" | "cancel";
399
+ text?: string;
400
+ }
401
+ );
399
402
 
400
403
  /**
401
404
  * This object controls the back button, which can be displayed in the header of
@@ -515,7 +518,7 @@ interface HapticFeedback {
515
518
  * - rigid, indicates a collision between hard or inflexible UI objects,
516
519
  * - soft, indicates a collision between soft or flexible UI objects.
517
520
  */
518
- impactOccurred(style: 'light' | 'medium' | 'heavy' | 'rigid' | 'soft'): () => void;
521
+ impactOccurred(style: "light" | "medium" | "heavy" | "rigid" | "soft"): () => void;
519
522
  /**
520
523
  * A method tells that a task or action has succeeded, failed, or produced a
521
524
  * warning. The Telegram app may play the appropriate haptics based on type
@@ -524,7 +527,7 @@ interface HapticFeedback {
524
527
  * - success, indicates that a task or action has completed successfully,
525
528
  * - warning, indicates that a task or action produced a warning.
526
529
  */
527
- notificationOccurred(type: 'error' | 'success' | 'warning'): () => void;
530
+ notificationOccurred(type: "error" | "success" | "warning"): () => void;
528
531
  /**
529
532
  * A method tells that the user has changed a selection. The Telegram app
530
533
  * may play the appropriate haptics.
@@ -645,7 +648,7 @@ interface WebAppInitData {
645
648
  * “private”, “group”, “supergroup”, or “channel”.
646
649
  * Returned only for Web Apps launched from direct links.
647
650
  */
648
- chat_type?: 'sender' | 'private' | 'group' | 'supergroup' | 'channel';
651
+ chat_type?: "sender" | "private" | "group" | "supergroup" | "channel";
649
652
  /**
650
653
  * Global identifier, uniquely corresponding to the chat from which the Web App was opened.
651
654
  * Returned only for Web Apps launched from a direct link.
@@ -721,7 +724,7 @@ interface WebAppChat {
721
724
  /**
722
725
  * Type of chat, can be either “group”, “supergroup” or “channel”
723
726
  */
724
- type: 'group' | 'supergroup' | 'channel';
727
+ type: "group" | "supergroup" | "channel";
725
728
  /**
726
729
  * Title of the chat
727
730
  */
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/telegram-web-app",
3
- "version": "6.9.0",
3
+ "version": "6.9.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": "2f5a5fcf817fe0bf0a0e10016c001674a72d56fe50e45e2ee126f9db11c37afb",
33
+ "typesPublisherContentHash": "67938d52e1a927d86e06017fc2dc4f2f6ea2de9687d39499f507a66459d8f059",
34
34
  "typeScriptVersion": "4.5"
35
35
  }