@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,220 @@
1
+ import { BetterPromise } from 'better-promises';
2
+ import { SafeAreaInsets, EventListener, RequestError, PostEventError } from '@tma.js/bridge';
3
+ import { Computed } from '@tma.js/signals';
4
+ import { WithStateRestore } from '../../fn-options/withStateRestore.js';
5
+ import { AsyncOptions } from '../../types.js';
6
+ import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
7
+ import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
8
+ import { WithVersion } from '../../fn-options/withVersion.js';
9
+ import { WithRequest } from '../../fn-options/withRequest.js';
10
+ import { CSSVarsBoundError, FullscreenFailedError } from '../../errors.js';
11
+ import { WithPostEvent } from '../../fn-options/withPostEvent.js';
12
+ import * as E from 'fp-ts/Either';
13
+ import * as TE from 'fp-ts/TaskEither';
14
+ type FullscreenError = FullscreenFailedError | RequestError;
15
+ type ViewportChangedEventListener = EventListener<'viewport_changed'>;
16
+ type FullscreenChangedEventListener = EventListener<'fullscreen_changed'>;
17
+ type SafeAreaInsetsChangedEventListener = EventListener<'safe_area_changed'>;
18
+ type SafeAreaInsetCSSVarKey = `safeAreaInset${Capitalize<keyof SafeAreaInsets>}`;
19
+ export type GetCSSVarNameKey = 'width' | 'height' | 'stableHeight' | SafeAreaInsetCSSVarKey | `content${Capitalize<SafeAreaInsetCSSVarKey>}`;
20
+ export type GetCSSVarNameFn = (key: GetCSSVarNameKey) => string | null | undefined | false;
21
+ export interface ViewportState {
22
+ contentSafeAreaInsets: SafeAreaInsets;
23
+ height: number;
24
+ isExpanded: boolean;
25
+ isFullscreen: boolean;
26
+ safeAreaInsets: SafeAreaInsets;
27
+ stableHeight: number;
28
+ width: number;
29
+ }
30
+ type WithListeners<On extends string, Off extends string, L> = {
31
+ [K in On | Off]: (listener: L) => void;
32
+ };
33
+ export interface ViewportOptions<EViewportStable, EFullscreen> extends WithStateRestore<ViewportState>, WithVersion, WithRequest, WithPostEvent, WithListeners<'onViewportChanged', 'offViewportChanged', ViewportChangedEventListener>, WithListeners<'onFullscreenChanged', 'offFullscreenChanged', FullscreenChangedEventListener>, WithListeners<'onSafeAreaInsetsChanged', 'offSafeAreaInsetsChanged', SafeAreaInsetsChangedEventListener>, WithListeners<'onContentSafeAreaInsetsChanged', 'offContentSafeAreaInsetsChanged', SafeAreaInsetsChangedEventListener>, SharedFeatureOptions {
34
+ /**
35
+ * True if the viewport is stable.
36
+ */
37
+ isViewportStable: boolean | (() => E.Either<EViewportStable, boolean>);
38
+ /**
39
+ * True if the application was opened in fullscreen initially.
40
+ */
41
+ isFullscreen: boolean | (() => E.Either<EFullscreen, boolean>);
42
+ }
43
+ export declare class Viewport<EViewportStable, EFullscreen> {
44
+ constructor({ storage, isPageReload, onContentSafeAreaInsetsChanged, onSafeAreaInsetsChanged, onViewportChanged, onFullscreenChanged, offContentSafeAreaInsetsChanged, offFullscreenChanged, offSafeAreaInsetsChanged, offViewportChanged, request, isViewportStable, isFullscreen, isTma, version, postEvent, }: ViewportOptions<EViewportStable, EFullscreen>);
45
+ /**
46
+ * Complete component state.
47
+ */
48
+ readonly state: Computed<ViewportState>;
49
+ /**
50
+ * Signal containing the current height of the **visible area** of the Mini App.
51
+ *
52
+ * The application can display just the top part of the Mini App, with its
53
+ * lower part remaining outside the screen area. From this position, the user
54
+ * can "pull" the Mini App to its maximum height, while the bot can do the same
55
+ * by calling `expand` method. As the position of the Mini App changes, the
56
+ * current height value of the visible area will be updated in real time.
57
+ *
58
+ * Please note that the refresh rate of this value is not sufficient to
59
+ * smoothly follow the lower border of the window. It should not be used to pin
60
+ * interface elements to the bottom of the visible area. It's more appropriate
61
+ * to use the value of the `stableHeight` field for this purpose.
62
+ *
63
+ * @see stableHeight
64
+ */
65
+ readonly height: Computed<number>;
66
+ /**
67
+ * Signal containing the height of the visible area of the Mini App in its last stable state.
68
+ *
69
+ * The application can display just the top part of the Mini App, with its
70
+ * lower part remaining outside the screen area. From this position, the user
71
+ * can "pull" the Mini App to its maximum height, while the application can do
72
+ * the same by calling `expand` method.
73
+ *
74
+ * Unlike the value of `height`, the value of `stableHeight` does not change as
75
+ * the position of the Mini App changes with user gestures or during
76
+ * animations. The value of `stableHeight` will be updated after all gestures
77
+ * and animations are completed and the Mini App reaches its final size.
78
+ *
79
+ * @see height
80
+ */
81
+ readonly stableHeight: Computed<number>;
82
+ /**
83
+ * Signal containing the currently visible area width.
84
+ */
85
+ readonly width: Computed<number>;
86
+ /**
87
+ * Signal indicating if the Mini App is expanded to the maximum available height. Otherwise,
88
+ * if the Mini App occupies part of the screen and can be expanded to the full
89
+ * height using the `expand` method.
90
+ */
91
+ readonly isExpanded: Computed<boolean>;
92
+ /**
93
+ * Signal indicating if the current viewport height is stable and is not going to change in
94
+ * the next moment.
95
+ */
96
+ readonly isStable: Computed<boolean>;
97
+ /**
98
+ * Signal containing content safe area insets.
99
+ */
100
+ readonly contentSafeAreaInsets: Computed<SafeAreaInsets>;
101
+ /**
102
+ * Signal containing top content safe area inset.
103
+ */
104
+ readonly contentSafeAreaInsetTop: Computed<number>;
105
+ /**
106
+ * Signal containing left content safe area inset.
107
+ */
108
+ readonly contentSafeAreaInsetLeft: Computed<number>;
109
+ /**
110
+ * Signal containing right content safe area inset.
111
+ */
112
+ readonly contentSafeAreaInsetRight: Computed<number>;
113
+ /**
114
+ * Signal containing bottom content safe area inset.
115
+ */
116
+ readonly contentSafeAreaInsetBottom: Computed<number>;
117
+ /**
118
+ * Signal containing safe area insets.
119
+ */
120
+ readonly safeAreaInsets: Computed<SafeAreaInsets>;
121
+ /**
122
+ * Signal containing top safe area inset.
123
+ */
124
+ readonly safeAreaInsetTop: Computed<number>;
125
+ /**
126
+ * Signal containing left safe area inset.
127
+ */
128
+ readonly safeAreaInsetLeft: Computed<number>;
129
+ /**
130
+ * Signal containing right safe area inset.
131
+ */
132
+ readonly safeAreaInsetRight: Computed<number>;
133
+ /**
134
+ * Signal containing bottom safe area inset.
135
+ */
136
+ readonly safeAreaInsetBottom: Computed<number>;
137
+ /**
138
+ * Signal indicating if the viewport is currently in fullscreen mode.
139
+ */
140
+ readonly isFullscreen: Computed<boolean>;
141
+ /**
142
+ * Requests fullscreen mode for the mini application.
143
+ * @since Mini Apps v8.0
144
+ */
145
+ readonly requestFullscreenFp: WithChecksFp<(options?: AsyncOptions) => TE.TaskEither<FullscreenError, void>, true>;
146
+ /**
147
+ * @see requestFullscreenFp
148
+ */
149
+ readonly requestFullscreen: WithChecks<(options?: AsyncOptions) => BetterPromise<void>, true>;
150
+ /**
151
+ * Exits mini application from the fullscreen mode.
152
+ * @since Mini Apps v8.0
153
+ */
154
+ readonly exitFullscreenFp: WithChecksFp<(options?: AsyncOptions) => TE.TaskEither<FullscreenError, void>, true>;
155
+ /**
156
+ * @see exitFullscreenFp
157
+ */
158
+ readonly exitFullscreen: WithChecks<(options?: AsyncOptions) => BetterPromise<void>, true>;
159
+ /**
160
+ * Signal indicating if CSS variables are bound.
161
+ */
162
+ readonly isCssVarsBound: Computed<boolean>;
163
+ /**
164
+ * Creates CSS variables connected with the current viewport.
165
+ *
166
+ * By default, created CSS variables names are following the pattern "--tg-theme-{name}", where
167
+ * {name} is a viewport property name converted from camel case to kebab case.
168
+ *
169
+ * Default variables:
170
+ * - `--tg-viewport-height`
171
+ * - `--tg-viewport-width`
172
+ * - `--tg-viewport-stable-height`
173
+ * - `--tg-viewport-content-safe-area-inset-top`
174
+ * - `--tg-viewport-content-safe-area-inset-bottom`
175
+ * - `--tg-viewport-content-safe-area-inset-left`
176
+ * - `--tg-viewport-content-safe-area-inset-right`
177
+ * - `--tg-viewport-safe-area-inset-top`
178
+ * - `--tg-viewport-safe-area-inset-bottom`
179
+ * - `--tg-viewport-safe-area-inset-left`
180
+ * - `--tg-viewport-safe-area-inset-right`
181
+ *
182
+ * Variables are being automatically updated if the viewport was changed.
183
+ *
184
+ * @param getCSSVarName - function, returning computed complete CSS variable name. The CSS
185
+ * variable will only be defined if the function returned non-empty string value.
186
+ * @returns Function to stop updating variables.
187
+ * @example Using no arguments
188
+ * bindCssVarsFp();
189
+ * @example Using custom CSS vars generator
190
+ * bindCssVarsFp(key => `--my-prefix-${key}`);
191
+ */
192
+ readonly bindCssVarsFp: WithChecksFp<(getCSSVarName?: GetCSSVarNameFn) => (E.Either<CSSVarsBoundError, VoidFunction>), false>;
193
+ /**
194
+ * @see bindCssVarsFp
195
+ */
196
+ readonly bindCssVars: WithChecks<(getCSSVarName?: GetCSSVarNameFn) => VoidFunction, false>;
197
+ /**
198
+ * Signal indicating if the component is currently mounted.
199
+ */
200
+ readonly isMounted: Computed<boolean>;
201
+ /**
202
+ * Mounts the component.
203
+ */
204
+ readonly mountFp: WithChecksFp<(options?: AsyncOptions) => (TE.TaskEither<EFullscreen | EViewportStable | RequestError, void>), false>;
205
+ /**
206
+ * @see mountFp
207
+ */
208
+ readonly mount: WithChecks<(options?: AsyncOptions) => BetterPromise<void>, false>;
209
+ /**
210
+ * A method that expands the Mini App to the maximum available height. To find
211
+ * out if the Mini App is expanded to the maximum height, refer to the value of
212
+ * the `isExpanded`.
213
+ */
214
+ readonly expandFp: WithChecksFp<() => E.Either<PostEventError, void>, false>;
215
+ /**
216
+ * @see expandFp
217
+ */
218
+ readonly expand: WithChecks<() => void, false>;
219
+ }
220
+ export {};
@@ -0,0 +1,2 @@
1
+ export { viewport } from './instance.js';
2
+ export { Viewport, type ViewportState, type ViewportOptions } from './Viewport.js';
@@ -0,0 +1,2 @@
1
+ import { Viewport } from './Viewport.js';
2
+ export declare const viewport: Viewport<import('@tma.js/bridge').RetrieveLaunchParamsError, import('@tma.js/bridge').RetrieveLaunchParamsError>;
@@ -0,0 +1,2 @@
1
+ export { requestEmojiStatusAccess, requestEmojiStatusAccessFp, } from './requestEmojiStatusAccess.js';
2
+ export { setEmojiStatus, setEmojiStatusFp, type SetEmojiStatusOptions, } from './setEmojiStatus.js';
@@ -0,0 +1,16 @@
1
+ import { EmojiStatusAccessRequestedStatus, RequestError } from '@tma.js/bridge';
2
+ import { AsyncOptions } from '../../types.js';
3
+ import * as TE from 'fp-ts/TaskEither';
4
+ /**
5
+ * Shows a native popup requesting permission for the bot to manage user's emoji status.
6
+ * @param options - additional options.
7
+ * @returns Emoji status access status.
8
+ * @since Mini Apps v8.0
9
+ * @example
10
+ * const status = await requestEmojiStatusAccess();
11
+ */
12
+ export declare const requestEmojiStatusAccessFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(options: AsyncOptions) => TE.TaskEither<RequestError, EmojiStatusAccessRequestedStatus>, true, never>;
13
+ /**
14
+ * @see requestEmojiStatusAccessFp
15
+ */
16
+ export declare const requestEmojiStatusAccess: import('../../with-checks/withChecksFp.js').WithChecks<(options: AsyncOptions) => TE.TaskEither<RequestError, EmojiStatusAccessRequestedStatus>, true, never>;
@@ -0,0 +1,28 @@
1
+ import { RequestError } from '@tma.js/bridge';
2
+ import { AsyncOptions } from '../../types.js';
3
+ import { SetEmojiStatusError } from '../../errors.js';
4
+ import * as TE from 'fp-ts/TaskEither';
5
+ export interface SetEmojiStatusOptions extends AsyncOptions {
6
+ duration?: number;
7
+ }
8
+ /**
9
+ * Opens a dialog allowing the user to set the specified custom emoji as their status.
10
+ * @returns Nothing if status set was successful.
11
+ * @param options - additional options.
12
+ * @since Mini Apps v8.0
13
+ * @example
14
+ * pipe(
15
+ * setEmojiStatusFp('5361800828313167608'),
16
+ * TE.match(error => {
17
+ * console.error('Error occurred', error);
18
+ * }, () => {
19
+ * console.log('Status set');
20
+ * }),
21
+ * );
22
+ * const statusSet = await setEmojiStatus('5361800828313167608');
23
+ */
24
+ export declare const setEmojiStatusFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(customEmojiId: string, options?: SetEmojiStatusOptions) => TE.TaskEither<RequestError | SetEmojiStatusError, void>, true, never>;
25
+ /**
26
+ * @see setEmojiStatusFp
27
+ */
28
+ export declare const setEmojiStatus: import('../../with-checks/withChecksFp.js').WithChecks<(customEmojiId: string, options?: SetEmojiStatusOptions) => TE.TaskEither<RequestError | SetEmojiStatusError, void>, true, never>;
@@ -0,0 +1,11 @@
1
+ import { PostEventError } from '@tma.js/bridge';
2
+ import type * as E from 'fp-ts/Either';
3
+ /**
4
+ * Prompts the user to add the Mini App to the home screen.
5
+ * @since Mini Apps v8.0
6
+ */
7
+ export declare const addToHomeScreenFp: import('../../with-checks/withChecksFp.js').WithChecksFp<() => E.Either<PostEventError, void>, true, never>;
8
+ /**
9
+ * @see addToHomeScreenFp
10
+ */
11
+ export declare const addToHomeScreen: import('../../with-checks/withChecksFp.js').WithChecks<() => E.Either<PostEventError, void>, true, never>;
@@ -0,0 +1,14 @@
1
+ import { HomeScreenStatus, RequestError } from '@tma.js/bridge';
2
+ import { AsyncOptions } from '../../types.js';
3
+ import * as TE from 'fp-ts/TaskEither';
4
+ /**
5
+ * Sends a request to the native Telegram application to check if the current mini
6
+ * application is added to the device's home screen.
7
+ * @param options - additional options.
8
+ * @since Mini Apps v8.0
9
+ */
10
+ export declare const checkHomeScreenStatusFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(options?: AsyncOptions) => TE.TaskEither<RequestError, HomeScreenStatus>, true, never>;
11
+ /**
12
+ * @see checkHomeScreenStatusFp
13
+ */
14
+ export declare const checkHomeScreenStatus: import('../../with-checks/withChecksFp.js').WithChecks<(options?: AsyncOptions) => TE.TaskEither<RequestError, HomeScreenStatus>, true, never>;
@@ -0,0 +1,2 @@
1
+ export { addToHomeScreenFp, addToHomeScreen } from './addToHomeScreen.js';
2
+ export { checkHomeScreenStatus, checkHomeScreenStatusFp } from './checkHomeScreenStatus.js';
@@ -0,0 +1,3 @@
1
+ export { type OpenLinkError, openLinkFp, openLink, type OpenLinkOptions } from './openLink.js';
2
+ export { type OpenTelegramLinkError, openTelegramLinkFp, openTelegramLink, } from './openTelegramLink.js';
3
+ export { shareURLFp, shareURL, type ShareURLError } from './shareURL.js';
@@ -0,0 +1,31 @@
1
+ import { OpenLinkBrowser, PostEventError } from '@tma.js/bridge';
2
+ import { InvalidArgumentsError } from '../../errors.js';
3
+ import * as E from 'fp-ts/Either';
4
+ export interface OpenLinkOptions {
5
+ /**
6
+ * Attempts to use the instant view mode.
7
+ */
8
+ tryInstantView?: boolean;
9
+ /**
10
+ * A preferred browser to open the link in.
11
+ */
12
+ tryBrowser?: OpenLinkBrowser;
13
+ }
14
+ export type OpenLinkError = PostEventError | InvalidArgumentsError;
15
+ /**
16
+ * Opens a link.
17
+ *
18
+ * The Mini App will not be closed.
19
+ *
20
+ * Note that this method can be called only in response to the user
21
+ * interaction with the Mini App interface (e.g. click inside the Mini App or on the main button).
22
+ * @param url - URL to be opened.
23
+ * @param options - additional options.
24
+ * @example
25
+ * openLink('https://google.com', {
26
+ * tryInstantView: true,
27
+ * tryBrowser: 'chrome',
28
+ * });
29
+ */
30
+ export declare const openLinkFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(url: string | URL, options?: OpenLinkOptions) => E.Either<OpenLinkError, void>, false, never>;
31
+ export declare const openLink: import('../../with-checks/withChecksFp.js').WithChecks<(url: string | URL, options?: OpenLinkOptions) => E.Either<OpenLinkError, void>, false, never>;
@@ -0,0 +1,18 @@
1
+ import { PostEventError } from '@tma.js/bridge';
2
+ import { InvalidArgumentsError } from '../../errors.js';
3
+ import * as E from 'fp-ts/Either';
4
+ export type OpenTelegramLinkError = PostEventError | InvalidArgumentsError;
5
+ /**
6
+ * Opens a Telegram link inside the Telegram app. The function expects passing a link in a full
7
+ * format using the hostname "t.me".
8
+ *
9
+ * The Mini App will be closed.
10
+ * @param url - URL to be opened.
11
+ * @example
12
+ * openTelegramLink('https://t.me/heyqbnk');
13
+ */
14
+ export declare const openTelegramLinkFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(url: string | URL) => E.Either<OpenTelegramLinkError, void>, false, never>;
15
+ /**
16
+ * @see openTelegramLinkFp
17
+ */
18
+ export declare const openTelegramLink: import('../../with-checks/withChecksFp.js').WithChecks<(url: string | URL) => E.Either<OpenTelegramLinkError, void>, false, never>;
@@ -0,0 +1,18 @@
1
+ import { PostEventError } from '@tma.js/bridge';
2
+ import type * as E from 'fp-ts/Either';
3
+ export type ShareURLError = PostEventError;
4
+ /**
5
+ * Shares the specified URL with the passed to the chats, selected by user.
6
+ * After being called, it closes the mini application.
7
+ *
8
+ * This method uses Telegram's Share Links.
9
+ * @param url - URL to share.
10
+ * @param text - text to append after the URL.
11
+ * @see https://core.telegram.org/api/links#share-links
12
+ * @see https://core.telegram.org/widgets/share#custom-buttons
13
+ */
14
+ export declare const shareURLFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(url: string, text?: string) => E.Either<ShareURLError, void>, false, never>;
15
+ /**
16
+ * @see shareURLFp
17
+ */
18
+ export declare const shareURL: import('../../with-checks/withChecksFp.js').WithChecks<(url: string, text?: string) => E.Either<ShareURLError, void>, false, never>;
@@ -0,0 +1,3 @@
1
+ export { type RequestContactError, type RequestedContactCompleteData, type RequestedContact, requestContact, requestContactComplete, requestContactCompleteFp, requestContactFp, } from './requestContact.js';
2
+ export { type RequestPhoneAccessError, requestPhoneAccess, requestPhoneAccessFp, } from './requestPhoneAccess.js';
3
+ export { requestWriteAccess, requestWriteAccessFp, type RequestWriteAccessError, } from './requestWriteAccess.js';
@@ -0,0 +1,59 @@
1
+ import { BetterTaskEitherError } from '@tma.js/toolkit';
2
+ import { InvokeCustomMethodError } from '../../fn-options/withInvokeCustomMethod.js';
3
+ import { AccessDeniedError, ValidationError } from '../../errors.js';
4
+ import { AsyncOptions } from '../../types.js';
5
+ import * as TE from 'fp-ts/TaskEither';
6
+ /**
7
+ * Requested contact information.
8
+ */
9
+ export interface RequestedContact {
10
+ contact: {
11
+ user_id: number;
12
+ phone_number: string;
13
+ first_name: string;
14
+ last_name?: string;
15
+ [key: string]: unknown;
16
+ };
17
+ auth_date: Date;
18
+ hash: string;
19
+ [key: string]: unknown;
20
+ }
21
+ /**
22
+ * Requested contact complete data.
23
+ */
24
+ export interface RequestedContactCompleteData {
25
+ /**
26
+ * Raw original representation of the contact data returned from the Telegram server.
27
+ */
28
+ raw: string;
29
+ /**
30
+ * Parsed representation of the contact data.
31
+ */
32
+ parsed: RequestedContact;
33
+ }
34
+ export type RequestContactError = InvokeCustomMethodError | AccessDeniedError | ValidationError | BetterTaskEitherError;
35
+ /**
36
+ * Requests current user contact information.
37
+ *
38
+ * This function returns an object, containing both raw and parsed representations of a response,
39
+ * received from the Telegram client.
40
+ * @param options - additional options.
41
+ * @since Mini Apps v6.9
42
+ */
43
+ export declare const requestContactCompleteFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(options?: AsyncOptions) => TE.TaskEither<RequestContactError, RequestedContactCompleteData>, true, never>;
44
+ /**
45
+ * @see requestContactCompleteFp
46
+ */
47
+ export declare const requestContactComplete: import('../../with-checks/withChecksFp.js').WithChecks<(options?: AsyncOptions) => TE.TaskEither<RequestContactError, RequestedContactCompleteData>, true, never>;
48
+ /**
49
+ * Works the same way as the `requestContactCompleteFp` function, but returns only parsed
50
+ * representation of the contact data.
51
+ * @see requestContactCompleteFp
52
+ * @param options - additional options.
53
+ * @since Mini Apps v6.9
54
+ */
55
+ export declare const requestContactFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(options?: AsyncOptions) => TE.TaskEither<RequestContactError, RequestedContact>, true, never>;
56
+ /**
57
+ * @see requestContactFp
58
+ */
59
+ export declare const requestContact: import('../../with-checks/withChecksFp.js').WithChecks<(options?: AsyncOptions) => TE.TaskEither<RequestContactError, RequestedContact>, true, never>;
@@ -0,0 +1,19 @@
1
+ import { PhoneRequestedStatus, RequestError } from '@tma.js/bridge';
2
+ import { AsyncOptions } from '../../types.js';
3
+ import * as TE from 'fp-ts/TaskEither';
4
+ export type RequestPhoneAccessError = RequestError;
5
+ /**
6
+ * Requests current user phone access. Method returns promise, which resolves
7
+ * status of the request. In case, user accepted the request, Mini App bot will receive
8
+ * the according notification.
9
+ *
10
+ * To obtain the retrieved information instead, utilize the `requestContact` method.
11
+ * @param options - additional options.
12
+ * @since Mini Apps v6.9
13
+ * @see requestContact
14
+ */
15
+ export declare const requestPhoneAccessFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(options?: AsyncOptions) => TE.TaskEither<RequestPhoneAccessError, PhoneRequestedStatus>, true, never>;
16
+ /**
17
+ * @see requestPhoneAccessFp
18
+ */
19
+ export declare const requestPhoneAccess: import('../../with-checks/withChecksFp.js').WithChecks<(options?: AsyncOptions) => TE.TaskEither<RequestPhoneAccessError, PhoneRequestedStatus>, true, never>;
@@ -0,0 +1,14 @@
1
+ import { WriteAccessRequestedStatus, RequestError } from '@tma.js/bridge';
2
+ import { AsyncOptions } from '../../types.js';
3
+ import * as TE from 'fp-ts/TaskEither';
4
+ export type RequestWriteAccessError = RequestError;
5
+ /**
6
+ * Requests write message access to the current user.
7
+ * @param options - additional options.
8
+ * @since Mini Apps v6.9
9
+ */
10
+ export declare const requestWriteAccessFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(options?: AsyncOptions) => TE.TaskEither<RequestWriteAccessError, WriteAccessRequestedStatus>, true, never>;
11
+ /**
12
+ * @see requestWriteAccessFp
13
+ */
14
+ export declare const requestWriteAccess: import('../../with-checks/withChecksFp.js').WithChecks<(options?: AsyncOptions) => TE.TaskEither<RequestWriteAccessError, WriteAccessRequestedStatus>, true, never>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Copies specified text to the clipboard.
3
+ * @param text - text to copy.
4
+ */
5
+ export declare function copyTextToClipboard(text: string): Promise<void>;
@@ -0,0 +1,21 @@
1
+ import { RequestError } from '@tma.js/bridge';
2
+ import { AccessDeniedError } from '../../errors.js';
3
+ import { AsyncOptions } from '../../types.js';
4
+ import * as TE from 'fp-ts/TaskEither';
5
+ export type DownloadFileError = RequestError | AccessDeniedError;
6
+ /**
7
+ * Displays a native popup prompting the user to download a file.
8
+ * @param url - the HTTPS URL of the file to be downloaded.
9
+ * @param file - the suggested name for the downloaded file.
10
+ * @param options - additional request execution options.
11
+ * @since Mini Apps v8.0
12
+ * @example
13
+ * pipe(
14
+ * downloadFileFp('https://telegram.org/js/telegram-web-app.js', 'telegram-sdk.js'),
15
+ * TE.map(() => {
16
+ * console.log('Downloading');
17
+ * })
18
+ * )
19
+ */
20
+ export declare const downloadFileFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(url: string, fileName: string, options?: AsyncOptions) => TE.TaskEither<DownloadFileError, void>, true, never>;
21
+ export declare const downloadFile: import('../../with-checks/withChecksFp.js').WithChecks<(url: string, fileName: string, options?: AsyncOptions) => TE.TaskEither<DownloadFileError, void>, true, never>;
@@ -0,0 +1,11 @@
1
+ export { copyTextToClipboard } from './copyTextToClipboard.js';
2
+ export { downloadFile, type DownloadFileError, downloadFileFp } from './downloadFile.js';
3
+ export { getCurrentTime, type GetCurrentTimeError, getCurrentTimeFp } from './getCurrentTime.js';
4
+ export { hideKeyboard, hideKeyboardFp, type HideKeyboardError } from './hideKeyboard.js';
5
+ export { readTextFromClipboard, readTextFromClipboardFp, type ReadTextFromClipboardError, } from './readTextFromClipboard.js';
6
+ export { retrieveAndroidDeviceData } from './retrieveAndroidDeviceData.js';
7
+ export { retrieveAndroidDeviceDataFrom, type AndroidDeviceData, } from './retrieveAndroidDeviceDataFrom.js';
8
+ export { sendData, sendDataFp, type SendDataError } from './sendData.js';
9
+ export { shareMessage, shareMessageFp, type ShareMessageFnError } from './shareMessage.js';
10
+ export { shareStory, shareStoryFp, type ShareStoryOptions, type ShareStoryError, } from './shareStory.js';
11
+ export { switchInlineQuery, switchInlineQueryFp, type SwitchInlineQueryError, } from './switchInlineQuery.js';
@@ -0,0 +1,15 @@
1
+ import { InvokeCustomMethodError } from '../../fn-options/withInvokeCustomMethod.js';
2
+ import { AsyncOptions } from '../../types.js';
3
+ import { ValidationError } from '../../errors.js';
4
+ import * as TE from 'fp-ts/TaskEither';
5
+ export type GetCurrentTimeError = InvokeCustomMethodError | ValidationError;
6
+ /**
7
+ * @returns The current time according to the Telegram server time.
8
+ * @param options - additional options.
9
+ * @since Mini Apps v6.9
10
+ */
11
+ export declare const getCurrentTimeFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(options?: AsyncOptions) => TE.TaskEither<GetCurrentTimeError, Date>, true, never>;
12
+ /**
13
+ * @see getCurrentTimeFp
14
+ */
15
+ export declare const getCurrentTime: import('../../with-checks/withChecksFp.js').WithChecks<(options?: AsyncOptions) => TE.TaskEither<GetCurrentTimeError, Date>, true, never>;
@@ -0,0 +1,13 @@
1
+ import { PostEventError } from '@tma.js/bridge';
2
+ import * as E from 'fp-ts/Either';
3
+ export type HideKeyboardError = PostEventError;
4
+ /**
5
+ * Hides the on-screen keyboard, if it is currently visible. Does nothing if the keyboard is
6
+ * not active.
7
+ * @since Mini Apps v9.1
8
+ */
9
+ export declare const hideKeyboardFp: import('../../with-checks/withChecksFp.js').WithChecksFp<() => E.Either<HideKeyboardError, void>, true, never>;
10
+ /**
11
+ * @see hideKeyboardFp
12
+ */
13
+ export declare const hideKeyboard: import('../../with-checks/withChecksFp.js').WithChecks<() => E.Either<HideKeyboardError, void>, true, never>;
@@ -0,0 +1,13 @@
1
+ import { RequestError } from '@tma.js/bridge';
2
+ import { AsyncOptions } from '../../types.js';
3
+ import * as TE from 'fp-ts/TaskEither';
4
+ export type ReadTextFromClipboardError = RequestError;
5
+ /**
6
+ * Reads a text from the clipboard and returns a `string` or `null`. `null` is returned
7
+ * in one of the following cases:
8
+ * - A value in the clipboard is not a text.
9
+ * - Access to the clipboard is not granted.
10
+ * @since Mini Apps v6.4
11
+ */
12
+ export declare const readTextFromClipboardFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(options?: AsyncOptions) => TE.TaskEither<ReadTextFromClipboardError, string | null>, true, never>;
13
+ export declare const readTextFromClipboard: import('../../with-checks/withChecksFp.js').WithChecks<(options?: AsyncOptions) => TE.TaskEither<ReadTextFromClipboardError, string | null>, true, never>;
@@ -0,0 +1,6 @@
1
+ import { AndroidDeviceData } from './retrieveAndroidDeviceDataFrom.js';
2
+ /**
3
+ * Retrieves Android device data from the navigator.userAgent.
4
+ * @see https://core.telegram.org/bots/webapps#additional-data-in-user-agent
5
+ */
6
+ export declare function retrieveAndroidDeviceData(): AndroidDeviceData;
@@ -0,0 +1,14 @@
1
+ export interface AndroidDeviceData {
2
+ appVersion?: string;
3
+ manufacturer?: string;
4
+ model?: string;
5
+ androidVersion?: string;
6
+ sdkVersion?: number;
7
+ performanceClass?: 'LOW' | 'AVERAGE' | 'HIGH' | string;
8
+ }
9
+ /**
10
+ * Retrieves Android device data from the specified User Agent.
11
+ * @see https://core.telegram.org/bots/webapps#additional-data-in-user-agent
12
+ * @param userAgent - user agent.
13
+ */
14
+ export declare function retrieveAndroidDeviceDataFrom(userAgent: string): AndroidDeviceData;
@@ -0,0 +1,20 @@
1
+ import { PostEventError } from '@tma.js/bridge';
2
+ import { InvalidArgumentsError } from '../../errors.js';
3
+ import * as E from 'fp-ts/Either';
4
+ export type SendDataError = PostEventError | InvalidArgumentsError;
5
+ /**
6
+ * Sends data to the bot.
7
+ *
8
+ * When this method called, a service message sent to the bot containing the data of the length
9
+ * up to 4096 bytes, and the Mini App closed.
10
+ *
11
+ * See the field `web_app_data` in the class [Message](https://core.telegram.org/bots/api#message).
12
+ *
13
+ * This method is only available for Mini Apps launched via a Keyboard button.
14
+ * @param data - data to send to bot.
15
+ */
16
+ export declare const sendDataFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(data: string) => E.Either<SendDataError, void>, false, never>;
17
+ /**
18
+ * @see sendDataFp
19
+ */
20
+ export declare const sendData: import('../../with-checks/withChecksFp.js').WithChecks<(data: string) => E.Either<SendDataError, void>, false, never>;
@@ -0,0 +1,14 @@
1
+ import { RequestError } from '@tma.js/bridge';
2
+ import { ShareMessageError } from '../../errors.js';
3
+ import { AsyncOptions } from '../../types.js';
4
+ import * as TE from 'fp-ts/TaskEither';
5
+ export type ShareMessageFnError = RequestError | ShareMessageError;
6
+ /**
7
+ * Opens a dialog allowing the user to share a message provided by the bot.
8
+ * @since Mini Apps v8.0
9
+ */
10
+ export declare const shareMessageFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(messageId: string, options?: AsyncOptions) => TE.TaskEither<ShareMessageFnError, void>, true, never>;
11
+ /**
12
+ * @see shareMessageFp
13
+ */
14
+ export declare const shareMessage: import('../../with-checks/withChecksFp.js').WithChecks<(messageId: string, options?: AsyncOptions) => TE.TaskEither<ShareMessageFnError, void>, true, never>;