@tma.js/bridge 1.3.10 → 1.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [code-badge]: https://img.shields.io/badge/source-black?logo=github
6
6
 
7
- [docs-link]: https://docs.telegram-mini-apps.com/docs/libraries/twa-js-bridge
7
+ [docs-link]: https://docs.telegram-mini-apps.com/packages/typescript/tma-js-bridge
8
8
 
9
9
  [docs-badge]: https://img.shields.io/badge/documentation-blue?logo=gitbook&logoColor=white
10
10
 
@@ -25,4 +25,4 @@ data difference problems to protect developers code and save their time.
25
25
 
26
26
  This library is a part of TypeScript packages ecosystem around Telegram Web
27
27
  Apps. You can learn more about this package in this
28
- [documentation](https://docs.telegram-mini-apps.com/docs/libraries/twa-js-bridge).
28
+ [documentation][docs-link].
@@ -3,87 +3,99 @@ import type { IsNever, Not } from '@tma.js/util-types';
3
3
  import type { ClipboardTextReceivedPayload, CustomMethodInvokedPayload, InvoiceClosedPayload, PhoneRequestedPayload, PopupClosedPayload, QrTextReceivedPayload, ThemeChangedPayload, ViewportChangedPayload, WriteAccessRequestedPayload } from './payloads.js';
4
4
  /**
5
5
  * Map where key is known event name, and value is its listener.
6
- * @see Documentation https://docs.telegram-mini-apps.com/docs/apps-communication/events
6
+ * @see https://docs.telegram-mini-apps.com/apps-communication/events
7
7
  */
8
8
  export interface Events {
9
9
  /**
10
10
  * User clicked back button.
11
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/events#back_button_pressed
11
+ * @since v6.1
12
+ * @see https://docs.telegram-mini-apps.com/apps-communication/events#back-button-pressed
12
13
  */
13
14
  back_button_pressed: () => void;
14
15
  /**
15
- * Text was extracted from clipboard.
16
- * @param payload - event information.
17
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/events#clipboard_text_received
16
+ * Telegram application attempted to extract text from clipboard.
17
+ * @param payload - event payload.
18
+ * @since v6.4
19
+ * @see https://docs.telegram-mini-apps.com/apps-communication/events#clipboard-text-received
18
20
  */
19
21
  clipboard_text_received: (payload: ClipboardTextReceivedPayload) => void;
20
22
  /**
21
- * Being called whenever custom method was invoked.
23
+ * Custom method invocation completed.
22
24
  * @param payload - event payload.
23
- * @since 6.9
25
+ * @since v6.9
26
+ * @see https://docs.telegram-mini-apps.com/apps-communication/events#custom-method-invoked
24
27
  */
25
28
  custom_method_invoked: (payload: CustomMethodInvokedPayload) => void;
26
29
  /**
27
- * Invoice was closed.
30
+ * An invoice was closed.
28
31
  * @param payload - invoice close information.
29
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/events#invoice_closed
32
+ * @see https://docs.telegram-mini-apps.com/apps-communication/events#invoice-closed
30
33
  */
31
34
  invoice_closed: (payload: InvoiceClosedPayload) => void;
32
35
  /**
33
- * User clicked main button.
34
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/events#main_button_pressed
36
+ * User clicked the Main Button.
37
+ * @see https://docs.telegram-mini-apps.com/apps-communication/events#main-button-pressed
35
38
  */
36
39
  main_button_pressed: () => void;
37
40
  /**
38
41
  * Application received phone access request status.
39
- * @param payload - event payload. - event payload.
40
- * @since 6.9
42
+ * @param payload - event payload.
43
+ * @since v6.9
44
+ * @see https://docs.telegram-mini-apps.com/apps-communication/events#phone-requested
41
45
  */
42
46
  phone_requested: (payload: PhoneRequestedPayload) => void;
43
47
  /**
44
48
  * Popup was closed.
45
- * @param payload - popup close information.
46
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/events#main_button_pressed
49
+ * @param payload - event payload.
50
+ * @see https://docs.telegram-mini-apps.com/apps-communication/events#popup-closed
47
51
  */
48
52
  popup_closed: (payload: PopupClosedPayload) => void;
49
53
  /**
50
- * Data from QR was extracted.
51
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/events#qr_text_received
54
+ * The QR scanner scanned some QR and extracted its content.
55
+ * @param payload - event payload.
56
+ * @since v6.4
57
+ * @see https://docs.telegram-mini-apps.com/apps-communication/events#qr-text-received
52
58
  */
53
59
  qr_text_received: (payload: QrTextReceivedPayload) => void;
54
60
  /**
55
61
  * QR scanner was closed.
56
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/events#scan_qr_popup_closed
62
+ * @since v6.4
63
+ * @see https://docs.telegram-mini-apps.com/apps-communication/events#scan-qr-popup-closed
57
64
  */
58
65
  scan_qr_popup_closed: () => void;
59
66
  /**
60
- * Telegram requested to update current application style.
67
+ * The event which is usually sent by the Telegram web application. Its payload represents
68
+ * `<style/>` tag html content, a developer could use. The stylesheet described in the payload
69
+ * will help the developer to stylize the app scrollbar (but he is still able to do it himself).
61
70
  * @param html - `style` tag inner HTML.
62
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/events#set_custom_style
71
+ * @see https://docs.telegram-mini-apps.com/apps-communication/events#set-custom-style
63
72
  */
64
73
  set_custom_style: (html: string) => void;
65
74
  /**
66
- * Occurs when the Settings item in context menu is pressed.
67
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/events#settings_button_pressed
75
+ * Occurs when the Settings Button was pressed.
76
+ * @since v6.1
77
+ * @see https://docs.telegram-mini-apps.com/apps-communication/events#settings-button-pressed
68
78
  */
69
79
  settings_button_pressed: () => void;
70
80
  /**
71
81
  * Occurs whenever theme settings are changed in the user's Telegram app
72
82
  * (including switching to night mode).
73
- * @param payload - theme information.
74
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/events#theme_changed
83
+ * @param payload - event payload.
84
+ * @see https://docs.telegram-mini-apps.com/apps-communication/events#theme-changed
75
85
  */
76
86
  theme_changed: (payload: ThemeChangedPayload) => void;
77
87
  /**
78
- * Viewport was changed.
79
- * @param payload - viewport information.
80
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/events#viewport_changed
88
+ * Occurs whenever the viewport has been changed. For example, when the user started
89
+ * dragging the application or called the expansion method.
90
+ * @param payload - event payload.
91
+ * @see https://docs.telegram-mini-apps.com/apps-communication/events#viewport-changed
81
92
  */
82
93
  viewport_changed: (payload: ViewportChangedPayload) => void;
83
94
  /**
84
- * Application received write access requests status.
95
+ * Application received write access request status.
85
96
  * @param payload - event payload.
86
- * @since 6.9
97
+ * @since v6.9
98
+ * @see https://docs.telegram-mini-apps.com/apps-communication/events#write-access-requested
87
99
  */
88
100
  write_access_requested: (payload: WriteAccessRequestedPayload) => void;
89
101
  }
@@ -1,23 +1,52 @@
1
1
  import type { RGB } from '@tma.js/colors';
2
2
  import type { RequestId } from '../shared.js';
3
3
  export interface ClipboardTextReceivedPayload {
4
+ /**
5
+ * Passed during the `web_app_read_text_from_clipboard` method invocation `req_id` value.
6
+ */
4
7
  req_id: RequestId;
8
+ /**
9
+ * Data extracted from the clipboard. The returned value will have the type `string` only in
10
+ * the case, application has access to the clipboard.
11
+ */
5
12
  data?: string | null;
6
13
  }
7
14
  export interface CustomMethodInvokedPayload<R = unknown> {
15
+ /**
16
+ * Unique identifier of this invocation.
17
+ */
8
18
  req_id: RequestId;
19
+ /**
20
+ * Method invocation successful result.
21
+ */
9
22
  result?: R;
23
+ /**
24
+ * Method invocation error code.
25
+ */
10
26
  error?: string;
11
27
  }
12
28
  export type InvoiceStatus = 'paid' | 'failed' | 'pending' | 'cancelled' | string;
13
29
  export interface InvoiceClosedPayload {
30
+ /**
31
+ * Passed during the `web_app_open_invoice` method invocation `slug` value.
32
+ */
14
33
  slug: string;
34
+ /**
35
+ * Invoice status
36
+ */
15
37
  status: InvoiceStatus;
16
38
  }
17
39
  export interface QrTextReceivedPayload {
40
+ /**
41
+ * Data extracted from the QR.
42
+ */
18
43
  data?: string;
19
44
  }
20
45
  export interface ThemeChangedPayload {
46
+ /**
47
+ * Map where the key is a theme stylesheet key and value is the corresponding color in
48
+ * `#RRGGBB` format.
49
+ */
21
50
  theme_params: {
22
51
  bg_color?: RGB;
23
52
  text_color?: RGB;
@@ -29,19 +58,41 @@ export interface ThemeChangedPayload {
29
58
  };
30
59
  }
31
60
  export interface ViewportChangedPayload {
61
+ /**
62
+ * The viewport height.
63
+ */
32
64
  height: number;
65
+ /**
66
+ * The viewport width.
67
+ */
33
68
  width: number;
69
+ /**
70
+ * Is the viewport currently expanded.
71
+ */
34
72
  is_expanded: boolean;
73
+ /**
74
+ * Is the viewport current state stable and not going to change in the next moment.
75
+ */
35
76
  is_state_stable: boolean;
36
77
  }
37
78
  export interface PopupClosedPayload {
79
+ /**
80
+ * Identifier of the clicked button. In case, the popup was closed without clicking any button,
81
+ * this property will be omitted.
82
+ */
38
83
  button_id?: string;
39
84
  }
40
85
  export type PhoneRequestedStatus = 'sent' | string;
41
86
  export interface PhoneRequestedPayload {
87
+ /**
88
+ * Request status.
89
+ */
42
90
  status: PhoneRequestedStatus;
43
91
  }
44
92
  export type WriteAccessRequestedStatus = 'allowed' | string;
45
93
  export interface WriteAccessRequestedPayload {
94
+ /**
95
+ * Request status.
96
+ */
46
97
  status: WriteAccessRequestedStatus;
47
98
  }
@@ -5,198 +5,281 @@ import type { AnyHapticFeedbackParams } from './haptic.js';
5
5
  import type { RequestId } from '../shared.js';
6
6
  import type { AnyInvokeCustomMethodParams } from './invoke-custom-method.js';
7
7
  /**
8
- * Color key which could be used tot update header color.
8
+ * Color key which could be used to update header color.
9
9
  */
10
10
  export type HeaderColorKey = 'bg_color' | 'secondary_bg_color';
11
+ /**
12
+ * Chat type which could be used when calling `web_app_switch_inline_query` method.
13
+ */
14
+ export type SwitchInlineQueryChatType = 'users' | 'bots' | 'groups' | 'channels';
11
15
  type CreateParams<P = never, SupportCheckKey extends UnionKeys<P> = never> = {
12
16
  params: P;
13
17
  supportCheckKey: SupportCheckKey;
14
18
  };
15
19
  /**
16
- * Describes list of events and their parameters that could be posted by
17
- * Bridge.
18
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods
20
+ * Describes list of events and their parameters that could be posted by Bridge.
21
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods
19
22
  */
20
23
  export interface MethodsParams {
21
24
  /**
22
- * Notifies parent iframe about current frame is ready.
23
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#iframe_ready
24
- * @since 6.0
25
+ * Notifies parent iframe about the current frame is ready. This method is only used in the Web
26
+ * version of Telegram. As a result, Mini App will receive `set_custom_style` event.
27
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#iframe-ready
25
28
  */
26
29
  iframe_ready: CreateParams;
27
30
  /**
28
- * Closes WebApp.
29
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_close
30
- * @since 6.0
31
+ * Closes Mini App.
32
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-close
31
33
  */
32
34
  web_app_close: CreateParams;
33
35
  /**
34
- * Closes QR scanner.
35
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_close_scan_qr_popup
36
- * @since 6.4
36
+ * Closes a QR scanner. The Telegram application creates `scan_qr_popup_closed` event.
37
+ * @since v6.4
38
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-close-scan-qr-popup
37
39
  */
38
40
  web_app_close_scan_qr_popup: CreateParams;
39
41
  /**
40
- * Sends data to bot.
41
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_data_send
42
- * @since 6.0
42
+ * Sends data to the bot. When this method is called, a service message is sent to the bot
43
+ * containing the data of the length up to 4096 bytes. Then, Mini App will be closed.
44
+ *
45
+ * To get more information, take a look at `web_app_data` field in the
46
+ * class [Message](https://core.telegram.org/bots/api#message).
47
+ *
48
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-data-send
43
49
  */
44
50
  web_app_data_send: CreateParams<{
51
+ /**
52
+ * Data to send to a bot. Should not have size of more than 4096 bytes.
53
+ */
45
54
  data: string;
46
55
  }>;
47
56
  /**
48
- * Expands Web App.
49
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_expand
50
- * @since 6.0
57
+ * Expands the Mini App.
58
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-expand
51
59
  */
52
60
  web_app_expand: CreateParams;
53
61
  /**
54
62
  * Invokes custom method.
55
- * @since 6.9
63
+ * @since v6.9
64
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-invoke-custom-method
56
65
  */
57
66
  web_app_invoke_custom_method: CreateParams<AnyInvokeCustomMethodParams>;
58
67
  /**
59
- * Opens new invoice.
60
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_open_invoice
61
- * @since 6.1
68
+ * Opens an invoice by its specified slug. More information about invoices in
69
+ * this [documentation](https://core.telegram.org/bots/payments).
70
+ * @since v6.1
71
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-open-invoice
62
72
  */
63
73
  web_app_open_invoice: CreateParams<{
74
+ /**
75
+ * Invoice unique identifier.
76
+ */
64
77
  slug: string;
65
78
  }>;
66
79
  /**
67
- * Opens link in default browser. Doesn't close application.
68
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_open_link
69
- * @since 6.0
80
+ * Opens link in the default browser. Mini App will not be closed.
81
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-open-link
70
82
  */
71
83
  web_app_open_link: CreateParams<{
84
+ /**
85
+ * URL to be opened by Telegram application. Should be a full path with `https` protocol.
86
+ */
72
87
  url: string;
73
88
  /**
74
89
  * Link will be opened in Instant View mode if possible.
90
+ * @since v6.4
75
91
  * @see https://instantview.telegram.org/
76
- * @since 6.4
77
92
  */
78
93
  try_instant_view?: boolean;
79
94
  }, 'try_instant_view'>;
80
95
  /**
81
- * Opens new popup.
82
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_open_popup
83
- * @since 6.2
96
+ * Opens a new popup. When user closes the popup, Telegram creates the `popup_closed` event.
97
+ * @since v6.2
98
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-open-popup
84
99
  */
85
100
  web_app_open_popup: CreateParams<PopupParams>;
86
101
  /**
87
- * Opens QR scanner.
88
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_open_scan_qr_popup
89
- * @since 6.4
102
+ * Opens a QR scanner. When the scanner was closed, the Telegram application creates
103
+ * the `scan_qr_popup_closed` event. When the scanner reads QR, Telegram creates the
104
+ * `qr_text_received` event.
105
+ * @since v6.4
106
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-open-scan-qr-popup
90
107
  */
91
108
  web_app_open_scan_qr_popup: CreateParams<{
109
+ /**
110
+ * Text to be displayed in the QR scanner.
111
+ */
92
112
  text?: string;
93
113
  }>;
94
114
  /**
95
- * Opens link which has format like "https://t.me/*".
96
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_open_tg_link
97
- * @since 6.1
115
+ * Opens the Telegram link by its pathname and query parameters. The link will be opened in the
116
+ * Telegram app, Mini App will be closed.
117
+ * @since v6.1
118
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-open-tg-link
98
119
  */
99
120
  web_app_open_tg_link: CreateParams<{
121
+ /**
122
+ * Should be a value taken from the link of this format: `https://t.me/{path_full}`. Can
123
+ * additionally contain query parameters.
124
+ */
100
125
  path_full: string;
101
126
  }>;
102
127
  /**
103
- * Reads text from clipboard.
104
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_read_text_from_clipboard
105
- * @since 6.4
128
+ * Reads text from the clipboard. The method accepts a request identifier which is used to
129
+ * appropriately retrieve the method execution result from the `clipboard_text_received` event.
130
+ * @since v6.4
131
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-read-text-from-clipboard
106
132
  */
107
133
  web_app_read_text_from_clipboard: CreateParams<{
134
+ /**
135
+ * Unique request identifier. Should be any unique string to handle the generated event
136
+ * appropriately.
137
+ */
108
138
  req_id: RequestId;
109
139
  }>;
110
140
  /**
111
- * Notifies Telegram about current application is ready to be shown.
112
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_ready
113
- * @since 6.0
141
+ * Notifies Telegram about current application is ready to be shown. This method will make
142
+ * Telegram to remove application loader and display Mini App.
143
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-ready
114
144
  */
115
145
  web_app_ready: CreateParams;
116
146
  /**
117
147
  * Requests access to current user's phone.
118
- * @since 6.9
148
+ * @since v6.9
149
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-request-phone
119
150
  */
120
151
  web_app_request_phone: CreateParams;
121
152
  /**
122
- * Requests current theme from Telegram.
123
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_request_theme
124
- * @since 6.0
153
+ * Requests current theme from Telegram. As a result, Telegram will create `theme_changed` event.
154
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-request-theme
125
155
  */
126
156
  web_app_request_theme: CreateParams;
127
157
  /**
128
- * Requests current viewport information from Telegram.
129
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_request_viewport
130
- * @since 6.0
158
+ * Requests current viewport information from Telegram. As a result, Telegram will create
159
+ * `viewport_changed` event.
160
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-request-viewport
131
161
  */
132
162
  web_app_request_viewport: CreateParams;
133
163
  /**
134
164
  * Requests write message access to current user.
135
- * @since 6.9
165
+ * @since v6.9
166
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-rqeuest-write-access
136
167
  */
137
168
  web_app_request_write_access: CreateParams;
138
169
  /**
139
- * Updates current background color.
140
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_set_background_color
141
- * @since 6.1
170
+ * Updates the Mini App background color.
171
+ * @since v6.1
172
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-set-background-color
142
173
  */
143
174
  web_app_set_background_color: CreateParams<{
144
- color: string;
175
+ /**
176
+ * The Mini App background color in `#RRGGBB` format.
177
+ */
178
+ color: RGB;
145
179
  }>;
146
180
  /**
147
- * Updates current header color.
148
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_set_header_color
149
- * @since 6.1
181
+ * Updates the Mini App header color.
182
+ * @since v6.1
183
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-set-header-color
150
184
  */
151
185
  web_app_set_header_color: CreateParams<{
186
+ /**
187
+ * The Mini App header color key.
188
+ */
152
189
  color_key: HeaderColorKey;
153
190
  } | {
154
191
  /**
155
- * @since 6.9
192
+ * Color in RGB format.
193
+ * @since v6.9
156
194
  */
157
195
  color: RGB;
158
196
  }, 'color'>;
159
197
  /**
160
- * Updates current information about back button.
161
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_setup_back_button
162
- * @since 6.1
198
+ * Updates the Back Button settings.
199
+ * @since v6.1
200
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-setup-back-button
163
201
  */
164
202
  web_app_setup_back_button: CreateParams<{
203
+ /**
204
+ * Should the Back Button be visible.
205
+ */
165
206
  is_visible: boolean;
166
207
  }>;
167
208
  /**
168
- * Changes current closing confirmation requirement status.
169
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_setup_closing_behavior
170
- * @since 6.0
209
+ * Updates current closing behavior.
210
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-setup-closing-behavior
171
211
  */
172
212
  web_app_setup_closing_behavior: CreateParams<{
213
+ /**
214
+ * Will user be prompted in case, an application is going to be closed.
215
+ */
173
216
  need_confirmation: boolean;
174
217
  }>;
175
218
  /**
176
- * Updates current information about main button.
177
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_setup_main_button
178
- * @since 6.0
219
+ * Updates the Main Button settings.
220
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-setup-main-button
179
221
  */
180
222
  web_app_setup_main_button: CreateParams<{
223
+ /**
224
+ * Should the Main Button be displayed.
225
+ */
181
226
  is_visible?: boolean;
227
+ /**
228
+ * Should the Main Button be enabled.
229
+ */
182
230
  is_active?: boolean;
231
+ /**
232
+ * Should loader inside the Main Button be displayed. Use this property in case, some
233
+ * operation takes time. This loader will make user notified about it.
234
+ */
183
235
  is_progress_visible?: boolean;
236
+ /**
237
+ * Text inside the Main Button.
238
+ */
184
239
  text?: string;
240
+ /**
241
+ * The Main Button background color in `#RRGGBB` format.
242
+ */
185
243
  color?: string;
244
+ /**
245
+ * The Main Button text color in `#RRGGBB` format.
246
+ */
186
247
  text_color?: string;
187
248
  }>;
188
249
  /**
189
- * Updates current information about Settings Button.
190
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_setup_settings_button
191
- * @since 6.10
250
+ * Updates current state of Settings Button.
251
+ * @since v6.10
252
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-setup-settings-button
192
253
  */
193
254
  web_app_setup_settings_button: CreateParams<{
255
+ /**
256
+ * Should the Settings Button be displayed.
257
+ */
194
258
  is_visible: boolean;
195
259
  }>;
260
+ /**
261
+ * Inserts the bot's username and the specified inline query in the current chat's input field.
262
+ * Query may be empty, in which case only the bot's username will be inserted. The client prompts
263
+ * the user to choose a specific chat, then opens that chat and inserts the bot's username and
264
+ * the specified inline query in the input field.
265
+ * @since v6.7
266
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-switch-inline-query
267
+ */
268
+ web_app_switch_inline_query: CreateParams<{
269
+ /**
270
+ * Text which should be inserted in the input after the current bot name. Max length is
271
+ * 256 symbols.
272
+ */
273
+ query: string;
274
+ /**
275
+ * List of chat types which could be chosen to send the message. Could be empty list.
276
+ */
277
+ chat_types: SwitchInlineQueryChatType[];
278
+ }>;
196
279
  /**
197
280
  * Generates haptic feedback event.
198
- * @see https://docs.telegram-mini-apps.com/docs/apps-communication/methods#web_app_trigger_haptic_feedback
199
- * @since 6.1
281
+ * @since v6.1
282
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#web-app-trigger-haptic-feedback
200
283
  */
201
284
  web_app_trigger_haptic_feedback: CreateParams<AnyHapticFeedbackParams>;
202
285
  }
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * Describes the native popup.
3
- * @see https://core.telegram.org/bots/webapps#popupparams
4
3
  */
5
4
  export interface PopupParams {
6
5
  /**
@@ -18,7 +17,7 @@ export interface PopupParams {
18
17
  }
19
18
  /**
20
19
  * Describes the native popup button.
21
- * @see https://core.telegram.org/bots/webapps#popupbutton
20
+ * @see https://docs.telegram-mini-apps.com/apps-communication/methods#popupbutton
22
21
  */
23
22
  export type PopupButton = {
24
23
  /**
@@ -10,7 +10,7 @@ interface PostEventOptions {
10
10
  }
11
11
  export type PostEvent = typeof postEvent;
12
12
  /**
13
- * Sends event to native application which launched Web App. This function
13
+ * Sends event to native application which launched Mini App. This function
14
14
  * accepts only events, which require arguments.
15
15
  * @param eventType - event name.
16
16
  * @param params - event parameters.
@@ -20,7 +20,7 @@ export type PostEvent = typeof postEvent;
20
20
  */
21
21
  export declare function postEvent<E extends NonEmptyMethodName>(eventType: E, params: MethodParams<E>, options?: PostEventOptions): void;
22
22
  /**
23
- * Sends event to native application which launched Web App. This function
23
+ * Sends event to native application which launched Mini App. This function
24
24
  * accepts only events, which require arguments.
25
25
  * @param eventType - event name.
26
26
  * @param options - posting options.