@tma.js/sdk 1.4.8 → 1.4.9

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 (149) hide show
  1. package/dist/dts/bridge/errors/MethodUnsupportedError.d.ts +2 -2
  2. package/dist/dts/bridge/errors/ParameterUnsupportedError.d.ts +2 -2
  3. package/dist/dts/bridge/events/events.d.ts +13 -3
  4. package/dist/dts/bridge/events/on.d.ts +5 -3
  5. package/dist/dts/bridge/events/parsers/clipboardTextReceived.d.ts +2 -2
  6. package/dist/dts/bridge/events/parsers/customMethodInvoked.d.ts +2 -2
  7. package/dist/dts/bridge/events/parsers/invoiceClosed.d.ts +1 -1
  8. package/dist/dts/bridge/events/parsers/phoneRequested.d.ts +1 -1
  9. package/dist/dts/bridge/events/parsers/popupClosed.d.ts +1 -1
  10. package/dist/dts/bridge/events/parsers/qrTextReceived.d.ts +1 -1
  11. package/dist/dts/bridge/events/parsers/theme-changed.d.ts +2 -2
  12. package/dist/dts/bridge/events/parsers/viewportChanged.d.ts +1 -1
  13. package/dist/dts/bridge/events/parsers/writeAccessRequested.d.ts +1 -1
  14. package/dist/dts/bridge/events/singletonEmitter.d.ts +1 -1
  15. package/dist/dts/bridge/invokeCustomMethod.d.ts +2 -2
  16. package/dist/dts/bridge/methods/createPostEvent.d.ts +1 -1
  17. package/dist/dts/bridge/methods/custom-methods.d.ts +1 -1
  18. package/dist/dts/bridge/methods/methods.d.ts +5 -2
  19. package/dist/dts/bridge/request.d.ts +5 -3
  20. package/dist/dts/classnames/mergeClassNames.d.ts +2 -18
  21. package/dist/dts/{back-button → components/back-button}/BackButton.d.ts +4 -4
  22. package/dist/dts/{back-button → components/back-button}/types.d.ts +2 -2
  23. package/dist/dts/{closing-behavior → components/closing-behavior}/ClosingBehavior.d.ts +6 -3
  24. package/dist/dts/{closing-behavior → components/closing-behavior}/types.d.ts +1 -1
  25. package/dist/dts/{cloud-storage → components/cloud-storage}/CloudStorage.d.ts +5 -4
  26. package/dist/dts/{haptic-feedback → components/haptic-feedback}/HapticFeedback.d.ts +4 -3
  27. package/dist/dts/components/init-data/chatParser.d.ts +6 -0
  28. package/dist/dts/components/init-data/initDataParser.d.ts +6 -0
  29. package/dist/dts/components/init-data/userParser.d.ts +6 -0
  30. package/dist/dts/{invoice → components/invoice}/Invoice.d.ts +9 -5
  31. package/dist/dts/{invoice → components/invoice}/types.d.ts +1 -1
  32. package/dist/dts/{main-button → components/main-button}/MainButton.d.ts +2 -2
  33. package/dist/dts/{main-button → components/main-button}/types.d.ts +3 -3
  34. package/dist/dts/{mini-app → components/mini-app}/MiniApp.d.ts +11 -6
  35. package/dist/dts/components/mini-app/contactParser.d.ts +2 -0
  36. package/dist/dts/{mini-app → components/mini-app}/types.d.ts +6 -5
  37. package/dist/dts/{popup → components/popup}/Popup.d.ts +8 -5
  38. package/dist/dts/{popup → components/popup}/preparePopupParams.d.ts +1 -1
  39. package/dist/dts/{popup → components/popup}/types.d.ts +1 -1
  40. package/dist/dts/{qr-scanner → components/qr-scanner}/QRScanner.d.ts +8 -5
  41. package/dist/dts/{qr-scanner → components/qr-scanner}/types.d.ts +1 -1
  42. package/dist/dts/{settings-button → components/settings-button}/SettingsButton.d.ts +4 -4
  43. package/dist/dts/{settings-button → components/settings-button}/types.d.ts +2 -2
  44. package/dist/dts/{theme-params → components/theme-params}/ThemeParams.d.ts +8 -4
  45. package/dist/dts/{theme-params → components/theme-params}/requestThemeParams.d.ts +1 -1
  46. package/dist/dts/components/theme-params/themeParamsParser.d.ts +3 -0
  47. package/dist/dts/{theme-params → components/theme-params}/types.d.ts +2 -2
  48. package/dist/dts/{utils → components/utils}/Utils.d.ts +4 -4
  49. package/dist/dts/{viewport → components/viewport}/Viewport.d.ts +8 -4
  50. package/dist/dts/{viewport → components/viewport}/isStableViewportPlatform.d.ts +1 -1
  51. package/dist/dts/{viewport → components/viewport}/requestViewport.d.ts +1 -1
  52. package/dist/dts/{viewport → components/viewport}/types.d.ts +2 -2
  53. package/dist/dts/css/bindMiniAppCSSVars.d.ts +2 -2
  54. package/dist/dts/css/bindThemeCSSVars.d.ts +1 -1
  55. package/dist/dts/css/bindViewportCSSVars.d.ts +1 -1
  56. package/dist/dts/event-emitter/types.d.ts +1 -1
  57. package/dist/dts/globals.d.ts +1 -1
  58. package/dist/dts/index.d.ts +142 -27
  59. package/dist/dts/init/creators/createBackButton.d.ts +2 -2
  60. package/dist/dts/init/creators/createClosingBehavior.d.ts +2 -2
  61. package/dist/dts/init/creators/createMainButton.d.ts +3 -3
  62. package/dist/dts/init/creators/createMiniApp.d.ts +5 -5
  63. package/dist/dts/init/creators/createRequestIdGenerator.d.ts +1 -1
  64. package/dist/dts/init/creators/createSettingsButton.d.ts +2 -2
  65. package/dist/dts/init/creators/createThemeParams.d.ts +2 -1
  66. package/dist/dts/init/creators/createViewport.d.ts +3 -3
  67. package/dist/dts/init/css/processCSSVarsOption.d.ts +3 -3
  68. package/dist/dts/init/types.d.ts +16 -16
  69. package/dist/dts/launch-params/launchParamsParser.d.ts +2 -1
  70. package/dist/dts/launch-params/types.d.ts +3 -3
  71. package/dist/dts/navigation/HashNavigator/HashNavigator.d.ts +6 -3
  72. package/dist/dts/navigation/HashNavigator/types.d.ts +1 -2
  73. package/dist/dts/navigation/Navigator/Navigator.d.ts +1 -1
  74. package/dist/dts/parsing/ValueParser.d.ts +1 -1
  75. package/dist/dts/parsing/parsers/array.d.ts +2 -2
  76. package/dist/dts/parsing/parsers/boolean.d.ts +2 -1
  77. package/dist/dts/parsing/parsers/date.d.ts +2 -1
  78. package/dist/dts/parsing/parsers/number.d.ts +2 -1
  79. package/dist/dts/parsing/parsers/rgb.d.ts +3 -1
  80. package/dist/dts/parsing/parsers/string.d.ts +2 -1
  81. package/dist/dts/state/State.d.ts +2 -2
  82. package/dist/dts/state/types.d.ts +1 -1
  83. package/dist/dts/storage.d.ts +2 -2
  84. package/dist/dts/supports/createSupportsFunc.d.ts +2 -2
  85. package/dist/dts/supports/createSupportsParamFunc.d.ts +2 -2
  86. package/dist/dts/supports/supports.d.ts +2 -2
  87. package/dist/dts/supports/types.d.ts +3 -0
  88. package/dist/dts/types/logical.d.ts +16 -0
  89. package/dist/dts/types/methods.d.ts +1 -1
  90. package/dist/dts/types/unions.d.ts +20 -0
  91. package/dist/dts/types/utils.d.ts +0 -28
  92. package/dist/dts/version/compareVersions.d.ts +2 -1
  93. package/dist/dts/version/types.d.ts +1 -0
  94. package/dist/index.cjs +1 -1
  95. package/dist/index.iife.js +1 -1
  96. package/dist/index.mjs +1527 -1527
  97. package/package.json +1 -1
  98. package/dist/dts/back-button/index.d.ts +0 -2
  99. package/dist/dts/bridge/env/index.d.ts +0 -2
  100. package/dist/dts/bridge/errors/index.d.ts +0 -2
  101. package/dist/dts/bridge/events/index.d.ts +0 -9
  102. package/dist/dts/bridge/events/parsers/index.d.ts +0 -9
  103. package/dist/dts/bridge/index.d.ts +0 -7
  104. package/dist/dts/bridge/methods/index.d.ts +0 -6
  105. package/dist/dts/classnames/index.d.ts +0 -2
  106. package/dist/dts/closing-behavior/index.d.ts +0 -2
  107. package/dist/dts/cloud-storage/index.d.ts +0 -1
  108. package/dist/dts/colors/index.d.ts +0 -5
  109. package/dist/dts/css/index.d.ts +0 -4
  110. package/dist/dts/event-emitter/index.d.ts +0 -2
  111. package/dist/dts/haptic-feedback/index.d.ts +0 -1
  112. package/dist/dts/init/creators/index.d.ts +0 -8
  113. package/dist/dts/init/css/index.d.ts +0 -1
  114. package/dist/dts/init/index.d.ts +0 -2
  115. package/dist/dts/init-data/chatParser.d.ts +0 -5
  116. package/dist/dts/init-data/index.d.ts +0 -6
  117. package/dist/dts/init-data/initDataParser.d.ts +0 -5
  118. package/dist/dts/init-data/userParser.d.ts +0 -5
  119. package/dist/dts/invoice/index.d.ts +0 -2
  120. package/dist/dts/launch-params/index.d.ts +0 -10
  121. package/dist/dts/logger/index.d.ts +0 -1
  122. package/dist/dts/main-button/index.d.ts +0 -2
  123. package/dist/dts/mini-app/contactParser.d.ts +0 -2
  124. package/dist/dts/mini-app/index.d.ts +0 -2
  125. package/dist/dts/misc/index.d.ts +0 -5
  126. package/dist/dts/navigation/HashNavigator/index.d.ts +0 -2
  127. package/dist/dts/navigation/Navigator/index.d.ts +0 -2
  128. package/dist/dts/navigation/index.d.ts +0 -4
  129. package/dist/dts/parsing/index.d.ts +0 -10
  130. package/dist/dts/parsing/parsers/index.d.ts +0 -8
  131. package/dist/dts/popup/index.d.ts +0 -2
  132. package/dist/dts/qr-scanner/index.d.ts +0 -2
  133. package/dist/dts/settings-button/index.d.ts +0 -2
  134. package/dist/dts/state/index.d.ts +0 -2
  135. package/dist/dts/supports/index.d.ts +0 -4
  136. package/dist/dts/theme-params/index.d.ts +0 -6
  137. package/dist/dts/theme-params/themeParamsParser.d.ts +0 -2
  138. package/dist/dts/timeout/index.d.ts +0 -4
  139. package/dist/dts/types/index.d.ts +0 -4
  140. package/dist/dts/utils/index.d.ts +0 -1
  141. package/dist/dts/version/index.d.ts +0 -2
  142. package/dist/dts/viewport/index.d.ts +0 -4
  143. /package/dist/dts/{init-data → components/init-data}/InitData.d.ts +0 -0
  144. /package/dist/dts/{init-data → components/init-data}/parseInitData.d.ts +0 -0
  145. /package/dist/dts/{init-data → components/init-data}/types.d.ts +0 -0
  146. /package/dist/dts/{theme-params → components/theme-params}/keys.d.ts +0 -0
  147. /package/dist/dts/{theme-params → components/theme-params}/parseThemeParams.d.ts +0 -0
  148. /package/dist/dts/{theme-params → components/theme-params}/serializeThemeParams.d.ts +0 -0
  149. /package/dist/dts/{viewport → components/viewport}/utils.d.ts +0 -0
