bm-webapp-sdk 0.1.2 → 0.1.3
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/dist/index.d.ts +1 -57
- package/esm/index.js +2 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,63 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
sessionHash?: string;
|
|
3
|
-
scenarioCode?: string;
|
|
4
|
-
initVariables?: TData;
|
|
5
|
-
botTokenParamName?: string;
|
|
6
|
-
userApiToken?: string;
|
|
7
|
-
retryDelayOnTimeout?: number;
|
|
8
|
-
requestTimeout?: number;
|
|
9
|
-
responseVar?: string;
|
|
10
|
-
apiEndpoint?: string;
|
|
11
|
-
}
|
|
12
|
-
type TData = {
|
|
13
|
-
[key: string]: any;
|
|
14
|
-
};
|
|
15
|
-
interface INodeEventsDecl {
|
|
16
|
-
inbox: boolean;
|
|
17
|
-
outbox: boolean;
|
|
18
|
-
anyInbox: boolean;
|
|
19
|
-
dialogClosed: boolean;
|
|
20
|
-
invoicePaid: boolean;
|
|
21
|
-
externalRequest: boolean;
|
|
22
|
-
buttons: boolean;
|
|
23
|
-
customEvents: boolean;
|
|
24
|
-
}
|
|
25
|
-
interface INode {
|
|
26
|
-
id: number;
|
|
27
|
-
title: string;
|
|
28
|
-
typeName: "basic" | "event" | "eventListener" | "condition" | "conditionBranch";
|
|
29
|
-
waitingForEvents?: INodeEventsDecl;
|
|
30
|
-
}
|
|
31
|
-
type TScenarioSessionStatus = "active" | "stopped" | "ended" | "unknownError" | "tunnelDisabled" | "expired" | "userDisabled" | "stepDeleted" | "transitionsLimit" | "parentStopped";
|
|
32
|
-
interface ScenarioSession {
|
|
33
|
-
id: number;
|
|
34
|
-
hash: string;
|
|
35
|
-
statusName: TScenarioSessionStatus;
|
|
36
|
-
ref: string | null;
|
|
37
|
-
variables: TData;
|
|
38
|
-
isTransitioning: boolean;
|
|
39
|
-
currentNode: INode | null;
|
|
40
|
-
}
|
|
41
|
-
export default class WebAppHandler {
|
|
42
|
-
readonly options: HandlerOptions;
|
|
43
|
-
data?: ScenarioSession;
|
|
44
|
-
private currentRequest?;
|
|
45
|
-
constructor(options: HandlerOptions);
|
|
46
|
-
isActive(): boolean;
|
|
47
|
-
init(): Promise<WebAppHandler>;
|
|
48
|
-
refreshData(): Promise<WebAppHandler>;
|
|
49
|
-
request(code: string, params?: TData, async?: boolean): Promise<WebAppHandler>;
|
|
50
|
-
abort(): void;
|
|
51
|
-
isTelegramInitAvailable(): boolean;
|
|
52
|
-
protected initNewSession(): Promise<WebAppHandler>;
|
|
53
|
-
protected makeRequest(method: string, path: string, json?: TData, signal?: AbortSignal): Promise<any>;
|
|
54
|
-
private waitUntilSessionFinishesTransition;
|
|
55
|
-
}
|
|
56
|
-
|
|
1
|
+
import WebAppHandler from './WebAppHandler';
|
|
57
2
|
export { WebAppHandler };
|
|
58
3
|
declare global {
|
|
59
4
|
interface Window {
|
|
60
5
|
Telegram: any;
|
|
61
6
|
}
|
|
62
7
|
}
|
|
63
|
-
|
package/esm/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bm-webapp-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "
|
|
6
|
-
"types": "
|
|
5
|
+
"main": "esm/index.js",
|
|
6
|
+
"types": "esm/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"develop": "webpack-dev-server --mode development",
|
|
9
9
|
"build": "webpack --mode production"
|