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