@@ -1,5 +1,5 @@
1
- import type { Version } from '../../version/index.js';
2
- import type { MiniAppsMethodName } from '../methods/index.js';
1
+ import type { Version } from '../../version/types.js';
2
+ import type { MiniAppsMethodName } from '../methods/methods.js';
3
3
  /**
4
4
  * Error thrown in case, unsupported method was called.
5
5
  */
@@ -1,5 +1,5 @@
1
- import type { Version } from '../../version/index.js';
2
- import type { MiniAppsMethodName } from '../methods/index.js';
1
+ import type { Version } from '../../version/types.js';
2
+ import type { MiniAppsMethodName } from '../methods/methods.js';
3
3
  /**
4
4
  * Error thrown in case, unsupported parameter was used.
5
5
  */
@@ -1,6 +1,16 @@
1
- import type { AnySubscribeListener, EventEmitter, EventListener, EventParams } from '../../event-emitter/index.js';
2
- import type { IsNever, Not } from '../../types/index.js';
3
- import type { ClipboardTextReceivedPayload, CustomMethodInvokedPayload, InvoiceClosedPayload, PhoneRequestedPayload, PopupClosedPayload, QrTextReceivedPayload, ThemeChangedPayload, ViewportChangedPayload, WriteAccessRequestedPayload } from './parsers/index.js';
1
+ import type { ClipboardTextReceivedPayload } from './parsers/clipboardTextReceived.js';
2
+ import type { CustomMethodInvokedPayload } from './parsers/customMethodInvoked.js';
3
+ import type { InvoiceClosedPayload } from './parsers/invoiceClosed.js';
4
+ import type { PhoneRequestedPayload } from './parsers/phoneRequested.js';
5
+ import type { PopupClosedPayload } from './parsers/popupClosed.js';
6
+ import type { QrTextReceivedPayload } from './parsers/qrTextReceived.js';
7
+ import type { ThemeChangedPayload } from './parsers/theme-changed.js';
8
+ import type { ViewportChangedPayload } from './parsers/viewportChanged.js';
9
+ import type { WriteAccessRequestedPayload } from './parsers/writeAccessRequested.js';
10
+ import type { EventEmitter } from '../../event-emitter/EventEmitter.js';
11
+ import type { AnySubscribeListener, EventListener, EventParams } from '../../event-emitter/types.js';
12
+ import type { Not } from '../../types/logical.js';
13
+ import type { IsNever } from '../../types/utils.js';
4
14
  /**
5
15
  * Map where key is known event name, and value is its listener.
6
16
  * @see https://docs.telegram-mini-apps.com/platform/events
@@ -1,10 +1,12 @@
1
1
  import type { MiniAppsEventListener, MiniAppsEventName } from './events.js';
2
- type StopListening = () => void;
2
+ /**
3
+ * Removes event listener.
4
+ */
5
+ export type RemoveListenerFn = () => void;
3
6
  /**
4
7
  * Adds new listener to the specified event. Returns handler
5
8
  * which allows to stop listening to event.
6
9
  * @param event - event name.
7
10
  * @param listener - event listener.
8
11
  */
