@tma.js/bridge 1.4.0 → 2.0.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 (92) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +44 -13
  3. package/dist/dts/applyPolyfills.d.ts +5 -0
  4. package/dist/dts/base64-url.d.ts +24 -0
  5. package/dist/dts/env/hasWebviewProxy.d.ts +10 -0
  6. package/dist/dts/env/isIframe.d.ts +5 -0
  7. package/dist/dts/env/isTMA.d.ts +31 -0
  8. package/dist/dts/env/mockTelegramEnv.d.ts +57 -0
  9. package/dist/dts/errors.d.ts +27 -0
  10. package/dist/dts/events/createEmitter.d.ts +58 -0
  11. package/dist/dts/events/emitEvent.d.ts +33 -0
  12. package/dist/dts/events/emitter.d.ts +2 -11
  13. package/dist/dts/events/types/events.d.ts +721 -0
  14. package/dist/dts/events/types/index.d.ts +3 -0
  15. package/dist/dts/events/types/listening.d.ts +5 -0
  16. package/dist/dts/events/types/misc.d.ts +16 -0
  17. package/dist/dts/globals.d.ts +45 -14
  18. package/dist/dts/index.d.ts +24 -7
  19. package/dist/dts/launch-params.d.ts +32 -0
  20. package/dist/dts/methods/captureSameReq.d.ts +10 -0
  21. package/dist/dts/methods/createPostEvent.d.ts +27 -7
  22. package/dist/dts/methods/postEvent.d.ts +31 -25
  23. package/dist/dts/methods/postMessage.d.ts +7 -0
  24. package/dist/dts/methods/supports.d.ts +15 -0
  25. package/dist/dts/methods/types/custom-method.d.ts +59 -0
  26. package/dist/dts/methods/types/index.d.ts +6 -0
  27. package/dist/dts/methods/types/methods.d.ts +756 -0
  28. package/dist/dts/methods/types/misc.d.ts +27 -0
  29. package/dist/dts/methods/{popup.d.ts → types/popup.d.ts} +1 -1
  30. package/dist/dts/methods/types/utils.d.ts +9 -0
  31. package/dist/dts/obj-prop-helpers.d.ts +39 -0
  32. package/dist/dts/start-param.d.ts +53 -0
  33. package/dist/dts/utils/compareVersions.d.ts +10 -0
  34. package/dist/dts/utils/invokeCustomMethod.d.ts +34 -0
  35. package/dist/dts/utils/request.d.ts +90 -0
  36. package/dist/index.cjs +3 -1
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.iife.js +3 -1
  39. package/dist/index.iife.js.map +1 -1
  40. package/dist/index.js +977 -0
  41. package/dist/index.js.map +1 -0
  42. package/package.json +26 -26
  43. package/dist/dts/env.d.ts +0 -29
  44. package/dist/dts/errors/MethodUnsupportedError.d.ts +0 -8
  45. package/dist/dts/errors/ParameterUnsupportedError.d.ts +0 -8
  46. package/dist/dts/errors/index.d.ts +0 -2
  47. package/dist/dts/events/events.d.ts +0 -130
  48. package/dist/dts/events/index.d.ts +0 -7
  49. package/dist/dts/events/off.d.ts +0 -7
  50. package/dist/dts/events/on.d.ts +0 -10
  51. package/dist/dts/events/onTelegramEvent.d.ts +0 -7
  52. package/dist/dts/events/once.d.ts +0 -9
  53. package/dist/dts/events/parsing.d.ts +0 -38
  54. package/dist/dts/events/payloads.d.ts +0 -93
  55. package/dist/dts/events/subscribe.d.ts +0 -9
  56. package/dist/dts/events/unsubscribe.d.ts +0 -6
  57. package/dist/dts/methods/index.d.ts +0 -6
  58. package/dist/dts/methods/invoke-custom-method.d.ts +0 -24
  59. package/dist/dts/methods/methods.d.ts +0 -330
  60. package/dist/dts/request.d.ts +0 -66
  61. package/dist/dts/shared.d.ts +0 -5
  62. package/dist/dts/supports.d.ts +0 -15
  63. package/dist/index.mjs +0 -297
  64. package/dist/index.mjs.map +0 -1
  65. package/src/env.ts +0 -49
  66. package/src/errors/MethodUnsupportedError.ts +0 -13
  67. package/src/errors/ParameterUnsupportedError.ts +0 -13
  68. package/src/errors/index.ts +0 -2
  69. package/src/events/emitter.ts +0 -126
  70. package/src/events/events.ts +0 -169
  71. package/src/events/index.ts +0 -7
  72. package/src/events/off.ts +0 -12
  73. package/src/events/on.ts +0 -17
  74. package/src/events/onTelegramEvent.ts +0 -83
  75. package/src/events/once.ts +0 -16
  76. package/src/events/parsing.ts +0 -110
  77. package/src/events/payloads.ts +0 -125
  78. package/src/events/subscribe.ts +0 -16
  79. package/src/events/unsubscribe.ts +0 -11
  80. package/src/globals.ts +0 -38
  81. package/src/index.ts +0 -7
  82. package/src/methods/createPostEvent.ts +0 -39
  83. package/src/methods/haptic.ts +0 -52
  84. package/src/methods/index.ts +0 -6
  85. package/src/methods/invoke-custom-method.ts +0 -25
  86. package/src/methods/methods.ts +0 -373
  87. package/src/methods/popup.ts +0 -53
  88. package/src/methods/postEvent.ts +0 -101
  89. package/src/request.ts +0 -168
  90. package/src/shared.ts +0 -5
  91. package/src/supports.ts +0 -82
  92. /package/dist/dts/methods/{haptic.d.ts → types/haptic-feedback.d.ts} +0 -0
