@open-wa/wa-automate-types-only 4.24.1 → 4.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/Client.d.ts +8 -1
- package/dist/api/model/config.d.ts +5 -0
- package/dist/cli/integrations/chatwoot.d.ts +6 -0
- package/dist/cli/server.d.ts +1 -0
- package/dist/controllers/initializer.d.ts +1 -36
- package/dist/controllers/patch_manager.d.ts +37 -0
- package/dist/structures/Dialog.d.ts +55 -0
- package/dist/utils/tools.d.ts +1 -0
- package/package.json +1 -1
package/dist/api/Client.d.ts
CHANGED
@@ -39,6 +39,8 @@ export declare class Client {
|
|
39
39
|
private _refreshing;
|
40
40
|
private _l;
|
41
41
|
private _prio;
|
42
|
+
private _pageListeners;
|
43
|
+
private _registeredPageListeners;
|
42
44
|
private _queues;
|
43
45
|
/**
|
44
46
|
* This is used to track if a listener is already used via webhook. Before, webhooks used to be set once per listener. Now a listener can be set via multiple webhooks, or revoked from a specific webhook.
|
@@ -104,6 +106,7 @@ export declare class Client {
|
|
104
106
|
*
|
105
107
|
*/
|
106
108
|
private registerListener;
|
109
|
+
private registerPageEventListener;
|
107
110
|
/**
|
108
111
|
* Listens to a log out event
|
109
112
|
*
|
@@ -111,7 +114,11 @@ export declare class Client {
|
|
111
114
|
* @param fn callback
|
112
115
|
* @fires `true`
|
113
116
|
*/
|
114
|
-
onLogout(fn: (loggedOut?: boolean) => any): Promise<boolean>;
|
117
|
+
onLogout(fn: (loggedOut?: boolean) => any, priority?: number): Promise<boolean>;
|
118
|
+
/**
|
119
|
+
* Wait for the webhook queue to become idle. This is useful for ensuring webhooks are cleared before ending a process.
|
120
|
+
*/
|
121
|
+
waitWhQIdle(): Promise<any>;
|
115
122
|
/**
|
116
123
|
* If you have set `onAnyMessage` or `onMessage` with the second parameter (PQueue options) then you may want to inspect their respective PQueue's.
|
117
124
|
*/
|
@@ -552,6 +552,11 @@ export interface ConfigObject {
|
|
552
552
|
* This will force the library to use the default cached raw github link for patches to shave a few hundred milliseconds from your launch time. If you use this option, you will need to wait about 5 minutes before trying out new patches.
|
553
553
|
* @default `false`
|
554
554
|
*/
|
555
|
+
ghPatch?: boolean;
|
556
|
+
/**
|
557
|
+
* Setting this to `true` will save a local copy of the patches.json file (as patches.ignore.data.json) which will be used in subsequent instantiations of the session. While the rest of the launch procedure is running, the library will fetch and save a recent version of the patches to ensure your patches don't go stale. This will be ignored if the cached patches are more than a day old.
|
558
|
+
* @default `false`
|
559
|
+
*/
|
555
560
|
cachedPatch?: boolean;
|
556
561
|
/**
|
557
562
|
* Setting `this` to true will replace the `console.table` with a stringified logging of the debug info object instead. This would be useful to set for smaller terminal windows. If `disableSpins` is `true` then this will also be `true`.
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { Client } from '../..';
|
2
|
+
import { cliFlags } from '../server';
|
3
|
+
import { Request, Response } from "express";
|
4
|
+
export declare type expressMiddleware = (req: Request, res: Response) => Promise<Response<any, Record<string, any>>>;
|
5
|
+
export declare const chatwootMiddleware: (cliConfig: cliFlags, client: Client) => expressMiddleware;
|
6
|
+
export declare const setupChatwootOutgoingMessageHandler: (cliConfig: cliFlags, client: Client) => Promise<void>;
|
package/dist/cli/server.d.ts
CHANGED
@@ -16,5 +16,6 @@ export declare const getCommands: () => any;
|
|
16
16
|
export declare const listListeners: () => string[];
|
17
17
|
export declare const setupMediaMiddleware: () => void;
|
18
18
|
export declare const setupTwilioCompatibleWebhook: (cliConfig: cliFlags, client: Client) => void;
|
19
|
+
export declare const setupChatwoot: (cliConfig: cliFlags, client: Client) => void;
|
19
20
|
export declare const setupBotPressHandler: (cliConfig: cliFlags, client: Client) => void;
|
20
21
|
export declare const setupSocketServer: (cliConfig: any, client: Client) => Promise<void>;
|
@@ -1,8 +1,6 @@
|
|
1
1
|
import { Client } from '../api/Client';
|
2
2
|
import { ConfigObject } from '../api/model/index';
|
3
|
-
|
4
|
-
import { SessionInfo } from '../api/model/sessionInfo';
|
5
|
-
import { Page } from 'puppeteer';
|
3
|
+
export declare const pkg: any, configWithCases: any, timeout: (ms: number) => Promise<unknown>;
|
6
4
|
export declare let screenshot: any;
|
7
5
|
/**
|
8
6
|
* Used to initialize the client session.
|
@@ -22,36 +20,3 @@ export declare let screenshot: any;
|
|
22
20
|
* @param config ConfigObject] The extended custom configuration
|
23
21
|
*/
|
24
22
|
export declare function create(config?: ConfigObject): Promise<Client>;
|
25
|
-
/**
|
26
|
-
* @private
|
27
|
-
*/
|
28
|
-
export declare function getPatch(config: ConfigObject, spinner?: Spin, sessionInfo?: SessionInfo): Promise<{
|
29
|
-
data: any;
|
30
|
-
tag: string;
|
31
|
-
}>;
|
32
|
-
/**
|
33
|
-
* @private
|
34
|
-
* @param page
|
35
|
-
* @param spinner
|
36
|
-
*/
|
37
|
-
export declare function injectLivePatch(page: Page, patch: {
|
38
|
-
data: any;
|
39
|
-
tag: string;
|
40
|
-
}, spinner?: Spin): Promise<void>;
|
41
|
-
/**
|
42
|
-
* @private
|
43
|
-
*/
|
44
|
-
export declare function getAndInjectLivePatch(page: Page, spinner?: Spin, preloadedPatch?: {
|
45
|
-
data: any;
|
46
|
-
tag: string;
|
47
|
-
}, config?: ConfigObject, sessionInfo?: SessionInfo): Promise<void>;
|
48
|
-
/**
|
49
|
-
* @private
|
50
|
-
*/
|
51
|
-
export declare function getLicense(config: ConfigObject, me: {
|
52
|
-
_serialized: string;
|
53
|
-
}, debugInfo: SessionInfo, spinner?: Spin): Promise<string | false>;
|
54
|
-
export declare function earlyInjectionCheck(page: Page): Promise<(page: Page) => boolean>;
|
55
|
-
export declare function getAndInjectLicense(page: Page, config: ConfigObject, me: {
|
56
|
-
_serialized: string;
|
57
|
-
}, debugInfo: SessionInfo, spinner?: Spin, preloadedLicense?: string | false): Promise<boolean>;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { ConfigObject } from '../api/model/index';
|
2
|
+
import { Spin } from './events';
|
3
|
+
import { SessionInfo } from '../api/model/sessionInfo';
|
4
|
+
import { Page } from 'puppeteer';
|
5
|
+
/**
|
6
|
+
* @private
|
7
|
+
*/
|
8
|
+
export declare function getPatch(config: ConfigObject, spinner?: Spin, sessionInfo?: SessionInfo): Promise<{
|
9
|
+
data: any;
|
10
|
+
tag: string;
|
11
|
+
}>;
|
12
|
+
/**
|
13
|
+
* @private
|
14
|
+
* @param page
|
15
|
+
* @param spinner
|
16
|
+
*/
|
17
|
+
export declare function injectLivePatch(page: Page, patch: {
|
18
|
+
data: any;
|
19
|
+
tag: string;
|
20
|
+
}, spinner?: Spin): Promise<void>;
|
21
|
+
/**
|
22
|
+
* @private
|
23
|
+
*/
|
24
|
+
export declare function getAndInjectLivePatch(page: Page, spinner?: Spin, preloadedPatch?: {
|
25
|
+
data: any;
|
26
|
+
tag: string;
|
27
|
+
}, config?: ConfigObject, sessionInfo?: SessionInfo): Promise<void>;
|
28
|
+
/**
|
29
|
+
* @private
|
30
|
+
*/
|
31
|
+
export declare function getLicense(config: ConfigObject, me: {
|
32
|
+
_serialized: string;
|
33
|
+
}, debugInfo: SessionInfo, spinner?: Spin): Promise<string | false>;
|
34
|
+
export declare function earlyInjectionCheck(page: Page): Promise<(page: Page) => boolean>;
|
35
|
+
export declare function getAndInjectLicense(page: Page, config: ConfigObject, me: {
|
36
|
+
_serialized: string;
|
37
|
+
}, debugInfo: SessionInfo, spinner?: Spin, preloadedLicense?: string | false): Promise<boolean>;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { Message } from "..";
|
2
|
+
export interface CurrentDialogProps {
|
3
|
+
[k: string]: any;
|
4
|
+
}
|
5
|
+
export interface DialogState {
|
6
|
+
currentStep: number;
|
7
|
+
currentProps: any;
|
8
|
+
lastInput: any;
|
9
|
+
isComplete: boolean;
|
10
|
+
isError: boolean;
|
11
|
+
errorMessage: string;
|
12
|
+
}
|
13
|
+
export interface DialogTemplate {
|
14
|
+
"dialogId": string;
|
15
|
+
"privateOnly": boolean;
|
16
|
+
"identifier": string;
|
17
|
+
"successMessage": string;
|
18
|
+
"startMessage": string;
|
19
|
+
"properties": {
|
20
|
+
[key: string]: DialogProperty;
|
21
|
+
};
|
22
|
+
}
|
23
|
+
export declare type CheckFunction = (lastReceivedMessage: Message, currentProps: CurrentDialogProps) => boolean;
|
24
|
+
export interface DialogProperty {
|
25
|
+
"order": number;
|
26
|
+
"key": string;
|
27
|
+
"prompt": string;
|
28
|
+
"type": string;
|
29
|
+
"skipCondition"?: CheckFunction;
|
30
|
+
"options"?: DialogButtons[] | DialogListMessageSection[];
|
31
|
+
"validation": DialogValidation[];
|
32
|
+
}
|
33
|
+
export interface DialogButtons {
|
34
|
+
label: string;
|
35
|
+
value: string;
|
36
|
+
}
|
37
|
+
export interface DialogListMessageSection {
|
38
|
+
title: string;
|
39
|
+
rows: DialogListMessageRow[];
|
40
|
+
}
|
41
|
+
export interface DialogListMessageRow {
|
42
|
+
title: string;
|
43
|
+
description: string;
|
44
|
+
value: string;
|
45
|
+
}
|
46
|
+
export interface DialogValidation {
|
47
|
+
"type": ValidationType;
|
48
|
+
"value": string | CheckFunction;
|
49
|
+
"errorMessage": string;
|
50
|
+
}
|
51
|
+
export declare enum ValidationType {
|
52
|
+
REGEX = "regex",
|
53
|
+
LENGTH = "length",
|
54
|
+
CHECK = "check"
|
55
|
+
}
|
package/dist/utils/tools.d.ts
CHANGED
@@ -24,3 +24,4 @@ export declare const getDUrl: (url: string, optionsOverride?: AxiosRequestConfig
|
|
24
24
|
* Use this to extract the mime type from a [[DataURL]]
|
25
25
|
*/
|
26
26
|
export declare const base64MimeType: (dUrl: DataURL) => string;
|
27
|
+
export declare const processSend: (message: string) => void;
|