@tma.js/sdk 1.1.0 → 1.2.0

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.
Files changed (46) hide show
  1. package/dist/dts/bridge/events/parsers/phoneRequested.d.ts +1 -1
  2. package/dist/dts/bridge/index.d.ts +1 -0
  3. package/dist/dts/bridge/invoke-custom-method.d.ts +18 -0
  4. package/dist/dts/bridge/methods/custom-methods.d.ts +56 -0
  5. package/dist/dts/bridge/methods/index.d.ts +1 -1
  6. package/dist/dts/bridge/methods/methods.d.ts +1 -1
  7. package/dist/dts/bridge/request.d.ts +3 -12
  8. package/dist/dts/cloud-storage/CloudStorage.d.ts +7 -16
  9. package/dist/dts/index.d.ts +7 -6
  10. package/dist/dts/init/creators/createMiniApp.d.ts +3 -1
  11. package/dist/dts/mini-app/MiniApp.d.ts +34 -4
  12. package/dist/dts/mini-app/contactParser.d.ts +2 -0
  13. package/dist/dts/mini-app/types.d.ts +12 -0
  14. package/dist/dts/timeout/index.d.ts +1 -0
  15. package/dist/dts/timeout/sleep.d.ts +5 -0
  16. package/dist/dts/timeout/withTimeout.d.ts +5 -12
  17. package/dist/dts/types/index.d.ts +1 -0
  18. package/dist/dts/types/methods.d.ts +15 -0
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.iife.js +1 -1
  22. package/dist/index.iife.js.map +1 -1
  23. package/dist/index.mjs +610 -484
  24. package/dist/index.mjs.map +1 -1
  25. package/package.json +1 -1
  26. package/src/bridge/events/parsers/phoneRequested.ts +1 -1
  27. package/src/bridge/index.ts +1 -0
  28. package/src/bridge/invoke-custom-method.ts +56 -0
  29. package/src/bridge/methods/custom-methods.ts +68 -0
  30. package/src/bridge/methods/index.ts +1 -1
  31. package/src/bridge/methods/methods.ts +3 -5
  32. package/src/bridge/request.ts +35 -44
  33. package/src/cloud-storage/CloudStorage.ts +36 -53
  34. package/src/index.ts +8 -20
  35. package/src/init/creators/createMiniApp.ts +4 -0
  36. package/src/init/init.ts +1 -0
  37. package/src/mini-app/MiniApp.ts +131 -20
  38. package/src/mini-app/contactParser.ts +29 -0
  39. package/src/mini-app/types.ts +13 -0
  40. package/src/timeout/index.ts +1 -0
  41. package/src/timeout/sleep.ts +10 -0
  42. package/src/timeout/withTimeout.ts +10 -22
  43. package/src/types/index.ts +1 -0
  44. package/src/types/methods.ts +18 -0
  45. package/dist/dts/bridge/methods/invoke-custom-method.d.ts +0 -24
  46. package/src/bridge/methods/invoke-custom-method.ts +0 -25
