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