@telegram-apps/sdk
Version:
TypeScript Source Development Kit for Telegram Mini Apps client application.
48 lines (47 loc) • 2.14 kB
TypeScript
import { InvoiceStatus } from '@telegram-apps/bridge';
import { AbortablePromise } from 'better-promises';
import { RequestOptionsNoCapture } from '../../../types.js';
/**
* Signal indicating if invoices are supported.
*/
export declare const isSupported: import('@telegram-apps/signals').Computed<boolean>;
/**
* Opens an invoice using its slug.
* @param slug - invoice slug.
* @param options - additional options.
* @since Mini Apps v6.1
* @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
* if (open.isAvailable()) {
* const status = await open('kJNFS331');
* }
*/
declare function _open(slug: string, options?: RequestOptionsNoCapture): AbortablePromise<InvoiceStatus>;
/**
* Opens an invoice using its url.
* @param url - invoice URL.
* @param type - value type.
* @param options - additional options.
* @since Mini Apps v6.1
* @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
* if (open.isAvailable()) {
* const status = await open('https://t.me/$kJNFS331', 'url');
* }
* @example
* if (open.isAvailable()) {
* const status = await open('https://t.me/invoice/kJNFS331', 'url');
* }
*/
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 {};