From ac09cce4a87b3a0667bddabcb1726991f1f5de84 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Wed, 21 Feb 2024 09:36:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=95=E7=94=A8=E7=9A=84=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=8E=9F=E6=96=87=0Btodo:=20=E6=8E=A5=E6=94=B6:=20=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E8=87=AA=E5=AE=A2=E6=88=B7=E4=BF=A1=E6=81=AF=E7=9A=84?= =?UTF-8?q?=E5=8E=9F=E6=96=87;=20emoji?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/msgUtils.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/msgUtils.js b/src/lib/msgUtils.js index d76112f..288e5c5 100644 --- a/src/lib/msgUtils.js +++ b/src/lib/msgUtils.js @@ -31,7 +31,7 @@ export const sentMsgTypeMapped = { renderId: msg.id, to: msg.to, msgtype: 'text', - msgcontent: { body: msg.text, ...(msg.context ? { context: msg.context, message_origin: msg.message_origin.origin } : {}) }, + msgcontent: { body: msg.text, ...(msg.context ? { context: msg.context, message_origin: msg.message_origin.msgOrigin } : {}) }, }), contentToRender: (msg) => ({ ...msg, @@ -246,11 +246,13 @@ export const whatsappMsgTypeMapped = { export const parseRenderMessageItem = (msg) => { console.log('parseRenderMessageItem', msg); return { + msgOrigin: msg, date: msg?.sendTime || msg?.createTime || '', ...(whatsappMsgTypeMapped?.[msg.type]?.data(msg) || {}), conversationid: msg.conversationid, ...(typeof whatsappMsgTypeMapped[msg.type].type === 'function' ? whatsappMsgTypeMapped[msg.type].type(msg) : { type: whatsappMsgTypeMapped[msg.type].type || 'text' }), // type: whatsappMsgTypeMapped?.[msg.type]?.type || 'text', + from: msg.from, sender: msg.from, senderName: msg?.customerProfile?.name || msg.from, // title: msg.customerProfile.name, @@ -285,11 +287,12 @@ export const parseRenderMessageList = (messages, conversationid = null) => { const msgType = msgContent.type; // const parseMethod = msgContent.bizType === 'whatsapp' ? cloneDeep(whatsappMsgTypeMapped) : {}; return { - origin: msgContent, + msgOrigin: msgContent, ...(whatsappMsgTypeMapped?.[msgType]?.data(msgContent) || {}), type: msgContent.type, ...(typeof whatsappMsgTypeMapped[msgType].type === 'function' ? whatsappMsgTypeMapped[msgType].type(msg) : { type: whatsappMsgTypeMapped[msgType].type || 'text' }), date: msgContent?.sendTime || msg.msgtime || '', + from: msgContent.from, sender: msgContent.from, senderName: msgContent?.customerProfile?.name || msgContent.from, ...(msg.msg_direction === 'outbound'