消息记录: 类型unsupported

dev/chat
Lei OT 2 years ago
parent 640f164ee0
commit 76f1be63dc

@ -402,7 +402,7 @@ export const whatsappMsgTypeMapped = {
*/ */
export const parseRenderMessageItem = (msg) => { export const parseRenderMessageItem = (msg) => {
console.log('parseRenderMessageItem', msg); console.log('parseRenderMessageItem', msg);
const thisMsgType = Object.keys(receivedMsgTypeMapped).includes(msg.type) ? msg.type : 'unsupported'; const thisMsgType = Object.keys(whatsappMsgTypeMapped).includes(msg.type) ? msg.type : 'unsupported';
return { return {
msgOrigin: msg, msgOrigin: msg,
date: msg?.sendTime || msg?.createTime || '', date: msg?.sendTime || msg?.createTime || '',
@ -442,7 +442,7 @@ export const parseRenderMessageList = (messages, conversationid = null) => {
return messages.map((msg, i) => { return messages.map((msg, i) => {
const msgContent = msg.msgtext_AsJOSN; const msgContent = msg.msgtext_AsJOSN;
msgContent.template = msg.msgtype === 'template' ? { ...msgContent.template, ...msg.template_AsJOSN } : {}; msgContent.template = msg.msgtype === 'template' ? { ...msgContent.template, ...msg.template_AsJOSN } : {};
const msgType = msgContent.type; const msgType = Object.keys(whatsappMsgTypeMapped).includes(msgContent.type) ? msgContent.type : 'unsupported';
// const parseMethod = msgContent.bizType === 'whatsapp' ? cloneDeep(whatsappMsgTypeMapped) : {}; // const parseMethod = msgContent.bizType === 'whatsapp' ? cloneDeep(whatsappMsgTypeMapped) : {};
return { return {
msgOrigin: msgContent, msgOrigin: msgContent,
@ -468,8 +468,8 @@ export const parseRenderMessageList = (messages, conversationid = null) => {
reply: { reply: {
message: msg.messageorigin_AsJOSN?.text?.body || msg.messageorigin_AsJOSN?.text, message: msg.messageorigin_AsJOSN?.text?.body || msg.messageorigin_AsJOSN?.text,
title: msg.messageorigin_AsJOSN?.customerProfile?.name || msg.messageorigin_AsJOSN?.senderName || 'me', title: msg.messageorigin_AsJOSN?.customerProfile?.name || msg.messageorigin_AsJOSN?.senderName || 'me',
...(typeof whatsappMsgTypeMapped[msg.messageorigin_AsJOSN?.type]?.renderForReply === 'function' ...(typeof whatsappMsgTypeMapped[(msg.messageorigin_AsJOSN?.type || 'unsupported')]?.renderForReply === 'function'
? whatsappMsgTypeMapped[msg.messageorigin_AsJOSN?.type].renderForReply(msg.messageorigin_AsJOSN) ? whatsappMsgTypeMapped[(msg.messageorigin_AsJOSN?.type || 'unsupported')].renderForReply(msg.messageorigin_AsJOSN)
: {}), : {}),
// titleColor: msg.messageorigin_AsJOSN?.customerProfile?.name ? '#a791ff' : "#128c7e", // titleColor: msg.messageorigin_AsJOSN?.customerProfile?.name ? '#a791ff' : "#128c7e",
titleColor: msg.messageorigin_direction === 'inbound' ? '#a791ff' : "#128c7e", titleColor: msg.messageorigin_direction === 'inbound' ? '#a791ff' : "#128c7e",

Loading…
Cancel
Save