@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
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Known type of chat.
|
|
3
|
-
*/
|
|
4
|
-
export type ChatType = 'sender' | 'private' | 'group' | 'supergroup' | 'channel' | string;
|
|
5
|
-
/**
|
|
6
|
-
* Describes Telegram Mini Apps [User](https://docs.telegram-mini-apps.com/platform/init-data#user) type.
|
|
7
|
-
*/
|
|
8
|
-
export interface User {
|
|
9
|
-
/**
|
|
10
|
-
* True, if this user added the bot to the attachment menu.
|
|
11
|
-
*/
|
|
12
|
-
addedToAttachmentMenu?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* True, if this user allowed the bot to message them.
|
|
15
|
-
*/
|
|
16
|
-
allowsWriteToPm?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* First name of the user or bot.
|
|
19
|
-
*/
|
|
20
|
-
firstName: string;
|
|
21
|
-
/**
|
|
22
|
-
* A unique identifier for the user or bot.
|
|
23
|
-
*/
|
|
24
|
-
id: number;
|
|
25
|
-
/**
|
|
26
|
-
* True, if this user is a bot. Returned in the `receiver` field only.
|
|
27
|
-
* @see InitDataParsed.receiver
|
|
28
|
-
*/
|
|
29
|
-
isBot?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* True, if this user is a Telegram Premium user.
|
|
32
|
-
*/
|
|
33
|
-
isPremium?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Last name of the user or bot.
|
|
36
|
-
*/
|
|
37
|
-
lastName?: string;
|
|
38
|
-
/**
|
|
39
|
-
* [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) of the user's language.
|
|
40
|
-
* Returns in user field only.
|
|
41
|
-
*/
|
|
42
|
-
languageCode?: string;
|
|
43
|
-
/**
|
|
44
|
-
* URL of the user’s profile photo. The photo can be in .jpeg or .svg
|
|
45
|
-
* formats. Only returned for Mini Apps launched from the attachment menu.
|
|
46
|
-
*/
|
|
47
|
-
photoUrl?: string;
|
|
48
|
-
/**
|
|
49
|
-
* Username of the user or bot.
|
|
50
|
-
*/
|
|
51
|
-
username?: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Describes Telegram Mini Apps [Chat](https://docs.telegram-mini-apps.com/platform/init-data#chat) type.
|
|
55
|
-
*/
|
|
56
|
-
export interface Chat {
|
|
57
|
-
/**
|
|
58
|
-
* Unique identifier for this chat.
|
|
59
|
-
*/
|
|
60
|
-
id: number;
|
|
61
|
-
/**
|
|
62
|
-
* URL of the chat’s photo. The photo can be in .jpeg or .svg formats.
|
|
63
|
-
* Only returned for Mini Apps launched from the attachment menu.
|
|
64
|
-
*/
|
|
65
|
-
photoUrl?: string;
|
|
66
|
-
/**
|
|
67
|
-
* Type of the chat.
|
|
68
|
-
*/
|
|
69
|
-
type: 'group' | 'supergroup' | 'channel' | string;
|
|
70
|
-
/**
|
|
71
|
-
* Title of the chat.
|
|
72
|
-
*/
|
|
73
|
-
title: string;
|
|
74
|
-
/**
|
|
75
|
-
* Username of the chat.
|
|
76
|
-
*/
|
|
77
|
-
username?: string;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Describes Telegram Mini Apps [InitData](https://docs.telegram-mini-apps.com/platform/init-data#parameters-list)
|
|
81
|
-
* type.
|
|
82
|
-
*/
|
|
83
|
-
export interface InitDataParsed {
|
|
84
|
-
/**
|
|
85
|
-
* Init data generation date.
|
|
86
|
-
*/
|
|
87
|
-
authDate: Date;
|
|
88
|
-
/**
|
|
89
|
-
* The number of seconds after which a message can be sent via the method [answerWebAppQuery](https://core.telegram.org/bots/api#answerwebappquery).
|
|
90
|
-
*/
|
|
91
|
-
canSendAfter?: number;
|
|
92
|
-
/**
|
|
93
|
-
* An object containing data about the chat where the bot was launched via
|
|
94
|
-
* the attachment menu. Returned for supergroups, channels and group
|
|
95
|
-
* chats – only for Mini Apps launched via the attachment menu.
|
|
96
|
-
*/
|
|
97
|
-
chat?: Chat;
|
|
98
|
-
/**
|
|
99
|
-
* The type of chat from which Mini App was opened.
|
|
100
|
-
*/
|
|
101
|
-
chatType?: ChatType;
|
|
102
|
-
/**
|
|
103
|
-
* A global identifier indicating the chat from which Mini App was opened. Returned only for
|
|
104
|
-
* applications opened by direct link.
|
|
105
|
-
*/
|
|
106
|
-
chatInstance?: string;
|
|
107
|
-
/**
|
|
108
|
-
* A hash of all passed parameters, which the bot server can use to
|
|
109
|
-
* check their [validity](https://core.telegram.org/bots/webapps#validating-data-received-via-the-web-app).
|
|
110
|
-
*/
|
|
111
|
-
hash: string;
|
|
112
|
-
/**
|
|
113
|
-
* A unique identifier for the Mini App session, required for sending
|
|
114
|
-
* messages via the [answerWebAppQuery](https://core.telegram.org/bots/api#answerwebappquery) method.
|
|
115
|
-
*/
|
|
116
|
-
queryId?: string;
|
|
117
|
-
/**
|
|
118
|
-
* An object containing data about the chat partner of the current user in
|
|
119
|
-
* the chat where the bot was launched via the attachment menu.
|
|
120
|
-
* Returned only for private chats and only for Mini Apps launched
|
|
121
|
-
* via the attachment menu.
|
|
122
|
-
*/
|
|
123
|
-
receiver?: User;
|
|
124
|
-
/**
|
|
125
|
-
* The value of the `startattach` or `startapp` parameter, passed via link.
|
|
126
|
-
*/
|
|
127
|
-
startParam?: string;
|
|
128
|
-
/**
|
|
129
|
-
* An object containing data about the current user.
|
|
130
|
-
*/
|
|
131
|
-
user?: User;
|
|
132
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { WithSupportsAndTrackableState } from '../../classes/WithSupportsAndTrackableState.js';
|
|
2
|
-
import { InvoiceStatus } from '../../bridge/events/types.js';
|
|
3
|
-
import { PostEvent } from '../../bridge/methods/postEvent.js';
|
|
4
|
-
import { Version } from '../../version/types.js';
|
|
5
|
-
import { InvoiceState } from './types.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @see API: https://docs.telegram-mini-apps.com/packages/tma-js-sdk/components/invoice
|
|
9
|
-
*/
|
|
10
|
-
export declare class Invoice extends WithSupportsAndTrackableState<InvoiceState, 'open'> {
|
|
11
|
-
private readonly postEvent;
|
|
12
|
-
constructor(isOpened: boolean, version: Version, postEvent: PostEvent);
|
|
13
|
-
private set isOpened(value);
|
|
14
|
-
/**
|
|
15
|
-
* True if invoice is currently opened.
|
|
16
|
-
*/
|
|
17
|
-
get isOpened(): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Opens an invoice using its slug.
|
|
20
|
-
* @param slug - invoice slug.
|
|
21
|
-
* @throws {Error} Invoice is already opened.
|
|
22
|
-
*/
|
|
23
|
-
open(slug: string): Promise<InvoiceStatus>;
|
|
24
|
-
/**
|
|
25
|
-
* Opens an invoice using its url. It expects passing link in full format, with hostname "t.me".
|
|
26
|
-
* @param url - invoice URL.
|
|
27
|
-
* @param type - value type.
|
|
28
|
-
* @throws {Error} Invoice is already opened.
|
|
29
|
-
*/
|
|
30
|
-
open(url: string, type: 'url'): Promise<InvoiceStatus>;
|
|
31
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { StateEvents } from '../../classes/State/types.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Invoice internal state.
|
|
5
|
-
*/
|
|
6
|
-
export interface InvoiceState {
|
|
7
|
-
isOpened: boolean;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Invoice events.
|
|
11
|
-
*/
|
|
12
|
-
export type InvoiceEvents = StateEvents<InvoiceState>;
|
|
13
|
-
/**
|
|
14
|
-
* Invoice event name.
|
|
15
|
-
*/
|
|
16
|
-
export type InvoiceEventName = keyof InvoiceEvents;
|
|
17
|
-
/**
|
|
18
|
-
* Invoice event listener.
|
|
19
|
-
*/
|
|
20
|
-
export type InvoiceEventListener<E extends InvoiceEventName> = InvoiceEvents[E];
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { WithStateUtils } from '../../classes/WithStateUtils.js';
|
|
2
|
-
import { RGB } from '../../colors/types.js';
|
|
3
|
-
import { MainButtonEvents, MainButtonParams, MainButtonProps, MainButtonState } from './types.js';
|
|
4
|
-
import { EventEmitter } from '../../events/event-emitter/EventEmitter.js';
|
|
5
|
-
|
|
6
|
-
type Emitter = EventEmitter<MainButtonEvents>;
|
|
7
|
-
/**
|
|
8
|
-
* @see Usage: https://docs.telegram-mini-apps.com/platform/main-button
|
|
9
|
-
* @see API: https://docs.telegram-mini-apps.com/packages/tma-js-sdk/components/main-button
|
|
10
|
-
*/
|
|
11
|
-
export declare class MainButton extends WithStateUtils<MainButtonState> {
|
|
12
|
-
private readonly postEvent;
|
|
13
|
-
constructor({ postEvent, ...rest }: MainButtonProps);
|
|
14
|
-
/**
|
|
15
|
-
* The MainButton background color.
|
|
16
|
-
*/
|
|
17
|
-
get bgColor(): RGB;
|
|
18
|
-
/**
|
|
19
|
-
* Sends current local state to the Telegram application.
|
|
20
|
-
*/
|
|
21
|
-
private commit;
|
|
22
|
-
/**
|
|
23
|
-
* Disables the MainButton.
|
|
24
|
-
* @see Does not work on Android: https://github.com/Telegram-Mini-Apps/issues/issues/1
|
|
25
|
-
*/
|
|
26
|
-
disable(): this;
|
|
27
|
-
/**
|
|
28
|
-
* Enables the MainButton.
|
|
29
|
-
*/
|
|
30
|
-
enable(): this;
|
|
31
|
-
/**
|
|
32
|
-
* Hides the MainButton.
|
|
33
|
-
*/
|
|
34
|
-
hide(): this;
|
|
35
|
-
/**
|
|
36
|
-
* Hides the MainButton loading indicator.
|
|
37
|
-
*/
|
|
38
|
-
hideLoader(): this;
|
|
39
|
-
private set isEnabled(value);
|
|
40
|
-
/**
|
|
41
|
-
* True if the MainButton is enabled.
|
|
42
|
-
*/
|
|
43
|
-
get isEnabled(): boolean;
|
|
44
|
-
private set isLoaderVisible(value);
|
|
45
|
-
/**
|
|
46
|
-
* True if the MainButton loader is visible.
|
|
47
|
-
*/
|
|
48
|
-
get isLoaderVisible(): boolean;
|
|
49
|
-
private set isVisible(value);
|
|
50
|
-
/**
|
|
51
|
-
* True if the MainButton is visible.
|
|
52
|
-
*/
|
|
53
|
-
get isVisible(): boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Adds a new event listener.
|
|
56
|
-
* @param event - event to listen.
|
|
57
|
-
* @param listener - listener to add.
|
|
58
|
-
*/
|
|
59
|
-
on: Emitter['on'];
|
|
60
|
-
/**
|
|
61
|
-
* Removes the event listener.
|
|
62
|
-
* @param event - event to listen.
|
|
63
|
-
* @param listener - listener to remove.
|
|
64
|
-
*/
|
|
65
|
-
off: Emitter['off'];
|
|
66
|
-
/**
|
|
67
|
-
* Shows the MainButton.
|
|
68
|
-
*
|
|
69
|
-
* Note that opening the Mini App from the attachment menu hides the main button until the
|
|
70
|
-
* user interacts with the Mini App interface.
|
|
71
|
-
*/
|
|
72
|
-
show(): this;
|
|
73
|
-
/**
|
|
74
|
-
* Shows a loading indicator on the Main Button.
|
|
75
|
-
*/
|
|
76
|
-
showLoader(): this;
|
|
77
|
-
/**
|
|
78
|
-
* Sets a new MainButton text. Minimal length for the text is 1 symbol, and maximum is 64 symbols.
|
|
79
|
-
* @param text - a new text.
|
|
80
|
-
*/
|
|
81
|
-
setText(text: string): this;
|
|
82
|
-
/**
|
|
83
|
-
* Sets a new Main Button text color.
|
|
84
|
-
* @param textColor - new text color.
|
|
85
|
-
*/
|
|
86
|
-
setTextColor(textColor: RGB): this;
|
|
87
|
-
/**
|
|
88
|
-
* Updates current Main Button color.
|
|
89
|
-
* @param bgColor - color to set.
|
|
90
|
-
*/
|
|
91
|
-
setBgColor(bgColor: RGB): this;
|
|
92
|
-
/**
|
|
93
|
-
* Allows setting multiple Main Button parameters.
|
|
94
|
-
* @param params - Main Button parameters.
|
|
95
|
-
*/
|
|
96
|
-
setParams(params: Partial<MainButtonParams>): this;
|
|
97
|
-
/**
|
|
98
|
-
* The MainButton text.
|
|
99
|
-
*/
|
|
100
|
-
get text(): string;
|
|
101
|
-
/**
|
|
102
|
-
* The MainButton text color.
|
|
103
|
-
*/
|
|
104
|
-
get textColor(): RGB;
|
|
105
|
-
}
|
|
106
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { PostEvent } from '../../bridge/methods/postEvent.js';
|
|
2
|
-
import { StateEvents } from '../../classes/State/types.js';
|
|
3
|
-
import { RGB } from '../../colors/types.js';
|
|
4
|
-
|
|
5
|
-
export interface MainButtonParams {
|
|
6
|
-
bgColor: RGB;
|
|
7
|
-
isEnabled: boolean;
|
|
8
|
-
isLoaderVisible: boolean;
|
|
9
|
-
isVisible: boolean;
|
|
10
|
-
text: string;
|
|
11
|
-
textColor: RGB;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* MainButton constructor properties.
|
|
15
|
-
*/
|
|
16
|
-
export interface MainButtonProps extends MainButtonParams {
|
|
17
|
-
postEvent: PostEvent;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* MainButton internal state.
|
|
21
|
-
*/
|
|
22
|
-
export interface MainButtonState extends MainButtonParams {
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* MainButton trackable events.
|
|
26
|
-
*/
|
|
27
|
-
export interface MainButtonEvents extends StateEvents<MainButtonState> {
|
|
28
|
-
/**
|
|
29
|
-
* The MainButton was clicked.
|
|
30
|
-
*/
|
|
31
|
-
click: () => void;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* MainButton event name.
|
|
35
|
-
*/
|
|
36
|
-
export type MainButtonEventName = keyof MainButtonEvents;
|
|
37
|
-
/**
|
|
38
|
-
* MainButton event listener.
|
|
39
|
-
*/
|
|
40
|
-
export type MainButtonEventListener<E extends MainButtonEventName> = MainButtonEvents[E];
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { WithSupportsAndTrackableState } from '../../classes/WithSupportsAndTrackableState.js';
|
|
2
|
-
import { PhoneRequestedStatus, WriteAccessRequestedStatus } from '../../bridge/events/types.js';
|
|
3
|
-
import { SwitchInlineQueryChatType } from '../../bridge/methods/types/methods.js';
|
|
4
|
-
import { RGB } from '../../colors/types.js';
|
|
5
|
-
import { MiniAppHeaderColor, MiniAppProps, MiniAppState, RequestedContact } from './types.js';
|
|
6
|
-
import { SupportsFn } from '../../supports/types.js';
|
|
7
|
-
import { ExecuteWithTimeout } from '../../types/methods.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Provides common Mini Apps functionality not covered by other system components.
|
|
11
|
-
*/
|
|
12
|
-
export declare class MiniApp extends WithSupportsAndTrackableState<MiniAppState, 'requestPhoneAccess' | 'requestWriteAccess' | 'switchInlineQuery' | 'setHeaderColor' | 'setBackgroundColor'> {
|
|
13
|
-
private readonly botInline;
|
|
14
|
-
private readonly postEvent;
|
|
15
|
-
private readonly createRequestId;
|
|
16
|
-
private requestPhoneAccessPromise;
|
|
17
|
-
private requestWriteAccessPromise;
|
|
18
|
-
constructor({ postEvent, createRequestId, version, botInline, ...rest }: MiniAppProps);
|
|
19
|
-
/**
|
|
20
|
-
* Attempts to get requested contact.
|
|
21
|
-
* @param timeout - request timeout.
|
|
22
|
-
*/
|
|
23
|
-
private getRequestedContact;
|
|
24
|
-
/**
|
|
25
|
-
* The Mini App background color.
|
|
26
|
-
* @example "#ffaabb"
|
|
27
|
-
*/
|
|
28
|
-
get bgColor(): RGB;
|
|
29
|
-
/**
|
|
30
|
-
* Closes the Mini App.
|
|
31
|
-
* @param returnBack - should the application be wrapped into the bottom bar.
|
|
32
|
-
*/
|
|
33
|
-
close(returnBack?: boolean): void;
|
|
34
|
-
/**
|
|
35
|
-
* The Mini App header color.
|
|
36
|
-
* @example "#ffaabb"
|
|
37
|
-
* @example "bg_color"
|
|
38
|
-
*/
|
|
39
|
-
get headerColor(): MiniAppHeaderColor;
|
|
40
|
-
/**
|
|
41
|
-
* True if the Mini App is currently launched in bot inline mode.
|
|
42
|
-
*/
|
|
43
|
-
get isBotInline(): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* True if the current Mini App background color is recognized as dark.
|
|
46
|
-
*/
|
|
47
|
-
get isDark(): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Informs the Telegram app that the Mini App is ready to be displayed.
|
|
50
|
-
*
|
|
51
|
-
* It is recommended to call this method as early as possible, as soon as all essential
|
|
52
|
-
* interface elements loaded. Once this method called, the loading placeholder is hidden
|
|
53
|
-
* and the Mini App shown.
|
|
54
|
-
*
|
|
55
|
-
* If the method not called, the placeholder will be hidden only when the page fully loaded.
|
|
56
|
-
*/
|
|
57
|
-
ready(): void;
|
|
58
|
-
/**
|
|
59
|
-
* Requests current user contact information. In contrary to requestPhoneAccess, this method
|
|
60
|
-
* returns promise with contact information that rejects in case, user denied access, or request
|
|
61
|
-
* failed.
|
|
62
|
-
* @param options - additional options.
|
|
63
|
-
*/
|
|
64
|
-
requestContact({ timeout }?: ExecuteWithTimeout): Promise<RequestedContact>;
|
|
65
|
-
/**
|
|
66
|
-
* Requests current user phone access. Method returns promise, which resolves
|
|
67
|
-
* status of the request. In case, user accepted the request, Mini App bot will receive
|
|
68
|
-
* the according notification.
|
|
69
|
-
*
|
|
70
|
-
* To obtain the retrieved information instead, utilize the `requestContact` method.
|
|
71
|
-
* @param options - additional options.
|
|
72
|
-
* @see requestContact
|
|
73
|
-
*/
|
|
74
|
-
requestPhoneAccess(options?: ExecuteWithTimeout): Promise<PhoneRequestedStatus>;
|
|
75
|
-
/**
|
|
76
|
-
* Requests write message access to current user.
|
|
77
|
-
* @param options - additional options.
|
|
78
|
-
*/
|
|
79
|
-
requestWriteAccess(options?: ExecuteWithTimeout): Promise<WriteAccessRequestedStatus>;
|
|
80
|
-
/**
|
|
81
|
-
* A method used to send data to the bot. When this method called, a service message sent to
|
|
82
|
-
* the bot containing the data of the length up to 4096 bytes, and the Mini App closed. See the
|
|
83
|
-
* field `web_app_data` in the class [Message](https://core.telegram.org/bots/api#message).
|
|
84
|
-
*
|
|
85
|
-
* This method is only available for Mini Apps launched via a Keyboard button.
|
|
86
|
-
* @param data - data to send to bot.
|
|
87
|
-
* @throws {Error} data has incorrect size.
|
|
88
|
-
*/
|
|
89
|
-
sendData(data: string): void;
|
|
90
|
-
/**
|
|
91
|
-
* Updates current Mini App header color.
|
|
92
|
-
*
|
|
93
|
-
* @see No effect on desktop: https://github.com/Telegram-Mini-Apps/tma.js/issues/9
|
|
94
|
-
* @see Works incorrectly in Android: https://github.com/Telegram-Mini-Apps/tma.js/issues/8
|
|
95
|
-
* @param color - color key or RGB color.
|
|
96
|
-
*/
|
|
97
|
-
setHeaderColor(color: MiniAppHeaderColor): void;
|
|
98
|
-
/**
|
|
99
|
-
* Updates current Mini App background color.
|
|
100
|
-
*
|
|
101
|
-
* @see No effect on desktop: https://github.com/Telegram-Mini-Apps/tma.js/issues/9
|
|
102
|
-
* @see Works incorrectly in Android: https://github.com/Telegram-Mini-Apps/tma.js/issues/8
|
|
103
|
-
* @param color - RGB color.
|
|
104
|
-
*/
|
|
105
|
-
setBgColor(color: RGB): void;
|
|
106
|
-
/**
|
|
107
|
-
* Checks if specified method parameter is supported by current component.
|
|
108
|
-
*/
|
|
109
|
-
supportsParam: SupportsFn<'setHeaderColor.color'>;
|
|
110
|
-
/**
|
|
111
|
-
* Inserts the bot's username and the specified inline query in the current chat's input field.
|
|
112
|
-
* Query may be empty, in which case only the bot's username will be inserted. The client prompts
|
|
113
|
-
* the user to choose a specific chat, then opens that chat and inserts the bot's username and
|
|
114
|
-
* the specified inline query in the input field.
|
|
115
|
-
* @param text - text which should be inserted in the input after the current bot name. Max
|
|
116
|
-
* length is 256 symbols.
|
|
117
|
-
* @param chatTypes - List of chat types which could be chosen to send the message. Could be
|
|
118
|
-
* empty list.
|
|
119
|
-
*/
|
|
120
|
-
switchInlineQuery(text: string, chatTypes?: SwitchInlineQueryChatType[]): void;
|
|
121
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ValueParser } from '../../../parsing/ValueParser/ValueParser.js';
|
|
2
|
-
import { RequestedContact } from '../types.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Returns function which parses incoming value as a contact information.
|
|
6
|
-
*/
|
|
7
|
-
export declare function contact(): ValueParser<RequestedContact, false>;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { PostEvent } from '../../bridge/methods/postEvent.js';
|
|
2
|
-
import { HeaderColorKey } from '../../bridge/methods/types/methods.js';
|
|
3
|
-
import { StateEvents } from '../../classes/State/types.js';
|
|
4
|
-
import { RGB } from '../../colors/types.js';
|
|
5
|
-
import { CreateRequestIdFn } from '../../request-id/types.js';
|
|
6
|
-
import { Version } from '../../version/types.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* MiniApp constructor properties.
|
|
10
|
-
*/
|
|
11
|
-
export interface MiniAppProps extends MiniAppState {
|
|
12
|
-
version: Version;
|
|
13
|
-
botInline: boolean;
|
|
14
|
-
createRequestId: CreateRequestIdFn;
|
|
15
|
-
postEvent: PostEvent;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* MiniApp header color.
|
|
19
|
-
*/
|
|
20
|
-
export type MiniAppHeaderColor = HeaderColorKey | RGB;
|
|
21
|
-
/**
|
|
22
|
-
* MiniApp internal state.
|
|
23
|
-
*/
|
|
24
|
-
export interface MiniAppState {
|
|
25
|
-
bgColor: RGB;
|
|
26
|
-
headerColor: MiniAppHeaderColor;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* MiniApp trackable events.
|
|
30
|
-
*/
|
|
31
|
-
export interface MiniAppEvents extends StateEvents<MiniAppState> {
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* MiniApp event name.
|
|
35
|
-
*/
|
|
36
|
-
export type MiniAppEventName = keyof MiniAppEvents;
|
|
37
|
-
/**
|
|
38
|
-
* MiniApp event listener.
|
|
39
|
-
*/
|
|
40
|
-
export type MiniAppEventListener<E extends MiniAppEventName> = MiniAppEvents[E];
|
|
41
|
-
/**
|
|
42
|
-
* Requested contact information.
|
|
43
|
-
*/
|
|
44
|
-
export interface RequestedContact {
|
|
45
|
-
contact: {
|
|
46
|
-
userId: number;
|
|
47
|
-
phoneNumber: string;
|
|
48
|
-
firstName: string;
|
|
49
|
-
lastName?: string;
|
|
50
|
-
};
|
|
51
|
-
authDate: Date;
|
|
52
|
-
hash: string;
|
|
53
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { WithSupportsAndTrackableState } from '../../classes/WithSupportsAndTrackableState.js';
|
|
2
|
-
import { PostEvent } from '../../bridge/methods/postEvent.js';
|
|
3
|
-
import { OpenPopupOptions, PopupState } from './types.js';
|
|
4
|
-
import { Version } from '../../version/types.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @see Usage: https://docs.telegram-mini-apps.com/platform/popup
|
|
8
|
-
* @see API: https://docs.telegram-mini-apps.com/packages/tma-js-sdk/components/popup
|
|
9
|
-
*/
|
|
10
|
-
export declare class Popup extends WithSupportsAndTrackableState<PopupState, 'open'> {
|
|
11
|
-
private readonly postEvent;
|
|
12
|
-
constructor(isOpened: boolean, version: Version, postEvent: PostEvent);
|
|
13
|
-
private set isOpened(value);
|
|
14
|
-
/**
|
|
15
|
-
* True if the Popup is opened.
|
|
16
|
-
*/
|
|
17
|
-
get isOpened(): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* A method that shows a native popup described by the `params` argument.
|
|
20
|
-
* Promise will be resolved when popup is closed. Resolved value will have
|
|
21
|
-
* an identifier of pressed button.
|
|
22
|
-
*
|
|
23
|
-
* In case, user clicked outside the popup or clicked top right popup close
|
|
24
|
-
* button, null will be returned.
|
|
25
|
-
*
|
|
26
|
-
* @param options - popup parameters.
|
|
27
|
-
* @throws {Error} Popup is already opened.
|
|
28
|
-
*/
|
|
29
|
-
open(options: OpenPopupOptions): Promise<string | null>;
|
|
30
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PopupParams as BridgePopupParams } from '../../bridge/methods/types/popup.js';
|
|
2
|
-
import { OpenPopupOptions } from './types.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Prepares popup parameters before sending them to native app.
|
|
6
|
-
* @param params - popup parameters.
|
|
7
|
-
*/
|
|
8
|
-
export declare function preparePopupParams(params: OpenPopupOptions): BridgePopupParams;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { WithSupportsAndTrackableState } from '../../classes/WithSupportsAndTrackableState.js';
|
|
2
|
-
import { PostEvent } from '../../bridge/methods/postEvent.js';
|
|
3
|
-
import { Version } from '../../version/types.js';
|
|
4
|
-
import { QRScannerOpenOptions, QRScannerState } from './types.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @see API: https://docs.telegram-mini-apps.com/packages/tma-js-sdk/components/qr-scanner
|
|
8
|
-
*/
|
|
9
|
-
export declare class QRScanner extends WithSupportsAndTrackableState<QRScannerState, 'close' | 'open'> {
|
|
10
|
-
private readonly postEvent;
|
|
11
|
-
constructor(isOpened: boolean, version: Version, postEvent: PostEvent);
|
|
12
|
-
/**
|
|
13
|
-
* Closes the scanner.
|
|
14
|
-
*/
|
|
15
|
-
close(): void;
|
|
16
|
-
private set isOpened(value);
|
|
17
|
-
/**
|
|
18
|
-
* Returns true if the scanner is currently opened.
|
|
19
|
-
*/
|
|
20
|
-
get isOpened(): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Opens the scanner with the specified title shown to user.
|
|
23
|
-
* The method returns a promise with a scanned QR content and null if the scanner was closed.
|
|
24
|
-
* @param options - method options.
|
|
25
|
-
*/
|
|
26
|
-
open(options?: QRScannerOpenOptions): Promise<string | null>;
|
|
27
|
-
/**
|
|
28
|
-
* Opens the scanner with the specified title shown to user.
|
|
29
|
-
* The method returns a promise with a scanned QR content and null if the scanner was closed.
|
|
30
|
-
* @param text - title to display.
|
|
31
|
-
*/
|
|
32
|
-
open(text?: string): Promise<string | null>;
|
|
33
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { StateEvents } from '../../classes/State/types.js';
|
|
2
|
-
import { RequestCaptureEventFn } from '../../bridge/request.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* QRScanner internal state.
|
|
6
|
-
*/
|
|
7
|
-
export interface QRScannerState {
|
|
8
|
-
isOpened: boolean;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* QRScanner trackable events.
|
|
12
|
-
*/
|
|
13
|
-
export type QRScannerEvents = StateEvents<QRScannerState>;
|
|
14
|
-
/**
|
|
15
|
-
* QRScanner event name.
|
|
16
|
-
*/
|
|
17
|
-
export type QRScannerEventName = keyof QRScannerEvents;
|
|
18
|
-
/**
|
|
19
|
-
* QRScanner event listener.
|
|
20
|
-
*/
|
|
21
|
-
export type QRScannerEventListener<E extends QRScannerEventName> = QRScannerEvents[E];
|
|
22
|
-
export interface QRScannerOpenOptions {
|
|
23
|
-
/**
|
|
24
|
-
* Title to be displayed.
|
|
25
|
-
*/
|
|
26
|
-
text?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Function, which should return true, if QR should be captured.
|
|
29
|
-
*/
|
|
30
|
-
capture?: RequestCaptureEventFn<'qr_text_received'>;
|
|
31
|
-
}
|