@tma.js/sdk 2.7.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +9 -9
  3. package/dist/dts/composables/AsyncMountable.d.ts +44 -0
  4. package/dist/dts/composables/Button.d.ts +140 -0
  5. package/dist/dts/composables/Mountable.d.ts +43 -0
  6. package/dist/dts/composables/Stateful.d.ts +35 -0
  7. package/dist/dts/errors.d.ts +41 -0
  8. package/dist/dts/features/BackButton/BackButton.d.ts +96 -0
  9. package/dist/dts/features/BackButton/exports.d.ts +2 -0
  10. package/dist/dts/features/BackButton/instance.d.ts +2 -0
  11. package/dist/dts/features/Biometry/Biometry.d.ts +122 -0
  12. package/dist/dts/features/Biometry/exports.d.ts +3 -0
  13. package/dist/dts/features/Biometry/instance.d.ts +2 -0
  14. package/dist/dts/features/Biometry/types.d.ts +84 -0
  15. package/dist/dts/features/ClosingBehavior/ClosingBehavior.d.ts +51 -0
  16. package/dist/dts/features/ClosingBehavior/exports.d.ts +2 -0
  17. package/dist/dts/features/ClosingBehavior/instance.d.ts +2 -0
  18. package/dist/dts/features/CloudStorage/CloudStorage.d.ts +90 -0
  19. package/dist/dts/features/CloudStorage/exports.d.ts +2 -0
  20. package/dist/dts/features/CloudStorage/instance.d.ts +2 -0
  21. package/dist/dts/features/HapticFeedback/HapticFeedback.d.ts +57 -0
  22. package/dist/dts/features/HapticFeedback/exports.d.ts +2 -0
  23. package/dist/dts/features/HapticFeedback/instance.d.ts +2 -0
  24. package/dist/dts/features/InitData/InitData.d.ts +84 -0
  25. package/dist/dts/features/InitData/exports.d.ts +2 -0
  26. package/dist/dts/features/InitData/instance.d.ts +2 -0
  27. package/dist/dts/features/Invoice/Invoice.d.ts +54 -0
  28. package/dist/dts/features/Invoice/exports.d.ts +2 -0
  29. package/dist/dts/features/Invoice/instance.d.ts +2 -0
  30. package/dist/dts/features/LocationManager/LocationManager.d.ts +74 -0
  31. package/dist/dts/features/LocationManager/exports.d.ts +3 -0
  32. package/dist/dts/features/LocationManager/instance.d.ts +2 -0
  33. package/dist/dts/features/LocationManager/types.d.ts +65 -0
  34. package/dist/dts/features/MainButton/MainButton.d.ts +214 -0
  35. package/dist/dts/features/MainButton/exports.d.ts +2 -0
  36. package/dist/dts/features/MainButton/instance.d.ts +2 -0
  37. package/dist/dts/features/MiniApp/MiniApp.d.ts +192 -0
  38. package/dist/dts/features/MiniApp/exports.d.ts +2 -0
  39. package/dist/dts/features/MiniApp/instance.d.ts +2 -0
  40. package/dist/dts/features/Popup/Popup.d.ts +56 -0
  41. package/dist/dts/features/Popup/exports.d.ts +3 -0
  42. package/dist/dts/features/Popup/instance.d.ts +2 -0
  43. package/dist/dts/features/Popup/prepareParams.d.ts +9 -0
  44. package/dist/dts/{components → features}/Popup/types.d.ts +5 -12
  45. package/dist/dts/features/QrScanner/QrScanner.d.ts +132 -0
  46. package/dist/dts/features/QrScanner/exports.d.ts +2 -0
  47. package/dist/dts/features/QrScanner/instance.d.ts +2 -0
  48. package/dist/dts/features/SecondaryButton/SecondaryButton.d.ts +253 -0
  49. package/dist/dts/features/SecondaryButton/exports.d.ts +2 -0
  50. package/dist/dts/features/SecondaryButton/instance.d.ts +2 -0
  51. package/dist/dts/features/SettingsButton/SettingsButton.d.ts +96 -0
  52. package/dist/dts/features/SettingsButton/exports.d.ts +2 -0
  53. package/dist/dts/features/SettingsButton/instance.d.ts +2 -0
  54. package/dist/dts/features/SwipeBehavior/SwipeBehavior.d.ts +62 -0
  55. package/dist/dts/features/SwipeBehavior/exports.d.ts +2 -0
  56. package/dist/dts/features/SwipeBehavior/instance.d.ts +2 -0
  57. package/dist/dts/features/ThemeParams/ThemeParams.d.ts +127 -0
  58. package/dist/dts/features/ThemeParams/exports.d.ts +2 -0
  59. package/dist/dts/features/ThemeParams/instance.d.ts +2 -0
  60. package/dist/dts/features/Viewport/Viewport.d.ts +220 -0
  61. package/dist/dts/features/Viewport/exports.d.ts +2 -0
  62. package/dist/dts/features/Viewport/instance.d.ts +2 -0
  63. package/dist/dts/features/emoji-status/exports.d.ts +2 -0
  64. package/dist/dts/features/emoji-status/requestEmojiStatusAccess.d.ts +16 -0
  65. package/dist/dts/features/emoji-status/setEmojiStatus.d.ts +28 -0
  66. package/dist/dts/features/home-screen/addToHomeScreen.d.ts +11 -0
  67. package/dist/dts/features/home-screen/checkHomeScreenStatus.d.ts +14 -0
  68. package/dist/dts/features/home-screen/exports.d.ts +2 -0
  69. package/dist/dts/features/links/exports.d.ts +3 -0
  70. package/dist/dts/features/links/openLink.d.ts +31 -0
  71. package/dist/dts/features/links/openTelegramLink.d.ts +18 -0
  72. package/dist/dts/features/links/shareURL.d.ts +18 -0
  73. package/dist/dts/features/privacy/exports.d.ts +3 -0
  74. package/dist/dts/features/privacy/requestContact.d.ts +59 -0
  75. package/dist/dts/features/privacy/requestPhoneAccess.d.ts +19 -0
  76. package/dist/dts/features/privacy/requestWriteAccess.d.ts +14 -0
  77. package/dist/dts/features/uncategorized/copyTextToClipboard.d.ts +5 -0
  78. package/dist/dts/features/uncategorized/downloadFile.d.ts +21 -0
  79. package/dist/dts/features/uncategorized/exports.d.ts +11 -0
  80. package/dist/dts/features/uncategorized/getCurrentTime.d.ts +15 -0
  81. package/dist/dts/features/uncategorized/hideKeyboard.d.ts +13 -0
  82. package/dist/dts/features/uncategorized/readTextFromClipboard.d.ts +13 -0
  83. package/dist/dts/features/uncategorized/retrieveAndroidDeviceData.d.ts +6 -0
  84. package/dist/dts/features/uncategorized/retrieveAndroidDeviceDataFrom.d.ts +14 -0
  85. package/dist/dts/features/uncategorized/sendData.d.ts +20 -0
  86. package/dist/dts/features/uncategorized/shareMessage.d.ts +14 -0
  87. package/dist/dts/features/uncategorized/shareStory.d.ts +50 -0
  88. package/dist/dts/features/uncategorized/switchInlineQuery.d.ts +28 -0
  89. package/dist/dts/fn-options/bottomButtonOptions.d.ts +11 -0
  90. package/dist/dts/fn-options/buttonOptions.d.ts +10 -0
  91. package/dist/dts/fn-options/createFnOption.d.ts +2 -0
  92. package/dist/dts/fn-options/sharedFeatureOptions.d.ts +8 -0
  93. package/dist/dts/fn-options/withInvokeCustomMethod.d.ts +11 -0
  94. package/dist/dts/fn-options/withPostEvent.d.ts +8 -0
  95. package/dist/dts/fn-options/withRequest.d.ts +8 -0
  96. package/dist/dts/fn-options/withStateRestore.d.ts +13 -0
  97. package/dist/dts/fn-options/withVersion.d.ts +9 -0
  98. package/dist/dts/globals/createRequestId.d.ts +4 -0
  99. package/dist/dts/globals/inline-mode.d.ts +4 -0
  100. package/dist/dts/globals/invokeCustomMethod.d.ts +16 -0
  101. package/dist/dts/globals/post-event.d.ts +4 -0
  102. package/dist/dts/globals/request.d.ts +3 -0
  103. package/dist/dts/globals/resetGlobals.d.ts +4 -0
  104. package/dist/dts/globals/signals-registry.d.ts +39 -0
  105. package/dist/dts/globals/themeParams.d.ts +4 -0
  106. package/dist/dts/globals/version.d.ts +4 -0
  107. package/dist/dts/helpers/access.d.ts +2 -0
  108. package/dist/dts/helpers/component-storage.d.ts +9 -0
  109. package/dist/dts/helpers/createIsSupportedSignal.d.ts +5 -0
  110. package/dist/dts/helpers/css-vars.d.ts +11 -0
  111. package/dist/dts/helpers/isColorDark.d.ts +11 -0
  112. package/dist/dts/{navigation/isPageReload.d.ts → helpers/navigation.d.ts} +1 -1
  113. package/dist/dts/helpers/removeUndefined.d.ts +10 -0
  114. package/dist/dts/helpers/shallowEqual.d.ts +1 -0
  115. package/dist/dts/index.d.ts +33 -168
  116. package/dist/dts/init.d.ts +42 -0
  117. package/dist/dts/types.d.ts +6 -0
  118. package/dist/dts/with-checks/throwifyWithChecksFp.d.ts +3 -0
  119. package/dist/dts/with-checks/withChecksFp.d.ts +172 -0
  120. package/dist/index.cjs +1 -3
  121. package/dist/index.cjs.map +1 -1
  122. package/dist/index.iife.js +3 -3
  123. package/dist/index.iife.js.map +1 -1
  124. package/dist/index.js +3811 -2897
  125. package/dist/index.js.map +1 -1
  126. package/package.json +15 -5
  127. package/dist/dts/bridge/captureSameReq.d.ts +0 -10
  128. package/dist/dts/bridge/events/event-emitter/createMiniAppsEventEmitter.d.ts +0 -15
  129. package/dist/dts/bridge/events/event-emitter/singleton.d.ts +0 -8
  130. package/dist/dts/bridge/events/event-handlers/cleanupEventHandlers.d.ts +0 -4
  131. package/dist/dts/bridge/events/event-handlers/defineEventHandlers.d.ts +0 -6
  132. package/dist/dts/bridge/events/event-handlers/emitMiniAppsEvent.d.ts +0 -9
  133. package/dist/dts/bridge/events/listening/off.d.ts +0 -8
  134. package/dist/dts/bridge/events/listening/on.d.ts +0 -12
  135. package/dist/dts/bridge/events/listening/subscribe.d.ts +0 -9
  136. package/dist/dts/bridge/events/listening/unsubscribe.d.ts +0 -7
  137. package/dist/dts/bridge/events/types.d.ts +0 -302
  138. package/dist/dts/bridge/invokeCustomMethod.d.ts +0 -23
  139. package/dist/dts/bridge/methods/createPostEvent.d.ts +0 -14
  140. package/dist/dts/bridge/methods/postEvent.d.ts +0 -40
  141. package/dist/dts/bridge/methods/types/custom-methods.d.ts +0 -57
  142. package/dist/dts/bridge/methods/types/haptic.d.ts +0 -40
  143. package/dist/dts/bridge/methods/types/index.d.ts +0 -4
  144. package/dist/dts/bridge/methods/types/methods.d.ts +0 -392
  145. package/dist/dts/bridge/methods/types/popup.d.ts +0 -49
  146. package/dist/dts/bridge/parseMessage.d.ts +0 -18
  147. package/dist/dts/bridge/request.d.ts +0 -53
  148. package/dist/dts/bridge/target-origin.d.ts +0 -18
  149. package/dist/dts/classes/State/State.d.ts +0 -46
  150. package/dist/dts/classes/State/types.d.ts +0 -29
  151. package/dist/dts/classes/WithStateUtils.d.ts +0 -18
  152. package/dist/dts/classes/WithSupports.d.ts +0 -19
  153. package/dist/dts/classes/WithSupportsAndStateUtils.d.ts +0 -24
  154. package/dist/dts/classes/WithSupportsAndTrackableState.d.ts +0 -16
  155. package/dist/dts/classes/WithTrackableState.d.ts +0 -16
  156. package/dist/dts/classnames/classNames.d.ts +0 -12
  157. package/dist/dts/classnames/mergeClassNames.d.ts +0 -14
  158. package/dist/dts/colors/isColorDark.d.ts +0 -6
  159. package/dist/dts/colors/isRGB.d.ts +0 -7
  160. package/dist/dts/colors/isRGBShort.d.ts +0 -7
  161. package/dist/dts/colors/toRGB.d.ts +0 -12
  162. package/dist/dts/colors/types.d.ts +0 -8
  163. package/dist/dts/components/BackButton/BackButton.d.ts +0 -41
  164. package/dist/dts/components/BackButton/initBackButton.d.ts +0 -7
  165. package/dist/dts/components/BackButton/types.d.ts +0 -25
  166. package/dist/dts/components/BiometryManager/BiometryManager.d.ts +0 -61
  167. package/dist/dts/components/BiometryManager/formatEvent.d.ts +0 -34
  168. package/dist/dts/components/BiometryManager/initBiometryManager.d.ts +0 -7
  169. package/dist/dts/components/BiometryManager/requestBiometryInfo.d.ts +0 -8
  170. package/dist/dts/components/BiometryManager/types.d.ts +0 -40
  171. package/dist/dts/components/ClosingBehavior/ClosingBehavior.d.ts +0 -26
  172. package/dist/dts/components/ClosingBehavior/initClosingBehavior.d.ts +0 -7
  173. package/dist/dts/components/ClosingBehavior/types.d.ts +0 -20
  174. package/dist/dts/components/CloudStorage/CloudStorage.d.ts +0 -47
  175. package/dist/dts/components/CloudStorage/initCloudStorage.d.ts +0 -7
  176. package/dist/dts/components/HapticFeedback/HapticFeedback.d.ts +0 -34
  177. package/dist/dts/components/HapticFeedback/initHapticFeedback.d.ts +0 -7
  178. package/dist/dts/components/InitData/InitData.d.ts +0 -55
  179. package/dist/dts/components/InitData/initInitData.d.ts +0 -7
  180. package/dist/dts/components/InitData/parseInitData.d.ts +0 -7
  181. package/dist/dts/components/InitData/parsers/chat.d.ts +0 -3
  182. package/dist/dts/components/InitData/parsers/initData.d.ts +0 -7
  183. package/dist/dts/components/InitData/parsers/user.d.ts +0 -3
  184. package/dist/dts/components/InitData/types.d.ts +0 -132
  185. package/dist/dts/components/Invoice/Invoice.d.ts +0 -31
  186. package/dist/dts/components/Invoice/initInvoice.d.ts +0 -7
  187. package/dist/dts/components/Invoice/types.d.ts +0 -20
  188. package/dist/dts/components/MainButton/MainButton.d.ts +0 -106
  189. package/dist/dts/components/MainButton/initMainButton.d.ts +0 -7
  190. package/dist/dts/components/MainButton/types.d.ts +0 -40
  191. package/dist/dts/components/MiniApp/MiniApp.d.ts +0 -121
  192. package/dist/dts/components/MiniApp/initMiniApp.d.ts +0 -7
  193. package/dist/dts/components/MiniApp/parsing/contact.d.ts +0 -7
  194. package/dist/dts/components/MiniApp/types.d.ts +0 -53
  195. package/dist/dts/components/Popup/Popup.d.ts +0 -30
  196. package/dist/dts/components/Popup/initPopup.d.ts +0 -7
  197. package/dist/dts/components/Popup/preparePopupParams.d.ts +0 -8
  198. package/dist/dts/components/QRScanner/QRScanner.d.ts +0 -33
  199. package/dist/dts/components/QRScanner/initQRScanner.d.ts +0 -7
  200. package/dist/dts/components/QRScanner/types.d.ts +0 -31
  201. package/dist/dts/components/SettingsButton/SettingsButton.d.ts +0 -37
  202. package/dist/dts/components/SettingsButton/initSettingsButton.d.ts +0 -7
  203. package/dist/dts/components/SettingsButton/types.d.ts +0 -25
  204. package/dist/dts/components/ThemeParams/ThemeParams.d.ts +0 -57
  205. package/dist/dts/components/ThemeParams/initThemeParams.d.ts +0 -7
  206. package/dist/dts/components/ThemeParams/keys.d.ts +0 -11
  207. package/dist/dts/components/ThemeParams/parsing/parseThemeParams.d.ts +0 -7
  208. package/dist/dts/components/ThemeParams/parsing/serializeThemeParams.d.ts +0 -6
  209. package/dist/dts/components/ThemeParams/parsing/themeParams.d.ts +0 -4
  210. package/dist/dts/components/ThemeParams/requestThemeParams.d.ts +0 -8
  211. package/dist/dts/components/ThemeParams/types.d.ts +0 -29
  212. package/dist/dts/components/Utils/Utils.d.ts +0 -77
  213. package/dist/dts/components/Utils/initUtils.d.ts +0 -7
  214. package/dist/dts/components/Viewport/Viewport.d.ts +0 -77
  215. package/dist/dts/components/Viewport/initViewport.d.ts +0 -7
  216. package/dist/dts/components/Viewport/requestViewport.d.ts +0 -13
  217. package/dist/dts/components/Viewport/types.d.ts +0 -35
  218. package/dist/dts/css-vars/bindMiniAppCSSVars.d.ts +0 -29
  219. package/dist/dts/css-vars/bindThemeParamsCSSVars.d.ts +0 -29
  220. package/dist/dts/css-vars/bindViewportCSSVars.d.ts +0 -32
  221. package/dist/dts/css-vars/setCSSVar.d.ts +0 -6
  222. package/dist/dts/debug/debug.d.ts +0 -14
  223. package/dist/dts/env/hasExternalNotify.d.ts +0 -10
  224. package/dist/dts/env/hasWebviewProxy.d.ts +0 -10
  225. package/dist/dts/env/initWeb.d.ts +0 -11
  226. package/dist/dts/env/isIframe.d.ts +0 -5
  227. package/dist/dts/env/isSSR.d.ts +0 -4
  228. package/dist/dts/env/isTMA.d.ts +0 -4
  229. package/dist/dts/env/mockTelegramEnv.d.ts +0 -7
  230. package/dist/dts/errors/SDKError.d.ts +0 -9
  231. package/dist/dts/errors/createError.d.ts +0 -10
  232. package/dist/dts/errors/errors.d.ts +0 -49
  233. package/dist/dts/errors/isSDKError.d.ts +0 -7
  234. package/dist/dts/errors/isSDKErrorOfType.d.ts +0 -8
  235. package/dist/dts/events/event-emitter/EventEmitter.d.ts +0 -54
  236. package/dist/dts/events/event-emitter/types.d.ts +0 -45
  237. package/dist/dts/events/onWindow.d.ts +0 -10
  238. package/dist/dts/events/types.d.ts +0 -6
  239. package/dist/dts/index.low-level.d.ts +0 -41
  240. package/dist/dts/launch-params/parseLaunchParams.d.ts +0 -7
  241. package/dist/dts/launch-params/retrieveFromLocation.d.ts +0 -7
  242. package/dist/dts/launch-params/retrieveFromPerformance.d.ts +0 -7
  243. package/dist/dts/launch-params/retrieveFromStorage.d.ts +0 -7
  244. package/dist/dts/launch-params/retrieveFromUrl.d.ts +0 -8
  245. package/dist/dts/launch-params/retrieveLaunchParams.d.ts +0 -7
  246. package/dist/dts/launch-params/saveToStorage.d.ts +0 -7
  247. package/dist/dts/launch-params/serializeLaunchParams.d.ts +0 -7
  248. package/dist/dts/launch-params/types.d.ts +0 -51
  249. package/dist/dts/logger/Logger.d.ts +0 -29
  250. package/dist/dts/misc/createCleanup.d.ts +0 -11
  251. package/dist/dts/misc/createComponentInitFn/createComponentInitFn.d.ts +0 -16
  252. package/dist/dts/misc/createComponentInitFn/types.d.ts +0 -54
  253. package/dist/dts/misc/createSingleton.d.ts +0 -15
  254. package/dist/dts/misc/isRecord.d.ts +0 -5
  255. package/dist/dts/misc/objectFromKeys.d.ts +0 -6
  256. package/dist/dts/navigation/BasicNavigator/BasicNavigator.d.ts +0 -118
  257. package/dist/dts/navigation/BasicNavigator/prepareItem.d.ts +0 -8
  258. package/dist/dts/navigation/BasicNavigator/types.d.ts +0 -37
  259. package/dist/dts/navigation/BrowserNavigator/BrowserNavigator.d.ts +0 -198
  260. package/dist/dts/navigation/BrowserNavigator/basicItemToBrowser.d.ts +0 -7
  261. package/dist/dts/navigation/BrowserNavigator/createBrowserNavigatorFromLocation.d.ts +0 -4
  262. package/dist/dts/navigation/BrowserNavigator/prepareItem.d.ts +0 -25
  263. package/dist/dts/navigation/BrowserNavigator/types.d.ts +0 -64
  264. package/dist/dts/navigation/createSafeURL.d.ts +0 -7
  265. package/dist/dts/navigation/drop.d.ts +0 -4
  266. package/dist/dts/navigation/ensurePrefix.d.ts +0 -7
  267. package/dist/dts/navigation/getFirstNavigationEntry.d.ts +0 -6
  268. package/dist/dts/navigation/getHash.d.ts +0 -15
  269. package/dist/dts/navigation/getPathname.d.ts +0 -7
  270. package/dist/dts/navigation/go.d.ts +0 -5
  271. package/dist/dts/navigation/initNavigator.d.ts +0 -9
  272. package/dist/dts/navigation/urlToPath.d.ts +0 -7
  273. package/dist/dts/parsing/ArrayParser/ArrayParser.d.ts +0 -17
  274. package/dist/dts/parsing/ArrayParser/types.d.ts +0 -12
  275. package/dist/dts/parsing/ValueParser/ValueParser.d.ts +0 -17
  276. package/dist/dts/parsing/ValueParser/types.d.ts +0 -28
  277. package/dist/dts/parsing/createTypeError.d.ts +0 -6
  278. package/dist/dts/parsing/createValueParserGenerator.d.ts +0 -10
  279. package/dist/dts/parsing/parseBySchema.d.ts +0 -9
  280. package/dist/dts/parsing/parsers/array.d.ts +0 -7
  281. package/dist/dts/parsing/parsers/boolean.d.ts +0 -6
  282. package/dist/dts/parsing/parsers/date.d.ts +0 -6
  283. package/dist/dts/parsing/parsers/json.d.ts +0 -9
  284. package/dist/dts/parsing/parsers/number.d.ts +0 -6
  285. package/dist/dts/parsing/parsers/rgb.d.ts +0 -7
  286. package/dist/dts/parsing/parsers/searchParams.d.ts +0 -9
  287. package/dist/dts/parsing/parsers/string.d.ts +0 -6
  288. package/dist/dts/parsing/toRecord.d.ts +0 -7
  289. package/dist/dts/parsing/types.d.ts +0 -30
  290. package/dist/dts/request-id/createRequestIdGenerator.d.ts +0 -6
  291. package/dist/dts/request-id/types.d.ts +0 -9
  292. package/dist/dts/storage/storage.d.ts +0 -42
  293. package/dist/dts/supports/createSupportsFn.d.ts +0 -12
  294. package/dist/dts/supports/createSupportsParamFn.d.ts +0 -16
  295. package/dist/dts/supports/supports.d.ts +0 -16
  296. package/dist/dts/supports/types.d.ts +0 -4
  297. package/dist/dts/timeout/createTimeoutError.d.ts +0 -7
  298. package/dist/dts/timeout/sleep.d.ts +0 -5
  299. package/dist/dts/timeout/withTimeout.d.ts +0 -6
  300. package/dist/dts/types/index.d.ts +0 -6
  301. package/dist/dts/types/logical.d.ts +0 -16
  302. package/dist/dts/types/methods.d.ts +0 -16
  303. package/dist/dts/types/misc.d.ts +0 -12
  304. package/dist/dts/types/platform.d.ts +0 -4
  305. package/dist/dts/types/unions.d.ts +0 -20
  306. package/dist/dts/types/utils.d.ts +0 -24
  307. package/dist/dts/version/compareVersions.d.ts +0 -10
  308. package/dist/dts/version/types.d.ts +0 -5
  309. package/dist/index.low-level.iife.js +0 -4
  310. package/dist/index.low-level.iife.js.map +0 -1
