@wppconnect/wa-js 1.1.19 → 1.2.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/CHANGELOG.md +4 -0
- package/dist/{auth → conn}/eventEmitter.d.ts +37 -3
- package/dist/conn/events/index.d.ts +22 -0
- package/dist/{auth/events/registerChangeEvent.d.ts → conn/events/registerAuthCodeChangeEvent.d.ts} +0 -0
- package/dist/{auth/events/registerIdleEvent.d.ts → conn/events/registerAuthenticatedEvent.d.ts} +0 -0
- package/dist/{auth → conn}/events/registerLogoutEvent.d.ts +0 -0
- package/dist/{auth/functions/poke.d.ts → conn/events/registerMainLoadedEvent.d.ts} +1 -1
- package/dist/conn/events/registerMainReadyEvent.d.ts +16 -0
- package/dist/conn/events/registerQRCodeIdleEvent.d.ts +16 -0
- package/dist/conn/events/registerRequireAuthEvent.d.ts +16 -0
- package/dist/{auth → conn}/functions/getAuthCode.d.ts +0 -0
- package/dist/{auth → conn}/functions/index.d.ts +2 -1
- package/dist/{auth → conn}/functions/isAuthenticated.d.ts +0 -0
- package/dist/{auth → conn}/functions/isIdle.d.ts +0 -0
- package/dist/conn/functions/isMainLoaded.d.ts +24 -0
- package/dist/{auth → conn}/functions/isMultiDevice.d.ts +0 -0
- package/dist/{auth → conn}/functions/logout.d.ts +0 -0
- package/dist/conn/functions/refreshQR.d.ts +28 -0
- package/dist/{auth → conn}/functions/setMultiDevice.d.ts +1 -1
- package/dist/{auth → conn}/index.d.ts +0 -0
- package/dist/{auth → conn}/types.d.ts +0 -0
- package/dist/index.d.ts +1 -1
- package/dist/whatsapp/misc/{State.d.ts → Socket.d.ts} +2 -2
- package/dist/{auth/events/index.d.ts → whatsapp/misc/Stream.d.ts} +3 -3
- package/dist/whatsapp/misc/index.d.ts +2 -1
- package/dist/whatsapp/models/{StateModel.d.ts → SocketModel.d.ts} +3 -3
- package/dist/whatsapp/models/StreamModel.d.ts +61 -0
- package/dist/whatsapp/models/index.d.ts +2 -1
- package/dist/wppconnect-wa.js +1 -1
- package/package.json +12 -17
- package/tests/check-auth.ts +2 -2
- package/tests/prepare.ts +3 -3
- package/dist/internal.d.ts +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -17,11 +17,45 @@ import Emittery from 'emittery';
|
|
|
17
17
|
import { AuthCode } from '.';
|
|
18
18
|
export declare type UnsubscribeFn = () => void;
|
|
19
19
|
export interface EventTypes {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
auth_code_change: AuthCode | null;
|
|
21
|
+
/**
|
|
22
|
+
* Triggered afted a success QR code scan
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```javascript
|
|
26
|
+
* WPP.conn.on('authenticated', () => {
|
|
27
|
+
* // Your code
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
authenticated: undefined;
|
|
22
32
|
logout: undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Triggered when the main interface is loaded, but is syncing
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```javascript
|
|
38
|
+
* WPP.conn.on('main_loaded', () => {
|
|
39
|
+
* // Your code
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
main_loaded: undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Triggered when the main interface is loaded, authenticated and ready to send message
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```javascript
|
|
49
|
+
* WPP.conn.on('main_ready', () => {
|
|
50
|
+
* // Your code
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
main_ready: undefined;
|
|
55
|
+
qrcode_idle: undefined;
|
|
56
|
+
require_auth: undefined;
|
|
23
57
|
}
|
|
24
|
-
export declare const eventEmitter: Emittery<EventTypes, EventTypes, "
|
|
58
|
+
export declare const eventEmitter: Emittery<EventTypes, EventTypes, "authenticated" | "logout" | "main_loaded" | "main_ready" | "qrcode_idle" | "require_auth">;
|
|
25
59
|
/**
|
|
26
60
|
* Subscribe to one event.
|
|
27
61
|
* @event
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import './registerAuthCodeChangeEvent';
|
|
17
|
+
import './registerAuthenticatedEvent';
|
|
18
|
+
import './registerLogoutEvent';
|
|
19
|
+
import './registerMainLoadedEvent';
|
|
20
|
+
import './registerMainReadyEvent';
|
|
21
|
+
import './registerQRCodeIdleEvent';
|
|
22
|
+
import './registerRequireAuthEvent';
|
package/dist/{auth/events/registerChangeEvent.d.ts → conn/events/registerAuthCodeChangeEvent.d.ts}
RENAMED
|
File without changes
|
package/dist/{auth/events/registerIdleEvent.d.ts → conn/events/registerAuthenticatedEvent.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
File without changes
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
export { getAuthCode } from './getAuthCode';
|
|
17
17
|
export { isAuthenticated } from './isAuthenticated';
|
|
18
18
|
export { isIdle } from './isIdle';
|
|
19
|
+
export { isMainLoaded } from './isMainLoaded';
|
|
19
20
|
export { isMultiDevice } from './isMultiDevice';
|
|
20
21
|
export { logout } from './logout';
|
|
21
|
-
export {
|
|
22
|
+
export { refreshQR } from './refreshQR';
|
|
22
23
|
export { setMultiDevice } from './setMultiDevice';
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Check is main interface is loaded and authenticated
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```javascript
|
|
21
|
+
* const isMainLoaded = WPP.conn.isMainLoaded();
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function isMainLoaded(): boolean;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { AuthCode } from '..';
|
|
17
|
+
/**
|
|
18
|
+
* Refresh the current QRCode when is waiting for scan and return the current code
|
|
19
|
+
*
|
|
20
|
+
* For legacy: It will wait for next code
|
|
21
|
+
* For multidevice: It will generate a new one
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```javascript
|
|
25
|
+
* await WPP.conn.refreshQR();
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function refreshQR(): Promise<AuthCode | null>;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* @param md If it's true, WhatsApp WEB will switch to MD. If it's false, WhatsApp WEB will switch to Legacy.
|
|
18
18
|
* @example
|
|
19
19
|
* ```javascript
|
|
20
|
-
* WPP.
|
|
20
|
+
* WPP.conn.setMultiDevice(true)
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
export declare function setMultiDevice(md?: boolean): boolean;
|
|
File without changes
|
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
@@ -20,9 +20,9 @@ import * as webpack from './webpack';
|
|
|
20
20
|
export { webpack };
|
|
21
21
|
export { isInjected, isReady } from './webpack';
|
|
22
22
|
export * as config from './config';
|
|
23
|
-
export * as auth from './auth';
|
|
24
23
|
export * as blocklist from './blocklist';
|
|
25
24
|
export * as chat from './chat';
|
|
25
|
+
export * as conn from './conn';
|
|
26
26
|
export * as contact from './contact';
|
|
27
27
|
export * as group from './group';
|
|
28
28
|
export * as labels from './labels';
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
16
|
+
import { SocketModel } from '../models';
|
|
17
17
|
/** @whatsapp 65044 */
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const Socket: SocketModel;
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import '
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
import { StreamModel } from '../models';
|
|
17
|
+
/** @whatsapp 8080 */
|
|
18
|
+
export declare const Stream: StreamModel;
|
|
@@ -32,7 +32,8 @@ export * from './MediaUtils';
|
|
|
32
32
|
export * from './MsgKey';
|
|
33
33
|
export * from './MsgLoadState';
|
|
34
34
|
export * from './OpaqueData';
|
|
35
|
-
export * from './
|
|
35
|
+
export * from './Socket';
|
|
36
|
+
export * from './Stream';
|
|
36
37
|
export * from './UserPrefs';
|
|
37
38
|
export * from './VCard';
|
|
38
39
|
export * from './Wap';
|
|
@@ -55,11 +55,11 @@ interface Session {
|
|
|
55
55
|
interface Derived {
|
|
56
56
|
}
|
|
57
57
|
/** @whatsapp 65044 */
|
|
58
|
-
export declare interface
|
|
58
|
+
export declare interface SocketModel extends ModelProxy<Props, Session, Derived> {
|
|
59
59
|
}
|
|
60
60
|
/** @whatsapp 65044 */
|
|
61
|
-
export declare class
|
|
62
|
-
constructor(proterties?: ModelPropertiesContructor<
|
|
61
|
+
export declare class SocketModel extends Model {
|
|
62
|
+
constructor(proterties?: ModelPropertiesContructor<SocketModel>, options?: ModelOptions);
|
|
63
63
|
initialize(): any;
|
|
64
64
|
preload(): any;
|
|
65
65
|
send(e?: any): any;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Model, ModelOptions, ModelPropertiesContructor, ModelProxy } from './Model';
|
|
17
|
+
interface Props {
|
|
18
|
+
}
|
|
19
|
+
interface Session {
|
|
20
|
+
info?: any;
|
|
21
|
+
mode: string;
|
|
22
|
+
obscurity?: any;
|
|
23
|
+
needsUpdate?: any;
|
|
24
|
+
clientExpired?: any;
|
|
25
|
+
hardExpired?: any;
|
|
26
|
+
lastSyncStart?: any;
|
|
27
|
+
needsManualDownload?: any;
|
|
28
|
+
couldForce?: any;
|
|
29
|
+
uiActive?: any;
|
|
30
|
+
available?: any;
|
|
31
|
+
unavailableShiftTimer?: any;
|
|
32
|
+
unavailableLogoutTimer?: any;
|
|
33
|
+
unobscureShiftTimer?: any;
|
|
34
|
+
timeoutEvent?: any;
|
|
35
|
+
resumeCount?: any;
|
|
36
|
+
phoneAuthed?: any;
|
|
37
|
+
}
|
|
38
|
+
interface Derived {
|
|
39
|
+
displayInfo?: any;
|
|
40
|
+
}
|
|
41
|
+
/** @whatsapp 8080 */
|
|
42
|
+
export declare interface StreamModel extends ModelProxy<Props, Session, Derived> {
|
|
43
|
+
}
|
|
44
|
+
/** @whatsapp 8080 */
|
|
45
|
+
export declare class StreamModel extends Model {
|
|
46
|
+
constructor(proterties?: ModelPropertiesContructor<StreamModel>, options?: ModelOptions);
|
|
47
|
+
markAvailable(): void;
|
|
48
|
+
markUnavailable(e?: any): void;
|
|
49
|
+
onSelfUpdate(): void;
|
|
50
|
+
onSocketUpdate(): void;
|
|
51
|
+
unobscure(): void;
|
|
52
|
+
onPhoneAuthedUpdate(): void;
|
|
53
|
+
onAvailableUpdate(): void;
|
|
54
|
+
sendAvailability(e?: any): void;
|
|
55
|
+
updateCouldForce(): void;
|
|
56
|
+
updateHardExpire(): void;
|
|
57
|
+
logPageResume(): void;
|
|
58
|
+
updateWamLog(): void;
|
|
59
|
+
logModeChange(): void;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
@@ -54,11 +54,12 @@ export * from './QuickReplyModel';
|
|
|
54
54
|
export * from './RecentEmojiModel';
|
|
55
55
|
export * from './RecentStickerModel';
|
|
56
56
|
export * from './ReplyButtonModel';
|
|
57
|
-
export * from './
|
|
57
|
+
export * from './SocketModel';
|
|
58
58
|
export * from './StatusModel';
|
|
59
59
|
export * from './StatusV3Model';
|
|
60
60
|
export * from './StickerModel';
|
|
61
61
|
export * from './StickerPackModel';
|
|
62
|
+
export * from './StreamModel';
|
|
62
63
|
export * from './TemplateButtonModel';
|
|
63
64
|
export * from './UnreadMentionModel';
|
|
64
65
|
export * from './WebCallModel';
|