@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
@@ -1,16 +0,0 @@
1
- import { WithSupportsAndStateUtils } from './WithSupportsAndStateUtils.js';
2
- import { StateEvents } from './State/types.js';
3
- import { EventEmitter } from '../events/event-emitter/EventEmitter.js';
4
-
5
- type Emitter<StateShape extends object> = EventEmitter<StateEvents<StateShape>>;
6
- export declare class WithSupportsAndTrackableState<StateShape extends object, SupportsMethod extends string> extends WithSupportsAndStateUtils<StateShape, SupportsMethod> {
7
- /**
8
- * Adds a new event listener.
9
- */
10
- on: Emitter<StateShape>['on'];
11
- /**
12
- * Removes the event listener.
13
- */
14
- off: Emitter<StateShape>['off'];
15
- }
16
- export {};
@@ -1,16 +0,0 @@
1
- import { WithStateUtils } from './WithStateUtils.js';
2
- import { StateEvents } from './State/types.js';
3
- import { EventEmitter } from '../events/event-emitter/EventEmitter.js';
4
-
5
- type Emitter<StateShape extends object> = EventEmitter<StateEvents<StateShape>>;
6
- export declare class WithTrackableState<StateShape extends object> extends WithStateUtils<StateShape> {
7
- /**
8
- * Adds a new event listener.
9
- */
10
- on: Emitter<StateShape>['on'];
11
- /**
12
- * Removes the event listener.
13
- */
14
- off: Emitter<StateShape>['off'];
15
- }
16
- export {};
@@ -1,12 +0,0 @@
1
- /**
2
- * Function which joins passed values with space following these rules:
3
- * 1. If value is non-empty string, it will be added to output.
4
- * 2. If value is object, only those keys will be added, which values are truthy.
5
- * 3. If value is array, classNames will be called with this value spread.
6
- * 4. All other values are ignored.
7
- *
8
- * You can find this function to similar one from the package {@link https://www.npmjs.com/package/classnames|classnames}.
9
- * @param values - values array.
10
- * @returns Final class name.
11
- */
12
- export declare function classNames(...values: any[]): string;
@@ -1,14 +0,0 @@
1
- import { UnionOptionalKeys, UnionRequiredKeys } from '../types/unions.js';
2
-
3
- export type MergeClassNames<Tuple extends any[]> = Exclude<Tuple[number], number | string | null | undefined | any[] | boolean> extends infer Union ? {
4
- [K in UnionRequiredKeys<Union>]: string;
5
- } & {
6
- [K in UnionOptionalKeys<Union>]?: string;
7
- } : never;
8
- /**
9
- * Merges 2 sets of parameters. Function expects passing an array of objects with values, which
10
- * could be passed to `classNames` function. As the result, it returns an object with keys
11
- * from all objects with merged values.
12
- * @see classNames
13
- */
14
- export declare function mergeClassNames<T extends any[]>(...partials: T): MergeClassNames<T>;
@@ -1,6 +0,0 @@
1
- /**
2
- * Returns true in case, the color is recognized as dark.
3
- * @param color - color in any format acceptable by toRGB function.
4
- * @see toRGB
5
- */
6
- export declare function isColorDark(color: string): boolean;
@@ -1,7 +0,0 @@
1
- import { RGB } from './types.js';
2
-
3
- /**
4
- * Returns true in case, passed value has #RRGGBB format.
5
- * @param value - value to check.
6
- */
7
- export declare function isRGB(value: string): value is RGB;
@@ -1,7 +0,0 @@
1
- import { RGBShort } from './types.js';
2
-
3
- /**
4
- * Returns true in case, passed value has #RGB format.
5
- * @param value - value to check.
6
- */
7
- export declare function isRGBShort(value: string): value is RGBShort;
@@ -1,12 +0,0 @@
1
- import { RGB } from './types.js';
2
-
3
- /**
4
- * Converts passed value to #RRGGBB format. Accepts following color formats:
5
- * - `#RGB`
6
- * - `#RRGGBB`
7
- * - `rgb(1,2,3)`
8
- * - `rgba(1,2,3,4)`
9
- * @param value - value to convert.
10
- * @throws {Error} Passed value does not satisfy any of known RGB formats.
11
- */
12
- export declare function toRGB(value: string): RGB;
@@ -1,8 +0,0 @@
1
- /**
2
- * Color in format #RGB.
3
- */
4
- export type RGBShort = `#${string}`;
5
- /**
6
- * Color in format #RRGGBB.
7
- */
8
- export type RGB = `#${string}`;
@@ -1,41 +0,0 @@
1
- import { WithSupportsAndStateUtils } from '../../classes/WithSupportsAndStateUtils.js';
2
- import { PostEvent } from '../../bridge/methods/postEvent.js';
3
- import { BackButtonEvents, BackButtonState } from './types.js';
4
- import { EventEmitter } from '../../events/event-emitter/EventEmitter.js';
5
- import { Version } from '../../version/types.js';
6
-
7
- type Emitter = EventEmitter<BackButtonEvents>;
8
- /**
9
- * @see Usage: https://docs.telegram-mini-apps.com/platform/back-button
10
- * @see API: https://docs.telegram-mini-apps.com/packages/tma-js-sdk/components/back-button
11
- */
12
- export declare class BackButton extends WithSupportsAndStateUtils<BackButtonState, 'show' | 'hide'> {
13
- private readonly postEvent;
14
- constructor(isVisible: boolean, version: Version, postEvent: PostEvent);
15
- private set isVisible(value);
16
- /**
17
- * True if BackButton is currently visible.
18
- */
19
- get isVisible(): boolean;
20
- /**
21
- * Hides the BackButton.
22
- */
23
- hide(): void;
24
- /**
25
- * Adds a new event listener.
26
- * @param event - event to listen.
27
- * @param listener - listener to add.
28
- */
29
- on: Emitter['on'];
30
- /**
31
- * Removes the event listener.
32
- * @param event - event to listen.
33
- * @param listener - listener to remove.
34
- */
35
- off: Emitter['off'];
36
- /**
37
- * Shows the BackButton.
38
- */
39
- show(): void;
40
- }
41
- export {};
@@ -1,7 +0,0 @@
1
- import { BackButton } from './BackButton.js';
2
-
3
- /**
4
- * @returns A new initialized instance of the `BackButton` class.
5
- * @see BackButton
6
- */
7
- export declare const initBackButton: import('../../index.js').InitDynamicComponentFn<BackButton>;
@@ -1,25 +0,0 @@
1
- import { StateEvents } from '../../classes/State/types.js';
2
-
3
- /**
4
- * BackButton internal state.
5
- */
6
- export interface BackButtonState {
7
- isVisible: boolean;
8
- }
9
- /**
10
- * BackButton trackable events.
11
- */
12
- export interface BackButtonEvents extends StateEvents<BackButtonState> {
13
- /**
14
- * The BackButton was clicked.
15
- */
16
- click: () => void;
17
- }
18
- /**
19
- * BackButton event name.
20
- */
21
- export type BackButtonEventName = keyof BackButtonEvents;
22
- /**
23
- * BackButton event listener.
24
- */
25
- export type BackButtonEventListener<E extends BackButtonEventName> = BackButtonEvents[E];
@@ -1,61 +0,0 @@
1
- import { WithSupportsAndTrackableState } from '../../classes/WithSupportsAndTrackableState.js';
2
- import { BiometryType } from '../../bridge/events/types.js';
3
- import { BiometryManagerAuthenticateOptions, BiometryManagerProps, BiometryManagerRequestAccessOptions, BiometryManagerState, BiometryManagerUpdateTokenOptions } from './types.js';
4
-
5
- export declare class BiometryManager extends WithSupportsAndTrackableState<BiometryManagerState, 'auth' | 'openSettings' | 'requestAccess' | 'updateToken'> {
6
- private readonly postEvent;
7
- private authPromise?;
8
- private accessPromise?;
9
- constructor({ postEvent, version, ...rest }: BiometryManagerProps);
10
- /**
11
- * Shows whether biometry is available.
12
- */
13
- get available(): boolean;
14
- /**
15
- * Shows whether permission to use biometrics has been granted.
16
- */
17
- get accessGranted(): boolean;
18
- /**
19
- * Shows whether if permission to use biometrics has been requested.
20
- */
21
- get accessRequested(): boolean;
22
- /**
23
- * Authenticates the user using biometrics.
24
- * @param options - method options.
25
- * @since 7.2
26
- * @returns Token from the local secure storage, if authentication was successful.
27
- */
28
- authenticate({ reason, ...rest }: BiometryManagerAuthenticateOptions): Promise<string | undefined>;
29
- /**
30
- * A unique device identifier that can be used to match the token to the device.
31
- */
32
- get deviceId(): string;
33
- /**
34
- * Opens the biometric access settings for bots. Useful when you need to request biometrics
35
- * access to users who haven't granted it yet.
36
- *
37
- * _Note that this method can be called only in response to user interaction with the Mini App
38
- * interface (e.g. a click inside the Mini App or on the main button)_.
39
- * @since 7.2
40
- */
41
- openSettings(): void;
42
- /**
43
- * Requests permission to use biometrics.
44
- * @since 7.2
45
- * @returns Promise with true, if access was granted.
46
- */
47
- requestAccess({ reason, ...rest }?: BiometryManagerRequestAccessOptions): Promise<boolean>;
48
- /**
49
- * The type of biometrics currently available on the device.
50
- */
51
- get biometryType(): BiometryType | undefined;
52
- /**
53
- * Shows whether token was saved previously in the local secure storage.
54
- */
55
- get tokenSaved(): boolean;
56
- /**
57
- * Updates the biometric token in a secure storage on the device.
58
- * @returns Promise with `true`, if token was updated.
59
- */
60
- updateToken({ token, ...rest }?: BiometryManagerUpdateTokenOptions): Promise<boolean>;
61
- }
@@ -1,34 +0,0 @@
1
- import { BiometryType, MiniAppsEventPayload } from '../../bridge/events/types.js';
2
-
3
- export interface FormatBiometryInfoResult {
4
- /**
5
- * Shows whether biometry is available.
6
- */
7
- available: boolean;
8
- /**
9
- * Shows whether permission to use biometrics has been requested.
10
- */
11
- accessRequested: boolean;
12
- /**
13
- * Shows whether permission to use biometrics has been granted.
14
- */
15
- accessGranted: boolean;
16
- /**
17
- * A unique device identifier that can be used to match the token to the device.
18
- */
19
- deviceId: string;
20
- /**
21
- * Show whether local storage contains previously saved token.
22
- */
23
- tokenSaved: boolean;
24
- /**
25
- * The type of biometrics currently available on the device.
26
- */
27
- type: BiometryType;
28
- }
29
- /**
30
- * Converts `biometry_info_received` to some common shape.
31
- * @param event - event payload.
32
- * @see biometry_info_received
33
- */
34
- export declare function formatEvent(event: MiniAppsEventPayload<'biometry_info_received'>): FormatBiometryInfoResult;
@@ -1,7 +0,0 @@
1
- import { BiometryManager } from './BiometryManager.js';
2
-
3
- /**
4
- * @returns A promise with a new initialized instance of the `BiometryManager` class.
5
- * @see BiometryManager
6
- */
7
- export declare const initBiometryManager: import('../../index.js').InitDynamicComponentFn<Promise<BiometryManager>>;
@@ -1,8 +0,0 @@
1
- import { ExecuteWithOptions } from '../../types/index.js';
2
- import { FormatBiometryInfoResult } from './formatEvent.js';
3
-
4
- /**
5
- * Requests biometry information.
6
- * @param options - additional execution options.
7
- */
8
- export declare function requestBiometryInfo(options?: ExecuteWithOptions): Promise<FormatBiometryInfoResult>;
@@ -1,40 +0,0 @@
1
- import { BiometryType } from '../../bridge/events/types.js';
2
- import { PostEvent } from '../../bridge/methods/postEvent.js';
3
- import { ExecuteWithTimeout, Maybe } from '../../types/index.js';
4
- import { Version } from '../../version/types.js';
5
-
6
- export interface BiometryManagerState {
7
- accessGranted: boolean;
8
- accessRequested: boolean;
9
- available: boolean;
10
- deviceId: string;
11
- tokenSaved: boolean;
12
- token?: string;
13
- biometryType?: BiometryType;
14
- }
15
- export interface BiometryManagerProps extends BiometryManagerState {
16
- postEvent: PostEvent;
17
- version: Version;
18
- }
19
- export interface BiometryManagerAuthenticateOptions extends ExecuteWithTimeout {
20
- /**
21
- * The text to be displayed to a user in the popup describing why you are
22
- * asking them to authenticate and what action you will be taking based on that
23
- * authentication, 0-128 characters.
24
- */
25
- reason?: Maybe<string>;
26
- }
27
- export interface BiometryManagerUpdateTokenOptions extends ExecuteWithTimeout {
28
- /**
29
- * Token to save in the local device secure storage. Passing `null`, `undefined` or empty string
30
- * removes it from the storage.
31
- */
32
- token?: Maybe<string>;
33
- }
34
- export interface BiometryManagerRequestAccessOptions extends ExecuteWithTimeout {
35
- /**
36
- * The text to be displayed to a user in the popup describing why the bot needs access to
37
- * biometrics, 0-128 characters.
38
- */
39
- reason?: Maybe<string>;
40
- }
@@ -1,26 +0,0 @@
1
- import { WithTrackableState } from '../../classes/WithTrackableState.js';
2
- import { PostEvent } from '../../bridge/methods/postEvent.js';
3
- import { ClosingBehaviorState } from './types.js';
4
-
5
- /**
6
- * @see Usage: https://docs.telegram-mini-apps.com/platform/closing-behavior
7
- * @see API: https://docs.telegram-mini-apps.com/packages/tma-js-sdk/components/closing-behavior
8
- */
9
- export declare class ClosingBehavior extends WithTrackableState<ClosingBehaviorState> {
10
- private readonly postEvent;
11
- constructor(isConfirmationNeeded: boolean, postEvent: PostEvent);
12
- private set isConfirmationNeeded(value);
13
- /**
14
- * True, if the confirmation dialog should be shown while the user is trying to close
15
- * the Mini App.
16
- */
17
- get isConfirmationNeeded(): boolean;
18
- /**
19
- * Disables the confirmation dialog when closing the Mini App.
20
- */
21
- disableConfirmation(): void;
22
- /**
23
- * Enables the confirmation dialog when closing the Mini App.
24
- */
25
- enableConfirmation(): void;
26
- }
@@ -1,7 +0,0 @@
1
- import { ClosingBehavior } from './ClosingBehavior.js';
2
-
3
- /**
4
- * @returns A new initialized instance of the `ClosingBehavior` class.
5
- * @see ClosingBehavior
6
- */
7
- export declare const initClosingBehavior: import('../../index.js').InitDynamicComponentFn<ClosingBehavior>;
@@ -1,20 +0,0 @@
1
- import { StateEvents } from '../../classes/State/types.js';
2
-
3
- /**
4
- * ClosingBehavior internal state.
5
- */
6
- export interface ClosingBehaviorState {
7
- isConfirmationNeeded: boolean;
8
- }
9
- /**
10
- * ClosingBehavior trackable events.
11
- */
12
- export type ClosingBehaviorEvents = StateEvents<ClosingBehaviorState>;
13
- /**
14
- * ClosingBehavior event name.
15
- */
16
- export type ClosingBehaviorEventName = keyof ClosingBehaviorEvents;
17
- /**
18
- * ClosingBehavior event listener.
19
- */
20
- export type ClosingBehaviorEventListener<E extends ClosingBehaviorEventName> = ClosingBehaviorEvents[E];
@@ -1,47 +0,0 @@
1
- import { WithSupports } from '../../classes/WithSupports.js';
2
- import { PostEvent } from '../../bridge/methods/postEvent.js';
3
- import { CreateRequestIdFn } from '../../request-id/types.js';
4
- import { ExecuteWithTimeout } from '../../types/methods.js';
5
- import { Version } from '../../version/types.js';
6
-
7
- /**
8
- * @see API: https://docs.telegram-mini-apps.com/packages/tma-js-sdk/components/cloud-storage
9
- */
10
- export declare class CloudStorage extends WithSupports<'delete' | 'get' | 'getKeys' | 'set'> {
11
- private readonly createRequestId;
12
- private readonly postEvent;
13
- constructor(version: Version, createRequestId: CreateRequestIdFn, postEvent: PostEvent);
14
- /**
15
- * Deletes specified key or keys from the cloud storage.
16
- * @param keyOrKeys - key or keys to delete.
17
- * @param options - request execution options.
18
- */
19
- delete(keyOrKeys: string | string[], options?: ExecuteWithTimeout): Promise<void>;
20
- /**
21
- * Returns list of all keys presented in the cloud storage.
22
- * @param options - request execution options.
23
- */
24
- getKeys(options?: ExecuteWithTimeout): Promise<string[]>;
25
- /**
26
- * Returns map, where key is one of the specified in keys argument, and value is according
27
- * storage value.
28
- * @param keys - keys list.
29
- * @param options - request execution options.
30
- */
31
- get<K extends string>(keys: K[], options?: ExecuteWithTimeout): Promise<Record<K, string>>;
32
- /**
33
- * Returns value of the specified key.
34
- * @param key - cloud storage key.
35
- * @param options - request execution options.
36
- * @return Value of the specified key. In case, key was not created previously, function
37
- * will return empty string.
38
- */
39
- get(key: string, options?: ExecuteWithTimeout): Promise<string>;
40
- /**
41
- * Saves specified value by key.
42
- * @param key - storage key.
43
- * @param value - storage value.
44
- * @param options - request execution options.
45
- */
46
- set(key: string, value: string, options?: ExecuteWithTimeout): Promise<void>;
47
- }
@@ -1,7 +0,0 @@
1
- import { CloudStorage } from './CloudStorage.js';
2
-
3
- /**
4
- * @returns A new initialized instance of the `CloudStorage` class.
5
- * @see CloudStorage
6
- */
7
- export declare const initCloudStorage: import('../../index.js').InitStaticComponentFn<CloudStorage>;
@@ -1,34 +0,0 @@
1
- import { WithSupports } from '../../classes/WithSupports.js';
2
- import { PostEvent } from '../../bridge/methods/postEvent.js';
3
- import { ImpactHapticFeedbackStyle, NotificationHapticFeedbackType } from '../../bridge/methods/types/haptic.js';
4
- import { Version } from '../../version/types.js';
5
-
6
- /**
7
- * @see Usage: https://docs.telegram-mini-apps.com/platform/haptic-feedback
8
- * @see API: https://docs.telegram-mini-apps.com/packages/tma-js-sdk/components/haptic-feedback
9
- */
10
- export declare class HapticFeedback extends WithSupports<'impactOccurred' | 'notificationOccurred' | 'selectionChanged'> {
11
- private readonly postEvent;
12
- constructor(version: Version, postEvent: PostEvent);
13
- /**
14
- * A method tells that an impact occurred. The Telegram app may play the
15
- * appropriate haptics based on style value passed.
16
- * @param style - impact style.
17
- */
18
- impactOccurred(style: ImpactHapticFeedbackStyle): void;
19
- /**
20
- * A method tells that a task or action has succeeded, failed, or produced
21
- * a warning. The Telegram app may play the appropriate haptics based on
22
- * type value passed.
23
- * @param type - notification type.
24
- */
25
- notificationOccurred(type: NotificationHapticFeedbackType): void;
26
- /**
27
- * A method tells that the user has changed a selection. The Telegram app
28
- * may play the appropriate haptics.
29
- *
30
- * Do not use this feedback when the user makes or confirms a selection;
31
- * use it only when the selection changes.
32
- */
33
- selectionChanged(): void;
34
- }
@@ -1,7 +0,0 @@
1
- import { HapticFeedback } from './HapticFeedback.js';
2
-
3
- /**
4
- * @returns A new initialized instance of the `HapticFeedback` class.
5
- * @see HapticFeedback
6
- */
7
- export declare const initHapticFeedback: import('../../index.js').InitStaticComponentFn<HapticFeedback>;
@@ -1,55 +0,0 @@
1
- import { Chat, ChatType, InitDataParsed, User } from './types.js';
2
-
3
- /**
4
- * @see Usage: https://docs.telegram-mini-apps.com/platform/init-data
5
- * @see API: https://docs.telegram-mini-apps.com/packages/tma-js-sdk/init-data
6
- */
7
- export declare class InitData {
8
- private readonly initData;
9
- constructor(initData: InitDataParsed);
10
- /**
11
- * @see InitDataParsed.authDate
12
- */
13
- get authDate(): Date;
14
- /**
15
- * @see InitDataParsed.canSendAfter
16
- */
17
- get canSendAfter(): number | undefined;
18
- /**
19
- * Date after which it is allowed to call
20
- * the [answerWebAppQuery](https://core.telegram.org/bots/api#answerwebappquery) method.
21
- */
22
- get canSendAfterDate(): Date | undefined;
23
- /**
24
- * @see InitDataParsed.chat
25
- */
26
- get chat(): Chat | undefined;
27
- /**
28
- * @see InitDataParsed.chatType
29
- */
30
- get chatType(): ChatType | undefined;
31
- /**
32
- * @see InitDataParsed.chatInstance
33
- */
34
- get chatInstance(): string | undefined;
35
- /**
36
- * @see InitDataParsed.hash
37
- */
38
- get hash(): string;
39
- /**
40
- * @see InitDataParsed.queryId
41
- */
42
- get queryId(): string | undefined;
43
- /**
44
- * @see InitDataParsed.receiver
45
- */
46
- get receiver(): User | undefined;
47
- /**
48
- * @see InitDataParsed.startParam
49
- */
50
- get startParam(): string | undefined;
51
- /**
52
- * @see InitDataParsed.user
53
- */
54
- get user(): User | undefined;
55
- }
@@ -1,7 +0,0 @@
1
- import { InitData } from './InitData.js';
2
-
3
- /**
4
- * @returns A new initialized instance of the `InitData` class or undefined.
5
- * @see InitData
6
- */
7
- export declare const initInitData: import('../../index.js').InitStaticComponentFn<InitData | undefined>;
@@ -1,7 +0,0 @@
1
- import { InitDataParsed } from './types.js';
2
-
3
- /**
4
- * Parses incoming value as init data.
5
- * @param value - value to parse.
6
- */
7
- export declare function parseInitData(value: unknown): InitDataParsed;
@@ -1,3 +0,0 @@
1
- import { Chat } from '../types.js';
2
-
3
- export declare const chat: import('../../../parsing/ValueParser/types.js').ValueParserOptionalResult<import('../../../parsing/ValueParser/ValueParser.js').ValueParser<Chat, false>, Chat>;
@@ -1,7 +0,0 @@
1
- import { ValueParser } from '../../../parsing/ValueParser/ValueParser.js';
2
- import { InitDataParsed } from '../types.js';
3
-
4
- /**
5
- * Returns parser used to parse init data, presented as search params.
6
- */
7
- export declare function initData(): ValueParser<InitDataParsed, false>;
@@ -1,3 +0,0 @@
1
- import { User } from '../types.js';
2
-
3
- export declare const user: import('../../../parsing/ValueParser/types.js').ValueParserOptionalResult<import('../../../parsing/ValueParser/ValueParser.js').ValueParser<User, false>, User>;