@wppconnect/wa-js 3.0.0 → 3.0.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,4 +1,9 @@
1
- # 3.0.0 (2024-03-09)
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))
2
7
 
3
8
 
4
9
 
package/README.md CHANGED
@@ -99,7 +99,7 @@ import * as playwright from 'playwright-chromium';
99
99
 
100
100
  async function start() {
101
101
  const browser = await playwright.chromium.launch();
102
- const page = browser.newPage();
102
+ const page = await browser.newPage();
103
103
 
104
104
  await page.goto('https://web.whatsapp.com/');
105
105
 
@@ -112,7 +112,7 @@ async function start() {
112
112
 
113
113
  // Evaluating code: See https://playwright.dev/docs/evaluating/
114
114
  const isAuthenticated: string = await page.evaluate(() =>
115
- WPP.auth.isAuthenticated()
115
+ WPP.conn.isAuthenticated()
116
116
  );
117
117
 
118
118
  // Sending message: See https://playwright.dev/docs/evaluating/
@@ -14,5 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import './events';
17
+ import './patch';
17
18
  export * from './functions';
18
19
  export * from './types';
@@ -0,0 +1,16 @@
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
+ export {};
@@ -28,8 +28,9 @@ export interface NewLabelOptions {
28
28
  * await WPP.labels.addNewLabel(`Name of label`);
29
29
  * //or
30
30
  * await WPP.labels.addNewLabel(`Name of label`, { labelColor: '#dfaef0' });
31
- * //or
32
- * await WPP.labels.addNewLabel(`Name of label`, { labelColor: 4292849392 });
31
+ * ```
32
+ * //or with color index
33
+ * await WPP.labels.addNewLabel(`Name of label`, { labelColor: 16 });
33
34
  * ```
34
35
  */
35
- export declare function addNewLabel(labelName: string, options?: NewLabelOptions): Promise<any>;
36
+ export declare function addNewLabel(labelName: string, options?: NewLabelOptions): Promise<import("..").Label>;
@@ -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.
@@ -0,0 +1,37 @@
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
+ export interface EditLabelOptions {
17
+ /**
18
+ * If it's decimal, send it as a number. If it's hexadecimal, send it as a string.
19
+ * If labelColor is omitted, the color will be generated automatically
20
+ */
21
+ labelColor?: string | number;
22
+ name?: string;
23
+ }
24
+ /**
25
+ * Edit a label
26
+ * For get a new color, use await WPP.labels.getLabelColorPalette() to get the list of available colors
27
+ * @example
28
+ * ```javascript
29
+ * await WPP.labels.editLabel(`Name of label`);
30
+ * //or
31
+ * await WPP.labels.editLabel(`Name of label`, { labelColor: '#dfaef0' });
32
+ * ```
33
+ * //or with color index
34
+ * await WPP.labels.editLabel(`Name of label`, { labelColor: 16 });
35
+ * ```
36
+ */
37
+ export declare function editLabel(id: string, options?: EditLabelOptions): Promise<import("..").Label>;
@@ -14,6 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  /**
17
- * Returns an array of color palette in positive decimal
17
+ * Returns an array of color palette in hex code
18
18
  */
19
- export declare function getLabelColorPalette(): Promise<number[]>;
19
+ export declare function getLabelColorPalette(): Promise<string[]>;
@@ -18,6 +18,7 @@ export { addOrRemoveLabels, AddOrRemoveLabelsOptions, } from './addOrRemoveLabel
18
18
  export { colorIsInLabelPalette } from './colorIsInLabelPalette';
19
19
  export { deleteAllLabels } from './deleteAllLabels';
20
20
  export { deleteLabel, DeleteLabelReturn } from './deleteLabel';
21
+ export { editLabel } from './editLabel';
21
22
  export { getAllLabels } from './getAllLabels';
22
23
  export { getLabelById } from './getLabelById';
23
24
  export { getLabelColorPalette } from './getLabelColorPalette';
@@ -19,4 +19,5 @@ export interface Label {
19
19
  color: number | null;
20
20
  count: number;
21
21
  hexColor: string;
22
+ colorIndex: number;
22
23
  }
@@ -31,6 +31,7 @@ export declare class LabelCollection extends BaseCollection<LabelModel> {
31
31
  deleteLabel(id: string): any;
32
32
  updateLabel(e?: any, t?: any): any;
33
33
  getNewLabelColor(): any;
34
+ getNextAvailableColor(): any;
34
35
  getLabelColorPalette(): any;
35
36
  handleRemove(e?: any): any;
36
37
  updateChecksum(e?: any): any;
@@ -0,0 +1,20 @@
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
+ * @whatsapp 885910
18
+ */
19
+ export declare function colorIndexToHex(index: number): string;
20
+ export declare function getAllLabelColors(): string[];
@@ -0,0 +1,18 @@
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
+ /** @whatsapp 263133
17
+ */
18
+ export declare function getNextLabelId(): Promise<number>;
@@ -22,6 +22,7 @@ export * from './canEditMsg';
22
22
  export * from './canReplyMsg';
23
23
  export * from './changeOptInStatusForExternalWebBeta';
24
24
  export * from './collections';
25
+ export * from './colorIndexToHex';
25
26
  export * from './contactFunctions';
26
27
  export * from './createFanoutMsgStanza';
27
28
  export * from './createGroup';
@@ -57,6 +58,7 @@ export * from './getGroupSenderKeyList';
57
58
  export * from './getGroupSizeLimit';
58
59
  export * from './getHistorySyncProgress';
59
60
  export * from './getMembershipApprovalRequests';
61
+ export * from './getNextLabelId';
60
62
  export * from './getNumChatsPinned';
61
63
  export * from './getOrderInfo';
62
64
  export * from './getParticipants';
@@ -77,6 +79,8 @@ export * from './isRegistered';
77
79
  export * from './isUnreadTypeMsg';
78
80
  export * from './joinGroupViaInvite';
79
81
  export * from './keepMessage';
82
+ export * from './labelAddAction';
83
+ export * from './labelAddAction';
80
84
  export * from './markSeen';
81
85
  export * from './mediaTypeFromProtobuf';
82
86
  export * from './membershipApprovalRequestAction';
@@ -0,0 +1,20 @@
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
+ /** @whatsapp 165820
17
+ */
18
+ export declare function labelAddAction(name: string, colorIndex: number): Promise<any>;
19
+ export declare function labelDeleteAction(id: string, name: string, colorIndex: number): Promise<number>;
20
+ export declare function labelEditAction(id: string, name: string, predefinedId: number, colorIndex: number): Promise<any>;
@@ -15,8 +15,17 @@
15
15
  */
16
16
  import { ChatModel } from '../models';
17
17
  /**
18
+ * @deprecated
18
19
  * @whatsapp 59992
19
20
  * @whatsapp 259992 >= 2.2222.8
20
21
  * @whatsapp 503153 >= 2.2228.4
22
+ * <= 2.3000.x
21
23
  */
22
24
  export declare function setArchive(chat: ChatModel, archive: boolean, id?: string): Promise<void>;
25
+ /**
26
+ * @whatsapp >= 2.3000.1012117641
27
+ */
28
+ export declare function setArchive(args: {
29
+ id: string;
30
+ archive: boolean;
31
+ }[]): Promise<void>;
@@ -0,0 +1,22 @@
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 >= 2.3000.x
18
+ */
19
+ export declare namespace IsOfficialClient {
20
+ function isLegitErrorStack(): boolean;
21
+ let isOfficialClient: boolean;
22
+ }
@@ -21,6 +21,7 @@ export * from './Conn';
21
21
  export * from './Constants';
22
22
  export * from './EventEmitter';
23
23
  export * from './ImageUtils';
24
+ export * from './IsOfficialClient';
24
25
  export * from './MediaBlobCache';
25
26
  export * from './MediaEntry';
26
27
  export * from './MediaObject';
@@ -190,6 +190,7 @@ interface Props {
190
190
  totalCurrencyCode?: any;
191
191
  historySyncMetaData?: any;
192
192
  mdDowngrade?: any;
193
+ isCaptionByUser: boolean;
193
194
  isSendFailure: boolean;
194
195
  appStateSyncKeyShare?: any;
195
196
  appStateSyncKeyRequest?: any;