@core-ease/telegram-kit 3.0.1
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/LICENSE +21 -0
- package/README.md +299 -0
- package/dist/animation/index.d.mts +4 -0
- package/dist/animation/index.d.ts +4 -0
- package/dist/animation/index.js +2413 -0
- package/dist/animation/index.mjs +5 -0
- package/dist/animation/lottie/index.d.mts +10 -0
- package/dist/animation/lottie/index.d.ts +10 -0
- package/dist/animation/lottie/index.js +2313 -0
- package/dist/animation/lottie/index.mjs +4 -0
- package/dist/animation/tgs/index.d.mts +18 -0
- package/dist/animation/tgs/index.d.ts +18 -0
- package/dist/animation/tgs/index.js +2402 -0
- package/dist/animation/tgs/index.mjs +4 -0
- package/dist/bot/index.d.mts +477 -0
- package/dist/bot/index.d.ts +477 -0
- package/dist/bot/index.js +870 -0
- package/dist/bot/index.mjs +847 -0
- package/dist/bot-D8BnLWIi.d.mts +2041 -0
- package/dist/bot-D8BnLWIi.d.ts +2041 -0
- package/dist/browser.global.js +23 -0
- package/dist/chunk-7AARTHNW.mjs +40 -0
- package/dist/chunk-7CVYPKAL.mjs +15 -0
- package/dist/chunk-B3PWALX5.mjs +4418 -0
- package/dist/chunk-BQEUEAVK.mjs +2262 -0
- package/dist/chunk-FPWYSKK2.mjs +3089 -0
- package/dist/chunk-JXK5HCDV.mjs +254 -0
- package/dist/chunk-OMH2JGOH.mjs +88 -0
- package/dist/chunk-PXO36YTU.mjs +38 -0
- package/dist/core/index.d.mts +151 -0
- package/dist/core/index.d.ts +151 -0
- package/dist/core/index.js +3837 -0
- package/dist/core/index.mjs +495 -0
- package/dist/dev/index.d.mts +77 -0
- package/dist/dev/index.d.ts +77 -0
- package/dist/dev/index.js +3214 -0
- package/dist/dev/index.mjs +151 -0
- package/dist/engine-BDm1_hzn.d.mts +382 -0
- package/dist/engine-BDm1_hzn.d.ts +382 -0
- package/dist/format/index.d.mts +61 -0
- package/dist/format/index.d.ts +61 -0
- package/dist/format/index.js +121 -0
- package/dist/format/index.mjs +112 -0
- package/dist/hooks/index.d.mts +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +4234 -0
- package/dist/hooks/index.mjs +3 -0
- package/dist/hooks-C5Per70R.d.mts +1066 -0
- package/dist/hooks-C5Per70R.d.ts +1066 -0
- package/dist/index.d.mts +849 -0
- package/dist/index.d.ts +849 -0
- package/dist/index.js +5026 -0
- package/dist/index.mjs +478 -0
- package/dist/keyboards/index.d.mts +50 -0
- package/dist/keyboards/index.d.ts +50 -0
- package/dist/keyboards/index.js +127 -0
- package/dist/keyboards/index.mjs +124 -0
- package/dist/links/index.d.mts +53 -0
- package/dist/links/index.d.ts +53 -0
- package/dist/links/index.js +139 -0
- package/dist/links/index.mjs +133 -0
- package/dist/lottie/index.d.mts +3 -0
- package/dist/lottie/index.d.ts +3 -0
- package/dist/lottie/index.js +2313 -0
- package/dist/lottie/index.mjs +4 -0
- package/dist/qr/index.d.mts +75 -0
- package/dist/qr/index.d.ts +75 -0
- package/dist/qr/index.js +983 -0
- package/dist/qr/index.mjs +946 -0
- package/dist/sdk/index.d.mts +322 -0
- package/dist/sdk/index.d.ts +322 -0
- package/dist/sdk/index.js +3138 -0
- package/dist/sdk/index.mjs +2 -0
- package/dist/server/index.d.mts +28 -0
- package/dist/server/index.d.ts +28 -0
- package/dist/server/index.js +254 -0
- package/dist/server/index.mjs +246 -0
- package/dist/tgs/index.d.mts +3 -0
- package/dist/tgs/index.d.ts +3 -0
- package/dist/tgs/index.js +2402 -0
- package/dist/tgs/index.mjs +4 -0
- package/dist/webapp-B-3_74nK.d.mts +842 -0
- package/dist/webapp-B-3_74nK.d.ts +842 -0
- package/dist/webapp-BDi9q3-a.d.mts +42 -0
- package/dist/webapp-YvmwFYUQ.d.ts +42 -0
- package/package.json +165 -0
|
@@ -0,0 +1,842 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure, side-effect-light helper functions.
|
|
3
|
+
* Direct TypeScript port of the `window.Telegram.Utils` helpers plus a
|
|
4
|
+
* handful of private helpers that lived as free functions in the original
|
|
5
|
+
* IIFE (strTrim, byteLength, versionCompare, parseColorToHex, isColorDark).
|
|
6
|
+
*/
|
|
7
|
+
declare function urlSafeDecode(urlencoded: string): string;
|
|
8
|
+
declare function urlParseQueryString(queryString: string): Record<string, string | null>;
|
|
9
|
+
declare function urlParseHashParams(locationHash: string): Record<string, any>;
|
|
10
|
+
/**
|
|
11
|
+
* Telegram apps use this to add service params (e.g. tgShareScoreUrl) to a
|
|
12
|
+
* game URL.
|
|
13
|
+
* url looks like 'https://game.com/path?query=1#hash'
|
|
14
|
+
* addHash looks like 'tgShareScoreUrl=' + encodeURIComponent('tgb://share_game_score?hash=very_long_hash123')
|
|
15
|
+
*/
|
|
16
|
+
declare function urlAppendHashParams(url: string, addHash: string): string;
|
|
17
|
+
declare function sessionStorageSet(key: string, value: unknown): boolean;
|
|
18
|
+
declare function sessionStorageGet<T = any>(key: string): T | null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Shared type definitions for the Telegram WebApp SDK port.
|
|
22
|
+
*
|
|
23
|
+
* These types describe the wire format exchanged with the native Telegram
|
|
24
|
+
* client (postEvent/receiveEvent payloads) as well as the public-facing
|
|
25
|
+
* shapes exposed to the Mini App developer. Kept in one file so every
|
|
26
|
+
* module (core, ui, features, theme) can depend on a single source of truth.
|
|
27
|
+
*/
|
|
28
|
+
/** Generic string-keyed dictionary used for loosely-typed event payloads. */
|
|
29
|
+
type AnyRecord = Record<string, any>;
|
|
30
|
+
/** Callback signature used throughout the SDK for fire-and-forget events. */
|
|
31
|
+
type VoidCallback = (...args: any[]) => void;
|
|
32
|
+
/** Handler used internally by the WebView event bus. */
|
|
33
|
+
type EventHandler = (eventType: string, eventData: any) => void;
|
|
34
|
+
/** Raw key/value hash-params parsed from `location.hash`. */
|
|
35
|
+
interface InitParams extends AnyRecord {
|
|
36
|
+
_path?: string;
|
|
37
|
+
tgWebAppData?: string;
|
|
38
|
+
tgWebAppThemeParams?: string;
|
|
39
|
+
tgWebAppDefaultColors?: string;
|
|
40
|
+
tgWebAppVersion?: string;
|
|
41
|
+
tgWebAppPlatform?: string;
|
|
42
|
+
tgWebAppFullscreen?: string;
|
|
43
|
+
tgWebAppShowSettings?: string;
|
|
44
|
+
tgWebAppBotInline?: string;
|
|
45
|
+
tgWebAppDebug?: string;
|
|
46
|
+
}
|
|
47
|
+
/** Theme color palette pushed by the Telegram client. */
|
|
48
|
+
interface ThemeParams extends AnyRecord {
|
|
49
|
+
bg_color?: string;
|
|
50
|
+
text_color?: string;
|
|
51
|
+
hint_color?: string;
|
|
52
|
+
link_color?: string;
|
|
53
|
+
button_color?: string;
|
|
54
|
+
button_text_color?: string;
|
|
55
|
+
secondary_bg_color?: string;
|
|
56
|
+
header_bg_color?: string;
|
|
57
|
+
bottom_bar_bg_color?: string;
|
|
58
|
+
accent_text_color?: string;
|
|
59
|
+
section_bg_color?: string;
|
|
60
|
+
section_header_text_color?: string;
|
|
61
|
+
section_separator_color?: string;
|
|
62
|
+
subtitle_text_color?: string;
|
|
63
|
+
destructive_text_color?: string;
|
|
64
|
+
}
|
|
65
|
+
/** Default (fallback) colors sent alongside theme params. */
|
|
66
|
+
interface DefaultColors {
|
|
67
|
+
bg_color?: string;
|
|
68
|
+
bg_dark_color?: string;
|
|
69
|
+
header_color?: string;
|
|
70
|
+
header_dark_color?: string;
|
|
71
|
+
}
|
|
72
|
+
type ColorScheme = 'light' | 'dark';
|
|
73
|
+
interface SafeAreaInset {
|
|
74
|
+
top: number;
|
|
75
|
+
bottom: number;
|
|
76
|
+
left: number;
|
|
77
|
+
right: number;
|
|
78
|
+
}
|
|
79
|
+
/** `Telegram.WebApp.initDataUnsafe` shape - untrusted, parsed client-side. */
|
|
80
|
+
interface WebAppInitDataUnsafe extends AnyRecord {
|
|
81
|
+
query_id?: string;
|
|
82
|
+
user?: WebAppUser;
|
|
83
|
+
receiver?: WebAppUser;
|
|
84
|
+
chat?: WebAppChat;
|
|
85
|
+
chat_type?: string;
|
|
86
|
+
chat_instance?: string;
|
|
87
|
+
start_param?: string;
|
|
88
|
+
can_send_after?: number;
|
|
89
|
+
auth_date?: string;
|
|
90
|
+
hash?: string;
|
|
91
|
+
signature?: string;
|
|
92
|
+
}
|
|
93
|
+
interface WebAppUser extends AnyRecord {
|
|
94
|
+
id: number;
|
|
95
|
+
is_bot?: boolean;
|
|
96
|
+
first_name: string;
|
|
97
|
+
last_name?: string;
|
|
98
|
+
username?: string;
|
|
99
|
+
language_code?: string;
|
|
100
|
+
is_premium?: boolean;
|
|
101
|
+
added_to_attachment_menu?: boolean;
|
|
102
|
+
allows_write_to_pm?: boolean;
|
|
103
|
+
photo_url?: string;
|
|
104
|
+
}
|
|
105
|
+
interface WebAppChat extends AnyRecord {
|
|
106
|
+
id: number;
|
|
107
|
+
type: string;
|
|
108
|
+
title: string;
|
|
109
|
+
username?: string;
|
|
110
|
+
photo_url?: string;
|
|
111
|
+
}
|
|
112
|
+
/** Button position for the SecondaryButton relative to the MainButton. */
|
|
113
|
+
type BottomButtonPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
114
|
+
interface BottomButtonParams {
|
|
115
|
+
is_visible?: boolean;
|
|
116
|
+
is_active?: boolean;
|
|
117
|
+
is_progress_visible?: boolean;
|
|
118
|
+
icon_custom_emoji_id?: string | false | null;
|
|
119
|
+
text?: string;
|
|
120
|
+
color?: string | false | null;
|
|
121
|
+
text_color?: string | false | null;
|
|
122
|
+
has_shine_effect?: boolean;
|
|
123
|
+
position?: BottomButtonPosition;
|
|
124
|
+
}
|
|
125
|
+
type PopupButtonType = 'default' | 'ok' | 'close' | 'cancel' | 'destructive';
|
|
126
|
+
interface PopupButton {
|
|
127
|
+
id?: string | number;
|
|
128
|
+
type?: PopupButtonType;
|
|
129
|
+
text?: string;
|
|
130
|
+
}
|
|
131
|
+
interface PopupParams {
|
|
132
|
+
title?: string;
|
|
133
|
+
message: string;
|
|
134
|
+
buttons?: PopupButton[];
|
|
135
|
+
}
|
|
136
|
+
interface ScanQrPopupParams {
|
|
137
|
+
text?: string;
|
|
138
|
+
}
|
|
139
|
+
interface OpenLinkOptions {
|
|
140
|
+
try_instant_view?: boolean;
|
|
141
|
+
try_browser?: string;
|
|
142
|
+
}
|
|
143
|
+
interface OpenTelegramLinkOptions {
|
|
144
|
+
force_request?: boolean;
|
|
145
|
+
}
|
|
146
|
+
interface CloseOptions {
|
|
147
|
+
return_back?: boolean;
|
|
148
|
+
}
|
|
149
|
+
type HapticImpactStyle = 'light' | 'medium' | 'heavy' | 'rigid' | 'soft';
|
|
150
|
+
type HapticNotificationType = 'error' | 'success' | 'warning';
|
|
151
|
+
type HomeScreenStatus = 'unsupported' | 'unknown' | 'added' | 'missed';
|
|
152
|
+
type BiometricType = 'unknown' | 'finger' | 'face';
|
|
153
|
+
interface BiometricRequestAccessParams {
|
|
154
|
+
reason?: string;
|
|
155
|
+
}
|
|
156
|
+
interface BiometricAuthenticateParams {
|
|
157
|
+
reason?: string;
|
|
158
|
+
}
|
|
159
|
+
interface LocationData {
|
|
160
|
+
latitude: number;
|
|
161
|
+
longitude: number;
|
|
162
|
+
altitude: number | null;
|
|
163
|
+
course: number | null;
|
|
164
|
+
speed: number | null;
|
|
165
|
+
horizontal_accuracy: number | null;
|
|
166
|
+
vertical_accuracy: number | null;
|
|
167
|
+
course_accuracy: number | null;
|
|
168
|
+
speed_accuracy: number | null;
|
|
169
|
+
}
|
|
170
|
+
interface MotionSensorStartParams {
|
|
171
|
+
refresh_rate?: number;
|
|
172
|
+
}
|
|
173
|
+
interface DeviceOrientationStartParams extends MotionSensorStartParams {
|
|
174
|
+
need_absolute?: boolean;
|
|
175
|
+
}
|
|
176
|
+
interface DownloadFileParams {
|
|
177
|
+
url: string;
|
|
178
|
+
file_name: string;
|
|
179
|
+
}
|
|
180
|
+
interface ShareToStoryWidgetLink {
|
|
181
|
+
url: string;
|
|
182
|
+
name?: string;
|
|
183
|
+
}
|
|
184
|
+
interface ShareToStoryParams {
|
|
185
|
+
text?: string;
|
|
186
|
+
widget_link?: ShareToStoryWidgetLink;
|
|
187
|
+
}
|
|
188
|
+
/** Two-way callback shape shared by storage-like features (err-first). */
|
|
189
|
+
type ErrCallback<T = any> = (error: string | null, result?: T) => void;
|
|
190
|
+
/** Generic result callback for CloudStorage.getItems(). */
|
|
191
|
+
type ItemsCallback = ErrCallback<Record<string, string>>;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* WebView bridge / transport layer.
|
|
195
|
+
*
|
|
196
|
+
* This is a faithful port of the first `(function () { ... })()` block in
|
|
197
|
+
* the original telegram-web-app.js: it is responsible for talking to the
|
|
198
|
+
* native Telegram client (Android/iOS WebView proxy, Windows `external`
|
|
199
|
+
* bridge, or a browser `postMessage` iframe bridge) and for the generic
|
|
200
|
+
* pub/sub event bus that every higher-level feature (WebApp, buttons,
|
|
201
|
+
* storages, sensors, ...) is built on top of.
|
|
202
|
+
*
|
|
203
|
+
* Nothing Telegram.WebApp-specific lives here on purpose: this module only
|
|
204
|
+
* knows how to send/receive named events and parse the initial hash params.
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
declare global {
|
|
208
|
+
interface Window {
|
|
209
|
+
TelegramWebviewProxy?: {
|
|
210
|
+
postEvent(eventType: string, eventData: string): void;
|
|
211
|
+
};
|
|
212
|
+
TelegramGameProxy_receiveEvent?: (eventType: string, eventData: any) => void;
|
|
213
|
+
TelegramGameProxy?: {
|
|
214
|
+
receiveEvent: (eventType: string, eventData: any) => void;
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
type PostEventCallback = (error?: {
|
|
219
|
+
notAvailable?: true;
|
|
220
|
+
} | Error | undefined) => void;
|
|
221
|
+
declare class TelegramWebView {
|
|
222
|
+
readonly initParams: InitParams;
|
|
223
|
+
readonly isIframe: boolean;
|
|
224
|
+
private eventHandlers;
|
|
225
|
+
private iFrameStyleEl;
|
|
226
|
+
constructor();
|
|
227
|
+
private handleParentMessage;
|
|
228
|
+
/** Sends a named event + payload to the native Telegram client. */
|
|
229
|
+
postEvent(eventType: string, callback?: PostEventCallback, eventData?: unknown): void;
|
|
230
|
+
/** Dispatches an incoming event to every subscriber of `eventType`. */
|
|
231
|
+
receiveEvent: (eventType: string, eventData: any) => void;
|
|
232
|
+
callEventCallbacks(eventType: string, func: (handler: EventHandler) => void): void;
|
|
233
|
+
onEvent(eventType: string, callback: EventHandler): void;
|
|
234
|
+
offEvent(eventType: string, callback: EventHandler): void;
|
|
235
|
+
}
|
|
236
|
+
/** Re-exported so consumers of `window.Telegram.Utils` keep the same surface. */
|
|
237
|
+
declare const Utils: {
|
|
238
|
+
urlSafeDecode: typeof urlSafeDecode;
|
|
239
|
+
urlParseQueryString: typeof urlParseQueryString;
|
|
240
|
+
urlParseHashParams: typeof urlParseHashParams;
|
|
241
|
+
urlAppendHashParams: typeof urlAppendHashParams;
|
|
242
|
+
sessionStorageSet: typeof sessionStorageSet;
|
|
243
|
+
sessionStorageGet: typeof sessionStorageGet;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* WebApp-level kernel.
|
|
248
|
+
*
|
|
249
|
+
* The original script keeps a pile of closures (`versionAtLeast`,
|
|
250
|
+
* `receiveWebViewEvent`, `webAppCallbacks`, `generateCallbackId`,
|
|
251
|
+
* `setCssProperty`, `invokeCustomMethod`, ...) that every feature
|
|
252
|
+
* (buttons, storages, sensors, popups...) reaches into.
|
|
253
|
+
*
|
|
254
|
+
* To keep the TypeScript port modular while preserving that exact runtime
|
|
255
|
+
* behavior, those closures are grouped into one small `WebAppKernel` class
|
|
256
|
+
* that gets constructed once and injected into every feature module. This
|
|
257
|
+
* is the *only* piece of shared mutable plumbing; everything else lives in
|
|
258
|
+
* its own dedicated module.
|
|
259
|
+
*/
|
|
260
|
+
|
|
261
|
+
type WebAppCallback = (...args: any[]) => void;
|
|
262
|
+
interface PendingCallback {
|
|
263
|
+
callback?: WebAppCallback;
|
|
264
|
+
}
|
|
265
|
+
declare class WebAppKernel {
|
|
266
|
+
readonly webView: TelegramWebView;
|
|
267
|
+
readonly initParams: InitParams;
|
|
268
|
+
/** Mutable current protocol version reported by the client, e.g. '8.0'. */
|
|
269
|
+
private _version;
|
|
270
|
+
private callbacks;
|
|
271
|
+
/** Height (px) reserved by the in-browser debug bottom bar, if active. */
|
|
272
|
+
bottomBarHeightPx: number;
|
|
273
|
+
constructor(webView: TelegramWebView);
|
|
274
|
+
get version(): string;
|
|
275
|
+
set version(v: string);
|
|
276
|
+
versionAtLeast(ver: string): boolean;
|
|
277
|
+
/** Logs + throws `WebAppMethodUnsupported` for a method gated by version. */
|
|
278
|
+
requireVersion(ver: string, methodName: string): void;
|
|
279
|
+
/** Same as {@link requireVersion} but warns instead of throwing (soft-gated features). */
|
|
280
|
+
warnIfUnsupported(ver: string, featureName: string): boolean;
|
|
281
|
+
setCssProperty(name: string, value: string): void;
|
|
282
|
+
strTrim(str: unknown): string;
|
|
283
|
+
byteLength(str: string): number;
|
|
284
|
+
/** Dispatches an internal `webview:<eventType>` event to WebApp-level subscribers. */
|
|
285
|
+
receiveWebViewEvent(eventType: string, ...args: any[]): void;
|
|
286
|
+
onWebViewEvent(eventType: string, callback: EventHandler): void;
|
|
287
|
+
offWebViewEvent(eventType: string, callback: EventHandler): void;
|
|
288
|
+
/** Allocates a fresh request id and registers its pending callback. */
|
|
289
|
+
registerCallback(callback?: WebAppCallback, len?: number): string;
|
|
290
|
+
takeCallback(reqId: string): PendingCallback | undefined;
|
|
291
|
+
hasCallback(reqId: string): boolean;
|
|
292
|
+
/** Generic `web_app_invoke_custom_method` used by CloudStorage, contact lookup, etc. */
|
|
293
|
+
invokeCustomMethod(method: string, params: AnyRecordLike | undefined, callback?: WebAppCallback): void;
|
|
294
|
+
onCustomMethodInvoked: (_eventType: string, eventData: any) => void;
|
|
295
|
+
}
|
|
296
|
+
type AnyRecordLike = Record<string, any>;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* `Telegram.WebApp.BackButton` - port of the `BackButton` IIFE.
|
|
300
|
+
*/
|
|
301
|
+
|
|
302
|
+
declare class BackButton {
|
|
303
|
+
private readonly kernel;
|
|
304
|
+
private _isVisible;
|
|
305
|
+
private curButtonState;
|
|
306
|
+
constructor(kernel: WebAppKernel);
|
|
307
|
+
private handleBackButtonPressed;
|
|
308
|
+
get isVisible(): boolean;
|
|
309
|
+
set isVisible(val: boolean);
|
|
310
|
+
private checkVersion;
|
|
311
|
+
private buttonParams;
|
|
312
|
+
private updateButton;
|
|
313
|
+
setParams(params: {
|
|
314
|
+
is_visible?: boolean;
|
|
315
|
+
}): this;
|
|
316
|
+
onClick(callback: VoidCallback): this;
|
|
317
|
+
offClick(callback: VoidCallback): this;
|
|
318
|
+
show(): this;
|
|
319
|
+
hide(): this;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Debug bottom bar - the little on-page mock of Telegram's native Main /
|
|
324
|
+
* Secondary button bar, shown only when `tgWebAppDebug` is present in the
|
|
325
|
+
* init hash params (i.e. when testing a Mini App directly in a desktop
|
|
326
|
+
* browser instead of inside the real Telegram client).
|
|
327
|
+
*
|
|
328
|
+
* Isolated into its own module so it can be tree-shaken/omitted entirely in
|
|
329
|
+
* builds that never run in debug mode, and so `BottomButton` doesn't need
|
|
330
|
+
* to know anything about DOM styling.
|
|
331
|
+
*/
|
|
332
|
+
|
|
333
|
+
interface DebugButtonVisualState {
|
|
334
|
+
is_visible?: boolean;
|
|
335
|
+
is_active?: boolean;
|
|
336
|
+
is_progress_visible?: boolean;
|
|
337
|
+
text?: string;
|
|
338
|
+
color?: string;
|
|
339
|
+
text_color?: string;
|
|
340
|
+
has_shine_effect?: boolean;
|
|
341
|
+
}
|
|
342
|
+
type ButtonType = 'main' | 'secondary';
|
|
343
|
+
declare class DebugBottomBar {
|
|
344
|
+
private readonly kernel;
|
|
345
|
+
private readonly getBottomBarColor;
|
|
346
|
+
readonly enabled: boolean;
|
|
347
|
+
private container;
|
|
348
|
+
private buttons;
|
|
349
|
+
/** Invoked whenever the reserved bottom-bar height changes. */
|
|
350
|
+
onHeightChanged: (() => void) | null;
|
|
351
|
+
constructor(kernel: WebAppKernel, getBottomBarColor: () => string);
|
|
352
|
+
/** Creates & registers a debug clone of a Main/Secondary button; returns its element. */
|
|
353
|
+
registerButton(type: ButtonType, onPressed: () => void): HTMLElement | null;
|
|
354
|
+
/** Applies visual state coming from `BottomButton.buttonParams()`. */
|
|
355
|
+
updateButtonVisual(type: ButtonType, params: DebugButtonVisualState & {
|
|
356
|
+
position?: BottomButtonPosition;
|
|
357
|
+
}): void;
|
|
358
|
+
private updateBar;
|
|
359
|
+
/** Called after the bottom-bar color changes so the debug bar repaints too. */
|
|
360
|
+
refreshColor(): void;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Theme & chrome-color manager.
|
|
365
|
+
*
|
|
366
|
+
* Owns `themeParams`, `colorScheme`, `headerColor`, `backgroundColor` and
|
|
367
|
+
* `bottomBarColor` - i.e. everything the original script updates whenever a
|
|
368
|
+
* `theme_changed` event arrives or the developer calls one of the
|
|
369
|
+
* `set*Color` setters.
|
|
370
|
+
*/
|
|
371
|
+
|
|
372
|
+
declare class ThemeManager {
|
|
373
|
+
private readonly kernel;
|
|
374
|
+
private themeParams;
|
|
375
|
+
private _colorScheme;
|
|
376
|
+
private backgroundColorValue;
|
|
377
|
+
private appBackgroundColor;
|
|
378
|
+
private headerColorKey;
|
|
379
|
+
private headerColorValue;
|
|
380
|
+
private appHeaderColorKey;
|
|
381
|
+
private appHeaderColorValue;
|
|
382
|
+
private bottomBarColorValue;
|
|
383
|
+
private appBottomBarColor;
|
|
384
|
+
/** Called after every bottom-bar color update, e.g. to refresh the debug bar. */
|
|
385
|
+
onBottomBarColorApplied: (() => void) | null;
|
|
386
|
+
constructor(kernel: WebAppKernel);
|
|
387
|
+
get colorScheme(): ColorScheme;
|
|
388
|
+
getThemeParams(): ThemeParams;
|
|
389
|
+
setThemeParams(theme: ThemeParams): void;
|
|
390
|
+
setDefaultColors(defColors: DefaultColors): void;
|
|
391
|
+
getHeaderColor(): string | null | undefined;
|
|
392
|
+
setHeaderColor(color: string): void;
|
|
393
|
+
updateHeaderColor(): void;
|
|
394
|
+
getBackgroundColor(): string | undefined;
|
|
395
|
+
setBackgroundColor(color: string): void;
|
|
396
|
+
updateBackgroundColor(): void;
|
|
397
|
+
getBottomBarColor(): string;
|
|
398
|
+
setBottomBarColor(color: string): void;
|
|
399
|
+
updateBottomBarColor(): void;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* `Telegram.WebApp.MainButton` / `Telegram.WebApp.SecondaryButton`.
|
|
404
|
+
*
|
|
405
|
+
* Both buttons share 100% of their behavior in the original SDK
|
|
406
|
+
* (`BottomButtonConstructor(type)`); this class keeps that single
|
|
407
|
+
* implementation and is instantiated twice by the WebApp aggregator.
|
|
408
|
+
*/
|
|
409
|
+
|
|
410
|
+
type BottomButtonType = 'main' | 'secondary';
|
|
411
|
+
interface SetBottomButtonParams {
|
|
412
|
+
text?: string;
|
|
413
|
+
color?: string | false | null;
|
|
414
|
+
text_color?: string | false | null;
|
|
415
|
+
is_visible?: boolean;
|
|
416
|
+
is_active?: boolean;
|
|
417
|
+
has_shine_effect?: boolean;
|
|
418
|
+
position?: BottomButtonPosition;
|
|
419
|
+
icon_custom_emoji_id?: string | false | null;
|
|
420
|
+
}
|
|
421
|
+
declare class BottomButton {
|
|
422
|
+
private readonly kernel;
|
|
423
|
+
private readonly theme;
|
|
424
|
+
private readonly debugBar;
|
|
425
|
+
readonly type: BottomButtonType;
|
|
426
|
+
private isVisibleValue;
|
|
427
|
+
private isActiveValue;
|
|
428
|
+
private hasShineEffectValue;
|
|
429
|
+
private isProgressVisibleValue;
|
|
430
|
+
private iconCustomEmojiIdValue;
|
|
431
|
+
private textValue;
|
|
432
|
+
private colorValue;
|
|
433
|
+
private textColorValue;
|
|
434
|
+
private positionValue;
|
|
435
|
+
private curButtonState;
|
|
436
|
+
private readonly isMain;
|
|
437
|
+
private readonly setupEventName;
|
|
438
|
+
private readonly nativePressEventName;
|
|
439
|
+
private readonly webViewEventName;
|
|
440
|
+
private readonly defaultText;
|
|
441
|
+
private readonly defaultColor;
|
|
442
|
+
private readonly defaultTextColor;
|
|
443
|
+
constructor(type: BottomButtonType, kernel: WebAppKernel, theme: ThemeManager, debugBar: DebugBottomBar);
|
|
444
|
+
private handlePressed;
|
|
445
|
+
get iconCustomEmojiId(): string | false;
|
|
446
|
+
set iconCustomEmojiId(val: string | false);
|
|
447
|
+
get text(): string;
|
|
448
|
+
set text(val: string);
|
|
449
|
+
get color(): string;
|
|
450
|
+
set color(val: string);
|
|
451
|
+
get textColor(): string;
|
|
452
|
+
set textColor(val: string);
|
|
453
|
+
get isVisible(): boolean;
|
|
454
|
+
set isVisible(val: boolean);
|
|
455
|
+
get isProgressVisible(): boolean;
|
|
456
|
+
get isActive(): boolean;
|
|
457
|
+
set isActive(val: boolean);
|
|
458
|
+
get hasShineEffect(): boolean;
|
|
459
|
+
set hasShineEffect(val: boolean);
|
|
460
|
+
get position(): BottomButtonPosition;
|
|
461
|
+
set position(val: BottomButtonPosition);
|
|
462
|
+
private buttonParams;
|
|
463
|
+
private updateButton;
|
|
464
|
+
setParams(params: SetBottomButtonParams): this;
|
|
465
|
+
setText(text: string): this;
|
|
466
|
+
onClick(callback: VoidCallback): this;
|
|
467
|
+
offClick(callback: VoidCallback): this;
|
|
468
|
+
show(): this;
|
|
469
|
+
hide(): this;
|
|
470
|
+
enable(): this;
|
|
471
|
+
disable(): this;
|
|
472
|
+
showProgress(leaveActive?: boolean): this;
|
|
473
|
+
hideProgress(): this;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* `Telegram.WebApp.SettingsButton` - port of the `SettingsButton` IIFE.
|
|
478
|
+
*/
|
|
479
|
+
|
|
480
|
+
declare class SettingsButton {
|
|
481
|
+
private readonly kernel;
|
|
482
|
+
private _isVisible;
|
|
483
|
+
private curButtonState;
|
|
484
|
+
constructor(kernel: WebAppKernel);
|
|
485
|
+
private handleSettingsButtonPressed;
|
|
486
|
+
get isVisible(): boolean;
|
|
487
|
+
set isVisible(val: boolean);
|
|
488
|
+
private checkVersion;
|
|
489
|
+
private buttonParams;
|
|
490
|
+
private updateButton;
|
|
491
|
+
setParams(params: {
|
|
492
|
+
is_visible?: boolean;
|
|
493
|
+
}): this;
|
|
494
|
+
onClick(callback: VoidCallback): this;
|
|
495
|
+
offClick(callback: VoidCallback): this;
|
|
496
|
+
show(): this;
|
|
497
|
+
hide(): this;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* `Telegram.WebApp.HapticFeedback`.
|
|
502
|
+
*/
|
|
503
|
+
|
|
504
|
+
declare class HapticFeedback {
|
|
505
|
+
private readonly kernel;
|
|
506
|
+
constructor(kernel: WebAppKernel);
|
|
507
|
+
private trigger;
|
|
508
|
+
impactOccurred(style: HapticImpactStyle): this;
|
|
509
|
+
notificationOccurred(type: HapticNotificationType): this;
|
|
510
|
+
selectionChanged(): this;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* `Telegram.WebApp.CloudStorage`.
|
|
515
|
+
*/
|
|
516
|
+
|
|
517
|
+
declare class CloudStorage {
|
|
518
|
+
private readonly kernel;
|
|
519
|
+
constructor(kernel: WebAppKernel);
|
|
520
|
+
private invoke;
|
|
521
|
+
setItem(key: string, value: string, callback?: ErrCallback): this;
|
|
522
|
+
getItem(key: string, callback?: ErrCallback<string>): this;
|
|
523
|
+
getItems(keys: string[], callback?: ItemsCallback): this;
|
|
524
|
+
removeItem(key: string, callback?: ErrCallback): this;
|
|
525
|
+
removeItems(keys: string[], callback?: ErrCallback): this;
|
|
526
|
+
getKeys(callback?: ErrCallback<string[]>): this;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* `Telegram.WebApp.DeviceStorage`.
|
|
531
|
+
*/
|
|
532
|
+
|
|
533
|
+
declare class DeviceStorage {
|
|
534
|
+
private readonly kernel;
|
|
535
|
+
constructor(kernel: WebAppKernel);
|
|
536
|
+
private handleEvent;
|
|
537
|
+
private invoke;
|
|
538
|
+
setItem(key: string, value: string, callback?: ErrCallback): this;
|
|
539
|
+
getItem(key: string, callback?: ErrCallback<string>): this;
|
|
540
|
+
removeItem(key: string, callback?: ErrCallback): this;
|
|
541
|
+
clear(callback?: ErrCallback): this;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* `Telegram.WebApp.SecureStorage`.
|
|
546
|
+
*/
|
|
547
|
+
|
|
548
|
+
type SecureStorageCallback = (error: string | null, result?: any, canRestore?: boolean) => void;
|
|
549
|
+
declare class SecureStorage {
|
|
550
|
+
private readonly kernel;
|
|
551
|
+
constructor(kernel: WebAppKernel);
|
|
552
|
+
private handleEvent;
|
|
553
|
+
private invoke;
|
|
554
|
+
setItem(key: string, value: string, callback?: SecureStorageCallback): this;
|
|
555
|
+
getItem(key: string, callback?: SecureStorageCallback): this;
|
|
556
|
+
restoreItem(key: string, callback?: SecureStorageCallback): this;
|
|
557
|
+
removeItem(key: string, callback?: SecureStorageCallback): this;
|
|
558
|
+
clear(callback?: SecureStorageCallback): this;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* `Telegram.WebApp.BiometricManager`.
|
|
563
|
+
*/
|
|
564
|
+
|
|
565
|
+
type InitCallback$1 = () => void;
|
|
566
|
+
type AccessCallback = (granted: boolean) => void;
|
|
567
|
+
type AuthCallback = (authenticated: boolean, token: string | null) => void;
|
|
568
|
+
type TokenCallback = (applied: boolean) => void;
|
|
569
|
+
declare class BiometricManager {
|
|
570
|
+
private readonly kernel;
|
|
571
|
+
private _isInited;
|
|
572
|
+
private _isBiometricAvailable;
|
|
573
|
+
private _biometricType;
|
|
574
|
+
private _isAccessRequested;
|
|
575
|
+
private _isAccessGranted;
|
|
576
|
+
private _isBiometricTokenSaved;
|
|
577
|
+
private _deviceId;
|
|
578
|
+
private initCallbacks;
|
|
579
|
+
private accessRequestState;
|
|
580
|
+
private authRequestState;
|
|
581
|
+
private tokenRequestState;
|
|
582
|
+
constructor(kernel: WebAppKernel);
|
|
583
|
+
get isInited(): boolean;
|
|
584
|
+
get isBiometricAvailable(): boolean;
|
|
585
|
+
get biometricType(): BiometricType;
|
|
586
|
+
get isAccessRequested(): boolean;
|
|
587
|
+
get isAccessGranted(): boolean;
|
|
588
|
+
get isBiometricTokenSaved(): boolean;
|
|
589
|
+
get deviceId(): string;
|
|
590
|
+
private handleInfoReceived;
|
|
591
|
+
private handleAuthRequested;
|
|
592
|
+
private handleTokenUpdated;
|
|
593
|
+
private checkVersion;
|
|
594
|
+
private checkInit;
|
|
595
|
+
init(callback?: InitCallback$1): this;
|
|
596
|
+
requestAccess(params: BiometricRequestAccessParams, callback?: AccessCallback): this;
|
|
597
|
+
authenticate(params: BiometricAuthenticateParams, callback?: AuthCallback): this;
|
|
598
|
+
updateBiometricToken(token: string, callback?: TokenCallback): this;
|
|
599
|
+
openSettings(): this;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* `Telegram.WebApp.LocationManager`.
|
|
604
|
+
*/
|
|
605
|
+
|
|
606
|
+
type InitCallback = () => void;
|
|
607
|
+
type GetLocationCallback = (data: LocationData | null) => void;
|
|
608
|
+
declare class LocationManager {
|
|
609
|
+
private readonly kernel;
|
|
610
|
+
private _isInited;
|
|
611
|
+
private _isLocationAvailable;
|
|
612
|
+
private _isAccessRequested;
|
|
613
|
+
private _isAccessGranted;
|
|
614
|
+
private initCallbacks;
|
|
615
|
+
private getRequestCallbacks;
|
|
616
|
+
constructor(kernel: WebAppKernel);
|
|
617
|
+
get isInited(): boolean;
|
|
618
|
+
get isLocationAvailable(): boolean;
|
|
619
|
+
get isAccessRequested(): boolean;
|
|
620
|
+
get isAccessGranted(): boolean;
|
|
621
|
+
private handleLocationChecked;
|
|
622
|
+
private handleLocationRequested;
|
|
623
|
+
private locationResponse;
|
|
624
|
+
private checkVersion;
|
|
625
|
+
private checkInit;
|
|
626
|
+
init(callback?: InitCallback): this;
|
|
627
|
+
getLocation(callback: GetLocationCallback): this;
|
|
628
|
+
openSettings(): this;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Shared implementation for the three near-identical motion sensors
|
|
633
|
+
* (`Accelerometer`, `Gyroscope`, `DeviceOrientation`). All three follow the
|
|
634
|
+
* exact same start/stop/changed/failed event protocol in the original SDK,
|
|
635
|
+
* differing only in event names and payload shape - so we factor that
|
|
636
|
+
* protocol out once here and let each sensor supply its own config +
|
|
637
|
+
* payload mapping.
|
|
638
|
+
*/
|
|
639
|
+
|
|
640
|
+
interface MotionSensorEventNames {
|
|
641
|
+
started: string;
|
|
642
|
+
stopped: string;
|
|
643
|
+
changed: string;
|
|
644
|
+
failed: string;
|
|
645
|
+
webViewStarted: string;
|
|
646
|
+
webViewStopped: string;
|
|
647
|
+
webViewChanged: string;
|
|
648
|
+
webViewFailed: string;
|
|
649
|
+
startCommand: string;
|
|
650
|
+
stopCommand: string;
|
|
651
|
+
minVersion: string;
|
|
652
|
+
displayName: string;
|
|
653
|
+
}
|
|
654
|
+
type StartCallback = (success: boolean) => void;
|
|
655
|
+
type StopCallback = (success: boolean) => void;
|
|
656
|
+
declare abstract class MotionSensorBase<TValues extends Record<string, any>> {
|
|
657
|
+
protected readonly kernel: WebAppKernel;
|
|
658
|
+
private readonly names;
|
|
659
|
+
protected _isStarted: boolean;
|
|
660
|
+
protected values: TValues;
|
|
661
|
+
private startCallbacks;
|
|
662
|
+
private stopCallbacks;
|
|
663
|
+
protected constructor(kernel: WebAppKernel, names: MotionSensorEventNames, initialValues: TValues);
|
|
664
|
+
get isStarted(): boolean;
|
|
665
|
+
private handleStarted;
|
|
666
|
+
private handleStopped;
|
|
667
|
+
private handleChanged;
|
|
668
|
+
private handleFailed;
|
|
669
|
+
/** Subclasses map the raw `*_changed` event payload onto their typed value shape. */
|
|
670
|
+
protected abstract mapChangedPayload(eventData: any): TValues;
|
|
671
|
+
protected checkVersion(): boolean;
|
|
672
|
+
protected buildStartParams(refreshRate: unknown): {
|
|
673
|
+
refresh_rate?: number;
|
|
674
|
+
};
|
|
675
|
+
protected doStart(reqParams: Record<string, any>, callback?: StartCallback): void;
|
|
676
|
+
stop(callback?: StopCallback): this;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
interface AccelerometerValues {
|
|
680
|
+
x: number | null;
|
|
681
|
+
y: number | null;
|
|
682
|
+
z: number | null;
|
|
683
|
+
}
|
|
684
|
+
declare class Accelerometer extends MotionSensorBase<AccelerometerValues> {
|
|
685
|
+
constructor(kernel: WebAppKernel);
|
|
686
|
+
protected mapChangedPayload(eventData: any): AccelerometerValues;
|
|
687
|
+
get x(): number | null;
|
|
688
|
+
get y(): number | null;
|
|
689
|
+
get z(): number | null;
|
|
690
|
+
start(params?: MotionSensorStartParams, callback?: (success: boolean) => void): this;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
interface GyroscopeValues {
|
|
694
|
+
x: number | null;
|
|
695
|
+
y: number | null;
|
|
696
|
+
z: number | null;
|
|
697
|
+
}
|
|
698
|
+
declare class Gyroscope extends MotionSensorBase<GyroscopeValues> {
|
|
699
|
+
constructor(kernel: WebAppKernel);
|
|
700
|
+
protected mapChangedPayload(eventData: any): GyroscopeValues;
|
|
701
|
+
get x(): number | null;
|
|
702
|
+
get y(): number | null;
|
|
703
|
+
get z(): number | null;
|
|
704
|
+
start(params?: MotionSensorStartParams, callback?: (success: boolean) => void): this;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
interface DeviceOrientationValues {
|
|
708
|
+
absolute: boolean;
|
|
709
|
+
alpha: number | null;
|
|
710
|
+
beta: number | null;
|
|
711
|
+
gamma: number | null;
|
|
712
|
+
}
|
|
713
|
+
declare class DeviceOrientation extends MotionSensorBase<DeviceOrientationValues> {
|
|
714
|
+
constructor(kernel: WebAppKernel);
|
|
715
|
+
protected mapChangedPayload(eventData: any): DeviceOrientationValues;
|
|
716
|
+
get absolute(): boolean;
|
|
717
|
+
get alpha(): number | null;
|
|
718
|
+
get beta(): number | null;
|
|
719
|
+
get gamma(): number | null;
|
|
720
|
+
start(params?: DeviceOrientationStartParams, callback?: (success: boolean) => void): this;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* `Telegram.WebApp` - the public-facing composition root.
|
|
725
|
+
*
|
|
726
|
+
* This class owns no protocol logic itself; it wires the kernel + every
|
|
727
|
+
* feature module together (dependency injection) and re-exposes their
|
|
728
|
+
* public surface under the exact same property/method names as the
|
|
729
|
+
* original monolithic script, so existing integrations keep working
|
|
730
|
+
* unchanged (just typed, and testable module-by-module now).
|
|
731
|
+
*
|
|
732
|
+
* Adding a new feature later means: write a small class in `features/`,
|
|
733
|
+
* `sensors/`, `ui/` or `theme/` that takes a `WebAppKernel`, then
|
|
734
|
+
* instantiate + expose it here. No other module needs to change.
|
|
735
|
+
*/
|
|
736
|
+
|
|
737
|
+
declare class WebApp {
|
|
738
|
+
readonly webView: TelegramWebView;
|
|
739
|
+
private readonly kernel;
|
|
740
|
+
private webAppInitData;
|
|
741
|
+
private webAppInitDataUnsafe;
|
|
742
|
+
private webAppPlatform;
|
|
743
|
+
private webAppIsActive;
|
|
744
|
+
private readonly theme;
|
|
745
|
+
private readonly viewport;
|
|
746
|
+
private readonly debugBar;
|
|
747
|
+
readonly BackButton: BackButton;
|
|
748
|
+
readonly MainButton: BottomButton;
|
|
749
|
+
readonly SecondaryButton: BottomButton;
|
|
750
|
+
readonly SettingsButton: SettingsButton;
|
|
751
|
+
readonly HapticFeedback: HapticFeedback;
|
|
752
|
+
readonly CloudStorage: CloudStorage;
|
|
753
|
+
readonly DeviceStorage: DeviceStorage;
|
|
754
|
+
readonly SecureStorage: SecureStorage;
|
|
755
|
+
readonly BiometricManager: BiometricManager;
|
|
756
|
+
readonly LocationManager: LocationManager;
|
|
757
|
+
readonly Accelerometer: Accelerometer;
|
|
758
|
+
readonly DeviceOrientation: DeviceOrientation;
|
|
759
|
+
readonly Gyroscope: Gyroscope;
|
|
760
|
+
private readonly popups;
|
|
761
|
+
private readonly scanQr;
|
|
762
|
+
private readonly invoices;
|
|
763
|
+
private readonly clipboard;
|
|
764
|
+
private readonly contact;
|
|
765
|
+
private readonly homeScreen;
|
|
766
|
+
private readonly downloadFileManager;
|
|
767
|
+
private readonly sharing;
|
|
768
|
+
private readonly emojiStatus;
|
|
769
|
+
private readonly links;
|
|
770
|
+
constructor(webView: TelegramWebView);
|
|
771
|
+
private handleThemeChanged;
|
|
772
|
+
private handleVisibilityChanged;
|
|
773
|
+
get initData(): string;
|
|
774
|
+
get initDataUnsafe(): WebAppInitDataUnsafe;
|
|
775
|
+
get version(): string;
|
|
776
|
+
get platform(): string;
|
|
777
|
+
get colorScheme(): ColorScheme;
|
|
778
|
+
get themeParams(): ThemeParams;
|
|
779
|
+
get isExpanded(): boolean;
|
|
780
|
+
get viewportHeight(): number;
|
|
781
|
+
get viewportStableHeight(): number;
|
|
782
|
+
get safeAreaInset(): SafeAreaInset;
|
|
783
|
+
get contentSafeAreaInset(): SafeAreaInset;
|
|
784
|
+
get isFullscreen(): boolean;
|
|
785
|
+
get isActive(): boolean;
|
|
786
|
+
get isClosingConfirmationEnabled(): boolean;
|
|
787
|
+
set isClosingConfirmationEnabled(val: boolean);
|
|
788
|
+
get isVerticalSwipesEnabled(): boolean;
|
|
789
|
+
set isVerticalSwipesEnabled(val: boolean);
|
|
790
|
+
get isOrientationLocked(): boolean;
|
|
791
|
+
set isOrientationLocked(val: boolean);
|
|
792
|
+
get headerColor(): string | null | undefined;
|
|
793
|
+
set headerColor(val: string);
|
|
794
|
+
get backgroundColor(): string | undefined;
|
|
795
|
+
set backgroundColor(val: string);
|
|
796
|
+
get bottomBarColor(): string;
|
|
797
|
+
set bottomBarColor(val: string);
|
|
798
|
+
isVersionAtLeast(ver: string): boolean;
|
|
799
|
+
setHeaderColor(colorKey: string): void;
|
|
800
|
+
setBackgroundColor(color: string): void;
|
|
801
|
+
setBottomBarColor(color: string): void;
|
|
802
|
+
enableClosingConfirmation(): void;
|
|
803
|
+
disableClosingConfirmation(): void;
|
|
804
|
+
enableVerticalSwipes(): void;
|
|
805
|
+
disableVerticalSwipes(): void;
|
|
806
|
+
lockOrientation(): void;
|
|
807
|
+
unlockOrientation(): void;
|
|
808
|
+
requestFullscreen(): void;
|
|
809
|
+
exitFullscreen(): void;
|
|
810
|
+
addToHomeScreen(): void;
|
|
811
|
+
checkHomeScreenStatus(callback?: (status: HomeScreenStatus) => void): void;
|
|
812
|
+
onEvent(eventType: string, callback: (...args: any[]) => void): void;
|
|
813
|
+
offEvent(eventType: string, callback: (...args: any[]) => void): void;
|
|
814
|
+
sendData(data: string): void;
|
|
815
|
+
switchInlineQuery(query: string, chooseChatTypes?: string[]): void;
|
|
816
|
+
openLink(url: string, options?: OpenLinkOptions): void;
|
|
817
|
+
openTelegramLink(url: string, options?: OpenTelegramLinkOptions): void;
|
|
818
|
+
openInvoice(url: string, callback?: (status: 'paid' | 'cancelled' | 'failed' | 'pending') => void): void;
|
|
819
|
+
showPopup(params: PopupParams, callback?: (buttonId: string | null) => void): void;
|
|
820
|
+
showAlert(message: string, callback?: () => void): void;
|
|
821
|
+
showConfirm(message: string, callback?: (ok: boolean) => void): void;
|
|
822
|
+
showScanQrPopup(params: ScanQrPopupParams, callback?: (data: string | null) => boolean | void): void;
|
|
823
|
+
closeScanQrPopup(): void;
|
|
824
|
+
readTextFromClipboard(callback?: (data: string | null) => void): void;
|
|
825
|
+
requestWriteAccess(callback?: (granted: boolean) => void): void;
|
|
826
|
+
requestContact(callback?: (sent: boolean, eventPayload: Record<string, any>) => void): void;
|
|
827
|
+
downloadFile(params: DownloadFileParams, callback?: (isDownloading: boolean) => void): void;
|
|
828
|
+
shareToStory(mediaUrl: string, params?: ShareToStoryParams): void;
|
|
829
|
+
shareMessage(msgId: string, callback?: (sent: boolean) => void): void;
|
|
830
|
+
requestChat(reqId: string, callback?: (sent: boolean) => void): void;
|
|
831
|
+
setEmojiStatus(customEmojiId: string, params?: {
|
|
832
|
+
duration?: number;
|
|
833
|
+
}, callback?: (applied: boolean) => void): void;
|
|
834
|
+
requestEmojiStatusAccess(callback?: (granted: boolean) => void): void;
|
|
835
|
+
invokeCustomMethod(method: string, params?: Record<string, any>, callback?: (err: any, res: any) => void): void;
|
|
836
|
+
hideKeyboard(): void;
|
|
837
|
+
ready(): void;
|
|
838
|
+
expand(): void;
|
|
839
|
+
close(options?: CloseOptions): void;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
export { Accelerometer as A, BackButton as B, type ColorScheme as C, type DownloadFileParams as D, type ErrCallback as E, LocationManager as F, Gyroscope as G, HapticFeedback as H, type InitParams as I, type PopupButton as J, type PopupButtonType as K, type LocationData as L, type MotionSensorStartParams as M, SecureStorage as N, type OpenLinkOptions as O, type PopupParams as P, SettingsButton as Q, type ShareToStoryWidgetLink as R, type ShareToStoryParams as S, type ThemeParams as T, ThemeManager as U, Utils as V, type WebAppUser as W, type VoidCallback as X, type WebAppChat as Y, type WebAppInitDataUnsafe as Z, WebApp as a, WebAppKernel as b, type SafeAreaInset as c, type ScanQrPopupParams as d, type HomeScreenStatus as e, type OpenTelegramLinkOptions as f, TelegramWebView as g, type AnyRecord as h, type BiometricAuthenticateParams as i, BiometricManager as j, type BiometricRequestAccessParams as k, type BiometricType as l, BottomButton as m, type BottomButtonParams as n, type BottomButtonPosition as o, type CloseOptions as p, CloudStorage as q, DebugBottomBar as r, type DefaultColors as s, DeviceOrientation as t, type DeviceOrientationStartParams as u, DeviceStorage as v, type EventHandler as w, type HapticImpactStyle as x, type HapticNotificationType as y, type ItemsCallback as z };
|