9
- export declare function on<E extends MiniAppsEventName>(event: E, listener: MiniAppsEventListener<E>): StopListening;
10
- export {};
12
+ export declare function on<E extends MiniAppsEventName>(event: E, listener: MiniAppsEventListener<E>): RemoveListenerFn;
@@ -1,4 +1,4 @@
1
- import type { RequestId } from '../../../types/index.js';
1
+ import type { RequestId } from '../../../types/request-id.js';
2
2
  export interface ClipboardTextReceivedPayload {
3
3
  /**
4
4
  * Passed during the `web_app_read_text_from_clipboard` method invocation `req_id` value.
@@ -10,4 +10,4 @@ export interface ClipboardTextReceivedPayload {
10
10
  */
11
11
  data?: string | null;
12
12
  }
13
- export declare function clipboardTextReceived(): import('../../../parsing/index.js').ValueParser<ClipboardTextReceivedPayload, false>;
13
+ export declare function clipboardTextReceived(): import("../../../parsing/ValueParser.js").ValueParser<ClipboardTextReceivedPayload, false>;
@@ -1,4 +1,4 @@
1
- import type { RequestId } from '../../../types/index.js';
1
+ import type { RequestId } from '../../../types/request-id.js';
2
2
  export interface CustomMethodInvokedPayload<R = unknown> {
3
3
  /**
4
4
  * Unique identifier of this invocation.
@@ -13,4 +13,4 @@ export interface CustomMethodInvokedPayload<R = unknown> {
13
13
  */
14
14
  error?: string;
15
15
  }