package/package.json CHANGED
@@ -1,64 +1,64 @@
1
1
  {
2
2
  "name": "@tma.js/bridge",
3
- "version": "1.4.0",
4
- "description": "Communication layer between Telegram and frontend applications.",
3
+ "version": "2.0.0",
4
+ "description": "TypeScript package to provide communication layer between Mini App and Telegram application.",
5
5
  "author": "Vladislav Kibenko <wolfram.deus@gmail.com>",
6
- "homepage": "https://github.com/Telegram-Mini-Apps/tma.js#readme",
6
+ "homepage": "https://github.com/Telegram-Mini-Apps/telegram-apps#readme",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/Telegram-Mini-Apps/tma.js.git",
10
- "directory": "packages/bridge"
9
+ "url": "git@github.com:Telegram-Mini-Apps/telegram-apps.git",
10
+ "directory": "tma.js/bridge"
11
11
  },
12
12
  "bugs": {
13
- "url": "https://github.com/Telegram-Mini-Apps/tma.js/issues"
13
+ "url": "https://github.com/Telegram-Mini-Apps/telegram-apps/issues"
14
14
  },
15
15
  "keywords": [
16
16
  "telegram-mini-apps",
17
17
  "typescript",
18
- "bridge",
19
- "webview"
18
+ "bridge"
20
19
  ],
21
20
  "license": "MIT",
22
21
  "type": "module",
23
22
  "sideEffects": false,
24
23
  "files": [
25
- "dist",
26
- "src"
24
+ "dist"
27
25
  ],
28
26
  "main": "./dist/index.cjs",
29
- "browser": "./dist/index.iife.js",
30
- "module": "./dist/index.mjs",
27
+ "module": "./dist/index.js",
31
28
  "types": "./dist/dts/index.d.ts",
32
29
  "exports": {
33
30
  ".": {
34
31
  "types": "./dist/dts/index.d.ts",
35
- "import": "./dist/index.mjs",
32
+ "import": "./dist/index.js",
36
33
  "require": "./dist/index.cjs",
37
34
  "default": "./dist/index.cjs"
38
35
  }
39
36
  },
40
37
  "dependencies": {
41
- "@tma.js/colors": "0.0.5",
42
- "@tma.js/event-emitter": "0.1.0",
43
- "@tma.js/logger": "0.0.5",
44
- "@tma.js/parsing": "1.0.0",
45
- "@tma.js/util-types": "0.0.3",
46
- "@tma.js/utils": "0.5.6"
38
+ "better-promises": "^1.0.0",
39
+ "error-kid": "^1.0.2",
40
+ "fp-ts": "^2.16.11",
41
+ "mitt": "^3.0.1",
42
+ "valibot": "^1.1.0",
43
+ "@tma.js/signals": "^1.0.0",
44
+ "@tma.js/toolkit": "^1.0.0",
45
+ "@tma.js/transformers": "^1.0.0",
46
+ "@tma.js/types": "^1.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "build-utils": "0.0.1",
50
- "eslint-config-custom": "0.1.0",
49
+ "test-utils": "0.0.1",
51
50
  "tsconfig": "0.0.2"
52
51
  },
53
52
  "publishConfig": {
54
53
  "access": "public"
55
54
  },
