@tma.js/sdk 2.7.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +9 -9
- package/dist/dts/composables/AsyncMountable.d.ts +44 -0
- package/dist/dts/composables/Button.d.ts +140 -0
- package/dist/dts/composables/Mountable.d.ts +43 -0
- package/dist/dts/composables/Stateful.d.ts +35 -0
- package/dist/dts/errors.d.ts +41 -0
- package/dist/dts/features/BackButton/BackButton.d.ts +96 -0
- package/dist/dts/features/BackButton/exports.d.ts +2 -0
- package/dist/dts/features/BackButton/instance.d.ts +2 -0
- package/dist/dts/features/Biometry/Biometry.d.ts +122 -0
- package/dist/dts/features/Biometry/exports.d.ts +3 -0
- package/dist/dts/features/Biometry/instance.d.ts +2 -0
- package/dist/dts/features/Biometry/types.d.ts +84 -0
- package/dist/dts/features/ClosingBehavior/ClosingBehavior.d.ts +51 -0
- package/dist/dts/features/ClosingBehavior/exports.d.ts +2 -0
- package/dist/dts/features/ClosingBehavior/instance.d.ts +2 -0
- package/dist/dts/features/CloudStorage/CloudStorage.d.ts +90 -0
- package/dist/dts/features/CloudStorage/exports.d.ts +2 -0
- package/dist/dts/features/CloudStorage/instance.d.ts +2 -0
- package/dist/dts/features/HapticFeedback/HapticFeedback.d.ts +57 -0
- package/dist/dts/features/HapticFeedback/exports.d.ts +2 -0
- package/dist/dts/features/HapticFeedback/instance.d.ts +2 -0
- package/dist/dts/features/InitData/InitData.d.ts +84 -0
- package/dist/dts/features/InitData/exports.d.ts +2 -0
- package/dist/dts/features/InitData/instance.d.ts +2 -0
- package/dist/dts/features/Invoice/Invoice.d.ts +54 -0
- package/dist/dts/features/Invoice/exports.d.ts +2 -0
- package/dist/dts/features/Invoice/instance.d.ts +2 -0
- package/dist/dts/features/LocationManager/LocationManager.d.ts +74 -0
- package/dist/dts/features/LocationManager/exports.d.ts +3 -0
- package/dist/dts/features/LocationManager/instance.d.ts +2 -0
- package/dist/dts/features/LocationManager/types.d.ts +65 -0
- package/dist/dts/features/MainButton/MainButton.d.ts +214 -0
- package/dist/dts/features/MainButton/exports.d.ts +2 -0
- package/dist/dts/features/MainButton/instance.d.ts +2 -0
- package/dist/dts/features/MiniApp/MiniApp.d.ts +192 -0
- package/dist/dts/features/MiniApp/exports.d.ts +2 -0
- package/dist/dts/features/MiniApp/instance.d.ts +2 -0
- package/dist/dts/features/Popup/Popup.d.ts +56 -0
- package/dist/dts/features/Popup/exports.d.ts +3 -0
- package/dist/dts/features/Popup/instance.d.ts +2 -0
- package/dist/dts/features/Popup/prepareParams.d.ts +9 -0
- package/dist/dts/{components → features}/Popup/types.d.ts +5 -12
- package/dist/dts/features/QrScanner/QrScanner.d.ts +132 -0
- package/dist/dts/features/QrScanner/exports.d.ts +2 -0
- package/dist/dts/features/QrScanner/instance.d.ts +2 -0
- package/dist/dts/features/SecondaryButton/SecondaryButton.d.ts +253 -0
- package/dist/dts/features/SecondaryButton/exports.d.ts +2 -0
- package/dist/dts/features/SecondaryButton/instance.d.ts +2 -0
- package/dist/dts/features/SettingsButton/SettingsButton.d.ts +96 -0
- package/dist/dts/features/SettingsButton/exports.d.ts +2 -0
- package/dist/dts/features/SettingsButton/instance.d.ts +2 -0
- package/dist/dts/features/SwipeBehavior/SwipeBehavior.d.ts +62 -0
- package/dist/dts/features/SwipeBehavior/exports.d.ts +2 -0
- package/dist/dts/features/SwipeBehavior/instance.d.ts +2 -0
- package/dist/dts/features/ThemeParams/ThemeParams.d.ts +127 -0
- package/dist/dts/features/ThemeParams/exports.d.ts +2 -0
- package/dist/dts/features/ThemeParams/instance.d.ts +2 -0
- package/dist/dts/features/Viewport/Viewport.d.ts +220 -0
- package/dist/dts/features/Viewport/exports.d.ts +2 -0
- package/dist/dts/features/Viewport/instance.d.ts +2 -0
- package/dist/dts/features/emoji-status/exports.d.ts +2 -0
- package/dist/dts/features/emoji-status/requestEmojiStatusAccess.d.ts +16 -0
- package/dist/dts/features/emoji-status/setEmojiStatus.d.ts +28 -0
- package/dist/dts/features/home-screen/addToHomeScreen.d.ts +11 -0
- package/dist/dts/features/home-screen/checkHomeScreenStatus.d.ts +14 -0
- package/dist/dts/features/home-screen/exports.d.ts +2 -0
- package/dist/dts/features/links/exports.d.ts +3 -0
- package/dist/dts/features/links/openLink.d.ts +31 -0
- package/dist/dts/features/links/openTelegramLink.d.ts +18 -0
- package/dist/dts/features/links/shareURL.d.ts +18 -0
- package/dist/dts/features/privacy/exports.d.ts +3 -0
- package/dist/dts/features/privacy/requestContact.d.ts +59 -0
- package/dist/dts/features/privacy/requestPhoneAccess.d.ts +19 -0
- package/dist/dts/features/privacy/requestWriteAccess.d.ts +14 -0
- package/dist/dts/features/uncategorized/copyTextToClipboard.d.ts +5 -0
- package/dist/dts/features/uncategorized/downloadFile.d.ts +21 -0
- package/dist/dts/features/uncategorized/exports.d.ts +11 -0
- package/dist/dts/features/uncategorized/getCurrentTime.d.ts +15 -0
- package/dist/dts/features/uncategorized/hideKeyboard.d.ts +13 -0
- package/dist/dts/features/uncategorized/readTextFromClipboard.d.ts +13 -0
- package/dist/dts/features/uncategorized/retrieveAndroidDeviceData.d.ts +6 -0
- package/dist/dts/features/uncategorized/retrieveAndroidDeviceDataFrom.d.ts +14 -0
- package/dist/dts/features/uncategorized/sendData.d.ts +20 -0
- package/dist/dts/features/uncategorized/shareMessage.d.ts +14 -0
- package/dist/dts/features/uncategorized/shareStory.d.ts +50 -0
- package/dist/dts/features/uncategorized/switchInlineQuery.d.ts +28 -0
- package/dist/dts/fn-options/bottomButtonOptions.d.ts +11 -0
- package/dist/dts/fn-options/buttonOptions.d.ts +10 -0
- package/dist/dts/fn-options/createFnOption.d.ts +2 -0
- package/dist/dts/fn-options/sharedFeatureOptions.d.ts +8 -0
- package/dist/dts/fn-options/withInvokeCustomMethod.d.ts +11 -0
- package/dist/dts/fn-options/withPostEvent.d.ts +8 -0
- package/dist/dts/fn-options/withRequest.d.ts +8 -0
- package/dist/dts/fn-options/withStateRestore.d.ts +13 -0
- package/dist/dts/fn-options/withVersion.d.ts +9 -0
- package/dist/dts/globals/createRequestId.d.ts +4 -0
- package/dist/dts/globals/inline-mode.d.ts +4 -0
- package/dist/dts/globals/invokeCustomMethod.d.ts +16 -0
- package/dist/dts/globals/post-event.d.ts +4 -0
- package/dist/dts/globals/request.d.ts +3 -0
- package/dist/dts/globals/resetGlobals.d.ts +4 -0
- package/dist/dts/globals/signals-registry.d.ts +39 -0
- package/dist/dts/globals/themeParams.d.ts +4 -0
- package/dist/dts/globals/version.d.ts +4 -0
- package/dist/dts/helpers/access.d.ts +2 -0
- package/dist/dts/helpers/component-storage.d.ts +9 -0
- package/dist/dts/helpers/createIsSupportedSignal.d.ts +5 -0
- package/dist/dts/helpers/css-vars.d.ts +11 -0
- package/dist/dts/helpers/isColorDark.d.ts +11 -0
- package/dist/dts/{navigation/isPageReload.d.ts → helpers/navigation.d.ts} +1 -1
- package/dist/dts/helpers/removeUndefined.d.ts +10 -0
- package/dist/dts/helpers/shallowEqual.d.ts +1 -0
- package/dist/dts/index.d.ts +33 -168
- package/dist/dts/init.d.ts +42 -0
- package/dist/dts/types.d.ts +6 -0
- package/dist/dts/with-checks/throwifyWithChecksFp.d.ts +3 -0
- package/dist/dts/with-checks/withChecksFp.d.ts +172 -0
- package/dist/index.cjs +1 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +3 -3
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +3811 -2897
- package/dist/index.js.map +1 -1
- package/package.json +19 -9
- package/dist/dts/bridge/captureSameReq.d.ts +0 -10
- package/dist/dts/bridge/events/event-emitter/createMiniAppsEventEmitter.d.ts +0 -15
- package/dist/dts/bridge/events/event-emitter/singleton.d.ts +0 -8
- package/dist/dts/bridge/events/event-handlers/cleanupEventHandlers.d.ts +0 -4
- package/dist/dts/bridge/events/event-handlers/defineEventHandlers.d.ts +0 -6
- package/dist/dts/bridge/events/event-handlers/emitMiniAppsEvent.d.ts +0 -9
- package/dist/dts/bridge/events/listening/off.d.ts +0 -8
- package/dist/dts/bridge/events/listening/on.d.ts +0 -12
- package/dist/dts/bridge/events/listening/subscribe.d.ts +0 -9
- package/dist/dts/bridge/events/listening/unsubscribe.d.ts +0 -7
- package/dist/dts/bridge/events/types.d.ts +0 -302
- package/dist/dts/bridge/invokeCustomMethod.d.ts +0 -23
- package/dist/dts/bridge/methods/createPostEvent.d.ts +0 -14
- package/dist/dts/bridge/methods/postEvent.d.ts +0 -40
- package/dist/dts/bridge/methods/types/custom-methods.d.ts +0 -57
- package/dist/dts/bridge/methods/types/haptic.d.ts +0 -40
- package/dist/dts/bridge/methods/types/index.d.ts +0 -4
- package/dist/dts/bridge/methods/types/methods.d.ts +0 -392
- package/dist/dts/bridge/methods/types/popup.d.ts +0 -49
- package/dist/dts/bridge/parseMessage.d.ts +0 -18
- package/dist/dts/bridge/request.d.ts +0 -53
- package/dist/dts/bridge/target-origin.d.ts +0 -18
- package/dist/dts/classes/State/State.d.ts +0 -46
- package/dist/dts/classes/State/types.d.ts +0 -29
- package/dist/dts/classes/WithStateUtils.d.ts +0 -18
- package/dist/dts/classes/WithSupports.d.ts +0 -19
- package/dist/dts/classes/WithSupportsAndStateUtils.d.ts +0 -24
- package/dist/dts/classes/WithSupportsAndTrackableState.d.ts +0 -16
- package/dist/dts/classes/WithTrackableState.d.ts +0 -16
- package/dist/dts/classnames/classNames.d.ts +0 -12
- package/dist/dts/classnames/mergeClassNames.d.ts +0 -14
- package/dist/dts/colors/isColorDark.d.ts +0 -6
- package/dist/dts/colors/isRGB.d.ts +0 -7
- package/dist/dts/colors/isRGBShort.d.ts +0 -7
- package/dist/dts/colors/toRGB.d.ts +0 -12
- package/dist/dts/colors/types.d.ts +0 -8
- package/dist/dts/components/BackButton/BackButton.d.ts +0 -41
- package/dist/dts/components/BackButton/initBackButton.d.ts +0 -7
- package/dist/dts/components/BackButton/types.d.ts +0 -25
- package/dist/dts/components/BiometryManager/BiometryManager.d.ts +0 -61
- package/dist/dts/components/BiometryManager/formatEvent.d.ts +0 -34
- package/dist/dts/components/BiometryManager/initBiometryManager.d.ts +0 -7
- package/dist/dts/components/BiometryManager/requestBiometryInfo.d.ts +0 -8
- package/dist/dts/components/BiometryManager/types.d.ts +0 -40
- package/dist/dts/components/ClosingBehavior/ClosingBehavior.d.ts +0 -26
- package/dist/dts/components/ClosingBehavior/initClosingBehavior.d.ts +0 -7
- package/dist/dts/components/ClosingBehavior/types.d.ts +0 -20
- package/dist/dts/components/CloudStorage/CloudStorage.d.ts +0 -47
- package/dist/dts/components/CloudStorage/initCloudStorage.d.ts +0 -7
- package/dist/dts/components/HapticFeedback/HapticFeedback.d.ts +0 -34
- package/dist/dts/components/HapticFeedback/initHapticFeedback.d.ts +0 -7
- package/dist/dts/components/InitData/InitData.d.ts +0 -55
- package/dist/dts/components/InitData/initInitData.d.ts +0 -7
- package/dist/dts/components/InitData/parseInitData.d.ts +0 -7
- package/dist/dts/components/InitData/parsers/chat.d.ts +0 -3
- package/dist/dts/components/InitData/parsers/initData.d.ts +0 -7
- package/dist/dts/components/InitData/parsers/user.d.ts +0 -3
- package/dist/dts/components/InitData/types.d.ts +0 -132
- package/dist/dts/components/Invoice/Invoice.d.ts +0 -31
- package/dist/dts/components/Invoice/initInvoice.d.ts +0 -7
- package/dist/dts/components/Invoice/types.d.ts +0 -20
- package/dist/dts/components/MainButton/MainButton.d.ts +0 -106
- package/dist/dts/components/MainButton/initMainButton.d.ts +0 -7
- package/dist/dts/components/MainButton/types.d.ts +0 -40
- package/dist/dts/components/MiniApp/MiniApp.d.ts +0 -121
- package/dist/dts/components/MiniApp/initMiniApp.d.ts +0 -7
- package/dist/dts/components/MiniApp/parsing/contact.d.ts +0 -7
- package/dist/dts/components/MiniApp/types.d.ts +0 -53
- package/dist/dts/components/Popup/Popup.d.ts +0 -30
- package/dist/dts/components/Popup/initPopup.d.ts +0 -7
- package/dist/dts/components/Popup/preparePopupParams.d.ts +0 -8
- package/dist/dts/components/QRScanner/QRScanner.d.ts +0 -33
- package/dist/dts/components/QRScanner/initQRScanner.d.ts +0 -7
- package/dist/dts/components/QRScanner/types.d.ts +0 -31
- package/dist/dts/components/SettingsButton/SettingsButton.d.ts +0 -37
- package/dist/dts/components/SettingsButton/initSettingsButton.d.ts +0 -7
- package/dist/dts/components/SettingsButton/types.d.ts +0 -25
- package/dist/dts/components/ThemeParams/ThemeParams.d.ts +0 -57
- package/dist/dts/components/ThemeParams/initThemeParams.d.ts +0 -7
- package/dist/dts/components/ThemeParams/keys.d.ts +0 -11
- package/dist/dts/components/ThemeParams/parsing/parseThemeParams.d.ts +0 -7
- package/dist/dts/components/ThemeParams/parsing/serializeThemeParams.d.ts +0 -6
- package/dist/dts/components/ThemeParams/parsing/themeParams.d.ts +0 -4
- package/dist/dts/components/ThemeParams/requestThemeParams.d.ts +0 -8
- package/dist/dts/components/ThemeParams/types.d.ts +0 -29
- package/dist/dts/components/Utils/Utils.d.ts +0 -77
- package/dist/dts/components/Utils/initUtils.d.ts +0 -7
- package/dist/dts/components/Viewport/Viewport.d.ts +0 -77
- package/dist/dts/components/Viewport/initViewport.d.ts +0 -7
- package/dist/dts/components/Viewport/requestViewport.d.ts +0 -13
- package/dist/dts/components/Viewport/types.d.ts +0 -35
- package/dist/dts/css-vars/bindMiniAppCSSVars.d.ts +0 -29
- package/dist/dts/css-vars/bindThemeParamsCSSVars.d.ts +0 -29
- package/dist/dts/css-vars/bindViewportCSSVars.d.ts +0 -32
- package/dist/dts/css-vars/setCSSVar.d.ts +0 -6
- package/dist/dts/debug/debug.d.ts +0 -14
- package/dist/dts/env/hasExternalNotify.d.ts +0 -10
- package/dist/dts/env/hasWebviewProxy.d.ts +0 -10
- package/dist/dts/env/initWeb.d.ts +0 -11
- package/dist/dts/env/isIframe.d.ts +0 -5
- package/dist/dts/env/isSSR.d.ts +0 -4
- package/dist/dts/env/isTMA.d.ts +0 -4
- package/dist/dts/env/mockTelegramEnv.d.ts +0 -7
- package/dist/dts/errors/SDKError.d.ts +0 -9
- package/dist/dts/errors/createError.d.ts +0 -10
- package/dist/dts/errors/errors.d.ts +0 -49
- package/dist/dts/errors/isSDKError.d.ts +0 -7
- package/dist/dts/errors/isSDKErrorOfType.d.ts +0 -8
- package/dist/dts/events/event-emitter/EventEmitter.d.ts +0 -54
- package/dist/dts/events/event-emitter/types.d.ts +0 -45
- package/dist/dts/events/onWindow.d.ts +0 -10
- package/dist/dts/events/types.d.ts +0 -6
- package/dist/dts/index.low-level.d.ts +0 -41
- package/dist/dts/launch-params/parseLaunchParams.d.ts +0 -7
- package/dist/dts/launch-params/retrieveFromLocation.d.ts +0 -7
- package/dist/dts/launch-params/retrieveFromPerformance.d.ts +0 -7
- package/dist/dts/launch-params/retrieveFromStorage.d.ts +0 -7
- package/dist/dts/launch-params/retrieveFromUrl.d.ts +0 -8
- package/dist/dts/launch-params/retrieveLaunchParams.d.ts +0 -7
- package/dist/dts/launch-params/saveToStorage.d.ts +0 -7
- package/dist/dts/launch-params/serializeLaunchParams.d.ts +0 -7
- package/dist/dts/launch-params/types.d.ts +0 -51
- package/dist/dts/logger/Logger.d.ts +0 -29
- package/dist/dts/misc/createCleanup.d.ts +0 -11
- package/dist/dts/misc/createComponentInitFn/createComponentInitFn.d.ts +0 -16
- package/dist/dts/misc/createComponentInitFn/types.d.ts +0 -54
- package/dist/dts/misc/createSingleton.d.ts +0 -15
- package/dist/dts/misc/isRecord.d.ts +0 -5
- package/dist/dts/misc/objectFromKeys.d.ts +0 -6
- package/dist/dts/navigation/BasicNavigator/BasicNavigator.d.ts +0 -118
- package/dist/dts/navigation/BasicNavigator/prepareItem.d.ts +0 -8
- package/dist/dts/navigation/BasicNavigator/types.d.ts +0 -37
- package/dist/dts/navigation/BrowserNavigator/BrowserNavigator.d.ts +0 -198
- package/dist/dts/navigation/BrowserNavigator/basicItemToBrowser.d.ts +0 -7
- package/dist/dts/navigation/BrowserNavigator/createBrowserNavigatorFromLocation.d.ts +0 -4
- package/dist/dts/navigation/BrowserNavigator/prepareItem.d.ts +0 -25
- package/dist/dts/navigation/BrowserNavigator/types.d.ts +0 -64
- package/dist/dts/navigation/createSafeURL.d.ts +0 -7
- package/dist/dts/navigation/drop.d.ts +0 -4
- package/dist/dts/navigation/ensurePrefix.d.ts +0 -7
- package/dist/dts/navigation/getFirstNavigationEntry.d.ts +0 -6
- package/dist/dts/navigation/getHash.d.ts +0 -15
- package/dist/dts/navigation/getPathname.d.ts +0 -7
- package/dist/dts/navigation/go.d.ts +0 -5
- package/dist/dts/navigation/initNavigator.d.ts +0 -9
- package/dist/dts/navigation/urlToPath.d.ts +0 -7
- package/dist/dts/parsing/ArrayParser/ArrayParser.d.ts +0 -17
- package/dist/dts/parsing/ArrayParser/types.d.ts +0 -12
- package/dist/dts/parsing/ValueParser/ValueParser.d.ts +0 -17
- package/dist/dts/parsing/ValueParser/types.d.ts +0 -28
- package/dist/dts/parsing/createTypeError.d.ts +0 -6
- package/dist/dts/parsing/createValueParserGenerator.d.ts +0 -10
- package/dist/dts/parsing/parseBySchema.d.ts +0 -9
- package/dist/dts/parsing/parsers/array.d.ts +0 -7
- package/dist/dts/parsing/parsers/boolean.d.ts +0 -6
- package/dist/dts/parsing/parsers/date.d.ts +0 -6
- package/dist/dts/parsing/parsers/json.d.ts +0 -9
- package/dist/dts/parsing/parsers/number.d.ts +0 -6
- package/dist/dts/parsing/parsers/rgb.d.ts +0 -7
- package/dist/dts/parsing/parsers/searchParams.d.ts +0 -9
- package/dist/dts/parsing/parsers/string.d.ts +0 -6
- package/dist/dts/parsing/toRecord.d.ts +0 -7
- package/dist/dts/parsing/types.d.ts +0 -30
- package/dist/dts/request-id/createRequestIdGenerator.d.ts +0 -6
- package/dist/dts/request-id/types.d.ts +0 -9
- package/dist/dts/storage/storage.d.ts +0 -42
- package/dist/dts/supports/createSupportsFn.d.ts +0 -12
- package/dist/dts/supports/createSupportsParamFn.d.ts +0 -16
- package/dist/dts/supports/supports.d.ts +0 -16
- package/dist/dts/supports/types.d.ts +0 -4
- package/dist/dts/timeout/createTimeoutError.d.ts +0 -7
- package/dist/dts/timeout/sleep.d.ts +0 -5
- package/dist/dts/timeout/withTimeout.d.ts +0 -6
- package/dist/dts/types/index.d.ts +0 -6
- package/dist/dts/types/logical.d.ts +0 -16
- package/dist/dts/types/methods.d.ts +0 -16
- package/dist/dts/types/misc.d.ts +0 -12
- package/dist/dts/types/platform.d.ts +0 -4
- package/dist/dts/types/unions.d.ts +0 -20
- package/dist/dts/types/utils.d.ts +0 -24
- package/dist/dts/version/compareVersions.d.ts +0 -10
- package/dist/dts/version/types.d.ts +0 -5
- package/dist/index.low-level.iife.js +0 -4
- package/dist/index.low-level.iife.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tma.js/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "TypeScript Source Development Kit for Telegram Mini Apps client application.",
|
|
5
5
|
"author": "Vladislav Kibenko <wolfram.deus@gmail.com>",
|
|
6
|
-
"homepage": "https://github.com/Telegram-Mini-Apps/
|
|
6
|
+
"homepage": "https://github.com/Telegram-Mini-Apps/telegram-apps#readme",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git@github.com:Telegram-Mini-Apps/
|
|
10
|
-
"directory": "
|
|
9
|
+
"url": "git@github.com:Telegram-Mini-Apps/telegram-apps.git",
|
|
10
|
+
"directory": "tma.js/sdk"
|
|
11
11
|
},
|
|
12
12
|
"bugs": {
|
|
13
|
-
"url": "https://github.com/Telegram-Mini-Apps/
|
|
13
|
+
"url": "https://github.com/Telegram-Mini-Apps/telegram-apps/issues"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
16
|
"telegram-mini-apps",
|
|
@@ -34,6 +34,17 @@
|
|
|
34
34
|
"default": "./dist/index.cjs"
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"better-promises": "^1.0.0",
|
|
39
|
+
"error-kid": "^1.0.2",
|
|
40
|
+
"fp-ts": "^2.16.11",
|
|
41
|
+
"valibot": "^1.1.0",
|
|
42
|
+
"@tma.js/bridge": "^2.1.0",
|
|
43
|
+
"@tma.js/signals": "^1.0.0",
|
|
44
|
+
"@tma.js/toolkit": "^1.0.1",
|
|
45
|
+
"@tma.js/transformers": "^1.1.0",
|
|
46
|
+
"@tma.js/types": "^1.0.1"
|
|
47
|
+
},
|
|
37
48
|
"devDependencies": {
|
|
38
49
|
"test-utils": "0.0.1",
|
|
39
50
|
"tsconfig": "0.0.2"
|
|
@@ -43,12 +54,11 @@
|
|
|
43
54
|
},
|
|
44
55
|
"scripts": {
|
|
45
56
|
"test": "vitest --run",
|
|
46
|
-
"lint": "cd ../.. && eslint
|
|
57
|
+
"lint": "cd ../.. && eslint tma.js/sdk/src --ignore-pattern **/*.test.ts",
|
|
47
58
|
"lint:fix": "pnpm run lint --fix",
|
|
48
59
|
"typecheck": "tsc --noEmit -p tsconfig.build.json",
|
|
49
|
-
"build": "rimraf dist && pnpm run build:default && pnpm run build:iife
|
|
60
|
+
"build": "rimraf dist && pnpm run build:default && pnpm run build:iife",
|
|
50
61
|
"build:default": "vite build -c vite.config.ts",
|
|
51
|
-
"build:iife": "vite build -c vite.iife.config.ts"
|
|
52
|
-
"build:iife:low-level": "vite build -c vite.iife.low-level.config.ts"
|
|
62
|
+
"build:iife": "vite build -c vite.iife.config.ts"
|
|
53
63
|
}
|
|
54
64
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
type CaptureSameReqFn = (payload: {
|
|
2
|
-
req_id: string;
|
|
3
|
-
}) => boolean;
|
|
4
|
-
/**
|
|
5
|
-
* Returns a function which can be used in `request` function `capture` property to capture
|
|
6
|
-
* the event with the same request identifier.
|
|
7
|
-
* @param reqId - request identifier.
|
|
8
|
-
*/
|
|
9
|
-
export declare function captureSameReq(reqId: string): CaptureSameReqFn;
|
|
10
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { MiniAppsEventEmitter } from '../types.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Creates new event emitter, which handles events from the Telegram application.
|
|
5
|
-
*/
|
|
6
|
-
export declare function createMiniAppsEventEmitter(): [
|
|
7
|
-
/**
|
|
8
|
-
* Created event emitter.
|
|
9
|
-
*/
|
|
10
|
-
emitter: MiniAppsEventEmitter,
|
|
11
|
-
/**
|
|
12
|
-
* Function to dispose created emitter.
|
|
13
|
-
*/
|
|
14
|
-
dispose: () => void
|
|
15
|
-
];
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { MiniAppsEventEmitter } from '../types.js';
|
|
2
|
-
|
|
3
|
-
declare const resetMiniAppsEventEmitter: () => void;
|
|
4
|
-
/**
|
|
5
|
-
* Returns Mini Apps event emitter singleton.
|
|
6
|
-
*/
|
|
7
|
-
export declare function miniAppsEventEmitter(): MiniAppsEventEmitter;
|
|
8
|
-
export { resetMiniAppsEventEmitter };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines special handlers by known paths, which are recognized by
|
|
3
|
-
* Telegram as ports to receive events. This function also sets special
|
|
4
|
-
* function in global window object to prevent duplicate declaration.
|
|
5
|
-
*/
|
|
6
|
-
export declare function defineEventHandlers(): void;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Emits event sent from Telegram native application like it was sent in
|
|
3
|
-
* default web environment between 2 iframes. It dispatches new MessageEvent
|
|
4
|
-
* and expects it to be handled via `window.addEventListener('message', ...)`
|
|
5
|
-
* as developer would do it to handle messages sent from the parent iframe.
|
|
6
|
-
* @param eventType - event name.
|
|
7
|
-
* @param eventData - event payload.
|
|
8
|
-
*/
|
|
9
|
-
export declare function emitMiniAppsEvent(eventType: string, eventData: unknown): void;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { MiniAppsEventListener, MiniAppsEventName } from '../types.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Removes listener from specified event.
|
|
5
|
-
* @param event - event to listen.
|
|
6
|
-
* @param listener - event listener to remove.
|
|
7
|
-
*/
|
|
8
|
-
export declare function off<E extends MiniAppsEventName>(event: E, listener: MiniAppsEventListener<E>): void;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { RemoveEventListenerFn } from '../../../events/types.js';
|
|
2
|
-
import { MiniAppsEventListener, MiniAppsEventName } from '../types.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Adds new listener to the specified event. Returns handler
|
|
6
|
-
* which allows to stop listening to event.
|
|
7
|
-
* @param event - event name.
|
|
8
|
-
* @param listener - event listener.
|
|
9
|
-
* @param once - should listener be called only once.
|
|
10
|
-
* @returns Function to remove bound event listener.
|
|
11
|
-
*/
|
|
12
|
-
export declare function on<E extends MiniAppsEventName>(event: E, listener: MiniAppsEventListener<E>, once?: boolean): RemoveEventListenerFn;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { RemoveEventListenerFn } from '../../../events/types.js';
|
|
2
|
-
import { MiniAppsSubscribeListener } from '../types.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Subscribes to all events sent from the native Telegram application.
|
|
6
|
-
* @param listener - event listener to bind.
|
|
7
|
-
* @returns Function to remove bound event listener.
|
|
8
|
-
*/
|
|
9
|
-
export declare function subscribe(listener: MiniAppsSubscribeListener): RemoveEventListenerFn;
|
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
import { RGB } from '../../colors/types.js';
|
|
2
|
-
import { EventListener } from '../../events/event-emitter/types.js';
|
|
3
|
-
import { RemoveEventListenerFn } from '../../events/types.js';
|
|
4
|
-
import { EventEmitter } from '../../events/event-emitter/EventEmitter.js';
|
|
5
|
-
import { RequestId } from '../../request-id/types.js';
|
|
6
|
-
|
|
7
|
-
export type InvoiceStatus = 'paid' | 'failed' | 'pending' | 'cancelled' | string;
|
|
8
|
-
export type PhoneRequestedStatus = 'sent' | 'cancelled' | string;
|
|
9
|
-
export type WriteAccessRequestedStatus = 'allowed' | string;
|
|
10
|
-
export type BiometryType = 'finger' | 'face' | string;
|
|
11
|
-
export type BiometryTokenUpdateStatus = 'updated' | 'removed' | string;
|
|
12
|
-
export type BiometryAuthRequestStatus = 'failed' | 'authorized' | string;
|
|
13
|
-
/**
|
|
14
|
-
* Map where key is known event name, and value is its listener.
|
|
15
|
-
* @see https://docs.telegram-mini-apps.com/platform/events
|
|
16
|
-
*/
|
|
17
|
-
export interface MiniAppsEvents {
|
|
18
|
-
/**
|
|
19
|
-
* User clicked the BackButton.
|
|
20
|
-
* @since v6.1
|
|
21
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#back-button-pressed
|
|
22
|
-
*/
|
|
23
|
-
back_button_pressed: never;
|
|
24
|
-
/**
|
|
25
|
-
* Biometry authentication request completed.
|
|
26
|
-
* @since 7.2
|
|
27
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#biometry-auth-requested
|
|
28
|
-
*/
|
|
29
|
-
biometry_auth_requested: {
|
|
30
|
-
/**
|
|
31
|
-
* Authentication status.
|
|
32
|
-
*/
|
|
33
|
-
status: BiometryAuthRequestStatus;
|
|
34
|
-
/**
|
|
35
|
-
* Token from the local secure storage saved previously.
|
|
36
|
-
*/
|
|
37
|
-
token?: string;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Biometry settings were received.
|
|
41
|
-
* @since 7.2
|
|
42
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#biometry-info-received
|
|
43
|
-
*/
|
|
44
|
-
biometry_info_received: {
|
|
45
|
-
/**
|
|
46
|
-
* Shows whether biometry is available.
|
|
47
|
-
*/
|
|
48
|
-
available: false;
|
|
49
|
-
} | {
|
|
50
|
-
/**
|
|
51
|
-
* Shows whether biometry is available.
|
|
52
|
-
*/
|
|
53
|
-
available: true;
|
|
54
|
-
/**
|
|
55
|
-
* Shows whether permission to use biometrics has been requested.
|
|
56
|
-
*/
|
|
57
|
-
access_requested: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Shows whether permission to use biometrics has been granted.
|
|
60
|
-
*/
|
|
61
|
-
access_granted: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* A unique device identifier that can be used to match the token to the device.
|
|
64
|
-
*/
|
|
65
|
-
device_id: string;
|
|
66
|
-
/**
|
|
67
|
-
* Show whether local storage contains previously saved token.
|
|
68
|
-
*/
|
|
69
|
-
token_saved: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* The type of biometrics currently available on the device.
|
|
72
|
-
*/
|
|
73
|
-
type: BiometryType;
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Biometry token was updated.
|
|
77
|
-
* @since 7.2
|
|
78
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#biometry-token-updated
|
|
79
|
-
*/
|
|
80
|
-
biometry_token_updated: {
|
|
81
|
-
/**
|
|
82
|
-
* Update status.
|
|
83
|
-
*/
|
|
84
|
-
status: BiometryTokenUpdateStatus;
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Telegram application attempted to extract text from clipboard.
|
|
88
|
-
* @since v6.4
|
|
89
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#clipboard-text-received
|
|
90
|
-
*/
|
|
91
|
-
clipboard_text_received: {
|
|
92
|
-
/**
|
|
93
|
-
* Passed during the `web_app_read_text_from_clipboard` method invocation `req_id` value.
|
|
94
|
-
*/
|
|
95
|
-
req_id: RequestId;
|
|
96
|
-
/**
|
|
97
|
-
* Data extracted from the clipboard. The returned value will have the type `string` only in
|
|
98
|
-
* the case, application has access to the clipboard.
|
|
99
|
-
*/
|
|
100
|
-
data?: string | null;
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* Custom method invocation completed.
|
|
104
|
-
* @since v6.9
|
|
105
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#custom-method-invoked
|
|
106
|
-
*/
|
|
107
|
-
custom_method_invoked: {
|
|
108
|
-
/**
|
|
109
|
-
* Unique identifier of this invocation.
|
|
110
|
-
*/
|
|
111
|
-
req_id: RequestId;
|
|
112
|
-
/**
|
|
113
|
-
* Method invocation successful result.
|
|
114
|
-
*/
|
|
115
|
-
result?: unknown;
|
|
116
|
-
/**
|
|
117
|
-
* Method invocation error code.
|
|
118
|
-
*/
|
|
119
|
-
error?: string;
|
|
120
|
-
};
|
|
121
|
-
/**
|
|
122
|
-
* An invoice was closed.
|
|
123
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#invoice-closed
|
|
124
|
-
*/
|
|
125
|
-
invoice_closed: {
|
|
126
|
-
/**
|
|
127
|
-
* Passed during the `web_app_open_invoice` method invocation `slug` value.
|
|
128
|
-
*/
|
|
129
|
-
slug: string;
|
|
130
|
-
/**
|
|
131
|
-
* Invoice status.
|
|
132
|
-
*/
|
|
133
|
-
status: InvoiceStatus;
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* User clicked the Main Button.
|
|
137
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#main-button-pressed
|
|
138
|
-
*/
|
|
139
|
-
main_button_pressed: never;
|
|
140
|
-
/**
|
|
141
|
-
* Application received phone access request status.
|
|
142
|
-
* @since v6.9
|
|
143
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#phone-requested
|
|
144
|
-
*/
|
|
145
|
-
phone_requested: {
|
|
146
|
-
/**
|
|
147
|
-
* Request status.
|
|
148
|
-
*/
|
|
149
|
-
status: PhoneRequestedStatus;
|
|
150
|
-
};
|
|
151
|
-
/**
|
|
152
|
-
* Popup was closed.
|
|
153
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#popup-closed
|
|
154
|
-
*/
|
|
155
|
-
popup_closed: {
|
|
156
|
-
/**
|
|
157
|
-
* Identifier of the clicked button. In case, the popup was closed without clicking any button,
|
|
158
|
-
* this property will be omitted.
|
|
159
|
-
*/
|
|
160
|
-
button_id?: string;
|
|
161
|
-
};
|
|
162
|
-
/**
|
|
163
|
-
* The QR scanner scanned some QR and extracted its content.
|
|
164
|
-
* @param payload - event payload.
|
|
165
|
-
* @since v6.4
|
|
166
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#qr-text-received
|
|
167
|
-
*/
|
|
168
|
-
qr_text_received: {
|
|
169
|
-
/**
|
|
170
|
-
* Data extracted from the QR.
|
|
171
|
-
*/
|
|
172
|
-
data?: string;
|
|
173
|
-
};
|
|
174
|
-
/**
|
|
175
|
-
* Parent iframe requested current iframe reload.
|
|
176
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#reload-iframe
|
|
177
|
-
*/
|
|
178
|
-
reload_iframe: never;
|
|
179
|
-
/**
|
|
180
|
-
* QR scanner was closed.
|
|
181
|
-
* @since v6.4
|
|
182
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#scan-qr-popup-closed
|
|
183
|
-
*/
|
|
184
|
-
scan_qr_popup_closed: never;
|
|
185
|
-
/**
|
|
186
|
-
* The event which is usually sent by the Telegram web application. Its payload represents
|
|
187
|
-
* `<style/>` tag html content, a developer could use. The stylesheet described in the payload
|
|
188
|
-
* will help the developer to stylize the app scrollbar (but he is still able to do it himself).
|
|
189
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#set-custom-style
|
|
190
|
-
*/
|
|
191
|
-
set_custom_style: string;
|
|
192
|
-
/**
|
|
193
|
-
* Occurs when the Settings Button was pressed.
|
|
194
|
-
* @since v6.1
|
|
195
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#settings-button-pressed
|
|
196
|
-
*/
|
|
197
|
-
settings_button_pressed: never;
|
|
198
|
-
/**
|
|
199
|
-
* Occurs whenever theme settings are changed in the user's Telegram app
|
|
200
|
-
* (including switching to night mode).
|
|
201
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#theme-changed
|
|
202
|
-
*/
|
|
203
|
-
theme_changed: {
|
|
204
|
-
/**
|
|
205
|
-
* Map where the key is a theme stylesheet key and value is the corresponding color in
|
|
206
|
-
* `#RRGGBB` format.
|
|
207
|
-
*/
|
|
208
|
-
theme_params: {
|
|
209
|
-
/**
|
|
210
|
-
* @since v6.10
|
|
211
|
-
*/
|
|
212
|
-
accent_text_color?: RGB;
|
|
213
|
-
bg_color?: RGB;
|
|
214
|
-
button_color?: RGB;
|
|
215
|
-
button_text_color?: RGB;
|
|
216
|
-
/**
|
|
217
|
-
* @since v6.10
|
|
218
|
-
*/
|
|
219
|
-
destructive_text_color?: RGB;
|
|
220
|
-
/**
|
|
221
|
-
* @since v6.10
|
|
222
|
-
*/
|
|
223
|
-
header_bg_color?: RGB;
|
|
224
|
-
hint_color?: RGB;
|
|
225
|
-
link_color?: RGB;
|
|
226
|
-
secondary_bg_color?: RGB;
|
|
227
|
-
/**
|
|
228
|
-
* @since v6.10
|
|
229
|
-
*/
|
|
230
|
-
section_bg_color?: RGB;
|
|
231
|
-
/**
|
|
232
|
-
* @since v6.10
|
|
233
|
-
*/
|
|
234
|
-
section_header_text_color?: RGB;
|
|
235
|
-
/**
|
|
236
|
-
* @since v6.10
|
|
237
|
-
*/
|
|
238
|
-
subtitle_text_color?: RGB;
|
|
239
|
-
text_color?: RGB;
|
|
240
|
-
[key: string]: RGB | undefined;
|
|
241
|
-
};
|
|
242
|
-
};
|
|
243
|
-
/**
|
|
244
|
-
* Occurs whenever the viewport has been changed. For example, when the user started
|
|
245
|
-
* dragging the application or called the expansion method.
|
|
246
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#viewport-changed
|
|
247
|
-
*/
|
|
248
|
-
viewport_changed: {
|
|
249
|
-
/**
|
|
250
|
-
* The viewport height.
|
|
251
|
-
*/
|
|
252
|
-
height: number;
|
|
253
|
-
/**
|
|
254
|
-
* The viewport width.
|
|
255
|
-
*/
|
|
256
|
-
width: number;
|
|
257
|
-
/**
|
|
258
|
-
* Is the viewport currently expanded.
|
|
259
|
-
*/
|
|
260
|
-
is_expanded: boolean;
|
|
261
|
-
/**
|
|
262
|
-
* Is the viewport current state stable and not going to change in the next moment.
|
|
263
|
-
*/
|
|
264
|
-
is_state_stable: boolean;
|
|
265
|
-
};
|
|
266
|
-
/**
|
|
267
|
-
* Application received write access request status.
|
|
268
|
-
* @since v6.9
|
|
269
|
-
* @see https://docs.telegram-mini-apps.com/platform/events#write-access-requested
|
|
270
|
-
*/
|
|
271
|
-
write_access_requested: {
|
|
272
|
-
/**
|
|
273
|
-
* Request status.
|
|
274
|
-
*/
|
|
275
|
-
status: WriteAccessRequestedStatus;
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Mini Apps event name.
|
|
280
|
-
*/
|
|
281
|
-
export type MiniAppsEventName = keyof MiniAppsEvents;
|
|
282
|
-
/**
|
|
283
|
-
* Payload of the specified Mini Apps event.
|
|
284
|
-
*/
|
|
285
|
-
export type MiniAppsEventPayload<E extends MiniAppsEventName> = MiniAppsEvents[E];
|
|
286
|
-
/**
|
|
287
|
-
* Returns event listener for the specified Mini Apps event.
|
|
288
|
-
*/
|
|
289
|
-
export type MiniAppsEventListener<E extends MiniAppsEventName> = EventListener<MiniAppsEvents[E]>;
|
|
290
|
-
export interface MiniAppsEventEmitter extends Pick<EventEmitter<MiniAppsEvents>, 'on' | 'off' | 'count'> {
|
|
291
|
-
subscribe(listener: MiniAppsSubscribeListener): RemoveEventListenerFn;
|
|
292
|
-
unsubscribe(listener: MiniAppsSubscribeListener): void;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Mini Apps event listener used in `subscribe` and `unsubscribe` functions.
|
|
296
|
-
*/
|
|
297
|
-
export type MiniAppsSubscribeListener = (payload: {
|
|
298
|
-
[E in MiniAppsEventName]: {
|
|
299
|
-
name: E;
|
|
300
|
-
payload: MiniAppsEventPayload<E>;
|
|
301
|
-
};
|
|
302
|
-
}[MiniAppsEventName]) => void;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ExecuteWithOptions } from '../types/index.js';
|
|
2
|
-
import { CustomMethodName, CustomMethodParams } from './methods/types/custom-methods.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Invokes known custom method. Returns method execution result.
|
|
6
|
-
* @param method - method name.
|
|
7
|
-
* @param params - method parameters.
|
|
8
|
-
* @param requestId - request identifier.
|
|
9
|
-
* @param options - additional options.
|
|
10
|
-
* @throws {SDKError} ERR_INVOKE_CUSTOM_METHOD_RESPONSE
|
|
11
|
-
* @see ERR_INVOKE_CUSTOM_METHOD_RESPONSE
|
|
12
|
-
*/
|
|
13
|
-
export declare function invokeCustomMethod<M extends CustomMethodName>(method: M, params: CustomMethodParams<M>, requestId: string, options?: ExecuteWithOptions): Promise<unknown>;
|
|
14
|
-
/**
|
|
15
|
-
* Invokes unknown custom method. Returns method execution result.
|
|
16
|
-
* @param method - method name.
|
|
17
|
-
* @param params - method parameters.
|
|
18
|
-
* @param requestId - request identifier.
|
|
19
|
-
* @param options - additional options.
|
|
20
|
-
* @throws {SDKError} ERR_INVOKE_CUSTOM_METHOD_RESPONSE
|
|
21
|
-
* @see ERR_INVOKE_CUSTOM_METHOD_RESPONSE
|
|
22
|
-
*/
|
|
23
|
-
export declare function invokeCustomMethod(method: string, params: object, requestId: string, options?: ExecuteWithOptions): Promise<unknown>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Version } from '../../version/types.js';
|
|
2
|
-
import { PostEvent } from './postEvent.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Creates a function which checks if specified method and parameters are supported.
|
|
6
|
-
*
|
|
7
|
-
* If method or parameters are unsupported, an error will be thrown.
|
|
8
|
-
* @param version - Telegram Mini Apps version.
|
|
9
|
-
* @throws {SDKError} ERR_METHOD_UNSUPPORTED
|
|
10
|
-
* @throws {SDKError} ERR_METHOD_PARAMETER_UNSUPPORTED
|
|
11
|
-
* @see ERR_METHOD_UNSUPPORTED
|
|
12
|
-
* @see ERR_METHOD_PARAMETER_UNSUPPORTED
|
|
13
|
-
*/
|
|
14
|
-
export declare function createPostEvent(version: Version): PostEvent;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { MiniAppsMethodParams, MiniAppsMethodWithOptionalParams, MiniAppsMethodWithoutParams, MiniAppsMethodWithRequiredParams } from './types/methods.js';
|
|
2
|
-
|
|
3
|
-
interface PostEventOptions {
|
|
4
|
-
/**
|
|
5
|
-
* Origin used while posting a message.
|
|
6
|
-
*
|
|
7
|
-
* This option is only used if the current environment is browser (Web version of Telegram)
|
|
8
|
-
* and could be used for test purposes.
|
|
9
|
-
* @default 'https://web.telegram.org'
|
|
10
|
-
*/
|
|
11
|
-
targetOrigin?: string;
|
|
12
|
-
}
|
|
13
|
-
export type PostEvent = typeof postEvent;
|
|
14
|
-
/**
|
|
15
|
-
* Calls Mini Apps method with optional parameters.
|
|
16
|
-
* @param method - method name.
|
|
17
|
-
* @param params - method parameters.
|
|
18
|
-
* @param options - posting options.
|
|
19
|
-
* @throws {SDKError} ERR_UNKNOWN_ENV
|
|
20
|
-
* @see ERR_UNKNOWN_ENV
|
|
21
|
-
*/
|
|
22
|
-
export declare function postEvent<Method extends MiniAppsMethodWithOptionalParams>(method: Method, params?: MiniAppsMethodParams<Method>, options?: PostEventOptions): void;
|
|
23
|
-
/**
|
|
24
|
-
* Calls Mini Apps method without parameters.
|
|
25
|
-
* @param method - method name.
|
|
26
|
-
* @param options - posting options.
|
|
27
|
-
* @throws {SDKError} ERR_UNKNOWN_ENV
|
|
28
|
-
* @see ERR_UNKNOWN_ENV
|
|
29
|
-
*/
|
|
30
|
-
export declare function postEvent(method: MiniAppsMethodWithoutParams | MiniAppsMethodWithOptionalParams, options?: PostEventOptions): void;
|
|
31
|
-
/**
|
|
32
|
-
* Calls Mini Apps method with parameters.
|
|
33
|
-
* @param method - method name.
|
|
34
|
-
* @param params - method parameters.
|
|
35
|
-
* @param options - posting options.
|
|
36
|
-
* @throws {SDKError} ERR_UNKNOWN_ENV
|
|
37
|
-
* @see ERR_UNKNOWN_ENV
|
|
38
|
-
*/
|
|
39
|
-
export declare function postEvent<Method extends MiniAppsMethodWithRequiredParams>(method: Method, params: MiniAppsMethodParams<Method>, options?: PostEventOptions): void;
|
|
40
|
-
export {};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { RequestId } from '../../../request-id/types.js';
|
|
2
|
-
|
|
3
|
-
interface CreateInvokeCustomMethodParams<M extends string, Params extends object> {
|
|
4
|
-
/**
|
|
5
|
-
* Unique request identifier.
|
|
6
|
-
*/
|
|
7
|
-
req_id: RequestId;
|
|
8
|
-
/**
|
|
9
|
-
* Method name.
|
|
10
|
-
*/
|
|
11
|
-
method: M;
|
|
12
|
-
/**
|
|
13
|
-
* Method specific parameters.
|
|
14
|
-
*/
|
|
15
|
-
params: Params;
|
|
16
|
-
}
|
|
17
|
-
export interface CustomMethodsParams {
|
|
18
|
-
/**
|
|
19
|
-
* Deletes storage values by their keys.
|
|
20
|
-
*/
|
|
21
|
-
deleteStorageValues: {
|
|
22
|
-
keys: string | string[];
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Gets current user contact in case, Mini has access to it.
|
|
26
|
-
*/
|
|
27
|
-
getRequestedContact: {};
|
|
28
|
-
/**
|
|
29
|
-
* Gets all registered storage keys.
|
|
30
|
-
*/
|
|
31
|
-
getStorageKeys: {};
|
|
32
|
-
/**
|
|
33
|
-
* Gets storage values by their keys.
|
|
34
|
-
*/
|
|
35
|
-
getStorageValues: {
|
|
36
|
-
keys: string | string[];
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Saves value by specified key in the storage.
|
|
40
|
-
*/
|
|
41
|
-
saveStorageValue: {
|
|
42
|
-
key: string;
|
|
43
|
-
value: string;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Known custom method name.
|
|
48
|
-
*/
|
|
49
|
-
export type CustomMethodName = keyof CustomMethodsParams;
|
|
50
|
-
/**
|
|
51
|
-
* Custom method parameters.
|
|
52
|
-
*/
|
|
53
|
-
export type CustomMethodParams<M extends CustomMethodName> = CustomMethodsParams[M];
|
|
54
|
-
export type AnyInvokeCustomMethodParams = CreateInvokeCustomMethodParams<string, any> | {
|
|
55
|
-
[M in CustomMethodName]: CreateInvokeCustomMethodParams<M, CustomMethodParams<M>>;
|
|
56
|
-
}[CustomMethodName];
|
|
57
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generic type which creates new types of haptic feedback.
|
|
3
|
-
*/
|
|
4
|
-
type CreateHapticFeedbackParams<T extends string, P> = {
|
|
5
|
-
type: T;
|
|
6
|
-
} & P;
|
|
7
|
-
/**
|
|
8
|
-
* Style of impact occurred haptic event.
|
|
9
|
-
* - `light`, indicates a collision between small or lightweight UI objects,
|
|
10
|
-
* - `medium`, indicates a collision between medium-sized or medium-weight UI objects,
|
|
11
|
-
* - `heavy`, indicates a collision between large or heavyweight UI objects,
|
|
12
|
-
* - `rigid`, indicates a collision between hard or inflexible UI objects,
|
|
13
|
-
* - `soft`, indicates a collision between soft or flexible UI objects.
|
|
14
|
-
*/
|
|
15
|
-
export type ImpactHapticFeedbackStyle = 'light' | 'medium' | 'heavy' | 'rigid' | 'soft';
|
|
16
|
-
/**
|
|
17
|
-
* Type of notification occurred type event.
|
|
18
|
-
* - `error`, indicates that a task or action has failed,
|
|
19
|
-
* - `success`, indicates that a task or action has completed successfully,
|
|
20
|
-
* - `warning`, indicates that a task or action produced a warning.
|
|
21
|
-
*/
|
|
22
|
-
export type NotificationHapticFeedbackType = 'error' | 'success' | 'warning';
|
|
23
|
-
/**
|
|
24
|
-
* `impactOccurred` haptic feedback.
|
|
25
|
-
*/
|
|
26
|
-
export type ImpactHapticFeedbackParams = CreateHapticFeedbackParams<'impact', {
|
|
27
|
-
impact_style: ImpactHapticFeedbackStyle;
|
|
28
|
-
}>;
|
|
29
|
-
/**
|
|
30
|
-
* `notificationOccurred` haptic feedback.
|
|
31
|
-
*/
|
|
32
|
-
export type NotificationHapticFeedbackParams = CreateHapticFeedbackParams<'notification', {
|
|
33
|
-
notification_type: NotificationHapticFeedbackType;
|
|
34
|
-
}>;
|
|
35
|
-
/**
|
|
36
|
-
* `selectionChanged` haptic feedback.
|
|
37
|
-
*/
|
|
38
|
-
export type SelectionHapticFeedbackParams = CreateHapticFeedbackParams<'selection_change', {}>;
|
|
39
|
-
export type AnyHapticFeedbackParams = ImpactHapticFeedbackParams | NotificationHapticFeedbackParams | SelectionHapticFeedbackParams;
|
|
40
|
-
export {};
|