diff --git a/data/web/corefork.telegram.org/api/bots/webapps.html b/data/web/corefork.telegram.org/api/bots/webapps.html index e602a0c061..704015e673 100644 --- a/data/web/corefork.telegram.org/api/bots/webapps.html +++ b/data/web/corefork.telegram.org/api/bots/webapps.html @@ -89,12 +89,39 @@ Note that eventual errors will not be sent as a failed event if the

theme_changed

Params: a JSON object with the following fields:

Emitted when requested by the Mini App using a web_app_request_theme event », or when the app theme changes.

popup_closed

Params: a JSON object with an optional button_id string field.

Emitted when the user presses a button or cancels a popup brought up by a previous web_app_open_popup event ».

+

write_access_requested

+

Params: a JSON object with the following fields:

+ +

Used by clients to reply to a web_app_request_write_access event », indicating whether the user has allowed the bot to send messages to the user (allowed) or not (cancelled).

+

phone_requested

+

Params: a JSON object with the following fields:

+ +

Used by clients to reply to a web_app_request_phone event », indicating whether the user has shared their phone number with the bot (allowed) or not (cancelled).

+

custom_method_invoked

+

Params: a JSON object with the following fields:

+ +

Used by clients to reply to web_app_invoke_custom_method events ».

+

clipboard_text_received

+

Params: a JSON object with the following fields:

+ +

Used by clients to reply to web_app_read_text_from_clipboard events ».

Keyboard Button Mini Apps

Schema:

replyKeyboardMarkup#85dd99d1 flags:# resize:flags.0?true single_use:flags.1?true selective:flags.2?true persistent:flags.4?true rows:Vector<KeyboardButtonRow> placeholder:flags.3?string = ReplyMarkup;
@@ -253,7 +280,6 @@ Confirmation should always be asked, even if the inactive
 
 
 

Finally, open the webview using the url contained in the returned appWebViewResultUrl.

-

The bot can write to the user directly if it already has a chat with the user or if it requested permission via request_write_access and the user granted it with write_allowed.

Theme parameters

Bot Mini Apps can be themed according to the following theme parameters, passed as a JSON object to the theme_params parameter of the messages.requestSimpleWebView and messages.requestWebView methods.

This JSON object has the following keys, containing color theme information (hex string, RGB, no alpha) to pass to the Mini App:

diff --git a/data/web/corefork.telegram.org/api/web-events.html b/data/web/corefork.telegram.org/api/web-events.html index c5cbce7756..7bc6113a9c 100644 --- a/data/web/corefork.telegram.org/api/web-events.html +++ b/data/web/corefork.telegram.org/api/web-events.html @@ -76,7 +76,7 @@ The GamingCommunication and bot mini apps libraries by default will use '* -

Emitted by bot mini apps when to open a native pop-up over the webview.

+

Emitted by bot mini apps to open a native pop-up over the webview.

By default, buttons should be displayed on one row.
If the mini app provides two buttons that can't fit horizontally on one row, display each button on a separate row.
If the mini app provides three buttons, always display each button on a separate row.

@@ -86,6 +86,50 @@ If the mini app provides three buttons, always display each button on a separate

Disable handling of this event if a popup is already being displayed, re-enable handling only after the popup_closed response event is emitted.
While handling is enabled, maximum 3 consecutive valid events of this type can be handled in a timespan of 3 seconds, ignore excess events.

+

web_app_request_write_access

+

Event data: null

+

Emitted by bot mini apps to ask permission from the user to send them messages.

+

Upon receiving this event, clients should first invoke bots.canSendMessage, to check whether they have already granted the bot permission to write them in some way.

+ +

web_app_request_phone

+

Event data: null

+

Emitted by bot mini apps to ask the user to share their phone number as a contact.

+

Upon receiving this event, clients should show a prompt to the user, indicating that the bot is asking them to share their phone number (optionally also asking the user to unblock the bot, if it's currently blocked).

+

If they accept, the user's phone number should be shared by sending a contact to the bot (unblocking it first, if it's currently blocked by the user); if all RPC queries (to unblock the bot, to send the message) succeed, a phone_requested event » should be sent with {"status": "sent"}.

+

If the user refuses or any intermdiate method call fails, a phone_requested event » should be sent with {"status": "cancelled"}.

+

web_app_invoke_custom_method

+

Event data: a JSON object with the following fields:

+
    +
  • req_id - A string with the ID of the current request
  • +
  • method - A string, containing the name of the called custom method
  • +
  • params - An object containing the parameters of the method call
  • +
+

Emitted by bot mini apps to make custom method calls to Telegram's servers on behalf of the user.

