@tma.js/sdk 2.6.1 → 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 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +3 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +3824 -2925
- package/dist/index.js.map +1 -1
- package/package.json +19 -9
- 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/methods/createPostEvent.d.ts +0 -13
- package/dist/dts/bridge/methods/postEvent.d.ts +0 -38
- 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/target-origin.d.ts +0 -13
- package/dist/dts/bridge/utils/captureSameReq.d.ts +0 -10
- package/dist/dts/bridge/utils/invokeCustomMethod.d.ts +0 -23
- package/dist/dts/bridge/utils/request.d.ts +0 -47
- 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 -120
- 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 -54
- 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 -2
- package/dist/index.low-level.iife.js.map +0 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { PostEventError } from '@tma.js/bridge';
|
|
2
|
+
import * as E from 'fp-ts/Either';
|
|
3
|
+
export interface ShareStoryOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The caption to be added to the media.
|
|
6
|
+
* 0-200 characters for regular users and 0-2048 characters for premium subscribers.
|
|
7
|
+
* @see https://telegram.org/faq_premium#telegram-premium
|
|
8
|
+
*/
|
|
9
|
+
text?: string;
|
|
10
|
+
/**
|
|
11
|
+
* An object that describes a widget link to be included in the story.
|
|
12
|
+
* Note that only premium subscribers can post stories with links.
|
|
13
|
+
* @see https://telegram.org/faq_premium#telegram-premium
|
|
14
|
+
*/
|
|
15
|
+
widgetLink?: {
|
|
16
|
+
/**
|
|
17
|
+
* The URL to be included in the story.
|
|
18
|
+
*/
|
|
19
|
+
url: string;
|
|
20
|
+
/**
|
|
21
|
+
* The name to be displayed for the widget link, 0-48 characters.
|
|
22
|
+
*/
|
|
23
|
+
name?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export type ShareStoryError = PostEventError;
|
|
27
|
+
/**
|
|
28
|
+
* Opens the native story editor.
|
|
29
|
+
* @since Mini Apps v7.8
|
|
30
|
+
* @example
|
|
31
|
+
* pipe(
|
|
32
|
+
* shareStory('https://example.com/background.png', {
|
|
33
|
+
* text: 'Look at this cool group!',
|
|
34
|
+
* widgetLink: {
|
|
35
|
+
* url: 'https://t.me/heyqbnk',
|
|
36
|
+
* name: 'Vlad\'s community',
|
|
37
|
+
* },
|
|
38
|
+
* }),
|
|
39
|
+
* TE.match(error => {
|
|
40
|
+
* console.error('Something went wrong', error);
|
|
41
|
+
* }, () => {
|
|
42
|
+
* console.log('Call was successful');
|
|
43
|
+
* }),
|
|
44
|
+
* );
|
|
45
|
+
*/
|
|
46
|
+
export declare const shareStoryFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(mediaUrl: string, options?: ShareStoryOptions) => E.Either<ShareStoryError, void>, true, never>;
|
|
47
|
+
/**
|
|
48
|
+
* @see shareStoryFp
|
|
49
|
+
*/
|
|
50
|
+
export declare const shareStory: import('../../with-checks/withChecksFp.js').WithChecks<(mediaUrl: string, options?: ShareStoryOptions) => E.Either<ShareStoryError, void>, true, never>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PostEventError, SwitchInlineQueryChatType } from '@tma.js/bridge';
|
|
2
|
+
import * as E from 'fp-ts/Either';
|
|
3
|
+
export type SwitchInlineQueryError = PostEventError;
|
|
4
|
+
/**
|
|
5
|
+
* Inserts the bot's username and the specified inline query in the current chat's input field.
|
|
6
|
+
* Query may be empty, in which case only the bot's username will be inserted. The client prompts
|
|
7
|
+
* the user to choose a specific chat, then opens that chat and inserts the bot's username and
|
|
8
|
+
* the specified inline query in the input field.
|
|
9
|
+
* @param query - text which should be inserted in the input after the current bot name. Max
|
|
10
|
+
* length is 256 symbols.
|
|
11
|
+
* @param chatTypes - List of chat types which could be chosen to send the message. Could be an
|
|
12
|
+
* empty list.
|
|
13
|
+
* @since Mini Apps v6.7
|
|
14
|
+
* @example
|
|
15
|
+
* pipe(
|
|
16
|
+
* switchInlineQuery('my query goes here', ['users']),
|
|
17
|
+
* E.match(error => {
|
|
18
|
+
* console.error('Something went wrong', error);
|
|
19
|
+
* }, () => {
|
|
20
|
+
* console.log('Call was successful');
|
|
21
|
+
* }),
|
|
22
|
+
* );
|
|
23
|
+
*/
|
|
24
|
+
export declare const switchInlineQueryFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(query: string, chatTypes?: SwitchInlineQueryChatType[]) => E.Either<SwitchInlineQueryError, void>, true, never>;
|
|
25
|
+
/**
|
|
26
|
+
* @see switchInlineQueryFp
|
|
27
|
+
*/
|
|
28
|
+
export declare const switchInlineQuery: import('../../with-checks/withChecksFp.js').WithChecks<(query: string, chatTypes?: SwitchInlineQueryChatType[]) => E.Either<SwitchInlineQueryError, void>, true, never>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EventName } from '@tma.js/bridge';
|
|
2
|
+
export declare function bottomButtonOptions<S, D>(storageName: string, trackedClickEvent: EventName, defaults: D): {
|
|
3
|
+
defaults: D;
|
|
4
|
+
onClick(listener: VoidFunction, once?: boolean): VoidFunction;
|
|
5
|
+
offClick(listener: VoidFunction, once?: boolean): void;
|
|
6
|
+
isTma: import('../types.js').MaybeAccessor<boolean>;
|
|
7
|
+
postEvent: import('@tma.js/bridge').PostEventFpFn;
|
|
8
|
+
version: import('../types.js').MaybeAccessor<import('@tma.js/types').Version>;
|
|
9
|
+
storage: import('../helpers/component-storage.js').ComponentStorage<S>;
|
|
10
|
+
isPageReload: import('../types.js').MaybeAccessor<boolean>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EventName } from '@tma.js/bridge';
|
|
2
|
+
export declare function buttonOptions<S>(storageName: string, trackedClickEvent: EventName): {
|
|
3
|
+
onClick(listener: VoidFunction, once?: boolean): VoidFunction;
|
|
4
|
+
offClick(listener: VoidFunction, once?: boolean): void;
|
|
5
|
+
isTma: import('../types.js').MaybeAccessor<boolean>;
|
|
6
|
+
postEvent: import('@tma.js/bridge').PostEventFpFn;
|
|
7
|
+
version: import('../types.js').MaybeAccessor<import('@tma.js/types').Version>;
|
|
8
|
+
storage: import('../helpers/component-storage.js').ComponentStorage<S>;
|
|
9
|
+
isPageReload: import('../types.js').MaybeAccessor<boolean>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CustomMethodParams, CustomMethodName, InvokeCustomMethodError, InvokeCustomMethodFpOptions, RequestError } from '@tma.js/bridge';
|
|
2
|
+
import type * as TE from 'fp-ts/TaskEither';
|
|
3
|
+
export type { InvokeCustomMethodError };
|
|
4
|
+
export interface InvokeCustomMethodNoRequestIdFn {
|
|
5
|
+
<M extends CustomMethodName>(this: void, method: M, params: CustomMethodParams<M>, options?: InvokeCustomMethodFpOptions): TE.TaskEither<InvokeCustomMethodError, unknown>;
|
|
6
|
+
(this: void, method: string, params: object, options?: InvokeCustomMethodFpOptions): TE.TaskEither<RequestError, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export interface WithInvokeCustomMethod {
|
|
9
|
+
invokeCustomMethod: InvokeCustomMethodNoRequestIdFn;
|
|
10
|
+
}
|
|
11
|
+
export declare const withInvokeCustomMethod: <O extends object>(obj: O) => O & WithInvokeCustomMethod;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PostEventFpFn } from '@tma.js/bridge';
|
|
2
|
+
export interface WithPostEvent {
|
|
3
|
+
/**
|
|
4
|
+
* A postEvent function to use to call Mini Apps methods.
|
|
5
|
+
*/
|
|
6
|
+
postEvent: PostEventFpFn;
|
|
7
|
+
}
|
|
8
|
+
export declare const withPostEvent: <O extends object>(obj: O) => O & WithPostEvent;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentStorage } from '../helpers/component-storage.js';
|
|
2
|
+
import { MaybeAccessor } from '../types.js';
|
|
3
|
+
export interface WithStateRestore<T> {
|
|
4
|
+
/**
|
|
5
|
+
* A storage the component could use to store its data.
|
|
6
|
+
*/
|
|
7
|
+
storage: ComponentStorage<T>;
|
|
8
|
+
/**
|
|
9
|
+
* True if the current page is reloaded.
|
|
10
|
+
*/
|
|
11
|
+
isPageReload: MaybeAccessor<boolean>;
|
|
12
|
+
}
|
|
13
|
+
export declare function withStateRestore<S>(storageName: string): <O extends object>(obj: O) => O & WithStateRestore<S>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Version } from '@tma.js/types';
|
|
2
|
+
import { MaybeAccessor } from '../types.js';
|
|
3
|
+
export interface WithVersion {
|
|
4
|
+
/**
|
|
5
|
+
* The currently supported Telegram Mini Apps version by the Telegram client.
|
|
6
|
+
*/
|
|
7
|
+
version: MaybeAccessor<Version>;
|
|
8
|
+
}
|
|
9
|
+
export declare const withVersion: <O extends object>(obj: O) => O & WithVersion;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RequestError, CustomMethodName, CustomMethodParams, InvokeCustomMethodOptions } from '@tma.js/bridge';
|
|
2
|
+
import * as TE from 'fp-ts/TaskEither';
|
|
3
|
+
/**
|
|
4
|
+
* Invokes known custom method. Returns method execution result.
|
|
5
|
+
* @param method - method name.
|
|
6
|
+
* @param params - method parameters.
|
|
7
|
+
* @param options - additional options.
|
|
8
|
+
*/
|
|
9
|
+
export declare function invokeCustomMethod<M extends CustomMethodName>(method: M, params: CustomMethodParams<M>, options?: InvokeCustomMethodOptions): TE.TaskEither<RequestError, unknown>;
|
|
10
|
+
/**
|
|
11
|
+
* Invokes unknown custom method. Returns method execution result.
|
|
12
|
+
* @param method - method name.
|
|
13
|
+
* @param params - method parameters.
|
|
14
|
+
* @param options - additional options.
|
|
15
|
+
*/
|
|
16
|
+
export declare function invokeCustomMethod(method: string, params: object, options?: InvokeCustomMethodOptions): TE.TaskEither<RequestError, unknown>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { postEventFp as _postEventFp, PostEventFpFn, PostEventFn } from '@tma.js/bridge';
|
|
2
|
+
export declare const postEventFpSignal: import('@tma.js/signals').Signal<typeof _postEventFp>;
|
|
3
|
+
export declare const postEventFp: PostEventFpFn;
|
|
4
|
+
export declare const postEvent: PostEventFn;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Computed, Signal, SignalOptions } from '@tma.js/signals';
|
|
2
|
+
export type SignalsTuple<T> = [Signal<T>, Computed<T>];
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new signal with the initial value.
|
|
5
|
+
* @param initialValue - the initial value.
|
|
6
|
+
* @param options - additional options.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createSignal<T>(initialValue: T, options?: SignalOptions<T>): Signal<T>;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new signal without the initial value.
|
|
11
|
+
* @param initialValue - the initial value.
|
|
12
|
+
* @param options - additional options.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createSignal<T>(initialValue?: T, options?: SignalOptions<T | undefined>): Signal<T | undefined>;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a signal, which wil be automatically updated if some of its dependant signals were
|
|
17
|
+
* modified.
|
|
18
|
+
* @param fn - computation function.
|
|
19
|
+
* @param options - additional functions.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createComputed<T>(fn: (prev?: T) => T, options?: SignalOptions<T>): Computed<T>;
|
|
22
|
+
/**
|
|
23
|
+
* Resets all signals states.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resetSignals(): void;
|
|
26
|
+
/**
|
|
27
|
+
* @returns A tuple, containing a manual and computed signals. The computed signal is based on
|
|
28
|
+
* the manual one.
|
|
29
|
+
* @param initialValue - the initial value.
|
|
30
|
+
* @param options - additional options.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createSignalsTuple<T>(initialValue: T, options?: SignalOptions<T>): SignalsTuple<T>;
|
|
33
|
+
/**
|
|
34
|
+
* @returns A tuple, containing a manual and computed signals. The computed signal is based on
|
|
35
|
+
* the manual one.
|
|
36
|
+
* @param initialValue - an initial value.
|
|
37
|
+
* @param options - additional options.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createSignalsTuple<T>(initialValue?: T, options?: SignalOptions<T | undefined>): SignalsTuple<T | undefined>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ComponentStorage<T> {
|
|
2
|
+
get: () => T | undefined;
|
|
3
|
+
set: (value: T) => void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new sessionStorage-based component storage.
|
|
7
|
+
* @param key - session storage key to use.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createComponentSessionStorage<T>(key: string): ComponentStorage<T>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MethodName } from '@tma.js/bridge';
|
|
2
|
+
import { Computed } from '@tma.js/signals';
|
|
3
|
+
import { Version } from '@tma.js/types';
|
|
4
|
+
import { MaybeAccessor } from '../types.js';
|
|
5
|
+
export declare function createIsSupportedSignal(method: MethodName, version: MaybeAccessor<Version>): Computed<boolean>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sets CSS variable globally.
|
|
3
|
+
* @param name - variable name.
|
|
4
|
+
* @param value - variable value.
|
|
5
|
+
*/
|
|
6
|
+
export declare function setCssVar(name: string, value: string | null): void;
|
|
7
|
+
/**
|
|
8
|
+
* Deletes specified CSS variable.
|
|
9
|
+
* @param name - variable name.
|
|
10
|
+
*/
|
|
11
|
+
export declare function deleteCssVar(name: string): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as E from 'fp-ts/Either';
|
|
2
|
+
/**
|
|
3
|
+
* @param color - color in any format acceptable by the `toRGB` function.
|
|
4
|
+
* @returns True if the color is recognized as dark.
|
|
5
|
+
* @see toRGB
|
|
6
|
+
*/
|
|
7
|
+
export declare function isColorDarkFp(color: string): E.Either<Error, boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* @see isColorDarkFp
|
|
10
|
+
*/
|
|
11
|
+
export declare const isColorDark: ((color: string) => boolean) & {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UnionRequiredKeys } from '@tma.js/toolkit';
|
|
2
|
+
type RemoveUndefined<T> = {
|
|
3
|
+
[K in UnionRequiredKeys<T>]-?: T[K];
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* @returns Object with keys having undefined values.
|
|
7
|
+
* @param value - an object to remove undefined values from.
|
|
8
|
+
*/
|
|
9
|
+
export declare function removeUndefined<T extends {}>(value: T): RemoveUndefined<T>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function shallowEqual<T extends object>(a: T, b: T): boolean;
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -1,168 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export * from './
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export * from './
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
*
|
|
18
|
-
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export * from './
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export {
|
|
33
|
-
export {
|
|
34
|
-
export type { BackButtonEventListener, BackButtonEventName, BackButtonEvents, BackButtonState, } from './components/BackButton/types.js';
|
|
35
|
-
export { BiometryManager } from './components/BiometryManager/BiometryManager.js';
|
|
36
|
-
export { initBiometryManager } from './components/BiometryManager/initBiometryManager.js';
|
|
37
|
-
export { requestBiometryInfo } from './components/BiometryManager/requestBiometryInfo.js';
|
|
38
|
-
export type { BiometryManagerAuthenticateOptions, BiometryManagerProps, BiometryManagerRequestAccessOptions, BiometryManagerUpdateTokenOptions, BiometryManagerState, } from './components/BiometryManager/types.js';
|
|
39
|
-
export { ClosingBehavior } from './components/ClosingBehavior/ClosingBehavior.js';
|
|
40
|
-
export { initClosingBehavior } from './components/ClosingBehavior/initClosingBehavior.js';
|
|
41
|
-
export type { ClosingBehaviorEventListener, ClosingBehaviorEventName, ClosingBehaviorEvents, ClosingBehaviorState, } from './components/ClosingBehavior/types.js';
|
|
42
|
-
export { CloudStorage } from './components/CloudStorage/CloudStorage.js';
|
|
43
|
-
export { initCloudStorage } from './components/CloudStorage/initCloudStorage.js';
|
|
44
|
-
export { HapticFeedback } from './components/HapticFeedback/HapticFeedback.js';
|
|
45
|
-
export { initHapticFeedback } from './components/HapticFeedback/initHapticFeedback.js';
|
|
46
|
-
export { InitData } from './components/InitData/InitData.js';
|
|
47
|
-
export { initInitData } from './components/InitData/initInitData.js';
|
|
48
|
-
export { parseInitData } from './components/InitData/parseInitData.js';
|
|
49
|
-
export type { Chat, ChatType, User, InitDataParsed, } from './components/InitData/types.js';
|
|
50
|
-
export { initInvoice } from './components/Invoice/initInvoice.js';
|
|
51
|
-
export { Invoice } from './components/Invoice/Invoice.js';
|
|
52
|
-
export type { InvoiceEventListener, InvoiceEventName, InvoiceEvents, InvoiceState, } from './components/Invoice/types.js';
|
|
53
|
-
export { initMainButton } from './components/MainButton/initMainButton.js';
|
|
54
|
-
export { MainButton } from './components/MainButton/MainButton.js';
|
|
55
|
-
export type { MainButtonEventListener, MainButtonEventName, MainButtonEvents, MainButtonParams, MainButtonProps, MainButtonState, } from './components/MainButton/types.js';
|
|
56
|
-
export { initMiniApp } from './components/MiniApp/initMiniApp.js';
|
|
57
|
-
export { MiniApp } from './components/MiniApp/MiniApp.js';
|
|
58
|
-
export type { MiniAppEventListener, MiniAppEventName, MiniAppEvents, MiniAppHeaderColor, MiniAppProps, MiniAppState, RequestedContact, } from './components/MiniApp/types.js';
|
|
59
|
-
export { initPopup } from './components/Popup/initPopup.js';
|
|
60
|
-
export { Popup } from './components/Popup/Popup.js';
|
|
61
|
-
export type { OpenPopupOptions, OpenPopupOptionsButton, PopupEventListener, PopupEventName, PopupEvents, PopupState, } from './components/Popup/types.js';
|
|
62
|
-
export { initQRScanner } from './components/QRScanner/initQRScanner.js';
|
|
63
|
-
export { QRScanner } from './components/QRScanner/QRScanner.js';
|
|
64
|
-
export type { QRScannerEventListener, QRScannerEventName, QRScannerEvents, QRScannerState, QRScannerOpenOptions } from './components/QRScanner/types.js';
|
|
65
|
-
export { initSettingsButton } from './components/SettingsButton/initSettingsButton.js';
|
|
66
|
-
export { SettingsButton } from './components/SettingsButton/SettingsButton.js';
|
|
67
|
-
export type { SettingsButtonEventListener, SettingsButtonEventName, SettingsButtonEvents, SettingsButtonState, } from './components/SettingsButton/types.js';
|
|
68
|
-
export { initThemeParams } from './components/ThemeParams/initThemeParams.js';
|
|
69
|
-
export { parseThemeParams } from './components/ThemeParams/parsing/parseThemeParams.js';
|
|
70
|
-
export { serializeThemeParams } from './components/ThemeParams/parsing/serializeThemeParams.js';
|
|
71
|
-
export { requestThemeParams } from './components/ThemeParams/requestThemeParams.js';
|
|
72
|
-
export { ThemeParams } from './components/ThemeParams/ThemeParams.js';
|
|
73
|
-
export type { ThemeParamsEventListener, ThemeParamsEventName, ThemeParamsEvents, ThemeParamsKey, ThemeParamsParsed, ThemeParamsState, } from './components/ThemeParams/types.js';
|
|
74
|
-
export { initUtils } from './components/Utils/initUtils.js';
|
|
75
|
-
export { Utils } from './components/Utils/Utils.js';
|
|
76
|
-
export { initViewport } from './components/Viewport/initViewport.js';
|
|
77
|
-
export { requestViewport, type RequestViewportResult, } from './components/Viewport/requestViewport.js';
|
|
78
|
-
export type { ViewportEventListener, ViewportEventName, ViewportEvents, ViewportProps, ViewportState, } from './components/Viewport/types.js';
|
|
79
|
-
export { Viewport } from './components/Viewport/Viewport.js';
|
|
80
|
-
/**
|
|
81
|
-
* CSS Vars.
|
|
82
|
-
*/
|
|
83
|
-
export { bindMiniAppCSSVars, type GetMiniAppCSSVarNameFn } from './css-vars/bindMiniAppCSSVars.js';
|
|
84
|
-
export { bindThemeParamsCSSVars, type GetThemeParamsCSSVarNameFn, } from './css-vars/bindThemeParamsCSSVars.js';
|
|
85
|
-
export { bindViewportCSSVars, type GetViewportCSSVarNameFn, } from './css-vars/bindViewportCSSVars.js';
|
|
86
|
-
export { setCSSVar } from './css-vars/setCSSVar.js';
|
|
87
|
-
/**
|
|
88
|
-
* Debug.
|
|
89
|
-
*/
|
|
90
|
-
export { setDebug } from './debug/debug.js';
|
|
91
|
-
/**
|
|
92
|
-
* Env.
|
|
93
|
-
*/
|
|
94
|
-
export { initWeb } from './env/initWeb.js';
|
|
95
|
-
export { isIframe } from './env/isIframe.js';
|
|
96
|
-
export { isSSR } from './env/isSSR.js';
|
|
97
|
-
export { isTMA } from './env/isTMA.js';
|
|
98
|
-
export { mockTelegramEnv } from './env/mockTelegramEnv.js';
|
|
99
|
-
/**
|
|
100
|
-
* Errors.
|
|
101
|
-
*/
|
|
102
|
-
export * from './errors/errors.js';
|
|
103
|
-
export { isSDKError } from './errors/isSDKError.js';
|
|
104
|
-
export { isSDKErrorOfType } from './errors/isSDKErrorOfType.js';
|
|
105
|
-
export { SDKError } from './errors/SDKError.js';
|
|
106
|
-
/**
|
|
107
|
-
* Events.
|
|
108
|
-
*/
|
|
109
|
-
export { EventEmitter } from './events/event-emitter/EventEmitter.js';
|
|
110
|
-
export * from './events/event-emitter/types.js';
|
|
111
|
-
export * from './events/types.js';
|
|
112
|
-
/**
|
|
113
|
-
* Launch params.
|
|
114
|
-
*/
|
|
115
|
-
export { parseLaunchParams } from './launch-params/parseLaunchParams.js';
|
|
116
|
-
export { retrieveLaunchParams } from './launch-params/retrieveLaunchParams.js';
|
|
117
|
-
export { serializeLaunchParams } from './launch-params/serializeLaunchParams.js';
|
|
118
|
-
export * from './launch-params/types.js';
|
|
119
|
-
/**
|
|
120
|
-
* Misc.
|
|
121
|
-
*/
|
|
122
|
-
export type { FactoryOptions, FactoryStatic, Factory, FactoryDynamic, InitComponentFn, InitStaticComponentFn, InitDynamicComponentFn, WithOnChange, } from './misc/createComponentInitFn/types.js';
|
|
123
|
-
/**
|
|
124
|
-
* Navigation.
|
|
125
|
-
*/
|
|
126
|
-
export { BasicNavigator } from './navigation/BasicNavigator/BasicNavigator.js';
|
|
127
|
-
export type { BasicNavigatorAnyHistoryItem, BasicNavigatorEvents, BasicNavigatorHistoryItem, } from './navigation/BasicNavigator/types.js';
|
|
128
|
-
export { BrowserNavigator } from './navigation/BrowserNavigator/BrowserNavigator.js';
|
|
129
|
-
export { createBrowserNavigatorFromLocation, } from './navigation/BrowserNavigator/createBrowserNavigatorFromLocation.js';
|
|
130
|
-
export { createSafeURL } from './navigation/createSafeURL.js';
|
|
131
|
-
export { getHash } from './navigation/getHash.js';
|
|
132
|
-
export { getPathname } from './navigation/getPathname.js';
|
|
133
|
-
export { initNavigator } from './navigation/initNavigator.js';
|
|
134
|
-
export { isPageReload } from './navigation/isPageReload.js';
|
|
135
|
-
export { urlToPath } from './navigation/urlToPath.js';
|
|
136
|
-
export type { BrowserNavigatorAnyHistoryItem, BrowserNavigatorConOptions, BrowserNavigatorEvents, BrowserNavigatorHashMode, BrowserNavigatorHistoryItem, URLLike, } from './navigation/BrowserNavigator/types.js';
|
|
137
|
-
/**
|
|
138
|
-
* Parsing.
|
|
139
|
-
*/
|
|
140
|
-
export { array } from './parsing/parsers/array.js';
|
|
141
|
-
export { boolean } from './parsing/parsers/boolean.js';
|
|
142
|
-
export { date } from './parsing/parsers/date.js';
|
|
143
|
-
export { json } from './parsing/parsers/json.js';
|
|
144
|
-
export { number } from './parsing/parsers/number.js';
|
|
145
|
-
export { rgb } from './parsing/parsers/rgb.js';
|
|
146
|
-
export { searchParams } from './parsing/parsers/searchParams.js';
|
|
147
|
-
export { string } from './parsing/parsers/string.js';
|
|
148
|
-
/**
|
|
149
|
-
* Request ID
|
|
150
|
-
*/
|
|
151
|
-
export type { RequestId } from './request-id/types.js';
|
|
152
|
-
/**
|
|
153
|
-
* Supports.
|
|
154
|
-
*/
|
|
155
|
-
export { supports } from './supports/supports.js';
|
|
156
|
-
/**
|
|
157
|
-
* Timeout.
|
|
158
|
-
*/
|
|
159
|
-
export { withTimeout } from './timeout/withTimeout.js';
|
|
160
|
-
/**
|
|
161
|
-
* Types.
|
|
162
|
-
*/
|
|
163
|
-
export * from './types/index.js';
|
|
164
|
-
/**
|
|
165
|
-
* Version.
|
|
166
|
-
*/
|
|
167
|
-
export { compareVersions } from './version/compareVersions.js';
|
|
168
|
-
export type { Version } from './version/types.js';
|
|
1
|
+
export * from './features/BackButton/exports.js';
|
|
2
|
+
export * from './features/Biometry/exports.js';
|
|
3
|
+
export * from './features/ClosingBehavior/exports.js';
|
|
4
|
+
export * from './features/CloudStorage/exports.js';
|
|
5
|
+
export * from './features/emoji-status/exports.js';
|
|
6
|
+
export * from './features/HapticFeedback/exports.js';
|
|
7
|
+
export * from './features/home-screen/exports.js';
|
|
8
|
+
export * from './features/InitData/exports.js';
|
|
9
|
+
export * from './features/Invoice/exports.js';
|
|
10
|
+
export * from './features/links/exports.js';
|
|
11
|
+
export * from './features/LocationManager/exports.js';
|
|
12
|
+
export * from './features/MainButton/exports.js';
|
|
13
|
+
export * from './features/MiniApp/exports.js';
|
|
14
|
+
export * from './features/Popup/exports.js';
|
|
15
|
+
export * from './features/privacy/exports.js';
|
|
16
|
+
export * from './features/QrScanner/exports.js';
|
|
17
|
+
export * from './features/SecondaryButton/exports.js';
|
|
18
|
+
export * from './features/SettingsButton/exports.js';
|
|
19
|
+
export * from './features/SwipeBehavior/exports.js';
|
|
20
|
+
export * from './features/ThemeParams/exports.js';
|
|
21
|
+
export * from './features/uncategorized/exports.js';
|
|
22
|
+
export * from './features/Viewport/exports.js';
|
|
23
|
+
export { createRequestId } from './globals/createRequestId.js';
|
|
24
|
+
export { invokeCustomMethod } from './globals/invokeCustomMethod.js';
|
|
25
|
+
export { postEvent, postEventFp } from './globals/post-event.js';
|
|
26
|
+
export { request, requestFp } from './globals/request.js';
|
|
27
|
+
export { isColorDark, isColorDarkFp } from './helpers/isColorDark.js';
|
|
28
|
+
export * from './errors.js';
|
|
29
|
+
export { init, initFp, type InitOptions } from './init.js';
|
|
30
|
+
export type { AsyncOptions } from './types.js';
|
|
31
|
+
export { isTMA, isTMAFp, type isTMAError, mockTelegramEnv, off, offAll, on, type EventListener, type SubscribeListener, type Events, type WriteAccessRequestedStatus, type EmojiStatusAccessRequestedStatus, type BiometryAuthRequestStatus, type BiometryTokenUpdateStatus, type BiometryType, type EmojiStatusFailedError, type EventName, type EventPayload, type EventWithoutPayload, type EventWithPayload, type PhoneRequestedStatus, type FullScreenErrorStatus, type HomeScreenStatus, type InvoiceStatus, type SafeAreaInsets, createPostEvent, type CreatePostEventMode, type OnUnsupportedFn, getReleaseVersion, type PostEventFn, type PostEventFpFn, type PostEventError, supports, type AnyHapticFeedbackParams, type AnyInvokeCustomMethodParams, type CreateMethodParams, type CustomMethodName, type ImpactHapticFeedbackParams, type ImpactHapticFeedbackStyle, type CustomMethodsParams, type CustomMethodParams, type MethodName, type MethodVersionedParams, type NotificationHapticFeedbackParams, type NotificationHapticFeedbackType, type Methods, type SelectionHapticFeedbackParams, type MethodNameWithOptionalParams, type MethodNameWithoutParams, type MethodNameWithRequiredParams, type MethodNameWithVersionedParams, type MethodParams, type PopupParams, type BackgroundColor, type BottomBarColor, type HeaderColorKey, type PopupButton, type OpenLinkBrowser, type SecondaryButtonPosition, type SwitchInlineQueryChatType, type InvokeCustomMethodFn, type InvokeCustomMethodOptions, type InvokeCustomMethodFpFn, type InvokeCustomMethodError, type InvokeCustomMethodFpOptions, type RequestCaptureEventFn, type RequestCaptureEventsFn, type RequestCaptureFn, type RequestCaptureFnEventsPayload, type RequestFn, type RequestOptions, type RequestResult, type RequestError, type RequestFpOptions, type RequestFpFn, applyPolyfills, decodeBase64Url, encodeBase64Url, decodeBase64UrlFp, type DecodeBase64UrlError, LaunchParamsRetrieveError, InvalidLaunchParamsError, InvokeCustomMethodFailedError, MethodParameterUnsupportedError, MethodUnsupportedError, UnknownEnvError, setDebug, debug, logger, setTargetOrigin, targetOrigin, retrieveLaunchParams, retrieveRawInitData, retrieveRawInitDataFp, retrieveRawLaunchParams, retrieveRawLaunchParamsFp, retrieveLaunchParamsFp, type RetrieveLaunchParamsError, type RetrieveLaunchParamsResult, type RetrieveRawInitDataError, type RetrieveRawLaunchParamsError, createStartParam, createStartParamFp, decodeStartParam, decodeStartParamFp, isSafeToCreateStartParam, createLogger, deepSnakeToCamelObjKeys, type DeepConvertSnakeKeysToCamelCase, type Logger, type LoggerFn, type LoggerForceFn, type LoggerOptions, type LogLevel, CancelledError, TimeoutError, } from '@tma.js/bridge';
|
|
32
|
+
export { parseInitDataQuery, parseInitDataQueryFp, type ParseInitDataQueryError, parseLaunchParamsQuery, parseLaunchParamsQueryFp, type ParseLaunchParamsQueryError, isRGBShort, isRGBAShort, isRGB, isRGBA, isAnyRGB, toRGBFullFp, toRGBFp, toRGB, toRGBFull, serializeInitDataQuery, type InitDataLike, serializeLaunchParamsQuery, type LaunchParamsLike, } from '@tma.js/transformers';
|
|
33
|
+
export type { RGB, User, Chat, InitData, ChatType, Platform, ThemeParams, LaunchParams, KnownThemeParamsKey, Version, } from '@tma.js/types';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { RetrieveLaunchParamsError, PostEventError, PostEventFpFn } from '@tma.js/bridge';
|
|
2
|
+
import { Version, ThemeParams } from '@tma.js/types';
|
|
3
|
+
import * as E from 'fp-ts/Either';
|
|
4
|
+
export interface InitOptions {
|
|
5
|
+
/**
|
|
6
|
+
* True if SDK should accept styles sent from the Telegram application.
|
|
7
|
+
* @default true
|
|
8
|
+
*/
|
|
9
|
+
acceptCustomStyles?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* True if the application is launched in inline mode.
|
|
12
|
+
* @default Will be calculated based on the launch parameters' tgWebAppBotInline field.
|
|
13
|
+
*/
|
|
14
|
+
isInlineMode?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* A custom `postEvent` function to use across the package.
|
|
17
|
+
* @default tma.js/bridge's postEventFp function will be used.
|
|
18
|
+
*/
|
|
19
|
+
postEvent?: PostEventFpFn;
|
|
20
|
+
/**
|
|
21
|
+
* Mini application theme parameters.
|
|
22
|
+
* @default Will be calculated based on the launch parameters' tgWebAppThemeParams field.
|
|
23
|
+
*/
|
|
24
|
+
themeParams?: ThemeParams;
|
|
25
|
+
/**
|
|
26
|
+
* Telegram Mini Apps version supported by the Telegram client.
|
|
27
|
+
* @default Will be calculated based on the launch parameters' tgWebAppVersion field.
|
|
28
|
+
*/
|
|
29
|
+
version?: Version;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Initializes the SDK allowing it to properly handle events, sent from the native Telegram
|
|
33
|
+
* application. This function also configure the package's global dependencies (functions,
|
|
34
|
+
* variables used across the package).
|
|
35
|
+
* @param options - function options.
|
|
36
|
+
* @returns A function, to perform a cleanup.
|
|
37
|
+
*/
|
|
38
|
+
export declare function initFp(options?: InitOptions): E.Either<RetrieveLaunchParamsError | PostEventError, VoidFunction>;
|
|
39
|
+
/**
|
|
40
|
+
* @see initFp
|
|
41
|
+
*/
|
|
42
|
+
export declare const init: ((options?: InitOptions | undefined) => VoidFunction) & {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AnyFn } from '@tma.js/toolkit';
|
|
2
|
+
import { WithChecksFp, WithChecks } from './withChecksFp.js';
|
|
3
|
+
export declare function throwifyWithChecksFp<Fn extends AnyFn, HasSupportCheck extends boolean, SupportsMapKeySchema extends string>(fn: WithChecksFp<Fn, HasSupportCheck, SupportsMapKeySchema>): WithChecks<Fn, HasSupportCheck, SupportsMapKeySchema>;
|