16
- export declare function customMethodInvoked(): import('../../../parsing/index.js').ValueParser<CustomMethodInvokedPayload<unknown>, false>;
16
+ export declare function customMethodInvoked(): import("../../../parsing/ValueParser.js").ValueParser<CustomMethodInvokedPayload<unknown>, false>;
@@ -9,4 +9,4 @@ export interface InvoiceClosedPayload {
9
9
  */
10
10
  status: InvoiceStatus;
11
11
  }
12
- export declare function invoiceClosed(): import('../../../parsing/index.js').ValueParser<InvoiceClosedPayload, false>;
12
+ export declare function invoiceClosed(): import("../../../parsing/ValueParser.js").ValueParser<InvoiceClosedPayload, false>;
@@ -5,4 +5,4 @@ export interface PhoneRequestedPayload {
5
5
  */
6
6
  status: PhoneRequestedStatus;
7
7
  }
8
- export declare function phoneRequested(): import('../../../parsing/index.js').ValueParser<PhoneRequestedPayload, false>;
8
+ export declare function phoneRequested(): import("../../../parsing/ValueParser.js").ValueParser<PhoneRequestedPayload, false>;
@@ -5,4 +5,4 @@ export interface PopupClosedPayload {
5
5
  */
6
6
  button_id?: string;
7
7
  }
8
- export declare function popupClosed(): import('../../../parsing/index.js').ValueParser<PopupClosedPayload, false>;
8
+ export declare function popupClosed(): import("../../../parsing/ValueParser.js").ValueParser<PopupClosedPayload, false>;
@@ -4,4 +4,4 @@ export interface QrTextReceivedPayload {
4
4
  */
5
5
  data?: string;
6
6
  }
7
- export declare function qrTextReceived(): import('../../../parsing/index.js').ValueParser<QrTextReceivedPayload, false>;
7
+ export declare function qrTextReceived(): import("../../../parsing/ValueParser.js").ValueParser<QrTextReceivedPayload, false>;
@@ -1,4 +1,4 @@
1
- import type { RGB } from '../../../colors/index.js';
1
+ import type { RGB } from '../../../colors/types.js';
2
2
  export interface ThemeChangedPayload {
3
3
  /**
4
4
  * Map where the key is a theme stylesheet key and value is the corresponding color in
@@ -39,4 +39,4 @@ export interface ThemeChangedPayload {
39
39
  [key: string]: RGB | undefined;
40
40
  };
41
41
  }
42
- export declare function themeChanged(): import('../../../parsing/index.js').ValueParser<ThemeChangedPayload, false>;
42
+ export declare function themeChanged(): import("../../../parsing/ValueParser.js").ValueParser<ThemeChangedPayload, false>;
@@ -16,4 +16,4 @@ export interface ViewportChangedPayload {
16
16
  */
17
17
  is_state_stable: boolean;
18
18
  }
19
- export declare function viewportChanged(): import('../../../parsing/index.js').ValueParser<ViewportChangedPayload, false>;
19
+ export declare function viewportChanged(): import("../../../parsing/ValueParser.js").ValueParser<ViewportChangedPayload, false>;
@@ -5,4 +5,4 @@ export interface WriteAccessRequestedPayload {
5
5
  */
6
6
  status: WriteAccessRequestedStatus;
7
7
  }
8
- export declare function writeAccessRequested(): import('../../../parsing/index.js').ValueParser<WriteAccessRequestedPayload, false>;
8
+ export declare function writeAccessRequested(): import("../../../parsing/ValueParser.js").ValueParser<WriteAccessRequestedPayload, false>;
@@ -1,4 +1,4 @@
1
- import type { MiniAppsEventEmitter } from '../../bridge/index.js';
1
+ import type { MiniAppsEventEmitter } from './events.js';
2
2
  /**
3
3
  * Returns singleton instance of bridge EventEmitter. Also, defines
4
4
  * Telegram event handlers.
@@ -1,5 +1,5 @@
1
- import type { ExecuteWithOptions } from '../types/index.js';
2
- import type { CustomMethodName, CustomMethodParams } from './methods/index.js';
1
+ import type { CustomMethodName, CustomMethodParams } from './methods/custom-methods.js';
2
+ import type { ExecuteWithOptions } from '../types/methods.js';
3
3
  /**
4
4
  * Invokes known custom method. Returns method execution result.
5
5
  * @param method - method name.
@@ -1,5 +1,5 @@
1
- import type { Version } from '../../version/index.js';
2
1
  import { type PostEvent } from './postEvent.js';
2
+ import type { Version } from '../../version/types.js';
3
3
  /**
4
4
  * Creates function which checks if specified method and parameters are supported. In case,
5
5
  * method or parameters are unsupported, an error will be thrown.
@@ -1,4 +1,4 @@
1
- import type { RequestId } from '../../types/index.js';
1
+ import type { RequestId } from '../../types/request-id.js';
2
2
  interface CreateInvokeCustomMethodParams<M extends string, Params extends object> {
3
3
  /**
4
4
  * Unique request identifier.
@@ -1,8 +1,11 @@
1
- import type { RGB } from '../../colors/index.js';
2
- import type { IsNever, Not, RequestId, UnionKeys } from '../../types/index.js';
3
1
  import type { AnyInvokeCustomMethodParams } from './custom-methods.js';
4
2
  import type { AnyHapticFeedbackParams } from './haptic.js';
5
3
  import type { PopupParams } from './popup.js';
4
+ import type { RGB } from '../../colors/types.js';
5
+ import type { Not } from '../../types/logical.js';
6
+ import type { RequestId } from '../../types/request-id.js';
7
+ import type { UnionKeys } from '../../types/unions.js';
8
+ import type { IsNever } from '../../types/utils.js';
6
9
  /**
7
10
  * Color key which could be used to update header color.
8
11
  */
