New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@telegram-apps/bridge

Package Overview
Dependencies
Maintainers
0
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@telegram-apps/bridge - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

16

dist/dts/events/types/events.d.ts
import { RGB } from '@telegram-apps/types';
import { PhoneRequestedStatus, InvoiceStatus, WriteAccessRequestedStatus, BiometryAuthRequestStatus, BiometryType, BiometryTokenUpdateStatus, FullScreenErrorStatus } from './misc.js';
import { PhoneRequestedStatus, InvoiceStatus, WriteAccessRequestedStatus, BiometryAuthRequestStatus, BiometryType, BiometryTokenUpdateStatus, SafeAreaInsets, FullScreenErrorStatus } from './misc.js';
/**

@@ -115,2 +115,9 @@ * Map where key is known event name, and value is its listener.

/**
* Occurs when the safe area for content changes
* (e.g., due to orientation change or screen adjustments).
* @since Mini Apps v8.0
* @see https://docs.telegram-mini-apps.com/platform/events#content_safe_area_changed
* */
content_safe_area_changed: SafeAreaInsets;
/**
* Custom method invocation completed.

@@ -215,2 +222,9 @@ * @since v6.9

/**
* Occurs whenever the device's safe area insets change
* (e.g., due to orientation change or screen adjustments).
* @since Mini Apps v8.0
* @see https://docs.telegram-mini-apps.com/platform/events#safe_area_changed
* */
safe_area_changed: SafeAreaInsets;
/**
* QR scanner was closed.

@@ -217,0 +231,0 @@ * @since v6.4

@@ -8,1 +8,7 @@ export type InvoiceStatus = 'paid' | 'failed' | 'pending' | 'cancelled' | string;

export type FullScreenErrorStatus = 'ALREADY_FULLSCREEN' | 'UNSUPPORTED' | string;
export interface SafeAreaInsets {
top: number;
bottom: number;
left: number;
right: number;
}

@@ -6,1 +6,2 @@ export type * from './custom-method.js';

export type * from './popup.js';
export type { CreateMethodParams } from './utils.js';

96

dist/dts/methods/types/methods.d.ts
import { If, IsNever } from '@telegram-apps/toolkit';
import { RGB } from '@telegram-apps/types';
import { CreateParams } from './utils.js';
import { CreateMethodParams } from './utils.js';
import { AnyHapticFeedbackParams } from './haptic-feedback.js';

@@ -50,3 +50,3 @@ import { PopupParams } from './popup.js';

*/
iframe_ready: CreateParams<{
iframe_ready: CreateMethodParams<{
/**

@@ -61,3 +61,3 @@ * True, if the current Mini App supports native reloading.

*/
iframe_will_reload: CreateParams;
iframe_will_reload: CreateMethodParams;
/**

@@ -72,3 +72,3 @@ * Emitted by bot mini apps to ask the client to initialize the biometric authentication manager

*/
web_app_biometry_get_info: CreateParams;
web_app_biometry_get_info: CreateMethodParams;
/**

@@ -83,3 +83,3 @@ * Opens the biometric access settings for bots. Useful when you need to request biometrics

*/
web_app_biometry_open_settings: CreateParams;
web_app_biometry_open_settings: CreateMethodParams;
/**

@@ -96,3 +96,3 @@ * Emitted by bot mini apps to ask the user permission to use biometric authentication,

*/
web_app_biometry_request_access: CreateParams<{
web_app_biometry_request_access: CreateMethodParams<{
/**

@@ -117,3 +117,3 @@ * Reason to request biometry access. Should be at least 1 symbol length, but not

*/
web_app_biometry_request_auth: CreateParams<{
web_app_biometry_request_auth: CreateMethodParams<{
/**

@@ -137,3 +137,3 @@ * Reason to request biometry data. Should be at least 1 symbol length, but not more than

*/
web_app_biometry_update_token: CreateParams<{
web_app_biometry_update_token: CreateMethodParams<{
/**

@@ -152,3 +152,3 @@ * Optional string field, containing the reason why the bot is asking to authenticate using biometrics (1-128 chars, used in the prompt).

*/
web_app_close: CreateParams<{
web_app_close: CreateMethodParams<{
/**

@@ -165,3 +165,3 @@ * Should the client return to the previous activity.

*/
web_app_close_scan_qr_popup: CreateParams;
web_app_close_scan_qr_popup: CreateMethodParams;
/**

@@ -176,3 +176,3 @@ * Sends data to the bot. When this method is called, a service message is sent to the bot

*/
web_app_data_send: CreateParams<{
web_app_data_send: CreateMethodParams<{
/**

@@ -184,6 +184,12 @@ * Data to send to a bot. Should not have size of more than 4096 bytes.

/**
* Exits fullscreen mode for miniapp.
* @since v8.0
* @see https://docs.telegram-mini-apps.com/platform/methods#web-app-exit-fullscreen
*/
web_app_exit_fullscreen: CreateMethodParams;
/**
* Expands the Mini App.
* @see https://docs.telegram-mini-apps.com/platform/methods#web-app-expand
*/
web_app_expand: CreateParams;
web_app_expand: CreateMethodParams;
/**

@@ -194,3 +200,3 @@ * Invokes custom method.

*/
web_app_invoke_custom_method: CreateParams<AnyInvokeCustomMethodParams>;
web_app_invoke_custom_method: CreateMethodParams<AnyInvokeCustomMethodParams>;
/**

@@ -202,3 +208,3 @@ * Opens an invoice by its specified slug. More information about invoices in

*/
web_app_open_invoice: CreateParams<{
web_app_open_invoice: CreateMethodParams<{
/**

@@ -213,3 +219,3 @@ * Invoice unique identifier.

*/
web_app_open_link: CreateParams<{
web_app_open_link: CreateMethodParams<{
/**

@@ -236,3 +242,3 @@ * URL to be opened by Telegram application. Should be a full path with `https` protocol.

*/
web_app_open_popup: CreateParams<PopupParams>;
web_app_open_popup: CreateMethodParams<PopupParams>;
/**

@@ -245,3 +251,3 @@ * Opens a QR scanner. When the scanner was closed, the Telegram application creates

*/
web_app_open_scan_qr_popup: CreateParams<{
web_app_open_scan_qr_popup: CreateMethodParams<{
/**

@@ -258,3 +264,3 @@ * Text to be displayed in the QR scanner.

*/
web_app_open_tg_link: CreateParams<{
web_app_open_tg_link: CreateMethodParams<{
/**

@@ -272,3 +278,3 @@ * Should be a value taken from the link of this format: `https://t.me/{path_full}`. Can

*/
web_app_read_text_from_clipboard: CreateParams<{
web_app_read_text_from_clipboard: CreateMethodParams<{
/**

@@ -285,15 +291,15 @@ * Unique request identifier. Should be any unique string to handle the generated event

*/
web_app_ready: CreateParams;
web_app_ready: CreateMethodParams;
/**
* Requests to open the mini app in fullscreen.
* Requests content safe area of the user's phone.
* @since v8.0
* @see https://docs.telegram-mini-apps.com/platform/methods#web-app-request-fullscreen
* @see https://docs.telegram-mini-apps.com/platform/methods#web-app-request-content-safe-area
*/
web_app_request_fullscreen: CreateParams;
web_app_request_content_safe_area: CreateMethodParams;
/**
* Exits fullscreen mode for miniapp.
* Requests to open the mini app in fullscreen.
* @since v8.0
* @see https://docs.telegram-mini-apps.com/platform/methods#web-app-exit-fullscreen
* @see https://docs.telegram-mini-apps.com/platform/methods#web-app-request-fullscreen
*/
web_app_exit_fullscreen: CreateParams;
web_app_request_fullscreen: CreateMethodParams;
/**

@@ -304,8 +310,14 @@ * Requests access to current user's phone.

*/
web_app_request_phone: CreateParams;
web_app_request_phone: CreateMethodParams;
/**
* Requests safe area of the user's phone.
* @since v8.0
* @see https://docs.telegram-mini-apps.com/platform/methods#web-app-request-safe-area
*/
web_app_request_safe_area: CreateMethodParams;
/**
* Requests current theme from Telegram. As a result, Telegram will create `theme_changed` event.
* @see https://docs.telegram-mini-apps.com/platform/methods#web-app-request-theme
*/
web_app_request_theme: CreateParams;
web_app_request_theme: CreateMethodParams;
/**

@@ -316,3 +328,3 @@ * Requests current viewport information from Telegram. As a result, Telegram will create

*/
web_app_request_viewport: CreateParams;
web_app_request_viewport: CreateMethodParams;
/**

@@ -323,3 +335,3 @@ * Requests write message access to the current user.

*/
web_app_request_write_access: CreateParams;
web_app_request_write_access: CreateMethodParams;
/**

@@ -330,3 +342,3 @@ * Updates the Mini App background color.

*/
web_app_set_background_color: CreateParams<{
web_app_set_background_color: CreateMethodParams<{
/**

@@ -342,3 +354,3 @@ * Color to set.

*/
web_app_set_bottom_bar_color: CreateParams<{
web_app_set_bottom_bar_color: CreateMethodParams<{
/**

@@ -354,3 +366,3 @@ * Color to set.

*/
web_app_set_header_color: CreateParams<{
web_app_set_header_color: CreateMethodParams<{
/**

@@ -372,3 +384,3 @@ * The Mini App header color key.

*/
web_app_setup_back_button: CreateParams<{
web_app_setup_back_button: CreateMethodParams<{
/**

@@ -383,3 +395,3 @@ * Should the Back Button be visible.

*/
web_app_setup_closing_behavior: CreateParams<{
web_app_setup_closing_behavior: CreateMethodParams<{
/**

@@ -394,3 +406,3 @@ * Will user be prompted in case, an application is going to be closed.

*/
web_app_setup_main_button: CreateParams<ButtonParams, 'has_shine_effect'>;
web_app_setup_main_button: CreateMethodParams<ButtonParams, 'has_shine_effect'>;
/**

@@ -401,3 +413,3 @@ * Updates the secondary button settings.

*/
web_app_setup_secondary_button: CreateParams<ButtonParams & {
web_app_setup_secondary_button: CreateMethodParams<ButtonParams & {
/**

@@ -420,3 +432,3 @@ * Position of the secondary button. It applies only if both the main and secondary buttons

*/
web_app_setup_settings_button: CreateParams<{
web_app_setup_settings_button: CreateMethodParams<{
/**

@@ -432,3 +444,3 @@ * Should the Settings Button be displayed.

*/
web_app_setup_swipe_behavior: CreateParams<{
web_app_setup_swipe_behavior: CreateMethodParams<{
allow_vertical_swipe: boolean;

@@ -440,3 +452,3 @@ }>;

*/
web_app_share_to_story: CreateParams<{
web_app_share_to_story: CreateMethodParams<{
/**

@@ -476,3 +488,3 @@ * A media URL which will be used as a background for a created story.

*/
web_app_switch_inline_query: CreateParams<{
web_app_switch_inline_query: CreateMethodParams<{
/**

@@ -493,3 +505,3 @@ * Text which should be inserted in the input after the current bot name. Max length is

*/
web_app_trigger_haptic_feedback: CreateParams<AnyHapticFeedbackParams>;
web_app_trigger_haptic_feedback: CreateMethodParams<AnyHapticFeedbackParams>;
}

@@ -496,0 +508,0 @@ /**

type UnionKeys<T> = T extends T ? keyof T : never;
export interface CreateParams<Params = never, VersionedParam extends UnionKeys<Params> = never> {
/**
* Creates Mini Apps method parameters types.
*/
export interface CreateMethodParams<Params = never, VersionedParam extends UnionKeys<Params> = never> {
params: Params;

@@ -4,0 +7,0 @@ versionedParams: VersionedParam;

@@ -1,5 +0,5 @@

this.tapps=this.tapps||{};this.tapps.bridge=function(s){"use strict";class h extends Error{constructor(t,n,r){super(typeof n=="object"?n.message:n||t,{cause:typeof n=="object"?n.cause:r}),this.type=t,Object.setPrototypeOf(this,h.prototype)}}function Q(e){return e.replace(/[A-Z]/g,t=>`_${t.toLowerCase()}`)}function Ne(e){return e.replace(/_[a-z]/g,t=>t[1].toUpperCase())}const De="ERR_INVALID_VALUE",Ce="ERR_UNEXPECTED_VALUE",Ue="ERR_UNEXPECTED_TYPE",x="ERR_PARSE";function ee(e,t){const n={};for(const r in e){const o=e[r];if(!o)continue;let a,i;typeof o=="function"?(a=r,i=o):[a,i]=o;try{const c=i(t(a));c!==void 0&&(n[r]=c)}catch(c){throw new h(x,`Parser for "${r}" property failed${a===r?"":`. Source field: "${a}"`}`,c)}}return n}function te(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch(n){throw new h(De,{cause:n})}if(typeof t!="object"||!t||Array.isArray(t))throw new h(Ce);return t}function g(e,t){return n=>{const r=o=>{if(!(n&&o===void 0))try{return t(o)}catch(a){throw new h(x,{message:`"${e}" transformer failed to parse the value`,cause:a})}};return Object.assign(r,{isValid(o){try{return r(o),!0}catch{return!1}}})}}function m(e,t){return g(t||"object",n=>{const r=te(n);return ee(e,o=>r[o])})}function R(e){throw new h(Ue,`Unexpected value received: ${JSON.stringify(e)}`)}const A=g("boolean",e=>{if(typeof e=="boolean")return e;const t=String(e);if(t==="1"||t==="true")return!0;if(t==="0"||t==="false")return!1;R(e)}),_=g("string",e=>{if(typeof e=="string"||typeof e=="number")return e.toString();R(e)}),P=g("number",e=>{if(typeof e=="number")return e;if(typeof e=="string"){const t=Number(e);if(!Number.isNaN(t))return t}R(e)}),Oe=g("date",e=>e instanceof Date?e:new Date(P()(e)*1e3));function ne(e,t){return g(t||"searchParams",n=>{typeof n!="string"&&!(n instanceof URLSearchParams)&&R(n);const r=typeof n=="string"?new URLSearchParams(n):n;return ee(e,o=>{const a=r.get(o);return a===null?void 0:a})})}function j(e){for(const t in e)e[t]=[Q(t),e[t]];return e}const We=e=>{const t=P(),n=P(!0),r=_(),o=_(!0),a=A(!0),i=m(j({addedToAttachmentMenu:a,allowsWriteToPm:a,firstName:r,id:t,isBot:a,isPremium:a,languageCode:o,lastName:o,photoUrl:o,username:o}),"User")(!0);return ne(j({authDate:Oe(),canSendAfter:n,chat:m(j({id:t,type:r,title:r,photoUrl:o,username:o}),"Chat")(!0),chatInstance:o,chatType:o,hash:r,queryId:o,receiver:i,startParam:o,user:i}),"initData")(e)};function je(e){return/^#[\da-f]{6}$/i.test(e)}function ke(e){return/^#[\da-f]{3}$/i.test(e)}function Me(e){const t=e.replace(/\s/g,"").toLowerCase();if(je(t))return t;if(ke(t)){let r="#";for(let o=0;o<3;o+=1)r+=t[1+o].repeat(2);return r}const n=t.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||t.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);if(!n)throw new Error(`Value "${e}" does not satisfy any of known RGB formats.`);return n.slice(1).reduce((r,o)=>{const a=parseInt(o,10).toString(16);return r+(a.length===1?"0":"")+a},"#")}const Le=g("rgb",e=>Me(_()(e))),re=g("themeParams",e=>{const t=Le(!0);return Object.entries(te(e)).reduce((n,[r,o])=>(n[Ne(r)]=t(o),n),{})});function k(e){return JSON.stringify(Object.fromEntries(Object.entries(e).map(([t,n])=>[Q(t),n])))}const Ie=e=>{const t=_(),n=_(!0),r=A(!0);return ne({botInline:["tgWebAppBotInline",r],defaultColors:["tgWebAppDefaultColors",re(!0)],fullscreen:["tgWebAppFullscreen",r],initData:["tgWebAppData",We(!0)],initDataRaw:["tgWebAppData",n],platform:["tgWebAppPlatform",t],showSettings:["tgWebAppShowSettings",r],startParam:["tgWebAppStartParam",n],themeParams:["tgWebAppThemeParams",re()],version:["tgWebAppVersion",t]},"launchParams")(e)};function qe(e){const{initDataRaw:t,startParam:n,showSettings:r,botInline:o,fullscreen:a,defaultColors:i}=e,c=new URLSearchParams;return c.set("tgWebAppPlatform",e.platform),c.set("tgWebAppThemeParams",k(e.themeParams)),c.set("tgWebAppVersion",e.version),t&&c.set("tgWebAppData",t),n&&c.set("tgWebAppStartParam",n),typeof r=="boolean"&&c.set("tgWebAppShowSettings",r?"1":"0"),typeof o=="boolean"&&c.set("tgWebAppBotInline",o?"1":"0"),typeof a=="boolean"&&c.set("tgWebAppFullscreen",a?"1":"0"),i&&c.set("tgWebAppDefaultColors",k(i)),c.toString()}const oe=m({eventType:_(),eventData:e=>e},"miniAppsMessage"),ae=g("fn",e=>{if(typeof e=="function")return e;R(e)});function Fe(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}const He=m({TelegramWebviewProxy:m({postEvent:ae()})()});function M(e){return He().isValid(e)}function se(){try{return window.self!==window.top}catch{return!0}}var Je=Object.defineProperty,Be=(e,t,n)=>t in e?Je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ie=(e,t,n)=>Be(e,typeof t!="symbol"?t+"":t,n);class b extends Error{constructor(t,n,r){super(typeof n=="object"?n.message:n||t,{cause:typeof n=="object"?n.cause:r}),this.type=t,Object.setPrototypeOf(this,b.prototype)}}function L(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function $(...e){const t=e.flat(1);return[t.push.bind(t),()=>{t.forEach(n=>{n()})}]}function Ge(e,t){return e instanceof b&&e.type===t}function N(e){return t=>Ge(t,e)}const I="ERR_ABORTED",q="ERR_CANCELED",F="ERR_TIMED_OUT";function H(e){return new b(I,{cause:e})}const Ve=N(F),Ke=N(I),Ze=N(q);function ce(e,t){return e.reject=t.reject,e}class d extends Promise{constructor(t,n){let r,o;typeof t=="function"?(r=t,o=n):o=t;let a,i;super((c,u)=>{o||(o={});const{abortSignal:f}=o;if(f&&f.aborted)return u(H(f.reason));const[p,w]=$(),E=v=>(...vt)=>(w(),v(...vt)),O=new AbortController,{signal:W}=O;i=E(v=>{O.abort(v),u(v)}),a=E(c),f&&p(L(f,"abort",()=>{i(H(f.reason))}));const{timeout:Y}=o;if(Y){const v=setTimeout(()=>{i(new b(F,`Timeout reached: ${Y}ms`))},Y);p(()=>{clearTimeout(v)})}r&&r(a,i,W)}),ie(this,"reject"),this.reject=i}static withFn(t,n){return new d((r,o,a)=>{try{const i=t(a);return i instanceof Promise?i.then(r,o):r(i)}catch(i){o(i)}},n)}static resolve(t){return new d(n=>{n(t)})}static reject(t){return new d((n,r)=>{r(t)})}cancel(){this.reject(new b(q))}catch(t){return this.then(void 0,t)}finally(t){return ce(super.finally(t),this)}then(t,n){return ce(super.then(t,n),this)}}function ue(e,t){return e.resolve=t.resolve,e}class T extends d{constructor(t,n){let r,o;typeof t=="function"?(r=t,o=n):o=t;let a;super((i,c,u)=>{a=i,r&&r(i,c,u)},o),ie(this,"resolve"),this.resolve=a}static withFn(t,n){return new T((r,o,a)=>d.withFn(t,{abortSignal:a}).then(r,o),n)}static resolve(t){return new T(n=>{n(t)})}static reject(t){return new T((n,r)=>{r(t)})}catch(t){return this.then(void 0,t)}finally(t){return ue(super.finally(t),this)}then(t,n){return ue(super.then(t,n),this)}}function ze(e,t){return new d(n=>{setTimeout(n,e)},{abortSignal:t})}function fe(e){return`tapps/${e}`}function le(e,t){sessionStorage.setItem(fe(e),JSON.stringify(t))}function pe(e){const t=sessionStorage.getItem(fe(e));try{return t?JSON.parse(t):void 0}catch{}}function Xe(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Ye(e){return e.replace(/[A-Z]/g,t=>`_${t.toLowerCase()}`)}function Qe(e){return e.replace(/_[a-z]/g,t=>t[1].toUpperCase())}function _e(e,t){t||(t={});const{textColor:n,bgColor:r,shouldLog:o=!0}=t;function a(i,...c){if(!o||typeof o=="function"&&!o())return;const u="font-weight:bold;padding:0 5px;border-radius:5px";console[i](`%c${Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,timeZone:"UTC"}).format(new Date)}%c / %c${e}`,`${u};background-color: lightblue;color:black`,"",`${u};${n?`color:${n};`:""}${r?`background-color:${r}`:""}`,...c)}return[function(...i){a("log",...i)},function(...i){a("error",...i)}]}function xe(e,t){document.documentElement.style.setProperty(e,t)}function et(e){document.documentElement.style.removeProperty(e)}function tt(e,t){t()}function y(e,t){t||(t={});const n=t.equals||Object.is;let r=[],o=e;const a=f=>{if(!n(o,f)){const p=o;o=f,tt(u,()=>{[...r].forEach(([w,E])=>{w(f,p),E&&c(w,!0)})})}};function i(f){const p=typeof f!="object"?{once:f}:f;return{once:p.once||!1,signal:p.signal||!1}}const c=(f,p)=>{const w=i(p),E=r.findIndex(([O,W])=>O===f&&W.once===w.once&&W.signal===w.signal);E>=0&&r.splice(E,1)},u=Object.assign(function(){return nt(u),o},{destroy(){r=[]},set:a,reset(){a(e)},sub(f,p){return r.push([f,i(p)]),()=>c(f,p)},unsub:c,unsubAll(){r=r.filter(f=>f[1].signal)}});return u}const J=[];function nt(e){J.length&&J[J.length-1].add(e)}const B=y(!1),[G,rt]=_e("Bridge",{bgColor:"#9147ff",textColor:"white",shouldLog:B}),ot={clipboard_text_received:m({req_id:_(),data:e=>e===null?e:_(!0)(e)},"clipboard_text_received"),custom_method_invoked:m({req_id:_(),result:e=>e,error:_(!0)},"custom_method_invoked"),popup_closed:g("popup_closed",e=>e?m({button_id:t=>t==null?void 0:_()(t)})()(e):{}),viewport_changed:m({height:P(),width:e=>e==null?window.innerWidth:P()(e),is_state_stable:A(),is_expanded:A()},"viewport_changed")};function at(e){const t=window,[,n]=$(L(t,"message",r=>{if(r.source!==t.parent)return;let o;try{o=oe()(r.data)}catch{return}const{eventType:a,eventData:i}=o,c=ot[a];try{const u=c?c()(i):i;G("Event received:",u?{eventType:a,eventData:u}:{eventType:a}),e([a,u])}catch(u){rt([`An error occurred processing the "${a}" event from the Telegram application.`,"Please, file an issue here:","https://github.com/Telegram-Mini-Apps/telegram-apps/issues/new/choose"].join(`
`),o,u)}}));return n}const D=y(),C=y();function be(){return C()||C.set(at(D.set)),D}const S=y({});function ge(e){let t=S()[e];return t||(t=y(void 0,{equals(){return!1}}),be().sub(n=>{n&&n[0]===e&&t.set(n[1])}),S.set({...S(),[e]:t})),t}function me(e,t,n){return ge(e).sub(t,n)}const de="ERR_METHOD_UNSUPPORTED",he="ERR_RETRIEVE_LP_FAILED",we="ERR_METHOD_PARAMETER_UNSUPPORTED",Ee="ERR_UNKNOWN_ENV",ye="ERR_INVOKE_CUSTOM_METHOD_RESPONSE",V=y("https://web.telegram.org");function K(e,t){G("Posting event:",t?{eventType:e,eventData:t}:{eventType:e});const n=window;if(M(n)){n.TelegramWebviewProxy.postEvent(e,JSON.stringify(t));return}const r=JSON.stringify({eventType:e,eventData:t});if(se())return n.parent.postMessage(r,V());const{external:o}=n;if(m({notify:ae()})().isValid(o)){o.notify(r);return}throw new b(Ee)}function Z(e,t,n){n||(n={});const{capture:r}=n,[o,a]=$();return new d(i=>{(Array.isArray(t)?t:[t]).forEach(c=>{o(me(c,u=>{(!r||(Array.isArray(t)?r({event:c,payload:u}):r(u)))&&i(u)}))}),(n.postEvent||K)(e,n.params)},n).finally(a)}function z(e){return Ie()(e)}function ve(e){return z(e.replace(/^[^?#]*[?#]/,"").replace(/[?#]/g,"&"))}function st(){return ve(window.location.href)}function it(){const e=performance.getEntriesByType("navigation")[0];if(!e)throw new Error("Unable to get first navigation entry.");return ve(e.name)}const ct="launchParams";function ut(){return z(pe(ct)||"")}function Re(e){le("launchParams",qe(e))}function Pe(e){return e instanceof Error?e.message+(e.cause?`
${Pe(e.cause)}`:""):JSON.stringify(e)}function Te(){const e=[];for(const t of[st,it,ut])try{const n=t();return Re(n),n}catch(n){e.push(n)}throw new b(he,["Unable to retrieve launch parameters from any known source. Perhaps, you have opened your app outside Telegram?","📖 Refer to docs for more information:","https://docs.telegram-mini-apps.com/packages/telegram-apps-sdk/environment","Collected errors:",...e.map(t=>`— ${Pe(t)}`)].join(`
`))}function ft(e){if(e==="simple")try{return Te(),!0}catch{return!1}return d.withFn(async()=>{if(M(window))return!0;try{return await Z("web_app_request_theme","theme_changed",{timeout:100}),!0}catch{return!1}},e)}function U(e,t){window.dispatchEvent(new MessageEvent("message",{data:JSON.stringify({eventType:e,eventData:t}),source:window.parent}))}function lt(e,t){if(typeof t=="string")try{const{eventType:n}=oe()(t);n==="web_app_request_theme"&&U("theme_changed",{theme_params:JSON.parse(k(e))}),n==="web_app_request_viewport"&&U("viewport_changed",{width:window.innerWidth,height:window.innerHeight,is_state_stable:!0,is_expanded:!0})}catch{}}function pt(e){var r;const t=typeof e=="string"?z(e):e;Re(t);const n=(r=window.TelegramWebviewProxy)==null?void 0:r.postEvent;window.TelegramWebviewProxy={postEvent(o,a){lt(t.themeParams,JSON.stringify({eventType:o,eventData:a})),n==null||n(o,a)}},G("Environment was mocked by the mockTelegramEnv function")}function _t(){[["TelegramGameProxy_receiveEvent"],["TelegramGameProxy","receiveEvent"],["Telegram","WebView","receiveEvent"]].forEach(e=>{let t=window;e.forEach((n,r,o)=>{if(r===o.length-1){t[n]=U;return}n in t||(t[n]={}),t=t[n]})})}function bt(){["TelegramGameProxy_receiveEvent","TelegramGameProxy","Telegram"].forEach(e=>{delete window[e]})}function gt(e,t,n){ge(e).unsub(t,n)}function mt(e,t){return be().sub(e,t)}function dt(e,t){D.unsub(e,t)}function Se(e){return({req_id:t})=>t===e}function Ae(e){return e.split(".").map(Number)}function $e(e,t){const n=Ae(e),r=Ae(t),o=Math.max(n.length,r.length);for(let a=0;a<o;a+=1){const i=n[a]||0,c=r[a]||0;if(i!==c)return i>c?1:-1}return 0}function l(e,t){return $e(e,t)<=0}function X(e,t,n){if(typeof n=="string"){if(e==="web_app_open_link"){if(t==="try_instant_view")return l("6.4",n);if(t==="try_browser")return l("7.6",n)}if(e==="web_app_set_header_color"&&t==="color")return l("6.9",n);if(e==="web_app_close"&&t==="return_back")return l("7.6",n);if(e==="web_app_setup_main_button"&&t==="has_shine_effect")return l("7.10",n)}switch(e){case"web_app_open_tg_link":case"web_app_open_invoice":case"web_app_setup_back_button":case"web_app_set_background_color":case"web_app_set_header_color":case"web_app_trigger_haptic_feedback":return l("6.1",t);case"web_app_open_popup":return l("6.2",t);case"web_app_close_scan_qr_popup":case"web_app_open_scan_qr_popup":case"web_app_read_text_from_clipboard":return l("6.4",t);case"web_app_switch_inline_query":return l("6.7",t);case"web_app_invoke_custom_method":case"web_app_request_write_access":case"web_app_request_phone":return l("6.9",t);case"web_app_setup_settings_button":return l("6.10",t);case"web_app_biometry_get_info":case"web_app_biometry_open_settings":case"web_app_biometry_request_access":case"web_app_biometry_request_auth":case"web_app_biometry_update_token":return l("7.2",t);case"web_app_setup_swipe_behavior":return l("7.7",t);case"web_app_share_to_story":return l("7.8",t);case"web_app_setup_secondary_button":case"web_app_set_bottom_bar_color":return l("7.10",t);case"web_app_request_fullscreen":case"web_app_exit_fullscreen":return l("8.0",t);default:return["iframe_ready","iframe_will_reload","web_app_close","web_app_data_send","web_app_expand","web_app_open_link","web_app_ready","web_app_request_theme","web_app_request_viewport","web_app_setup_main_button","web_app_setup_closing_behavior"].includes(e)}}function ht(e,t){t||(t="strict");const n=typeof t=="function"?t:r=>{const{method:o,version:a}=r;let i,c;if("param"in r?(i=`Parameter "${r.param}" of "${o}" method is unsupported in Mini Apps version ${a}`,c=we):(i=`Method "${o}" is unsupported in Mini Apps version ${a}`,c=de),t==="strict")throw new b(c,i);return console.warn(i)};return(r,o)=>X(r,e)?Fe(o)&&r==="web_app_set_header_color"&&"color"in o&&!X(r,"color",e)?n({version:e,method:r,param:"color"}):K(r,o):n({version:e,method:r})}function wt(e,t,n,r){return Z("web_app_invoke_custom_method","custom_method_invoked",{...r||{},params:{method:e,params:t,req_id:n},capture:Se(n)}).then(({result:o,error:a})=>{if(a)throw new b(ye,a);return o})}function Et(e){e.unsubAll(),e.reset()}function yt(){var e;(e=C())==null||e(),[...Object.values(S()),S,D,C,V,B].forEach(Et)}return s.$debug=B,s.$targetOrigin=V,s.CancelablePromise=d,s.ERR_ABORTED=I,s.ERR_CANCELED=q,s.ERR_CUSTOM_METHOD_ERR_RESPONSE=ye,s.ERR_METHOD_PARAMETER_UNSUPPORTED=we,s.ERR_METHOD_UNSUPPORTED=de,s.ERR_RETRIEVE_LP_FAILED=he,s.ERR_TIMED_OUT=F,s.ERR_UNKNOWN_ENV=Ee,s.EnhancedPromise=T,s.TypedError=b,s.addEventListener=L,s.camelToKebab=Xe,s.camelToSnake=Ye,s.captureSameReq=Se,s.compareVersions=$e,s.createAbortError=H,s.createCbCollector=$,s.createLogger=_e,s.createPostEvent=ht,s.createTypedErrorPredicate=N,s.defineEventHandlers=_t,s.deleteCssVar=et,s.emitMiniAppsEvent=U,s.getStorageValue=pe,s.hasWebviewProxy=M,s.invokeCustomMethod=wt,s.isAbortError=Ke,s.isCanceledError=Ze,s.isIframe=se,s.isTMA=ft,s.isTimeoutError=Ve,s.mockTelegramEnv=pt,s.off=gt,s.on=me,s.postEvent=K,s.removeEventHandlers=bt,s.request=Z,s.resetPackageState=yt,s.retrieveLaunchParams=Te,s.setCssVar=xe,s.setStorageValue=le,s.sleep=ze,s.snakeToCamel=Qe,s.subscribe=mt,s.supports=X,s.unsubscribe=dt,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),s}({});
this.tapps=this.tapps||{};this.tapps.bridge=function(s){"use strict";class d extends Error{constructor(t,n,r){super(typeof n=="object"?n.message:n||t,{cause:typeof n=="object"?n.cause:r}),this.type=t,Object.setPrototypeOf(this,d.prototype)}}function Q(e){return e.replace(/[A-Z]/g,t=>`_${t.toLowerCase()}`)}function Ne(e){return e.replace(/_[a-z]/g,t=>t[1].toUpperCase())}const De="ERR_INVALID_VALUE",Ce="ERR_UNEXPECTED_VALUE",Ue="ERR_UNEXPECTED_TYPE",x="ERR_PARSE";function ee(e,t){const n={};for(const r in e){const o=e[r];if(!o)continue;let a,i;typeof o=="function"?(a=r,i=o):[a,i]=o;try{const c=i(t(a));c!==void 0&&(n[r]=c)}catch(c){throw new d(x,`Parser for "${r}" property failed${a===r?"":`. Source field: "${a}"`}`,c)}}return n}function te(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch(n){throw new d(De,{cause:n})}if(typeof t!="object"||!t||Array.isArray(t))throw new d(Ce);return t}function g(e,t){return n=>{const r=o=>{if(!(n&&o===void 0))try{return t(o)}catch(a){throw new d(x,{message:`"${e}" transformer failed to parse the value`,cause:a})}};return Object.assign(r,{isValid(o){try{return r(o),!0}catch{return!1}}})}}function w(e,t){return g(t||"object",n=>{const r=te(n);return ee(e,o=>r[o])})}function R(e){throw new d(Ue,`Unexpected value received: ${JSON.stringify(e)}`)}const A=g("boolean",e=>{if(typeof e=="boolean")return e;const t=String(e);if(t==="1"||t==="true")return!0;if(t==="0"||t==="false")return!1;R(e)}),l=g("string",e=>{if(typeof e=="string"||typeof e=="number")return e.toString();R(e)}),P=g("number",e=>{if(typeof e=="number")return e;if(typeof e=="string"){const t=Number(e);if(!Number.isNaN(t))return t}R(e)}),Oe=g("date",e=>e instanceof Date?e:new Date(P()(e)*1e3));function ne(e,t){return g(t||"searchParams",n=>{typeof n!="string"&&!(n instanceof URLSearchParams)&&R(n);const r=typeof n=="string"?new URLSearchParams(n):n;return ee(e,o=>{const a=r.get(o);return a===null?void 0:a})})}function j(e){for(const t in e)e[t]=[Q(t),e[t]];return e}const We=e=>{const t=P(),n=P(!0),r=l(),o=l(!0),a=A(!0),i=w(j({addedToAttachmentMenu:a,allowsWriteToPm:a,firstName:r,id:t,isBot:a,isPremium:a,languageCode:o,lastName:o,photoUrl:o,username:o}),"User")(!0);return ne(j({authDate:Oe(),canSendAfter:n,chat:w(j({id:t,type:r,title:r,photoUrl:o,username:o}),"Chat")(!0),chatInstance:o,chatType:o,hash:r,queryId:o,receiver:i,startParam:o,user:i}),"initData")(e)};function je(e){return/^#[\da-f]{6}$/i.test(e)}function ke(e){return/^#[\da-f]{3}$/i.test(e)}function Me(e){const t=e.replace(/\s/g,"").toLowerCase();if(je(t))return t;if(ke(t)){let r="#";for(let o=0;o<3;o+=1)r+=t[1+o].repeat(2);return r}const n=t.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/)||t.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);if(!n)throw new Error(`Value "${e}" does not satisfy any of known RGB formats.`);return n.slice(1).reduce((r,o)=>{const a=parseInt(o,10).toString(16);return r+(a.length===1?"0":"")+a},"#")}const Le=g("rgb",e=>Me(l()(e))),re=g("themeParams",e=>{const t=Le(!0);return Object.entries(te(e)).reduce((n,[r,o])=>(n[Ne(r)]=t(o),n),{})});function k(e){return JSON.stringify(Object.fromEntries(Object.entries(e).map(([t,n])=>[Q(t),n])))}const qe=e=>{const t=l(),n=l(!0),r=A(!0);return ne({botInline:["tgWebAppBotInline",r],defaultColors:["tgWebAppDefaultColors",re(!0)],fullscreen:["tgWebAppFullscreen",r],initData:["tgWebAppData",We(!0)],initDataRaw:["tgWebAppData",n],platform:["tgWebAppPlatform",t],showSettings:["tgWebAppShowSettings",r],startParam:["tgWebAppStartParam",n],themeParams:["tgWebAppThemeParams",re()],version:["tgWebAppVersion",t]},"launchParams")(e)};function Ie(e){const{initDataRaw:t,startParam:n,showSettings:r,botInline:o,fullscreen:a,defaultColors:i}=e,c=new URLSearchParams;return c.set("tgWebAppPlatform",e.platform),c.set("tgWebAppThemeParams",k(e.themeParams)),c.set("tgWebAppVersion",e.version),t&&c.set("tgWebAppData",t),n&&c.set("tgWebAppStartParam",n),typeof r=="boolean"&&c.set("tgWebAppShowSettings",r?"1":"0"),typeof o=="boolean"&&c.set("tgWebAppBotInline",o?"1":"0"),typeof a=="boolean"&&c.set("tgWebAppFullscreen",a?"1":"0"),i&&c.set("tgWebAppDefaultColors",k(i)),c.toString()}const oe=w({eventType:l(),eventData:e=>e},"miniAppsMessage"),ae=g("fn",e=>{if(typeof e=="function")return e;R(e)});function Fe(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}const He=w({TelegramWebviewProxy:w({postEvent:ae()})()});function M(e){return He().isValid(e)}function se(){try{return window.self!==window.top}catch{return!0}}var Je=Object.defineProperty,Be=(e,t,n)=>t in e?Je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ie=(e,t,n)=>Be(e,typeof t!="symbol"?t+"":t,n);class b extends Error{constructor(t,n,r){super(typeof n=="object"?n.message:n||t,{cause:typeof n=="object"?n.cause:r}),this.type=t,Object.setPrototypeOf(this,b.prototype)}}function L(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function $(...e){const t=e.flat(1);return[t.push.bind(t),()=>{t.forEach(n=>{n()})}]}function Ge(e,t){return e instanceof b&&e.type===t}function N(e){return t=>Ge(t,e)}const q="ERR_ABORTED",I="ERR_CANCELED",F="ERR_TIMED_OUT";function H(e){return new b(q,{cause:e})}const Ve=N(F),Ke=N(q),Ze=N(I);function ce(e,t){return e.reject=t.reject,e}class m extends Promise{constructor(t,n){let r,o;typeof t=="function"?(r=t,o=n):o=t;let a,i;super((c,u)=>{o||(o={});const{abortSignal:f}=o;if(f&&f.aborted)return u(H(f.reason));const[_,h]=$(),E=v=>(...vt)=>(h(),v(...vt)),O=new AbortController,{signal:W}=O;i=E(v=>{O.abort(v),u(v)}),a=E(c),f&&_(L(f,"abort",()=>{i(H(f.reason))}));const{timeout:Y}=o;if(Y){const v=setTimeout(()=>{i(new b(F,`Timeout reached: ${Y}ms`))},Y);_(()=>{clearTimeout(v)})}r&&r(a,i,W)}),ie(this,"reject"),this.reject=i}static withFn(t,n){return new m((r,o,a)=>{try{const i=t(a);return i instanceof Promise?i.then(r,o):r(i)}catch(i){o(i)}},n)}static resolve(t){return new m(n=>{n(t)})}static reject(t){return new m((n,r)=>{r(t)})}cancel(){this.reject(new b(I))}catch(t){return this.then(void 0,t)}finally(t){return ce(super.finally(t),this)}then(t,n){return ce(super.then(t,n),this)}}function ue(e,t){return e.resolve=t.resolve,e}class T extends m{constructor(t,n){let r,o;typeof t=="function"?(r=t,o=n):o=t;let a;super((i,c,u)=>{a=i,r&&r(i,c,u)},o),ie(this,"resolve"),this.resolve=a}static withFn(t,n){return new T((r,o,a)=>m.withFn(t,{abortSignal:a}).then(r,o),n)}static resolve(t){return new T(n=>{n(t)})}static reject(t){return new T((n,r)=>{r(t)})}catch(t){return this.then(void 0,t)}finally(t){return ue(super.finally(t),this)}then(t,n){return ue(super.then(t,n),this)}}function ze(e,t){return new m(n=>{setTimeout(n,e)},{abortSignal:t})}function fe(e){return`tapps/${e}`}function pe(e,t){sessionStorage.setItem(fe(e),JSON.stringify(t))}function _e(e){const t=sessionStorage.getItem(fe(e));try{return t?JSON.parse(t):void 0}catch{}}function Xe(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Ye(e){return e.replace(/[A-Z]/g,t=>`_${t.toLowerCase()}`)}function Qe(e){return e.replace(/_[a-z]/g,t=>t[1].toUpperCase())}function le(e,t){t||(t={});const{textColor:n,bgColor:r,shouldLog:o=!0}=t;function a(i,...c){if(!o||typeof o=="function"&&!o())return;const u="font-weight:bold;padding:0 5px;border-radius:5px";console[i](`%c${Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,timeZone:"UTC"}).format(new Date)}%c / %c${e}`,`${u};background-color: lightblue;color:black`,"",`${u};${n?`color:${n};`:""}${r?`background-color:${r}`:""}`,...c)}return[function(...i){a("log",...i)},function(...i){a("error",...i)}]}function xe(e,t){document.documentElement.style.setProperty(e,t)}function et(e){document.documentElement.style.removeProperty(e)}function tt(e,t){t()}function y(e,t){t||(t={});const n=t.equals||Object.is;let r=[],o=e;const a=f=>{if(!n(o,f)){const _=o;o=f,tt(u,()=>{[...r].forEach(([h,E])=>{h(f,_),E&&c(h,!0)})})}};function i(f){const _=typeof f!="object"?{once:f}:f;return{once:_.once||!1,signal:_.signal||!1}}const c=(f,_)=>{const h=i(_),E=r.findIndex(([O,W])=>O===f&&W.once===h.once&&W.signal===h.signal);E>=0&&r.splice(E,1)},u=Object.assign(function(){return nt(u),o},{destroy(){r=[]},set:a,reset(){a(e)},sub(f,_){return r.push([f,i(_)]),()=>c(f,_)},unsub:c,unsubAll(){r=r.filter(f=>f[1].signal)}});return u}const J=[];function nt(e){J.length&&J[J.length-1].add(e)}const B=y(!1),[G,rt]=le("Bridge",{bgColor:"#9147ff",textColor:"white",shouldLog:B}),ot={clipboard_text_received:w({req_id:l(),data:e=>e===null?e:l(!0)(e)},"clipboard_text_received"),custom_method_invoked:w({req_id:l(),result:e=>e,error:l(!0)},"custom_method_invoked"),popup_closed:g("popup_closed",e=>e?w({button_id:t=>t==null?void 0:l()(t)})()(e):{}),viewport_changed:w({height:P(),width:e=>e==null?window.innerWidth:P()(e),is_state_stable:A(),is_expanded:A()},"viewport_changed")};function at(e){const t=window,[,n]=$(L(t,"message",r=>{if(r.source!==t.parent)return;let o;try{o=oe()(r.data)}catch{return}const{eventType:a,eventData:i}=o,c=ot[a];try{const u=c?c()(i):i;G("Event received:",u?{eventType:a,eventData:u}:{eventType:a}),e([a,u])}catch(u){rt([`An error occurred processing the "${a}" event from the Telegram application.`,"Please, file an issue here:","https://github.com/Telegram-Mini-Apps/telegram-apps/issues/new/choose"].join(`
`),o,u)}}));return n}const D=y(),C=y();function be(){return C()||C.set(at(D.set)),D}const S=y({});function ge(e){let t=S()[e];return t||(t=y(void 0,{equals(){return!1}}),be().sub(n=>{n&&n[0]===e&&t.set(n[1])}),S.set({...S(),[e]:t})),t}function we(e,t,n){return ge(e).sub(t,n)}const me="ERR_METHOD_UNSUPPORTED",de="ERR_RETRIEVE_LP_FAILED",he="ERR_METHOD_PARAMETER_UNSUPPORTED",Ee="ERR_UNKNOWN_ENV",ye="ERR_INVOKE_CUSTOM_METHOD_RESPONSE",V=y("https://web.telegram.org");function K(e,t){G("Posting event:",t?{eventType:e,eventData:t}:{eventType:e});const n=window;if(M(n)){n.TelegramWebviewProxy.postEvent(e,JSON.stringify(t));return}const r=JSON.stringify({eventType:e,eventData:t});if(se())return n.parent.postMessage(r,V());const{external:o}=n;if(w({notify:ae()})().isValid(o)){o.notify(r);return}throw new b(Ee)}function Z(e,t,n){n||(n={});const{capture:r}=n,[o,a]=$();return new m(i=>{(Array.isArray(t)?t:[t]).forEach(c=>{o(we(c,u=>{(!r||(Array.isArray(t)?r({event:c,payload:u}):r(u)))&&i(u)}))}),(n.postEvent||K)(e,n.params)},n).finally(a)}function z(e){return qe()(e)}function ve(e){return z(e.replace(/^[^?#]*[?#]/,"").replace(/[?#]/g,"&"))}function st(){return ve(window.location.href)}function it(){const e=performance.getEntriesByType("navigation")[0];if(!e)throw new Error("Unable to get first navigation entry.");return ve(e.name)}const ct="launchParams";function ut(){return z(_e(ct)||"")}function Re(e){pe("launchParams",Ie(e))}function Pe(e){return e instanceof Error?e.message+(e.cause?`
${Pe(e.cause)}`:""):JSON.stringify(e)}function Te(){const e=[];for(const t of[st,it,ut])try{const n=t();return Re(n),n}catch(n){e.push(n)}throw new b(de,["Unable to retrieve launch parameters from any known source. Perhaps, you have opened your app outside Telegram?","📖 Refer to docs for more information:","https://docs.telegram-mini-apps.com/packages/telegram-apps-sdk/environment","Collected errors:",...e.map(t=>`— ${Pe(t)}`)].join(`
`))}function ft(e){if(e==="simple")try{return Te(),!0}catch{return!1}return m.withFn(async()=>{if(M(window))return!0;try{return await Z("web_app_request_theme","theme_changed",{timeout:100}),!0}catch{return!1}},e)}function U(e,t){window.dispatchEvent(new MessageEvent("message",{data:JSON.stringify({eventType:e,eventData:t}),source:window.parent}))}function pt(e,t){if(typeof t=="string")try{const{eventType:n}=oe()(t);n==="web_app_request_theme"&&U("theme_changed",{theme_params:JSON.parse(k(e))}),n==="web_app_request_viewport"&&U("viewport_changed",{width:window.innerWidth,height:window.innerHeight,is_state_stable:!0,is_expanded:!0})}catch{}}function _t(e){var r;const t=typeof e=="string"?z(e):e;Re(t);const n=(r=window.TelegramWebviewProxy)==null?void 0:r.postEvent;window.TelegramWebviewProxy={postEvent(o,a){pt(t.themeParams,JSON.stringify({eventType:o,eventData:a})),n==null||n(o,a)}},G("Environment was mocked by the mockTelegramEnv function")}function lt(){[["TelegramGameProxy_receiveEvent"],["TelegramGameProxy","receiveEvent"],["Telegram","WebView","receiveEvent"]].forEach(e=>{let t=window;e.forEach((n,r,o)=>{if(r===o.length-1){t[n]=U;return}n in t||(t[n]={}),t=t[n]})})}function bt(){["TelegramGameProxy_receiveEvent","TelegramGameProxy","Telegram"].forEach(e=>{delete window[e]})}function gt(e,t,n){ge(e).unsub(t,n)}function wt(e,t){return be().sub(e,t)}function mt(e,t){D.unsub(e,t)}function Se(e){return({req_id:t})=>t===e}function Ae(e){return e.split(".").map(Number)}function $e(e,t){const n=Ae(e),r=Ae(t),o=Math.max(n.length,r.length);for(let a=0;a<o;a+=1){const i=n[a]||0,c=r[a]||0;if(i!==c)return i>c?1:-1}return 0}function p(e,t){return $e(e,t)<=0}function X(e,t,n){if(typeof n=="string"){if(e==="web_app_open_link"){if(t==="try_instant_view")return p("6.4",n);if(t==="try_browser")return p("7.6",n)}if(e==="web_app_set_header_color"&&t==="color")return p("6.9",n);if(e==="web_app_close"&&t==="return_back")return p("7.6",n);if(e==="web_app_setup_main_button"&&t==="has_shine_effect")return p("7.10",n)}switch(e){case"web_app_open_tg_link":case"web_app_open_invoice":case"web_app_setup_back_button":case"web_app_set_background_color":case"web_app_set_header_color":case"web_app_trigger_haptic_feedback":return p("6.1",t);case"web_app_open_popup":return p("6.2",t);case"web_app_close_scan_qr_popup":case"web_app_open_scan_qr_popup":case"web_app_read_text_from_clipboard":return p("6.4",t);case"web_app_switch_inline_query":return p("6.7",t);case"web_app_invoke_custom_method":case"web_app_request_write_access":case"web_app_request_phone":return p("6.9",t);case"web_app_setup_settings_button":return p("6.10",t);case"web_app_biometry_get_info":case"web_app_biometry_open_settings":case"web_app_biometry_request_access":case"web_app_biometry_request_auth":case"web_app_biometry_update_token":return p("7.2",t);case"web_app_setup_swipe_behavior":return p("7.7",t);case"web_app_share_to_story":return p("7.8",t);case"web_app_setup_secondary_button":case"web_app_set_bottom_bar_color":return p("7.10",t);case"web_app_request_safe_area":case"web_app_request_content_safe_area":case"web_app_request_fullscreen":case"web_app_exit_fullscreen":return p("8.0",t);default:return["iframe_ready","iframe_will_reload","web_app_close","web_app_data_send","web_app_expand","web_app_open_link","web_app_ready","web_app_request_theme","web_app_request_viewport","web_app_setup_main_button","web_app_setup_closing_behavior"].includes(e)}}function dt(e,t){t||(t="strict");const n=typeof t=="function"?t:r=>{const{method:o,version:a}=r;let i,c;if("param"in r?(i=`Parameter "${r.param}" of "${o}" method is unsupported in Mini Apps version ${a}`,c=he):(i=`Method "${o}" is unsupported in Mini Apps version ${a}`,c=me),t==="strict")throw new b(c,i);return console.warn(i)};return(r,o)=>X(r,e)?Fe(o)&&r==="web_app_set_header_color"&&"color"in o&&!X(r,"color",e)?n({version:e,method:r,param:"color"}):K(r,o):n({version:e,method:r})}function ht(e,t,n,r){return Z("web_app_invoke_custom_method","custom_method_invoked",{...r||{},params:{method:e,params:t,req_id:n},capture:Se(n)}).then(({result:o,error:a})=>{if(a)throw new b(ye,a);return o})}function Et(e){e.unsubAll(),e.reset()}function yt(){var e;(e=C())==null||e(),[...Object.values(S()),S,D,C,V,B].forEach(Et)}return s.$debug=B,s.$targetOrigin=V,s.CancelablePromise=m,s.ERR_ABORTED=q,s.ERR_CANCELED=I,s.ERR_CUSTOM_METHOD_ERR_RESPONSE=ye,s.ERR_METHOD_PARAMETER_UNSUPPORTED=he,s.ERR_METHOD_UNSUPPORTED=me,s.ERR_RETRIEVE_LP_FAILED=de,s.ERR_TIMED_OUT=F,s.ERR_UNKNOWN_ENV=Ee,s.EnhancedPromise=T,s.TypedError=b,s.addEventListener=L,s.camelToKebab=Xe,s.camelToSnake=Ye,s.captureSameReq=Se,s.compareVersions=$e,s.createAbortError=H,s.createCbCollector=$,s.createLogger=le,s.createPostEvent=dt,s.createTypedErrorPredicate=N,s.defineEventHandlers=lt,s.deleteCssVar=et,s.emitMiniAppsEvent=U,s.getStorageValue=_e,s.hasWebviewProxy=M,s.invokeCustomMethod=ht,s.isAbortError=Ke,s.isCanceledError=Ze,s.isIframe=se,s.isTMA=ft,s.isTimeoutError=Ve,s.mockTelegramEnv=_t,s.off=gt,s.on=we,s.postEvent=K,s.removeEventHandlers=bt,s.request=Z,s.resetPackageState=yt,s.retrieveLaunchParams=Te,s.setCssVar=xe,s.setStorageValue=pe,s.sleep=ze,s.snakeToCamel=Qe,s.subscribe=wt,s.supports=X,s.unsubscribe=mt,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),s}({});
//# sourceMappingURL=index.iife.js.map

@@ -27,9 +27,9 @@ class m extends Error {

try {
const i = a(t(s));
i !== void 0 && (n[r] = i);
} catch (i) {
const c = a(t(s));
c !== void 0 && (n[r] = c);
} catch (c) {
throw new m(
K,
`Parser for "${r}" property failed${s === r ? "" : `. Source field: "${s}"`}`,
i
c
);

@@ -188,3 +188,3 @@ }

}
const Te = g("rgb", (e) => Re(l()(e))), q = g(
const Te = g("rgb", (e) => Re(l()(e))), I = g(
"themeParams",

@@ -208,3 +208,3 @@ (e) => {

botInline: ["tgWebAppBotInline", r],
defaultColors: ["tgWebAppDefaultColors", q(!0)],
defaultColors: ["tgWebAppDefaultColors", I(!0)],
fullscreen: ["tgWebAppFullscreen", r],

@@ -216,3 +216,3 @@ initData: ["tgWebAppData", ye(!0)],

startParam: ["tgWebAppStartParam", n],
themeParams: ["tgWebAppThemeParams", q()],
themeParams: ["tgWebAppThemeParams", I()],
version: ["tgWebAppVersion", t]

@@ -230,4 +230,4 @@ }, "launchParams")(e);

defaultColors: a
} = e, i = new URLSearchParams();
return i.set("tgWebAppPlatform", e.platform), i.set("tgWebAppThemeParams", /* @__PURE__ */ j(e.themeParams)), i.set("tgWebAppVersion", e.version), t && i.set("tgWebAppData", t), n && i.set("tgWebAppStartParam", n), typeof r == "boolean" && i.set("tgWebAppShowSettings", r ? "1" : "0"), typeof o == "boolean" && i.set("tgWebAppBotInline", o ? "1" : "0"), typeof s == "boolean" && i.set("tgWebAppFullscreen", s ? "1" : "0"), a && i.set("tgWebAppDefaultColors", /* @__PURE__ */ j(a)), i.toString();
} = e, c = new URLSearchParams();
return c.set("tgWebAppPlatform", e.platform), c.set("tgWebAppThemeParams", /* @__PURE__ */ j(e.themeParams)), c.set("tgWebAppVersion", e.version), t && c.set("tgWebAppData", t), n && c.set("tgWebAppStartParam", n), typeof r == "boolean" && c.set("tgWebAppShowSettings", r ? "1" : "0"), typeof o == "boolean" && c.set("tgWebAppBotInline", o ? "1" : "0"), typeof s == "boolean" && c.set("tgWebAppFullscreen", s ? "1" : "0"), a && c.set("tgWebAppDefaultColors", /* @__PURE__ */ j(a)), c.toString();
}

@@ -302,11 +302,11 @@ const X = _({

let s, a;
super((i, c) => {
super((c, i) => {
o || (o = {});
const { abortSignal: u } = o;
if (u && u.aborted)
return c(M(u.reason));
return i(M(u.reason));
const [f, h] = k(), d = (E) => (...ge) => (h(), E(...ge)), T = new AbortController(), { signal: A } = T;
a = d((E) => {
T.abort(E), c(E);
}), s = d(i), u && f(
T.abort(E), i(E);
}), s = d(c), u && f(
te(u, "abort", () => {

@@ -393,4 +393,4 @@ a(M(u.reason));

let s;
super((a, i, c) => {
s = a, r && r(a, i, c);
super((a, c, i) => {
s = a, r && r(a, c, i);
}, o), ee(this, "resolve"), this.resolve = s;

@@ -463,6 +463,6 @@ }

}
function it(e) {
function ct(e) {
return e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
}
function ct(e) {
function it(e) {
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);

@@ -481,6 +481,6 @@ }

} = t;
function s(a, ...i) {
function s(a, ...c) {
if (!o || typeof o == "function" && !o())
return;
const c = "font-weight:bold;padding:0 5px;border-radius:5px";
const i = "font-weight:bold;padding:0 5px;border-radius:5px";
console[a](

@@ -494,6 +494,6 @@ `%c${Intl.DateTimeFormat("en-GB", {

}).format(/* @__PURE__ */ new Date())}%c / %c${e}`,
`${c};background-color: lightblue;color:black`,
`${i};background-color: lightblue;color:black`,
"",
`${c};${n ? `color:${n};` : ""}${r ? `background-color:${r}` : ""}`,
...i
`${i};${n ? `color:${n};` : ""}${r ? `background-color:${r}` : ""}`,
...c
);

@@ -527,5 +527,5 @@ }

const f = o;
o = u, Le(c, () => {
o = u, Le(i, () => {
[...r].forEach(([h, d]) => {
h(u, f), d && i(h, !0);
h(u, f), d && c(h, !0);
});

@@ -542,8 +542,8 @@ });

}
const i = (u, f) => {
const c = (u, f) => {
const h = a(f), d = r.findIndex(([T, A]) => T === u && A.once === h.once && A.signal === h.signal);
d >= 0 && r.splice(d, 1);
}, c = Object.assign(
}, i = Object.assign(
function() {
return Oe(c), o;
return Oe(i), o;
},

@@ -559,5 +559,5 @@ {

sub(u, f) {
return r.push([u, a(f)]), () => i(u, f);
return r.push([u, a(f)]), () => c(u, f);
},
unsub: i,
unsub: c,
unsubAll() {

@@ -568,3 +568,3 @@ r = r.filter((u) => u[1].signal);

);
return c;
return i;
}

@@ -575,7 +575,7 @@ const W = [];

}
const ae = /* @__PURE__ */ y(!1), [O, Ie] = /* @__PURE__ */ ke("Bridge", {
const ae = /* @__PURE__ */ y(!1), [O, qe] = /* @__PURE__ */ ke("Bridge", {
bgColor: "#9147ff",
textColor: "white",
shouldLog: ae
}), qe = {
}), Ie = {
clipboard_text_received: _({

@@ -613,8 +613,8 @@ req_id: l(),

}
const { eventType: s, eventData: a } = o, i = qe[s];
const { eventType: s, eventData: a } = o, c = Ie[s];
try {
const c = i ? i()(a) : a;
O("Event received:", c ? { eventType: s, eventData: c } : { eventType: s }), e([s, c]);
} catch (c) {
Ie(
const i = c ? c()(a) : a;
O("Event received:", i ? { eventType: s, eventData: i } : { eventType: s }), e([s, i]);
} catch (i) {
qe(
[

@@ -627,3 +627,3 @@ `An error occurred processing the "${s}" event from the Telegram application.`,

o,
c
i
);

@@ -636,7 +636,7 @@ }

const C = /* @__PURE__ */ y(), N = /* @__PURE__ */ y();
function ie() {
function ce() {
return N() || N.set(Me(C.set)), C;
}
const v = /* @__PURE__ */ y({});
function ce(e) {
function ie(e) {
let t = v()[e];

@@ -647,3 +647,3 @@ return t || (t = /* @__PURE__ */ y(void 0, {

}
}), ie().sub((n) => {
}), ce().sub((n) => {
n && n[0] === e && t.set(n[1]);

@@ -653,3 +653,3 @@ }), v.set({ ...v(), [e]: t })), t;

function Fe(e, t, n) {
return ce(e).sub(t, n);
return ie(e).sub(t, n);
}

@@ -678,9 +678,9 @@ const Je = "ERR_METHOD_UNSUPPORTED", Be = "ERR_RETRIEVE_LP_FAILED", He = "ERR_METHOD_PARAMETER_UNSUPPORTED", Ge = "ERR_UNKNOWN_ENV", Ke = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", ue = /* @__PURE__ */ y("https://web.telegram.org");

return new w((a) => {
(Array.isArray(t) ? t : [t]).forEach((i) => {
(Array.isArray(t) ? t : [t]).forEach((c) => {
o(
Fe(i, (c) => {
Fe(c, (i) => {
(!r || (Array.isArray(t) ? r({
event: i,
payload: c
}) : r(c))) && a(c);
event: c,
payload: i
}) : r(i))) && a(i);
})

@@ -691,7 +691,7 @@ );

}
function I(e) {
function q(e) {
return Ae()(e);
}
function le(e) {
return I(
return q(
e.replace(/^[^?#]*[?#]/, "").replace(/[?#]/g, "&")

@@ -711,3 +711,3 @@ );

function Xe() {
return I(xe(ze) || "");
return q(xe(ze) || "");
}

@@ -788,3 +788,3 @@ function _e(e) {

var r;
const t = typeof e == "string" ? I(e) : e;
const t = typeof e == "string" ? q(e) : e;
_e(t);

@@ -823,6 +823,6 @@ const n = (r = window.TelegramWebviewProxy) == null ? void 0 : r.postEvent;

function wt(e, t, n) {
ce(e).unsub(t, n);
ie(e).unsub(t, n);
}
function ht(e, t) {
return ie().sub(e, t);
return ce().sub(e, t);
}

@@ -841,5 +841,5 @@ function dt(e, t) {

for (let s = 0; s < o; s += 1) {
const a = n[s] || 0, i = r[s] || 0;
if (a !== i)
return a > i ? 1 : -1;
const a = n[s] || 0, c = r[s] || 0;
if (a !== c)
return a > c ? 1 : -1;
}

@@ -901,2 +901,4 @@ return 0;

return p("7.10", t);
case "web_app_request_safe_area":
case "web_app_request_content_safe_area":
case "web_app_request_fullscreen":

@@ -925,5 +927,5 @@ case "web_app_exit_fullscreen":

const { method: o, version: s } = r;
let a, i;
if ("param" in r ? (a = `Parameter "${r.param}" of "${o}" method is unsupported in Mini Apps version ${s}`, i = He) : (a = `Method "${o}" is unsupported in Mini Apps version ${s}`, i = Je), t === "strict")
throw new b(i, a);
let a, c;
if ("param" in r ? (a = `Parameter "${r.param}" of "${o}" method is unsupported in Mini Apps version ${s}`, c = He) : (a = `Method "${o}" is unsupported in Mini Apps version ${s}`, c = Je), t === "strict")
throw new b(c, a);
return console.warn(a);

@@ -973,4 +975,4 @@ };

te as addEventListener,
it as camelToKebab,
ct as camelToSnake,
ct as camelToKebab,
it as camelToSnake,
et as captureSameReq,

@@ -977,0 +979,0 @@ tt as compareVersions,

{
"name": "@telegram-apps/bridge",
"version": "1.5.0",
"version": "1.6.0",
"description": "TypeScript package to provide communication layer between Mini App and Telegram application.",

@@ -40,4 +40,4 @@ "author": "Vladislav Kibenko <wolfram.deus@gmail.com>",

"dependencies": {
"@telegram-apps/toolkit": "^1.0.0",
"@telegram-apps/signals": "^1.1.0",
"@telegram-apps/toolkit": "^1.0.0",
"@telegram-apps/transformers": "^1.1.0",

@@ -44,0 +44,0 @@ "@telegram-apps/types": "^1.1.0"

@@ -10,2 +10,3 @@ import type { RGB } from '@telegram-apps/types';

BiometryTokenUpdateStatus,
SafeAreaInsets,
FullScreenErrorStatus,

@@ -128,2 +129,9 @@ } from './misc.js';

/**
* Occurs when the safe area for content changes
* (e.g., due to orientation change or screen adjustments).
* @since Mini Apps v8.0
* @see https://docs.telegram-mini-apps.com/platform/events#content_safe_area_changed
* */
content_safe_area_changed: SafeAreaInsets;
/**
* Custom method invocation completed.

@@ -228,2 +236,9 @@ * @since v6.9

/**
* Occurs whenever the device's safe area insets change
* (e.g., due to orientation change or screen adjustments).
* @since Mini Apps v8.0
* @see https://docs.telegram-mini-apps.com/platform/events#safe_area_changed
* */
safe_area_changed: SafeAreaInsets;
/**
* QR scanner was closed.

@@ -230,0 +245,0 @@ * @since v6.4

@@ -25,2 +25,9 @@ export type InvoiceStatus =

| 'UNSUPPORTED'
| string;
| string;
export interface SafeAreaInsets {
top: number;
bottom: number;
left: number;
right: number;
}

@@ -121,2 +121,3 @@ import { expect, it, describe } from 'vitest';

'web_app_request_fullscreen',
'web_app_exit_fullscreen'
]],

@@ -123,0 +124,0 @@ ])('%s', (version, methods) => {

@@ -104,2 +104,4 @@ import type { Version } from '@telegram-apps/types';

return versionLessOrEqual('7.10', paramOrVersion);
case 'web_app_request_safe_area':
case 'web_app_request_content_safe_area':
case 'web_app_request_fullscreen':

@@ -106,0 +108,0 @@ case 'web_app_exit_fullscreen':

@@ -6,1 +6,2 @@ export type * from './custom-method.js';

export type * from './popup.js';
export type { CreateMethodParams } from './utils.js';
import type { If, IsNever } from '@telegram-apps/toolkit';
import type { RGB } from '@telegram-apps/types';
import type { CreateParams } from './utils.js';
import type { CreateMethodParams } from './utils.js';
import type { AnyHapticFeedbackParams } from './haptic-feedback.js';

@@ -60,3 +60,3 @@ import type { PopupParams } from './popup.js';

*/
iframe_ready: CreateParams<{
iframe_ready: CreateMethodParams<{
/**

@@ -71,3 +71,3 @@ * True, if the current Mini App supports native reloading.

*/
iframe_will_reload: CreateParams;
iframe_will_reload: CreateMethodParams;
/**

@@ -82,3 +82,3 @@ * Emitted by bot mini apps to ask the client to initialize the biometric authentication manager

*/
web_app_biometry_get_info: CreateParams;
web_app_biometry_get_info: CreateMethodParams;
/**

@@ -93,3 +93,3 @@ * Opens the biometric access settings for bots. Useful when you need to request biometrics

*/
web_app_biometry_open_settings: CreateParams;
web_app_biometry_open_settings: CreateMethodParams;
/**

@@ -106,3 +106,3 @@ * Emitted by bot mini apps to ask the user permission to use biometric authentication,

*/
web_app_biometry_request_access: CreateParams<{
web_app_biometry_request_access: CreateMethodParams<{
/**

@@ -127,3 +127,3 @@ * Reason to request biometry access. Should be at least 1 symbol length, but not

*/
web_app_biometry_request_auth: CreateParams<{
web_app_biometry_request_auth: CreateMethodParams<{
/**

@@ -147,3 +147,3 @@ * Reason to request biometry data. Should be at least 1 symbol length, but not more than

*/
web_app_biometry_update_token: CreateParams<{
web_app_biometry_update_token: CreateMethodParams<{
/**

@@ -162,3 +162,3 @@ * Optional string field, containing the reason why the bot is asking to authenticate using biometrics (1-128 chars, used in the prompt).

*/
web_app_close: CreateParams<{
web_app_close: CreateMethodParams<{
/**

@@ -175,3 +175,3 @@ * Should the client return to the previous activity.

*/
web_app_close_scan_qr_popup: CreateParams;
web_app_close_scan_qr_popup: CreateMethodParams;
/**

@@ -186,3 +186,3 @@ * Sends data to the bot. When this method is called, a service message is sent to the bot

*/
web_app_data_send: CreateParams<{
web_app_data_send: CreateMethodParams<{
/**

@@ -194,6 +194,12 @@ * Data to send to a bot. Should not have size of more than 4096 bytes.

/**
* Exits fullscreen mode for miniapp.
* @since v8.0
* @see https://docs.telegram-mini-apps.com/platform/methods#web-app-exit-fullscreen
*/
web_app_exit_fullscreen: CreateMethodParams;
/**
* Expands the Mini App.
* @see https://docs.telegram-mini-apps.com/platform/methods#web-app-expand
*/
web_app_expand: CreateParams;
web_app_expand: CreateMethodParams;
/**

@@ -204,3 +210,3 @@ * Invokes custom method.

*/
web_app_invoke_custom_method: CreateParams<AnyInvokeCustomMethodParams>;
web_app_invoke_custom_method: CreateMethodParams<AnyInvokeCustomMethodParams>;
/**

@@ -212,3 +218,3 @@ * Opens an invoice by its specified slug. More information about invoices in

*/
web_app_open_invoice: CreateParams<{
web_app_open_invoice: CreateMethodParams<{
/**

@@ -223,3 +229,3 @@ * Invoice unique identifier.

*/
web_app_open_link: CreateParams<{
web_app_open_link: CreateMethodParams<{
/**

@@ -246,3 +252,3 @@ * URL to be opened by Telegram application. Should be a full path with `https` protocol.

*/
web_app_open_popup: CreateParams<PopupParams>;
web_app_open_popup: CreateMethodParams<PopupParams>;
/**

@@ -255,3 +261,3 @@ * Opens a QR scanner. When the scanner was closed, the Telegram application creates

*/
web_app_open_scan_qr_popup: CreateParams<{
web_app_open_scan_qr_popup: CreateMethodParams<{
/**

@@ -268,3 +274,3 @@ * Text to be displayed in the QR scanner.

*/
web_app_open_tg_link: CreateParams<{
web_app_open_tg_link: CreateMethodParams<{
/**

@@ -282,3 +288,3 @@ * Should be a value taken from the link of this format: `https://t.me/{path_full}`. Can

*/
web_app_read_text_from_clipboard: CreateParams<{
web_app_read_text_from_clipboard: CreateMethodParams<{
/**

@@ -295,15 +301,15 @@ * Unique request identifier. Should be any unique string to handle the generated event

*/
web_app_ready: CreateParams;
web_app_ready: CreateMethodParams;
/**
* Requests to open the mini app in fullscreen.
* Requests content safe area of the user's phone.
* @since v8.0
* @see https://docs.telegram-mini-apps.com/platform/methods#web-app-request-fullscreen
* @see https://docs.telegram-mini-apps.com/platform/methods#web-app-request-content-safe-area
*/
web_app_request_fullscreen: CreateParams;
web_app_request_content_safe_area: CreateMethodParams;
/**
* Exits fullscreen mode for miniapp.
* Requests to open the mini app in fullscreen.
* @since v8.0
* @see https://docs.telegram-mini-apps.com/platform/methods#web-app-exit-fullscreen
* @see https://docs.telegram-mini-apps.com/platform/methods#web-app-request-fullscreen
*/
web_app_exit_fullscreen: CreateParams;
web_app_request_fullscreen: CreateMethodParams;
/**

@@ -314,8 +320,14 @@ * Requests access to current user's phone.

*/
web_app_request_phone: CreateParams;
web_app_request_phone: CreateMethodParams;
/**
* Requests safe area of the user's phone.
* @since v8.0
* @see https://docs.telegram-mini-apps.com/platform/methods#web-app-request-safe-area
*/
web_app_request_safe_area: CreateMethodParams;
/**
* Requests current theme from Telegram. As a result, Telegram will create `theme_changed` event.
* @see https://docs.telegram-mini-apps.com/platform/methods#web-app-request-theme
*/
web_app_request_theme: CreateParams;
web_app_request_theme: CreateMethodParams;
/**

@@ -326,3 +338,3 @@ * Requests current viewport information from Telegram. As a result, Telegram will create

*/
web_app_request_viewport: CreateParams;
web_app_request_viewport: CreateMethodParams;
/**

@@ -333,3 +345,3 @@ * Requests write message access to the current user.

*/
web_app_request_write_access: CreateParams;
web_app_request_write_access: CreateMethodParams;
/**

@@ -340,3 +352,3 @@ * Updates the Mini App background color.

*/
web_app_set_background_color: CreateParams<{
web_app_set_background_color: CreateMethodParams<{
/**

@@ -352,3 +364,3 @@ * Color to set.

*/
web_app_set_bottom_bar_color: CreateParams<{
web_app_set_bottom_bar_color: CreateMethodParams<{
/**

@@ -364,3 +376,3 @@ * Color to set.

*/
web_app_set_header_color: CreateParams<
web_app_set_header_color: CreateMethodParams<
| {

@@ -384,3 +396,3 @@ /**

*/
web_app_setup_back_button: CreateParams<{
web_app_setup_back_button: CreateMethodParams<{
/**

@@ -395,3 +407,3 @@ * Should the Back Button be visible.

*/
web_app_setup_closing_behavior: CreateParams<{
web_app_setup_closing_behavior: CreateMethodParams<{
/**

@@ -406,3 +418,3 @@ * Will user be prompted in case, an application is going to be closed.

*/
web_app_setup_main_button: CreateParams<ButtonParams, 'has_shine_effect'>;
web_app_setup_main_button: CreateMethodParams<ButtonParams, 'has_shine_effect'>;
/**

@@ -413,3 +425,3 @@ * Updates the secondary button settings.

*/
web_app_setup_secondary_button: CreateParams<ButtonParams & {
web_app_setup_secondary_button: CreateMethodParams<ButtonParams & {
/**

@@ -432,3 +444,3 @@ * Position of the secondary button. It applies only if both the main and secondary buttons

*/
web_app_setup_settings_button: CreateParams<{
web_app_setup_settings_button: CreateMethodParams<{
/**

@@ -444,3 +456,3 @@ * Should the Settings Button be displayed.

*/
web_app_setup_swipe_behavior: CreateParams<{
web_app_setup_swipe_behavior: CreateMethodParams<{
allow_vertical_swipe: boolean;

@@ -452,3 +464,3 @@ }>;

*/
web_app_share_to_story: CreateParams<{
web_app_share_to_story: CreateMethodParams<{
/**

@@ -488,3 +500,3 @@ * A media URL which will be used as a background for a created story.

*/
web_app_switch_inline_query: CreateParams<{
web_app_switch_inline_query: CreateMethodParams<{
/**

@@ -505,3 +517,3 @@ * Text which should be inserted in the input after the current bot name. Max length is

*/
web_app_trigger_haptic_feedback: CreateParams<AnyHapticFeedbackParams>;
web_app_trigger_haptic_feedback: CreateMethodParams<AnyHapticFeedbackParams>;
}

@@ -508,0 +520,0 @@

type UnionKeys<T> = T extends T ? keyof T : never;
export interface CreateParams<Params = never, VersionedParam extends UnionKeys<Params> = never> {
/**
* Creates Mini Apps method parameters types.
*/
export interface CreateMethodParams<Params = never, VersionedParam extends UnionKeys<Params> = never> {
params: Params;
versionedParams: VersionedParam;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc