mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +00:00
feat: Get Orders and Products (#612)
* - Get products and orders * - Get products and orders * - Eslint fixes * - Eslint fixes * allow downloading media for products * products and orders work on normal accounts Co-authored-by: Renato Jop <renato.jop@consystec-corp.com> Co-authored-by: Pedro Lopez <pedroslopez@me.com> Co-authored-by: Pedro S. Lopez <pslamoros@hotmail.com>
This commit is contained in:
@@ -32,6 +32,9 @@ exports.ExposeStore = (moduleRaidStr) => {
|
||||
window.Store.Sticker = window.mR.findModule('Sticker')[0].default.Sticker;
|
||||
window.Store.UploadUtils = window.mR.findModule((module) => (module.default && module.default.encryptAndUpload) ? module.default : null)[0].default;
|
||||
window.Store.Label = window.mR.findModule('LabelCollection')[0].default;
|
||||
window.Store.QueryOrder = window.mR.findModule('queryOrder')[0];
|
||||
window.Store.QueryProduct = window.mR.findModule('queryProduct')[0];
|
||||
|
||||
};
|
||||
|
||||
exports.LoadUtils = () => {
|
||||
@@ -458,6 +461,20 @@ exports.LoadUtils = () => {
|
||||
const chat = await window.WWebJS.getChat(chatId);
|
||||
return (chat.labels || []).map(id => window.WWebJS.getLabel(id));
|
||||
};
|
||||
|
||||
window.WWebJS.getOrderDetail = async (orderId, token) => {
|
||||
return window.Store.QueryOrder.queryOrder(orderId, 80, 80, token);
|
||||
};
|
||||
|
||||
window.WWebJS.getProductMetadata = async (productId) => {
|
||||
let sellerId = window.Store.Conn.wid;
|
||||
let product = await window.Store.QueryProduct.queryProduct(sellerId, productId);
|
||||
if (product && product.data) {
|
||||
return product.data;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
};
|
||||
|
||||
exports.MarkAllRead = () => {
|
||||
|
||||
Reference in New Issue
Block a user