@tma.js/sdk 1.4.8 → 1.5.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 (155) hide show
  1. package/dist/dts/bridge/captureSameReq.d.ts +10 -0
  2. package/dist/dts/bridge/errors/MethodUnsupportedError.d.ts +2 -2
  3. package/dist/dts/bridge/errors/ParameterUnsupportedError.d.ts +2 -2
  4. package/dist/dts/bridge/events/events.d.ts +13 -3
  5. package/dist/dts/bridge/events/on.d.ts +2 -3
  6. package/dist/dts/bridge/events/once.d.ts +2 -3
  7. package/dist/dts/bridge/events/parsers/clipboardTextReceived.d.ts +2 -2
  8. package/dist/dts/bridge/events/parsers/customMethodInvoked.d.ts +2 -2
  9. package/dist/dts/bridge/events/parsers/invoiceClosed.d.ts +1 -1
  10. package/dist/dts/bridge/events/parsers/phoneRequested.d.ts +1 -1
  11. package/dist/dts/bridge/events/parsers/popupClosed.d.ts +1 -1
  12. package/dist/dts/bridge/events/parsers/qrTextReceived.d.ts +1 -1
  13. package/dist/dts/bridge/events/parsers/theme-changed.d.ts +2 -2
  14. package/dist/dts/bridge/events/parsers/viewportChanged.d.ts +1 -1
  15. package/dist/dts/bridge/events/parsers/writeAccessRequested.d.ts +1 -1
  16. package/dist/dts/bridge/events/singletonEmitter.d.ts +1 -1
  17. package/dist/dts/bridge/events/subscribe.d.ts +2 -3
  18. package/dist/dts/bridge/events/types.d.ts +4 -0
  19. package/dist/dts/bridge/invokeCustomMethod.d.ts +2 -2
  20. package/dist/dts/bridge/methods/createPostEvent.d.ts +1 -1
  21. package/dist/dts/bridge/methods/custom-methods.d.ts +1 -1
  22. package/dist/dts/bridge/methods/methods.d.ts +9 -8
  23. package/dist/dts/bridge/request.d.ts +38 -40
  24. package/dist/dts/classnames/mergeClassNames.d.ts +2 -18
  25. package/dist/dts/{back-button → components/back-button}/BackButton.d.ts +4 -4
  26. package/dist/dts/{back-button → components/back-button}/types.d.ts +2 -2
  27. package/dist/dts/{closing-behavior → components/closing-behavior}/ClosingBehavior.d.ts +6 -3
  28. package/dist/dts/{closing-behavior → components/closing-behavior}/types.d.ts +1 -1
  29. package/dist/dts/{cloud-storage → components/cloud-storage}/CloudStorage.d.ts +5 -4
  30. package/dist/dts/{haptic-feedback → components/haptic-feedback}/HapticFeedback.d.ts +4 -3
  31. package/dist/dts/components/init-data/chatParser.d.ts +6 -0
  32. package/dist/dts/components/init-data/initDataParser.d.ts +6 -0
  33. package/dist/dts/components/init-data/userParser.d.ts +6 -0
  34. package/dist/dts/{invoice → components/invoice}/Invoice.d.ts +9 -5
  35. package/dist/dts/{invoice → components/invoice}/types.d.ts +1 -1
  36. package/dist/dts/{main-button → components/main-button}/MainButton.d.ts +2 -2
  37. package/dist/dts/{main-button → components/main-button}/types.d.ts +3 -3
  38. package/dist/dts/{mini-app → components/mini-app}/MiniApp.d.ts +11 -6
  39. package/dist/dts/components/mini-app/contactParser.d.ts +2 -0
  40. package/dist/dts/{mini-app → components/mini-app}/types.d.ts +6 -5
  41. package/dist/dts/{popup → components/popup}/Popup.d.ts +8 -5
  42. package/dist/dts/{popup → components/popup}/preparePopupParams.d.ts +1 -1
  43. package/dist/dts/{popup → components/popup}/types.d.ts +1 -1
  44. package/dist/dts/{qr-scanner → components/qr-scanner}/QRScanner.d.ts +8 -5
  45. package/dist/dts/{qr-scanner → components/qr-scanner}/types.d.ts +1 -1
  46. package/dist/dts/{settings-button → components/settings-button}/SettingsButton.d.ts +4 -4
  47. package/dist/dts/{settings-button → components/settings-button}/types.d.ts +2 -2
  48. package/dist/dts/{theme-params → components/theme-params}/ThemeParams.d.ts +8 -4
  49. package/dist/dts/components/theme-params/requestThemeParams.d.ts +7 -0
  50. package/dist/dts/components/theme-params/themeParamsParser.d.ts +3 -0
  51. package/dist/dts/{theme-params → components/theme-params}/types.d.ts +2 -2
  52. package/dist/dts/{utils → components/utils}/Utils.d.ts +4 -4
  53. package/dist/dts/{viewport → components/viewport}/Viewport.d.ts +9 -5
  54. package/dist/dts/{viewport → components/viewport}/isStableViewportPlatform.d.ts +1 -1
  55. package/dist/dts/{viewport → components/viewport}/requestViewport.d.ts +2 -2
  56. package/dist/dts/{viewport → components/viewport}/types.d.ts +2 -2
  57. package/dist/dts/css/bindMiniAppCSSVars.d.ts +2 -2
  58. package/dist/dts/css/bindThemeCSSVars.d.ts +1 -1
  59. package/dist/dts/css/bindViewportCSSVars.d.ts +1 -1
  60. package/dist/dts/event-emitter/types.d.ts +1 -1
  61. package/dist/dts/globals.d.ts +1 -1
  62. package/dist/dts/index.d.ts +144 -27
  63. package/dist/dts/init/creators/createBackButton.d.ts +2 -2
  64. package/dist/dts/init/creators/createClosingBehavior.d.ts +2 -2
  65. package/dist/dts/init/creators/createMainButton.d.ts +3 -3
  66. package/dist/dts/init/creators/createMiniApp.d.ts +5 -5
  67. package/dist/dts/init/creators/createRequestIdGenerator.d.ts +1 -1
  68. package/dist/dts/init/creators/createSettingsButton.d.ts +2 -2
  69. package/dist/dts/init/creators/createThemeParams.d.ts +2 -1
  70. package/dist/dts/init/creators/createViewport.d.ts +3 -3
  71. package/dist/dts/init/css/processCSSVarsOption.d.ts +3 -3
  72. package/dist/dts/init/types.d.ts +16 -16
  73. package/dist/dts/launch-params/launchParamsParser.d.ts +2 -1
  74. package/dist/dts/launch-params/types.d.ts +3 -3
  75. package/dist/dts/navigation/HashNavigator/HashNavigator.d.ts +6 -3
  76. package/dist/dts/navigation/HashNavigator/types.d.ts +1 -2
  77. package/dist/dts/navigation/Navigator/Navigator.d.ts +1 -1
  78. package/dist/dts/parsing/ValueParser.d.ts +1 -1
  79. package/dist/dts/parsing/parsers/array.d.ts +2 -2
  80. package/dist/dts/parsing/parsers/boolean.d.ts +2 -1
  81. package/dist/dts/parsing/parsers/date.d.ts +2 -1
  82. package/dist/dts/parsing/parsers/number.d.ts +2 -1
  83. package/dist/dts/parsing/parsers/rgb.d.ts +3 -1
  84. package/dist/dts/parsing/parsers/string.d.ts +2 -1
  85. package/dist/dts/state/State.d.ts +2 -2
  86. package/dist/dts/state/types.d.ts +1 -1
  87. package/dist/dts/storage.d.ts +2 -2
  88. package/dist/dts/supports/createSupportsFunc.d.ts +2 -2
  89. package/dist/dts/supports/createSupportsParamFunc.d.ts +2 -2
  90. package/dist/dts/supports/supports.d.ts +2 -2
  91. package/dist/dts/supports/types.d.ts +3 -0
  92. package/dist/dts/timeout/withTimeout.d.ts +2 -2
  93. package/dist/dts/types/logical.d.ts +16 -0
  94. package/dist/dts/types/methods.d.ts +1 -1
  95. package/dist/dts/types/unions.d.ts +20 -0
  96. package/dist/dts/types/utils.d.ts +0 -28
  97. package/dist/dts/version/compareVersions.d.ts +2 -1
  98. package/dist/dts/version/types.d.ts +1 -0
  99. package/dist/index.cjs +1 -1
  100. package/dist/index.iife.js +1 -1
  101. package/dist/index.mjs +1714 -1702
  102. package/package.json +1 -1
  103. package/dist/dts/back-button/index.d.ts +0 -2
  104. package/dist/dts/bridge/env/index.d.ts +0 -2
  105. package/dist/dts/bridge/errors/index.d.ts +0 -2
  106. package/dist/dts/bridge/events/index.d.ts +0 -9
  107. package/dist/dts/bridge/events/parsers/index.d.ts +0 -9
  108. package/dist/dts/bridge/index.d.ts +0 -7
  109. package/dist/dts/bridge/methods/index.d.ts +0 -6
  110. package/dist/dts/classnames/index.d.ts +0 -2
  111. package/dist/dts/closing-behavior/index.d.ts +0 -2
  112. package/dist/dts/cloud-storage/index.d.ts +0 -1
  113. package/dist/dts/colors/index.d.ts +0 -5
  114. package/dist/dts/css/index.d.ts +0 -4
  115. package/dist/dts/event-emitter/index.d.ts +0 -2
  116. package/dist/dts/haptic-feedback/index.d.ts +0 -1
  117. package/dist/dts/init/creators/index.d.ts +0 -8
  118. package/dist/dts/init/css/index.d.ts +0 -1
  119. package/dist/dts/init/index.d.ts +0 -2
  120. package/dist/dts/init-data/chatParser.d.ts +0 -5
  121. package/dist/dts/init-data/index.d.ts +0 -6
  122. package/dist/dts/init-data/initDataParser.d.ts +0 -5
  123. package/dist/dts/init-data/userParser.d.ts +0 -5
  124. package/dist/dts/invoice/index.d.ts +0 -2
  125. package/dist/dts/launch-params/index.d.ts +0 -10
  126. package/dist/dts/logger/index.d.ts +0 -1
  127. package/dist/dts/main-button/index.d.ts +0 -2
  128. package/dist/dts/mini-app/contactParser.d.ts +0 -2
  129. package/dist/dts/mini-app/index.d.ts +0 -2
  130. package/dist/dts/misc/index.d.ts +0 -5
  131. package/dist/dts/navigation/HashNavigator/index.d.ts +0 -2
  132. package/dist/dts/navigation/Navigator/index.d.ts +0 -2
  133. package/dist/dts/navigation/index.d.ts +0 -4
  134. package/dist/dts/parsing/index.d.ts +0 -10
  135. package/dist/dts/parsing/parsers/index.d.ts +0 -8
  136. package/dist/dts/popup/index.d.ts +0 -2
  137. package/dist/dts/qr-scanner/index.d.ts +0 -2
  138. package/dist/dts/settings-button/index.d.ts +0 -2
  139. package/dist/dts/state/index.d.ts +0 -2
  140. package/dist/dts/supports/index.d.ts +0 -4
  141. package/dist/dts/theme-params/index.d.ts +0 -6
  142. package/dist/dts/theme-params/requestThemeParams.d.ts +0 -7
  143. package/dist/dts/theme-params/themeParamsParser.d.ts +0 -2
  144. package/dist/dts/timeout/index.d.ts +0 -4
  145. package/dist/dts/types/index.d.ts +0 -4
  146. package/dist/dts/utils/index.d.ts +0 -1
  147. package/dist/dts/version/index.d.ts +0 -2
  148. package/dist/dts/viewport/index.d.ts +0 -4
  149. /package/dist/dts/{init-data → components/init-data}/InitData.d.ts +0 -0
  150. /package/dist/dts/{init-data → components/init-data}/parseInitData.d.ts +0 -0
  151. /package/dist/dts/{init-data → components/init-data}/types.d.ts +0 -0
  152. /package/dist/dts/{theme-params → components/theme-params}/keys.d.ts +0 -0
  153. /package/dist/dts/{theme-params → components/theme-params}/parseThemeParams.d.ts +0 -0
  154. /package/dist/dts/{theme-params → components/theme-params}/serializeThemeParams.d.ts +0 -0
  155. /package/dist/dts/{viewport → components/viewport}/utils.d.ts +0 -0