@@ -1,4 +1,4 @@
1
- export type PhoneRequestedStatus = 'sent' | string;
1
+ export type PhoneRequestedStatus = 'sent' | 'cancelled' | string;
2
2
  export interface PhoneRequestedPayload {
3
3
  /**
4
4
  * Request status.
@@ -2,4 +2,5 @@ export * from './env/index.js';
2
2
  export * from './errors/index.js';
3
3
  export * from './events/index.js';
4
4
  export * from './methods/index.js';
5
+ export * from './invoke-custom-method.js';
5
6
  export * from './request.js';
@@ -0,0 +1,18 @@
1
+ import type { ExecuteWithOptions } from '../types/index.js';
2
+ import type { CustomMethodName, CustomMethodParams } from './methods/index.js';
3
+ /**
4
+ * Invokes known custom method. Returns method execution result.
5
+ * @param method - method name.
6
+ * @param params - method parameters.
7
+ * @param requestId - request identifier.
8
+ * @param options - additional options.
9
+ */
10
+ export declare function invokeCustomMethod<M extends CustomMethodName>(method: M, params: CustomMethodParams<M>, requestId: string, options?: ExecuteWithOptions): Promise<unknown>;
11
+ /**
12
+ * Invokes unknown custom method. Returns method execution result.
13
+ * @param method - method name.
14
+ * @param params - method parameters.
15
+ * @param requestId - request identifier.
16
+ * @param options - additional options.
17
+ */
18
+ export declare function invokeCustomMethod(method: string, params: object, requestId: string, options?: ExecuteWithOptions): Promise<unknown>;
@@ -0,0 +1,56 @@
1
+ import type { RequestId } from '../../types/index.js';
2
+ interface CreateInvokeCustomMethodParams<M extends string, Params extends object> {
3
+ /**
4
+ * Unique request identifier.
5
+ */
6
+ req_id: RequestId;
7
+ /**
8
+ * Method name.
9
+ */
10
+ method: M;
11
+ /**
12
+ * Method specific parameters.
13
+ */
14
+ params: Params;
15
+ }
16
+ export interface CustomMethodsParams {
17
+ /**
18
+ * Deletes storage values by their keys.
19
+ */
20
+ deleteStorageValues: {
21
+ keys: string | string[];
22
+ };
23
+ /**
24
+ * Gets current user contact in case, Mini has access to it.
25
+ */
26
+ getRequestedContact: {};
27
+ /**
28
+ * Gets all registered storage keys.
29
+ */
30
+ getStorageKeys: {};
31
+ /**
32
+ * Gets storage values by their keys.
33
+ */
34
+ getStorageValues: {
35
+ keys: string | string[];
36
+ };
37
+ /**
38
+ * Saves value by specified key in the storage.
39
+ */
40
+ saveStorageValue: {
41
+ key: string;
42
+ value: string;
43
+ };
44
+ }
45
+ /**
46
+ * Known custom method name.
47
+ */
48
+ export type CustomMethodName = keyof CustomMethodsParams;
49
+ /**
50
+ * Custom method parameters.
51
+ */
52
+ export type CustomMethodParams<M extends CustomMethodName> = CustomMethodsParams[M];
53
+ export type AnyInvokeCustomMethodParams = CreateInvokeCustomMethodParams<string, any> | {
54
+ [M in CustomMethodName]: CreateInvokeCustomMethodParams<M, CustomMethodParams<M>>;
55
+ }[CustomMethodName];
56
+ export {};
@@ -1,6 +1,6 @@
1
1
  export * from './createPostEvent.js';
2
+ export * from './custom-methods.js';
2
3
  export * from './haptic.js';
3
- export * from './invoke-custom-method.js';
4
4
  export * from './methods.js';
5
5
  export * from './popup.js';
6
6
  export * from './postEvent.js';
@@ -1,7 +1,7 @@
1
1
  import type { RGB } from '../../colors/index.js';
2
2
  import type { IsNever, Not, RequestId, UnionKeys } from '../../types/index.js';
3
+ import type { AnyInvokeCustomMethodParams } from './custom-methods.js';
3
4
  import type { AnyHapticFeedbackParams } from './haptic.js';
4
- import type { AnyInvokeCustomMethodParams } from './invoke-custom-method.js';
5
5
  import type { PopupParams } from './popup.js';
6
6
  /**
7
7
  * Color key which could be used to update header color.
@@ -1,6 +1,6 @@
1
- import type { And, If, IsNever } from '../types/index.js';
1
+ import type { And, ExecuteWithOptions, If, IsNever } from '../types/index.js';
2
2
  import { type MiniAppsEventHasParams, type MiniAppsEventName, type MiniAppsEventParams } from './events/index.js';
3
- import { type MiniAppsEmptyMethodName, type MiniAppsMethodAcceptParams, type MiniAppsMethodName, type MiniAppsMethodParams, type MiniAppsNonEmptyMethodName, type PostEvent } from './methods/index.js';
3
+ import { type MiniAppsEmptyMethodName, type MiniAppsMethodAcceptParams, type MiniAppsMethodName, type MiniAppsMethodParams, type MiniAppsNonEmptyMethodName } from './methods/index.js';
4
4
  /**
5
5
  * Names of methods, which require passing "req_id" parameter.
6
6
  */
@@ -17,16 +17,7 @@ type EventWithRequestId = {
17
17
  req_id: string;
18
18
  } ? true : false>, E, never>;
19
19
  }[MiniAppsEventName];
