@wppconnect/wa-js 3.0.1 → 3.1.1

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,9 +1,4 @@
1
- ## 3.0.1 (2024-03-25)
2
-
3
-
4
- ### Bug Fixes
5
-
6
- * Fixed isOfficialClient check ([#1769](https://github.com/wppconnect-team/wa-js/issues/1769)) ([88f1f0e](https://github.com/wppconnect-team/wa-js/commit/88f1f0e6daf18b0492ceffb6274adef02323dc35))
1
+ ## 3.1.1 (2024-04-10)
7
2
 
8
3
 
9
4
 
@@ -49,6 +49,7 @@ export { openChatAt } from './openChatAt';
49
49
  export { openChatBottom } from './openChatBottom';
50
50
  export { openChatFromUnread } from './openChatFromUnread';
51
51
  export { pin, unpin } from './pin';
52
+ export { pinMsg, unpinMsg } from './pinMsg';
52
53
  export { LinkPreviewOptions, prepareLinkPreview } from './prepareLinkPreview';
53
54
  export { MessageButtonsOptions, prepareMessageButtons, } from './prepareMessageButtons';
54
55
  export { prepareRawMessage } from './prepareRawMessage';
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright 2023 WPPConnect Team
2
+ * Copyright 2024 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.
@@ -20,6 +20,7 @@ export interface ChatListOptions {
20
20
  direction?: 'after' | 'before';
21
21
  onlyCommunities?: boolean;
22
22
  onlyGroups?: boolean;
23
+ onlyNewsletter?: boolean;
23
24
  onlyUsers?: boolean;
24
25
  onlyWithUnreadMessage?: boolean;
25
26
  withLabels?: string[];
@@ -47,6 +48,9 @@ export interface ChatListOptions {
47
48
  * // Only communities chats
48
49
  * const chats = await WPP.chat.list({onlyCommunities: true});
49
50
  *
51
+ * // Only Newsletter
52
+ * const chats = await WPP.chat.list({onlyNewsletter: true});
53
+ *
50
54
  * // Only with label Text
51
55
  * const chats = await WPP.chat.list({withLabels: ['Test']});
52
56
  *
@@ -0,0 +1,60 @@
1
+ /*!
2
+ * Copyright 2024 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 { MsgKey, MsgModel } from '../../whatsapp';
17
+ import { SendMsgResult } from '../../whatsapp/enums';
18
+ /**
19
+ * Pin a message in chat
20
+ *
21
+ * @example
22
+ * ```javascript
23
+ * // Pin a message in chat
24
+ * WPP.chat.pinMsg('true_[number]@c.us_ABCDEF');
25
+ *
26
+ * // Pin a message in chat for 30 days
27
+ * WPP.chat.pinMsg('true_[number]@c.us_ABCDEF', 2592000);
28
+ *
29
+ * // Unpin a message
30
+ * WPP.chat.pinMsg('true_[number]@c.us_ABCDEF', false);
31
+ * // or
32
+ * WPP.chat.unpinMsg('true_[number]@c.us_ABCDEF');
33
+ * ```
34
+ * @category Chat
35
+ */
36
+ export declare function pinMsg(msgId: string | MsgKey, pin?: boolean, seconds?: number): Promise<{
37
+ message: MsgModel;
38
+ pinned: boolean;
39
+ result: SendMsgResult;
40
+ }>;
41
+ /**
42
+ * Unpin a message in chat
43
+ *
44
+ * @alias pin
45
+ *
46
+ * @example
47
+ * ```javascript
48
+ * // Unpin a message
49
+ * WPP.chat.unpinMsg('true_[number]@c.us_ABCDEF');
50
+ *
51
+ * // Alias for
52
+ * WPP.chat.pinMsg('true_[number]@c.us_ABCDEF', false);
53
+ * ```
54
+ * @category Chat
55
+ */
56
+ export declare function unpinMsg(msgId: string | MsgKey): Promise<{
57
+ message: MsgModel;
58
+ pinned: boolean;
59
+ result: SendMsgResult;
60
+ }>;
@@ -0,0 +1,29 @@
1
+ /*!
2
+ * Copyright 2024 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 { PinInChatModel } from '../models/PinInChatModel';
17
+ import { Collection } from './Collection';
18
+ /**
19
+ * @whatsapp WAWebPinInChatCollection >= 2.3000.1012170943
20
+ */
21
+ export declare class PinInChatCollection extends Collection<PinInChatModel> {
22
+ static model: PinInChatModel;
23
+ static cachePolicy?: any;
24
+ deleteByParentMessageKey(a?: any): any;
25
+ getByMsgKey(a?: any): PinInChatModel;
26
+ getByParentMsgKey(a?: any): PinInChatModel;
27
+ byChatId(a?: any): PinInChatModel[];
28
+ byIsFailedByMe(a?: any): any;
29
+ }
@@ -40,6 +40,7 @@ export * from './MuteCollection';
40
40
  export * from './OrderCollection';
41
41
  export * from './OrderItemCollection';
42
42
  export * from './ParticipantCollection';
43
+ export * from './PinInChatCollection';
43
44
  export * from './PresenceCollection';
44
45
  export * from './ProductCollCollection';
45
46
  export * from './ProductCollection';
@@ -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
+ /** @whatsapp WAWebPinMsgConstants >= 2.3000.1012170943
17
+ */
18
+ export declare enum PIN_STATE {
19
+ INVALID = 0,
20
+ PIN = 1,
21
+ UNPIN = 2
22
+ }
@@ -20,4 +20,5 @@ export * from './KIC_ENTRY_POINT_TYP';
20
20
  export * from './LogoutReason';
21
21
  export * from './MSG_TYPE';
22
22
  export * from './OUTWARD_TYPES';
23
+ export * from './PIN_STATE';
23
24
  export * from './SendMsgResult';
@@ -0,0 +1,19 @@
1
+ /*!
2
+ * Copyright 2024 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
+ * @whatsapp WAWebPollsVotesSchema => 2.3000.x
18
+ */
19
+ export declare function getTableVotes(args?: any): any;
@@ -66,6 +66,7 @@ export * from './getPushname';
66
66
  export * from './getQuotedMsgObj';
67
67
  export * from './getReactions';
68
68
  export * from './getSearchContext';
69
+ export * from './getTableVotes';
69
70
  export * from './getVotes';
70
71
  export * from './getWhatsAppWebExternalBetaJoinedIdb';
71
72
  export * from './GROUP_JID';
@@ -75,6 +76,7 @@ export * from './handleSingleMsg';
75
76
  export * from './initializeAltDeviceLinking';
76
77
  export * from './isAnimatedWebp';
77
78
  export * from './isAuthenticated';
79
+ export * from './isLegitErrorStack';
78
80
  export * from './isRegistered';
79
81
  export * from './isUnreadTypeMsg';
80
82
  export * from './joinGroupViaInvite';
@@ -107,6 +109,7 @@ export * from './sendExitGroup';
107
109
  export * from './sendGroupParticipants';
108
110
  export * from './sendJoinGroupViaInvite';
109
111
  export * from './sendNewsletterMessageJob';
112
+ export * from './sendPinInChatMsg';
110
113
  export * from './sendQueryExists';
111
114
  export * from './sendQueryGroupInvite';
112
115
  export * from './sendQueryGroupInviteCode';
@@ -130,3 +133,4 @@ export * from './uploadMedia';
130
133
  export * from './uploadProductImage';
131
134
  export * from './uploadThumbnail';
132
135
  export * from './upsertVotes';
136
+ export * from './voteFromDbRow';
@@ -0,0 +1,19 @@
1
+ /*!
2
+ * Copyright 2024 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
+ * @whatsapp 525438
18
+ */
19
+ export declare function isLegitErrorStack(): boolean;
@@ -0,0 +1,25 @@
1
+ /*!
2
+ * Copyright 2024 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 { SendMsgResult } from '../enums';
17
+ import { PIN_STATE } from '../enums/PIN_STATE';
18
+ import { MsgModel } from '../models';
19
+ /** @whatsapp WAWebSendPinMessageAction >= 2.3000.1012170943
20
+ */
21
+ export declare function sendPinInChatMsg(msg: MsgModel, type: PIN_STATE, time?: number, d?: any): Promise<{
22
+ count: number;
23
+ messageSendResult: SendMsgResult;
24
+ t: number;
25
+ }>;
@@ -0,0 +1,20 @@
1
+ /*!
2
+ * Copyright 2024 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 } from '../models';
17
+ /**
18
+ * @whatsapp WAWebPollsDbSerialization >= 2.3000.x
19
+ */
20
+ export declare function voteFromDbRow(msg: MsgModel): Promise<any>;
@@ -17,6 +17,5 @@
17
17
  * @whatsapp >= 2.3000.x
18
18
  */
19
19
  export declare namespace IsOfficialClient {
20
- function isLegitErrorStack(): boolean;
21
20
  let isOfficialClient: boolean;
22
21
  }
@@ -39,10 +39,16 @@ export declare class MuteModel extends Model<MuteCollection> {
39
39
  idClass: typeof Wid;
40
40
  allowedIds?: any;
41
41
  constructor(proterties?: ModelPropertiesContructor<MuteModel>, options?: ModelOptions);
42
- setMute(e?: any, t?: any): any;
43
- mute(expiration: number, sendAction?: boolean, sequence?: number): Promise<number>;
42
+ setMute(expiration?: number, isAutoMuted?: boolean, sendDevice?: boolean): any;
43
+ mute(args: {
44
+ expiration: number;
45
+ sendDevice?: boolean;
46
+ isAutoMuted?: boolean;
47
+ }): Promise<number>;
44
48
  canMute(): boolean;
45
- unmute(sendAction?: boolean, sequence?: number): Promise<void>;
49
+ unmute(args: {
50
+ sendDevice?: boolean;
51
+ }): Promise<void>;
46
52
  getCollection(): MuteCollection;
47
53
  }
48
54
  export {};
@@ -0,0 +1,50 @@
1
+ /*!
2
+ * Copyright 2024 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 { CartCollection } from '../collections';
17
+ import { PinInChatCollection } from '../collections/PinInChatCollection';
18
+ import { MsgKey, Wid } from '../misc';
19
+ import { Model, ModelOptions, ModelPropertiesContructor, ModelProxy } from './Model';
20
+ interface Props {
21
+ msgKey: MsgKey;
22
+ parentMsgKey: MsgKey;
23
+ senderTimestampMs: number;
24
+ t: number;
25
+ sender: Wid;
26
+ chatId: Wid;
27
+ pinType: number;
28
+ pinExpiryDuration: number;
29
+ id: MsgKey;
30
+ read: boolean;
31
+ }
32
+ interface Session {
33
+ }
34
+ interface Derived {
35
+ }
36
+ /**
37
+ * @whatsapp WAWebPinInChatModel >= 2.3000.1012170943
38
+ */
39
+ export declare interface PinInChatModel extends ModelProxy<Props, Session, Derived> {
40
+ }
41
+ /**
42
+ * @whatsapp WAWebPinInChatModel >= 2.3000.1012170943
43
+ */
44
+ export declare class PinInChatModel extends Model<CartCollection> {
45
+ constructor(proterties?: ModelPropertiesContructor<PinInChatModel>, options?: ModelOptions);
46
+ deleteByParentMessageKey(): void;
47
+ getByMsgKey(): CartCollection;
48
+ getByParentMsgKey(): PinInChatCollection;
49
+ }
50
+ export {};
@@ -125,3 +125,4 @@ export declare const StickerPackStore: collections.StickerPackCollection;
125
125
  * @whatsapp 545068 >= 2.2222.8
126
126
  */
127
127
  export declare const StickerSearchStore: collections.StickerSearchCollection;
128
+ export declare const PinInChatStore: collections.PinInChatCollection;