@apiteam/twa-bridge 7.1.1 → 7.1.12

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