@vbotma/sdk 3.3.4 → 3.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/dist/dts/features/HapticFeedback/HapticFeedback.d.ts +3 -3
- package/dist/dts/features/InitData/InitData.d.ts +0 -1
- package/dist/dts/features/Invoice/Invoice.d.ts +1 -1
- package/dist/dts/features/MiniApp/MiniApp.d.ts +1 -1
- package/dist/dts/features/Popup/types.d.ts +0 -2
- package/dist/dts/features/links/openVBotLink.d.ts +2 -2
- package/dist/dts/features/links/shareURL.d.ts +1 -3
- package/dist/dts/features/privacy/requestContact.d.ts +1 -1
- package/dist/dts/features/uncategorized/downloadFile.d.ts +1 -1
- package/dist/dts/features/uncategorized/getCurrentTime.d.ts +1 -1
- package/dist/dts/features/uncategorized/retrieveAndroidDeviceData.d.ts +0 -1
- package/dist/dts/features/uncategorized/retrieveAndroidDeviceDataFrom.d.ts +0 -1
- package/dist/dts/features/uncategorized/sendData.d.ts +0 -1
- package/dist/dts/features/uncategorized/shareStory.d.ts +3 -3
- package/dist/dts/host-features/Link/HostLink.d.ts +2 -2
- package/dist/dts/init.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +3 -3
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +156 -157
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
[docs-badge]: https://img.shields.io/badge/documentation-blue?logo=gitbook&logoColor=white
|
|
6
6
|
|
|
7
|
-
[link]: https://github.com/Telegram-Mini-Apps/tma.js/tree/master/tma.js/sdk
|
|
8
7
|
|
|
9
8
|
[docs-link]: https://docs.vbot-mini-apps.com/packages/tma-js-sdk
|
|
10
9
|
|
|
@@ -22,11 +21,11 @@
|
|
|
22
21
|
Made from scratch TypeScript library for seamless communication with VBot Mini Apps
|
|
23
22
|
functionality.
|
|
24
23
|
|
|
25
|
-
The code of this library is designed to simplify the process of developers interacting with
|
|
24
|
+
The code of this library is designed to simplify the process of developers interacting with VBot
|
|
26
25
|
Mini Apps. It consists of several individual components, each responsible for a specific aspect of
|
|
27
26
|
the VBot Mini Apps ecosystem.
|
|
28
27
|
|
|
29
|
-
Before you begin using the SDK, we highly recommend familiarizing yourself with the
|
|
28
|
+
Before you begin using the SDK, we highly recommend familiarizing yourself with the VBot Mini
|
|
30
29
|
Apps [documentation](https://docs.vbot-mini-apps.com/platform/about)
|
|
31
30
|
to grasp the fundamental concepts of the platform.
|
|
32
31
|
|
|
@@ -18,7 +18,7 @@ export declare class HapticFeedback {
|
|
|
18
18
|
*/
|
|
19
19
|
readonly isSupported: Computed<boolean>;
|
|
20
20
|
/**
|
|
21
|
-
* A method that tells if an impact occurred. The
|
|
21
|
+
* A method that tells if an impact occurred. The VBot app may play the
|
|
22
22
|
* appropriate haptics based on style value passed.
|
|
23
23
|
* @param style - impact style.
|
|
24
24
|
* @since Mini Apps v6.1
|
|
@@ -30,7 +30,7 @@ export declare class HapticFeedback {
|
|
|
30
30
|
impactOccurred: WithChecks<(style: ImpactHapticFeedbackStyle) => void, true>;
|
|
31
31
|
/**
|
|
32
32
|
* A method tells that a task or action has succeeded, failed, or produced
|
|
33
|
-
* a warning. The
|
|
33
|
+
* a warning. The VBot app may play the appropriate haptics based on type
|
|
34
34
|
* value passed.
|
|
35
35
|
* @param type - notification type.
|
|
36
36
|
* @since Mini Apps v6.1
|
|
@@ -41,7 +41,7 @@ export declare class HapticFeedback {
|
|
|
41
41
|
*/
|
|
42
42
|
notificationOccurred: WithChecks<(type: NotificationHapticFeedbackType) => void, true>;
|
|
43
43
|
/**
|
|
44
|
-
* A method tells that the user has changed a selection. The
|
|
44
|
+
* A method tells that the user has changed a selection. The VBot app may
|
|
45
45
|
* play the appropriate haptics.
|
|
46
46
|
*
|
|
47
47
|
* Do not use this feedback when the user makes or confirms a selection; use
|
|
@@ -29,7 +29,6 @@ export declare class InitData<Err extends Error> {
|
|
|
29
29
|
readonly canSendAfter: Computed<number | undefined>;
|
|
30
30
|
/**
|
|
31
31
|
* Date after which it is allowed to call
|
|
32
|
-
* the [answerWebAppQuery](https://core.telegram.org/bots/api#answerwebappquery) method.
|
|
33
32
|
*/
|
|
34
33
|
readonly canSendAfterDate: Computed<Date | undefined>;
|
|
35
34
|
/**
|
|
@@ -43,7 +43,7 @@ export declare class Invoice {
|
|
|
43
43
|
* @param options - additional options.
|
|
44
44
|
* @since Mini Apps v6.1
|
|
45
45
|
* @example
|
|
46
|
-
* const status = await invoice.openUrl('https://
|
|
46
|
+
* const status = await invoice.openUrl('https://vbot.vn/$kJNFS331');
|
|
47
47
|
*/
|
|
48
48
|
readonly openUrlFp: WithChecksFp<(url: string, options?: AsyncOptions) => (InvoiceTask<InvalidArgumentsError, InvoiceStatus>), true>;
|
|
49
49
|
/**
|
|
@@ -172,7 +172,7 @@ export declare class MiniApp {
|
|
|
172
172
|
*/
|
|
173
173
|
readonly close: WithChecks<(returnBack?: boolean) => void, false>;
|
|
174
174
|
/**
|
|
175
|
-
* Informs the
|
|
175
|
+
* Informs the VBot app that the Mini App is ready to be displayed.
|
|
176
176
|
*
|
|
177
177
|
* It is recommended to call this method as early as possible, as soon as all
|
|
178
178
|
* essential interface elements loaded.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AsyncOptions } from '../../types.js';
|
|
2
2
|
/**
|
|
3
3
|
* This object describes the native popup.
|
|
4
|
-
* @see https://core.telegram.org/bots/webapps#popupparams
|
|
5
4
|
*/
|
|
6
5
|
export interface ShowOptions extends AsyncOptions {
|
|
7
6
|
/**
|
|
@@ -21,7 +20,6 @@ export interface ShowOptions extends AsyncOptions {
|
|
|
21
20
|
}
|
|
22
21
|
/**
|
|
23
22
|
* This object describes the native popup button.
|
|
24
|
-
* @see https://core.telegram.org/bots/webapps#popupbutton
|
|
25
23
|
*/
|
|
26
24
|
export type ShowOptionsButton = {
|
|
27
25
|
/**
|
|
@@ -4,12 +4,12 @@ import { InvalidArgumentsError } from '../../errors.js';
|
|
|
4
4
|
export type OpenVBotLinkError = PostEventError | InvalidArgumentsError;
|
|
5
5
|
/**
|
|
6
6
|
* Opens a VBot link inside the VBot app. The function expects passing a link in a full
|
|
7
|
-
* format using the hostname "
|
|
7
|
+
* format using the hostname "vbot.vn".
|
|
8
8
|
*
|
|
9
9
|
* The Mini App will be closed.
|
|
10
10
|
* @param url - URL to be opened.
|
|
11
11
|
* @example
|
|
12
|
-
* openVBotLink('https://
|
|
12
|
+
* openVBotLink('https://vbot.vn/heyqbnk');
|
|
13
13
|
*/
|
|
14
14
|
export declare const openVBotLinkFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(url: string | URL) => E.Either<OpenVBotLinkError, void>, false, never>;
|
|
15
15
|
/**
|
|
@@ -5,11 +5,9 @@ export type ShareURLError = PostEventError;
|
|
|
5
5
|
* Shares the specified URL with the passed to the chats, selected by user.
|
|
6
6
|
* After being called, it closes the mini application.
|
|
7
7
|
*
|
|
8
|
-
* This method uses
|
|
8
|
+
* This method uses VBot's Share Links.
|
|
9
9
|
* @param url - URL to share.
|
|
10
10
|
* @param text - text to append after the URL.
|
|
11
|
-
* @see https://core.telegram.org/api/links#share-links
|
|
12
|
-
* @see https://core.telegram.org/widgets/share#custom-buttons
|
|
13
11
|
*/
|
|
14
12
|
export declare const shareURLFp: import('../../with-checks/withChecksFp.js').WithChecksFp<(url: string, text?: string) => E.Either<ShareURLError, void>, false, never>;
|
|
15
13
|
/**
|
|
@@ -23,7 +23,7 @@ export interface RequestedContact {
|
|
|
23
23
|
*/
|
|
24
24
|
export interface RequestedContactCompleteData {
|
|
25
25
|
/**
|
|
26
|
-
* Raw original representation of the contact data returned from the
|
|
26
|
+
* Raw original representation of the contact data returned from the VBot server.
|
|
27
27
|
*/
|
|
28
28
|
raw: string;
|
|
29
29
|
/**
|
|
@@ -11,7 +11,7 @@ export type DownloadFileError = RequestError | AccessDeniedError;
|
|
|
11
11
|
* @since Mini Apps v8.0
|
|
12
12
|
* @example
|
|
13
13
|
* fn.pipe(
|
|
14
|
-
* downloadFileFp('https://
|
|
14
|
+
* downloadFileFp('https://vbot.org/js/vbot-web-app.js', 'vbot-sdk.js'),
|
|
15
15
|
* TE.map(() => {
|
|
16
16
|
* console.log('Downloading');
|
|
17
17
|
* })
|
|
@@ -4,7 +4,7 @@ import { InvokeCustomMethodError } from '../../fn-options/withInvokeCustomMethod
|
|
|
4
4
|
import { AsyncOptions } from '../../types.js';
|
|
5
5
|
export type GetCurrentTimeError = InvokeCustomMethodError | ValidationError;
|
|
6
6
|
/**
|
|
7
|
-
* @returns The current time according to the
|
|
7
|
+
* @returns The current time according to the VBot server time.
|
|
8
8
|
* @param options - additional options.
|
|
9
9
|
* @since Mini Apps v6.9
|
|
10
10
|
*/
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AndroidDeviceData } from './retrieveAndroidDeviceDataFrom.js';
|
|
2
2
|
/**
|
|
3
3
|
* Retrieves Android device data from the navigator.userAgent.
|
|
4
|
-
* @see https://core.telegram.org/bots/webapps#additional-data-in-user-agent
|
|
5
4
|
*/
|
|
6
5
|
export declare function retrieveAndroidDeviceData(): AndroidDeviceData;
|
|
@@ -8,7 +8,6 @@ export interface AndroidDeviceData {
|
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Retrieves Android device data from the specified User Agent.
|
|
11
|
-
* @see https://core.telegram.org/bots/webapps#additional-data-in-user-agent
|
|
12
11
|
* @param userAgent - user agent.
|
|
13
12
|
*/
|
|
14
13
|
export declare function retrieveAndroidDeviceDataFrom(userAgent: string): AndroidDeviceData;
|
|
@@ -8,7 +8,6 @@ export type SendDataError = PostEventError | InvalidArgumentsError;
|
|
|
8
8
|
* When this method called, a service message sent to the bot containing the data of the length
|
|
9
9
|
* up to 4096 bytes, and the Mini App closed.
|
|
10
10
|
*
|
|
11
|
-
* See the field `web_app_data` in the class [Message](https://core.telegram.org/bots/api#message).
|
|
12
11
|
*
|
|
13
12
|
* This method is only available for Mini Apps launched via a Keyboard button.
|
|
14
13
|
* @param data - data to send to bot.
|
|
@@ -4,13 +4,13 @@ export interface ShareStoryOptions {
|
|
|
4
4
|
/**
|
|
5
5
|
* The caption to be added to the media.
|
|
6
6
|
* 0-200 characters for regular users and 0-2048 characters for premium subscribers.
|
|
7
|
-
* @see https://
|
|
7
|
+
* @see https://vbot.org/faq_premium#vbot-premium
|
|
8
8
|
*/
|
|
9
9
|
text?: string;
|
|
10
10
|
/**
|
|
11
11
|
* An object that describes a widget link to be included in the story.
|
|
12
12
|
* Note that only premium subscribers can post stories with links.
|
|
13
|
-
* @see https://
|
|
13
|
+
* @see https://vbot.org/faq_premium#vbot-premium
|
|
14
14
|
*/
|
|
15
15
|
widgetLink?: {
|
|
16
16
|
/**
|
|
@@ -32,7 +32,7 @@ export type ShareStoryError = PostEventError;
|
|
|
32
32
|
* shareStory('https://example.com/background.png', {
|
|
33
33
|
* text: 'Look at this cool group!',
|
|
34
34
|
* widgetLink: {
|
|
35
|
-
* url: 'https://
|
|
35
|
+
* url: 'https://vbot.vn/heyqbnk',
|
|
36
36
|
* name: 'Vlad\'s community',
|
|
37
37
|
* },
|
|
38
38
|
* }),
|
|
@@ -5,8 +5,8 @@ export declare class HostLink {
|
|
|
5
5
|
*/
|
|
6
6
|
onOpenLink(listener: (params: MethodParams<'web_app_open_link'>) => void): VoidFunction;
|
|
7
7
|
/**
|
|
8
|
-
* Listens to '
|
|
8
|
+
* Listens to 'web_app_open_vb_link' methods calls from Mini App.
|
|
9
9
|
*/
|
|
10
|
-
onOpenTgLink(listener: (params: MethodParams<'
|
|
10
|
+
onOpenTgLink(listener: (params: MethodParams<'web_app_open_vb_link'>) => void): VoidFunction;
|
|
11
11
|
}
|
|
12
12
|
export declare const hostLink: HostLink;
|
package/dist/dts/init.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface InitOptions {
|
|
|
29
29
|
version?: Version;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* Initializes the SDK allowing it to properly handle events, sent from the native
|
|
32
|
+
* Initializes the SDK allowing it to properly handle events, sent from the native VBot
|
|
33
33
|
* application. This function also configure the package's global dependencies (functions,
|
|
34
34
|
* variables used across the package).
|
|
35
35
|
* @param options - function options.
|