@@ -1,6 +1,8 @@
1
- import type { And, ExecuteWithOptions, If, IsNever } from '../types/index.js';
2
- import { type MiniAppsEventHasParams, type MiniAppsEventName, type MiniAppsEventParams } from './events/index.js';
3
- import { type MiniAppsEmptyMethodName, type MiniAppsMethodAcceptParams, type MiniAppsMethodName, type MiniAppsMethodParams, type MiniAppsNonEmptyMethodName } from './methods/index.js';
1
+ import type { MiniAppsEventHasParams, MiniAppsEventName, MiniAppsEventParams } from './events/events.js';
2
+ import type { MiniAppsEmptyMethodName, MiniAppsMethodAcceptParams, MiniAppsMethodName, MiniAppsMethodParams, MiniAppsNonEmptyMethodName } from './methods/methods.js';
3
+ import type { And, If } from '../types/logical.js';
4
+ import type { ExecuteWithOptions } from '../types/methods.js';
5
+ import type { IsNever } from '../types/utils.js';
4
6
  /**
5
7
  * Names of methods, which require passing "req_id" parameter.
6
8
  */
@@ -1,20 +1,5 @@
1
- /**
2
- * Returns union keys removing those, which values are not strings.
3
- */
4
- type UnionStringKeys<U> = U extends U ? {
5
- [K in keyof U]-?: U[K] extends string | undefined ? K : never;
6
- }[keyof U] : never;
7
- /**
8
- * Returns union required keys.
9
- */
10
- type UnionRequiredKeys<U> = U extends U ? {
11
- [K in UnionStringKeys<U>]: ({} extends Pick<U, K> ? never : K);
12
- }[UnionStringKeys<U>] : never;
13
- /**
14
- * Returns union optional keys.
15
- */
16
- type UnionOptionalKeys<U> = Exclude<UnionStringKeys<U>, UnionRequiredKeys<U>>;
17
- type MergeClassNames<Tuple extends any[]> = Exclude<Tuple[number], number | string | null | undefined | any[] | boolean> extends infer Union ? {
1
+ import type { UnionOptionalKeys, UnionRequiredKeys } from '../types/unions.js';
2
+ export type MergeClassNames<Tuple extends any[]> = Exclude<Tuple[number], number | string | null | undefined | any[] | boolean> extends infer Union ? {
18
3
  [K in UnionRequiredKeys<Union>]: string;
19
4
  } & {
20
5
  [K in UnionOptionalKeys<Union>]?: string;
@@ -26,4 +11,3 @@ type MergeClassNames<Tuple extends any[]> = Exclude<Tuple[number], number | stri
26
11
  * @see classNames
27
12
  */
28
13
  export declare function mergeClassNames<T extends any[]>(...partials: T): MergeClassNames<T>;
29
- export {};
@@ -1,8 +1,8 @@
1
- import { type PostEvent } from '../bridge/index.js';
2
- import { EventEmitter } from '../event-emitter/index.js';
3
- import { type SupportsFunc } from '../supports/index.js';
4
- import type { Version } from '../version/index.js';
5
1
  import type { BackButtonEvents } from './types.js';
2
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
3
+ import { EventEmitter } from '../../event-emitter/EventEmitter.js';
4
+ import type { SupportsFunc } from '../../supports/types.js';
5
+ import type { Version } from '../../version/types.js';
6
6
  type Emitter = EventEmitter<BackButtonEvents>;
7
7
  /**
8
8
  * Class which controls the back button displayed in the header of the Mini App in the Telegram
@@ -1,5 +1,5 @@
1
- import type { MiniAppsEventListener } from '../bridge/index.js';
2
- import type { StateEvents } from '../state/index.js';
1
+ import type { MiniAppsEventListener } from '../../bridge/events/events.js';
2
+ import type { StateEvents } from '../../state/types.js';
3
3
  export interface BackButtonState {
4
4
  isVisible: boolean;
5
5
  }
@@ -1,5 +1,7 @@
1
- import { type PostEvent } from '../bridge/index.js';
2
1
  import type { ClosingBehaviorEvents } from './types.js';
2
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
3
+ import { EventEmitter } from '../../event-emitter/EventEmitter.js';
4
+ type Emitter = EventEmitter<ClosingBehaviorEvents>;
3
5
  /**
4
6
  * Component responsible for controlling current closing confirmation
5
7
  * status.
@@ -28,9 +30,10 @@ export declare class ClosingBehavior {
28
30
  /**
29
31
  * Adds new event listener.
30
32
  */
31
- on: <E extends "change" | "change:isConfirmationNeeded">(event: E, listener: import('../event-emitter/index.js').EventListener<ClosingBehaviorEvents[E]>) => import('../event-emitter/index.js').RemoveEventListener;
33
+ on: Emitter['on'];
32
34
  /**
33
35
  * Removes event listener.
34
36
  */
35
- off: <E extends "change" | "change:isConfirmationNeeded">(event: E, listener: import('../event-emitter/index.js').EventListener<ClosingBehaviorEvents[E]>) => void;
37
+ off: Emitter['off'];
36
38
  }
39
+ export {};
@@ -1,4 +1,4 @@
1
- import type { StateEvents } from '../state/index.js';
1
+ import type { StateEvents } from '../../state/types.js';
2
2
  export interface ClosingBehaviorState {
3
3
  isConfirmationNeeded: boolean;
4
4
  }
@@ -1,7 +1,8 @@
1
- import { postEvent as defaultPostEvent } from '../bridge/index.js';
2
- import { type SupportsFunc } from '../supports/index.js';
3
- import type { CreateRequestIdFunc, ExecuteWithTimeout } from '../types/index.js';
4
- import type { Version } from '../version/index.js';
1
+ import { postEvent as defaultPostEvent } from '../../bridge/methods/postEvent.js';
2
+ import type { SupportsFunc } from '../../supports/types.js';
3
+ import type { ExecuteWithTimeout } from '../../types/methods.js';
4
+ import type { CreateRequestIdFunc } from '../../types/request-id.js';
5
+ import type { Version } from '../../version/types.js';
5
6
  export declare class CloudStorage {
6
7
  private readonly createRequestId;
7
8
  private readonly postEvent;
@@ -1,6 +1,7 @@
1
- import { type ImpactHapticFeedbackStyle, type NotificationHapticFeedbackType, type PostEvent } from '../bridge/index.js';
2
- import { type SupportsFunc } from '../supports/index.js';
3
- import type { Version } from '../version/index.js';
1
+ import type { ImpactHapticFeedbackStyle, NotificationHapticFeedbackType } from '../../bridge/methods/haptic.js';
2
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
3
+ import type { SupportsFunc } from '../../supports/types.js';
4
+ import type { Version } from '../../version/types.js';
4
5
  /**
5
6
  * Class which controls haptic feedback. It allows calling different types of
6
7
  * haptic notifications which usually occur after user interaction with
@@ -0,0 +1,6 @@
1
+ import type { Chat } from './types.js';
2
+ import type { ValueParser } from '../../parsing/ValueParser.js';
3
+ /**
4
+ * Returns parser used to parse chat data.
5
+ */
6
+ export declare function chatParser(): ValueParser<Chat, false>;
@@ -0,0 +1,6 @@
1
+ import type { InitDataParsed } from './types.js';
2
+ import type { ValueParser } from '../../parsing/ValueParser.js';
3
+ /**
4
+ * Returns parser used to parse init data, presented as search params.
5
+ */
6
+ export declare function initDataParser(): ValueParser<InitDataParsed, false>;
@@ -0,0 +1,6 @@
1
+ import type { User } from './types.js';
2
+ import type { ValueParser } from '../../parsing/ValueParser.js';
3
+ /**
4
+ * Returns parser used to parse user data.
5
+ */
6
+ export declare function userParser(): ValueParser<User, false>;
@@ -1,7 +1,10 @@
1
- import { type InvoiceStatus, type PostEvent } from '../bridge/index.js';
2
- import { type SupportsFunc } from '../supports/index.js';
3
- import type { Version } from '../version/index.js';
4
1
  import type { InvoiceEvents } from './types.js';
2
+ import type { InvoiceStatus } from '../../bridge/events/parsers/invoiceClosed.js';
3
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
4
+ import { EventEmitter } from '../../event-emitter/EventEmitter.js';
5
+ import type { SupportsFunc } from '../../supports/types.js';
6
+ import type { Version } from '../../version/types.js';
7
+ type Emitter = EventEmitter<InvoiceEvents>;
5
8
  /**
6
9
  * Controls currently displayed invoice.
7
10
  */
@@ -18,11 +21,11 @@ export declare class Invoice {
18
21
  /**
19
22
  * Adds new event listener.
20
23
  */
21
- on: <E extends "change" | "change:isOpened">(event: E, listener: import('../event-emitter/index.js').EventListener<InvoiceEvents[E]>) => import('../event-emitter/index.js').RemoveEventListener;
24
+ on: Emitter['on'];
22
25
  /**
23
26
  * Removes event listener.
24
27
  */
25
- off: <E extends "change" | "change:isOpened">(event: E, listener: import('../event-emitter/index.js').EventListener<InvoiceEvents[E]>) => void;
28
+ off: Emitter['off'];
26
29
  /**
27
30
  * Opens an invoice using its slug.
28
31
  * @param slug - invoice slug.
@@ -41,3 +44,4 @@ export declare class Invoice {
41
44
  */
42
45
  supports: SupportsFunc<'open'>;
43
46
  }
47
+ export {};
@@ -1,4 +1,4 @@
1
- import type { StateEvents } from '../state/index.js';
1
+ import type { StateEvents } from '../../state/types.js';
2
2
  export interface InvoiceState {
3
3
  isOpened: boolean;
4
4
  }
@@ -1,6 +1,6 @@
1
- import { EventEmitter } from '../event-emitter/index.js';
2
- import type { RGB } from '../colors/index.js';
3
1
  import type { MainButtonEvents, MainButtonParams, MainButtonProps } from './types.js';
2
+ import type { RGB } from '../../colors/types.js';
3
+ import { EventEmitter } from '../../event-emitter/EventEmitter.js';
4
4
  type Emitter = EventEmitter<MainButtonEvents>;
5
5
  /**
6
6
  * Controls the main button, which is displayed at the bottom
@@ -1,6 +1,6 @@
1
- import type { PostEvent } from '../bridge/index.js';
2
- import type { RGB } from '../colors/index.js';
3
- import type { StateEvents } from '../state/index.js';
1
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
2
+ import type { RGB } from '../../colors/types.js';
3
+ import type { StateEvents } from '../../state/types.js';
4
4
  export interface MainButtonParams {
5
5
  backgroundColor?: RGB;
6
6
  isEnabled?: boolean;
@@ -1,8 +1,12 @@
1
- import { type PhoneRequestedStatus, type SwitchInlineQueryChatType, type WriteAccessRequestedStatus } from '../bridge/index.js';
2
- import { type RGB } from '../colors/index.js';
3
- import { type SupportsFunc } from '../supports/index.js';
4
- import type { ExecuteWithTimeout } from '../types/index.js';
5
1
  import type { MiniAppEvents, MiniAppHeaderColor, MiniAppProps, RequestedContact } from './types.js';
2
+ import type { PhoneRequestedStatus } from '../../bridge/events/parsers/phoneRequested.js';
3
+ import type { WriteAccessRequestedStatus } from '../../bridge/events/parsers/writeAccessRequested.js';
4
+ import type { SwitchInlineQueryChatType } from '../../bridge/methods/methods.js';
5
+ import type { RGB } from '../../colors/types.js';
6
+ import { EventEmitter } from '../../event-emitter/EventEmitter.js';
7
+ import type { SupportsFunc } from '../../supports/types.js';
8
+ import type { ExecuteWithTimeout } from '../../types/methods.js';
9
+ type Emitter = EventEmitter<MiniAppEvents>;
6
10
  /**
7
11
  * Provides common Mini Apps functionality not covered by other system components.
8
12
  */
@@ -50,11 +54,11 @@ export declare class MiniApp {
50
54
  /**
51
55
  * Adds new event listener.
52
56
  */
53
- on: <E extends "change" | "change:backgroundColor" | "change:headerColor">(event: E, listener: import('../event-emitter/index.js').EventListener<MiniAppEvents[E]>) => import('../event-emitter/index.js').RemoveEventListener;
57
+ on: Emitter['on'];
54
58
  /**
55
59
  * Removes event listener.
56
60
  */
57
- off: <E extends "change" | "change:backgroundColor" | "change:headerColor">(event: E, listener: import('../event-emitter/index.js').EventListener<MiniAppEvents[E]>) => void;
61
+ off: Emitter['off'];
58
62
  /**
59
63
  * Informs the Telegram app that the Mini App is ready to be displayed.
60
64
  *
@@ -127,3 +131,4 @@ export declare class MiniApp {
127
131
  */
128
132
  switchInlineQuery(text: string, chatTypes?: SwitchInlineQueryChatType[]): void;
129
133
  }
134
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { RequestedContact } from './types.js';
2
+ export declare const contactParser: import("../../parsing/ValueParser.js").ValueParser<RequestedContact, false>;
@@ -1,8 +1,9 @@
1
- import type { HeaderColorKey, PostEvent } from '../bridge/index.js';
2
- import type { RGB } from '../colors/index.js';
3
- import type { StateEvents } from '../state/index.js';
4
- import type { CreateRequestIdFunc } from '../types/index.js';
5
- import type { Version } from '../version/index.js';
1
+ import type { HeaderColorKey } from '../../bridge/methods/methods.js';
2
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
3
+ import type { RGB } from '../../colors/types.js';
4
+ import type { StateEvents } from '../../state/types.js';
5
+ import type { CreateRequestIdFunc } from '../../types/request-id.js';
6
+ import type { Version } from '../../version/types.js';
6
7
  export interface MiniAppProps {
7
8
  headerColor: MiniAppHeaderColor;
8
9
  backgroundColor: RGB;
@@ -1,7 +1,9 @@
1
- import { type PostEvent } from '../bridge/index.js';
2
- import { type SupportsFunc } from '../supports/index.js';
3
- import type { Version } from '../version/index.js';
4
1
  import type { OpenPopupOptions, PopupEvents } from './types.js';
2
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
3
+ import { EventEmitter } from '../../event-emitter/EventEmitter.js';
4
+ import type { SupportsFunc } from '../../supports/types.js';
5
+ import type { Version } from '../../version/types.js';
6
+ type Emitter = EventEmitter<PopupEvents>;
5
7
  /**
6
8
  * Controls currently displayed application popup. It allows developers to
7
9
  * open new custom popups and detect popup-connected events.
@@ -19,11 +21,11 @@ export declare class Popup {
19
21
  /**
20
22
  * Adds new event listener.
21
23
  */
22
- on: <E extends "change" | "change:isOpened">(event: E, listener: import('../event-emitter/index.js').EventListener<PopupEvents[E]>) => import('../event-emitter/index.js').RemoveEventListener;
24
+ on: Emitter['on'];
23
25
  /**
24
26
  * Removes event listener.
25
27
  */
26
- off: <E extends "change" | "change:isOpened">(event: E, listener: import('../event-emitter/index.js').EventListener<PopupEvents[E]>) => void;
28
+ off: Emitter['off'];
27
29
  /**
28
30
  * A method that shows a native popup described by the `params` argument.
29
31
  * Promise will be resolved when popup is closed. Resolved value will have
@@ -43,3 +45,4 @@ export declare class Popup {
43
45
  */
44
46
  supports: SupportsFunc<'open'>;
45
47
  }
48
+ export {};
@@ -1,5 +1,5 @@
1
- import type { PopupParams as BridgePopupParams } from '../bridge/index.js';
2
1
  import type { OpenPopupOptions } from './types.js';
2
+ import type { PopupParams as BridgePopupParams } from '../../bridge/methods/popup.js';
3
3
  /**
4
4
  * Prepares popup parameters before sending them to native app.
5
5
  * @param params - popup parameters.
@@ -1,4 +1,4 @@
1
- import type { StateEvents } from '../state/index.js';
1
+ import type { StateEvents } from '../../state/types.js';
2
2
  export interface PopupState {
3
3
  isOpened: boolean;
4
4
  }
@@ -1,7 +1,9 @@
1
- import { type PostEvent } from '../bridge/index.js';
2
- import { type SupportsFunc } from '../supports/index.js';
3
- import type { Version } from '../version/index.js';
4
1
  import type { QRScannerEvents } from './types.js';
2
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
3
+ import { EventEmitter } from '../../event-emitter/EventEmitter.js';
4
+ import type { SupportsFunc } from '../../supports/types.js';
5
+ import type { Version } from '../../version/types.js';
6
+ type Emitter = EventEmitter<QRScannerEvents>;
5
7
  /**
6
8
  * Provides QR scanner functionality.
7
9
  */
@@ -29,13 +31,14 @@ export declare class QRScanner {
29
31
  /**
30
32
  * Adds new event listener.
31
33
  */
32
- on: <E extends "change" | "change:isOpened">(event: E, listener: import('../event-emitter/index.js').EventListener<QRScannerEvents[E]>) => import('../event-emitter/index.js').RemoveEventListener;
34
+ on: Emitter['on'];
33
35
  /**
34
36
  * Removes event listener.
35
37
  */
36
- off: <E extends "change" | "change:isOpened">(event: E, listener: import('../event-emitter/index.js').EventListener<QRScannerEvents[E]>) => void;
38
+ off: Emitter['off'];
37
39
  /**
38
40
  * Checks if specified method is supported by current component.
39
41
  */
40
42
  supports: SupportsFunc<'open' | 'close'>;
41
43
  }
44
+ export {};
@@ -1,4 +1,4 @@
1
- import type { StateEvents } from '../state/index.js';
1
+ import type { StateEvents } from '../../state/types.js';
2
2
  export interface QRScannerState {
3
3
  isOpened: boolean;
4
4
  }
@@ -1,8 +1,8 @@
1
- import { type PostEvent } from '../bridge/index.js';
2
- import { EventEmitter } from '../event-emitter/index.js';
3
- import { type SupportsFunc } from '../supports/index.js';
4
- import type { Version } from '../version/index.js';
5
1
  import type { SettingsButtonEvents } from './types.js';
2
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
3
+ import { EventEmitter } from '../../event-emitter/EventEmitter.js';
4
+ import type { SupportsFunc } from '../../supports/types.js';
5
+ import type { Version } from '../../version/types.js';
6
6
  type Emitter = EventEmitter<SettingsButtonEvents>;
7
7
  export declare class SettingsButton {
8
8
  private readonly postEvent;
@@ -1,5 +1,5 @@
1
- import type { MiniAppsEventListener } from '../bridge/index.js';
2
- import type { StateEvents } from '../state/index.js';
1
+ import type { MiniAppsEventListener } from '../../bridge/events/events.js';
2
+ import type { StateEvents } from '../../state/types.js';
3
3
  export interface SettingsButtonState {
4
4
  isVisible: boolean;
5
5
  }
@@ -1,5 +1,8 @@
1
- import { type RGB } from '../colors/index.js';
2
1
  import type { ThemeParamsEvents, ThemeParamsParsed } from './types.js';
2
+ import type { RemoveListenerFn } from '../../bridge/events/on.js';
3
+ import type { RGB } from '../../colors/types.js';
4
+ import { EventEmitter } from '../../event-emitter/EventEmitter.js';
5
+ type Emitter = EventEmitter<ThemeParamsEvents>;
3
6
  export declare class ThemeParams {
4
7
  private readonly ee;
5
8
  private readonly state;
@@ -35,11 +38,11 @@ export declare class ThemeParams {
35
38
  /**
36
39
  * Adds new event listener.
37
40
  */
38
- on: <E extends `change:${string}` | "change">(event: E, listener: import('../event-emitter/index.js').EventListener<ThemeParamsEvents[E]>) => import('../event-emitter/index.js').RemoveEventListener;
41
+ on: Emitter['on'];
39
42
  /**
40
43
  * Removes event listener.
41
44
  */
42
- off: <E extends `change:${string}` | "change">(event: E, listener: import('../event-emitter/index.js').EventListener<ThemeParamsEvents[E]>) => void;
45
+ off: Emitter['off'];
43
46
  get secondaryBackgroundColor(): RGB | undefined;
44
47
  /**
45
48
  * @since v6.10
@@ -53,10 +56,11 @@ export declare class ThemeParams {
53
56
  * Starts listening to theme changes and applies them.
54
57
  * @returns Function to stop listening.
55
58
  */
56
- listen(): () => void;
59
+ listen(): RemoveListenerFn;
57
60
  /**
58
61
  * @since v6.10
59
62
  */
60
63
  get subtitleTextColor(): RGB | undefined;
61
64
  get textColor(): RGB | undefined;
62
65
  }
66
+ export {};
@@ -1,5 +1,5 @@
1
- import { type RequestOptions } from '../bridge/index.js';
2
1
  import type { ThemeParamsParsed } from './types.js';
2
+ import type { RequestOptions } from '../../bridge/request.js';
3
3
  /**
4
4
  * Requests current theme parameters from the Telegram application.
5
5
  * @param options - request options.
@@ -0,0 +1,3 @@
1
+ import type { ThemeParamsParsed } from './types.js';
2
+ import type { ValueParserGenerator } from '../../parsing/createValueParserGenerator.js';
3
+ export declare const themeParamsParser: ValueParserGenerator<ThemeParamsParsed>;