65 lines
3.5 KiB
Diff
65 lines
3.5 KiB
Diff
diff --git a/node_modules/whatsapp-web.js/src/util/Injected.js b/node_modules/whatsapp-web.js/src/util/Injected.js
|
|
index xxxxxxx..yyyyyyy 100644
|
|
--- a/node_modules/whatsapp-web.js/src/util/Injected.js
|
|
+++ b/node_modules/whatsapp-web.js/src/util/Injected.js
|
|
@@ -628,16 +628,28 @@ exports.ExposeStore = () => {
|
|
return Object.defineProperty(window, 'WWebJS', {
|
|
get() {
|
|
return {
|
|
getContactModel: (contact) => {
|
|
+ // Safe method extraction with fallbacks
|
|
+ const getContactMethod = (method) => {
|
|
+ if (!window.Store.ContactMethods || !window.Store.ContactMethods[method]) {
|
|
+ return null;
|
|
+ }
|
|
+ return window.Store.ContactMethods[method];
|
|
+ };
|
|
+
|
|
return {
|
|
id: contact.id,
|
|
name: contact.name,
|
|
type: contact.type,
|
|
- isMe: contact.isMe,
|
|
- isUser: contact.isUser,
|
|
- isGroup: contact.isGroup,
|
|
- isBroadcast: contact.isBroadcast,
|
|
- isBusiness: contact.isBusiness,
|
|
- isEnterprise: contact.isEnterprise,
|
|
+ isMe: contact.isMe || false,
|
|
+ isUser: contact.isUser || false,
|
|
+ isGroup: contact.isGroup || false,
|
|
+ isBroadcast: contact.isBroadcast || false,
|
|
+ isBusiness: contact.isBusiness || false,
|
|
+ isEnterprise: contact.isEnterprise || false,
|
|
+ isContactSyncEnabled: contact.isContactSyncEnabled || false,
|
|
+ isContactLocked: contact.isContactLocked || false,
|
|
verifiedLevel: contact.verifiedLevel,
|
|
verifiedName: contact.verifiedName,
|
|
pushname: contact.pushname,
|
|
@@ -646,11 +658,23 @@ exports.ExposeStore = () => {
|
|
isMe: contact.isMe,
|
|
isUser: contact.isUser,
|
|
isWAContact: contact.isWAContact,
|
|
- isMyContact: contact.isMyContact,
|
|
+ // Fallback for changed API
|
|
+ isMyContact: contact.isMyContact !== undefined
|
|
+ ? contact.isMyContact
|
|
+ : contact.type === 'in' || false,
|
|
isBlocked: contact.isBlocked,
|
|
- labels: contact.labels ? contact.labels.map(l => l.id) : []
|
|
+ labels: contact.labels ? contact.labels.map(l => l.id) : [],
|
|
+ // Additional properties
|
|
+ displayName: contact.displayName || contact.pushname || contact.name,
|
|
+ formattedName: contact.formattedName || contact.name,
|
|
+ formattedShortName: contact.formattedShortName || contact.name,
|
|
+ shortName: contact.shortName || contact.name,
|
|
+ isSaved: contact.isSaved !== undefined ? contact.isSaved : false,
|
|
+ isMuted: contact.muteExpiration !== undefined ? contact.muteExpiration > 0 : false,
|
|
+ muteExpiration: contact.muteExpiration || 0,
|
|
+ disappearingModeDuration: contact.disappearingModeDuration || 0
|
|
};
|
|
},
|
|
});
|
|
}
|
|
});
|
|
}
|