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