@telegram-apps/sdk
Advanced tools
Comparing version 2.11.3 to 3.0.0-beta.1
@@ -1,1 +0,6 @@ | ||
export declare const logInfo: (...args: any[]) => void, logError: (...args: any[]) => void; | ||
export declare const logInfo: (force: boolean, ...args: any[]) => void, logError: (force: boolean, ...args: any[]) => void; | ||
/** | ||
* Sets the package debug mode leading to outputting additional logs. | ||
* @param value - enable debug mode. | ||
*/ | ||
export declare function setDebug(value: boolean): void; |
@@ -1,15 +0,9 @@ | ||
export declare const ERR_POPUP_INVALID_PARAMS = "ERR_POPUP_INVALID_PARAMS"; | ||
export declare const ERR_INVALID_URL = "ERR_INVALID_URL"; | ||
export declare const ERR_INVALID_SLUG = "ERR_INVALID_SLUG"; | ||
export declare const ERR_DATA_INVALID_SIZE = "ERR_DATA_INVALID_SIZE"; | ||
export declare const ERR_ACCESS_DENIED = "ERR_ACCESS_DENIED"; | ||
export declare const ERR_ALREADY_REQUESTING = "ERR_ALREADY_REQUESTING"; | ||
export declare const ERR_ALREADY_OPENED = "ERR_ALREADY_OPENED"; | ||
export declare const ERR_ALREADY_MOUNTING = "ERR_ALREADY_MOUNTING"; | ||
export declare const ERR_CSS_VARS_ALREADY_BOUND = "ERR_VARS_ALREADY_BOUND"; | ||
export declare const ERR_NOT_AVAILABLE = "ERR_NOT_AVAILABLE"; | ||
export declare const ERR_NOT_INITIALIZED = "ERR_NOT_INITIALIZED"; | ||
export declare const ERR_NOT_SUPPORTED = "ERR_NOT_SUPPORTED"; | ||
export declare const ERR_NOT_MOUNTED = "ERR_NOT_MOUNTED"; | ||
export declare const ERR_FULLSCREEN_FAILED = "ERR_FULLSCREEN_FAILED"; | ||
export declare const ERR_EMOJI_STATUS_SET_FAILED = "ERR_EMOJI_STATUS_SET_FAILED"; | ||
export declare const CSSVarsBoundError: import('error-kid').CustomErrorClass<[]>, isCSSVarsBoundError: import('error-kid').IsErrorOfKindFn<Error>; | ||
export declare const NotAvailableError: import('error-kid').CustomErrorClass<[message: string]>, isNotAvailableError: import('error-kid').IsErrorOfKindFn<Error>; | ||
export declare const InvalidEnvError: import('error-kid').CustomErrorClass<[message?: string | undefined]>, isInvalidEnvError: import('error-kid').IsErrorOfKindFn<Error>; | ||
export declare const FunctionUnavailableError: import('error-kid').CustomErrorClass<[message?: string | undefined]>, isFunctionNotAvailableError: import('error-kid').IsErrorOfKindFn<Error>; | ||
export declare const InvalidArgumentsError: import('error-kid').CustomErrorClass<[message: string, cause?: unknown]>, isInvalidArguments: import('error-kid').IsErrorOfKindFn<Error>; | ||
export declare const ConcurrentCallError: import('error-kid').CustomErrorClass<[message: string]>, isConcurrentCallError: import('error-kid').IsErrorOfKindFn<Error>; | ||
export declare const SetEmojiStatusError: import('error-kid').CustomErrorClass<[error: string]>, isSetEmojiStatusError: import('error-kid').IsErrorOfKindFn<Error>; | ||
export declare const AccessDeniedError: import('error-kid').CustomErrorClass<[message: string]>, isAccessDeniedError: import('error-kid').IsErrorOfKindFn<Error>; | ||
export declare const FullscreenFailedError: import('error-kid').CustomErrorClass<[message: string]>, isFullscreenFailedError: import('error-kid').IsErrorOfKindFn<Error>; |
@@ -1,3 +0,1 @@ | ||
export { classNames } from './classnames/classNames.js'; | ||
export { mergeClassNames, type MergeClassNames } from './classnames/mergeClassNames.js'; | ||
export * from './scopes/components/back-button/exports.js'; | ||
@@ -24,10 +22,14 @@ export * from './scopes/components/biometry/exports.js'; | ||
export * from './scopes/utilities/uncategorized/exports.js'; | ||
export { $postEvent, $version, $createRequestId } from './scopes/globals.js'; | ||
export { wrapSafe, type WrapSafeOptions, type Supports, type SafeWrapped, type CustomSupportValidatorFn, type IsSupportedType, type IfAvailableFnResult, } from './scopes/wrappers/wrapSafe.js'; | ||
export { ignoreCanceled } from './utils/ignoreCanceled.js'; | ||
export { isColorDark } from './utils/isColorDark.js'; | ||
export { isSSR } from './utils/isSSR.js'; | ||
export { safeCall } from './utils/safeCall.js'; | ||
export { ERR_POPUP_INVALID_PARAMS, ERR_INVALID_URL, ERR_INVALID_SLUG, ERR_ACCESS_DENIED, ERR_DATA_INVALID_SIZE, ERR_NOT_AVAILABLE, ERR_NOT_SUPPORTED, ERR_NOT_MOUNTED, ERR_NOT_INITIALIZED, ERR_ALREADY_OPENED, ERR_CSS_VARS_ALREADY_BOUND, ERR_ALREADY_MOUNTING, ERR_ALREADY_REQUESTING, ERR_FULLSCREEN_FAILED, ERR_EMOJI_STATUS_SET_FAILED, } from './errors.js'; | ||
export { setDebug } from './debug.js'; | ||
export * from './errors.js'; | ||
export { invokeCustomMethod, postEvent, createRequestId, configure, request, type ConfigureOptions, } from './globals.js'; | ||
export { init, type InitOptions } from './init.js'; | ||
export { CancelablePromise, defineEventHandlers, emitMiniAppsEvent, isIframe, removeEventHandlers, compareVersions, createPostEvent, $debug, ERR_CANCELED, ERR_ABORTED, ERR_METHOD_PARAMETER_UNSUPPORTED, ERR_METHOD_UNSUPPORTED, ERR_TIMED_OUT, ERR_UNKNOWN_ENV, ERR_RETRIEVE_LP_FAILED, ERR_CUSTOM_METHOD_ERR_RESPONSE, invokeCustomMethod, isTMA, on, off, postEvent, $targetOrigin, request, subscribe, supports, unsubscribe, mockTelegramEnv, deleteCssVar, setCssVar, isAbortError, isTimeoutError, isCanceledError, addEventListener, retrieveLaunchParams, TypedError, } from '@telegram-apps/bridge'; | ||
export type { AsyncOptions, AnyHapticFeedbackParams, AnyInvokeCustomMethodParams, BottomBarColor, BiometryAuthRequestStatus, BiometryTokenUpdateStatus, BiometryType, Chat, ChatType, CustomMethodName, CustomMethodParams, CustomMethodsParams, CreateMethodParams, EventListener, EventName, EventPayload, Events, ExecuteWithOptions, ExecuteWithPostEvent, FullScreenErrorStatus, HeaderColorKey, ImpactHapticFeedbackParams, ImpactHapticFeedbackStyle, InvoiceStatus, LaunchParams, MethodName, MethodNameWithOptionalParams, MethodNameWithoutParams, MethodNameWithRequiredParams, MethodNameWithVersionedParams, MethodParams, Methods, MethodVersionedParams, NotificationHapticFeedbackParams, NotificationHapticFeedbackType, OpenLinkBrowser, OnUnsupportedFn, PhoneRequestedStatus, Platform, PopupButton, PopupParams, PostEventFn, RequestCaptureEventFn, RequestCaptureEventsFn, RGB, RGBShort, SelectionHapticFeedbackParams, SwitchInlineQueryChatType, ThemeParamsKey, User, Version, WriteAccessRequestedStatus, CreatePostEventMode, RequestBasicOptions, RequestCaptureFn, RequestFn, RequestResult, SubscribeListener, TypedErrorOptions, } from '@telegram-apps/bridge'; | ||
export { isRGB, isRGBShort, isRecord, toRecord, toRGB, ERR_UNEXPECTED_VALUE, ERR_PARSE, ERR_INVALID_VALUE, ERR_UNEXPECTED_TYPE, serializeLaunchParams, serializeThemeParams, } from '@telegram-apps/transformers'; | ||
export type { RequestOptionsNoCapture, AsyncOptions } from './types.js'; | ||
export { isTMA, mockTelegramEnv, targetOrigin, on, off, retrieveLaunchParams, type RetrieveLPResult, type RetrieveLPResultCamelCased, type RequestOptions, type InvokeCustomMethodOptions, type EventListener, type SubscribeListener, type EventPayload, type WriteAccessRequestedStatus, UnknownEnvError, isUnknownEnvError, createPostEvent, type CreatePostEventMode, InvokeCustomMethodError, isInvokeCustomMethodError, MethodParameterUnsupportedError, isMethodMethodParameterUnsupportedError, type CustomMethodName, type CustomMethodParams, type CreateMethodParams, type Methods, type AnyInvokeCustomMethodParams, type Events, isMethodUnsupportedError, type EventWithoutPayload, type EventWithPayload, type CustomMethodsParams, type InvokeCustomMethodFn, supports, emitEvent, MethodUnsupportedError, type EmojiStatusAccessRequestedStatus, type HomeScreenStatus, type OnUnsupportedFn, type ImpactHapticFeedbackParams, type ImpactHapticFeedbackStyle, type MethodName, type MethodParams, type PostEventFn, type NotificationHapticFeedbackParams, type RequestFn, type BiometryAuthRequestStatus, type PhoneRequestedStatus, type SafeAreaInsets, type BiometryType, type BiometryTokenUpdateStatus, type EventName, type NotificationHapticFeedbackType, type SelectionHapticFeedbackParams, type MethodNameWithoutParams, type MethodNameWithOptionalParams, type MethodNameWithRequiredParams, type EmojiStatusFailedError, type FullScreenErrorStatus, type InvoiceStatus, type RequestResult, isLaunchParamsRetrieveError, LaunchParamsRetrieveError, type BackgroundColor, type PopupParams, type BottomBarColor, type PopupButton, type HeaderColorKey, type OpenLinkBrowser, type SecondaryButtonPosition, type SwitchInlineQueryChatType, } from '@telegram-apps/bridge'; | ||
export { isRGB, toRGB, isRGBShort } from '@telegram-apps/transformers'; | ||
export type { RGB, User, Chat, InitData, ChatType, RGBShort, Platform, ThemeParams, LaunchParams, KnownThemeParamsKey, Version, } from '@telegram-apps/types'; |
@@ -1,2 +0,2 @@ | ||
import { ConfigureOptions } from './scopes/globals.js'; | ||
import { ConfigureOptions } from './globals.js'; | ||
export interface InitOptions extends ConfigureOptions { | ||
@@ -3,0 +3,0 @@ /** |
@@ -5,7 +5,7 @@ import { EventListener } from '@telegram-apps/bridge'; | ||
*/ | ||
export declare const isVisible: import('@telegram-apps/signals').Signal<boolean>; | ||
export declare const _isVisible: import('@telegram-apps/signals').Signal<boolean>, isVisible: import('@telegram-apps/signals').Computed<boolean>; | ||
/** | ||
* Signal indicating if the Back Button is currently mounted. | ||
*/ | ||
export declare const isMounted: import('@telegram-apps/signals').Signal<boolean>; | ||
export declare const _isMounted: import('@telegram-apps/signals').Signal<boolean>, isMounted: import('@telegram-apps/signals').Computed<boolean>; | ||
/** | ||
@@ -17,6 +17,7 @@ * Signal indicating if the Back Button is supported. | ||
* Hides the Back Button. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @param | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @since Mini Apps v6.1 | ||
@@ -28,8 +29,9 @@ * @example | ||
*/ | ||
export declare const hide: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
export declare const hide: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
/** | ||
* Mounts the Back Button restoring its state. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @param | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @since Mini Apps v6.1 | ||
@@ -41,3 +43,3 @@ * @example | ||
*/ | ||
export declare const mount: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
export declare const mount: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
/** | ||
@@ -47,5 +49,5 @@ * Adds a new Back Button click listener. | ||
* @returns A function to remove bound listener. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @since Mini Apps v6.1 | ||
@@ -60,9 +62,9 @@ * @example | ||
*/ | ||
export declare const onClick: import('../../toolkit/wrapSafe.js').SafeWrapped<(fn: EventListener<"back_button_pressed">) => VoidFunction, true, never>; | ||
export declare const onClick: import('../../wrappers/wrapSafe.js').SafeWrapped<(fn: EventListener<"back_button_pressed">) => VoidFunction, true, never>; | ||
/** | ||
* Removes the Back Button click listener. | ||
* @param fn - an event listener. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @since Mini Apps v6.1 | ||
@@ -78,9 +80,9 @@ * @example | ||
*/ | ||
export declare const offClick: import('../../toolkit/wrapSafe.js').SafeWrapped<(fn: EventListener<"back_button_pressed">) => void, true, never>; | ||
export declare const offClick: import('../../wrappers/wrapSafe.js').SafeWrapped<(fn: EventListener<"back_button_pressed">) => void, true, never>; | ||
/** | ||
* Shows the Back Button. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @since Mini Apps v6.1 | ||
@@ -92,3 +94,3 @@ * @example | ||
*/ | ||
export declare const show: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
export declare const show: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
/** | ||
@@ -95,0 +97,0 @@ * Unmounts the Back Button. |
@@ -1,1 +0,1 @@ | ||
export * from './back-button.js'; | ||
export { isSupported, isMounted, mount, offClick, onClick, show, isVisible, unmount, hide, } from './back-button.js'; |
@@ -1,4 +0,4 @@ | ||
export { authenticate as authenticateBiometry, isMounting as isBiometryMounting, isMounted as isBiometryMounted, isSupported as isBiometrySupported, mount as mountBiometry, mountError as biometryMountError, openSettings as openBiometrySettings, requestAccess as requestBiometryAccess, state as biometryState, unmount as unmountBiometry, updateToken as updateBiometryToken, isAuthenticating as isAuthenticatingBiometry, isRequestingAccess as isRequestingBiometryAccess, } from './exports.variable.js'; | ||
export { authenticate as authenticateBiometry, isMounting as isBiometryMounting, isMounted as isBiometryMounted, isSupported as isBiometrySupported, mount as mountBiometry, mountError as biometryMountError, openSettings as openBiometrySettings, requestAccess as requestBiometryAccess, state as biometryState, unmount as unmountBiometry, updateToken as updateBiometryToken, isAuthenticating as isAuthenticatingBiometry, isRequestingAccess as isRequestingBiometryAccess, requestAccessPromise as requestBiometryAccessPromise, requestAccessError as requestBiometryAccessError, mountPromise as mountBiometryPromise, authError as biometryAuthError, authPromise as biometryAuthPromise, isAvailable as isBiometryAvailable, } from './exports.variable.js'; | ||
export * as biometry from './exports.variable.js'; | ||
export { requestBiometry } from './requestBiometry.js'; | ||
export type { AuthenticateOptions as AuthenticateBiometryOptions, State as BiometryState, RequestAccessOptions as RequestBiometryAccessOptions, UpdateTokenOptions as UpdateBiometryTokenOptions, } from './types.js'; |
@@ -1,2 +0,2 @@ | ||
export * from './methods.js'; | ||
export * from './signals.js'; | ||
export { isMounted, mountPromise, mountError, authPromise, authError, isMounting, requestAccessPromise, mount, unmount, isSupported, openSettings, requestAccess, isRequestingAccess, isAuthenticating, authenticate, updateToken, requestAccessError, } from './methods.js'; | ||
export { state, isAvailable } from './signals.js'; |
@@ -1,2 +0,3 @@ | ||
import { CancelablePromise, BiometryTokenUpdateStatus, BiometryAuthRequestStatus } from '@telegram-apps/bridge'; | ||
import { BiometryTokenUpdateStatus, BiometryAuthRequestStatus } from '@telegram-apps/bridge'; | ||
import { AbortablePromise } from 'better-promises'; | ||
import { AuthenticateOptions, RequestAccessOptions, UpdateTokenOptions } from './types.js'; | ||
@@ -8,2 +9,17 @@ /** | ||
/** | ||
* Mounts the Biometry component. | ||
* @since Mini Apps v7.2 | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
* if (mount.isAvailable()) { | ||
* await mount(); | ||
* } | ||
*/ | ||
export declare const mount: import('../../wrappers/wrapSafe.js').SafeWrapped<(abortSignal: any) => AbortablePromise<void>, false, never>; | ||
export declare const mountPromise: import('@telegram-apps/signals').Computed<AbortablePromise<any> | undefined>, isMounting: import('@telegram-apps/signals').Computed<boolean>; | ||
export declare const mountError: import('@telegram-apps/signals').Computed<Error | undefined>; | ||
export declare const _isMounted: import('@telegram-apps/signals').Signal<boolean>, isMounted: import('@telegram-apps/signals').Computed<boolean>; | ||
/** | ||
* Attempts to authenticate a user using biometrics and fetch a previously stored secure token. | ||
@@ -13,8 +29,8 @@ * @param options - method options. | ||
* @returns Token from the local secure storage saved previously or undefined. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {TypedError} ERR_ALREADY_REQUESTING | ||
* @throws {TypedError} ERR_NOT_AVAILABLE | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @throws {ConcurrentCallError} Biometry authentication is already in progress | ||
* @throws {NotAvailableError} Biometry is not available | ||
* @example | ||
@@ -27,3 +43,3 @@ * if (authenticate.isAvailable()) { | ||
*/ | ||
export declare const authenticate: import('../../toolkit/wrapSafe.js').SafeWrapped<(options?: AuthenticateOptions) => CancelablePromise<{ | ||
export declare const authenticate: import('../../wrappers/wrapSafe.js').SafeWrapped<(options?: AuthenticateOptions) => AbortablePromise<{ | ||
/** | ||
@@ -38,2 +54,13 @@ * Authentication status. | ||
}>, true, never>; | ||
export declare const authPromise: import('@telegram-apps/signals').Computed<AbortablePromise<{ | ||
/** | ||
* Authentication status. | ||
*/ | ||
status: BiometryAuthRequestStatus; | ||
/** | ||
* Token from the local secure storage saved previously. | ||
*/ | ||
token?: string; | ||
}> | undefined>, isAuthenticating: import('@telegram-apps/signals').Computed<boolean>; | ||
export declare const authError: import('@telegram-apps/signals').Computed<Error | undefined>; | ||
/** | ||
@@ -46,5 +73,5 @@ * Opens the biometric access settings for bots. Useful when you need to request biometrics | ||
* @since Mini Apps v7.2 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -55,3 +82,3 @@ * if (openSettings.isAvailable()) { | ||
*/ | ||
export declare const openSettings: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
export declare const openSettings: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
/** | ||
@@ -61,8 +88,8 @@ * Requests permission to use biometrics. | ||
* @returns Promise with true, if access was granted. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {TypedError} ERR_ALREADY_REQUESTING | ||
* @throws {TypedError} ERR_NOT_AVAILABLE | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @throws {ConcurrentCallError} Biometry access request is already in progress | ||
* @throws {NotAvailableError} Biometry is not available | ||
* @example | ||
@@ -75,16 +102,6 @@ * if (requestAccess.isAvailable()) { | ||
*/ | ||
export declare const requestAccess: import('../../toolkit/wrapSafe.js').SafeWrapped<(options?: RequestAccessOptions) => CancelablePromise<boolean>, true, never>; | ||
export declare const requestAccess: import('../../wrappers/wrapSafe.js').SafeWrapped<(options?: RequestAccessOptions) => AbortablePromise<boolean>, true, never>; | ||
export declare const requestAccessPromise: import('@telegram-apps/signals').Computed<AbortablePromise<boolean> | undefined>, isRequestingAccess: import('@telegram-apps/signals').Computed<boolean>; | ||
export declare const requestAccessError: import('@telegram-apps/signals').Computed<Error | undefined>; | ||
/** | ||
* Mounts the Biometry component. | ||
* @since Mini Apps v7.2 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @example | ||
* if (mount.isAvailable()) { | ||
* await mount(); | ||
* } | ||
*/ | ||
export declare const mount: import('../../toolkit/wrapSafe.js').SafeWrapped<(options?: import('@telegram-apps/bridge').AsyncOptions) => CancelablePromise<void>, false, never>; | ||
/** | ||
* Unmounts the component. | ||
@@ -97,6 +114,6 @@ */ | ||
* @returns Promise with `true`, if token was updated. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @example Setting a new token | ||
@@ -113,2 +130,2 @@ * if (updateToken.isAvailable()) { | ||
*/ | ||
export declare const updateToken: import('../../toolkit/wrapSafe.js').SafeWrapped<(options?: UpdateTokenOptions) => CancelablePromise<BiometryTokenUpdateStatus>, true, never>; | ||
export declare const updateToken: import('../../wrappers/wrapSafe.js').SafeWrapped<(options?: UpdateTokenOptions) => AbortablePromise<BiometryTokenUpdateStatus>, true, never>; |
@@ -1,3 +0,4 @@ | ||
import { ExecuteWithOptions, CancelablePromise } from '@telegram-apps/bridge'; | ||
import { State } from './types.js'; | ||
import { EventPayload } from '@telegram-apps/bridge'; | ||
import { AbortablePromise } from 'better-promises'; | ||
import { RequestOptionsNoCapture } from '../../../types.js'; | ||
/** | ||
@@ -7,5 +8,5 @@ * Requests biometry information. | ||
* @param options - additional execution options. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -16,2 +17,2 @@ * if (requestBiometry.isAvailable()) { | ||
*/ | ||
export declare const requestBiometry: import('../../toolkit/wrapSafe.js').SafeWrapped<(options?: ExecuteWithOptions) => CancelablePromise<State>, true, never>; | ||
export declare const requestBiometry: import('../../wrappers/wrapSafe.js').SafeWrapped<(options?: RequestOptionsNoCapture) => AbortablePromise<EventPayload<"biometry_info_received">>, true, never>; |
@@ -1,2 +0,1 @@ | ||
import { CancelablePromise } from '@telegram-apps/toolkit'; | ||
import { State } from './types.js'; | ||
@@ -6,30 +5,6 @@ /** | ||
*/ | ||
export declare const state: import('@telegram-apps/signals').Signal<State>; | ||
export declare const _state: import('@telegram-apps/signals').Signal<State>, state: import('@telegram-apps/signals').Computed<State>; | ||
/** | ||
* True if the manager is currently authenticating. | ||
*/ | ||
export declare const isAuthenticating: import('@telegram-apps/signals').Signal<boolean>; | ||
/** | ||
* True if the manager is currently requesting access. | ||
*/ | ||
export declare const isRequestingAccess: import('@telegram-apps/signals').Signal<boolean>; | ||
/** | ||
* Signal indicating if the component is currently mounted. | ||
*/ | ||
export declare const isMounted: import('@telegram-apps/signals').Signal<boolean>; | ||
/** | ||
* Signal indicating if the component is currently mounting. | ||
*/ | ||
export declare const isMounting: import('@telegram-apps/signals').Computed<boolean>; | ||
/** | ||
* Signal containing the error occurred during mount. | ||
*/ | ||
export declare const mountError: import('@telegram-apps/signals').Signal<Error | undefined>; | ||
/** | ||
* Signal containing the mount process promise. | ||
*/ | ||
export declare const mountPromise: import('@telegram-apps/signals').Signal<CancelablePromise<State> | undefined>; | ||
/** | ||
* Signal indicating biometry is available. | ||
*/ | ||
export declare const isAvailable: import('@telegram-apps/signals').Computed<boolean>; |
@@ -1,13 +0,9 @@ | ||
import { BiometryType, AsyncOptions } from '@telegram-apps/bridge'; | ||
export type State = { | ||
import { BiometryType } from '@telegram-apps/bridge'; | ||
import { RequestOptionsNoCapture } from '../../../types.js'; | ||
export interface State { | ||
/** | ||
* If true, indicates that biometric authentication is available on the current device. | ||
*/ | ||
available: false; | ||
} | { | ||
available: boolean; | ||
/** | ||
* If true, indicates that biometric authentication is available on the current device. | ||
*/ | ||
available: true; | ||
/** | ||
* Indicates whether the app has previously requested permission to use biometrics. | ||
@@ -45,5 +41,5 @@ */ | ||
token?: string; | ||
}; | ||
} | ||
type Maybe<T> = T | null | undefined; | ||
export interface AuthenticateOptions extends AsyncOptions { | ||
export interface AuthenticateOptions extends RequestOptionsNoCapture { | ||
/** | ||
@@ -55,3 +51,3 @@ * Reason to request biometry data. Should be at least 1 symbol length, but not more than | ||
} | ||
export interface UpdateTokenOptions extends AsyncOptions { | ||
export interface UpdateTokenOptions extends RequestOptionsNoCapture { | ||
/** | ||
@@ -67,3 +63,3 @@ * Optional string field, containing the reason why the bot is asking to authenticate using biometrics (1-128 chars, used in the prompt). | ||
} | ||
export interface RequestAccessOptions extends AsyncOptions { | ||
export interface RequestAccessOptions extends RequestOptionsNoCapture { | ||
/** | ||
@@ -70,0 +66,0 @@ * The text to be displayed to a user in the popup describing why the bot needs access to |
@@ -5,12 +5,12 @@ /** | ||
*/ | ||
export declare const isConfirmationEnabled: import('@telegram-apps/signals').Signal<boolean>; | ||
export declare const _isConfirmationEnabled: import('@telegram-apps/signals').Signal<boolean>, isConfirmationEnabled: import('@telegram-apps/signals').Computed<boolean>; | ||
/** | ||
* Signal indicating if the Closing Behavior component is currently mounted. | ||
*/ | ||
export declare const isMounted: import('@telegram-apps/signals').Signal<boolean>; | ||
export declare const _isMounted: import('@telegram-apps/signals').Signal<boolean>, isMounted: import('@telegram-apps/signals').Computed<boolean>; | ||
/** | ||
* Disables the closing confirmation dialog. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @example | ||
@@ -21,8 +21,8 @@ * if (disableConfirmation.isAvailable()) { | ||
*/ | ||
export declare const disableConfirmation: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, false, never>; | ||
export declare const disableConfirmation: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, false, never>; | ||
/** | ||
* Enables the closing confirmation dialog. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @example | ||
@@ -33,7 +33,7 @@ * if (enableConfirmation.isAvailable()) { | ||
*/ | ||
export declare const enableConfirmation: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, false, never>; | ||
export declare const enableConfirmation: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, false, never>; | ||
/** | ||
* Mounts the Closing Behavior component restoring its state. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @example | ||
@@ -44,3 +44,3 @@ * if (mount.isAvailable()) { | ||
*/ | ||
export declare const mount: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, false, never>; | ||
export declare const mount: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, false, never>; | ||
/** | ||
@@ -47,0 +47,0 @@ * Unmounts the Closing Behavior component. |
@@ -1,1 +0,1 @@ | ||
export * from './closing-behavior.js'; | ||
export { isMounted, mount, unmount, enableConfirmation, isConfirmationEnabled, disableConfirmation, } from './closing-behavior.js'; |
@@ -1,2 +0,3 @@ | ||
import { CancelablePromise, ExecuteWithOptions } from '@telegram-apps/bridge'; | ||
import { AbortablePromise } from 'better-promises'; | ||
import { InvokeCustomMethodOptions } from '@telegram-apps/bridge'; | ||
/** | ||
@@ -11,5 +12,5 @@ * Signal indicating if the Cloud Storage is supported. | ||
* @since Mini Apps v6.9 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example Deleting a single key | ||
@@ -24,3 +25,3 @@ * if (deleteItem.isAvailable()) { | ||
*/ | ||
export declare const deleteItem: import('../../toolkit/wrapSafe.js').SafeWrapped<(keyOrKeys: string | string[], options?: ExecuteWithOptions) => CancelablePromise<void>, true, never>; | ||
export declare const deleteItem: import('../../wrappers/wrapSafe.js').SafeWrapped<(keyOrKeys: string | string[], options?: InvokeCustomMethodOptions) => AbortablePromise<void>, true, never>; | ||
/** | ||
@@ -33,5 +34,5 @@ * Gets multiple keys' values from the cloud storage. | ||
* @since Mini Apps v6.9 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -42,3 +43,3 @@ * if (deleteItem.isAvailable()) { | ||
*/ | ||
declare function _getItem<K extends string>(keys: K[], options?: ExecuteWithOptions): CancelablePromise<Record<K, string>>; | ||
declare function _getItem<K extends string>(keys: K[], options?: InvokeCustomMethodOptions): AbortablePromise<Record<K, string>>; | ||
/** | ||
@@ -51,5 +52,5 @@ * Gets a single key value from the cloud storage. | ||
* @since Mini Apps v6.9 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -60,4 +61,4 @@ * if (getItem.isAvailable()) { | ||
*/ | ||
declare function _getItem(key: string, options?: ExecuteWithOptions): CancelablePromise<string>; | ||
export declare const getItem: import('../../toolkit/wrapSafe.js').SafeWrapped<typeof _getItem, true, never>; | ||
declare function _getItem(key: string, options?: InvokeCustomMethodOptions): AbortablePromise<string>; | ||
export declare const getItem: import('../../wrappers/wrapSafe.js').SafeWrapped<typeof _getItem, true, never>; | ||
/** | ||
@@ -67,5 +68,5 @@ * Returns a list of all keys presented in the cloud storage. | ||
* @since Mini Apps v6.9 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -76,3 +77,3 @@ * if (getKeys.isAvailable()) { | ||
*/ | ||
export declare const getKeys: import('../../toolkit/wrapSafe.js').SafeWrapped<(options?: ExecuteWithOptions) => CancelablePromise<string[]>, true, never>; | ||
export declare const getKeys: import('../../wrappers/wrapSafe.js').SafeWrapped<(options?: InvokeCustomMethodOptions) => AbortablePromise<string[]>, true, never>; | ||
/** | ||
@@ -84,5 +85,5 @@ * Saves the specified value by a key. | ||
* @since Mini Apps v6.9 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -93,3 +94,16 @@ * if (setItem.isAvailable()) { | ||
*/ | ||
export declare const setItem: import('../../toolkit/wrapSafe.js').SafeWrapped<(key: string, value: string, options?: ExecuteWithOptions) => CancelablePromise<void>, true, never>; | ||
export declare const setItem: import('../../wrappers/wrapSafe.js').SafeWrapped<(key: string, value: string, options?: InvokeCustomMethodOptions) => AbortablePromise<void>, true, never>; | ||
/** | ||
* Clears the cloud storage. | ||
* @param options - additional options. | ||
* @since Mini Apps v6.9 | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
* if (clear.isAvailable()) { | ||
* await clear(); | ||
* } | ||
*/ | ||
export declare const clear: import('../../wrappers/wrapSafe.js').SafeWrapped<(options?: InvokeCustomMethodOptions) => AbortablePromise<void>, true, never>; | ||
export {}; |
@@ -11,5 +11,5 @@ import { ImpactHapticFeedbackStyle, NotificationHapticFeedbackType } from '@telegram-apps/bridge'; | ||
* @since Mini Apps v6.1 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -20,3 +20,3 @@ * if (impactOccurred.isAvailable()) { | ||
*/ | ||
export declare const impactOccurred: import('../../toolkit/wrapSafe.js').SafeWrapped<(style: ImpactHapticFeedbackStyle) => void, true, never>; | ||
export declare const impactOccurred: import('../../wrappers/wrapSafe.js').SafeWrapped<(style: ImpactHapticFeedbackStyle) => void, true, never>; | ||
/** | ||
@@ -28,5 +28,5 @@ * A method tells that a task or action has succeeded, failed, or produced | ||
* @since Mini Apps v6.1 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -37,3 +37,3 @@ * if (notificationOccurred.isAvailable()) { | ||
*/ | ||
export declare const notificationOccurred: import('../../toolkit/wrapSafe.js').SafeWrapped<(type: NotificationHapticFeedbackType) => void, true, never>; | ||
export declare const notificationOccurred: import('../../wrappers/wrapSafe.js').SafeWrapped<(type: NotificationHapticFeedbackType) => void, true, never>; | ||
/** | ||
@@ -46,5 +46,5 @@ * A method tells that the user has changed a selection. The Telegram app may | ||
* @since Mini Apps v6.1 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -55,2 +55,2 @@ * if (selectionChanged.isAvailable()) { | ||
*/ | ||
export declare const selectionChanged: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
export declare const selectionChanged: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, true, never>; |
export { state as initDataState, raw as initDataRaw, authDate as initDataAuthDate, chat as initDataChat, chatInstance as initDataChatInstance, chatType as initDataChatType, hash as initDataHash, canSendAfter as initDataCanSendAfter, canSendAfterDate as initDataCanSendAfterDate, queryId as initDataQueryId, restore as restoreInitData, user as initDataUser, receiver as initDataReceiver, startParam as initDataStartParam, } from './exports.variable.js'; | ||
export * as initData from './exports.variable.js'; | ||
export { parseInitData } from './parseInitData.js'; |
import { Computed } from '@telegram-apps/signals'; | ||
import { InitData } from '@telegram-apps/bridge'; | ||
import { InitData } from '@telegram-apps/types'; | ||
/** | ||
* Complete component state. | ||
*/ | ||
export declare const state: import('@telegram-apps/signals').Signal<InitData | undefined>; | ||
export declare const _state: import('@telegram-apps/signals').Signal<InitData | undefined>, state: Computed<InitData | undefined>; | ||
/** | ||
* @see InitData.authDate | ||
* @see InitData.auth_date | ||
*/ | ||
export declare const authDate: Computed<Date | undefined>; | ||
/** | ||
* @see InitData.canSendAfter | ||
* @see InitData.can_send_after | ||
*/ | ||
@@ -23,9 +23,9 @@ export declare const canSendAfter: Computed<number | undefined>; | ||
*/ | ||
export declare const chat: Computed<import('@telegram-apps/bridge').Chat | undefined>; | ||
export declare const chat: Computed<import('@telegram-apps/types').Chat | undefined>; | ||
/** | ||
* @see InitData.chatType | ||
* @see InitData.chat_type | ||
*/ | ||
export declare const chatType: Computed<string | undefined>; | ||
/** | ||
* @see InitData.chatInstance | ||
* @see InitData.chat_instance | ||
*/ | ||
@@ -38,3 +38,3 @@ export declare const chatInstance: Computed<string | undefined>; | ||
/** | ||
* @see InitData.queryId | ||
* @see InitData.query_id | ||
*/ | ||
@@ -45,7 +45,7 @@ export declare const queryId: Computed<string | undefined>; | ||
*/ | ||
export declare const raw: import('@telegram-apps/signals').Signal<string | undefined>; | ||
export declare const _raw: import('@telegram-apps/signals').Signal<string | undefined>, raw: Computed<string | undefined>; | ||
/** | ||
* @see InitData.receiver | ||
*/ | ||
export declare const receiver: Computed<import('@telegram-apps/bridge').User | undefined>; | ||
export declare const receiver: Computed<import('@telegram-apps/types').User | undefined>; | ||
/** | ||
@@ -56,3 +56,3 @@ * Restores the component state. | ||
/** | ||
* @see InitData.startParam | ||
* @see InitData.start_param | ||
*/ | ||
@@ -63,2 +63,2 @@ export declare const startParam: Computed<string | undefined>; | ||
*/ | ||
export declare const user: Computed<import('@telegram-apps/bridge').User | undefined>; | ||
export declare const user: Computed<import('@telegram-apps/types').User | undefined>; |
@@ -1,2 +0,2 @@ | ||
export { isSupported as isInvoiceSupported, isOpened as isInvoiceOpened, open as openInvoice, } from './exports.variable.js'; | ||
export { isSupported as isInvoiceSupported, isOpened as isInvoiceOpened, open as openInvoice, openPromise as openInvoicePromise, openError as openInvoiceError, } from './exports.variable.js'; | ||
export * as invoice from './exports.variable.js'; |
@@ -1,1 +0,1 @@ | ||
export * from './invoice.js'; | ||
export { isOpened, open, isSupported, openPromise, openError } from './invoice.js'; |
@@ -1,7 +0,5 @@ | ||
import { InvoiceStatus, ExecuteWithPostEvent } from '@telegram-apps/bridge'; | ||
import { InvoiceStatus } from '@telegram-apps/bridge'; | ||
import { AbortablePromise } from 'better-promises'; | ||
import { RequestOptionsNoCapture } from '../../../types.js'; | ||
/** | ||
* Signal indicating if an invoice is opened. | ||
*/ | ||
export declare const isOpened: import('@telegram-apps/signals').Signal<boolean>; | ||
/** | ||
* Signal indicating if invoices are supported. | ||
@@ -15,6 +13,6 @@ */ | ||
* @since Mini Apps v6.1 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_ALREADY_OPENED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {InvalidArgumentsError} An invoice is already opened | ||
* @example | ||
@@ -25,3 +23,3 @@ * if (open.isAvailable()) { | ||
*/ | ||
export declare function _open(slug: string, options?: ExecuteWithPostEvent): Promise<InvoiceStatus>; | ||
declare function _open(slug: string, options?: RequestOptionsNoCapture): AbortablePromise<InvoiceStatus>; | ||
/** | ||
@@ -33,8 +31,7 @@ * Opens an invoice using its url. | ||
* @since Mini Apps v6.1 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_ALREADY_OPENED | ||
* @throws {TypedError} ERR_INVALID_URL | ||
* @throws {TypedError} ERR_INVALID_SLUG | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {InvalidArgumentsError} An invoice is already opened | ||
* @throws {InvalidArgumentsError} Link has unexpected hostname | ||
* @example | ||
@@ -49,3 +46,6 @@ * if (open.isAvailable()) { | ||
*/ | ||
export declare function _open(url: string, type: 'url', options?: ExecuteWithPostEvent): Promise<InvoiceStatus>; | ||
export declare const open: import('../../toolkit/wrapSafe.js').SafeWrapped<typeof _open, true, never>; | ||
declare function _open(url: string, type: 'url', options?: RequestOptionsNoCapture): AbortablePromise<InvoiceStatus>; | ||
export declare const open: import('../../wrappers/wrapSafe.js').SafeWrapped<typeof _open, true, never>; | ||
export declare const openPromise: import('@telegram-apps/signals').Computed<AbortablePromise<string> | undefined>, isOpened: import('@telegram-apps/signals').Computed<boolean>; | ||
export declare const openError: import('@telegram-apps/signals').Computed<Error | undefined>; | ||
export {}; |
@@ -5,4 +5,4 @@ import { EventListener } from '@telegram-apps/bridge'; | ||
* Mounts the Main Button restoring its state. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @example | ||
@@ -13,3 +13,3 @@ * if (mount.isAvailable()) { | ||
*/ | ||
export declare const mount: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, false, never>; | ||
export declare const mount: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, false, never>; | ||
/** | ||
@@ -19,4 +19,4 @@ * Adds a new Main Button click listener. | ||
* @returns A function to remove bound listener. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @example | ||
@@ -30,8 +30,8 @@ * if (onClick.isAvailable()) { | ||
*/ | ||
export declare const onClick: import('../../toolkit/wrapSafe.js').SafeWrapped<(fn: EventListener<"main_button_pressed">) => VoidFunction, false, never>; | ||
export declare const onClick: import('../../wrappers/wrapSafe.js').SafeWrapped<(fn: EventListener<"main_button_pressed">) => VoidFunction, false, never>; | ||
/** | ||
* Removes the Main Button click listener. | ||
* @param fn - an event listener. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @example | ||
@@ -46,9 +46,9 @@ * if (offClick.isAvailable()) { | ||
*/ | ||
export declare const offClick: import('../../toolkit/wrapSafe.js').SafeWrapped<(fn: EventListener<"main_button_pressed">) => void, false, never>; | ||
export declare const offClick: import('../../wrappers/wrapSafe.js').SafeWrapped<(fn: EventListener<"main_button_pressed">) => void, false, never>; | ||
/** | ||
* Updates the Main Button state. | ||
* @param updates - state changes to perform. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @example | ||
@@ -63,3 +63,3 @@ * if (setParams.isAvailable()) { | ||
*/ | ||
export declare const setParams: import('../../toolkit/wrapSafe.js').SafeWrapped<(updates: Partial<State>) => void, false, never>; | ||
export declare const setParams: import('../../wrappers/wrapSafe.js').SafeWrapped<(updates: Partial<State>) => void, false, never>; | ||
/** | ||
@@ -66,0 +66,0 @@ * Unmounts the Main Button. |
@@ -11,3 +11,3 @@ import { Computed } from '@telegram-apps/signals'; | ||
*/ | ||
export declare const isMounted: import('@telegram-apps/signals').Signal<boolean>; | ||
export declare const _isMounted: import('@telegram-apps/signals').Signal<boolean>, isMounted: Computed<boolean>; | ||
/** | ||
@@ -14,0 +14,0 @@ * Signal containing the current Main Button background color. |
@@ -1,2 +0,2 @@ | ||
import { RGB } from '@telegram-apps/bridge'; | ||
import { RGB } from '@telegram-apps/types'; | ||
export interface State { | ||
@@ -3,0 +3,0 @@ backgroundColor?: RGB; |
@@ -1,4 +0,3 @@ | ||
export { bindCssVars as bindMiniAppCssVars, close as closeMiniApp, isSupported as isMiniAppSupported, mount as mountMiniApp, ready as miniAppReady, setHeaderColor as setMiniAppHeaderColor, setBackgroundColor as setMiniAppBackgroundColor, setBottomBarColor as setMiniAppBottomBarColor, unmount as unmountMiniApp, } from './methods.js'; | ||
export { backgroundColor as miniAppBackgroundColor, backgroundColorRGB as miniAppBackgroundColorRGB, bottomBarColor as miniAppBottomBarColor, bottomBarColorRGB as miniAppBottomBarColorRGB, headerColor as miniAppHeaderColor, headerColorRGB as miniAppHeaderColorRGB, isMounted as isMiniAppMounted, isCssVarsBound as isMiniAppCssVarsBound, isDark as isMiniAppDark, isActive as isMiniAppActive, state as miniAppState, } from './signals.js'; | ||
export { bindCssVars as bindMiniAppCssVars, close as closeMiniApp, isSupported as isMiniAppSupported, mount as mountMiniApp, ready as miniAppReady, setHeaderColor as setMiniAppHeaderColor, setBackgroundColor as setMiniAppBackgroundColor, setBottomBarColor as setMiniAppBottomBarColor, unmount as unmountMiniApp, backgroundColor as miniAppBackgroundColor, backgroundColorRGB as miniAppBackgroundColorRGB, bottomBarColor as miniAppBottomBarColor, bottomBarColorRGB as miniAppBottomBarColorRGB, headerColor as miniAppHeaderColor, headerColorRGB as miniAppHeaderColorRGB, isMounted as isMiniAppMounted, isCssVarsBound as isMiniAppCssVarsBound, isDark as isMiniAppDark, isActive as isMiniAppActive, state as miniAppState, mountPromise as miniAppMountPromise, isMounting as isMiniAppMounting, mountError as miniAppMountError, } from './exports.variable.js'; | ||
export * as miniApp from './exports.variable.js'; | ||
export type { HeaderColor as MiniAppHeaderColor, GetCssVarNameFn as MiniAppGetCssVarNameFn, State as MiniAppState, } from './types.js'; | ||
export * as miniApp from './exports.variable.js'; |
@@ -1,2 +0,2 @@ | ||
export * from './methods.js'; | ||
export * from './signals.js'; | ||
export { isSupported, close, bindCssVars, mountError, isMounted, isMounting, mountPromise, mount, ready, unmount, setBottomBarColor, setHeaderColor, setBackgroundColor, } from './methods.js'; | ||
export { state, isDark, isCssVarsBound, backgroundColorRGB, headerColor, headerColorRGB, bottomBarColorRGB, backgroundColor, bottomBarColor, isActive, } from './signals.js'; |
@@ -5,2 +5,3 @@ import { BottomBarColor, BackgroundColor } from '@telegram-apps/bridge'; | ||
import { GetCssVarNameFn, HeaderColor } from './types.js'; | ||
import { RequestOptionsNoCapture } from '../../../types.js'; | ||
/** | ||
@@ -23,6 +24,6 @@ * True if the Mini App component is supported. | ||
* @returns Function to stop updating variables. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_VARS_ALREADY_BOUND | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {CSSVarsBoundError} CSS variables are already bound | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @example Using no arguments | ||
@@ -37,8 +38,8 @@ * if (bindCssVars.isAvailable()) { | ||
*/ | ||
export declare const bindCssVars: import('../../toolkit/wrapSafe.js').SafeWrapped<(getCSSVarName?: GetCssVarNameFn) => VoidFunction, true, never>; | ||
export declare const bindCssVars: import('../../wrappers/wrapSafe.js').SafeWrapped<(getCSSVarName?: GetCssVarNameFn) => VoidFunction, true, never>; | ||
/** | ||
* Closes the Mini App. | ||
* @param returnBack - should the client return to the previous activity. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @example | ||
@@ -49,3 +50,3 @@ * if (close.isAvailable()) { | ||
*/ | ||
export declare const close: import('../../toolkit/wrapSafe.js').SafeWrapped<(returnBack?: boolean) => void, false, never>; | ||
export declare const close: import('../../wrappers/wrapSafe.js').SafeWrapped<(returnBack?: boolean) => void, false, never>; | ||
/** | ||
@@ -60,11 +61,14 @@ * Mounts the component. | ||
* @since Mini Apps v6.1 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
* if (mount.isAvailable()) { | ||
* mount(); | ||
* await mount(); | ||
* } | ||
*/ | ||
export declare const mount: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
export declare const mount: import('../../wrappers/wrapSafe.js').SafeWrapped<(options?: RequestOptionsNoCapture | undefined) => import('better-promises').AbortablePromise<void>, true, never>; | ||
export declare const mountPromise: Computed<import('better-promises').AbortablePromise<any> | undefined>, isMounting: Computed<boolean>; | ||
export declare const mountError: Computed<Error | undefined>; | ||
export declare const _isMounted: import('@telegram-apps/signals').Signal<boolean>, isMounted: Computed<boolean>; | ||
/** | ||
@@ -81,4 +85,4 @@ * Informs the Telegram app that the Mini App is ready to be displayed. | ||
* page was fully loaded. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @example | ||
@@ -89,10 +93,10 @@ * if (ready.isAvailable()) { | ||
*/ | ||
export declare const ready: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, false, never>; | ||
export declare const ready: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, false, never>; | ||
/** | ||
* Updates the background color. | ||
* @since Mini Apps v6.1 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @example | ||
@@ -103,10 +107,10 @@ * if (setBackgroundColor.isAvailable()) { | ||
*/ | ||
export declare const setBackgroundColor: import('../../toolkit/wrapSafe.js').SafeWrapped<(color: BackgroundColor) => void, true, never>; | ||
export declare const setBackgroundColor: import('../../wrappers/wrapSafe.js').SafeWrapped<(color: BackgroundColor) => void, true, never>; | ||
/** | ||
* Updates the bottom bar background color. | ||
* @since Mini Apps v7.10 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @example | ||
@@ -117,10 +121,10 @@ * if (setBottomBarColor.isAvailable()) { | ||
*/ | ||
export declare const setBottomBarColor: import('../../toolkit/wrapSafe.js').SafeWrapped<(color: BottomBarColor) => void, true, never>; | ||
export declare const setBottomBarColor: import('../../wrappers/wrapSafe.js').SafeWrapped<(color: BottomBarColor) => void, true, never>; | ||
/** | ||
* Updates the header color. | ||
* @since Mini Apps v6.1 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @example Using known color key | ||
@@ -135,3 +139,3 @@ * if (setHeaderColor.isAvailable()) { | ||
*/ | ||
export declare const setHeaderColor: import('../../toolkit/wrapSafe.js').SafeWrapped<(color: HeaderColor) => void, true, { | ||
export declare const setHeaderColor: import('../../wrappers/wrapSafe.js').SafeWrapped<(color: HeaderColor) => void, true, { | ||
rgb: ["web_app_set_header_color", "color", typeof isRGB]; | ||
@@ -138,0 +142,0 @@ }>; |
@@ -7,3 +7,3 @@ import { Computed } from '@telegram-apps/signals'; | ||
*/ | ||
export declare const backgroundColor: import('@telegram-apps/signals').Signal<BackgroundColor>; | ||
export declare const _backgroundColor: import('@telegram-apps/signals').Signal<BackgroundColor>, backgroundColor: Computed<BackgroundColor>; | ||
/** | ||
@@ -19,3 +19,3 @@ * RGB representation of the background color. | ||
*/ | ||
export declare const bottomBarColor: import('@telegram-apps/signals').Signal<BottomBarColor>; | ||
export declare const _bottomBarColor: import('@telegram-apps/signals').Signal<BottomBarColor>, bottomBarColor: Computed<BottomBarColor>; | ||
/** | ||
@@ -31,3 +31,3 @@ * RGB representation of the bottom bar background color. | ||
*/ | ||
export declare const headerColor: import('@telegram-apps/signals').Signal<HeaderColor>; | ||
export declare const _headerColor: import('@telegram-apps/signals').Signal<HeaderColor>, headerColor: Computed<HeaderColor>; | ||
/** | ||
@@ -41,9 +41,5 @@ * RGB representation of the header color. | ||
/** | ||
* True if the component is currently mounted. | ||
*/ | ||
export declare const isMounted: import('@telegram-apps/signals').Signal<boolean>; | ||
/** | ||
* True if CSS variables are currently bound. | ||
*/ | ||
export declare const isCssVarsBound: import('@telegram-apps/signals').Signal<boolean>; | ||
export declare const _isCssVarsBound: import('@telegram-apps/signals').Signal<boolean>, isCssVarsBound: Computed<boolean>; | ||
/** | ||
@@ -56,3 +52,3 @@ * True if the current Mini App background color is recognized as dark. | ||
*/ | ||
export declare const isActive: import('@telegram-apps/signals').Signal<boolean>; | ||
export declare const _isActive: import('@telegram-apps/signals').Signal<boolean>, isActive: Computed<boolean>; | ||
/** | ||
@@ -59,0 +55,0 @@ * Complete component state. |
@@ -1,2 +0,3 @@ | ||
import { HeaderColorKey, BottomBarColor, RGB, BackgroundColor } from '@telegram-apps/bridge'; | ||
import { HeaderColorKey, BottomBarColor, BackgroundColor } from '@telegram-apps/bridge'; | ||
import { RGB } from '@telegram-apps/types'; | ||
/** | ||
@@ -3,0 +4,0 @@ * Mini App header color. |
@@ -1,3 +0,3 @@ | ||
export { isOpened as isPopupOpened, isSupported as isPopupSupported, open as openPopup, } from './exports.variable.js'; | ||
export { isOpened as isPopupOpened, isSupported as isPopupSupported, open as openPopup, openError as openPopupError, openPromise as openPopupPromise, } from './exports.variable.js'; | ||
export * as popup from './exports.variable.js'; | ||
export type { OpenOptions as OpenPopupOptions, OpenOptionsButton as OpenPopupOptionsButton, } from './types.js'; |
@@ -1,1 +0,1 @@ | ||
export * from './popup.js'; | ||
export { isOpened, open, isSupported, openPromise, openError } from './popup.js'; |
import { OpenOptions } from './types.js'; | ||
/** | ||
* Signal indicating if a popup is opened. | ||
*/ | ||
export declare const isOpened: import('@telegram-apps/signals').Signal<boolean>; | ||
/** | ||
* Signal indicating if popups are supported. | ||
@@ -20,11 +16,11 @@ */ | ||
* @since Mini Apps v6.2 | ||
* @throws {TypedError} ERR_ALREADY_OPENED | ||
* @throws {TypedError} ERR_POPUP_INVALID_PARAMS: Invalid title | ||
* @throws {TypedError} ERR_POPUP_INVALID_PARAMS: Invalid message | ||
* @throws {TypedError} ERR_POPUP_INVALID_PARAMS: Invalid buttons count | ||
* @throws {TypedError} ERR_POPUP_INVALID_PARAMS: Invalid button id length | ||
* @throws {TypedError} ERR_POPUP_INVALID_PARAMS: Invalid button text length | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {InvalidArgumentsError} Invalid title | ||
* @throws {InvalidArgumentsError} Invalid message | ||
* @throws {InvalidArgumentsError} Invalid buttons count | ||
* @throws {InvalidArgumentsError} Invalid button id length | ||
* @throws {InvalidArgumentsError} Invalid button text length | ||
* @throws {ConcurrentCallError} A popup is already opened | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -42,2 +38,4 @@ * if (open.isAvailable()) { | ||
*/ | ||
export declare const open: import('../../toolkit/wrapSafe.js').SafeWrapped<(options: OpenOptions) => Promise<string | null>, true, never>; | ||
export declare const open: import('../../wrappers/wrapSafe.js').SafeWrapped<(options: OpenOptions) => import('better-promises').AbortablePromise<any>, true, never>; | ||
export declare const openPromise: import('@telegram-apps/signals').Computed<import('better-promises').AbortablePromise<any> | undefined>, isOpened: import('@telegram-apps/signals').Computed<boolean>; | ||
export declare const openError: import('@telegram-apps/signals').Computed<Error | undefined>; |
@@ -6,8 +6,8 @@ import { PopupParams } from '@telegram-apps/bridge'; | ||
* @param params - popup parameters. | ||
* @throws {TypedError} ERR_POPUP_INVALID_PARAMS: Invalid title | ||
* @throws {TypedError} ERR_POPUP_INVALID_PARAMS: Invalid message | ||
* @throws {TypedError} ERR_POPUP_INVALID_PARAMS: Invalid buttons count | ||
* @throws {TypedError} ERR_POPUP_INVALID_PARAMS: Invalid button id length | ||
* @throws {TypedError} ERR_POPUP_INVALID_PARAMS: Invalid button text length | ||
* @throws {InvalidArgumentsError} Invalid title | ||
* @throws {InvalidArgumentsError} Invalid message | ||
* @throws {InvalidArgumentsError} Invalid buttons count | ||
* @throws {InvalidArgumentsError} Invalid button id length | ||
* @throws {InvalidArgumentsError} Invalid button text length | ||
*/ | ||
export declare function prepareParams(params: OpenOptions): PopupParams; |
@@ -1,2 +0,2 @@ | ||
import { ExecuteWithPostEvent } from '@telegram-apps/bridge'; | ||
import { RequestOptionsNoCapture } from '../../../types.js'; | ||
/** | ||
@@ -6,3 +6,3 @@ * This object describes the native popup. | ||
*/ | ||
export interface OpenOptions extends ExecuteWithPostEvent { | ||
export interface OpenOptions extends RequestOptionsNoCapture { | ||
/** | ||
@@ -9,0 +9,0 @@ * The text to be displayed in the popup title, 0-64 characters. |
@@ -1,2 +0,2 @@ | ||
export { close as closeQrScanner, isSupported as isQrScannerSupported, isOpened as isQrScannerOpened, open as openQrScanner, } from './exports.variable.js'; | ||
export { close as closeQrScanner, isSupported as isQrScannerSupported, isOpened as isQrScannerOpened, open as openQrScanner, openPromise as openQrScannerPromise, openError as openQrScannerError, } from './exports.variable.js'; | ||
export * as qrScanner from './exports.variable.js'; |
@@ -1,1 +0,1 @@ | ||
export * from './qr-scanner.js'; | ||
export { isOpened, close, isSupported, openPromise, open, openError, } from './qr-scanner.js'; |
@@ -1,3 +0,4 @@ | ||
import { CancelablePromise, ExecuteWithOptions } from '@telegram-apps/bridge'; | ||
interface OpenSharedOptions extends ExecuteWithOptions { | ||
import { AbortablePromise } from 'better-promises'; | ||
import { RequestOptionsNoCapture } from '../../../types.js'; | ||
interface OpenSharedOptions extends RequestOptionsNoCapture { | ||
/** | ||
@@ -11,5 +12,5 @@ * Title to be displayed in the scanner. | ||
* @since Mini Apps v6.4 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -20,8 +21,4 @@ * if (close.isAvailable()) { | ||
*/ | ||
export declare const close: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
export declare const close: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
/** | ||
* True if the scanner is currently opened. | ||
*/ | ||
export declare const isOpened: import('@telegram-apps/signals').Signal<boolean>; | ||
/** | ||
* Signal indicating if the QR Scanner is currently opened. | ||
@@ -31,7 +28,6 @@ */ | ||
/** | ||
* Opens the scanner and returns a promise which will be resolved with the QR | ||
* content if the passed `capture` function returned true. | ||
* Opens the scanner and returns a promise which will be resolved with the QR content if the | ||
* passed `capture` function returned true. | ||
* | ||
* The `capture` option may be ommited. In this case, the first scanned QR | ||
* will be returned. | ||
* The `capture` option may be ommited. In this case, the first scanned QR will be returned. | ||
* | ||
@@ -43,13 +39,13 @@ * Promise may also be resolved to undefined if the scanner was closed. | ||
* @since Mini Apps v6.4 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_ALREADY_OPENED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {ConcurrentCallError} The QR Scanner is already opened | ||
* @example Without `capture` option | ||
* if (open.isAvailable()) { | ||
* const qr = await open({ text: 'Scan any QR' }); | ||
* if (captureOne.isAvailable()) { | ||
* const qr = await captureOne({ text: 'Scan any QR' }); | ||
* } | ||
* @example Using `capture` option | ||
* if (open.isAvailable()) { | ||
* const qr = await open({ | ||
* if (captureOne.isAvailable()) { | ||
* const qr = await captureOne({ | ||
* text: 'Scan any QR', | ||
@@ -68,19 +64,17 @@ * capture(scannedQr) { | ||
capture?: (qr: string) => boolean; | ||
}): CancelablePromise<string | undefined>; | ||
}): AbortablePromise<string | undefined>; | ||
/** | ||
* Opens the scanner and calls the `onCaptured` function each time, a QR was | ||
* scanned. | ||
* Opens the scanner and calls the `onCaptured` function each time, a QR was scanned. | ||
* | ||
* The function returns a promise which will be resolved when the QR scanner | ||
* was closed. It expects the scanner to be closed externally by a user or | ||
* via the `close` method. | ||
* The function returns a promise which will be resolved when the QR scanner was closed. It expects | ||
* the scanner to be closed externally by a user or via the `close` method. | ||
* @param options - method options. | ||
* @since Mini Apps v6.4 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_ALREADY_OPENED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {ConcurrentCallError} The QR Scanner is already opened | ||
* @example | ||
* if (open.isAvailable()) { | ||
* const promise = await open({ | ||
* if (captureMany.isAvailable()) { | ||
* const promise = await captureMany({ | ||
* text: 'Scan any QR', | ||
@@ -102,4 +96,6 @@ * onCaptured(scannedQr) { | ||
onCaptured: (qr: string) => void; | ||
}): CancelablePromise<void>; | ||
export declare const open: import('../../toolkit/wrapSafe.js').SafeWrapped<typeof _open, true, never>; | ||
}): AbortablePromise<void>; | ||
export declare const open: import('../../wrappers/wrapSafe.js').SafeWrapped<typeof _open, true, never>; | ||
export declare const openPromise: import('@telegram-apps/signals').Computed<AbortablePromise<void> | undefined>, isOpened: import('@telegram-apps/signals').Computed<boolean>; | ||
export declare const openError: import('@telegram-apps/signals').Computed<Error | undefined>; | ||
export {}; |
@@ -9,5 +9,5 @@ import { EventListener } from '@telegram-apps/bridge'; | ||
* Mounts the Secondary Button restoring its state. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -18,3 +18,3 @@ * if (mount.isAvailable()) { | ||
*/ | ||
export declare const mount: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
export declare const mount: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
/** | ||
@@ -24,5 +24,5 @@ * Adds a new Secondary Button click listener. | ||
* @returns A function to remove bound listener. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -36,9 +36,9 @@ * if (onClick.isAvailable()) { | ||
*/ | ||
export declare const onClick: import('../../toolkit/wrapSafe.js').SafeWrapped<(fn: EventListener<"secondary_button_pressed">) => VoidFunction, true, never>; | ||
export declare const onClick: import('../../wrappers/wrapSafe.js').SafeWrapped<(fn: EventListener<"secondary_button_pressed">) => VoidFunction, true, never>; | ||
/** | ||
* Removes the Secondary Button click listener. | ||
* @param fn - an event listener. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -53,10 +53,10 @@ * if (offClick.isAvailable()) { | ||
*/ | ||
export declare const offClick: import('../../toolkit/wrapSafe.js').SafeWrapped<(fn: EventListener<"secondary_button_pressed">) => void, true, never>; | ||
export declare const offClick: import('../../wrappers/wrapSafe.js').SafeWrapped<(fn: EventListener<"secondary_button_pressed">) => void, true, never>; | ||
/** | ||
* Updates the Secondary Button state. | ||
* @param updates - state changes to perform. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -72,3 +72,3 @@ * if (setParams.isAvailable()) { | ||
*/ | ||
export declare const setParams: import('../../toolkit/wrapSafe.js').SafeWrapped<(updates: Partial<State>) => void, true, never>; | ||
export declare const setParams: import('../../wrappers/wrapSafe.js').SafeWrapped<(updates: Partial<State>) => void, true, never>; | ||
/** | ||
@@ -75,0 +75,0 @@ * Unmounts the Secondary Button. |
@@ -11,3 +11,3 @@ import { Computed } from '@telegram-apps/signals'; | ||
*/ | ||
export declare const isMounted: import('@telegram-apps/signals').Signal<boolean>; | ||
export declare const _isMounted: import('@telegram-apps/signals').Signal<boolean>, isMounted: Computed<boolean>; | ||
/** | ||
@@ -14,0 +14,0 @@ * @see State.backgroundColor |
@@ -1,2 +0,3 @@ | ||
import { RGB, SecondaryButtonPosition } from '@telegram-apps/bridge'; | ||
import { SecondaryButtonPosition } from '@telegram-apps/bridge'; | ||
import { RGB } from '@telegram-apps/types'; | ||
export interface State { | ||
@@ -3,0 +4,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
export * from './settings-button.js'; | ||
export { isMounted, isVisible, mount, onClick, unmount, offClick, isSupported, hide, show, } from './settings-button.js'; |
@@ -5,7 +5,7 @@ import { EventListener } from '@telegram-apps/bridge'; | ||
*/ | ||
export declare const isVisible: import('@telegram-apps/signals').Signal<boolean>; | ||
export declare const _isVisible: import('@telegram-apps/signals').Signal<boolean>, isVisible: import('@telegram-apps/signals').Computed<boolean>; | ||
/** | ||
* Signal indicating if the Settings Button is currently mounted. | ||
*/ | ||
export declare const isMounted: import('@telegram-apps/signals').Signal<boolean>; | ||
export declare const _isMounted: import('@telegram-apps/signals').Signal<boolean>, isMounted: import('@telegram-apps/signals').Computed<boolean>; | ||
/** | ||
@@ -17,6 +17,6 @@ * Signal indicating if the Settings Button is supported. | ||
* Hides the Settings Button. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @since Mini Apps v6.10 | ||
@@ -28,8 +28,8 @@ * @example | ||
*/ | ||
export declare const hide: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
export declare const hide: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
/** | ||
* Mounts the Settings Button restoring its state. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @since Mini Apps v6.10 | ||
@@ -41,3 +41,3 @@ * @example | ||
*/ | ||
export declare const mount: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
export declare const mount: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
/** | ||
@@ -47,5 +47,5 @@ * Adds a new Settings Button click listener. | ||
* @returns A function to remove bound listener. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @since Mini Apps v6.10 | ||
@@ -60,9 +60,9 @@ * @example | ||
*/ | ||
export declare const onClick: import('../../toolkit/wrapSafe.js').SafeWrapped<(fn: EventListener<"settings_button_pressed">) => VoidFunction, true, never>; | ||
export declare const onClick: import('../../wrappers/wrapSafe.js').SafeWrapped<(fn: EventListener<"settings_button_pressed">) => VoidFunction, true, never>; | ||
/** | ||
* Removes the Settings Button click listener. | ||
* @param fn - an event listener. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @since Mini Apps v6.10 | ||
@@ -78,9 +78,9 @@ * @example | ||
*/ | ||
export declare const offClick: import('../../toolkit/wrapSafe.js').SafeWrapped<(fn: EventListener<"settings_button_pressed">) => void, true, never>; | ||
export declare const offClick: import('../../wrappers/wrapSafe.js').SafeWrapped<(fn: EventListener<"settings_button_pressed">) => void, true, never>; | ||
/** | ||
* Shows the Settings Button. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @since Mini Apps v6.10 | ||
@@ -92,3 +92,3 @@ * @example | ||
*/ | ||
export declare const show: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
export declare const show: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
/** | ||
@@ -95,0 +95,0 @@ * Unmounts the Settings Button. |
/** | ||
* Signal indicating if the Swipe Behavior component is currently mounted. | ||
*/ | ||
export declare const isMounted: import('@telegram-apps/signals').Signal<boolean>; | ||
export declare const _isMounted: import('@telegram-apps/signals').Signal<boolean>, isMounted: import('@telegram-apps/signals').Computed<boolean>; | ||
/** | ||
@@ -12,10 +12,10 @@ * Signal indicating if the Swipe Behavior is supported. | ||
*/ | ||
export declare const isVerticalEnabled: import('@telegram-apps/signals').Signal<boolean>; | ||
export declare const _isVerticalEnabled: import('@telegram-apps/signals').Signal<boolean>, isVerticalEnabled: import('@telegram-apps/signals').Computed<boolean>; | ||
/** | ||
* Disables vertical swipes. | ||
* @since Mini Apps v7.7 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @example | ||
@@ -26,10 +26,10 @@ * if (disableVertical.isAvailable()) { | ||
*/ | ||
export declare const disableVertical: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
export declare const disableVertical: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
/** | ||
* Enables vertical swipes. | ||
* @since Mini Apps v7.7 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @example | ||
@@ -40,9 +40,9 @@ * if (enableVertical.isAvailable()) { | ||
*/ | ||
export declare const enableVertical: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
export declare const enableVertical: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
/** | ||
* Mounts the Swipe Behavior component restoring its state. | ||
* @since Mini Apps v7.7 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -53,3 +53,3 @@ * if (mount.isAvailable()) { | ||
*/ | ||
export declare const mount: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
export declare const mount: import('../../wrappers/wrapSafe.js').SafeWrapped<() => void, true, never>; | ||
/** | ||
@@ -56,0 +56,0 @@ * Unmounts the Swipe Behavior component. |
@@ -1,5 +0,3 @@ | ||
export { accentTextColor as themeParamsAccentTextColor, backgroundColor as themeParamsBackgroundColor, bindCssVars as bindThemeParamsCssVars, buttonTextColor as themeParamsButtonTextColor, buttonColor as themeParamsButtonColor, bottomBarBgColor as themeParamsBottomBarBgColor, destructiveTextColor as themeParamsDestructiveTextColor, headerBackgroundColor as themeParamsHeaderBackgroundColor, hintColor as themeParamsHintColor, isMounted as isThemeParamsMounted, isDark as isThemeParamsDark, isCssVarsBound as isThemeParamsCssVarsBound, linkColor as themeParamsLinkColor, mount as mountThemeParams, state as themeParamsState, subtitleTextColor as themeParamsSubtitleTextColor, sectionBackgroundColor as themeParamsSectionBackgroundColor, secondaryBackgroundColor as themeParamsSecondaryBackgroundColor, sectionSeparatorColor as themeParamsSectionSeparatorColor, sectionHeaderTextColor as themeParamsSectionHeaderTextColor, textColor as themeParamsTextColor, unmount as unmountThemeParams, } from './exports.variable.js'; | ||
export { accentTextColor as themeParamsAccentTextColor, backgroundColor as themeParamsBackgroundColor, bindCssVars as bindThemeParamsCssVars, buttonTextColor as themeParamsButtonTextColor, buttonColor as themeParamsButtonColor, bottomBarBgColor as themeParamsBottomBarBgColor, destructiveTextColor as themeParamsDestructiveTextColor, headerBackgroundColor as themeParamsHeaderBackgroundColor, hintColor as themeParamsHintColor, isMounted as isThemeParamsMounted, isDark as isThemeParamsDark, isCssVarsBound as isThemeParamsCssVarsBound, linkColor as themeParamsLinkColor, mount as mountThemeParams, state as themeParamsState, subtitleTextColor as themeParamsSubtitleTextColor, sectionBackgroundColor as themeParamsSectionBackgroundColor, secondaryBackgroundColor as themeParamsSecondaryBackgroundColor, sectionSeparatorColor as themeParamsSectionSeparatorColor, sectionHeaderTextColor as themeParamsSectionHeaderTextColor, textColor as themeParamsTextColor, unmount as unmountThemeParams, mountError as themeParamsMountError, isMounting as isThemeParamsMounting, mountPromise as themeParamsMountPromise, } from './exports.variable.js'; | ||
export * as themeParams from './exports.variable.js'; | ||
export type { GetCssVarNameFn as ThemeParamsGetCssVarNameFn, ThemeParams, ThemeParamsKey, } from './types.js'; | ||
export { parseThemeParams } from './parseThemeParams.js'; | ||
export { serializeThemeParams } from '@telegram-apps/transformers'; | ||
export type { GetCssVarNameFn as ThemeParamsGetCssVarNameFn, } from './types.js'; |
@@ -1,2 +0,2 @@ | ||
export * from './signals.js'; | ||
export * from './methods.js'; | ||
export { state, isDark, accentTextColor, buttonTextColor, buttonColor, linkColor, backgroundColor, secondaryBackgroundColor, headerBackgroundColor, destructiveTextColor, sectionBackgroundColor, sectionSeparatorColor, hintColor, sectionHeaderTextColor, subtitleTextColor, textColor, bottomBarBgColor, isCssVarsBound, } from './signals.js'; | ||
export { mount, isMounted, isMounting, mountError, mountPromise, unmount, bindCssVars, } from './methods.js'; |
@@ -0,1 +1,3 @@ | ||
import { AbortablePromise } from 'better-promises'; | ||
import { RequestOptionsNoCapture } from '../../../types.js'; | ||
import { GetCssVarNameFn } from './types.js'; | ||
@@ -6,3 +8,3 @@ /** | ||
* By default, created CSS variables names are following the pattern "--tg-theme-{name}", where | ||
* {name} is a theme parameters key name converted from camel case to kebab case. | ||
* {name} is a theme parameters key name converted from snake case to kebab case. | ||
* | ||
@@ -18,6 +20,6 @@ * Default variables: | ||
* @returns Function to stop updating variables. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_CSS_VARS_ALREADY_BOUND | ||
* @throws {TypedError} ERR_NOT_MOUNTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {CSSVarsBoundError} CSS variables are already bound | ||
* @throws {FunctionNotAvailableError} The parent component is not mounted | ||
* @example Using no arguments | ||
@@ -32,14 +34,17 @@ * if (bindCssVars.isAvailable()) { | ||
*/ | ||
export declare const bindCssVars: import('../../toolkit/wrapSafe.js').SafeWrapped<(getCSSVarName?: GetCssVarNameFn) => VoidFunction, false, never>; | ||
export declare const bindCssVars: import('../../wrappers/wrapSafe.js').SafeWrapped<(getCSSVarName?: GetCssVarNameFn) => VoidFunction, false, never>; | ||
/** | ||
* Mounts the Theme Params component restoring its state. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
* if (mount.isAvailable()) { | ||
* mount(); | ||
* await mount(); | ||
* } | ||
*/ | ||
export declare const mount: import('../../toolkit/wrapSafe.js').SafeWrapped<() => void, false, never>; | ||
export declare const mount: import('../../wrappers/wrapSafe.js').SafeWrapped<(options?: RequestOptionsNoCapture | undefined) => AbortablePromise<void>, false, never>; | ||
export declare const mountPromise: import('@telegram-apps/signals').Computed<AbortablePromise<any> | undefined>, isMounting: import('@telegram-apps/signals').Computed<boolean>; | ||
export declare const mountError: import('@telegram-apps/signals').Computed<Error | undefined>; | ||
export declare const _isMounted: import('@telegram-apps/signals').Signal<boolean>, isMounted: import('@telegram-apps/signals').Computed<boolean>; | ||
/** | ||
@@ -46,0 +51,0 @@ * Unmounts the Theme Params component. |
@@ -1,15 +0,10 @@ | ||
import { ThemeParams } from '@telegram-apps/bridge'; | ||
import { Computed } from '@telegram-apps/signals'; | ||
/** | ||
* True if the component is currently mounted. | ||
*/ | ||
export declare const isMounted: import('@telegram-apps/signals').Signal<boolean>; | ||
/** | ||
* True if CSS variables are currently bound. | ||
*/ | ||
export declare const isCssVarsBound: import('@telegram-apps/signals').Signal<boolean>; | ||
export declare const _isCssVarsBound: import('@telegram-apps/signals').Signal<boolean>, isCssVarsBound: Computed<boolean>; | ||
/** | ||
* Complete component state. | ||
*/ | ||
export declare const state: import('@telegram-apps/signals').Signal<ThemeParams>; | ||
export declare const _state: import('@telegram-apps/signals').Signal<Partial<Record<string, `#${string}`>>>, state: Computed<Partial<Record<string, `#${string}`>>>; | ||
/** | ||
@@ -16,0 +11,0 @@ * @since v6.10 |
@@ -1,2 +0,2 @@ | ||
import { ThemeParams } from '@telegram-apps/bridge'; | ||
import { ThemeParams } from '@telegram-apps/types'; | ||
export interface GetCssVarNameFn { | ||
@@ -9,2 +9,1 @@ /** | ||
} | ||
export type { ThemeParams, ThemeParamsKey } from '@telegram-apps/bridge'; |
export declare const COMPONENT_NAME = "viewport"; | ||
export declare const REQUEST_FS_METHOD = "web_app_request_fullscreen"; | ||
export declare const FS_FAILED_EVENT = "fullscreen_failed"; | ||
export declare const FS_CHANGED_EVENT = "fullscreen_changed"; | ||
@@ -8,3 +6,1 @@ export declare const SA_CHANGED_EVENT = "safe_area_changed"; | ||
export declare const VIEWPORT_CHANGED_EVENT = "viewport_changed"; | ||
export declare const REQUEST_SAFE_AREA_METHOD = "web_app_request_safe_area"; | ||
export declare const REQUEST_CONTENT_SAFE_AREA_METHOD = "web_app_request_content_safe_area"; |
@@ -1,6 +0,4 @@ | ||
export { bindCssVars as bindViewportCssVars, expand as expandViewport, exitFullscreen, height as viewportHeight, isExpanded as isViewportExpanded, isStable as isViewportStable, isCssVarsBound as isViewportCssVarsBound, isChangingFullscreen, isFullscreen, isMounting as isViewportMounting, isMounted as isViewportMounted, mount as mountViewport, mountError as viewportMountError, mountPromise as viewportMountPromise, requestFullscreen, changeFullscreenPromise, changeFullscreenError, state as viewportState, stableHeight as viewportStableHeight, unmount as unmountViewport, width as viewportWidth, safeAreaInsetBottom as viewportSafeAreaInsetBottom, safeAreaInsetLeft as viewportSafeAreaInsetLeft, safeAreaInsetRight as viewportSafeAreaInsetRight, safeAreaInsetTop as viewportSafeAreaInsetTop, safeAreaInsets as viewportSafeAreaInsets, contentSafeAreaInsets as viewportContentSafeAreaInsets, contentSafeAreaInsetTop as viewportContentSafeAreaInsetTop, contentSafeAreaInsetBottom as viewportContentSafeAreaInsetBottom, contentSafeAreaInsetLeft as viewportContentSafeAreaInsetLeft, contentSafeAreaInsetRight as viewportContentSafeAreaInsetRight, } from './exports.variable.js'; | ||
export { bindCssVars as bindViewportCssVars, isCssVarsBound as isViewportCssVarsBound, expand as expandViewport, requestFullscreen, isFullscreen, exitFullscreen, changeFullscreenError, changeFullscreenPromise, mount as mountViewport, isMounted as isViewportMounted, isMounting as isViewportMounting, mountError as viewportMountError, mountPromise as viewportMountPromise, unmount as unmountViewport, contentSafeAreaInsetRight as viewportContentSafeAreaInsetRight, contentSafeAreaInsetLeft as viewportContentSafeAreaInsetLeft, contentSafeAreaInsetBottom as viewportContentSafeAreaInsetBottom, contentSafeAreaInsetTop as viewportContentSafeAreaInsetTop, contentSafeAreaInsets as viewportContentSafeAreaInsets, width as viewportWidth, height as viewportHeight, stableHeight as viewportStableHeight, isStable as isViewportStable, isExpanded as isViewportExpanded, safeAreaInsets as viewportSafeAreaInsets, safeAreaInsetTop as viewportSafeAreaInsetTop, safeAreaInsetRight as viewportSafeAreaInsetRight, safeAreaInsetLeft as viewportSafeAreaInsetLeft, safeAreaInsetBottom as viewportSafeAreaInsetBottom, state as viewportState, } from './exports.variable.js'; | ||
export * as viewport from './exports.variable.js'; | ||
export { requestContentSafeAreaInsets } from './methods/static/requestContentSafeAreaInsets.js'; | ||
export { requestSafeAreaInsets } from './methods/static/requestSafeAreaInsets.js'; | ||
export { requestViewport, type RequestViewportResult } from './methods/static/requestViewport.js'; | ||
export { requestContentSafeAreaInsets, requestSafeAreaInsets, requestViewport } from './static.js'; | ||
export type { State as ViewportState, GetCSSVarNameFn as ViewportGetCSSVarNameFn, GetCSSVarNameKey as ViewportGetCSSVarNameKey, } from './types.js'; |
@@ -1,14 +0,5 @@ | ||
export { requestFullscreen } from './methods/fullscreen/requestFullscreen.js'; | ||
export { exitFullscreen } from './methods/fullscreen/exitFullscreen.js'; | ||
export { mount } from './methods/mounting/mount.js'; | ||
export { unmount } from './methods/mounting/unmount.js'; | ||
export { bindCssVars } from './methods/bindCssVars.js'; | ||
export { expand } from './methods/expand.js'; | ||
export { contentSafeAreaInsetRight, contentSafeAreaInsetLeft, contentSafeAreaInsetBottom, contentSafeAreaInsetTop, contentSafeAreaInsets, } from './signals/content-safe-area-insets.js'; | ||
export { isCssVarsBound } from './signals/css-vars.js'; | ||
export { stableHeight, width, height } from './signals/dimensions.js'; | ||
export { isStable, isExpanded } from './signals/flags.js'; | ||
export { changeFullscreenError, changeFullscreenPromise, isFullscreen, isChangingFullscreen, } from './signals/fullscreen.js'; | ||
export { isMounted, isMounting, mountError, mountPromise } from './signals/mounting.js'; | ||
export { safeAreaInsets, safeAreaInsetTop, safeAreaInsetRight, safeAreaInsetLeft, safeAreaInsetBottom, } from './signals/safe-area-insets.js'; | ||
export { state } from './signals/state.js'; | ||
export { bindCssVars, isCssVarsBound } from './css-vars.js'; | ||
export { expand } from './expand.js'; | ||
export { requestFullscreen, isFullscreen, exitFullscreen, changeFullscreenError, changeFullscreenPromise, } from './fullscreen.js'; | ||
export { mount, isMounted, isMounting, mountError, mountPromise, unmount } from './mounting.js'; | ||
export { contentSafeAreaInsetRight, contentSafeAreaInsetLeft, contentSafeAreaInsetBottom, contentSafeAreaInsetTop, contentSafeAreaInsets, width, height, stableHeight, isStable, isExpanded, safeAreaInsets, safeAreaInsetTop, safeAreaInsetRight, safeAreaInsetLeft, safeAreaInsetBottom, state, } from './signals.js'; |
export { requestEmojiStatusAccess, requestEmojiStatusAccessError, requestEmojiStatusAccessPromise, isRequestingEmojiStatusAccess, } from './requestEmojiStatusAccess.js'; | ||
export { setEmojiStatus, isSettingEmojiStatus, setEmojiStatusError, setEmojiStatusPromise, } from './setEmojiStatus.js'; | ||
export { setEmojiStatus, isSettingEmojiStatus, setEmojiStatusError, setEmojiStatusPromise, type SetEmojiStatusOptions, } from './setEmojiStatus.js'; |
@@ -0,21 +1,10 @@ | ||
import { RequestOptionsNoCapture } from '../../../types.js'; | ||
/** | ||
* Signal containing the emoji status access request promise. | ||
*/ | ||
export declare const requestEmojiStatusAccessPromise: import('@telegram-apps/signals').Signal<Promise<string> | undefined>; | ||
/** | ||
* Signal containing the last emoji status access request error. | ||
*/ | ||
export declare const requestEmojiStatusAccessError: import('@telegram-apps/signals').Signal<Error | undefined>; | ||
/** | ||
* Signal indicating if the emoji status access is currently being requested. | ||
*/ | ||
export declare const isRequestingEmojiStatusAccess: import('@telegram-apps/signals').Computed<boolean>; | ||
/** | ||
* Shows a native popup requesting permission for the bot to manage user's emoji status. | ||
* @param options - additional options. | ||
* @since Mini Apps v8.0 | ||
* @throws {TypedError} ERR_ALREADY_REQUESTING | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {ConcurrentCallError} Emoji status access request is already in progress | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -26,2 +15,4 @@ * if (requestEmojiStatusAccess.isAvailable()) { | ||
*/ | ||
export declare const requestEmojiStatusAccess: import('../../toolkit/wrapSafe.js').SafeWrapped<() => PromiseLike<Promise<string>>, true, never>; | ||
export declare const requestEmojiStatusAccess: import('../../wrappers/wrapSafe.js').SafeWrapped<(options?: RequestOptionsNoCapture) => import('better-promises').AbortablePromise<any>, true, never>; | ||
export declare const requestEmojiStatusAccessPromise: import('@telegram-apps/signals').Computed<import('better-promises').AbortablePromise<any> | undefined>, isRequestingEmojiStatusAccess: import('@telegram-apps/signals').Computed<boolean>; | ||
export declare const requestEmojiStatusAccessError: import('@telegram-apps/signals').Computed<Error | undefined>; |
@@ -0,14 +1,6 @@ | ||
import { RequestOptionsNoCapture } from '../../../types.js'; | ||
export interface SetEmojiStatusOptions extends RequestOptionsNoCapture { | ||
duration?: number; | ||
} | ||
/** | ||
* Signal containing the emoji status access request promise. | ||
*/ | ||
export declare const setEmojiStatusPromise: import('@telegram-apps/signals').Signal<Promise<void> | undefined>; | ||
/** | ||
* Signal containing the last emoji status access request error. | ||
*/ | ||
export declare const setEmojiStatusError: import('@telegram-apps/signals').Signal<Error | undefined>; | ||
/** | ||
* Signal indicating if the emoji status set is currently being requested. | ||
*/ | ||
export declare const isSettingEmojiStatus: import('@telegram-apps/signals').Computed<boolean>; | ||
/** | ||
* Opens a dialog allowing the user to set the specified custom emoji as their status. | ||
@@ -18,6 +10,7 @@ * @returns Promise with boolean value indicating if the status was set. | ||
* @since Mini Apps v8.0 | ||
* @throws {TypedError} ERR_ALREADY_REQUESTING | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {ConcurrentCallError} Emoji status set request is currently in progress | ||
* @throws {SetEmojiStatusError} Failed to set emoji status | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -28,2 +21,4 @@ * if (setEmojiStatus.isAvailable()) { | ||
*/ | ||
export declare const setEmojiStatus: import('../../toolkit/wrapSafe.js').SafeWrapped<(customEmojiId: string, duration?: number | undefined) => PromiseLike<Promise<void>>, true, never>; | ||
export declare const setEmojiStatus: import('../../wrappers/wrapSafe.js').SafeWrapped<(customEmojiId: string, options?: SetEmojiStatusOptions) => import('better-promises').AbortablePromise<any>, true, never>; | ||
export declare const setEmojiStatusPromise: import('@telegram-apps/signals').Computed<import('better-promises').AbortablePromise<any> | undefined>, isSettingEmojiStatus: import('@telegram-apps/signals').Computed<boolean>; | ||
export declare const setEmojiStatusError: import('@telegram-apps/signals').Computed<Error | undefined>; |
@@ -1,1 +0,4 @@ | ||
export { checkHomeScreenStatusError, checkHomeScreenStatusPromise, isCheckingHomeScreenStatus, checkHomeScreenStatus, offAddedToHomeScreen, onAddedToHomeScreen, addToHomeScreen, offAddToHomeScreenFailed, onAddToHomeScreenFailed, } from './home-screen.js'; | ||
export { offAddToHomeScreenFailed, onAddToHomeScreenFailed } from './add-to-home-screen-failed.js'; | ||
export { offAddedToHomeScreen, onAddedToHomeScreen } from './added-to-home-screen.js'; | ||
export { addToHomeScreen } from './addToHomeScreen.js'; | ||
export { checkHomeScreenStatus, checkHomeScreenStatusError, checkHomeScreenStatusPromise, isCheckingHomeScreenStatus, } from './checkHomeScreenStatus.js'; |
@@ -21,5 +21,5 @@ import { OpenLinkBrowser } from '@telegram-apps/bridge'; | ||
* @param options - additional options. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_INVALID_URL | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {InvalidArgumentsError} Invalid URL passed | ||
* @example | ||
@@ -33,2 +33,2 @@ * if (openLink.isAvailable()) { | ||
*/ | ||
export declare const openLink: import('../../toolkit/wrapSafe.js').SafeWrapped<(url: string | URL, options?: OpenLinkOptions) => void, false, never>; | ||
export declare const openLink: import('../../wrappers/wrapSafe.js').SafeWrapped<(url: string | URL, options?: OpenLinkOptions) => void, false, never>; |
@@ -7,5 +7,5 @@ /** | ||
* @param url - URL to be opened. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_INVALID_URL | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {InvalidArgumentsError} Invalid URL passed | ||
* @example | ||
@@ -16,2 +16,2 @@ * if (openTelegramLink.isAvailable()) { | ||
*/ | ||
export declare const openTelegramLink: import('../../toolkit/wrapSafe.js').SafeWrapped<(url: string | URL) => void, false, never>; | ||
export declare const openTelegramLink: import('../../wrappers/wrapSafe.js').SafeWrapped<(url: string | URL) => void, false, never>; |
@@ -8,7 +8,8 @@ /** | ||
* @param text - text to append after the URL. | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {InvalidArgumentsError} Invalid URL passed | ||
* @see https://core.telegram.org/api/links#share-links | ||
* @see https://core.telegram.org/widgets/share#custom-buttons | ||
*/ | ||
export declare const shareURL: import('../../toolkit/wrapSafe.js').SafeWrapped<(url: string, text?: string) => void, false, never>; | ||
export declare const shareURL: import('../../wrappers/wrapSafe.js').SafeWrapped<(url: string, text?: string) => void, false, never>; |
@@ -1,3 +0,3 @@ | ||
export { requestContact, type RequestedContact } from './requestContact.js'; | ||
export { requestPhoneAccess, isRequestingPhoneAccess } from './requestPhoneAccess.js'; | ||
export { requestWriteAccess, isRequestingWriteAccess } from './requestWriteAccess.js'; | ||
export { requestContact, isRequestingContact, requestContactError, requestContactPromise, type RequestedContact, } from './requestContact.js'; | ||
export { requestPhoneAccess, isRequestingPhoneAccess, requestPhoneAccessPromise, requestPhoneAccessError, } from './requestPhoneAccess.js'; | ||
export { requestWriteAccess, isRequestingWriteAccess, requestWriteAccessPromise, requestWriteAccessError, } from './requestWriteAccess.js'; |
@@ -1,2 +0,2 @@ | ||
import { AsyncOptions, CancelablePromise } from '@telegram-apps/bridge'; | ||
import { AbortablePromise, PromiseOptions } from 'better-promises'; | ||
/** | ||
@@ -7,8 +7,8 @@ * Requested contact information. | ||
contact: { | ||
userId: number; | ||
phoneNumber: string; | ||
firstName: string; | ||
lastName?: string; | ||
user_id: number; | ||
phone_number: string; | ||
first_name: string; | ||
last_name?: string; | ||
}; | ||
authDate: Date; | ||
auth_date: Date; | ||
hash: string; | ||
@@ -22,7 +22,7 @@ } | ||
* @since Mini Apps v6.9 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_ACCESS_DENIED | ||
* @throws {TypedError} ERR_CUSTOM_METHOD_ERR_RESPONSE | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {AccessDeniedError} User denied access | ||
* @throws {ValiError} Response has invalid structure | ||
* @example | ||
@@ -33,2 +33,4 @@ * if (requestContact.isAvailable()) { | ||
*/ | ||
export declare const requestContact: import('../../toolkit/wrapSafe.js').SafeWrapped<(options?: AsyncOptions) => CancelablePromise<RequestedContact>, true, never>; | ||
export declare const requestContact: import('../../wrappers/wrapSafe.js').SafeWrapped<(options?: PromiseOptions) => AbortablePromise<RequestedContact>, true, never>; | ||
export declare const requestContactPromise: import('@telegram-apps/signals').Computed<AbortablePromise<RequestedContact> | undefined>, isRequestingContact: import('@telegram-apps/signals').Computed<boolean>; | ||
export declare const requestContactError: import('@telegram-apps/signals').Computed<Error | undefined>; |
@@ -1,8 +0,3 @@ | ||
import { AsyncOptions, PhoneRequestedStatus } from '@telegram-apps/bridge'; | ||
export declare const REQUEST_PHONE_METHOD = "web_app_request_phone"; | ||
import { RequestOptionsNoCapture } from '../../../types.js'; | ||
/** | ||
* Signal indicating if phone access is currently being requested. | ||
*/ | ||
export declare const isRequestingPhoneAccess: import('@telegram-apps/signals').Signal<boolean>; | ||
/** | ||
* Requests current user phone access. Method returns promise, which resolves | ||
@@ -16,6 +11,6 @@ * status of the request. In case, user accepted the request, Mini App bot will receive | ||
* @see requestContact | ||
* @throws {TypedError} ERR_ALREADY_REQUESTING | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {ConcurrentCallError} Phone access request is currently in progress | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -26,2 +21,4 @@ * if (requestPhoneAccess.isAvailable()) { | ||
*/ | ||
export declare const requestPhoneAccess: import('../../toolkit/wrapSafe.js').SafeWrapped<(options?: AsyncOptions) => Promise<PhoneRequestedStatus>, true, never>; | ||
export declare const requestPhoneAccess: import('../../wrappers/wrapSafe.js').SafeWrapped<(options?: RequestOptionsNoCapture) => import('better-promises').AbortablePromise<any>, true, never>; | ||
export declare const requestPhoneAccessPromise: import('@telegram-apps/signals').Computed<import('better-promises').AbortablePromise<any> | undefined>, isRequestingPhoneAccess: import('@telegram-apps/signals').Computed<boolean>; | ||
export declare const requestPhoneAccessError: import('@telegram-apps/signals').Computed<Error | undefined>; |
@@ -1,14 +0,12 @@ | ||
import { WriteAccessRequestedStatus, AsyncOptions } from '@telegram-apps/bridge'; | ||
import { WriteAccessRequestedStatus } from '@telegram-apps/bridge'; | ||
import { AbortablePromise } from 'better-promises'; | ||
import { RequestOptionsNoCapture } from '../../../types.js'; | ||
/** | ||
* Signal indicating if write access is currently being requested. | ||
*/ | ||
export declare const isRequestingWriteAccess: import('@telegram-apps/signals').Signal<boolean>; | ||
/** | ||
* Requests write message access to the current user. | ||
* @param options - additional options. | ||
* @since Mini Apps v6.9 | ||
* @throws {TypedError} ERR_ALREADY_REQUESTING | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {ConcurrentCallError} Write access request is currently in progress | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -19,2 +17,4 @@ * if (requestWriteAccess.isAvailable()) { | ||
*/ | ||
export declare const requestWriteAccess: import('../../toolkit/wrapSafe.js').SafeWrapped<(options?: AsyncOptions) => Promise<WriteAccessRequestedStatus>, true, never>; | ||
export declare const requestWriteAccess: import('../../wrappers/wrapSafe.js').SafeWrapped<(options?: RequestOptionsNoCapture) => AbortablePromise<WriteAccessRequestedStatus>, true, never>; | ||
export declare const requestWriteAccessPromise: import('@telegram-apps/signals').Computed<AbortablePromise<string> | undefined>, isRequestingWriteAccess: import('@telegram-apps/signals').Computed<boolean>; | ||
export declare const requestWriteAccessError: import('@telegram-apps/signals').Computed<Error | undefined>; |
@@ -1,6 +0,15 @@ | ||
import { AsyncOptions, CancelablePromise } from '@telegram-apps/bridge'; | ||
import { AbortablePromise } from 'better-promises'; | ||
import { InvokeCustomMethodOptions } from '@telegram-apps/bridge'; | ||
/** | ||
* @returns Current server time. | ||
* @param options - execution options. | ||
* @since Mini Apps v6.9 | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
* if (getCurrentTime.isAvailable()) { | ||
* const time = await getCurrentTime(); | ||
* } | ||
*/ | ||
export declare const getCurrentTime: import('../../toolkit/wrapSafe.js').SafeWrapped<(options?: AsyncOptions) => CancelablePromise<Date>, true, never>; | ||
export declare const getCurrentTime: import('../../wrappers/wrapSafe.js').SafeWrapped<(options?: InvokeCustomMethodOptions) => AbortablePromise<Date>, true, never>; |
@@ -1,2 +0,3 @@ | ||
import { AsyncOptions, CancelablePromise } from '@telegram-apps/bridge'; | ||
import { AbortablePromise } from 'better-promises'; | ||
import { RequestOptionsNoCapture } from '../../../types.js'; | ||
/** | ||
@@ -8,5 +9,5 @@ * Reads a text from the clipboard and returns a `string` or `null`. `null` is returned | ||
* @since Mini Apps v6.4 | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @example | ||
@@ -17,2 +18,2 @@ * if (readTextFromClipboard.isAvailable()) { | ||
*/ | ||
export declare const readTextFromClipboard: import('../../toolkit/wrapSafe.js').SafeWrapped<(options?: AsyncOptions) => CancelablePromise<string | null>, true, never>; | ||
export declare const readTextFromClipboard: import('../../wrappers/wrapSafe.js').SafeWrapped<(options?: RequestOptionsNoCapture) => AbortablePromise<string | null>, true, never>; |
@@ -11,5 +11,7 @@ /** | ||
* @param data - data to send to bot. | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_DATA_INVALID_SIZE | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The application must be launched in the inline mode | ||
* @throws {InvalidArgumentsError} Maximum size of data to send is 4096 bytes | ||
* @throws {InvalidArgumentsError} Attempted to send empty data | ||
* @example | ||
@@ -20,2 +22,2 @@ * if (sendData.isAvailable()) { | ||
*/ | ||
export declare const sendData: import('../../toolkit/wrapSafe.js').SafeWrapped<(data: string) => void, false, never>; | ||
export declare const sendData: import('../../wrappers/wrapSafe.js').SafeWrapped<(data: string) => void, true, never>; |
@@ -27,5 +27,5 @@ export interface ShareStoryOptions { | ||
* @since Mini Apps v7.8 | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @example | ||
@@ -42,2 +42,2 @@ * if (shareStory.isAvailable()) { | ||
*/ | ||
export declare const shareStory: import('../../toolkit/wrapSafe.js').SafeWrapped<(mediaUrl: string, options?: ShareStoryOptions) => void, true, never>; | ||
export declare const shareStory: import('../../wrappers/wrapSafe.js').SafeWrapped<(mediaUrl: string, options?: ShareStoryOptions) => void, true, never>; |
@@ -12,5 +12,5 @@ import { SwitchInlineQueryChatType } from '@telegram-apps/bridge'; | ||
* @since Mini Apps v6.7 | ||
* @throws {TypedError} ERR_NOT_SUPPORTED | ||
* @throws {TypedError} ERR_UNKNOWN_ENV | ||
* @throws {TypedError} ERR_NOT_INITIALIZED | ||
* @throws {FunctionNotAvailableError} The function is not supported | ||
* @throws {FunctionNotAvailableError} The environment is unknown | ||
* @throws {FunctionNotAvailableError} The SDK is not initialized | ||
* @example | ||
@@ -21,2 +21,2 @@ * if (switchInlineQuery.isAvailable()) { | ||
*/ | ||
export declare const switchInlineQuery: import('../../toolkit/wrapSafe.js').SafeWrapped<(query: string, chatTypes?: SwitchInlineQueryChatType[]) => void, true, never>; | ||
export declare const switchInlineQuery: import('../../wrappers/wrapSafe.js').SafeWrapped<(query: string, chatTypes?: SwitchInlineQueryChatType[]) => void, false, never>; |
@@ -0,1 +1,3 @@ | ||
import { RequestOptions } from '@telegram-apps/bridge'; | ||
import { PromiseOptions } from 'better-promises'; | ||
/** | ||
@@ -5,1 +7,3 @@ * Function with any arguments list and return type. | ||
export type AnyFn = (...args: any[]) => any; | ||
export type RequestOptionsNoCapture = Omit<RequestOptions<never>, 'capture'>; | ||
export type AsyncOptions = Omit<PromiseOptions, 'rejectOnAbort'>; |
@@ -1,13 +0,12 @@ | ||
export type SafeCallResult<T, E> = { | ||
result: T; | ||
} | { | ||
error: E; | ||
}; | ||
export type SafeCallResult<Data, Error> = [ok: true, data: Data] | [ok: false, error: Error]; | ||
/** | ||
* Calls the function and prevents it from throwing error. It returns an object | ||
* with one of two properties: `result` or `error`. | ||
* Calls the function and prevents it from throwing an error. | ||
* Instead, it handles the error and returns it as a value. | ||
* The returned tuple reminds tuples in GoLang. | ||
* | ||
* You can use this function to safely execute any other function. | ||
* @param fn - function to call. | ||
* @returns A tuple with either true on the first place and date on the second if the call | ||
* is successful, or false on the first place and error on the second if something went wrong. | ||
*/ | ||
export declare function safeCall<T, E = unknown>(fn: () => T): SafeCallResult<T, E>; |
{ | ||
"name": "@telegram-apps/sdk", | ||
"version": "2.11.3", | ||
"version": "3.0.0-beta.1", | ||
"description": "TypeScript Source Development Kit for Telegram Mini Apps client application.", | ||
@@ -38,11 +38,15 @@ "author": "Vladislav Kibenko <wolfram.deus@gmail.com>", | ||
"dependencies": { | ||
"better-promises": "^0.4.0", | ||
"error-kid": "^0.0.4", | ||
"valibot": "1.0.0-beta.14", | ||
"@telegram-apps/bridge": "^2.0.0", | ||
"@telegram-apps/navigation": "^1.0.13", | ||
"@telegram-apps/signals": "^1.1.1", | ||
"@telegram-apps/toolkit": "^1.1.1", | ||
"@telegram-apps/transformers": "^1.2.2", | ||
"@telegram-apps/toolkit": "^1.1.1", | ||
"@telegram-apps/bridge": "^1.9.2", | ||
"@telegram-apps/signals": "^1.1.1", | ||
"@telegram-apps/navigation": "^1.0.13" | ||
"@telegram-apps/types": "^1.2.1" | ||
}, | ||
"devDependencies": { | ||
"test-utils": "0.0.1", | ||
"tsconfig": "0.0.2" | ||
"tsconfig": "0.0.2", | ||
"test-utils": "0.0.1" | ||
}, | ||
@@ -49,0 +53,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2006612
7676
9
124
1
+ Added@telegram-apps/types@^1.2.1
+ Addedbetter-promises@^0.4.0
+ Addederror-kid@^0.0.4
+ Addedvalibot@1.0.0-beta.14
+ Added@telegram-apps/bridge@2.3.0(transitive)
+ Added@telegram-apps/toolkit@2.0.0(transitive)
+ Added@telegram-apps/transformers@2.1.0(transitive)
+ Added@telegram-apps/types@2.0.0(transitive)
+ Addedbetter-promises@0.4.0(transitive)
+ Addederror-kid@0.0.4(transitive)
+ Addedmitt@3.0.1(transitive)
+ Addedvalibot@1.0.0-beta.14(transitive)
Updated@telegram-apps/bridge@^2.0.0