@@ -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/types.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 {};
@@ -0,0 +1,7 @@
1
+ import type { ThemeParamsParsed } from './types.js';
2
+ import type { RequestSimpleOptions } from '../../bridge/request.js';
3
+ /**
4
+ * Requests current theme parameters from the Telegram application.
5
+ * @param options - request options.
6
+ */
7
+ export declare function requestThemeParams(options?: RequestSimpleOptions<'web_app_request_theme'>): Promise<ThemeParamsParsed>;
@@ -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>;
@@ -1,5 +1,5 @@
1
- import type { RGB } from '../colors/index.js';
2
- import type { StateEvents } from '../state/index.js';
1
+ import type { RGB } from '../../colors/types.js';
2
+ import type { StateEvents } from '../../state/types.js';
3
3
  export type ThemeParamsKey = 'accentTextColor' | 'backgroundColor' | 'buttonColor' | 'buttonTextColor' | 'destructiveTextColor' | 'headerBackgroundColor' | 'hintColor' | 'linkColor' | 'secondaryBackgroundColor' | 'sectionBackgroundColor' | 'sectionHeaderTextColor' | 'subtitleTextColor' | 'textColor';
4
4
  /**
5
5
  * Application [theme parameters](https://docs.telegram-mini-apps.com/platform/theming).
@@ -1,7 +1,7 @@
1
- import { type PostEvent } from '../bridge/index.js';
2
- import { type SupportsFunc } from '../supports/index.js';
3
- import type { CreateRequestIdFunc } from '../types/index.js';
4
- import type { Version } from '../version/index.js';
1
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
2
+ import type { SupportsFunc } from '../../supports/types.js';
3
+ import type { CreateRequestIdFunc } from '../../types/request-id.js';
4
+ import type { Version } from '../../version/types.js';
5
5
  /**
6
6
  * Provides common Mini Apps functionality not covered by other system components.
7
7
  */
