chore(): generate docs
This commit is contained in:
parent
2dbcf8ab5d
commit
28a2d3630c
76 changed files with 890 additions and 313 deletions
|
|
@ -4,7 +4,7 @@
|
|||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.11">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.34.1 » Source: Client.js</title>
|
||||
<title>whatsapp-web.js 1.34.2 » Source: Client.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>34.<wbr>1</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>34.<wbr>2</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
@ -1256,11 +1256,18 @@ class Client extends EventEmitter {
|
|||
|
||||
const msgs = await window.Store.PinnedMsgUtils.getTable().equals(['chatId'], chatWid.toString());
|
||||
|
||||
const pinnedMsgs = msgs.map((msg) => window.Store.Msg.get(msg.parentMsgKey));
|
||||
const pinnedMsgs = (
|
||||
await Promise.all(
|
||||
msgs.filter(msg => msg.pinType == 1).map(async (msg) => {
|
||||
const res = await window.Store.Msg.getMessagesById([msg.parentMsgKey]);
|
||||
return res?.messages?.[0];
|
||||
})
|
||||
)
|
||||
).filter(Boolean);
|
||||
|
||||
return !pinnedMsgs.length
|
||||
? []
|
||||
: pinnedMsgs.map((msg) => window.WWebJS.getMessageModel(msg));
|
||||
: await Promise.all(pinnedMsgs.map((msg) => window.WWebJS.getMessageModel(msg)));
|
||||
}, chatId);
|
||||
|
||||
return pinnedMsgs.map((msg) => new Message(this, msg));
|
||||
|
|
@ -1555,7 +1562,7 @@ class Client extends EventEmitter {
|
|||
const commonGroups = await this.pupPage.evaluate(async (contactId) => {
|
||||
let contact = window.Store.Contact.get(contactId);
|
||||
if (!contact) {
|
||||
const wid = window.Store.WidFactory.createUserWid(contactId);
|
||||
const wid = window.Store.WidFactory.createWid(contactId);
|
||||
const chatConstructor = window.Store.Contact.getModelsArray().find(c=>!c.isGroup).constructor;
|
||||
contact = new chatConstructor({id: wid});
|
||||
}
|
||||
|
|
@ -2341,13 +2348,15 @@ class Client extends EventEmitter {
|
|||
* @param {string} firstName
|
||||
* @param {string} lastName
|
||||
* @param {boolean} [syncToAddressbook = false] If set to true, the contact will also be saved to the user's address book on their phone. False by default
|
||||
* @returns {Promise&lt;import('..').ChatId>} Object in a wid format
|
||||
* @returns {Promise&lt;void>}
|
||||
*/
|
||||
async saveOrEditAddressbookContact(phoneNumber, firstName, lastName, syncToAddressbook = false)
|
||||
{
|
||||
return await this.pupPage.evaluate(async (phoneNumber, firstName, lastName, syncToAddressbook) => {
|
||||
return await window.Store.AddressbookContactUtils.saveContactAction(
|
||||
phoneNumber,
|
||||
phoneNumber,
|
||||
null,
|
||||
null,
|
||||
firstName,
|
||||
lastName,
|
||||
|
|
@ -2387,6 +2396,83 @@ class Client extends EventEmitter {
|
|||
}));
|
||||
}, userIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or edit a customer note
|
||||
* @see https://faq.whatsapp.com/1433099287594476
|
||||
* @param {string} userId The ID of a customer to add a note to
|
||||
* @param {string} note The note to add
|
||||
* @returns {Promise&lt;void>}
|
||||
*/
|
||||
async addOrEditCustomerNote(userId, note) {
|
||||
return await this.pupPage.evaluate(async (userId, note) => {
|
||||
if (!window.Store.BusinessGatingUtils.smbNotesV1Enabled()) return;
|
||||
|
||||
return window.Store.CustomerNoteUtils.noteAddAction(
|
||||
'unstructured',
|
||||
window.Store.WidToJid.widToUserJid(window.Store.WidFactory.createWid(userId)),
|
||||
note
|
||||
);
|
||||
}, userId, note);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a customer note
|
||||
* @see https://faq.whatsapp.com/1433099287594476
|
||||
* @param {string} userId The ID of a customer to get a note from
|
||||
* @returns {Promise&lt;{
|
||||
* chatId: string,
|
||||
* content: string,
|
||||
* createdAt: number,
|
||||
* id: string,
|
||||
* modifiedAt: number,
|
||||
* type: string
|
||||
* }>}
|
||||
*/
|
||||
async getCustomerNote(userId) {
|
||||
return await this.pupPage.evaluate(async (userId) => {
|
||||
if (!window.Store.BusinessGatingUtils.smbNotesV1Enabled()) return null;
|
||||
|
||||
const note = await window.Store.CustomerNoteUtils.retrieveOnlyNoteForChatJid(
|
||||
window.Store.WidToJid.widToUserJid(window.Store.WidFactory.createWid(userId))
|
||||
);
|
||||
|
||||
let serialized = note?.serialize();
|
||||
|
||||
if (!serialized) return null;
|
||||
|
||||
serialized.chatId = window.Store.JidToWid.userJidToUserWid(serialized.chatJid)._serialized;
|
||||
delete serialized.chatJid;
|
||||
|
||||
return serialized;
|
||||
}, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Poll Votes
|
||||
* @param {string} messageId
|
||||
* @return {Promise&lt;Array&lt;PollVote>>}
|
||||
*/
|
||||
async getPollVotes(messageId) {
|
||||
const msg = await this.getMessageById(messageId);
|
||||
if (!msg) return [];
|
||||
if (msg.type != 'poll_creation') throw 'Invalid usage! Can only be used with a pollCreation message';
|
||||
|
||||
const pollVotes = await this.pupPage.evaluate( async (msg) => {
|
||||
const msgKey = window.Store.MsgKey.fromString(msg.id._serialized);
|
||||
let pollVotes = await window.Store.PollsVotesSchema.getTable().equals(['parentMsgKey'], msgKey.toString());
|
||||
|
||||
return pollVotes.map(item => {
|
||||
const typedArray = new Uint8Array(item.selectedOptionLocalIds);
|
||||
return {
|
||||
...item,
|
||||
selectedOptionLocalIds: Array.from(typedArray)
|
||||
};
|
||||
});
|
||||
}, msg);
|
||||
|
||||
return pollVotes.map((pollVote) => new PollVote(this.client, {...pollVote, parentMessage: msg}));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Client;
|
||||
|
|
@ -2400,7 +2486,7 @@ module.exports = Client;
|
|||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.11 on September 10, 2025.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.11 on November 6, 2025.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
|||
Loading…
Reference in a new issue