+

This event should trigger a bots.invokeWebViewCustomMethod request, passing the method to custom_method, and the params to params.

+

Upon receiving a reply, a custom_method_invoked event » should be emitted, with the following fields:

+
    +
  • req_id - The req_id from the web_app_invoke_custom_method object
  • +
  • result - The JSON data contained in the response of the bots.invokeWebViewCustomMethod method, if the method call succeeded
  • +
  • error - The text of the RPC error, if the method call failed
  • +
+

web_app_read_text_from_clipboard

+

Event data: a JSON object with the following fields:

+
    +
  • req_id - A string with the ID of the current request
  • +
+

Emitted by bot mini apps to obtain the contents of the system clipboard.

+

Only for Mini Apps owned by bots added to the attachment menu, regardles of how the Mini App itself was launched, this event should trigger a clipboard_text_received event » with the following payload:

+
    +
  • req_id - The req_id from the web_app_read_text_from_clipboard request
  • +
  • data - A string with the clipboard contents
  • +
+

Note that user interactions must have a TTL of 10 seconds: events of this type must be ignored and a clipboard_text_received event » with the correct req_id and no data field must be sent if the last Mini App user interaction happened more than 10 seconds ago.

+

A clipboard_text_received event » with the correct req_id and no data field must also be sent if the bot is not installed in the attachment menu.

web_app_setup_closing_behavior

Event data: a JSON object with a boolean need_confirmation.

If equal to true, the client should require user confirmation with a "Changes that you made may not be saved." popup with "Cancel"/"Close anyway" buttons before closing the webview, to avoid accidentally aborting a sensitive operation; otherwise no confirmation should be requested.

@@ -93,11 +137,16 @@ While handling is enabled, maximum 3 consecutive valid events of this type can b

Event data: a JSON object with a string color with a hex RGB color.

Used to set the mini app background and lower overscroll color.

web_app_set_header_color

-

Event data: a JSON object with a string color_key, with of the following values:

+

Event data: a JSON object with the following fields:

    +
  • color_key - A string with one of the following values: +
  • +
  • color - A color in hex RGB format (#ffffff).
  • +
+

The two fields are mutually exclusive, if none of the two fields are provided the default header color is used.

Used to set the mini app header and upper overscroll color.

web_app_data_send

Event data: a JSON object with a string data field.

diff --git a/data/web/fragment.com/css/auction.css b/data/web/fragment.com/css/auction.css index 7b1f8dc44d..3b64657955 100644 --- a/data/web/fragment.com/css/auction.css +++ b/data/web/fragment.com/css/auction.css @@ -2463,7 +2463,7 @@ a.tm-table-action-link:hover { line-height: 42px; font-weight: bold; padding: 12px 20px; - background-color: var(--table-header-bg-color); + background-color: var(--field-bg-color); border-radius: var(--def-border-radius); color: var(--field-color); text-align: center; @@ -2548,6 +2548,70 @@ a.tm-table-action-link:hover { filter: blur(7px); } +.tm-field-hint { + margin: 8px 14px; +} + +.tm-number-form-group { + margin: 36px 0 0; +} +.tm-checkbox-toggle { + position: relative; + font-weight: normal; + font-size: 14px; + line-height: 20px; + padding: 11px 14px; + cursor: pointer; + -webkit-user-select: none; + user-select: none; +} +.tm-checkbox-toggle .checkbox { + position: absolute; + top: 0; + bottom: 0; + right: 0; + margin: auto 24px; +} +.tm-checkbox-toggle .checkbox ~ .tm-checkbox-label:before, +.tm-checkbox-toggle .checkbox ~ .tm-checkbox-label:after { + position: absolute; + right: 0; + top: 0; + content: ''; +} +.tm-checkbox-toggle .checkbox ~ .tm-checkbox-label:before { + margin: 11px 13px; + width: 36px; + height: 20px; + border-radius: 10px; + background-color: #64717f; + transition: var(--def-transition) background-color; +} +.tm-checkbox-toggle .checkbox:checked ~ .tm-checkbox-label:before { + background-color: #149efa; +} +.tm-checkbox-toggle .checkbox ~ .tm-checkbox-label:after { + width: 16px; + height: 16px; + margin: 13px; + border-radius: 8px; + background-color: #fff; + right: 18px; + transform: translateX(0); + transition: var(--def-transition) transform; +} +.tm-checkbox-toggle .checkbox:checked ~ .tm-checkbox-label:after { + background-color: #fff; + transform: translateX(16px); +} +.cant-receive, +.codes-disabled .can-receive { + display: none; +} +.codes-disabled .cant-receive { + display: block; +} +