@@ -1,5 +1,8 @@
1
- import { type RequestOptions } from '../bridge/index.js';
2
1
  import type { ViewportEvents, ViewportProps } from './types.js';
2
+ import type { RemoveListenerFn } from '../../bridge/events/types.js';
3
+ import type { RequestSimpleOptions } from '../../bridge/request.js';
4
+ import { EventEmitter } from '../../event-emitter/EventEmitter.js';
5
+ type Emitter = EventEmitter<ViewportEvents>;
3
6
  /**
4
7
  * Contains information about current WebApp device viewport, its dimensions
5
8
  * and state.
@@ -14,7 +17,7 @@ export declare class Viewport {
14
17
  * instance.
15
18
  * @param options - options to request fresh data.
16
19
  */
17
- sync(options?: RequestOptions): Promise<void>;
20
+ sync(options?: RequestSimpleOptions<'web_app_request_viewport'>): Promise<void>;
18
21
  /**
19
22
  * The current height of the visible area of the Mini App.
20
23
  *
@@ -51,7 +54,7 @@ export declare class Viewport {
51
54
  * Starts listening to viewport changes and applies them.
52
55
  * @returns Function to stop listening.
53
56
  */
54
- listen(): () => void;
57
+ listen(): RemoveListenerFn;
55
58
  /**
56
59
  * Returns true if the Mini App is expanded to the maximum available height.
57
60
  * Otherwise, if the Mini App occupies part of the screen and can be expanded
@@ -78,9 +81,10 @@ export declare class Viewport {
78
81
  /**
79
82
  * Adds new event listener.
80
83
  */