56
55
  "scripts": {
57
- "test": "vitest",
58
- "lint": "eslint -c .eslintrc.cjs src/**/* tests/**/*",
56
+ "test": "vitest --run",
57
+ "lint": "cd ../.. && eslint tma.js/bridge/src --ignore-pattern **/*.test.ts",
58
+ "lint:fix": "pnpm run lint --fix",
59
59
  "typecheck": "tsc --noEmit -p tsconfig.build.json",
60
- "build": "pnpm run build:default && pnpm run build:iife",
61
- "build:default": "vite build --config vite.config.ts",
62
- "build:iife": "vite build --config vite.iife.config.ts"
60
+ "build": "rimraf dist && pnpm run build:default && pnpm run build:iife",
61
+ "build:default": "vite build -c vite.config.ts",
62
+ "build:iife": "vite build -c vite.iife.config.ts"
63
63
  }
64
64
  }
package/dist/dts/env.d.ts DELETED
@@ -1,29 +0,0 @@
1
- type AnyFunc = (...args: unknown[]) => unknown;
2
- type WithExternalNotify<T> = T & {
3
- external: {
4
- notify: AnyFunc;
5
- };
6
- };
7
- type WithWebviewProxy<T> = T & {
8
- TelegramWebviewProxy: {
9
- postEvent: AnyFunc;
10
- };
11
- };
12
- /**
13
- * Returns true in case, passed value contains path `external.notify` property and `notify` is a
14
- * function.
15
- * @param value - value to check.
16
- */
17
- export declare function hasExternalNotify<T extends {}>(value: T): value is WithExternalNotify<T>;
18
- /**
19
- * Returns true in case, passed value contains path `TelegramWebviewProxy.postEvent` property and
20
- * `postEvent` is a function.
21
- * @param value - value to check.
22
- */
23
- export declare function hasWebviewProxy<T extends {}>(value: T): value is WithWebviewProxy<T>;
24
- /**
25
- * Returns true in case, current environment is iframe.
26
- * @see https://stackoverflow.com/a/326076
27
- */
28
- export declare function isIframe(): boolean;
29
- export {};
@@ -1,8 +0,0 @@
1
- import type { Version } from '@tma.js/utils';
2
- import type { MethodName } from '../methods/index.js';
3
- /**
4
- * Error thrown in case, unsupported method was called.
5
- */
6
- export declare class MethodUnsupportedError extends Error {
7
- constructor(method: MethodName, version: Version);
8
- }
@@ -1,8 +0,0 @@
1
- import type { Version } from '@tma.js/utils';
2
- import type { MethodName } from '../methods/index.js';
3
- /**
4
- * Error thrown in case, unsupported parameter was used.
5
- */
6
- export declare class ParameterUnsupportedError extends Error {
7
- constructor(method: MethodName, param: string, version: Version);
8
- }
@@ -1,2 +0,0 @@
1
- export * from './MethodUnsupportedError.js';
2
- export * from './ParameterUnsupportedError.js';
@@ -1,130 +0,0 @@
1
- import type { EventEmitter as UtilEventEmitter, EventListener as UtilEventListener, EventParams as UtilEventParams, AnySubscribeListener } from '@tma.js/event-emitter';
2
- import type { IsNever, Not } from '@tma.js/util-types';
3
- import type { ClipboardTextReceivedPayload, CustomMethodInvokedPayload, InvoiceClosedPayload, PhoneRequestedPayload, PopupClosedPayload, QrTextReceivedPayload, ThemeChangedPayload, ViewportChangedPayload, WriteAccessRequestedPayload } from './payloads.js';
4
- /**
5
- * Map where key is known event name, and value is its listener.
6
- * @see https://docs.telegram-mini-apps.com/apps-communication/events
7
- */
8
- export interface Events {
9
- /**
10
- * User clicked back button.
11
- * @since v6.1
12
- * @see https://docs.telegram-mini-apps.com/apps-communication/events#back-button-pressed
13
- */
14
- back_button_pressed: () => void;
15
- /**
16
- * Telegram application attempted to extract text from clipboard.
17
- * @param payload - event payload.
18
- * @since v6.4
19
- * @see https://docs.telegram-mini-apps.com/apps-communication/events#clipboard-text-received
20
- */
21
- clipboard_text_received: (payload: ClipboardTextReceivedPayload) => void;
22
- /**
23
- * Custom method invocation completed.
24
- * @param payload - event payload.
25
- * @since v6.9
26
- * @see https://docs.telegram-mini-apps.com/apps-communication/events#custom-method-invoked
27
- */
28
- custom_method_invoked: (payload: CustomMethodInvokedPayload) => void;
29
- /**
30
- * An invoice was closed.
31
- * @param payload - invoice close information.
32
- * @see https://docs.telegram-mini-apps.com/apps-communication/events#invoice-closed
33
- */
34
- invoice_closed: (payload: InvoiceClosedPayload) => void;
35
- /**
36
- * User clicked the Main Button.
37
- * @see https://docs.telegram-mini-apps.com/apps-communication/events#main-button-pressed
38
- */
39
- main_button_pressed: () => void;
40
- /**
41
- * Application received phone access request status.
42
- * @param payload - event payload.
43
- * @since v6.9
44
- * @see https://docs.telegram-mini-apps.com/apps-communication/events#phone-requested
45
- */
46
- phone_requested: (payload: PhoneRequestedPayload) => void;
47
- /**
48
- * Popup was closed.
49
- * @param payload - event payload.
50
- * @see https://docs.telegram-mini-apps.com/apps-communication/events#popup-closed
51
- */
52
- popup_closed: (payload: PopupClosedPayload) => void;
53
- /**
54
- * Parent iframe requested current iframe reload.
55
- * @see https://docs.telegram-mini-apps.com/apps-communication/events#reload-iframe
56
- */
57
- reload_iframe: () => void;
58
- /**
59
- * The QR scanner scanned some QR and extracted its content.
60
- * @param payload - event payload.
61
- * @since v6.4
62
- * @see https://docs.telegram-mini-apps.com/apps-communication/events#qr-text-received
63
- */
64
- qr_text_received: (payload: QrTextReceivedPayload) => void;
65
- /**
66
- * QR scanner was closed.
67
- * @since v6.4
68
- * @see https://docs.telegram-mini-apps.com/apps-communication/events#scan-qr-popup-closed
69
- */
70
- scan_qr_popup_closed: () => void;
71
- /**
72
- * The event which is usually sent by the Telegram web application. Its payload represents
73
- * `<style/>` tag html content, a developer could use. The stylesheet described in the payload
74
- * will help the developer to stylize the app scrollbar (but he is still able to do it himself).
75
- * @param html - `style` tag inner HTML.
76
- * @see https://docs.telegram-mini-apps.com/apps-communication/events#set-custom-style
77
- */
78
- set_custom_style: (html: string) => void;
79
- /**
80
- * Occurs when the Settings Button was pressed.
81
- * @since v6.1
82
- * @see https://docs.telegram-mini-apps.com/apps-communication/events#settings-button-pressed
83
- */
84
- settings_button_pressed: () => void;
85
- /**
86
- * Occurs whenever theme settings are changed in the user's Telegram app
87
- * (including switching to night mode).
88
- * @param payload - event payload.
89
- * @see https://docs.telegram-mini-apps.com/apps-communication/events#theme-changed
90
- */
91
- theme_changed: (payload: ThemeChangedPayload) => void;
92
- /**
93
- * Occurs whenever the viewport has been changed. For example, when the user started
94
- * dragging the application or called the expansion method.
95
- * @param payload - event payload.
96
- * @see https://docs.telegram-mini-apps.com/apps-communication/events#viewport-changed
97
- */
98
- viewport_changed: (payload: ViewportChangedPayload) => void;
99
- /**
100
- * Application received write access request status.
101
- * @param payload - event payload.
102
- * @since v6.9
103
- * @see https://docs.telegram-mini-apps.com/apps-communication/events#write-access-requested
104
- */
105
- write_access_requested: (payload: WriteAccessRequestedPayload) => void;
106
- }
107
- /**
108
- * Any known event name.
109
- */
110
- export type EventName = keyof Events;
111
- /**
112
- * Parameters of specified event.
113
- */
114
- export type EventParams<E extends EventName> = UtilEventParams<Events[E]>[0];
115
- /**
116
- * Returns event listener for specified event name.
117
- */
118
- export type EventListener<E extends EventName> = UtilEventListener<Events[E]>;
119
- /**
120
- * Event emitter, based describe events map.
121
- */
122
- export type EventEmitter = UtilEventEmitter<Events>;
123
- /**
124
- * Returns true in case, event has parameters.
125
- */
126
- export type EventHasParams<E extends EventName> = Not<IsNever<EventParams<E>>>;
127
- /**
128
- * Event listener used in `subscribe` and `unsubscribe` functions.
129
- */
130
- export type GlobalEventListener = AnySubscribeListener<Events> | ((event: string, data: unknown) => void);
@@ -1,7 +0,0 @@
1
- export type * from './events.js';
2
- export * from './off.js';
3
- export * from './on.js';
4
- export * from './once.js';
5
- export type * from './payloads.js';
6
- export * from './subscribe.js';
7
- export * from './unsubscribe.js';
@@ -1,7 +0,0 @@
1
- import type { EventName, EventListener } from './events.js';
2
- /**
3
- * Removes listener from specified event.
4
- * @param event - event to listen.
5
- * @param listener - event listener.
6
- */
7
- export declare function off<E extends EventName>(event: E, listener: EventListener<E>): void;
@@ -1,10 +0,0 @@
1
- import type { EventName, EventListener } from './events.js';
2
- type StopListening = () => void;
3
- /**
4
- * Adds new listener to the specified event. Returns handler
5
- * which allows to stop listening to event.
6
- * @param event - event name.
7
- * @param listener - event listener.
8
- */
9
- export declare function on<E extends EventName>(event: E, listener: EventListener<E>): StopListening;
10
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * Adds listener to window "message" event assuming, that this event could
3
- * be sent by Telegram native application. Calls passed callback with event
4
- * type and data.
5
- * @param cb - callback to call.
6
- */
7
- export declare function onTelegramEvent(cb: (eventType: string, eventData: unknown) => void): void;
@@ -1,9 +0,0 @@
1
- import type { EventName, EventListener } from './events.js';
2
- type StopListening = () => void;
3
- /**
4
- * Works the same as "on" method, but after catching the event, will remove event listener.
5
- * @param event - event name.
6
- * @param listener - event listener.
7
- */
8
- export declare function once<E extends EventName>(event: E, listener: EventListener<E>): StopListening;
9
- export {};
@@ -1,38 +0,0 @@
1
- import type { ClipboardTextReceivedPayload, CustomMethodInvokedPayload, InvoiceClosedPayload, PhoneRequestedPayload, PopupClosedPayload, QrTextReceivedPayload, ThemeChangedPayload, ViewportChangedPayload, WriteAccessRequestedPayload } from './payloads.js';
2
- /**
3
- * Parses incoming value as ThemeChangedPayload.
4
- */
5
- export declare const themeChangedPayload: import("@tma.js/parsing").ValueParser<ThemeChangedPayload, false>;
6
- /**
7
- * Parses incoming value as ViewportChangedPayload.
8
- * @param value - value to parse.
9
- */
10
- export declare const viewportChangedPayload: import("@tma.js/parsing").ValueParser<ViewportChangedPayload, false>;
11
- /**
12
- * Parses incoming value as PopupClosedPayload.
13
- */
14
- export declare const popupClosedPayload: import("@tma.js/parsing").ValueParser<PopupClosedPayload, false>;
15
- /**
16
- * Parses incoming value as QrTextReceivedPayload.
17
- */
18
- export declare const qrTextReceivedPayload: import("@tma.js/parsing").ValueParser<QrTextReceivedPayload, false>;
19
- /**
20
- * Parses incoming value as InvoiceClosedPayload.
21
- */
22
- export declare const invoiceClosedPayload: import("@tma.js/parsing").ValueParser<InvoiceClosedPayload, false>;
23
- /**
24
- * Parses incoming value as clipboard text received payload.
25
- */
26
- export declare const clipboardTextReceivedPayload: import("@tma.js/parsing").ValueParser<ClipboardTextReceivedPayload, false>;
27
- /**
28
- * Parses incoming value as WriteAccessRequestedPayload.
29
- */
30
- export declare const writeAccessRequestedPayload: import("@tma.js/parsing").ValueParser<WriteAccessRequestedPayload, false>;
31
- /**
32
- * Parses incoming value as PhoneRequestedPayload.
33
- */
34
- export declare const phoneRequestedPayload: import("@tma.js/parsing").ValueParser<PhoneRequestedPayload, false>;
35
- /**
36
- * Parses incoming value as CustomMethodInvokedPayload.
37
- */
38
- export declare const customMethodInvokedPayload: import("@tma.js/parsing").ValueParser<CustomMethodInvokedPayload<unknown>, false>;
@@ -1,93 +0,0 @@
1
- import type { RGB } from '@tma.js/colors';
2
- import type { RequestId } from '../shared.js';
3
- export interface ClipboardTextReceivedPayload {
4
- /**
5
- * Passed during the `web_app_read_text_from_clipboard` method invocation `req_id` value.
6
- */
7
- req_id: RequestId;
8
- /**
9
- * Data extracted from the clipboard. The returned value will have the type `string` only in
10
- * the case, application has access to the clipboard.
11
- */
12
- data?: string | null;
13
- }
14
- export interface CustomMethodInvokedPayload<R = unknown> {
15
- /**
16
- * Unique identifier of this invocation.
17
- */
18
- req_id: RequestId;
19
- /**
20
- * Method invocation successful result.
21
- */
22
- result?: R;
23
- /**
24
- * Method invocation error code.
25
- */
26
- error?: string;
27
- }
28
- export type InvoiceStatus = 'paid' | 'failed' | 'pending' | 'cancelled' | string;
29
- export interface InvoiceClosedPayload {
30
- /**
31
- * Passed during the `web_app_open_invoice` method invocation `slug` value.
32
- */
33
- slug: string;
34
- /**
35
- * Invoice status
36
- */
37
- status: InvoiceStatus;
38
- }
39
- export interface QrTextReceivedPayload {
40
- /**
41
- * Data extracted from the QR.
42
- */
43
- data?: string;
44
- }
45
- export type ThemeParamsKey = 'accent_text_color' | 'bg_color' | 'button_color' | 'button_text_color' | 'destructive_text_color' | 'header_bg_color' | 'hint_color' | 'link_color' | 'secondary_bg_color' | 'section_header_text_color' | 'section_bg_color' | 'subtitle_text_color' | 'text_color';
46
- export interface ThemeChangedPayload {
47
- /**
48
- * Map where the key is a theme stylesheet key and value is the corresponding color in
49
- * `#RRGGBB` format.
50
- */
51
- theme_params: {
52
- [Key in ThemeParamsKey]?: RGB;
53
- };
54
- }
55
- export interface ViewportChangedPayload {
56
- /**
57
- * The viewport height.
58
- */
59
- height: number;
60
- /**
61
- * The viewport width.
62
- */
63
- width: number;
64
- /**
65
- * Is the viewport currently expanded.
66
- */
67
- is_expanded: boolean;
68
- /**
69
- * Is the viewport current state stable and not going to change in the next moment.
70
- */
71
- is_state_stable: boolean;
72
- }
73
- export interface PopupClosedPayload {
74
- /**
75
- * Identifier of the clicked button. In case, the popup was closed without clicking any button,
76
- * this property will be omitted.
77
- */
78
- button_id?: string;
79
- }
80
- export type PhoneRequestedStatus = 'sent' | string;
81
- export interface PhoneRequestedPayload {
82
- /**
83
- * Request status.
84
- */
85
- status: PhoneRequestedStatus;
86
- }
87
- export type WriteAccessRequestedStatus = 'allowed' | string;
88
- export interface WriteAccessRequestedPayload {
89
- /**
90
- * Request status.
91
- */
92
- status: WriteAccessRequestedStatus;
93
- }
@@ -1,9 +0,0 @@
1
- import type { GlobalEventListener } from './events.js';
2
- type StopListening = () => void;
3
- /**
4
- * Subscribes to all events sent from the native Telegram application.
5
- * Returns function used to remove added event listener.
6
- * @param listener - event listener.
7
- */
8
- export declare function subscribe(listener: GlobalEventListener): StopListening;
9
- export {};
@@ -1,6 +0,0 @@
1
- import type { GlobalEventListener } from './events.js';
2
- /**
3
- * Removes global event listener.
4
- * @param listener - event listener.
5
- */
6
- export declare function unsubscribe(listener: GlobalEventListener): void;
@@ -1,6 +0,0 @@
1
- export * from './createPostEvent.js';
2
- export * from './haptic.js';
3
- export * from './invoke-custom-method.js';
4
- export * from './methods.js';
5
- export * from './popup.js';
6
- export * from './postEvent.js';
@@ -1,24 +0,0 @@
1
- import type { RequestId } from '../shared.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 type AnyInvokeCustomMethodParams = CreateInvokeCustomMethodParams<'deleteStorageValues', {
17
- keys: string | string[];
18
- }> | CreateInvokeCustomMethodParams<'getStorageValues', {
19
- keys: string | string[];
20
- }> | CreateInvokeCustomMethodParams<'getStorageKeys', {}> | CreateInvokeCustomMethodParams<'saveStorageValue', {
21
- key: string;
22
- value: string;
23
- }> | CreateInvokeCustomMethodParams<string, any>;
24
- export {};