@@ -0,0 +1,51 @@
1
+ import { Computed } from '@tma.js/signals';
2
+ import { PostEventError } from '@tma.js/bridge';
3
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
4
+ import { WithStateRestore } from '../../fn-options/withStateRestore.js';
5
+ import { WithPostEvent } from '../../fn-options/withPostEvent.js';
6
+ import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
7
+ import * as E from 'fp-ts/Either';
8
+ export interface ClosingBehaviorState {
9
+ isConfirmationEnabled: boolean;
10
+ }
11
+ export interface ClosingBehaviorOptions extends WithStateRestore<ClosingBehaviorState>, WithPostEvent, SharedFeatureOptions {
12
+ }
13
+ export declare class ClosingBehavior {
14
+ constructor({ postEvent, storage, isTma, isPageReload }: ClosingBehaviorOptions);
15
+ /**
16
+ * Signal indicating if closing confirmation dialog is currently enabled.
17
+ */
18
+ readonly isConfirmationEnabled: Computed<boolean>;
19
+ /**
20
+ * Signal indicating if the component is currently mounted.
21
+ */
22
+ readonly isMounted: Computed<boolean>;
23
+ /**
24
+ * Mounts the component restoring its state.
25
+ */
26
+ readonly mountFp: WithChecksFp<() => void, false>;
27
+ /**
28
+ * @see mountFp
29
+ */
30
+ readonly mount: WithChecks<() => void, false>;
31
+ /**
32
+ * Unmounts the component.
33
+ */
34
+ readonly unmount: () => void;
35
+ /**
36
+ * Disables the closing confirmation dialog.
37
+ */
38
+ readonly disableConfirmationFp: WithChecksFp<() => E.Either<PostEventError, void>, false>;
39
+ /**
40
+ * @see disableConfirmationFp
41
+ */
42
+ readonly disableConfirmation: WithChecks<() => void, false>;
43
+ /**
44
+ * Enables the closing confirmation dialog.
45
+ */
46
+ readonly enableConfirmationFp: WithChecksFp<() => E.Either<PostEventError, void>, false>;
47
+ /**
48
+ * @see enableConfirmationFp
49
+ */
50
+ readonly enableConfirmation: WithChecks<() => void, false>;
51
+ }
@@ -0,0 +1,2 @@
1
+ export { ClosingBehavior, type ClosingBehaviorOptions, type ClosingBehaviorState, } from './ClosingBehavior.js';
2
+ export { closingBehavior } from './instance.js';
@@ -0,0 +1,2 @@
1
+ import { ClosingBehavior } from './ClosingBehavior.js';
2
+ export declare const closingBehavior: ClosingBehavior;
@@ -0,0 +1,90 @@
1
+ import { Computed } from '@tma.js/signals';
2
+ import { InvokeCustomMethodFpOptions, RequestError } from '@tma.js/bridge';
3
+ import { BetterPromise } from 'better-promises';
4
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
5
+ import { WithVersion } from '../../fn-options/withVersion.js';
6
+ import { WithInvokeCustomMethod } from '../../fn-options/withInvokeCustomMethod.js';
7
+ import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
8
+ import * as TE from 'fp-ts/TaskEither';
9
+ type CloudStorageTask<T> = TE.TaskEither<RequestError, T>;
10
+ export interface CloudStorageOptions extends WithVersion, WithInvokeCustomMethod, SharedFeatureOptions {
11
+ }
12
+ /**
13
+ * @since Mini Apps v6.9
14
+ */
15
+ export declare class CloudStorage {
16
+ constructor({ version, isTma, invokeCustomMethod }: CloudStorageOptions);
17
+ /**
18
+ * Signal indicating if the component is supported.
19
+ */
20
+ readonly isSupported: Computed<boolean>;
21
+ /**
22
+ * Deletes specified key or keys from the cloud storage.
23
+ * @param keyOrKeys - key or keys to delete.
24
+ * @param options - request execution options.
25
+ * @since Mini Apps v6.9
26
+ */
27
+ readonly deleteItemFp: WithChecksFp<(keyOrKeys: string | string[], options?: InvokeCustomMethodFpOptions) => CloudStorageTask<void>, true>;
28
+ readonly deleteItem: WithChecks<(keyOrKeys: string | string[], options?: InvokeCustomMethodFpOptions) => BetterPromise<void>, true>;
29
+ /**
30
+ * Gets a single key value from the cloud storage.
31
+ * @param key - a key to get.
32
+ * @param options - request execution options.
33
+ * @returns A key value as a string.
34
+ * @since Mini Apps v6.9
35
+ */
36
+ readonly getItemFp: WithChecksFp<(key: string, options?: InvokeCustomMethodFpOptions) => CloudStorageTask<string>, true>;
37
+ /**
38
+ * @see getItemFp
39
+ */
40
+ readonly getItem: WithChecks<{
41
+ <K extends string>(keys: K[], options?: InvokeCustomMethodFpOptions): BetterPromise<Record<K, string>>;
42
+ (key: string, options?: InvokeCustomMethodFpOptions): BetterPromise<string>;
43
+ }, true>;
44
+ /**
45
+ * Gets multiple keys' values from the cloud storage.
46
+ * @param keys - keys list.
47
+ * @param options - request execution options.
48
+ * @returns A map, where a key is one of the specified in the `keys` argument,
49
+ * and a value is a corresponding storage value if an array of keys was passed.
50
+ * @since Mini Apps v6.9
51
+ */
52
+ readonly getItemsFp: WithChecksFp<(<K extends string>(keys: K[], options?: InvokeCustomMethodFpOptions) => CloudStorageTask<Record<K, string>>), true>;
53
+ /**
54
+ * @see getItemsFp
55
+ */
56
+ readonly getItems: WithChecks<(<K extends string>(keys: K[], options?: InvokeCustomMethodFpOptions) => BetterPromise<Record<K, string>>), true>;
57
+ /**
58
+ * Returns a list of all keys presented in the cloud storage.
59
+ * @param options - request execution options.
60
+ * @since Mini Apps v6.9
61
+ */
62
+ readonly getKeysFp: WithChecksFp<(options?: InvokeCustomMethodFpOptions) => CloudStorageTask<string[]>, true>;
63
+ /**
64
+ * @see getKeysFp
65
+ */
66
+ readonly getKeys: WithChecks<(options?: InvokeCustomMethodFpOptions) => BetterPromise<string[]>, true>;
67
+ /**
68
+ * Saves the specified value by a key.
69
+ * @param key - storage key.
70
+ * @param value - storage value.
71
+ * @param options - request execution options.
72
+ * @since Mini Apps v6.9
73
+ */
74
+ readonly setItemFp: WithChecksFp<(key: string, value: string, options?: InvokeCustomMethodFpOptions) => CloudStorageTask<void>, true>;
75
+ /**
76
+ * @see setItemFp
77
+ */
78
+ readonly setItem: WithChecks<(key: string, value: string, options?: InvokeCustomMethodFpOptions) => BetterPromise<void>, true>;
79
+ /**
80
+ * Clears the cloud storage.
81
+ * @param options - additional options.
82
+ * @since Mini Apps v6.9
83
+ */
84
+ readonly clearFp: WithChecksFp<(options?: InvokeCustomMethodFpOptions) => CloudStorageTask<void>, true>;
85
+ /**
86
+ * @see clearFp
87
+ */
88
+ readonly clear: WithChecks<(options?: InvokeCustomMethodFpOptions) => BetterPromise<void>, true>;
89
+ }
90
+ export {};
@@ -0,0 +1,2 @@
1
+ export { CloudStorage, type CloudStorageOptions } from './CloudStorage.js';
2
+ export { cloudStorage } from './instance.js';
@@ -0,0 +1,2 @@
1
+ import { CloudStorage } from './CloudStorage.js';
2
+ export declare const cloudStorage: CloudStorage;
@@ -0,0 +1,57 @@
1
+ import { Computed } from '@tma.js/signals';
2
+ import { ImpactHapticFeedbackStyle, NotificationHapticFeedbackType, PostEventError } from '@tma.js/bridge';
3
+ import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
4
+ import { WithChecksFp, WithChecks } from '../../with-checks/withChecksFp.js';
5
+ import { WithVersion } from '../../fn-options/withVersion.js';
6
+ import { WithPostEvent } from '../../fn-options/withPostEvent.js';
7
+ import * as E from 'fp-ts/Either';
8
+ type HapticFeedbackEither = E.Either<PostEventError, void>;
9
+ export interface HapticFeedbackOptions extends WithVersion, WithPostEvent, SharedFeatureOptions {
10
+ }
11
+ /**
12
+ * @since Mini Apps v6.1
13
+ */
14
+ export declare class HapticFeedback {
15
+ constructor({ postEvent, isTma, version }: HapticFeedbackOptions);
16
+ /**
17
+ * Signal indicating if the component is supported.
18
+ */
19
+ readonly isSupported: Computed<boolean>;
20
+ /**
21
+ * A method that tells if an impact occurred. The Telegram app may play the
22
+ * appropriate haptics based on style value passed.
23
+ * @param style - impact style.
24
+ * @since Mini Apps v6.1
25
+ */
26
+ impactOccurredFp: WithChecksFp<(style: ImpactHapticFeedbackStyle) => HapticFeedbackEither, true>;
27
+ /**
28
+ * @see impactOccurredFp
29
+ */
30
+ impactOccurred: WithChecks<(style: ImpactHapticFeedbackStyle) => void, true>;
31
+ /**
32
+ * A method tells that a task or action has succeeded, failed, or produced
33
+ * a warning. The Telegram app may play the appropriate haptics based on type
34
+ * value passed.
35
+ * @param type - notification type.
36
+ * @since Mini Apps v6.1
37
+ */
38
+ notificationOccurredFp: WithChecksFp<(type: NotificationHapticFeedbackType) => HapticFeedbackEither, true>;
39
+ /**
40
+ * @see notificationOccurredFp
41
+ */
42
+ notificationOccurred: WithChecks<(type: NotificationHapticFeedbackType) => void, true>;
43
+ /**
44
+ * A method tells that the user has changed a selection. The Telegram app may
45
+ * play the appropriate haptics.
46
+ *
47
+ * Do not use this feedback when the user makes or confirms a selection; use
48
+ * it only when the selection changes.
49
+ * @since Mini Apps v6.1
50
+ */
51
+ selectionChangedFp: WithChecksFp<() => HapticFeedbackEither, true>;
52
+ /**
53
+ * @see selectionChangedFp
54
+ */
55
+ selectionChanged: WithChecks<() => void, true>;
56
+ }
57
+ export {};
@@ -0,0 +1,2 @@
1
+ export { HapticFeedback, type HapticFeedbackOptions } from './HapticFeedback.js';
2
+ export { hapticFeedback } from './instance.js';
@@ -0,0 +1,2 @@
1
+ import { HapticFeedback } from './HapticFeedback.js';
2
+ export declare const hapticFeedback: HapticFeedback;
@@ -0,0 +1,84 @@
1
+ import { Computed } from '@tma.js/signals';
2
+ import { InitData as InitDataType } from '@tma.js/types';
3
+ import * as E from 'fp-ts/Either';
4
+ import * as O from 'fp-ts/Option';
5
+ export interface InitDataOptions<Err> {
6
+ /**
7
+ * Retrieves init data from the current environment.
8
+ */
9
+ retrieveInitData: () => E.Either<Err, O.Option<{
10
+ raw: string;
11
+ obj: InitDataType;
12
+ }>>;
13
+ }
14
+ export declare class InitData<Err extends Error> {
15
+ constructor({ retrieveInitData }: InitDataOptions<Err>);
16
+ private fromState;
17
+ private readonly _state;
18
+ private readonly _raw;
19
+ /**
20
+ * Complete component state.
21
+ */
22
+ readonly state: Computed<InitDataType | undefined>;
23
+ /**
24
+ * @see InitDataType.auth_date
25
+ */
26
+ readonly authDate: Computed<Date | undefined>;
27
+ /**
28
+ * @see InitDataType.can_send_after
29
+ */
30
+ readonly canSendAfter: Computed<number | undefined>;
31
+ /**
32
+ * Date after which it is allowed to call
33
+ * the [answerWebAppQuery](https://core.telegram.org/bots/api#answerwebappquery) method.
34
+ */
35
+ readonly canSendAfterDate: Computed<Date | undefined>;
36
+ /**
37
+ * @see InitDataType.chat
38
+ */
39
+ readonly chat: Computed<import('@tma.js/types').Chat | undefined>;
40
+ /**
41
+ * @see InitDataType.chat_type
42
+ */
43
+ readonly chatType: Computed<string | undefined>;
44
+ /**
45
+ * @see InitDataType.chat_instance
46
+ */
47
+ readonly chatInstance: Computed<string | undefined>;
48
+ /**
49
+ * @see InitDataType.hash
50
+ */
51
+ readonly hash: Computed<string | undefined>;
52
+ /**
53
+ * @see InitDataType.query_id
54
+ */
55
+ readonly queryId: Computed<string | undefined>;
56
+ /**
57
+ * Raw representation of init data.
58
+ */
59
+ readonly raw: Computed<string | undefined>;
60
+ /**
61
+ * @see InitDataType.receiver
62
+ */
63
+ readonly receiver: Computed<import('@tma.js/types').User | undefined>;
64
+ /**
65
+ * @see InitDataType.signature
66
+ */
67
+ readonly signature: Computed<string | undefined>;
68
+ /**
69
+ * @see InitDataType.start_param
70
+ */
71
+ readonly startParam: Computed<string | undefined>;
72
+ /**
73
+ * @see InitDataType.user
74
+ */
75
+ readonly user: Computed<import('@tma.js/types').User | undefined>;
76
+ /**
77
+ * Restores the component state.
78
+ */
79
+ readonly restoreFp: () => E.Either<Err, void>;
80
+ /**
81
+ * @see restoreFp
82
+ */
83
+ readonly restore: () => void;
84
+ }
@@ -0,0 +1,2 @@
1
+ export { InitData, type InitDataOptions } from './InitData.js';
2
+ export { initData } from './instance.js';
@@ -0,0 +1,2 @@
1
+ import { InitData } from './InitData.js';
2
+ export declare const initData: InitData<import('@tma.js/bridge').RetrieveLaunchParamsError>;
@@ -0,0 +1,54 @@
1
+ import { Computed } from '@tma.js/signals';
2
+ import { InvoiceStatus, RequestError } from '@tma.js/bridge';
3
+ import { BetterPromise } from 'better-promises';
4
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
5
+ import { AsyncOptions } from '../../types.js';
6
+ import { ConcurrentCallError, InvalidArgumentsError } from '../../errors.js';
7
+ import { WithVersion } from '../../fn-options/withVersion.js';
8
+ import { WithRequest } from '../../fn-options/withRequest.js';
9
+ import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
10
+ import * as TE from 'fp-ts/TaskEither';
11
+ type InvoiceTask<E, T> = TE.TaskEither<RequestError | ConcurrentCallError | E, T>;
12
+ export interface InvoiceOptions extends WithVersion, WithRequest, SharedFeatureOptions {
13
+ }
14
+ /**
15
+ * @since Mini Apps v6.1
16
+ */
17
+ export declare class Invoice {
18
+ constructor({ version, request, isTma }: InvoiceOptions);
19
+ /**
20
+ * Signal indicating if any invoice is currently opened.
21
+ */
22
+ readonly isOpened: Computed<boolean>;
23
+ /**
24
+ * Signal indicating if the component is supported.
25
+ */
26
+ readonly isSupported: Computed<boolean>;
27
+ /**
28
+ * Opens an invoice using its slug or URL.
29
+ * @param slug - invoice slug.
30
+ * @param options - additional options.
31
+ * @since Mini Apps v6.1
32
+ * @example
33
+ * const status = await invoice.openSlug('kJNFS331');
34
+ */
35
+ readonly openSlugFp: WithChecksFp<(slug: string, options?: AsyncOptions) => InvoiceTask<never, InvoiceStatus>, true>;
36
+ /**
37
+ * @see openSlugFp
38
+ */
39
+ readonly openSlug: WithChecks<(slug: string, options?: AsyncOptions) => BetterPromise<InvoiceStatus>, true>;
40
+ /**
41
+ * Opens an invoice using its URL.
42
+ * @param url - invoice URL.
43
+ * @param options - additional options.
44
+ * @since Mini Apps v6.1
45
+ * @example
46
+ * const status = await invoice.openUrl('https://t.me/$kJNFS331');
47
+ */
48
+ readonly openUrlFp: WithChecksFp<(url: string, options?: AsyncOptions) => (InvoiceTask<InvalidArgumentsError, InvoiceStatus>), true>;
49
+ /**
50
+ * @see openUrlFp
51
+ */
52
+ readonly openUrl: WithChecks<(url: string, options?: AsyncOptions) => BetterPromise<InvoiceStatus>, true>;
53
+ }
54
+ export {};
@@ -0,0 +1,2 @@
1
+ export { Invoice, type InvoiceOptions } from './Invoice.js';
2
+ export { invoice } from './instance.js';
@@ -0,0 +1,2 @@
1
+ import { Invoice } from './Invoice.js';
2
+ export declare const invoice: Invoice;
@@ -0,0 +1,74 @@
1
+ import { Computed } from '@tma.js/signals';
2
+ import { RequestError, PostEventError } from '@tma.js/bridge';
3
+ import { BetterPromise } from 'better-promises';
4
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
5
+ import { AsyncOptions } from '../../types.js';
6
+ import { LocationManagerOptions, LocationManagerRequestLocationResponse, LocationManagerState } from './types.js';
7
+ import * as E from 'fp-ts/Either';
8
+ import * as TE from 'fp-ts/TaskEither';
9
+ /**
10
+ * @since Mini Apps v8.0
11
+ */
12
+ export declare class LocationManager {
13
+ constructor({ version, request, postEvent, storage, isTma, isPageReload, }: LocationManagerOptions);
14
+ /**
15
+ * Complete location manager state.
16
+ */
17
+ readonly state: Computed<LocationManagerState>;
18
+ /**
19
+ * Signal indicating whether the location data tracking is currently available.
20
+ */
21
+ readonly isAvailable: Computed<boolean>;
22
+ /**
23
+ * Signal indicating whether the user has granted the app permission to track location data.
24
+ */
25
+ readonly isAccessGranted: Computed<boolean>;
26
+ /**
27
+ * Signal indicating whether the app has previously requested permission to track location data.
28
+ */
29
+ readonly isAccessRequested: Computed<boolean>;
30
+ /**
31
+ * Signal indicating if the component is currently mounted.
32
+ */
33
+ readonly isMounted: Computed<boolean>;
34
+ /**
35
+ * Signal indicating if the component is supported.
36
+ */
37
+ readonly isSupported: Computed<boolean>;
38
+ /**
39
+ * Opens the location access settings for bots. Useful when you need to request location access
40
+ * from users who haven't granted it yet.
41
+ *
42
+ * Note that this method can be called only in response to user interaction with the Mini App
43
+ * interface (e.g., a click inside the Mini App or on the main button).
44
+ * @since Mini Apps v8.0
45
+ */
46
+ readonly openSettingsFp: WithChecksFp<() => E.Either<PostEventError, void>, true>;
47
+ /**
48
+ * @see openSettingsFp
49
+ */
50
+ readonly openSettings: WithChecks<() => void, true>;
51
+ /**
52
+ * Requests location data.
53
+ * @since Mini Apps v8.0
54
+ * @returns Promise with location data or null it access was not granted.
55
+ */
56
+ readonly requestLocationFp: WithChecksFp<(options?: AsyncOptions) => (TE.TaskEither<RequestError, LocationManagerRequestLocationResponse | null>), true>;
57
+ /**
58
+ * @see requestLocationFp
59
+ */
60
+ readonly requestLocation: WithChecks<(options?: AsyncOptions) => BetterPromise<LocationManagerRequestLocationResponse | null>, true>;
61
+ /**
62
+ * Mounts the component restoring its state.
63
+ * @since Mini Apps v8.0
64
+ */
65
+ readonly mountFp: WithChecksFp<(options?: AsyncOptions) => TE.TaskEither<RequestError, void>, true>;
66
+ /**
67
+ * @see mountFp
68
+ */
69
+ readonly mount: WithChecks<(options?: AsyncOptions) => BetterPromise<void>, true>;
70
+ /**
71
+ * Unmounts the component.
72
+ */
73
+ readonly unmount: () => void;
74
+ }
@@ -0,0 +1,3 @@
1
+ export { LocationManager } from './LocationManager.js';
2
+ export { locationManager } from './instance.js';
3
+ export type { LocationManagerOptions, LocationManagerRequestLocationResponse, LocationManagerState, } from './types.js';
@@ -0,0 +1,2 @@
1
+ import { LocationManager } from './LocationManager.js';
2
+ export declare const locationManager: LocationManager;
@@ -0,0 +1,65 @@
1
+ import { Maybe } from '@tma.js/toolkit';
2
+ import { WithStateRestore } from '../../fn-options/withStateRestore.js';
3
+ import { WithRequest } from '../../fn-options/withRequest.js';
4
+ import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
5
+ import { WithVersion } from '../../fn-options/withVersion.js';
6
+ import { WithPostEvent } from '../../fn-options/withPostEvent.js';
7
+ export interface LocationManagerRequestLocationResponse {
8
+ /**
9
+ * Latitude in degrees.
10
+ */
11
+ latitude: number;
12
+ /**
13
+ * Longitude in degrees.
14
+ */
15
+ longitude: number;
16
+ /**
17
+ * Altitude above sea level in meters.
18
+ */
19
+ altitude?: Maybe<number>;
20
+ /**
21
+ * The direction the device is moving in degrees.
22
+ */
23
+ course?: Maybe<number>;
24
+ /**
25
+ * The speed of the device in m/s.
26
+ */
27
+ speed?: Maybe<number>;
28
+ /**
29
+ * Accuracy of the latitude and longitude values in meters.
30
+ */
31
+ horizontal_accuracy?: Maybe<number>;
32
+ /**
33
+ * Accuracy of the altitude value in meters.
34
+ */
35
+ vertical_accuracy?: Maybe<number>;
36
+ /**
37
+ * Accuracy of the course value in degrees.
38
+ */
39
+ course_accuracy?: Maybe<number>;
40
+ /**
41
+ * Accuracy of the speed value in m/s.
42
+ */
43
+ speed_accuracy?: Maybe<number>;
44
+ }
45
+ export interface LocationManagerState {
46
+ /**
47
+ * If true, indicates that location data tracking is available on the current device.
48
+ */
49
+ available: boolean;
50
+ /**
51
+ * Indicates whether the app has previously requested permission to track location data.
52
+ */
53
+ accessRequested: boolean;
54
+ /**
55
+ * Indicates whether the user has granted the app permission to track location data.
56
+ *
57
+ * If false and `accessRequested` is true may indicate that:
58
+ *
59
+ * - The user has simply canceled the permission popup.
60
+ * - The user has denied the app permission to track location data.
61
+ */
62
+ accessGranted: boolean;
63
+ }
64
+ export interface LocationManagerOptions extends WithStateRestore<LocationManagerState>, WithRequest, WithVersion, WithPostEvent, SharedFeatureOptions {
65
+ }