81
- on: <E extends "change" | "change:height" | "change:width" | "change:isExpanded" | "change:stableHeight">(event: E, listener: import('../event-emitter/index.js').EventListener<ViewportEvents[E]>) => import('../event-emitter/index.js').RemoveEventListener;
84
+ on: Emitter['on'];
82
85
  /**
83
86
  * Removes event listener.
84
87
  */
85
- off: <E extends "change" | "change:height" | "change:width" | "change:isExpanded" | "change:stableHeight">(event: E, listener: import('../event-emitter/index.js').EventListener<ViewportEvents[E]>) => void;
88
+ off: Emitter['off'];
86
89
  }
90
+ export {};
@@ -1,4 +1,4 @@
1
- import type { Platform } from '../types/index.js';
1
+ import type { Platform } from '../../types/platform.js';
2
2
  /**
3
3
  * Returns true if specified platform has stable viewport. Stable means not changing from time to
4
4
  * time.
@@ -1,4 +1,4 @@
1
- import { type RequestOptions } from '../bridge/index.js';
1
+ import type { RequestSimpleOptions } from '../../bridge/request.js';
2
2
  export interface RequestViewportResult {
3
3
  height: number;
4
4
  isStateStable: boolean;
@@ -9,4 +9,4 @@ export interface RequestViewportResult {
9
9
  * Requests viewport actual information from the Telegram application.
10
10
  * @param options - request options.
11
11
  */
