@wppconnect/wa-js 2.22.2 → 2.23.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 CHANGED
@@ -1,5 +1 @@
1
- ## 2.22.2 (2023-03-15)
2
-
3
- ### Bug Fixes
4
-
5
- - Fixed WPP.chat.sendFileMessage function for WhatsApp >= 2.2312.5 (fix [#976](https://github.com/wppconnect-team/wa-js/issues/976)) ([261be97](https://github.com/wppconnect-team/wa-js/commit/261be97b98dac5673987606e3a795a8a7a200af3))
1
+ # 2.23.0 (2023-04-01)
@@ -0,0 +1,38 @@
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
+ * Accept a incoming call
18
+ *
19
+ * @example
20
+ * ```javascript
21
+ * // Accept any incoming call
22
+ * WPP.call.accept();
23
+ *
24
+ * // Accept specific call id
25
+ * WPP.call.accept(callId);
26
+ *
27
+ * // Accept any incoming call
28
+ * WPP.on('call.incoming_call', (call) => {
29
+ * setTimeout(() => {
30
+ * WPP.call.accept(call.id);
31
+ * }, 1000);
32
+ * });
33
+ * ```
34
+ *
35
+ * @param {string} callId The call ID, empty to accept the first one
36
+ * @return {[type]} [return description]
37
+ */
38
+ export declare function accept(callId?: string): Promise<boolean>;
@@ -0,0 +1,36 @@
1
+ /*!
2
+ * Copyright 2023 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
+ * End a outcoming call
18
+ *
19
+ * @example
20
+ * ```javascript
21
+ * // End any outcoming call
22
+ * WPP.call.end();
23
+ *
24
+ * // End specific call id
25
+ * WPP.call.end(callId);
26
+ *
27
+ * // End any outcoming call
28
+ * WPP.on('call.outcoming_call', (call) => {
29
+ * WPP.call.end(call.id);
30
+ * });
31
+ * ```
32
+ *
33
+ * @param {string} callId The call ID, empty to end the first one
34
+ * @return {[type]} [return description]
35
+ */
36
+ export declare function end(callId?: string): Promise<boolean>;
@@ -13,4 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { rejectCall } from './rejectCall';
16
+ export { accept } from './accept';
17
+ export { end } from './end';
18
+ export { offer } from './offer';
19
+ export { reject, reject as rejectCall } from './reject';
@@ -0,0 +1,33 @@
1
+ /*!
2
+ * Copyright 2023 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 { Wid } from '../../whatsapp';
17
+ export interface CallOfferOptions {
18
+ isVideo?: boolean;
19
+ }
20
+ /**
21
+ * Send a call offer
22
+ *
23
+ * This method only will send a call offer, but there are no audio/video
24
+ *
25
+ * @example
26
+ * ```javascript
27
+ * // Send a call offer
28
+ * WPP.call.offer('[number]@c.us');
29
+ * // Send a video call offer
30
+ * WPP.call.offer('[number]@c.us', {isVideo: true});
31
+ * ```
32
+ */
33
+ export declare function offer(to: string | Wid, options?: CallOfferOptions): Promise<any>;
@@ -0,0 +1,31 @@
1
+ /*!
2
+ * Copyright 2023 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 { websocket } from '../../whatsapp';
17
+ export declare function parseRelayResponse(response: websocket.WapNode): {
18
+ rte: {
19
+ ip: number[];
20
+ port: number;
21
+ } | null;
22
+ key: string;
23
+ relays: {
24
+ [key: string]: {
25
+ ip: number[];
26
+ port: number;
27
+ relay_id: string;
28
+ token: string;
29
+ };
30
+ };
31
+ };
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2023 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 { websocket, Wid } from '../../whatsapp';
17
+ export declare function prepareDestionation(wids: Wid[], encKey: ArrayBufferLike): Promise<websocket.WapNode[]>;
@@ -19,18 +19,18 @@
19
19
  * @example
20
20
  * ```javascript
21
21
  * // Reject any incoming call
22
- * WPP.call.rejectCall();
22
+ * WPP.call.reject();
23
23
  *
24
24
  * // Reject specific call id
25
- * WPP.call.rejectCall(callId);
25
+ * WPP.call.reject(callId);
26
26
  *
27
27
  * // Reject any incoming call
28
28
  * WPP.on('call.incoming_call', (call) => {
29
- * WPP.call.rejectCall(call.id);
29
+ * WPP.call.reject(call.id);
30
30
  * });
31
31
  * ```
32
32
  *
33
33
  * @param {string} callId The call ID, empty to reject the first one
34
34
  * @return {[type]} [return description]
35
35
  */
36
- export declare function rejectCall(callId?: string): Promise<boolean>;
36
+ export declare function reject(callId?: string): Promise<boolean>;
@@ -16,6 +16,14 @@
16
16
  /**
17
17
  * Download the blob of a media message
18
18
  *
19
+ * ```javascript
20
+ * // Get a blob file
21
+ * await WPP.chat.downloadMedia('true_[number]@c.us_ABCDEF');
22
+ *
23
+ * // Get a base64Content
24
+ * await WPP.chat.downloadMedia('true_[number]@c.us_ABCDEF').then(WPP.util.blobToBase64);
25
+ * ```
26
+ *
19
27
  * @category Message
20
28
  */
21
29
  export declare function downloadMedia(id: string): Promise<Blob>;
@@ -66,4 +66,9 @@ export interface Config {
66
66
  * @default false
67
67
  */
68
68
  sendStatusToDevice: boolean;
69
+ /**
70
+ * Option to disable status sync
71
+ * @default false
72
+ */
73
+ syncAllStatus: boolean;
69
74
  }
@@ -14,5 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import './events';
17
+ import './patch';
17
18
  export * from './defaultSendStatusOptions';
18
19
  export * from './functions';
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * Copyright 2023 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 {};
@@ -13,6 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { RawMessage } from '../../chat';
17
+ import { Wid } from '../misc';
16
18
  import { StatusV3Model } from '../models';
17
19
  import { BaseCollection } from '.';
18
20
  /** @whatsapp 59387
@@ -24,9 +26,9 @@ export declare class StatusV3Collection extends BaseCollection<StatusV3Model> {
24
26
  sync(e?: any): any;
25
27
  logMetrics(e?: any): any;
26
28
  hasSynced(): boolean;
27
- handleUpdate(rawMsg?: any, checksum?: any, isMsgUpdate?: boolean): any;
29
+ handleUpdate(rawMsg?: RawMessage, checksum?: any, isMsgUpdate?: boolean): any;
28
30
  updateChecksum(e?: any): any;
29
- addStatusMessages(e?: any, t?: any): any;
31
+ addStatusMessages(wid: Wid, msgs: RawMessage[]): any;
30
32
  getUnexpired(e?: any): any;
31
33
  getMyStatus(): StatusV3Model;
32
34
  static comparator(): any;
@@ -0,0 +1,24 @@
1
+ /*!
2
+ * Copyright 2023 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 { MsgModel, websocket, Wid } from '..';
17
+ /**
18
+ *
19
+ */
20
+ export declare function createFanoutMsgStanza(msg: MsgModel, proto: {
21
+ [key: string]: any;
22
+ }, devices: Wid[], options: {
23
+ [key: string]: any;
24
+ }): Promise<websocket.WapNode>;
@@ -0,0 +1,23 @@
1
+ /*!
2
+ * Copyright 2023 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 { Wid } from '../misc';
17
+ /**
18
+ * @whatsapp 309029 >= 2.2312.7
19
+ */
20
+ export declare function encryptMsgProtobuf(wid: Wid, retryCount: number, protoMessage: any): Promise<{
21
+ type: string;
22
+ ciphertext: Uint8Array;
23
+ }>;
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * Copyright 2023 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 { RawMessage } from '../../chat';
17
+ import { Wid } from '../misc';
18
+ /**
19
+ * @whatsapp 359554 >= 2.2230.8
20
+ */
21
+ export declare function handleSingleMsg(wid: Wid, msg: RawMessage, type: string, update: boolean, preserveOrder: boolean): Promise<any>;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright 2021 WPPConnect Team
2
+ * Copyright 2023 WPPConnect Team
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ export * from './calculateFilehashFromBlob';
19
19
  export * from './canEditMsg';
20
20
  export * from './canReplyMsg';
21
21
  export * from './collections';
22
+ export * from './createFanoutMsgStanza';
22
23
  export * from './createGroup';
23
24
  export * from './createMsgProtobuf';
24
25
  export * from './createOrUpdateReactions';
@@ -26,6 +27,7 @@ export * from './editBusinessProfile';
26
27
  export * from './encodeMaybeMediaType';
27
28
  export * from './encryptAndSendGroupMsg';
28
29
  export * from './encryptAndSendMsg';
30
+ export * from './encryptMsgProtobuf';
29
31
  export * from './fetchLinkPreview';
30
32
  export * from './findChat';
31
33
  export * from './findFirstWebLink';
@@ -43,6 +45,7 @@ export * from './getSearchContext';
43
45
  export * from './getVotes';
44
46
  export * from './groupParticipants';
45
47
  export * from './handleAck';
48
+ export * from './handleSingleMsg';
46
49
  export * from './isAnimatedWebp';
47
50
  export * from './isAuthenticated';
48
51
  export * from './isRegistered';
@@ -21,7 +21,7 @@ export declare class WapNode {
21
21
  attrs: {
22
22
  [key: string]: any;
23
23
  };
24
- content: any[];
24
+ content: undefined | string | Uint8Array | WapNode[];
25
25
  constructor(tag: any, attrs?: {
26
26
  [key: string]: any;
27
27
  }, content?: any[]);