@apiteam/twa-bridge 7.7.0-beta.2 → 7.8.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.
- package/README.md +37 -3
- package/package.json +1 -1
- package/solid/index.d.ts +232 -695
- package/solid/index.js +1 -1
- package/solid/index.mjs +1 -1
- package/react/index.d.ts +0 -1003
- package/react/index.js +0 -1
- package/react/index.mjs +0 -1
- package/react/package.json +0 -17
package/solid/index.d.ts
CHANGED
|
@@ -1,588 +1,178 @@
|
|
|
1
1
|
import * as solid_js from 'solid-js';
|
|
2
|
+
import { Context, Component } from 'solid-js';
|
|
3
|
+
import { JSX } from 'solid-js/jsx-runtime';
|
|
2
4
|
|
|
3
5
|
declare const createIsViewportChanged: () => solid_js.Accessor<{
|
|
4
6
|
height: number;
|
|
5
|
-
width?: number
|
|
7
|
+
width?: number;
|
|
6
8
|
is_expanded: boolean;
|
|
7
9
|
is_state_stable: boolean;
|
|
8
10
|
}>;
|
|
9
11
|
|
|
10
|
-
type Close = () => {
|
|
12
|
+
type Close = (eventData?: SenderData[typeof MethodClose]) => {
|
|
11
13
|
status: boolean | typeof NOT_SUPPORTED;
|
|
12
14
|
};
|
|
13
|
-
/**
|
|
14
|
-
* Closes Mini App.
|
|
15
|
-
*
|
|
16
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-close
|
|
17
|
-
*/
|
|
18
15
|
declare const close: Close;
|
|
19
|
-
/**
|
|
20
|
-
* Method support check
|
|
21
|
-
*/
|
|
22
16
|
declare const supportClose: () => boolean;
|
|
23
17
|
|
|
24
|
-
type CloseScanQrPopup = () => {
|
|
18
|
+
type CloseScanQrPopup = (eventData?: SenderData[typeof MethodCloseScanQrPopup]) => {
|
|
25
19
|
status: boolean | typeof NOT_SUPPORTED;
|
|
26
20
|
};
|
|
27
|
-
/**
|
|
28
|
-
* Closes a QR scanner. The Telegram application creates the scan_qr_popup_closed event.
|
|
29
|
-
*
|
|
30
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-close-scan-qr-popup
|
|
31
|
-
*/
|
|
32
21
|
declare const closeScanQrPopup: CloseScanQrPopup;
|
|
33
|
-
/**
|
|
34
|
-
* Method support check
|
|
35
|
-
*/
|
|
36
22
|
declare const supportCloseScanQrPopup: () => boolean;
|
|
37
23
|
|
|
38
|
-
type DataSend = (eventData: {
|
|
39
|
-
/**
|
|
40
|
-
* Data to send to a bot. Should not have size of more than 4096 bytes.
|
|
41
|
-
*/
|
|
42
|
-
data: string;
|
|
43
|
-
}) => {
|
|
24
|
+
type DataSend = (eventData: SenderData[typeof MethodDataSend]) => {
|
|
44
25
|
status: boolean | typeof NOT_SUPPORTED;
|
|
45
26
|
};
|
|
46
|
-
/**
|
|
47
|
-
* Sends data to the bot. When this method is called, a service message is sent to the bot containing the data of the length up to 4096 bytes.
|
|
48
|
-
*
|
|
49
|
-
* Then, Mini App will be closed.
|
|
50
|
-
*
|
|
51
|
-
* To get more information, take a look at web_app_data field in the class Message.
|
|
52
|
-
*
|
|
53
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-data-send
|
|
54
|
-
*/
|
|
55
27
|
declare const dataSend: DataSend;
|
|
56
|
-
/**
|
|
57
|
-
* Method support check
|
|
58
|
-
*/
|
|
59
28
|
declare const supportDataSend: () => boolean;
|
|
60
29
|
|
|
61
|
-
type Expand = () => {
|
|
30
|
+
type Expand = (props?: SenderData[typeof MethodExpand]) => {
|
|
62
31
|
status: boolean | typeof NOT_SUPPORTED;
|
|
63
32
|
};
|
|
64
|
-
/**
|
|
65
|
-
* Closes Mini App.
|
|
66
|
-
*/
|
|
67
33
|
declare const expand: Expand;
|
|
68
|
-
/**
|
|
69
|
-
* Method support check
|
|
70
|
-
*/
|
|
71
34
|
declare const supportExpand: () => boolean;
|
|
72
35
|
|
|
73
|
-
type IframeReady = (eventData: {
|
|
74
|
-
/**
|
|
75
|
-
* Optional. True, if current Mini App supports native reloading.
|
|
76
|
-
*/
|
|
77
|
-
reload_supported?: boolean;
|
|
78
|
-
}) => {
|
|
36
|
+
type IframeReady = (eventData: SenderData[typeof MethodIframeReady]) => {
|
|
79
37
|
status: boolean | typeof NOT_SUPPORTED;
|
|
80
38
|
};
|
|
81
|
-
/**
|
|
82
|
-
* Notifies parent iframe about the current frame is ready.
|
|
83
|
-
* This method is only used in the Web version of Telegram.
|
|
84
|
-
* As a result, Mini App will receive set_custom_style event.
|
|
85
|
-
*
|
|
86
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#iframe-ready
|
|
87
|
-
*/
|
|
88
39
|
declare const iframeReady: IframeReady;
|
|
89
|
-
/**
|
|
90
|
-
* Method support check
|
|
91
|
-
*/
|
|
92
40
|
declare const supportIframeReady: () => boolean;
|
|
93
41
|
|
|
94
|
-
type IframeWillReload = () => {
|
|
42
|
+
type IframeWillReload = (eventData: SenderData[typeof MethodIframeReady]) => {
|
|
95
43
|
status: boolean | typeof NOT_SUPPORTED;
|
|
96
44
|
};
|
|
97
|
-
/**
|
|
98
|
-
* Notifies parent iframe about the current iframe is going to reload.
|
|
99
|
-
*
|
|
100
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#iframe-will-reload
|
|
101
|
-
*/
|
|
102
45
|
declare const iframeWillReload: IframeWillReload;
|
|
103
|
-
/**
|
|
104
|
-
* Method support check
|
|
105
|
-
*/
|
|
106
46
|
declare const supportIframeWillReload: () => boolean;
|
|
107
47
|
|
|
108
|
-
type InvokeCustomMethod = (eventData: {
|
|
109
|
-
/**
|
|
110
|
-
* Current invocation unique identifier.
|
|
111
|
-
*
|
|
112
|
-
* Default: () => randomReqId
|
|
113
|
-
*/
|
|
114
|
-
req_id?: string;
|
|
115
|
-
/**
|
|
116
|
-
* Method name.
|
|
117
|
-
*/
|
|
118
|
-
method: string;
|
|
119
|
-
/**
|
|
120
|
-
* Parameters according to method.
|
|
121
|
-
*/
|
|
122
|
-
params: unknown;
|
|
123
|
-
}) => Promise<{
|
|
48
|
+
type InvokeCustomMethod = (eventData: SenderData[typeof MethodInvokeCustomMethod]) => Promise<{
|
|
124
49
|
status: boolean | typeof NOT_SUPPORTED;
|
|
125
50
|
data?: EventsData[typeof EventCustomMethodInvoked];
|
|
126
51
|
}>;
|
|
127
|
-
/**
|
|
128
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-invoke-custom-method
|
|
129
|
-
*/
|
|
130
52
|
declare const invokeCustomMethod: InvokeCustomMethod;
|
|
131
|
-
/**
|
|
132
|
-
* Method support check
|
|
133
|
-
*/
|
|
134
53
|
declare const supportInvokeCustomMethod: () => boolean;
|
|
135
54
|
|
|
136
|
-
type OpenInvoice = (eventData: {
|
|
137
|
-
/**
|
|
138
|
-
* Invoice unique identifier.
|
|
139
|
-
*/
|
|
140
|
-
slug: string;
|
|
141
|
-
}) => {
|
|
55
|
+
type OpenInvoice = (eventData: SenderData[typeof MethodOpenInvoice]) => {
|
|
142
56
|
status: boolean | typeof NOT_SUPPORTED;
|
|
143
57
|
};
|
|
144
|
-
/**
|
|
145
|
-
* Opens an invoice by its specified slug.
|
|
146
|
-
*
|
|
147
|
-
* More information about invoices in this documentation.
|
|
148
|
-
*
|
|
149
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-open-invoice
|
|
150
|
-
*/
|
|
151
58
|
declare const openInvoice: OpenInvoice;
|
|
152
|
-
/**
|
|
153
|
-
* Method support check
|
|
154
|
-
*/
|
|
155
59
|
declare const supportOpenInvoice: () => boolean;
|
|
156
60
|
|
|
157
|
-
type OpenLink = (eventData: {
|
|
158
|
-
/**
|
|
159
|
-
* URL to be opened by Telegram application. Should be a full path with https protocol.
|
|
160
|
-
*/
|
|
161
|
-
url: string;
|
|
162
|
-
/**
|
|
163
|
-
* Optional. Link will be opened in Instant View mode if possible.
|
|
164
|
-
*/
|
|
165
|
-
try_instant_view?: boolean;
|
|
166
|
-
}) => {
|
|
61
|
+
type OpenLink = (eventData: SenderData[typeof MethodOpenLink]) => {
|
|
167
62
|
status: boolean | typeof NOT_SUPPORTED;
|
|
168
63
|
};
|
|
169
|
-
/**
|
|
170
|
-
* Opens link in the default browser.
|
|
171
|
-
*
|
|
172
|
-
* Mini App will not be closed.
|
|
173
|
-
*
|
|
174
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-open-link
|
|
175
|
-
*/
|
|
176
64
|
declare const openLink: OpenLink;
|
|
177
|
-
/**
|
|
178
|
-
* Method support check
|
|
179
|
-
*/
|
|
180
65
|
declare const supportOpenLink: () => boolean;
|
|
181
66
|
|
|
182
|
-
type
|
|
183
|
-
/**
|
|
184
|
-
* Identifier of the button, 0-64 characters.
|
|
185
|
-
*/
|
|
186
|
-
id: string;
|
|
187
|
-
type: 'default' | 'destructive' | 'ok' | 'close' | 'cancel';
|
|
188
|
-
/**
|
|
189
|
-
* The text to be displayed on the button, 0-64 characters. Ignored when type is ok, close or cancel.
|
|
190
|
-
*/
|
|
191
|
-
text: string;
|
|
192
|
-
};
|
|
193
|
-
type OpenPopup = (eventData: {
|
|
194
|
-
/**
|
|
195
|
-
* The text to be displayed in the popup title, 0-64 characters
|
|
196
|
-
*/
|
|
197
|
-
title: string;
|
|
198
|
-
/**
|
|
199
|
-
* The message to be displayed in the body of the popup, 1-256 characters
|
|
200
|
-
*/
|
|
201
|
-
message: string;
|
|
202
|
-
/**
|
|
203
|
-
* List of buttons to be displayed in the popup, 1-3 buttons
|
|
204
|
-
*/
|
|
205
|
-
buttons: PopupButton[];
|
|
206
|
-
}) => Promise<{
|
|
67
|
+
type OpenPopup = (eventData: SenderData[typeof MethodOpenPopup]) => Promise<{
|
|
207
68
|
status: boolean | typeof NOT_SUPPORTED;
|
|
208
69
|
data?: EventsData['popup_closed'];
|
|
209
70
|
}>;
|
|
210
|
-
/**
|
|
211
|
-
* Opens a new popup. When user closes the popup, Telegram creates the popup_closed event.
|
|
212
|
-
*
|
|
213
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-open-popup
|
|
214
|
-
*/
|
|
215
71
|
declare const openPopup: OpenPopup;
|
|
216
|
-
/**
|
|
217
|
-
* Method support check
|
|
218
|
-
*/
|
|
219
72
|
declare const supportOpenPopup: () => boolean;
|
|
220
73
|
|
|
221
|
-
type OpenScanQrPopup = (eventData: {
|
|
222
|
-
/**
|
|
223
|
-
* Optional. Text to be displayed in the QR scanner.
|
|
224
|
-
*/
|
|
225
|
-
text?: string;
|
|
226
|
-
/**
|
|
227
|
-
* [Custom] Optional. Сlose QR scanner after receiving data
|
|
228
|
-
*/
|
|
229
|
-
is_close?: boolean;
|
|
230
|
-
}) => Promise<{
|
|
74
|
+
type OpenScanQrPopup = (eventData: SenderData[typeof MethodOpenScanQrPopup]) => Promise<{
|
|
231
75
|
status: boolean | typeof NOT_SUPPORTED | 'closed';
|
|
232
76
|
data?: EventsData[typeof EventQrTextReceived];
|
|
233
77
|
}>;
|
|
234
|
-
/**
|
|
235
|
-
* Opens a QR scanner.
|
|
236
|
-
*
|
|
237
|
-
* When the scanner was closed, the Telegram application creates the scan_qr_popup_closed event.
|
|
238
|
-
*
|
|
239
|
-
* When the scanner reads QR, Telegram creates the qr_text_received event.
|
|
240
|
-
*
|
|
241
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-close-scan-qr-popup
|
|
242
|
-
*/
|
|
243
78
|
declare const openScanQrPopup: OpenScanQrPopup;
|
|
244
|
-
/**
|
|
245
|
-
* Method support check
|
|
246
|
-
*/
|
|
247
79
|
declare const supportOpenScanQrPopup: () => boolean;
|
|
248
80
|
|
|
249
|
-
type OpenTgLink = (eventData: {
|
|
250
|
-
/**
|
|
251
|
-
* Should be a value taken from the link of this format: https://t.me/{path_full}.
|
|
252
|
-
*
|
|
253
|
-
* Can additionally contain query parameters.
|
|
254
|
-
*/
|
|
255
|
-
path_full: string;
|
|
256
|
-
}) => {
|
|
81
|
+
type OpenTgLink = (eventData: SenderData[typeof MethodOpenTgLink]) => {
|
|
257
82
|
status: boolean | typeof NOT_SUPPORTED;
|
|
258
83
|
};
|
|
259
|
-
/**
|
|
260
|
-
* Opens the Telegram link by its pathname and query parameters.
|
|
261
|
-
*
|
|
262
|
-
* The link will be opened in the Telegram app, Mini App will be closed.
|
|
263
|
-
*
|
|
264
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-open-tg-link
|
|
265
|
-
*/
|
|
266
84
|
declare const openTgLink: OpenTgLink;
|
|
267
|
-
/**
|
|
268
|
-
* Method support check
|
|
269
|
-
*/
|
|
270
85
|
declare const supportOpenTgLink: () => boolean;
|
|
271
86
|
|
|
272
|
-
type ReadTextFromClipboard = (eventData
|
|
273
|
-
/**
|
|
274
|
-
* Unique request identifier. Should be any unique string to handle the generated event appropriately.
|
|
275
|
-
*
|
|
276
|
-
* Default: () => randomReqId
|
|
277
|
-
*/
|
|
278
|
-
req_id?: string;
|
|
279
|
-
}) => Promise<{
|
|
87
|
+
type ReadTextFromClipboard = (eventData?: SenderData[typeof MethodReadTextFromClipboard]) => Promise<{
|
|
280
88
|
status: boolean | typeof NOT_SUPPORTED;
|
|
281
89
|
data?: EventsData[typeof EventClipboardTextReceived];
|
|
282
90
|
}>;
|
|
283
|
-
/**
|
|
284
|
-
* Reads text from the clipboard.
|
|
285
|
-
*
|
|
286
|
-
* The method accepts a request identifier which is used to appropriately retrieve the method execution result from the clipboard_text_received event.
|
|
287
|
-
*
|
|
288
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-read-text-from-clipboard
|
|
289
|
-
*/
|
|
290
91
|
declare const readTextFromClipboard: ReadTextFromClipboard;
|
|
291
|
-
/**
|
|
292
|
-
* Method support check
|
|
293
|
-
*/
|
|
294
92
|
declare const supportReadTextFromClipboard: () => boolean;
|
|
295
93
|
|
|
296
|
-
type Ready = () => {
|
|
94
|
+
type Ready = (eventData?: SenderData[typeof MethodReady]) => {
|
|
297
95
|
status: boolean | typeof NOT_SUPPORTED;
|
|
298
96
|
};
|
|
299
|
-
/**
|
|
300
|
-
* Notifies Telegram about current application is ready to be shown.
|
|
301
|
-
*
|
|
302
|
-
* This method will make Telegram to remove application loader and display Mini App.
|
|
303
|
-
*
|
|
304
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-ready
|
|
305
|
-
*/
|
|
306
97
|
declare const ready: Ready;
|
|
307
|
-
/**
|
|
308
|
-
* Method support check
|
|
309
|
-
*/
|
|
310
98
|
declare const supportReady: () => boolean;
|
|
311
99
|
|
|
312
|
-
type RequestPhone = () => Promise<{
|
|
100
|
+
type RequestPhone = (eventData?: SenderData[typeof MethodRequestPhone]) => Promise<{
|
|
313
101
|
status: boolean | typeof NOT_SUPPORTED;
|
|
314
102
|
}>;
|
|
315
|
-
/**
|
|
316
|
-
* Requests access to current user's phone.
|
|
317
|
-
*
|
|
318
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-request-phone
|
|
319
|
-
*/
|
|
320
103
|
declare const requestPhone: RequestPhone;
|
|
321
|
-
/**
|
|
322
|
-
* Method support check
|
|
323
|
-
*/
|
|
324
104
|
declare const supportRequestPhone: () => boolean;
|
|
325
105
|
|
|
326
|
-
type RequestTheme = () => {
|
|
106
|
+
type RequestTheme = (eventData?: SenderData[typeof MethodRequestTheme]) => {
|
|
327
107
|
status: boolean | typeof NOT_SUPPORTED;
|
|
328
108
|
};
|
|
329
|
-
/**
|
|
330
|
-
* Requests current theme from Telegram.
|
|
331
|
-
*
|
|
332
|
-
* As a result, Telegram will create theme_changed event.
|
|
333
|
-
*
|
|
334
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-request-theme
|
|
335
|
-
*/
|
|
336
109
|
declare const requestTheme: RequestTheme;
|
|
337
|
-
/**
|
|
338
|
-
* Method support check
|
|
339
|
-
*/
|
|
340
110
|
declare const supportRequestTheme: () => boolean;
|
|
341
111
|
|
|
342
|
-
type RequestViewport = () => {
|
|
112
|
+
type RequestViewport = (eventData?: SenderData[typeof MethodRequestViewport]) => {
|
|
343
113
|
status: boolean | typeof NOT_SUPPORTED;
|
|
344
114
|
};
|
|
345
|
-
/**
|
|
346
|
-
* Requests current viewport information from Telegram.
|
|
347
|
-
*
|
|
348
|
-
* As a result, Telegram will create viewport_changed event.
|
|
349
|
-
*
|
|
350
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-request-viewport
|
|
351
|
-
*/
|
|
352
115
|
declare const requestViewport: RequestViewport;
|
|
353
|
-
/**
|
|
354
|
-
* Method support check
|
|
355
|
-
*/
|
|
356
116
|
declare const supportRequestViewport: () => boolean;
|
|
357
117
|
|
|
358
|
-
type RequestWriteAccess = () => {
|
|
118
|
+
type RequestWriteAccess = (eventData?: SenderData[typeof MethodRequestWriteAccess]) => {
|
|
359
119
|
status: boolean | typeof NOT_SUPPORTED;
|
|
360
120
|
};
|
|
361
|
-
/**
|
|
362
|
-
* Requests write message access to current user.
|
|
363
|
-
*
|
|
364
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-request-viewport
|
|
365
|
-
*/
|
|
366
121
|
declare const requestWriteAccess: RequestWriteAccess;
|
|
367
|
-
/**
|
|
368
|
-
* Method support check
|
|
369
|
-
*/
|
|
370
122
|
declare const supportRequestWriteAccess: () => boolean;
|
|
371
123
|
|
|
372
|
-
type SetBackgroundColor = (eventData: {
|
|
373
|
-
/**
|
|
374
|
-
* The Mini App background color in #RRGGBB format.
|
|
375
|
-
*/
|
|
376
|
-
color: string;
|
|
377
|
-
}) => {
|
|
124
|
+
type SetBackgroundColor = (eventData: SenderData[typeof MethodSetBackgroundColor]) => {
|
|
378
125
|
status: boolean | typeof NOT_SUPPORTED;
|
|
379
126
|
};
|
|
380
|
-
/**
|
|
381
|
-
* Updates the Mini App background color.
|
|
382
|
-
*
|
|
383
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-set-background-color
|
|
384
|
-
*/
|
|
385
127
|
declare const setBackgroundColor: SetBackgroundColor;
|
|
386
|
-
/**
|
|
387
|
-
* Method support check
|
|
388
|
-
*/
|
|
389
128
|
declare const supportSetBackgroundColor: () => boolean;
|
|
390
129
|
|
|
391
|
-
type SetHeaderColor = (eventData: {
|
|
392
|
-
/**
|
|
393
|
-
* The Mini App header color key. Could be either bg_color or secondary_bg_color.
|
|
394
|
-
*/
|
|
395
|
-
color_key?: 'bg_color' | 'secondary_bg_color';
|
|
396
|
-
/**
|
|
397
|
-
* Color in HEX format.
|
|
398
|
-
*/
|
|
399
|
-
color?: string;
|
|
400
|
-
}) => {
|
|
130
|
+
type SetHeaderColor = (eventData: SenderData[typeof MethodSetHeaderColor]) => {
|
|
401
131
|
status: boolean | typeof NOT_SUPPORTED;
|
|
402
132
|
};
|
|
403
|
-
/**
|
|
404
|
-
* Updates the Mini App header color. This method should accept color_key or color property.
|
|
405
|
-
*
|
|
406
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-set-header-color
|
|
407
|
-
*/
|
|
408
133
|
declare const setHeaderColor: SetHeaderColor;
|
|
409
|
-
/**
|
|
410
|
-
* Method support check
|
|
411
|
-
*/
|
|
412
134
|
declare const supportSetHeaderColor: () => boolean;
|
|
413
135
|
|
|
414
|
-
type
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
136
|
+
type SetBottomBarColor = (eventData: SenderData[typeof MethodSetBottomBarColor]) => {
|
|
137
|
+
status: boolean | typeof NOT_SUPPORTED;
|
|
138
|
+
};
|
|
139
|
+
declare const setBottomBarColor: SetBottomBarColor;
|
|
140
|
+
declare const supportSetBottomBarColor: () => boolean;
|
|
141
|
+
|
|
142
|
+
type SetupBackButton = (eventData: SenderData[typeof MethodSetupBackButton]) => {
|
|
420
143
|
status: boolean | typeof NOT_SUPPORTED;
|
|
421
144
|
};
|
|
422
|
-
/**
|
|
423
|
-
* Updates the Back Button settings.
|
|
424
|
-
*
|
|
425
|
-
* https://docs.telegram-mini-apps.com/platform/ui/back-button
|
|
426
|
-
*/
|
|
427
145
|
declare const setupBackButton: SetupBackButton;
|
|
428
|
-
/**
|
|
429
|
-
* Method support check
|
|
430
|
-
*/
|
|
431
146
|
declare const supportSetupBackButton: () => boolean;
|
|
432
147
|
|
|
433
|
-
type SetupClosingBehavior = (eventData: {
|
|
434
|
-
/**
|
|
435
|
-
* Will user be prompted in case, an application is going to be closed.
|
|
436
|
-
*/
|
|
437
|
-
need_confirmation: boolean;
|
|
438
|
-
}) => {
|
|
148
|
+
type SetupClosingBehavior = (eventData: SenderData[typeof MethodSetupClosingBehavior]) => {
|
|
439
149
|
status: boolean | typeof NOT_SUPPORTED;
|
|
440
150
|
};
|
|
441
|
-
/**
|
|
442
|
-
* Updates current closing behavior.
|
|
443
|
-
*
|
|
444
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-setup-closing-behavior
|
|
445
|
-
*/
|
|
446
151
|
declare const setupClosingBehavior: SetupClosingBehavior;
|
|
447
|
-
/**
|
|
448
|
-
* Method support check
|
|
449
|
-
*/
|
|
450
152
|
declare const supportSetupClosingBehavior: () => boolean;
|
|
451
153
|
|
|
452
|
-
type SetupMainButton = (eventData: {
|
|
453
|
-
/**
|
|
454
|
-
* Optional. Should the Main Button be displayed.
|
|
455
|
-
*/
|
|
456
|
-
is_visible?: boolean;
|
|
457
|
-
/**
|
|
458
|
-
* Optional. Should the Main Button be enabled.
|
|
459
|
-
*/
|
|
460
|
-
is_active?: boolean;
|
|
461
|
-
/**
|
|
462
|
-
* Optional. Should loader inside the Main Button be displayed. Use this property in case, some operation takes time. This loader will make user notified about it.
|
|
463
|
-
*/
|
|
464
|
-
is_progress_visible?: boolean;
|
|
465
|
-
/**
|
|
466
|
-
* Optional. Text inside the Main Button.
|
|
467
|
-
*/
|
|
468
|
-
text?: string;
|
|
469
|
-
/**
|
|
470
|
-
* Optional. The Main Button background color in #RRGGBB format.
|
|
471
|
-
*/
|
|
472
|
-
color?: string;
|
|
473
|
-
/**
|
|
474
|
-
* Optional. The Main Button text color in #RRGGBB format.
|
|
475
|
-
*/
|
|
476
|
-
text_color?: string;
|
|
477
|
-
}) => {
|
|
154
|
+
type SetupMainButton = (eventData: SenderData[typeof MethodSetupMainButton]) => {
|
|
478
155
|
status: boolean | typeof NOT_SUPPORTED;
|
|
479
156
|
};
|
|
480
|
-
/**
|
|
481
|
-
* Updates the Main Button settings.
|
|
482
|
-
*
|
|
483
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-setup-main-button
|
|
484
|
-
*/
|
|
485
157
|
declare const setupMainButton: SetupMainButton;
|
|
486
|
-
/**
|
|
487
|
-
* Method support check
|
|
488
|
-
*/
|
|
489
158
|
declare const supportSetupMainButton: () => boolean;
|
|
490
159
|
|
|
491
|
-
type SetupSettingsButton = (eventData: {
|
|
492
|
-
/**
|
|
493
|
-
* Should the Settings Button be displayed.
|
|
494
|
-
*/
|
|
495
|
-
is_visible: boolean;
|
|
496
|
-
}) => {
|
|
160
|
+
type SetupSettingsButton = (eventData: SenderData[typeof MethodSetupSettingsButton]) => {
|
|
497
161
|
status: boolean | typeof NOT_SUPPORTED;
|
|
498
162
|
};
|
|
499
|
-
/**
|
|
500
|
-
* Updates current state of Settings Button.
|
|
501
|
-
*
|
|
502
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-setup-settings-button
|
|
503
|
-
*/
|
|
504
163
|
declare const setupSettingsButton: SetupSettingsButton;
|
|
505
|
-
/**
|
|
506
|
-
* Method support check
|
|
507
|
-
*/
|
|
508
164
|
declare const supportSetupSettingsButton: () => boolean;
|
|
509
165
|
|
|
510
|
-
type SwitchInlineQuery = (eventData: {
|
|
511
|
-
/**
|
|
512
|
-
* Text which should be inserted in the input after the current bot name. Max length is 256 symbols.
|
|
513
|
-
*/
|
|
514
|
-
query: string;
|
|
515
|
-
/**
|
|
516
|
-
* List of chat types which could be chosen to send the message. Could be empty list. Values:
|
|
517
|
-
*
|
|
518
|
-
* users, bots, groups, channels
|
|
519
|
-
*/
|
|
520
|
-
chat_types: ['users', 'bots', 'groups', 'channels'];
|
|
521
|
-
}) => {
|
|
166
|
+
type SwitchInlineQuery = (eventData: SenderData[typeof MethodSwitchInlineQuery]) => {
|
|
522
167
|
status: boolean | typeof NOT_SUPPORTED;
|
|
523
168
|
};
|
|
524
|
-
/**
|
|
525
|
-
* Inserts the bot's username and the specified inline query in the current chat's input field.
|
|
526
|
-
*
|
|
527
|
-
* Query may be empty, in which case only the bot's username will be inserted.
|
|
528
|
-
*
|
|
529
|
-
* The client prompts the user to choose a specific chat, then opens that chat and inserts the bot's username and the specified inline query in the input field.
|
|
530
|
-
*
|
|
531
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-switch-inline-query
|
|
532
|
-
*/
|
|
533
169
|
declare const switchInlineQuery: SwitchInlineQuery;
|
|
534
|
-
/**
|
|
535
|
-
* Method support check
|
|
536
|
-
*/
|
|
537
170
|
declare const supportSwitchInlineQuery: () => boolean;
|
|
538
171
|
|
|
539
|
-
type TriggerHapticFeedback = (eventData: {
|
|
540
|
-
/**
|
|
541
|
-
* Type of haptic event. Values:
|
|
542
|
-
*
|
|
543
|
-
* impact - when there's a collision involving UI components.
|
|
544
|
-
*
|
|
545
|
-
* notification - when some action execution has been completed.
|
|
546
|
-
*
|
|
547
|
-
* selection_change - when the user changes their selection.
|
|
548
|
-
*/
|
|
549
|
-
type: 'impact' | 'notification' | 'selection_change';
|
|
550
|
-
/**
|
|
551
|
-
* Required when type is impact. Values:
|
|
552
|
-
*
|
|
553
|
-
* light - indicates a collision between small or lightweight UI objects
|
|
554
|
-
*
|
|
555
|
-
* medium - indicates a collision between medium-sized or medium-weight UI objects
|
|
556
|
-
*
|
|
557
|
-
* heavy - indicates a collision between large or heavyweight UI objects
|
|
558
|
-
*
|
|
559
|
-
* rigid - indicates a collision between hard or inflexible UI objects
|
|
560
|
-
*
|
|
561
|
-
* soft - indicates a collision between soft or flexible UI objects
|
|
562
|
-
*/
|
|
563
|
-
impact_style: 'light' | 'medium' | 'heavy' | 'rigid' | 'soft';
|
|
564
|
-
/**
|
|
565
|
-
* Required when type is notification. Values:
|
|
566
|
-
*
|
|
567
|
-
* error - indicates that a task or action has failed
|
|
568
|
-
*
|
|
569
|
-
* success - indicates that a task or action has completed successfully
|
|
570
|
-
*
|
|
571
|
-
* warning - indicates that a task or action produced a warning
|
|
572
|
-
*/
|
|
573
|
-
notification_type: 'error' | 'success' | 'warning';
|
|
574
|
-
}) => {
|
|
172
|
+
type TriggerHapticFeedback = (eventData: SenderData[typeof MethodTriggerHapticFeedback]) => {
|
|
575
173
|
status: boolean | typeof NOT_SUPPORTED;
|
|
576
174
|
};
|
|
577
|
-
/**
|
|
578
|
-
* Generates the haptic feedback event.
|
|
579
|
-
*
|
|
580
|
-
* Original: https://docs.telegram-mini-apps.com/platform/apps-communication/methods#web-app-trigger-haptic-feedback
|
|
581
|
-
*/
|
|
582
175
|
declare const triggerHapticFeedback: TriggerHapticFeedback;
|
|
583
|
-
/**
|
|
584
|
-
* Method support check
|
|
585
|
-
*/
|
|
586
176
|
declare const supportTriggerHapticFeedback: () => boolean;
|
|
587
177
|
|
|
588
178
|
type SessionStorageSet = ({ key, value }: {
|
|
@@ -591,337 +181,133 @@ type SessionStorageSet = ({ key, value }: {
|
|
|
591
181
|
}) => {
|
|
592
182
|
status: boolean | typeof NOT_SUPPORTED;
|
|
593
183
|
};
|
|
594
|
-
/**
|
|
595
|
-
* sessions storage set.
|
|
596
|
-
*/
|
|
597
184
|
declare const sessionStorageSet: SessionStorageSet;
|
|
598
|
-
/**
|
|
599
|
-
* Method support check
|
|
600
|
-
*/
|
|
601
185
|
declare const supportSessionStorageSet: () => boolean;
|
|
602
186
|
|
|
603
187
|
type SessionStorageGet = ({ key }: {
|
|
604
188
|
key: string;
|
|
605
189
|
}) => {
|
|
190
|
+
is_json: boolean;
|
|
606
191
|
status: boolean | typeof NOT_SUPPORTED;
|
|
607
192
|
value?: any;
|
|
608
193
|
};
|
|
609
|
-
/**
|
|
610
|
-
* sessions storage get.
|
|
611
|
-
*/
|
|
612
194
|
declare const sessionStorageGet: SessionStorageGet;
|
|
613
|
-
/**
|
|
614
|
-
* Method support check
|
|
615
|
-
*/
|
|
616
195
|
declare const supportSessionStorageGet: () => boolean;
|
|
617
196
|
|
|
618
|
-
type SetupSwipeBehavior = (
|
|
619
|
-
allow_vertical_swipe: boolean;
|
|
620
|
-
}) => {
|
|
197
|
+
type SetupSwipeBehavior = (eventData: SenderData[typeof MethodSetupSwipeBehavior]) => {
|
|
621
198
|
status: boolean | typeof NOT_SUPPORTED;
|
|
622
199
|
};
|
|
623
|
-
/**
|
|
624
|
-
* sessions storage set.
|
|
625
|
-
*/
|
|
626
200
|
declare const setupSwipeBehavior: SetupSwipeBehavior;
|
|
627
|
-
/**
|
|
628
|
-
* Method support check
|
|
629
|
-
*/
|
|
630
201
|
declare const supportSetupSwipeBehavior: () => boolean;
|
|
631
202
|
|
|
203
|
+
type ShareToStory = (eventData?: SenderData[typeof MethodShareToStory]) => {
|
|
204
|
+
status: boolean | typeof NOT_SUPPORTED;
|
|
205
|
+
};
|
|
206
|
+
declare const shareToStory: ShareToStory;
|
|
207
|
+
declare const supportShareToStory: () => boolean;
|
|
208
|
+
|
|
632
209
|
type User = {
|
|
633
|
-
/**
|
|
634
|
-
* Optional. True, if this user added the bot to the attachment menu.
|
|
635
|
-
*/
|
|
636
210
|
added_to_attachment_menu?: boolean;
|
|
637
|
-
/**
|
|
638
|
-
* Optional. True, if this user allowed the bot to message them.
|
|
639
|
-
*/
|
|
640
211
|
allows_write_to_pm?: boolean;
|
|
641
|
-
/**
|
|
642
|
-
* Optional. Has the user purchased Telegram Premium.
|
|
643
|
-
*/
|
|
644
212
|
is_premium?: boolean;
|
|
645
|
-
/**
|
|
646
|
-
* Bot or user name.
|
|
647
|
-
*/
|
|
648
213
|
first_name: string;
|
|
649
|
-
/**
|
|
650
|
-
* Bot or user ID.
|
|
651
|
-
*/
|
|
652
214
|
id: number;
|
|
653
|
-
/**
|
|
654
|
-
* Optional. Is the user a bot.
|
|
655
|
-
*/
|
|
656
215
|
is_bot?: boolean;
|
|
657
|
-
/**
|
|
658
|
-
* Optional. User's last name.
|
|
659
|
-
*/
|
|
660
216
|
last_name?: string;
|
|
661
|
-
/**
|
|
662
|
-
* Optional. IETF user's language.
|
|
663
|
-
*/
|
|
664
217
|
language_code: string;
|
|
665
|
-
/**
|
|
666
|
-
* Optional. Link to the user's or bot's photo.
|
|
667
|
-
*
|
|
668
|
-
* Photos can have formats .jpeg and .svg.
|
|
669
|
-
*
|
|
670
|
-
* It is returned only for Mini Apps opened through the attachment menu.
|
|
671
|
-
*/
|
|
672
218
|
photo_url?: string;
|
|
673
|
-
/**
|
|
674
|
-
* Optional. Login of the bot or user.
|
|
675
|
-
*/
|
|
676
219
|
username?: string;
|
|
677
220
|
};
|
|
678
221
|
type Chat = {
|
|
679
|
-
/**
|
|
680
|
-
* Unique chat ID.
|
|
681
|
-
*/
|
|
682
222
|
id: number;
|
|
683
|
-
/**
|
|
684
|
-
* Chat type. Values:
|
|
685
|
-
*
|
|
686
|
-
* group, supergroup, channel
|
|
687
|
-
*/
|
|
688
223
|
type: 'group' | 'supergroup' | 'channel';
|
|
689
|
-
/**
|
|
690
|
-
* Chat title.
|
|
691
|
-
*/
|
|
692
224
|
title: string;
|
|
693
|
-
/**
|
|
694
|
-
* Optional. Chat photo link. The photo can have .jpeg and .svg formats.
|
|
695
|
-
*
|
|
696
|
-
* It is returned only for Mini Apps opened through the attachments menu.
|
|
697
|
-
*/
|
|
698
225
|
photo_url?: string;
|
|
699
|
-
/**
|
|
700
|
-
* Optional. Chat user login.
|
|
701
|
-
*/
|
|
702
226
|
username?: string;
|
|
703
227
|
};
|
|
704
|
-
type GetInitData =
|
|
705
|
-
/**
|
|
706
|
-
* The date the initialization data was created.
|
|
707
|
-
*
|
|
708
|
-
* Is a number representing a Unix timestamp.
|
|
709
|
-
*/
|
|
228
|
+
type GetInitData = {
|
|
710
229
|
auth_date: number;
|
|
711
|
-
/**
|
|
712
|
-
* Optional. The number of seconds after which a message can be sent via the method answerWebAppQuery.
|
|
713
|
-
*/
|
|
714
230
|
can_send_after?: number;
|
|
715
|
-
/**
|
|
716
|
-
* Optional. An object containing information about the chat with the bot in which the Mini Apps was launched.
|
|
717
|
-
*
|
|
718
|
-
* It is returned only for Mini Apps opened through the attachments menu.
|
|
719
|
-
*/
|
|
720
231
|
chat?: Chat;
|
|
721
|
-
/**
|
|
722
|
-
* Optional. The type of chat from which the Mini Apps was opened. Values:
|
|
723
|
-
*
|
|
724
|
-
* sender, private, group, supergroup, channel
|
|
725
|
-
*
|
|
726
|
-
* Returned only for applications opened by direct link.
|
|
727
|
-
*/
|
|
728
232
|
chat_type?: 'sender' | 'private' | 'group' | 'supergroup' | 'channel';
|
|
729
|
-
/**
|
|
730
|
-
* Optional. A global identifier indicating the chat from which the Mini Apps was opened.
|
|
731
|
-
*
|
|
732
|
-
* Returned only for applications opened by direct link.
|
|
733
|
-
*/
|
|
734
233
|
chat_instance?: string;
|
|
735
|
-
/**
|
|
736
|
-
* Initialization data signature.
|
|
737
|
-
*/
|
|
738
234
|
hash: string;
|
|
739
|
-
/**
|
|
740
|
-
* Optional. The unique session ID of the Mini App. Used in the process of sending a message via the method answerWebAppQuery.
|
|
741
|
-
*/
|
|
742
235
|
query_id?: string;
|
|
743
|
-
/**
|
|
744
|
-
* Optional. An object containing data about the chat partner of the current user in the chat where the bot was launched via the attachment menu.
|
|
745
|
-
*
|
|
746
|
-
* Returned only for private chats and only for Mini Apps launched via the attachment menu.
|
|
747
|
-
*/
|
|
748
236
|
receiver?: User;
|
|
749
|
-
/**
|
|
750
|
-
* Optional. The value of the startattach or startapp query parameter specified in the link. It is returned only for Mini Apps opened through the attachment menu.
|
|
751
|
-
*/
|
|
752
237
|
start_param?: string;
|
|
753
|
-
/**
|
|
754
|
-
* Optional. An object containing information about the current user.
|
|
755
|
-
*/
|
|
756
238
|
user?: User;
|
|
239
|
+
} | undefined;
|
|
240
|
+
declare const getInitData: () => GetInitData;
|
|
241
|
+
|
|
242
|
+
type ThemeParams = {
|
|
243
|
+
bg_color: string;
|
|
244
|
+
text_color: string;
|
|
245
|
+
hint_color: string;
|
|
246
|
+
link_color: string;
|
|
247
|
+
button_color: string;
|
|
248
|
+
button_text_color: string;
|
|
249
|
+
secondary_bg_color: string;
|
|
250
|
+
header_bg_color: string;
|
|
251
|
+
bottom_bar_bg_color: string;
|
|
252
|
+
accent_text_color: string;
|
|
253
|
+
section_bg_color: string;
|
|
254
|
+
section_header_text_color: string;
|
|
255
|
+
section_separator_color: string;
|
|
256
|
+
subtitle_text_color: string;
|
|
257
|
+
destructive_text_color: string;
|
|
757
258
|
};
|
|
758
|
-
|
|
759
|
-
* In the list of launch parameters, initialization data is located in the tgWebAppData parameter.
|
|
760
|
-
*
|
|
761
|
-
* It is a set of data mostly related to a specific user who launched the Mini App.
|
|
762
|
-
*
|
|
763
|
-
* Original: https://docs.telegram-mini-apps.com/platform/launch-parameters/init-data#init-data
|
|
764
|
-
*/
|
|
765
|
-
declare const getInitData: GetInitData;
|
|
259
|
+
declare const getThemeParams: (theme_params?: ThemeParams) => ThemeParams;
|
|
766
260
|
|
|
767
261
|
type Sender = (eventType: string, eventData?: any) => void;
|
|
768
|
-
/**
|
|
769
|
-
* EDIT
|
|
770
|
-
*
|
|
771
|
-
* window.parent.postMessage(JSON.stringify({ eventType, eventData }), 'https://web.telegram.org');
|
|
772
|
-
* window['TelegramWebviewProxy'].postEvent(eventType, JSON.stringify(eventData));
|
|
773
|
-
*/
|
|
774
262
|
declare const sender: Sender;
|
|
775
263
|
|
|
776
|
-
type
|
|
777
|
-
declare const
|
|
264
|
+
type GetPlatform = () => 'phone' | 'web' | 'desktop';
|
|
265
|
+
declare const TG_WEB = "web";
|
|
266
|
+
declare const TG_PHONE = "phone";
|
|
267
|
+
declare const TG_DESKTOP = "desktop";
|
|
268
|
+
declare const getPlatform: GetPlatform;
|
|
269
|
+
|
|
270
|
+
declare const NOT_SUPPORTED = "not_supported";
|
|
778
271
|
|
|
779
272
|
type EventsData = {
|
|
780
|
-
/**
|
|
781
|
-
* User clicked the Back Button.
|
|
782
|
-
*/
|
|
783
273
|
back_button_pressed: undefined;
|
|
784
|
-
/**
|
|
785
|
-
* Telegram application attempted to extract text from clipboard.
|
|
786
|
-
*/
|
|
787
274
|
clipboard_text_received: {
|
|
788
|
-
/**
|
|
789
|
-
* Passed during the web_app_read_text_from_clipboard method invocation req_id value.
|
|
790
|
-
*/
|
|
791
275
|
req_id: string;
|
|
792
|
-
/**
|
|
793
|
-
* Optional. Data extracted from the clipboard. The returned value will have the type string only in the case, application has access to the clipboard.
|
|
794
|
-
*/
|
|
795
276
|
data?: string | null;
|
|
796
277
|
};
|
|
797
|
-
/**
|
|
798
|
-
* Custom method invocation completed.
|
|
799
|
-
*/
|
|
800
278
|
custom_method_invoked: {
|
|
801
|
-
/**
|
|
802
|
-
* Unique identifier of this invocation.
|
|
803
|
-
*/
|
|
804
279
|
req_id: string;
|
|
805
|
-
/**
|
|
806
|
-
* Optional. Method invocation successful result.
|
|
807
|
-
*/
|
|
808
280
|
result?: unknown;
|
|
809
|
-
/**
|
|
810
|
-
* Optional. Method invocation error code.
|
|
811
|
-
*/
|
|
812
281
|
error?: string;
|
|
813
282
|
};
|
|
814
|
-
/**
|
|
815
|
-
* An invoice was closed.
|
|
816
|
-
*/
|
|
817
283
|
invoice_closed: {
|
|
818
|
-
/**
|
|
819
|
-
* Passed during the web_app_open_invoice method invocation slug value.
|
|
820
|
-
*/
|
|
821
284
|
slug: string;
|
|
822
|
-
/**
|
|
823
|
-
* Invoice status. Values:
|
|
824
|
-
*
|
|
825
|
-
* paid - invoice was paid
|
|
826
|
-
*
|
|
827
|
-
* failed - invoice failed
|
|
828
|
-
*
|
|
829
|
-
* pending - invoice is currently pending
|
|
830
|
-
*
|
|
831
|
-
* cancelled - invoice was cancelled
|
|
832
|
-
*/
|
|
833
285
|
status: 'paid' | 'failed' | 'pending' | 'cancelled';
|
|
834
286
|
};
|
|
835
|
-
/**
|
|
836
|
-
* User clicked the Main Button.
|
|
837
|
-
*/
|
|
838
287
|
main_button_pressed: undefined;
|
|
839
|
-
/**
|
|
840
|
-
* Application received phone access request status.
|
|
841
|
-
*/
|
|
842
288
|
phone_requested: {
|
|
843
|
-
/**
|
|
844
|
-
* Request status. Can only be sent
|
|
845
|
-
*/
|
|
846
289
|
status: 'sent';
|
|
847
290
|
};
|
|
848
|
-
/**
|
|
849
|
-
* Popup was closed.
|
|
850
|
-
*/
|
|
851
291
|
popup_closed: {
|
|
852
|
-
/**
|
|
853
|
-
* Optional. Identifier of the clicked button.
|
|
854
|
-
*
|
|
855
|
-
* In case, the popup was closed without clicking any button, this property will be omitted.
|
|
856
|
-
*/
|
|
857
292
|
button_id?: string;
|
|
858
293
|
};
|
|
859
|
-
/**
|
|
860
|
-
* Parent iframe requested current iframe reload.
|
|
861
|
-
*/
|
|
862
294
|
reload_iframe: undefined;
|
|
863
|
-
/**
|
|
864
|
-
* The QR scanner scanned some QR and extracted its content.
|
|
865
|
-
*/
|
|
866
295
|
qr_text_received: {
|
|
867
|
-
/**
|
|
868
|
-
* Optional. Data extracted from the QR.
|
|
869
|
-
*/
|
|
870
296
|
data?: string;
|
|
871
297
|
};
|
|
872
|
-
/**
|
|
873
|
-
* QR scanner was closed.
|
|
874
|
-
*/
|
|
875
298
|
scan_qr_popup_closed: undefined;
|
|
876
|
-
/**
|
|
877
|
-
* The event which is usually sent by the Telegram web application.
|
|
878
|
-
*
|
|
879
|
-
* Its payload represents <style/> tag html content, a developer could use. The stylesheet described in the payload will help the developer to stylize the app scrollbar (but he is still able to do it himself).
|
|
880
|
-
*/
|
|
881
299
|
set_custom_style: undefined;
|
|
882
|
-
/**
|
|
883
|
-
* Occurs when the Settings Button was pressed.
|
|
884
|
-
*/
|
|
885
300
|
settings_button_pressed: undefined;
|
|
886
|
-
/**
|
|
887
|
-
* Occurs whenever the theme was changed in the user's Telegram app ( including switching to night mode).
|
|
888
|
-
*/
|
|
889
301
|
theme_changed: {
|
|
890
|
-
|
|
891
|
-
* Map where the key is a theme stylesheet key and value is the corresponding color in #RRGGBB format.
|
|
892
|
-
*/
|
|
893
|
-
theme_params: Record<string, string>;
|
|
302
|
+
theme_params: ThemeParams;
|
|
894
303
|
};
|
|
895
|
-
/**
|
|
896
|
-
* Occurs whenever the viewport has been changed.
|
|
897
|
-
*
|
|
898
|
-
* For example, when the user started dragging the application or called the expansion method.
|
|
899
|
-
*/
|
|
900
304
|
viewport_changed: {
|
|
901
|
-
/**
|
|
902
|
-
* The viewport height.
|
|
903
|
-
*/
|
|
904
305
|
height: number;
|
|
905
|
-
/**
|
|
906
|
-
* Optional. The viewport width.
|
|
907
|
-
*/
|
|
908
306
|
width?: number;
|
|
909
|
-
/**
|
|
910
|
-
* Is the viewport currently expanded.
|
|
911
|
-
*/
|
|
912
307
|
is_expanded: boolean;
|
|
913
|
-
/**
|
|
914
|
-
* Is the viewport current state stable and not going to change in the next moment.
|
|
915
|
-
*/
|
|
916
308
|
is_state_stable: boolean;
|
|
917
309
|
};
|
|
918
|
-
/**
|
|
919
|
-
* Application received write access request status.
|
|
920
|
-
*/
|
|
921
310
|
write_access_requested: {
|
|
922
|
-
/**
|
|
923
|
-
* Request status. Can only be allowed.
|
|
924
|
-
*/
|
|
925
311
|
status: 'allowed';
|
|
926
312
|
};
|
|
927
313
|
};
|
|
@@ -957,14 +343,6 @@ declare namespace listener {
|
|
|
957
343
|
export { type listener_EventsData as EventsData, listener_off as off, listener_on as on, listener_once as once };
|
|
958
344
|
}
|
|
959
345
|
|
|
960
|
-
type GetPlatform = () => 'phone' | 'web' | 'desktop';
|
|
961
|
-
declare const TG_WEB = "web";
|
|
962
|
-
declare const TG_PHONE = "phone";
|
|
963
|
-
declare const TG_DESKTOP = "desktop";
|
|
964
|
-
declare const getPlatform: GetPlatform;
|
|
965
|
-
|
|
966
|
-
declare const NOT_SUPPORTED = "not_supported";
|
|
967
|
-
|
|
968
346
|
declare const MethodInvokeCustomMethod = "web_app_invoke_custom_method";
|
|
969
347
|
declare const MethodOpenScanQrPopup = "web_app_open_scan_qr_popup";
|
|
970
348
|
declare const MethodReadTextFromClipboard = "web_app_read_text_from_clipboard";
|
|
@@ -985,6 +363,7 @@ declare const MethodRequestViewport = "web_app_request_viewport";
|
|
|
985
363
|
declare const MethodRequestWriteAccess = "web_app_request_write_access";
|
|
986
364
|
declare const MethodSetBackgroundColor = "web_app_set_background_color";
|
|
987
365
|
declare const MethodSetHeaderColor = "web_app_set_header_color";
|
|
366
|
+
declare const MethodSetBottomBarColor = "web_app_set_bottom_bar_color";
|
|
988
367
|
declare const MethodSetupBackButton = "web_app_setup_back_button";
|
|
989
368
|
declare const MethodSetupClosingBehavior = "web_app_setup_closing_behavior";
|
|
990
369
|
declare const MethodSetupMainButton = "web_app_setup_main_button";
|
|
@@ -992,6 +371,164 @@ declare const MethodSetupSettingsButton = "web_app_setup_settings_button";
|
|
|
992
371
|
declare const MethodSwitchInlineQuery = "web_app_switch_inline_query";
|
|
993
372
|
declare const MethodTriggerHapticFeedback = "web_app_trigger_haptic_feedback";
|
|
994
373
|
declare const MethodSetupSwipeBehavior = "web_app_setup_swipe_behavior";
|
|
374
|
+
declare const MethodShareToStory = "web_app_share_to_story";
|
|
375
|
+
declare enum Method {
|
|
376
|
+
InvokeCustomMethod = "web_app_invoke_custom_method",
|
|
377
|
+
OpenScanQrPopup = "web_app_open_scan_qr_popup",
|
|
378
|
+
ReadTextFromClipboard = "web_app_read_text_from_clipboard",
|
|
379
|
+
RequestPhone = "web_app_request_phone",
|
|
380
|
+
Close = "web_app_close",
|
|
381
|
+
CloseScanQrPopup = "web_app_close_scan_qr_popup",
|
|
382
|
+
DataSend = "web_app_data_send",
|
|
383
|
+
Expand = "web_app_expand",
|
|
384
|
+
IframeReady = "iframe_ready",
|
|
385
|
+
IframeWillReload = "iframe_will_reload",
|
|
386
|
+
OpenInvoice = "web_app_open_invoice",
|
|
387
|
+
OpenLink = "web_app_open_link",
|
|
388
|
+
OpenPopup = "web_app_open_popup",
|
|
389
|
+
OpenTgLink = "web_app_open_tg_link",
|
|
390
|
+
Ready = "web_app_ready",
|
|
391
|
+
RequestTheme = "web_app_request_theme",
|
|
392
|
+
RequestViewport = "web_app_request_viewport",
|
|
393
|
+
RequestWriteAccess = "web_app_request_write_access",
|
|
394
|
+
SetBackgroundColor = "web_app_set_background_color",
|
|
395
|
+
SetHeaderColor = "web_app_set_header_color",
|
|
396
|
+
SetBottomBarColor = "web_app_set_bottom_bar_color",
|
|
397
|
+
SetupBackButton = "web_app_setup_back_button",
|
|
398
|
+
SetupClosingBehavior = "web_app_setup_closing_behavior",
|
|
399
|
+
SetupMainButton = "web_app_setup_main_button",
|
|
400
|
+
SetupSettingsButton = "web_app_setup_settings_button",
|
|
401
|
+
SwitchInlineQuery = "web_app_switch_inline_query",
|
|
402
|
+
TriggerHapticFeedback = "web_app_trigger_haptic_feedback",
|
|
403
|
+
SetupSwipeBehavior = "web_app_setup_swipe_behavior",
|
|
404
|
+
ShareToStory = "web_app_share_to_story"
|
|
405
|
+
}
|
|
406
|
+
type PopupButton = {
|
|
407
|
+
id: string;
|
|
408
|
+
type: 'default' | 'destructive' | 'ok' | 'close' | 'cancel';
|
|
409
|
+
text: string;
|
|
410
|
+
};
|
|
411
|
+
type SenderData = {
|
|
412
|
+
[MethodInvokeCustomMethod]: {
|
|
413
|
+
req_id?: string;
|
|
414
|
+
method: string;
|
|
415
|
+
params: unknown;
|
|
416
|
+
};
|
|
417
|
+
[MethodOpenScanQrPopup]: {
|
|
418
|
+
text?: string;
|
|
419
|
+
is_close?: boolean;
|
|
420
|
+
};
|
|
421
|
+
[MethodReadTextFromClipboard]: {
|
|
422
|
+
req_id?: string;
|
|
423
|
+
};
|
|
424
|
+
[MethodRequestPhone]: undefined;
|
|
425
|
+
[MethodClose]: undefined;
|
|
426
|
+
[MethodCloseScanQrPopup]: undefined;
|
|
427
|
+
[MethodDataSend]: {
|
|
428
|
+
data: string;
|
|
429
|
+
};
|
|
430
|
+
[MethodExpand]: undefined;
|
|
431
|
+
[MethodIframeReady]: {
|
|
432
|
+
reload_supported?: boolean;
|
|
433
|
+
};
|
|
434
|
+
[MethodIframeWillReload]: undefined;
|
|
435
|
+
[MethodOpenInvoice]: {
|
|
436
|
+
slug: string;
|
|
437
|
+
};
|
|
438
|
+
[MethodOpenLink]: {
|
|
439
|
+
url: string;
|
|
440
|
+
try_instant_view?: boolean;
|
|
441
|
+
};
|
|
442
|
+
[MethodOpenPopup]: {
|
|
443
|
+
title: string;
|
|
444
|
+
message: string;
|
|
445
|
+
buttons: PopupButton[];
|
|
446
|
+
};
|
|
447
|
+
[MethodOpenTgLink]: {
|
|
448
|
+
path_full: string;
|
|
449
|
+
};
|
|
450
|
+
[MethodReady]: undefined;
|
|
451
|
+
[MethodRequestTheme]: undefined;
|
|
452
|
+
[MethodRequestViewport]: undefined;
|
|
453
|
+
[MethodRequestWriteAccess]: undefined;
|
|
454
|
+
[MethodSetBackgroundColor]: {
|
|
455
|
+
color: string;
|
|
456
|
+
};
|
|
457
|
+
[MethodSetHeaderColor]: {
|
|
458
|
+
color_key: 'bg_color' | 'secondary_bg_color';
|
|
459
|
+
color?: undefined;
|
|
460
|
+
} | {
|
|
461
|
+
color: string;
|
|
462
|
+
color_key?: undefined;
|
|
463
|
+
};
|
|
464
|
+
[MethodSetBottomBarColor]: {
|
|
465
|
+
color_key: 'bg_color' | 'secondary_bg_color' | 'bottom_bar_bg_color';
|
|
466
|
+
color?: undefined;
|
|
467
|
+
} | {
|
|
468
|
+
color: string;
|
|
469
|
+
color_key?: undefined;
|
|
470
|
+
};
|
|
471
|
+
[MethodSetupBackButton]: {
|
|
472
|
+
is_visible: boolean;
|
|
473
|
+
};
|
|
474
|
+
[MethodSetupClosingBehavior]: {
|
|
475
|
+
need_confirmation: boolean;
|
|
476
|
+
};
|
|
477
|
+
[MethodSetupMainButton]: {
|
|
478
|
+
is_visible?: boolean;
|
|
479
|
+
is_active?: boolean;
|
|
480
|
+
is_progress_visible?: boolean;
|
|
481
|
+
text?: string;
|
|
482
|
+
color?: string;
|
|
483
|
+
text_color?: string;
|
|
484
|
+
};
|
|
485
|
+
[MethodSetupSettingsButton]: {
|
|
486
|
+
is_visible: boolean;
|
|
487
|
+
};
|
|
488
|
+
[MethodSwitchInlineQuery]: {
|
|
489
|
+
query: string;
|
|
490
|
+
chat_types: ['users', 'bots', 'groups', 'channels'];
|
|
491
|
+
};
|
|
492
|
+
[MethodTriggerHapticFeedback]: {
|
|
493
|
+
type: 'impact';
|
|
494
|
+
impact_style: 'light' | 'medium' | 'heavy' | 'rigid' | 'soft';
|
|
495
|
+
} | {
|
|
496
|
+
type: 'notification';
|
|
497
|
+
notification_type: 'error' | 'success' | 'warning';
|
|
498
|
+
} | {
|
|
499
|
+
type: 'selection_change';
|
|
500
|
+
impact_style?: undefined;
|
|
501
|
+
notification_type?: undefined;
|
|
502
|
+
};
|
|
503
|
+
[MethodSetupSwipeBehavior]: {
|
|
504
|
+
allow_vertical_swipe: boolean;
|
|
505
|
+
};
|
|
506
|
+
[MethodShareToStory]: {
|
|
507
|
+
media: string;
|
|
508
|
+
text?: string;
|
|
509
|
+
widget_link?: {
|
|
510
|
+
url: string;
|
|
511
|
+
name: string;
|
|
512
|
+
};
|
|
513
|
+
};
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
type Debug = (methondName: string, errorId: number) => void;
|
|
517
|
+
declare const debug: Debug;
|
|
518
|
+
|
|
519
|
+
declare const getAppData: () => string | null;
|
|
520
|
+
|
|
521
|
+
type Value = {
|
|
522
|
+
viewport?: EventsData[typeof EventViewportChanged] & {
|
|
523
|
+
safe_area_bottom: number;
|
|
524
|
+
};
|
|
525
|
+
theme?: EventsData[typeof EventThemeChanged];
|
|
526
|
+
init?: GetInitData;
|
|
527
|
+
};
|
|
528
|
+
declare const ContextTwa: Context<Value>;
|
|
529
|
+
interface ProviderTWA extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
530
|
+
}
|
|
531
|
+
declare const ProviderTWA: Component<ProviderTWA>;
|
|
995
532
|
|
|
996
533
|
declare const EventBackButtonPressed = "back_button_pressed";
|
|
997
534
|
declare const EventClipboardTextReceived = "clipboard_text_received";
|
|
@@ -1009,4 +546,4 @@ declare const EventThemeChanged = "theme_changed";
|
|
|
1009
546
|
declare const EventViewportChanged = "viewport_changed";
|
|
1010
547
|
declare const EventWriteAccessRequested = "write_access_requested";
|
|
1011
548
|
|
|
1012
|
-
export { EventBackButtonPressed, EventClipboardTextReceived, EventCustomMethodInvoked, EventInvoiceClosed, EventMainButtonPressed, EventPhoneRequested, EventPopupClosed, EventQrTextReceived, EventReloadIframe, EventScanQrPopupClosed, EventSetCustomStyle, EventSettingsButtonPressed, EventThemeChanged, EventViewportChanged, EventWriteAccessRequested, type EventsData, MethodClose, MethodCloseScanQrPopup, MethodDataSend, MethodExpand, MethodIframeReady, MethodIframeWillReload, MethodInvokeCustomMethod, MethodOpenInvoice, MethodOpenLink, MethodOpenPopup, MethodOpenScanQrPopup, MethodOpenTgLink, MethodReadTextFromClipboard, MethodReady, MethodRequestPhone, MethodRequestTheme, MethodRequestViewport, MethodRequestWriteAccess, MethodSetBackgroundColor, MethodSetHeaderColor, MethodSetupBackButton, MethodSetupClosingBehavior, MethodSetupMainButton, MethodSetupSettingsButton, MethodSetupSwipeBehavior, MethodSwitchInlineQuery, MethodTriggerHapticFeedback, NOT_SUPPORTED, TG_DESKTOP, TG_PHONE, TG_WEB, close as bridgeClose, closeScanQrPopup as bridgeCloseScanQrPopup, dataSend as bridgeDataSend, expand as bridgeExpand, getInitData as bridgeGetInitData, iframeReady as bridgeIframeReady, iframeWillReload as bridgeIframeWillReload, invokeCustomMethod as bridgeInvokeCustomMethod, openInvoice as bridgeOpenInvoice, openLink as bridgeOpenLink, openPopup as bridgeOpenPopup, openScanQrPopup as bridgeOpenScanQrPopup, openTgLink as bridgeOpenTgLink, readTextFromClipboard as bridgeReadTextFromClipboard, ready as bridgeReady, requestPhone as bridgeRequestPhone, requestTheme as bridgeRequestTheme, requestViewport as bridgeRequestViewport, requestWriteAccess as bridgeRequestWriteAccess, sessionStorageGet as bridgeSessionStorageGet, sessionStorageSet as bridgeSessionStorageSet, setBackgroundColor as bridgeSetBackgroundColor, setHeaderColor as bridgeSetHeaderColor, setupBackButton as bridgeSetupBackButton, setupClosingBehavior as bridgeSetupClosingBehavior, setupMainButton as bridgeSetupMainButton, setupSettingsButton as bridgeSetupSettingsButton, setupSwipeBehavior as bridgeSetupSwipeBehavior, switchInlineQuery as bridgeSwitchInlineQuery, triggerHapticFeedback as bridgeTriggerHapticFeedback, createIsViewportChanged, debug, getPlatform, listener, sender, supportClose, supportCloseScanQrPopup, supportDataSend, supportExpand, supportIframeReady, supportIframeWillReload, supportInvokeCustomMethod, supportOpenInvoice, supportOpenLink, supportOpenPopup, supportOpenScanQrPopup, supportOpenTgLink, supportReadTextFromClipboard, supportReady, supportRequestPhone, supportRequestTheme, supportRequestViewport, supportRequestWriteAccess, supportSessionStorageGet, supportSessionStorageSet, supportSetBackgroundColor, supportSetHeaderColor, supportSetupBackButton, supportSetupClosingBehavior, supportSetupMainButton, supportSetupSettingsButton, supportSetupSwipeBehavior, supportSwitchInlineQuery, supportTriggerHapticFeedback };
|
|
549
|
+
export { ContextTwa, EventBackButtonPressed, EventClipboardTextReceived, EventCustomMethodInvoked, EventInvoiceClosed, EventMainButtonPressed, EventPhoneRequested, EventPopupClosed, EventQrTextReceived, EventReloadIframe, EventScanQrPopupClosed, EventSetCustomStyle, EventSettingsButtonPressed, EventThemeChanged, EventViewportChanged, EventWriteAccessRequested, type EventsData, type GetInitData, Method, MethodClose, MethodCloseScanQrPopup, MethodDataSend, MethodExpand, MethodIframeReady, MethodIframeWillReload, MethodInvokeCustomMethod, MethodOpenInvoice, MethodOpenLink, MethodOpenPopup, MethodOpenScanQrPopup, MethodOpenTgLink, MethodReadTextFromClipboard, MethodReady, MethodRequestPhone, MethodRequestTheme, MethodRequestViewport, MethodRequestWriteAccess, MethodSetBackgroundColor, MethodSetBottomBarColor, MethodSetHeaderColor, MethodSetupBackButton, MethodSetupClosingBehavior, MethodSetupMainButton, MethodSetupSettingsButton, MethodSetupSwipeBehavior, MethodShareToStory, MethodSwitchInlineQuery, MethodTriggerHapticFeedback, NOT_SUPPORTED, type PopupButton, ProviderTWA, type SenderData, TG_DESKTOP, TG_PHONE, TG_WEB, type ThemeParams, close as bridgeClose, closeScanQrPopup as bridgeCloseScanQrPopup, dataSend as bridgeDataSend, expand as bridgeExpand, getInitData as bridgeGetInitData, getThemeParams as bridgeGetThemeParams, iframeReady as bridgeIframeReady, iframeWillReload as bridgeIframeWillReload, invokeCustomMethod as bridgeInvokeCustomMethod, openInvoice as bridgeOpenInvoice, openLink as bridgeOpenLink, openPopup as bridgeOpenPopup, openScanQrPopup as bridgeOpenScanQrPopup, openTgLink as bridgeOpenTgLink, readTextFromClipboard as bridgeReadTextFromClipboard, ready as bridgeReady, requestPhone as bridgeRequestPhone, requestTheme as bridgeRequestTheme, requestViewport as bridgeRequestViewport, requestWriteAccess as bridgeRequestWriteAccess, sender as bridgeSend, sessionStorageGet as bridgeSessionStorageGet, sessionStorageSet as bridgeSessionStorageSet, setBackgroundColor as bridgeSetBackgroundColor, setBottomBarColor as bridgeSetBottomBarColor, setHeaderColor as bridgeSetHeaderColor, setupBackButton as bridgeSetupBackButton, setupClosingBehavior as bridgeSetupClosingBehavior, setupMainButton as bridgeSetupMainButton, setupSettingsButton as bridgeSetupSettingsButton, setupSwipeBehavior as bridgeSetupSwipeBehavior, shareToStory as bridgeShareToStory, switchInlineQuery as bridgeSwitchInlineQuery, triggerHapticFeedback as bridgeTriggerHapticFeedback, createIsViewportChanged, debug, getAppData, getPlatform, listener, sender, supportClose, supportCloseScanQrPopup, supportDataSend, supportExpand, supportIframeReady, supportIframeWillReload, supportInvokeCustomMethod, supportOpenInvoice, supportOpenLink, supportOpenPopup, supportOpenScanQrPopup, supportOpenTgLink, supportReadTextFromClipboard, supportReady, supportRequestPhone, supportRequestTheme, supportRequestViewport, supportRequestWriteAccess, supportSessionStorageGet, supportSessionStorageSet, supportSetBackgroundColor, supportSetBottomBarColor, supportSetHeaderColor, supportSetupBackButton, supportSetupClosingBehavior, supportSetupMainButton, supportSetupSettingsButton, supportSetupSwipeBehavior, supportShareToStory, supportSwitchInlineQuery, supportTriggerHapticFeedback };
|