diff --git a/src/lib/msgUtils.js b/src/lib/msgUtils.js index c361500..fdaaa5e 100644 --- a/src/lib/msgUtils.js +++ b/src/lib/msgUtils.js @@ -334,7 +334,7 @@ export const whatsappMsgTypeMapped = { }), }, // unsupported: { type: 'system', data: (msg) => ({ text: 'Message type is currently not supported.' }) }, - unsupported: { type: 'text', data: (msg) => ({ text: '[暂不支持此消息类型]' }) }, + unsupported: { type: 'text', data: (msg) => ({ text: `[暂不支持此消息类型](${msg.id})` }) }, reaction: { type: 'text', data: (msg) => ({ id: msg.wamid, text: msg.reaction?.emoji || '' }), @@ -353,6 +353,16 @@ export const whatsappMsgTypeMapped = { message: msg.document?.caption || msg.document?.filename || '', }), }, + contacts: { + type: 'meetingLink', + data: (msg) => ({ + id: msg.wamid, + meetingID: msg.wamid, + title: msg.contacts.length === 1 ? `联系人` : `${msg.contacts.length} 位联系人`, + text: msg.contacts.map(ele => `${ele.name.formatted_name}: ${ele.phones[0].wa_id}`).join('\n'), + data: msg.contacts.map(ele => ({ id: ele.phones[0].wa_id, wa_id: ele.phones[0].wa_id, name: ele.name.formatted_name })), + }), + }, // location: 'location', // contact: 'contact', // 'contact-card': 'contact-card', diff --git a/src/views/Conversations/Components/MessagesList.jsx b/src/views/Conversations/Components/MessagesList.jsx index a70fb89..18cecb2 100644 --- a/src/views/Conversations/Components/MessagesList.jsx +++ b/src/views/Conversations/Components/MessagesList.jsx @@ -135,6 +135,34 @@ const MessagesList = ({ reference, ...props }) => { replyButton: ['text', 'document', 'image'].includes(message.whatsapp_msg_type) ? true : false, className: 'whitespace-pre-wrap', })} + {...(message.type === 'meetingLink' + ? { + actionButtons: + message.data.length === 1 + ? [ + { + onClickButton: () => { + alert(`发消息 ${message.text}`); + }, + Component: () =>