20
- export interface RequestOptions {
21
- /**
22
- * Bridge postEvent method.
23
- * @default Global postEvent method.
24
- */
25
- postEvent?: PostEvent;
26
- /**
27
- * Execution timeout.
28
- */
29
- timeout?: number;
20
+ export interface RequestOptions extends ExecuteWithOptions {
30
21
  }
31
22
  export interface RequestOptionsAdvanced<EventPayload> extends RequestOptions {
32
23
  /**
@@ -1,37 +1,29 @@
1
- import { postEvent as defaultPostEvent, type RequestOptions } from '../bridge/index.js';
1
+ import { postEvent as defaultPostEvent } from '../bridge/index.js';
2
2
  import { type SupportsFunc } from '../supports/index.js';
3
- import type { CreateRequestIdFunc } from '../types/index.js';
3
+ import type { CreateRequestIdFunc, ExecuteWithTimeout } from '../types/index.js';
4
4
  import type { Version } from '../version/index.js';
5
- type WiredRequestOptions = Omit<RequestOptions, 'postEvent'>;
6
5
  export declare class CloudStorage {
7
6
  private readonly createRequestId;
8
7
  private readonly postEvent;
9
8
  constructor(version: Version, createRequestId: CreateRequestIdFunc, postEvent?: typeof defaultPostEvent);
10
- /**
11
- * Invokes custom method related to CloudStorage.
12
- * @param method - method name.
13
- * @param params - method parameters.
14
- * @param options - execution options.
15
- */
16
- private invokeCustomMethod;
17
9
  /**
18
10
  * Deletes specified key or keys from the cloud storage.
19
11
  * @param keyOrKeys - key or keys to delete.
20
12
  * @param options - request execution options.
21
13
  */
22
- delete(keyOrKeys: string | string[], options?: WiredRequestOptions): Promise<void>;
14
+ delete(keyOrKeys: string | string[], options?: ExecuteWithTimeout): Promise<void>;
23
15
  /**
24
16
  * Returns list of all keys presented in the cloud storage.
25
17
  * @param options - request execution options.
26
18
  */
27
- getKeys(options?: WiredRequestOptions): Promise<string[]>;
19
+ getKeys(options?: ExecuteWithTimeout): Promise<string[]>;
28
20
  /**
29
21
  * Returns map, where key is one of the specified in keys argument, and value is according
30
22
  * storage value.
31
23
  * @param keys - keys list.
32
24
  * @param options - request execution options.
33
25
  */
34
- get<K extends string>(keys: K[], options?: WiredRequestOptions): Promise<Record<K, string>>;
26
+ get<K extends string>(keys: K[], options?: ExecuteWithTimeout): Promise<Record<K, string>>;
35
27
  /**
36
28
  * Returns value of the specified key.
37
29
  * @param key - cloud storage key.
@@ -39,17 +31,16 @@ export declare class CloudStorage {
39
31
  * @return Value of the specified key. In case, key was not created previously, function
40
32
  * will return empty string.
41
33
  */
42
- get(key: string, options?: WiredRequestOptions): Promise<string>;
34
+ get(key: string, options?: ExecuteWithTimeout): Promise<string>;
43
35
  /**
44
36
  * Saves specified value by key.
45
37
  * @param key - storage key.
46
38
  * @param value - storage value.
47
39
  * @param options - request execution options.
48
40
  */
49
- set(key: string, value: string, options?: WiredRequestOptions): Promise<void>;
41
+ set(key: string, value: string, options?: ExecuteWithTimeout): Promise<void>;
50
42
  /**
51
43
  * Checks if specified method is supported by current component.
52
44
  */
53
45
  supports: SupportsFunc<'delete' | 'get' | 'getKeys' | 'set'>;
54
46
  }
55
- export {};
@@ -1,6 +1,6 @@
1
1
  export { BackButton, type BackButtonEventName, type BackButtonEventListener, } from './back-button/index.js';
2
- export { createPostEvent, isIframe, on, off, once, postEvent, request, subscribe, unsubscribe, MethodUnsupportedError, ParameterUnsupportedError, type HeaderColorKey, type InvoiceStatus, type ImpactHapticFeedbackStyle, type MiniAppsMethodName, type MiniAppsEventName, type MiniAppsEventParams, type MiniAppsEventListener, type MiniAppsGlobalEventListener, type MiniAppsEmptyMethodName, type MiniAppsMethodAcceptParams, type MiniAppsMethodParams, type MiniAppsNonEmptyMethodName, type MiniAppsMethods, type MiniAppsEventEmitter, type MiniAppsEventHasParams, type MiniAppsEvents, type NotificationHapticFeedbackType, type PhoneRequestedStatus, type PostEvent, type RequestOptions, type SwitchInlineQueryChatType, type WriteAccessRequestedStatus, } from './bridge/index.js';
3
- export { classNames, mergeClassNames, } from './classnames/index.js';
2
+ export { createPostEvent, isIframe, invokeCustomMethod, on, off, once, postEvent, request, subscribe, unsubscribe, MethodUnsupportedError, ParameterUnsupportedError, type HeaderColorKey, type InvoiceStatus, type ImpactHapticFeedbackStyle, type MiniAppsMethodName, type MiniAppsEventName, type MiniAppsEventParams, type MiniAppsEventListener, type MiniAppsGlobalEventListener, type MiniAppsEmptyMethodName, type MiniAppsMethodAcceptParams, type MiniAppsMethodParams, type MiniAppsNonEmptyMethodName, type MiniAppsMethods, type MiniAppsEventEmitter, type MiniAppsEventHasParams, type MiniAppsEvents, type NotificationHapticFeedbackType, type PhoneRequestedStatus, type PostEvent, type RequestOptions, type RequestOptionsAdvanced, type SwitchInlineQueryChatType, type WriteAccessRequestedStatus, } from './bridge/index.js';
3
+ export { classNames, mergeClassNames } from './classnames/index.js';
4
4
  export { ClosingBehavior, type ClosingBehaviorEventListener, type ClosingBehaviorEventName, type ClosingBehaviorEvents, } from './closing-behavior/index.js';
5
5
  export { CloudStorage } from './cloud-storage/index.js';
6
6
  export { isRGB, isRGBShort, isColorDark, toRGB, type RGB, type RGBShort, } from './colors/index.js';
@@ -11,15 +11,16 @@ export { Invoice, type InvoiceEvents, type InvoiceEventListener, type InvoiceEve
11
11
  export { launchParamsParser, parseLaunchParams, retrieveLaunchData, serializeLaunchParams, type LaunchParams, type LaunchData, } from './launch-params/index.js';
12
12
  export { MainButton, type MainButtonParams, type MainButtonProps, type MainButtonEvents, type MainButtonEventName, type MainButtonEventListener, } from './main-button/index.js';
13
13
  export { MiniApp, type MiniAppHeaderColor, type MiniAppEventName, type MiniAppEventListener, type MiniAppEvents, type MiniAppProps, } from './mini-app/index.js';
14
- export { isTMA, isRecord, } from './misc/index.js';
14
+ export { isTMA, isRecord } from './misc/index.js';
15
15
  export { getHash, HashNavigator, Navigator, type NavigationEntry, type NavigatorConEntry, type NavigatorOptions, type HashNavigatorOptions, type HashNavigatorEventsMap, type HashNavigatorEventListener, type HashNavigatorEventName, } from './navigation/index.js';
16
16
  export { Popup, type PopupEventName, type PopupEventListener, type PopupEvents, type OpenPopupOptions, type OpenPopupOptionsButton, } from './popup/index.js';
17
17
  export { QRScanner, type QRScannerEventListener, type QRScannerEventName, type QRScannerEvents, } from './qr-scanner/index.js';
18
18
  export { SettingsButton, type SettingsButtonEventName, type SettingsButtonEventListener, type SettingsButtonEvents, } from './settings-button/index.js';
19
19
  export { supports } from './supports/index.js';
20
20
  export { parseThemeParams, requestThemeParams, serializeThemeParams, themeParamsParser, ThemeParams, type ThemeParamsEventListener, type ThemeParamsEventName, type ThemeParamsEvents, type ThemeParamsKey, type ThemeParamsParsed, } from './theme-params/index.js';
21
- export type { RequestId, CreateRequestIdFunc, } from './types/index.js';
21
+ export { withTimeout, TimeoutError, isTimeoutError } from './timeout/index.js';
22
+ export type { RequestId, CreateRequestIdFunc } from './types/index.js';
22
23
  export { Utils } from './utils/index.js';
23
- export { compareVersions, type Version, } from './version/index.js';
24
+ export { compareVersions, type Version } from './version/index.js';
24
25
  export { requestViewport, Viewport, type RequestViewportResult, type ViewportProps, type ViewportEventName, type ViewportEventListener, type ViewportEvents, } from './viewport/index.js';
25
- export { setTargetOrigin, setDebug, } from './globals.js';
26
+ export { setTargetOrigin, setDebug } from './globals.js';
@@ -1,6 +1,7 @@
1
1
  import { MiniApp } from '../../mini-app/index.js';
2
2
  import type { PostEvent } from '../../bridge/index.js';
3
3
  import type { RGB } from '../../colors/index.js';
4
+ import type { CreateRequestIdFunc } from '../../types/index.js';
4
5
  import type { Version } from '../../version/index.js';
5
6
  /**
6
7
  * Creates MiniApp instance using last locally saved data also saving each state in
@@ -9,6 +10,7 @@ import type { Version } from '../../version/index.js';
9
10
  * @param backgroundColor - web app background color.
10
11
  * @param version - platform version.
11
12
  * @param botInline - is Mini App launched in inline mode.
13
+ * @param createRequestId - function which generates request identifiers.
12
14
  * @param postEvent - Bridge postEvent function
13
15
  */
14
- export declare function createMiniApp(isPageReload: boolean, backgroundColor: RGB, version: Version, botInline: boolean, postEvent: PostEvent): MiniApp;
16
+ export declare function createMiniApp(isPageReload: boolean, backgroundColor: RGB, version: Version, botInline: boolean, createRequestId: CreateRequestIdFunc, postEvent: PostEvent): MiniApp;
@@ -1,7 +1,8 @@
1
1
  import { type PhoneRequestedStatus, type SwitchInlineQueryChatType, type WriteAccessRequestedStatus } from '../bridge/index.js';
2
2
  import { type RGB } from '../colors/index.js';
3
3
  import { type SupportsFunc } from '../supports/index.js';
4
- import type { MiniAppEvents, MiniAppHeaderColor, MiniAppProps } from './types.js';
4
+ import type { ExecuteWithTimeout } from '../types/index.js';
5
+ import type { MiniAppEvents, MiniAppHeaderColor, MiniAppProps, RequestedContact } from './types.js';
5
6
  /**
6
7
  * Provides common Mini Apps functionality not covered by other system components.
7
8
  */
@@ -10,7 +11,14 @@ export declare class MiniApp {
10
11
  private readonly state;
11
12
  private readonly botInline;
12
13
  private readonly postEvent;
14
+ private readonly createRequestId;
15
+ private requestingPhoneAccess;
16
+ private requestingWriteAccess;
13
17
  constructor(props: MiniAppProps);
18
+ /**
19
+ * Attempts to get requested contact.
20
+ */
21
+ private getRequestedContact;
14
22
  /**
15
23
  * The Mini App background color.
16
24
  */
@@ -31,6 +39,14 @@ export declare class MiniApp {
31
39
  * True if current Mini App background color recognized as dark.
32
40
  */
33
41
  get isDark(): boolean;
42
+ /**
43
+ * True if phone access is currently being requested.
44
+ */
45
+ get isRequestingPhoneAccess(): boolean;
46
+ /**
47
+ * True if write access is currently being requested.
48
+ */
49
+ get isRequestingWriteAccess(): boolean;
34
50
  /**
35
51
  * Adds new event listener.
36
52
  */
@@ -50,13 +66,27 @@ export declare class MiniApp {
50
66
  */
51
67
  ready(): void;
52
68
  /**
53
- * Requests current user phone access.
69
+ * Requests current user contact information. In contrary to requestPhoneAccess, this method
70
+ * returns promise with contact information that rejects in case, user denied access, or request
71
+ * failed.
72
+ * @param options - additional options.
73
+ */
74
+ requestContact({ timeout }?: ExecuteWithTimeout): Promise<RequestedContact>;
75
+ /**
76
+ * Requests current user phone access. Method returns promise, which resolves
77
+ * status of the request. In case, user accepted the request, Mini App bot will receive
78
+ * the according notification.
79
+ *
80
+ * To obtain the retrieved information instead, utilize the requestContact method.
81
+ * @param options - additional options.
82
+ * @see requestContact
54
83
  */
55
- requestPhoneAccess(): Promise<PhoneRequestedStatus>;
84
+ requestPhoneAccess(options?: ExecuteWithTimeout): Promise<PhoneRequestedStatus>;
56
85
  /**
57
86
  * Requests write message access to current user.
87
+ * @param options - additional options.
58
88
  */
59
- requestWriteAccess(): Promise<WriteAccessRequestedStatus>;
89
+ requestWriteAccess(options?: ExecuteWithTimeout): Promise<WriteAccessRequestedStatus>;
60
90
  /**
61
91
  * A method used to send data to the bot. When this method called, a service message sent to
62
92
  * the bot containing the data of the length up to 4096 bytes, and the Mini App closed. See the
@@ -0,0 +1,2 @@
1
+ import type { RequestedContact } from './types.js';
2
+ export declare const contactParser: import('../parsing/index.js').ValueParser<RequestedContact, false>;
@@ -1,12 +1,14 @@
1
1
  import type { HeaderColorKey, PostEvent } from '../bridge/index.js';
2
2
  import type { RGB } from '../colors/index.js';
3
3
  import type { StateEvents } from '../state/index.js';
4
+ import type { CreateRequestIdFunc } from '../types/index.js';
4
5
  import type { Version } from '../version/index.js';
5
6
  export interface MiniAppProps {
6
7
  headerColor: MiniAppHeaderColor;
7
8
  backgroundColor: RGB;
8
9
  version: Version;
9
10
  botInline: boolean;
11
+ createRequestId: CreateRequestIdFunc;
10
12
  postEvent?: PostEvent;
11
13
  }
12
14
  export type MiniAppHeaderColor = HeaderColorKey | RGB;
@@ -17,3 +19,13 @@ export interface MiniAppState {
17
19
  export type MiniAppEvents = StateEvents<MiniAppState>;
18
20
  export type MiniAppEventName = keyof MiniAppEvents;
19
21
  export type MiniAppEventListener<E extends MiniAppEventName> = MiniAppEvents[E];
22
+ export interface RequestedContact {
23
+ contact: {
24
+ userId: number;
25
+ phoneNumber: string;
26
+ firstName: string;
27
+ lastName: string;
28
+ };
29
+ authDate: Date;
30
+ hash: string;
31
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './isTimeoutError.js';
2
+ export * from './sleep.js';
2
3
  export * from './TimeoutError.js';
3
4
  export * from './withTimeout.js';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Awaits for specified amount of time.
3
+ * @param duration - duration to await.
4
+ */
5
+ export declare function sleep(duration: number): Promise<void>;
@@ -1,14 +1,7 @@
1
- type AnyAsyncFunction = (...args: any[]) => Promise<any>;
2
1
  /**
3
- * Rejects specified promise in case, it is processed more than timeout seconds.
4
- * @param promise - wrapped promise.
5
- * @param timeout - timeout in milliseconds.
2
+ * Accepts specified function and instantly executes. It waits for timeout milliseconds for
3
+ * it to complete and throws an error in case, deadline was reached.
4
+ * @param func - function to execute.
5
+ * @param timeout - completion timeout.
6
6
  */
7
- export declare function withTimeout<P extends Promise<any>>(promise: P, timeout: number): P;
8
- /**
9
- * Wraps async function in function using timeout.
10
- * @param func - wrapped function.
11
- * @param timeout - async function timeout.
12
- */
13
- export declare function withTimeout<F extends AnyAsyncFunction>(func: F, timeout: number): F;
14
- export {};
7
+ export declare function withTimeout<T>(func: () => Promise<T>, timeout: number): Promise<T>;
@@ -1,3 +1,4 @@
1
+ export * from './methods.js';
1
2
  export * from './platform.js';
2
3
  export * from './request-id.js';
3
4
  export * from './utils.js';
@@ -0,0 +1,15 @@
1
+ import type { PostEvent } from '../bridge/index.js';
2
+ export interface ExecuteWithTimeout {
3
+ /**
4
+ * Timeout to execute method.
5
+ */
6
+ timeout?: number;
7
+ }
8
+ export interface ExecuteWithPostEvent {
9
+ /**
10
+ * postEvent function to use to call Telegram Mini Apps methods.
11
+ */
12
+ postEvent?: PostEvent;
13
+ }
14
+ export interface ExecuteWithOptions extends ExecuteWithTimeout, ExecuteWithPostEvent {
15
+ }