@apiteam/twa-bridge 0.0.2-beta.3 → 0.0.2-beta.4

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