12
- export declare function requestViewport(options?: RequestOptions): Promise<RequestViewportResult>;
12
+ export declare function requestViewport(options?: RequestSimpleOptions<'web_app_request_viewport'>): Promise<RequestViewportResult>;
@@ -1,5 +1,5 @@
1
- import type { PostEvent } from '../bridge/index.js';
2
- import type { StateEvents } from '../state/index.js';
1
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
2
+ import type { StateEvents } from '../../state/types.js';
3
3
  export interface ViewportProps {
4
4
  height: number;
5
5
  width: number;
@@ -1,5 +1,5 @@
1
- import type { MiniApp } from '../mini-app/index.js';
2
- import type { ThemeParams } from '../theme-params/index.js';
1
+ import type { MiniApp } from '../components/mini-app/MiniApp.js';
2
+ import type { ThemeParams } from '../components/theme-params/ThemeParams.js';
3
3
  /**
4
4
  * Creates CSS variables connected with WebApp background and header colors based on
5
5
  * passed WebApp and ThemeParams instances.
@@ -1,4 +1,4 @@
1
- import type { ThemeParams } from '../theme-params/index.js';
1
+ import type { ThemeParams } from '../components/theme-params/ThemeParams.js';
2
2
  /**
3
3
  * Creates CSS variables connected with theme parameters. Created CSS variables names are
4
4
  * following the pattern "--tg-theme-{name}". {name} is a theme parameters key name converted
@@ -1,4 +1,4 @@
1
- import type { Viewport } from '../viewport/index.js';
1
+ import type { Viewport } from '../components/viewport/Viewport.js';
2
2
  /**
3
3
  * Accepts Viewport instance and sets CSS variables connected with viewport
4
4
  * sizes.
@@ -1,4 +1,4 @@
1
- import type { IsNever } from '../types/index.js';
1
+ import type { IsNever } from '../types/utils.js';
2
2
  /**
3
3
  * Function accepting the list of passed arguments and returning nothing.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { Logger } from './logger/index.js';
1
+ import { Logger } from './logger/Logger.js';
2
2
  export declare const logger: Logger;
3
3
  /**
4
4
  * Sets new debug mode. Enabling debug mode leads to printing
@@ -1,28 +1,145 @@
1
- export { BackButton, type BackButtonEventName, type BackButtonEventListener, } from './back-button/index.js';
2
- export { createPostEvent, invokeCustomMethod, on, off, once, parseMessage, 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
- export { ClosingBehavior, type ClosingBehaviorEventListener, type ClosingBehaviorEventName, type ClosingBehaviorEvents, } from './closing-behavior/index.js';
5
- export { CloudStorage } from './cloud-storage/index.js';
6
- export { isRGB, isRGBShort, isColorDark, toRGB, type RGB, type RGBShort, } from './colors/index.js';
7
- export { setCSSVar, bindMiniAppCSSVars, bindThemeCSSVars, bindViewportCSSVars, } from './css/index.js';
8
- export { HapticFeedback } from './haptic-feedback/index.js';
9
- export { init, type InitOptions, type InitResult, } from './init/index.js';
10
- export { chatParser, InitData, initDataParser, parseInitData, userParser, type Chat, type ChatType, type InitDataParsed, type User, } from './init-data/index.js';
11
- export { Invoice, type InvoiceEvents, type InvoiceEventListener, type InvoiceEventName, } from './invoice/index.js';
12
- export { launchParamsParser, parseLaunchParams, retrieveLaunchData, retrieveLaunchParams, serializeLaunchParams, type LaunchParams, type LaunchData, } from './launch-params/index.js';
13
- export { MainButton, type MainButtonParams, type MainButtonProps, type MainButtonEvents, type MainButtonEventName, type MainButtonEventListener, } from './main-button/index.js';
14
- export { MiniApp, type MiniAppHeaderColor, type MiniAppEventName, type MiniAppEventListener, type MiniAppEvents, type MiniAppProps, } from './mini-app/index.js';
15
- export { isTMA, isRecord, isIframe, isPageReload, } from './misc/index.js';
16
- export { getHash, HashNavigator, Navigator, type NavigationEntry, type NavigatorConEntry, type NavigatorOptions, type HashNavigatorOptions, type HashNavigatorEventsMap, type HashNavigatorEventListener, type HashNavigatorEventName, } from './navigation/index.js';
17
- export { boolean, searchParams, string, rgb, array, date, json, number, ParseError, ParseSchemaFieldError, } from './parsing/index.js';
18
- export { Popup, type PopupEventName, type PopupEventListener, type PopupEvents, type OpenPopupOptions, type OpenPopupOptionsButton, } from './popup/index.js';
19
- export { QRScanner, type QRScannerEventListener, type QRScannerEventName, type QRScannerEvents, } from './qr-scanner/index.js';
20
- export { SettingsButton, type SettingsButtonEventName, type SettingsButtonEventListener, type SettingsButtonEvents, } from './settings-button/index.js';
21
- export { supports } from './supports/index.js';
22
- export { parseThemeParams, requestThemeParams, serializeThemeParams, themeParamsParser, ThemeParams, type ThemeParamsEventListener, type ThemeParamsEventName, type ThemeParamsEvents, type ThemeParamsKey, type ThemeParamsParsed, } from './theme-params/index.js';
23
- export { withTimeout, TimeoutError, isTimeoutError } from './timeout/index.js';
24
- export type { RequestId, CreateRequestIdFunc } from './types/index.js';
25
- export { Utils } from './utils/index.js';
26
- export { compareVersions, type Version } from './version/index.js';
27
- export { isStableViewportPlatform, requestViewport, Viewport, type RequestViewportResult, type ViewportProps, type ViewportEventName, type ViewportEventListener, type ViewportEvents, } from './viewport/index.js';
1
+ /**
2
+ * Bridge.
3
+ */
4
+ export { createPostEvent } from './bridge/methods/createPostEvent.js';
5
+ export { invokeCustomMethod } from './bridge/invokeCustomMethod.js';
6
+ export { on } from './bridge/events/on.js';
7
+ export { off } from './bridge/events/off.js';
8
+ export { once } from './bridge/events/once.js';
9
+ export { parseMessage } from './bridge/parseMessage.js';
10
+ export { postEvent, type PostEvent } from './bridge/methods/postEvent.js';
11
+ export { request, type RequestSimpleOptions, type RequestCompleteOptions, } from './bridge/request.js';
12
+ export { subscribe } from './bridge/events/subscribe.js';
13
+ export { unsubscribe } from './bridge/events/unsubscribe.js';
14
+ export { MethodUnsupportedError } from './bridge/errors/MethodUnsupportedError.js';
15
+ export { ParameterUnsupportedError } from './bridge/errors/ParameterUnsupportedError.js';
16
+ export type { HeaderColorKey, MiniAppsEmptyMethodName, MiniAppsMethodAcceptParams, MiniAppsMethodName, MiniAppsMethodParams, MiniAppsMethods, MiniAppsNonEmptyMethodName, SwitchInlineQueryChatType, } from './bridge/methods/methods.js';
17
+ export type { InvoiceStatus } from './bridge/events/parsers/invoiceClosed.js';
18
+ export type { ImpactHapticFeedbackStyle, NotificationHapticFeedbackType, } from './bridge/methods/haptic.js';
19
+ export type { MiniAppsEventEmitter, MiniAppsEventHasParams, MiniAppsEventListener, MiniAppsEventName, MiniAppsEventParams, MiniAppsEvents, MiniAppsGlobalEventListener, } from './bridge/events/events.js';
20
+ export type { PhoneRequestedStatus } from './bridge/events/parsers/phoneRequested.js';
21
+ export type { WriteAccessRequestedStatus } from './bridge/events/parsers/writeAccessRequested.js';
22
+ /**
23
+ * Classnames.
24
+ */
25
+ export { classNames } from './classnames/classNames.js';
26
+ export { mergeClassNames } from './classnames/mergeClassNames.js';
27
+ /**
28
+ * Colors.
29
+ */
30
+ export { isRGB } from './colors/isRGB.js';
31
+ export { isRGBShort } from './colors/isRGBShort.js';
32
+ export { isColorDark } from './colors/isColorDark.js';
33
+ export { toRGB } from './colors/toRGB.js';
34
+ export type { RGB, RGBShort } from './colors/types.js';
35
+ /**
36
+ * Components.
37
+ */
38
+ export { BackButton } from './components/back-button/BackButton.js';
39
+ export type { BackButtonEventListener, BackButtonEventName, BackButtonEvents, } from './components/back-button/types.js';
40
+ export { ClosingBehavior } from './components/closing-behavior/ClosingBehavior.js';
41
+ export type { ClosingBehaviorEventListener, ClosingBehaviorEventName, ClosingBehaviorEvents, } from './components/closing-behavior/types.js';
42
+ export { CloudStorage } from './components/cloud-storage/CloudStorage.js';
43
+ export { HapticFeedback } from './components/haptic-feedback/HapticFeedback.js';
44
+ export { chatParser } from './components/init-data/chatParser.js';
45
+ export { InitData } from './components/init-data/InitData.js';
46
+ export { initDataParser } from './components/init-data/initDataParser.js';
47
+ export { parseInitData } from './components/init-data/parseInitData.js';
48
+ export { userParser } from './components/init-data/userParser.js';
49
+ export type { Chat, User, ChatType, InitDataParsed } from './components/init-data/types.js';
50
+ export { Invoice } from './components/invoice/Invoice.js';
51
+ export type { InvoiceState, InvoiceEventListener, InvoiceEventName, InvoiceEvents, } from './components/invoice/types.js';
52
+ export { MainButton } from './components/main-button/MainButton.js';
53
+ export type { MainButtonParams, MainButtonEvents, MainButtonEventListener, MainButtonEventName, MainButtonProps, } from './components/main-button/types.js';
54
+ export { MiniApp } from './components/mini-app/MiniApp.js';
55
+ export type { MiniAppHeaderColor, MiniAppProps, MiniAppEvents, MiniAppEventListener, MiniAppEventName, } from './components/mini-app/types.js';
56
+ export { Popup } from './components/popup/Popup.js';
57
+ export type { PopupEventName, PopupEventListener, OpenPopupOptions, OpenPopupOptionsButton, PopupEvents, } from './components/popup/types.js';
58
+ export { QRScanner } from './components/qr-scanner/QRScanner.js';
59
+ export type { QRScannerEvents, QRScannerEventListener, QRScannerEventName, } from './components/qr-scanner/types.js';
60
+ export { SettingsButton } from './components/settings-button/SettingsButton.js';
61
+ export type { SettingsButtonEventListener, SettingsButtonEventName, SettingsButtonEvents, } from './components/settings-button/types.js';
62
+ export { parseThemeParams } from './components/theme-params/parseThemeParams.js';
63
+ export { requestThemeParams } from './components/theme-params/requestThemeParams.js';
64
+ export { serializeThemeParams } from './components/theme-params/serializeThemeParams.js';
65
+ export { themeParamsParser } from './components/theme-params/themeParamsParser.js';
66
+ export { ThemeParams } from './components/theme-params/ThemeParams.js';
67
+ export type { ThemeParamsEventListener, ThemeParamsEventName, ThemeParamsKey, ThemeParamsEvents, ThemeParamsParsed, } from './components/theme-params/types.js';
68
+ export { Utils } from './components/utils/Utils.js';
69
+ export { isStableViewportPlatform } from './components/viewport/isStableViewportPlatform.js';
70
+ export { requestViewport, type RequestViewportResult, } from './components/viewport/requestViewport.js';
71
+ export { Viewport } from './components/viewport/Viewport.js';
72
+ export type { ViewportProps, ViewportEventListener, ViewportEventName, ViewportEvents, } from './components/viewport/types.js';
73
+ /**
74
+ * CSS.
75
+ */
76
+ export { setCSSVar } from './css/setCSSVar.js';
77
+ export { bindMiniAppCSSVars } from './css/bindMiniAppCSSVars.js';
78
+ export { bindThemeCSSVars } from './css/bindThemeCSSVars.js';
79
+ export { bindViewportCSSVars } from './css/bindViewportCSSVars.js';
80
+ /**
81
+ * Init.
82
+ */
83
+ export { init } from './init/init.js';
84
+ export type { InitOptions, InitResult } from './init/types.js';
85
+ /**
86
+ * Launch params.
87
+ */
88
+ export { launchParamsParser } from './launch-params/launchParamsParser.js';
89
+ export { parseLaunchParams } from './launch-params/parseLaunchParams.js';
90
+ export { retrieveLaunchParams } from './launch-params/retrieveLaunchParams.js';
91
+ export { retrieveLaunchData } from './launch-params/retrieveLaunchData.js';
92
+ export { serializeLaunchParams } from './launch-params/serializeLaunchParams.js';
93
+ export type { LaunchParams } from './launch-params/types.js';
94
+ export type { LaunchData } from './launch-params/types.js';
95
+ /**
96
+ * Misc.
97
+ */
98
+ export { isTMA } from './misc/isTMA.js';
99
+ export { isRecord } from './misc/isRecord.js';
100
+ export { isIframe } from './misc/isIframe.js';
101
+ export { isPageReload } from './misc/isPageReload.js';
102
+ /**
103
+ * Navigation.
104
+ */
105
+ export { getHash } from './navigation/getHash.js';
106
+ export { HashNavigator } from './navigation/HashNavigator/HashNavigator.js';
107
+ export { Navigator } from './navigation/Navigator/Navigator.js';
108
+ export type { NavigationEntry, NavigatorConEntry, NavigatorOptions, } from './navigation/Navigator/types.js';
109
+ export type { HashNavigatorOptions, HashNavigatorEventListener, HashNavigatorEventsMap, HashNavigatorEventName, } from './navigation/HashNavigator/types.js';
110
+ /**
111
+ * Parsing.
112
+ */
113
+ export { boolean } from './parsing/parsers/boolean.js';
114
+ export { searchParams } from './parsing/parsers/searchParams.js';
115
+ export { string } from './parsing/parsers/string.js';
116
+ export { rgb } from './parsing/parsers/rgb.js';
117
+ export { array } from './parsing/parsers/array.js';
118
+ export { date } from './parsing/parsers/date.js';
119
+ export { json } from './parsing/parsers/json.js';
120
+ export { number } from './parsing/parsers/number.js';
121
+ export { ParseError } from './parsing/ParseError.js';
122
+ export { ParseSchemaFieldError } from './parsing/ParseSchemaFieldError.js';
123
+ /**
124
+ * Supports.
125
+ */
126
+ export { supports } from './supports/supports.js';
127
+ /**
128
+ * Timeout.
129
+ */
130
+ export { withTimeout } from './timeout/withTimeout.js';
131
+ export { TimeoutError } from './timeout/TimeoutError.js';
132
+ export { isTimeoutError } from './timeout/isTimeoutError.js';
133
+ /**
134
+ * Types.
135
+ */
136
+ export type { RequestId, CreateRequestIdFunc } from './types/request-id.js';
137
+ /**
138
+ * Version.
139
+ */
140
+ export { compareVersions } from './version/compareVersions.js';
141
+ export type { Version } from './version/types.js';
142
+ /**
143
+ * Globals.
144
+ */
28
145
  export { setTargetOrigin, setDebug } from './globals.js';
@@ -1,5 +1,5 @@
1
- import { BackButton } from '../../back-button/index.js';
2
- import type { PostEvent } from '../../bridge/index.js';
1
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
2
+ import { BackButton } from '../../components/back-button/BackButton.js';
3
3
  /**
4
4
  * Creates BackButton instance using last locally saved data also saving each state in
5
5
  * the storage.
@@ -1,5 +1,5 @@
1
- import { ClosingBehavior } from '../../closing-behavior/index.js';
2
- import type { PostEvent } from '../../bridge/index.js';
1
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
2
+ import { ClosingBehavior } from '../../components/closing-behavior/ClosingBehavior.js';
3
3
  /**
4
4
  * Creates ClosingBehaviour instance using last locally saved data also saving each state in
5
5
  * the storage.
@@ -1,6 +1,6 @@
1
- import { MainButton } from '../../main-button/index.js';
2
- import type { PostEvent } from '../../bridge/index.js';
3
- import type { RGB } from '../../colors/index.js';
1
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
2
+ import type { RGB } from '../../colors/types.js';
3
+ import { MainButton } from '../../components/main-button/MainButton.js';
4
4
  /**
5
5
  * Creates MainButton instance using last locally saved data also saving each state in
6
6
  * the storage.
@@ -1,8 +1,8 @@
1
- import { MiniApp } from '../../mini-app/index.js';
2
- import type { PostEvent } from '../../bridge/index.js';
3
- import type { RGB } from '../../colors/index.js';
4
- import type { CreateRequestIdFunc } from '../../types/index.js';
5
- import type { Version } from '../../version/index.js';
1
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
2
+ import type { RGB } from '../../colors/types.js';
3
+ import { MiniApp } from '../../components/mini-app/MiniApp.js';
4
+ import type { CreateRequestIdFunc } from '../../types/request-id.js';
5
+ import type { Version } from '../../version/types.js';
6
6
  /**
7
7
  * Creates MiniApp instance using last locally saved data also saving each state in
8
8
  * the storage.
@@ -1,4 +1,4 @@
1
- import type { CreateRequestIdFunc } from '../../types/index.js';
1
+ import type { CreateRequestIdFunc } from '../../types/request-id.js';
2
2
  /**
3
3
  * Creates function which generated request identifiers.
4
4
  */
@@ -1,5 +1,5 @@
1
- import { SettingsButton } from '../../settings-button/index.js';
2
- import type { PostEvent } from '../../bridge/index.js';
1
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
2
+ import { SettingsButton } from '../../components/settings-button/SettingsButton.js';
3
3
  /**
4
4
  * Creates SettingsButton instance using last locally saved data also saving each state in
5
5
  * the storage.
@@ -1,4 +1,5 @@
1
- import { ThemeParams, type ThemeParamsParsed } from '../../theme-params/index.js';
1
+ import { ThemeParams } from '../../components/theme-params/ThemeParams.js';
2
+ import type { ThemeParamsParsed } from '../../components/theme-params/types.js';
2
3
  /**
3
4
  * Creates synced instance of ThemeParams.
4
5
  * @param params - theme parameters.
@@ -1,6 +1,6 @@
1
- import { Viewport } from '../../viewport/index.js';
2
- import type { PostEvent } from '../../bridge/index.js';
3
- import type { Platform } from '../../types/index.js';
1
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
2
+ import { Viewport } from '../../components/viewport/Viewport.js';
3
+ import type { Platform } from '../../types/platform.js';
4
4
  /**
5
5
  * Creates Viewport instance using its actual state from the Telegram application.
6
6
  * @param isPageReload - was page reloaded.
@@ -1,6 +1,6 @@
1
- import type { MiniApp } from '../../mini-app/index.js';
2
- import type { ThemeParams } from '../../theme-params/index.js';
3
- import type { Viewport } from '../../viewport/index.js';
1
+ import type { MiniApp } from '../../components/mini-app/MiniApp.js';
2
+ import type { ThemeParams } from '../../components/theme-params/ThemeParams.js';
3
+ import type { Viewport } from '../../components/viewport/Viewport.js';
4
4
  import type { InitCSSVarsOption } from '../types.js';
5
5
  /**
6
6
  * Process initialization CSS vars option.
@@ -1,19 +1,19 @@
1
- import type { BackButton } from '../back-button/index.js';
2
- import type { PostEvent } from '../bridge/index.js';
3
- import type { ClosingBehavior } from '../closing-behavior/index.js';
4
- import type { CloudStorage } from '../cloud-storage/index.js';
5
- import type { HapticFeedback } from '../haptic-feedback/index.js';
6
- import type { InitData } from '../init-data/index.js';
7
- import type { Invoice } from '../invoice/index.js';
8
- import type { MainButton } from '../main-button/index.js';
9
- import type { MiniApp } from '../mini-app/index.js';
10
- import type { Popup } from '../popup/index.js';
11
- import type { QRScanner } from '../qr-scanner/index.js';
12
- import type { SettingsButton } from '../settings-button/index.js';
13
- import type { ThemeParams } from '../theme-params/index.js';
14
- import type { CreateRequestIdFunc } from '../types/index.js';
15
- import type { Utils } from '../utils/index.js';
16
- import type { Viewport } from '../viewport/index.js';
1
+ import type { PostEvent } from '../bridge/methods/postEvent.js';
2
+ import type { BackButton } from '../components/back-button/BackButton.js';
3
+ import type { ClosingBehavior } from '../components/closing-behavior/ClosingBehavior.js';
4
+ import type { CloudStorage } from '../components/cloud-storage/CloudStorage.js';
5
+ import type { HapticFeedback } from '../components/haptic-feedback/HapticFeedback.js';
6
+ import type { InitData } from '../components/init-data/InitData.js';
7
+ import type { Invoice } from '../components/invoice/Invoice.js';
8
+ import type { MainButton } from '../components/main-button/MainButton.js';
9
+ import type { MiniApp } from '../components/mini-app/MiniApp.js';
10
+ import type { Popup } from '../components/popup/Popup.js';
11
+ import type { QRScanner } from '../components/qr-scanner/QRScanner.js';
12
+ import type { SettingsButton } from '../components/settings-button/SettingsButton.js';
13
+ import type { ThemeParams } from '../components/theme-params/ThemeParams.js';
14
+ import type { Utils } from '../components/utils/Utils.js';
15
+ import type { Viewport } from '../components/viewport/Viewport.js';
16
+ import type { CreateRequestIdFunc } from '../types/request-id.js';
17
17
  export interface InitResult {
18
18
  backButton: BackButton;
19
19
  closingBehavior: ClosingBehavior;
@@ -1,5 +1,6 @@
1
1
  import type { LaunchParams } from './types.js';
2
+ import type { ValueParser } from '../parsing/ValueParser.js';
2
3
  /**
3
4
  * Returns parser used to parse launch params.
4
5
  */
5
- export declare function launchParamsParser(): import('../parsing/index.js').ValueParser<LaunchParams, false>;
6
+ export declare function launchParamsParser(): ValueParser<LaunchParams, false>;