|
|
|
@ -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'
|
|
|
|
|