@apiteam/twa-bridge 7.0.0-beta.9 → 7.1.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.
- package/README.md +37 -3
- package/package.json +1 -1
- package/react/index.d.ts +112 -50
- package/react/index.js +1 -1
- package/react/index.mjs +1 -1
- package/solid/index.d.ts +461 -300
- package/solid/index.js +1 -1
- package/solid/index.mjs +1 -1
package/solid/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as solid_js from 'solid-js';
|
|
2
|
+
import { Context, JSX, Component } from 'solid-js';
|
|
2
3
|
|
|
3
4
|
declare const createIsViewportChanged: () => solid_js.Accessor<{
|
|
4
5
|
height: number;
|
|
@@ -7,13 +8,13 @@ declare const createIsViewportChanged: () => solid_js.Accessor<{
|
|
|
7
8
|
is_state_stable: boolean;
|
|
8
9
|
}>;
|
|
9
10
|
|
|
10
|
-
type Close = () => {
|
|
11
|
+
type Close = (eventData?: SenderData[typeof MethodClose]) => {
|
|
11
12
|
status: boolean | typeof NOT_SUPPORTED;
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
+
* EN: A method that closes the Mini App.
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
+
* RU: Метод, который закрывает мини-приложение.
|
|
17
18
|
*/
|
|
18
19
|
declare const close: Close;
|
|
19
20
|
/**
|
|
@@ -21,13 +22,17 @@ declare const close: Close;
|
|
|
21
22
|
*/
|
|
22
23
|
declare const supportClose: () => boolean;
|
|
23
24
|
|
|
24
|
-
type CloseScanQrPopup = () => {
|
|
25
|
+
type CloseScanQrPopup = (eventData?: SenderData[typeof MethodCloseScanQrPopup]) => {
|
|
25
26
|
status: boolean | typeof NOT_SUPPORTED;
|
|
26
27
|
};
|
|
27
28
|
/**
|
|
28
|
-
*
|
|
29
|
+
* EN: A method that closes the native popup for scanning a QR code opened with the `openScanQrPopup` method.
|
|
29
30
|
*
|
|
30
|
-
*
|
|
31
|
+
* Run it if you received valid data in the event `qr_text_received`.
|
|
32
|
+
*
|
|
33
|
+
* RU: Метод, который закрывает собственное всплывающее окно для сканирования QR-кода, открытого с помощью метода `openScanQrPopup`.
|
|
34
|
+
*
|
|
35
|
+
* Запустите его, если вы получили действительные данные в событии `qr_text_received`.
|
|
31
36
|
*/
|
|
32
37
|
declare const closeScanQrPopup: CloseScanQrPopup;
|
|
33
38
|
/**
|
|
@@ -35,22 +40,25 @@ declare const closeScanQrPopup: CloseScanQrPopup;
|
|
|
35
40
|
*/
|
|
36
41
|
declare const supportCloseScanQrPopup: () => boolean;
|
|
37
42
|
|
|
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
|
-
}) => {
|
|
43
|
+
type DataSend = (eventData: SenderData[typeof MethodDataSend]) => {
|
|
44
44
|
status: boolean | typeof NOT_SUPPORTED;
|
|
45
45
|
};
|
|
46
46
|
/**
|
|
47
|
-
|
|
47
|
+
** EN: A method used to send data to the bot.
|
|
48
48
|
*
|
|
49
|
-
*
|
|
49
|
+
* When this method is called, a service message is sent to the bot containing the data data of the length up to 4096 bytes, and the Mini App is closed.
|
|
50
50
|
*
|
|
51
|
-
*
|
|
51
|
+
* See the field `web_app_data` in the class Message.
|
|
52
52
|
*
|
|
53
|
-
|
|
53
|
+
*! This method is only available for Mini Apps launched via a Keyboard button.
|
|
54
|
+
*
|
|
55
|
+
** RU: Метод, используемый для отправки данных боту.
|
|
56
|
+
*
|
|
57
|
+
* При вызове этого метода боту отправляется служебное сообщение, содержащее данные длиной до 4096 байт, и мини-приложение закрывается.
|
|
58
|
+
*
|
|
59
|
+
* Смотрите поле `web_app_data` в сообщении класса.
|
|
60
|
+
*
|
|
61
|
+
*! Этот метод доступен только для мини-приложений, запускаемых с помощью кнопки клавиатуры.
|
|
54
62
|
*/
|
|
55
63
|
declare const dataSend: DataSend;
|
|
56
64
|
/**
|
|
@@ -58,11 +66,13 @@ declare const dataSend: DataSend;
|
|
|
58
66
|
*/
|
|
59
67
|
declare const supportDataSend: () => boolean;
|
|
60
68
|
|
|
61
|
-
type Expand = () => {
|
|
69
|
+
type Expand = (props?: SenderData[typeof MethodExpand]) => {
|
|
62
70
|
status: boolean | typeof NOT_SUPPORTED;
|
|
63
71
|
};
|
|
64
72
|
/**
|
|
65
|
-
|
|
73
|
+
** EN: A method that expands the Mini App to the maximum available height.
|
|
74
|
+
*
|
|
75
|
+
** RU: Метод, расширяющий мини-приложение до максимально доступной высоты.
|
|
66
76
|
*/
|
|
67
77
|
declare const expand: Expand;
|
|
68
78
|
/**
|
|
@@ -70,12 +80,7 @@ declare const expand: Expand;
|
|
|
70
80
|
*/
|
|
71
81
|
declare const supportExpand: () => boolean;
|
|
72
82
|
|
|
73
|
-
type IframeReady = (eventData: {
|
|
74
|
-
/**
|
|
75
|
-
* Optional. True, if current Mini App supports native reloading.
|
|
76
|
-
*/
|
|
77
|
-
reload_supported?: boolean;
|
|
78
|
-
}) => {
|
|
83
|
+
type IframeReady = (eventData: SenderData[typeof MethodIframeReady]) => {
|
|
79
84
|
status: boolean | typeof NOT_SUPPORTED;
|
|
80
85
|
};
|
|
81
86
|
/**
|
|
@@ -91,7 +96,7 @@ declare const iframeReady: IframeReady;
|
|
|
91
96
|
*/
|
|
92
97
|
declare const supportIframeReady: () => boolean;
|
|
93
98
|
|
|
94
|
-
type IframeWillReload = () => {
|
|
99
|
+
type IframeWillReload = (eventData: SenderData[typeof MethodIframeReady]) => {
|
|
95
100
|
status: boolean | typeof NOT_SUPPORTED;
|
|
96
101
|
};
|
|
97
102
|
/**
|
|
@@ -105,22 +110,7 @@ declare const iframeWillReload: IframeWillReload;
|
|
|
105
110
|
*/
|
|
106
111
|
declare const supportIframeWillReload: () => boolean;
|
|
107
112
|
|
|
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<{
|
|
113
|
+
type InvokeCustomMethod = (eventData: SenderData[typeof MethodInvokeCustomMethod]) => Promise<{
|
|
124
114
|
status: boolean | typeof NOT_SUPPORTED;
|
|
125
115
|
data?: EventsData[typeof EventCustomMethodInvoked];
|
|
126
116
|
}>;
|
|
@@ -133,12 +123,7 @@ declare const invokeCustomMethod: InvokeCustomMethod;
|
|
|
133
123
|
*/
|
|
134
124
|
declare const supportInvokeCustomMethod: () => boolean;
|
|
135
125
|
|
|
136
|
-
type OpenInvoice = (eventData: {
|
|
137
|
-
/**
|
|
138
|
-
* Invoice unique identifier.
|
|
139
|
-
*/
|
|
140
|
-
slug: string;
|
|
141
|
-
}) => {
|
|
126
|
+
type OpenInvoice = (eventData: SenderData[typeof MethodOpenInvoice]) => {
|
|
142
127
|
status: boolean | typeof NOT_SUPPORTED;
|
|
143
128
|
};
|
|
144
129
|
/**
|
|
@@ -154,16 +139,7 @@ declare const openInvoice: OpenInvoice;
|
|
|
154
139
|
*/
|
|
155
140
|
declare const supportOpenInvoice: () => boolean;
|
|
156
141
|
|
|
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
|
-
}) => {
|
|
142
|
+
type OpenLink = (eventData: SenderData[typeof MethodOpenLink]) => {
|
|
167
143
|
status: boolean | typeof NOT_SUPPORTED;
|
|
168
144
|
};
|
|
169
145
|
/**
|
|
@@ -179,31 +155,7 @@ declare const openLink: OpenLink;
|
|
|
179
155
|
*/
|
|
180
156
|
declare const supportOpenLink: () => boolean;
|
|
181
157
|
|
|
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<{
|
|
158
|
+
type OpenPopup = (eventData: SenderData[typeof MethodOpenPopup]) => Promise<{
|
|
207
159
|
status: boolean | typeof NOT_SUPPORTED;
|
|
208
160
|
data?: EventsData['popup_closed'];
|
|
209
161
|
}>;
|
|
@@ -218,16 +170,7 @@ declare const openPopup: OpenPopup;
|
|
|
218
170
|
*/
|
|
219
171
|
declare const supportOpenPopup: () => boolean;
|
|
220
172
|
|
|
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<{
|
|
173
|
+
type OpenScanQrPopup = (eventData: SenderData[typeof MethodOpenScanQrPopup]) => Promise<{
|
|
231
174
|
status: boolean | typeof NOT_SUPPORTED | 'closed';
|
|
232
175
|
data?: EventsData[typeof EventQrTextReceived];
|
|
233
176
|
}>;
|
|
@@ -246,14 +189,7 @@ declare const openScanQrPopup: OpenScanQrPopup;
|
|
|
246
189
|
*/
|
|
247
190
|
declare const supportOpenScanQrPopup: () => boolean;
|
|
248
191
|
|
|
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
|
-
}) => {
|
|
192
|
+
type OpenTgLink = (eventData: SenderData[typeof MethodOpenTgLink]) => {
|
|
257
193
|
status: boolean | typeof NOT_SUPPORTED;
|
|
258
194
|
};
|
|
259
195
|
/**
|
|
@@ -269,14 +205,7 @@ declare const openTgLink: OpenTgLink;
|
|
|
269
205
|
*/
|
|
270
206
|
declare const supportOpenTgLink: () => boolean;
|
|
271
207
|
|
|
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<{
|
|
208
|
+
type ReadTextFromClipboard = (eventData?: SenderData[typeof MethodReadTextFromClipboard]) => Promise<{
|
|
280
209
|
status: boolean | typeof NOT_SUPPORTED;
|
|
281
210
|
data?: EventsData[typeof EventClipboardTextReceived];
|
|
282
211
|
}>;
|
|
@@ -293,7 +222,7 @@ declare const readTextFromClipboard: ReadTextFromClipboard;
|
|
|
293
222
|
*/
|
|
294
223
|
declare const supportReadTextFromClipboard: () => boolean;
|
|
295
224
|
|
|
296
|
-
type Ready = () => {
|
|
225
|
+
type Ready = (eventData?: SenderData[typeof MethodReady]) => {
|
|
297
226
|
status: boolean | typeof NOT_SUPPORTED;
|
|
298
227
|
};
|
|
299
228
|
/**
|
|
@@ -309,7 +238,7 @@ declare const ready: Ready;
|
|
|
309
238
|
*/
|
|
310
239
|
declare const supportReady: () => boolean;
|
|
311
240
|
|
|
312
|
-
type RequestPhone = () => Promise<{
|
|
241
|
+
type RequestPhone = (eventData?: SenderData[typeof MethodRequestPhone]) => Promise<{
|
|
313
242
|
status: boolean | typeof NOT_SUPPORTED;
|
|
314
243
|
}>;
|
|
315
244
|
/**
|
|
@@ -323,7 +252,7 @@ declare const requestPhone: RequestPhone;
|
|
|
323
252
|
*/
|
|
324
253
|
declare const supportRequestPhone: () => boolean;
|
|
325
254
|
|
|
326
|
-
type RequestTheme = () => {
|
|
255
|
+
type RequestTheme = (eventData?: SenderData[typeof MethodRequestTheme]) => {
|
|
327
256
|
status: boolean | typeof NOT_SUPPORTED;
|
|
328
257
|
};
|
|
329
258
|
/**
|
|
@@ -339,7 +268,7 @@ declare const requestTheme: RequestTheme;
|
|
|
339
268
|
*/
|
|
340
269
|
declare const supportRequestTheme: () => boolean;
|
|
341
270
|
|
|
342
|
-
type RequestViewport = () => {
|
|
271
|
+
type RequestViewport = (eventData?: SenderData[typeof MethodRequestViewport]) => {
|
|
343
272
|
status: boolean | typeof NOT_SUPPORTED;
|
|
344
273
|
};
|
|
345
274
|
/**
|
|
@@ -355,7 +284,7 @@ declare const requestViewport: RequestViewport;
|
|
|
355
284
|
*/
|
|
356
285
|
declare const supportRequestViewport: () => boolean;
|
|
357
286
|
|
|
358
|
-
type RequestWriteAccess = () => {
|
|
287
|
+
type RequestWriteAccess = (eventData?: SenderData[typeof MethodRequestWriteAccess]) => {
|
|
359
288
|
status: boolean | typeof NOT_SUPPORTED;
|
|
360
289
|
};
|
|
361
290
|
/**
|
|
@@ -369,12 +298,7 @@ declare const requestWriteAccess: RequestWriteAccess;
|
|
|
369
298
|
*/
|
|
370
299
|
declare const supportRequestWriteAccess: () => boolean;
|
|
371
300
|
|
|
372
|
-
type SetBackgroundColor = (eventData: {
|
|
373
|
-
/**
|
|
374
|
-
* The Mini App background color in #RRGGBB format.
|
|
375
|
-
*/
|
|
376
|
-
color: string;
|
|
377
|
-
}) => {
|
|
301
|
+
type SetBackgroundColor = (eventData: SenderData[typeof MethodSetBackgroundColor]) => {
|
|
378
302
|
status: boolean | typeof NOT_SUPPORTED;
|
|
379
303
|
};
|
|
380
304
|
/**
|
|
@@ -388,16 +312,7 @@ declare const setBackgroundColor: SetBackgroundColor;
|
|
|
388
312
|
*/
|
|
389
313
|
declare const supportSetBackgroundColor: () => boolean;
|
|
390
314
|
|
|
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
|
-
}) => {
|
|
315
|
+
type SetHeaderColor = (eventData: SenderData[typeof MethodSetHeaderColor]) => {
|
|
401
316
|
status: boolean | typeof NOT_SUPPORTED;
|
|
402
317
|
};
|
|
403
318
|
/**
|
|
@@ -411,12 +326,19 @@ declare const setHeaderColor: SetHeaderColor;
|
|
|
411
326
|
*/
|
|
412
327
|
declare const supportSetHeaderColor: () => boolean;
|
|
413
328
|
|
|
414
|
-
type
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
329
|
+
type SetBottomBarColor = (eventData: SenderData[typeof MethodSetBottomBarColor]) => {
|
|
330
|
+
status: boolean | typeof NOT_SUPPORTED;
|
|
331
|
+
};
|
|
332
|
+
/**
|
|
333
|
+
* Updates the Mini App header color. This method should accept color_key or color property.
|
|
334
|
+
*/
|
|
335
|
+
declare const setBottomBarColor: SetBottomBarColor;
|
|
336
|
+
/**
|
|
337
|
+
* Method support check
|
|
338
|
+
*/
|
|
339
|
+
declare const supportSetBottomBarColor: () => boolean;
|
|
340
|
+
|
|
341
|
+
type SetupBackButton = (eventData: SenderData[typeof MethodSetupBackButton]) => {
|
|
420
342
|
status: boolean | typeof NOT_SUPPORTED;
|
|
421
343
|
};
|
|
422
344
|
/**
|
|
@@ -430,12 +352,7 @@ declare const setupBackButton: SetupBackButton;
|
|
|
430
352
|
*/
|
|
431
353
|
declare const supportSetupBackButton: () => boolean;
|
|
432
354
|
|
|
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
|
-
}) => {
|
|
355
|
+
type SetupClosingBehavior = (eventData: SenderData[typeof MethodSetupClosingBehavior]) => {
|
|
439
356
|
status: boolean | typeof NOT_SUPPORTED;
|
|
440
357
|
};
|
|
441
358
|
/**
|
|
@@ -449,32 +366,7 @@ declare const setupClosingBehavior: SetupClosingBehavior;
|
|
|
449
366
|
*/
|
|
450
367
|
declare const supportSetupClosingBehavior: () => boolean;
|
|
451
368
|
|
|
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
|
-
}) => {
|
|
369
|
+
type SetupMainButton = (eventData: SenderData[typeof MethodSetupMainButton]) => {
|
|
478
370
|
status: boolean | typeof NOT_SUPPORTED;
|
|
479
371
|
};
|
|
480
372
|
/**
|
|
@@ -488,12 +380,7 @@ declare const setupMainButton: SetupMainButton;
|
|
|
488
380
|
*/
|
|
489
381
|
declare const supportSetupMainButton: () => boolean;
|
|
490
382
|
|
|
491
|
-
type SetupSettingsButton = (eventData: {
|
|
492
|
-
/**
|
|
493
|
-
* Should the Settings Button be displayed.
|
|
494
|
-
*/
|
|
495
|
-
is_visible: boolean;
|
|
496
|
-
}) => {
|
|
383
|
+
type SetupSettingsButton = (eventData: SenderData[typeof MethodSetupSettingsButton]) => {
|
|
497
384
|
status: boolean | typeof NOT_SUPPORTED;
|
|
498
385
|
};
|
|
499
386
|
/**
|
|
@@ -507,18 +394,7 @@ declare const setupSettingsButton: SetupSettingsButton;
|
|
|
507
394
|
*/
|
|
508
395
|
declare const supportSetupSettingsButton: () => boolean;
|
|
509
396
|
|
|
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
|
-
}) => {
|
|
397
|
+
type SwitchInlineQuery = (eventData: SenderData[typeof MethodSwitchInlineQuery]) => {
|
|
522
398
|
status: boolean | typeof NOT_SUPPORTED;
|
|
523
399
|
};
|
|
524
400
|
/**
|
|
@@ -536,42 +412,7 @@ declare const switchInlineQuery: SwitchInlineQuery;
|
|
|
536
412
|
*/
|
|
537
413
|
declare const supportSwitchInlineQuery: () => boolean;
|
|
538
414
|
|
|
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
|
-
}) => {
|
|
415
|
+
type TriggerHapticFeedback = (eventData: SenderData[typeof MethodTriggerHapticFeedback]) => {
|
|
575
416
|
status: boolean | typeof NOT_SUPPORTED;
|
|
576
417
|
};
|
|
577
418
|
/**
|
|
@@ -603,6 +444,7 @@ declare const supportSessionStorageSet: () => boolean;
|
|
|
603
444
|
type SessionStorageGet = ({ key }: {
|
|
604
445
|
key: string;
|
|
605
446
|
}) => {
|
|
447
|
+
is_json: boolean;
|
|
606
448
|
status: boolean | typeof NOT_SUPPORTED;
|
|
607
449
|
value?: any;
|
|
608
450
|
};
|
|
@@ -615,6 +457,18 @@ declare const sessionStorageGet: SessionStorageGet;
|
|
|
615
457
|
*/
|
|
616
458
|
declare const supportSessionStorageGet: () => boolean;
|
|
617
459
|
|
|
460
|
+
type SetupSwipeBehavior = (eventData: SenderData[typeof MethodSetupSwipeBehavior]) => {
|
|
461
|
+
status: boolean | typeof NOT_SUPPORTED;
|
|
462
|
+
};
|
|
463
|
+
/**
|
|
464
|
+
* sessions storage set.
|
|
465
|
+
*/
|
|
466
|
+
declare const setupSwipeBehavior: SetupSwipeBehavior;
|
|
467
|
+
/**
|
|
468
|
+
* Method support check
|
|
469
|
+
*/
|
|
470
|
+
declare const supportSetupSwipeBehavior: () => boolean;
|
|
471
|
+
|
|
618
472
|
type User = {
|
|
619
473
|
/**
|
|
620
474
|
* Optional. True, if this user added the bot to the attachment menu.
|
|
@@ -687,7 +541,7 @@ type Chat = {
|
|
|
687
541
|
*/
|
|
688
542
|
username?: string;
|
|
689
543
|
};
|
|
690
|
-
type GetInitData =
|
|
544
|
+
type GetInitData = {
|
|
691
545
|
/**
|
|
692
546
|
* The date the initialization data was created.
|
|
693
547
|
*
|
|
@@ -740,7 +594,7 @@ type GetInitData = () => null | {
|
|
|
740
594
|
* Optional. An object containing information about the current user.
|
|
741
595
|
*/
|
|
742
596
|
user?: User;
|
|
743
|
-
};
|
|
597
|
+
} | undefined;
|
|
744
598
|
/**
|
|
745
599
|
* In the list of launch parameters, initialization data is located in the tgWebAppData parameter.
|
|
746
600
|
*
|
|
@@ -748,7 +602,53 @@ type GetInitData = () => null | {
|
|
|
748
602
|
*
|
|
749
603
|
* Original: https://docs.telegram-mini-apps.com/platform/launch-parameters/init-data#init-data
|
|
750
604
|
*/
|
|
751
|
-
declare const getInitData: GetInitData;
|
|
605
|
+
declare const getInitData: () => GetInitData;
|
|
606
|
+
|
|
607
|
+
type ThemeParams = {
|
|
608
|
+
bg_color: string;
|
|
609
|
+
text_color: string;
|
|
610
|
+
hint_color: string;
|
|
611
|
+
link_color: string;
|
|
612
|
+
button_color: string;
|
|
613
|
+
button_text_color: string;
|
|
614
|
+
/**
|
|
615
|
+
* Bot API 6.1+
|
|
616
|
+
*/
|
|
617
|
+
secondary_bg_color: string;
|
|
618
|
+
/**
|
|
619
|
+
* Bot API 7.0+
|
|
620
|
+
*/
|
|
621
|
+
header_bg_color: string;
|
|
622
|
+
/**
|
|
623
|
+
* Bot API 7.10+
|
|
624
|
+
*/
|
|
625
|
+
bottom_bar_bg_color: string;
|
|
626
|
+
/**
|
|
627
|
+
* Bot API 7.0+
|
|
628
|
+
*/
|
|
629
|
+
accent_text_color: string;
|
|
630
|
+
/**
|
|
631
|
+
* Bot API 7.0+
|
|
632
|
+
*/
|
|
633
|
+
section_bg_color: string;
|
|
634
|
+
/**
|
|
635
|
+
* Bot API 7.0+
|
|
636
|
+
*/
|
|
637
|
+
section_header_text_color: string;
|
|
638
|
+
/**
|
|
639
|
+
* Bot API 7.6+
|
|
640
|
+
*/
|
|
641
|
+
section_separator_color: string;
|
|
642
|
+
/**
|
|
643
|
+
* Bot API 7.0+
|
|
644
|
+
*/
|
|
645
|
+
subtitle_text_color: string;
|
|
646
|
+
/**
|
|
647
|
+
* Bot API 7.0+
|
|
648
|
+
*/
|
|
649
|
+
destructive_text_color: string;
|
|
650
|
+
};
|
|
651
|
+
declare const getThemeParams: (theme_params: ThemeParams) => Record<string, string>;
|
|
752
652
|
|
|
753
653
|
type Sender = (eventType: string, eventData?: any) => void;
|
|
754
654
|
/**
|
|
@@ -759,18 +659,300 @@ type Sender = (eventType: string, eventData?: any) => void;
|
|
|
759
659
|
*/
|
|
760
660
|
declare const sender: Sender;
|
|
761
661
|
|
|
662
|
+
declare const MethodInvokeCustomMethod = "web_app_invoke_custom_method";
|
|
663
|
+
declare const MethodOpenScanQrPopup = "web_app_open_scan_qr_popup";
|
|
664
|
+
declare const MethodReadTextFromClipboard = "web_app_read_text_from_clipboard";
|
|
665
|
+
declare const MethodRequestPhone = "web_app_request_phone";
|
|
666
|
+
declare const MethodClose = "web_app_close";
|
|
667
|
+
declare const MethodCloseScanQrPopup = "web_app_close_scan_qr_popup";
|
|
668
|
+
declare const MethodDataSend = "web_app_data_send";
|
|
669
|
+
declare const MethodExpand = "web_app_expand";
|
|
670
|
+
declare const MethodIframeReady = "iframe_ready";
|
|
671
|
+
declare const MethodIframeWillReload = "iframe_will_reload";
|
|
672
|
+
declare const MethodOpenInvoice = "web_app_open_invoice";
|
|
673
|
+
declare const MethodOpenLink = "web_app_open_link";
|
|
674
|
+
declare const MethodOpenPopup = "web_app_open_popup";
|
|
675
|
+
declare const MethodOpenTgLink = "web_app_open_tg_link";
|
|
676
|
+
declare const MethodReady = "web_app_ready";
|
|
677
|
+
declare const MethodRequestTheme = "web_app_request_theme";
|
|
678
|
+
declare const MethodRequestViewport = "web_app_request_viewport";
|
|
679
|
+
declare const MethodRequestWriteAccess = "web_app_request_write_access";
|
|
680
|
+
declare const MethodSetBackgroundColor = "web_app_set_background_color";
|
|
681
|
+
declare const MethodSetHeaderColor = "web_app_set_header_color";
|
|
682
|
+
declare const MethodSetBottomBarColor = "web_app_set_bottom_bar_color";
|
|
683
|
+
declare const MethodSetupBackButton = "web_app_setup_back_button";
|
|
684
|
+
declare const MethodSetupClosingBehavior = "web_app_setup_closing_behavior";
|
|
685
|
+
declare const MethodSetupMainButton = "web_app_setup_main_button";
|
|
686
|
+
declare const MethodSetupSettingsButton = "web_app_setup_settings_button";
|
|
687
|
+
declare const MethodSwitchInlineQuery = "web_app_switch_inline_query";
|
|
688
|
+
declare const MethodTriggerHapticFeedback = "web_app_trigger_haptic_feedback";
|
|
689
|
+
declare const MethodSetupSwipeBehavior = "web_app_setup_swipe_behavior";
|
|
690
|
+
type PopupButton = {
|
|
691
|
+
/**
|
|
692
|
+
* Identifier of the button, 0-64 characters.
|
|
693
|
+
*/
|
|
694
|
+
id: string;
|
|
695
|
+
type: 'default' | 'destructive' | 'ok' | 'close' | 'cancel';
|
|
696
|
+
/**
|
|
697
|
+
* The text to be displayed on the button, 0-64 characters. Ignored when type is ok, close or cancel.
|
|
698
|
+
*/
|
|
699
|
+
text: string;
|
|
700
|
+
};
|
|
701
|
+
type SenderData = {
|
|
702
|
+
[MethodInvokeCustomMethod]: {
|
|
703
|
+
/**
|
|
704
|
+
* Current invocation unique identifier.
|
|
705
|
+
*
|
|
706
|
+
* Default: () => randomReqId
|
|
707
|
+
*/
|
|
708
|
+
req_id?: string;
|
|
709
|
+
/**
|
|
710
|
+
* Method name.
|
|
711
|
+
*/
|
|
712
|
+
method: string;
|
|
713
|
+
/**
|
|
714
|
+
* Parameters according to method.
|
|
715
|
+
*/
|
|
716
|
+
params: unknown;
|
|
717
|
+
};
|
|
718
|
+
[MethodOpenScanQrPopup]: {
|
|
719
|
+
/**
|
|
720
|
+
* Optional. Text to be displayed in the QR scanner.
|
|
721
|
+
*/
|
|
722
|
+
text?: string;
|
|
723
|
+
/**
|
|
724
|
+
* [Custom] Optional. Сlose QR scanner after receiving data
|
|
725
|
+
*/
|
|
726
|
+
is_close?: boolean;
|
|
727
|
+
};
|
|
728
|
+
[MethodReadTextFromClipboard]: {
|
|
729
|
+
/**
|
|
730
|
+
* Unique request identifier. Should be any unique string to handle the generated event appropriately.
|
|
731
|
+
*
|
|
732
|
+
* Default: () => randomReqId
|
|
733
|
+
*/
|
|
734
|
+
req_id?: string;
|
|
735
|
+
};
|
|
736
|
+
[MethodRequestPhone]: undefined;
|
|
737
|
+
[MethodClose]: undefined;
|
|
738
|
+
[MethodCloseScanQrPopup]: undefined;
|
|
739
|
+
[MethodDataSend]: {
|
|
740
|
+
/**
|
|
741
|
+
** EN: Data to send to a bot. Should not have size of more than 4096 bytes.
|
|
742
|
+
|
|
743
|
+
** RU: Данные для отправки боту. Не должен иметь размер более 4096 байт.
|
|
744
|
+
*/
|
|
745
|
+
data: string;
|
|
746
|
+
};
|
|
747
|
+
[MethodExpand]: undefined;
|
|
748
|
+
[MethodIframeReady]: {
|
|
749
|
+
/**
|
|
750
|
+
* Optional. True, if current Mini App supports native reloading.
|
|
751
|
+
*/
|
|
752
|
+
reload_supported?: boolean;
|
|
753
|
+
};
|
|
754
|
+
[MethodIframeWillReload]: undefined;
|
|
755
|
+
[MethodOpenInvoice]: {
|
|
756
|
+
/**
|
|
757
|
+
* Invoice unique identifier.
|
|
758
|
+
*/
|
|
759
|
+
slug: string;
|
|
760
|
+
};
|
|
761
|
+
[MethodOpenLink]: {
|
|
762
|
+
/**
|
|
763
|
+
* URL to be opened by Telegram application. Should be a full path with https protocol.
|
|
764
|
+
*/
|
|
765
|
+
url: string;
|
|
766
|
+
/**
|
|
767
|
+
* Optional. Link will be opened in Instant View mode if possible.
|
|
768
|
+
*/
|
|
769
|
+
try_instant_view?: boolean;
|
|
770
|
+
};
|
|
771
|
+
[MethodOpenPopup]: {
|
|
772
|
+
/**
|
|
773
|
+
* The text to be displayed in the popup title, 0-64 characters
|
|
774
|
+
*/
|
|
775
|
+
title: string;
|
|
776
|
+
/**
|
|
777
|
+
* The message to be displayed in the body of the popup, 1-256 characters
|
|
778
|
+
*/
|
|
779
|
+
message: string;
|
|
780
|
+
/**
|
|
781
|
+
* List of buttons to be displayed in the popup, 1-3 buttons
|
|
782
|
+
*/
|
|
783
|
+
buttons: PopupButton[];
|
|
784
|
+
};
|
|
785
|
+
[MethodOpenTgLink]: {
|
|
786
|
+
/**
|
|
787
|
+
* Should be a value taken from the link of this format: https://t.me/{path_full}.
|
|
788
|
+
*
|
|
789
|
+
* Can additionally contain query parameters.
|
|
790
|
+
*/
|
|
791
|
+
path_full: string;
|
|
792
|
+
};
|
|
793
|
+
[MethodReady]: undefined;
|
|
794
|
+
[MethodRequestTheme]: undefined;
|
|
795
|
+
[MethodRequestViewport]: undefined;
|
|
796
|
+
[MethodRequestWriteAccess]: undefined;
|
|
797
|
+
[MethodSetBackgroundColor]: {
|
|
798
|
+
/**
|
|
799
|
+
* The Mini App background color in #RRGGBB format.
|
|
800
|
+
*/
|
|
801
|
+
color: string;
|
|
802
|
+
};
|
|
803
|
+
[MethodSetHeaderColor]: {
|
|
804
|
+
/**
|
|
805
|
+
* The Mini App header color key. Could be either bg_color or secondary_bg_color.
|
|
806
|
+
*/
|
|
807
|
+
color_key: 'bg_color' | 'secondary_bg_color';
|
|
808
|
+
color?: undefined;
|
|
809
|
+
} | {
|
|
810
|
+
/**
|
|
811
|
+
* Color in HEX format.
|
|
812
|
+
*/
|
|
813
|
+
color: string;
|
|
814
|
+
color_key?: undefined;
|
|
815
|
+
};
|
|
816
|
+
[MethodSetBottomBarColor]: {
|
|
817
|
+
/**
|
|
818
|
+
* The Mini App header color key. Could be either bg_color or secondary_bg_color.
|
|
819
|
+
*/
|
|
820
|
+
color_key: 'bg_color' | 'secondary_bg_color' | 'bottom_bar_bg_color';
|
|
821
|
+
color?: undefined;
|
|
822
|
+
} | {
|
|
823
|
+
/**
|
|
824
|
+
* Color in HEX format.
|
|
825
|
+
*/
|
|
826
|
+
color: string;
|
|
827
|
+
color_key?: undefined;
|
|
828
|
+
};
|
|
829
|
+
[MethodSetupBackButton]: {
|
|
830
|
+
/**
|
|
831
|
+
* Should the Back Button be visible.
|
|
832
|
+
*/
|
|
833
|
+
is_visible: boolean;
|
|
834
|
+
};
|
|
835
|
+
[MethodSetupClosingBehavior]: {
|
|
836
|
+
/**
|
|
837
|
+
* Will user be prompted in case, an application is going to be closed.
|
|
838
|
+
*/
|
|
839
|
+
need_confirmation: boolean;
|
|
840
|
+
};
|
|
841
|
+
[MethodSetupMainButton]: {
|
|
842
|
+
/**
|
|
843
|
+
* Optional. Should the Main Button be displayed.
|
|
844
|
+
*/
|
|
845
|
+
is_visible?: boolean;
|
|
846
|
+
/**
|
|
847
|
+
* Optional. Should the Main Button be enabled.
|
|
848
|
+
*/
|
|
849
|
+
is_active?: boolean;
|
|
850
|
+
/**
|
|
851
|
+
* 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.
|
|
852
|
+
*/
|
|
853
|
+
is_progress_visible?: boolean;
|
|
854
|
+
/**
|
|
855
|
+
* Optional. Text inside the Main Button.
|
|
856
|
+
*/
|
|
857
|
+
text?: string;
|
|
858
|
+
/**
|
|
859
|
+
* Optional. The Main Button background color in #RRGGBB format.
|
|
860
|
+
*/
|
|
861
|
+
color?: string;
|
|
862
|
+
/**
|
|
863
|
+
* Optional. The Main Button text color in #RRGGBB format.
|
|
864
|
+
*/
|
|
865
|
+
text_color?: string;
|
|
866
|
+
};
|
|
867
|
+
[MethodSetupSettingsButton]: {
|
|
868
|
+
/**
|
|
869
|
+
* Should the Settings Button be displayed.
|
|
870
|
+
*/
|
|
871
|
+
is_visible: boolean;
|
|
872
|
+
};
|
|
873
|
+
[MethodSwitchInlineQuery]: {
|
|
874
|
+
/**
|
|
875
|
+
* Text which should be inserted in the input after the current bot name. Max length is 256 symbols.
|
|
876
|
+
*/
|
|
877
|
+
query: string;
|
|
878
|
+
/**
|
|
879
|
+
* List of chat types which could be chosen to send the message. Could be empty list. Values:
|
|
880
|
+
*
|
|
881
|
+
* users, bots, groups, channels
|
|
882
|
+
*/
|
|
883
|
+
chat_types: ['users', 'bots', 'groups', 'channels'];
|
|
884
|
+
};
|
|
885
|
+
[MethodTriggerHapticFeedback]: {
|
|
886
|
+
/**
|
|
887
|
+
* Type of haptic event. Values:
|
|
888
|
+
*
|
|
889
|
+
* impact - when there's a collision involving UI components.
|
|
890
|
+
*/
|
|
891
|
+
type: 'impact';
|
|
892
|
+
/**
|
|
893
|
+
* Required when type is impact. Values:
|
|
894
|
+
*
|
|
895
|
+
* light - indicates a collision between small or lightweight UI objects
|
|
896
|
+
*
|
|
897
|
+
* medium - indicates a collision between medium-sized or medium-weight UI objects
|
|
898
|
+
*
|
|
899
|
+
* heavy - indicates a collision between large or heavyweight UI objects
|
|
900
|
+
*
|
|
901
|
+
* rigid - indicates a collision between hard or inflexible UI objects
|
|
902
|
+
*
|
|
903
|
+
* soft - indicates a collision between soft or flexible UI objects
|
|
904
|
+
*/
|
|
905
|
+
impact_style: 'light' | 'medium' | 'heavy' | 'rigid' | 'soft';
|
|
906
|
+
} | {
|
|
907
|
+
/**
|
|
908
|
+
* Type of haptic event. Values:
|
|
909
|
+
*
|
|
910
|
+
* notification - when some action execution has been completed.
|
|
911
|
+
*/
|
|
912
|
+
type: 'notification';
|
|
913
|
+
/**
|
|
914
|
+
* Required when type is notification. Values:
|
|
915
|
+
*
|
|
916
|
+
* error - indicates that a task or action has failed
|
|
917
|
+
*
|
|
918
|
+
* success - indicates that a task or action has completed successfully
|
|
919
|
+
*
|
|
920
|
+
* warning - indicates that a task or action produced a warning
|
|
921
|
+
*/
|
|
922
|
+
notification_type: 'error' | 'success' | 'warning';
|
|
923
|
+
} | {
|
|
924
|
+
/**
|
|
925
|
+
* selection_change - when the user changes their selection.
|
|
926
|
+
*/
|
|
927
|
+
type: 'selection_change';
|
|
928
|
+
impact_style?: undefined;
|
|
929
|
+
notification_type?: undefined;
|
|
930
|
+
};
|
|
931
|
+
[MethodSetupSwipeBehavior]: {
|
|
932
|
+
allow_vertical_swipe: boolean;
|
|
933
|
+
};
|
|
934
|
+
};
|
|
935
|
+
|
|
762
936
|
type Debug = (methondName: string, errorId: number) => void;
|
|
763
937
|
declare const debug: Debug;
|
|
764
938
|
|
|
939
|
+
type GetPlatform = () => 'phone' | 'web' | 'desktop';
|
|
940
|
+
declare const TG_WEB = "web";
|
|
941
|
+
declare const TG_PHONE = "phone";
|
|
942
|
+
declare const TG_DESKTOP = "desktop";
|
|
943
|
+
declare const getPlatform: GetPlatform;
|
|
944
|
+
|
|
945
|
+
declare const NOT_SUPPORTED = "not_supported";
|
|
946
|
+
|
|
765
947
|
type EventsData = {
|
|
766
948
|
/**
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
949
|
+
* User clicked the Back Button.
|
|
950
|
+
*/
|
|
951
|
+
back_button_pressed: undefined;
|
|
770
952
|
/**
|
|
771
953
|
* Telegram application attempted to extract text from clipboard.
|
|
772
954
|
*/
|
|
773
|
-
|
|
955
|
+
clipboard_text_received: {
|
|
774
956
|
/**
|
|
775
957
|
* Passed during the web_app_read_text_from_clipboard method invocation req_id value.
|
|
776
958
|
*/
|
|
@@ -781,9 +963,9 @@ type EventsData = {
|
|
|
781
963
|
data?: string | null;
|
|
782
964
|
};
|
|
783
965
|
/**
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
966
|
+
* Custom method invocation completed.
|
|
967
|
+
*/
|
|
968
|
+
custom_method_invoked: {
|
|
787
969
|
/**
|
|
788
970
|
* Unique identifier of this invocation.
|
|
789
971
|
*/
|
|
@@ -798,9 +980,9 @@ type EventsData = {
|
|
|
798
980
|
error?: string;
|
|
799
981
|
};
|
|
800
982
|
/**
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
983
|
+
* An invoice was closed.
|
|
984
|
+
*/
|
|
985
|
+
invoice_closed: {
|
|
804
986
|
/**
|
|
805
987
|
* Passed during the web_app_open_invoice method invocation slug value.
|
|
806
988
|
*/
|
|
@@ -819,22 +1001,22 @@ type EventsData = {
|
|
|
819
1001
|
status: 'paid' | 'failed' | 'pending' | 'cancelled';
|
|
820
1002
|
};
|
|
821
1003
|
/**
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
1004
|
+
* User clicked the Main Button.
|
|
1005
|
+
*/
|
|
1006
|
+
main_button_pressed: undefined;
|
|
825
1007
|
/**
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
1008
|
+
* Application received phone access request status.
|
|
1009
|
+
*/
|
|
1010
|
+
phone_requested: {
|
|
829
1011
|
/**
|
|
830
1012
|
* Request status. Can only be sent
|
|
831
1013
|
*/
|
|
832
1014
|
status: 'sent';
|
|
833
1015
|
};
|
|
834
1016
|
/**
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
1017
|
+
* Popup was closed.
|
|
1018
|
+
*/
|
|
1019
|
+
popup_closed: {
|
|
838
1020
|
/**
|
|
839
1021
|
* Optional. Identifier of the clicked button.
|
|
840
1022
|
*
|
|
@@ -843,47 +1025,47 @@ type EventsData = {
|
|
|
843
1025
|
button_id?: string;
|
|
844
1026
|
};
|
|
845
1027
|
/**
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
1028
|
+
* Parent iframe requested current iframe reload.
|
|
1029
|
+
*/
|
|
1030
|
+
reload_iframe: undefined;
|
|
849
1031
|
/**
|
|
850
1032
|
* The QR scanner scanned some QR and extracted its content.
|
|
851
1033
|
*/
|
|
852
|
-
|
|
1034
|
+
qr_text_received: {
|
|
853
1035
|
/**
|
|
854
1036
|
* Optional. Data extracted from the QR.
|
|
855
1037
|
*/
|
|
856
1038
|
data?: string;
|
|
857
1039
|
};
|
|
858
1040
|
/**
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
1041
|
+
* QR scanner was closed.
|
|
1042
|
+
*/
|
|
1043
|
+
scan_qr_popup_closed: undefined;
|
|
862
1044
|
/**
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
1045
|
+
* The event which is usually sent by the Telegram web application.
|
|
1046
|
+
*
|
|
1047
|
+
* 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).
|
|
1048
|
+
*/
|
|
1049
|
+
set_custom_style: undefined;
|
|
868
1050
|
/**
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
1051
|
+
* Occurs when the Settings Button was pressed.
|
|
1052
|
+
*/
|
|
1053
|
+
settings_button_pressed: undefined;
|
|
872
1054
|
/**
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
1055
|
+
* Occurs whenever the theme was changed in the user's Telegram app ( including switching to night mode).
|
|
1056
|
+
*/
|
|
1057
|
+
theme_changed: {
|
|
876
1058
|
/**
|
|
877
1059
|
* Map where the key is a theme stylesheet key and value is the corresponding color in #RRGGBB format.
|
|
878
1060
|
*/
|
|
879
|
-
theme_params:
|
|
1061
|
+
theme_params: ThemeParams;
|
|
880
1062
|
};
|
|
881
1063
|
/**
|
|
882
1064
|
* Occurs whenever the viewport has been changed.
|
|
883
1065
|
*
|
|
884
1066
|
* For example, when the user started dragging the application or called the expansion method.
|
|
885
1067
|
*/
|
|
886
|
-
|
|
1068
|
+
viewport_changed: {
|
|
887
1069
|
/**
|
|
888
1070
|
* The viewport height.
|
|
889
1071
|
*/
|
|
@@ -902,9 +1084,9 @@ type EventsData = {
|
|
|
902
1084
|
is_state_stable: boolean;
|
|
903
1085
|
};
|
|
904
1086
|
/**
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
1087
|
+
* Application received write access request status.
|
|
1088
|
+
*/
|
|
1089
|
+
write_access_requested: {
|
|
908
1090
|
/**
|
|
909
1091
|
* Request status. Can only be allowed.
|
|
910
1092
|
*/
|
|
@@ -924,7 +1106,7 @@ declare global {
|
|
|
924
1106
|
interface Window {
|
|
925
1107
|
TelegramWebviewProxy: TelegramWebviewProxy;
|
|
926
1108
|
TelegramGameProxy: TelegramGameProxy;
|
|
927
|
-
TelegramGameProxy_receiveEvent: TelegramGameProxy[
|
|
1109
|
+
TelegramGameProxy_receiveEvent: TelegramGameProxy['receiveEvent'];
|
|
928
1110
|
Telegram: {
|
|
929
1111
|
WebView: TelegramGameProxy;
|
|
930
1112
|
};
|
|
@@ -943,38 +1125,17 @@ declare namespace listener {
|
|
|
943
1125
|
export { type listener_EventsData as EventsData, listener_off as off, listener_on as on, listener_once as once };
|
|
944
1126
|
}
|
|
945
1127
|
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
declare const
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
declare const
|
|
957
|
-
declare const MethodCloseScanQrPopup = "web_app_close_scan_qr_popup";
|
|
958
|
-
declare const MethodDataSend = "web_app_data_send";
|
|
959
|
-
declare const MethodExpand = "web_app_expand";
|
|
960
|
-
declare const MethodIframeReady = "iframe_ready";
|
|
961
|
-
declare const MethodIframeWillReload = "iframe_will_reload";
|
|
962
|
-
declare const MethodOpenInvoice = "web_app_open_invoice";
|
|
963
|
-
declare const MethodOpenLink = "web_app_open_link";
|
|
964
|
-
declare const MethodOpenPopup = "web_app_open_popup";
|
|
965
|
-
declare const MethodOpenTgLink = "web_app_open_tg_link";
|
|
966
|
-
declare const MethodReady = "web_app_ready";
|
|
967
|
-
declare const MethodRequestTheme = "web_app_request_theme";
|
|
968
|
-
declare const MethodRequestViewport = "web_app_request_viewport";
|
|
969
|
-
declare const MethodRequestWriteAccess = "web_app_request_write_access";
|
|
970
|
-
declare const MethodSetBackgroundColor = "web_app_set_background_color";
|
|
971
|
-
declare const MethodSetHeaderColor = "web_app_set_header_color";
|
|
972
|
-
declare const MethodSetupBackButton = "web_app_setup_back_button";
|
|
973
|
-
declare const MethodSetupClosingBehavior = "web_app_setup_closing_behavior";
|
|
974
|
-
declare const MethodSetupMainButton = "web_app_setup_main_button";
|
|
975
|
-
declare const MethodSetupSettingsButton = "web_app_setup_settings_button";
|
|
976
|
-
declare const MethodSwitchInlineQuery = "web_app_switch_inline_query";
|
|
977
|
-
declare const MethodTriggerHapticFeedback = "web_app_trigger_haptic_feedback";
|
|
1128
|
+
type Value = {
|
|
1129
|
+
viewport?: EventsData[typeof EventViewportChanged] & {
|
|
1130
|
+
safe_area_bottom: number;
|
|
1131
|
+
};
|
|
1132
|
+
theme?: EventsData[typeof EventThemeChanged];
|
|
1133
|
+
init?: GetInitData;
|
|
1134
|
+
};
|
|
1135
|
+
declare const ContextTwa: Context<Value>;
|
|
1136
|
+
interface ProviderTWA extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
1137
|
+
}
|
|
1138
|
+
declare const ProviderTWA: Component<ProviderTWA>;
|
|
978
1139
|
|
|
979
1140
|
declare const EventBackButtonPressed = "back_button_pressed";
|
|
980
1141
|
declare const EventClipboardTextReceived = "clipboard_text_received";
|
|
@@ -992,4 +1153,4 @@ declare const EventThemeChanged = "theme_changed";
|
|
|
992
1153
|
declare const EventViewportChanged = "viewport_changed";
|
|
993
1154
|
declare const EventWriteAccessRequested = "write_access_requested";
|
|
994
1155
|
|
|
995
|
-
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, 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, switchInlineQuery as bridgeSwitchInlineQuery, triggerHapticFeedback as bridgeTriggerHapticFeedback, createIsViewportChanged, debug, 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, supportSwitchInlineQuery, supportTriggerHapticFeedback };
|
|
1156
|
+
export { ContextTwa, EventBackButtonPressed, EventClipboardTextReceived, EventCustomMethodInvoked, EventInvoiceClosed, EventMainButtonPressed, EventPhoneRequested, EventPopupClosed, EventQrTextReceived, EventReloadIframe, EventScanQrPopupClosed, EventSetCustomStyle, EventSettingsButtonPressed, EventThemeChanged, EventViewportChanged, EventWriteAccessRequested, type EventsData, type GetInitData, 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, 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, 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, supportSetBottomBarColor, supportSetHeaderColor, supportSetupBackButton, supportSetupClosingBehavior, supportSetupMainButton, supportSetupSettingsButton, supportSetupSwipeBehavior, supportSwitchInlineQuery, supportTriggerHapticFeedback };
|