todo: 解析Email message对象

2.0/email-builder
Lei OT 11 months ago
parent 00f75f8308
commit 7411763eab

@ -648,11 +648,7 @@ export const parseRenderMessageList = (messages) => {
sender: msgContent.from, sender: msgContent.from,
senderName: msgContent?.customerProfile?.name || 'me', // msgContent.from, senderName: msgContent?.customerProfile?.name || 'me', // msgContent.from,
replyButton: ['text', 'document', 'image', 'email'].includes(msgContent.type) && (msgContent?.status || '') !== 'failed', replyButton: ['text', 'document', 'image', 'email'].includes(msgContent.type) && (msgContent?.status || '') !== 'failed',
// 用forwarded表示Resend, 与Reply互斥 // debug: email, failed forwarded: ['text', 'email'].includes(msgContent.type) && (msgContent?.status || 'failed') === 'failed', // 用forwarded表示Resend, 与Reply互斥 // debug: email, failed
forwarded: msg.msg_direction === 'outbound'
&& msg.msg_source === 'email'
&& ['email'].includes(msgContent.type)
&& (msgContent?.status || 'failed') === 'failed',
...(msg.msg_direction === 'outbound' ...(msg.msg_direction === 'outbound'
? { ? {
sender: 'me', sender: 'me',
@ -663,18 +659,18 @@ export const parseRenderMessageList = (messages) => {
statusTitle: msgStatusRenderMappedCN[msgContent?.status || 'failed'], statusTitle: msgStatusRenderMappedCN[msgContent?.status || 'failed'],
} }
: {}), : {}),
...(isEmpty(messageorigin) && (isEmpty(msgContent.context) || msgContent.context?.forwarded === true) ...((isEmpty(messageorigin) && (isEmpty(msgContent.context) || msgContent.context?.forwarded === true))
? // ...((isEmpty(msg.context) && isEmpty(msg.reaction)) || msg.context?.forwarded === true || isEmpty(messageorigin) // ...((isEmpty(msg.context) && isEmpty(msg.reaction)) || msg.context?.forwarded === true || isEmpty(messageorigin)
// ...((isEmpty(messageorigin) || isEmpty(msgContent.context)) // ...((isEmpty(messageorigin) || isEmpty(msgContent.context))
{} ? {}
: { : {
reply: { reply: {
message: messageorigin?.text?.body || messageorigin?.text, message: messageorigin?.text?.body || messageorigin?.text,
title: messageorigin?.customerProfile?.name || messageorigin?.senderName || 'me', title: messageorigin?.customerProfile?.name || messageorigin?.senderName || 'me',
...(typeof whatsappMsgTypeMapped[messageorigin?.type || 'unsupported']?.renderForReply === 'function' ...(typeof whatsappMsgTypeMapped[(messageorigin?.type || 'unsupported')]?.renderForReply === 'function'
? whatsappMsgTypeMapped[messageorigin?.type || 'unsupported'].renderForReply(messageorigin) ? whatsappMsgTypeMapped[(messageorigin?.type || 'unsupported')].renderForReply(messageorigin)
: {}), : {}),
titleColor: messageorigin?.customerProfile?.name ? '#a791ff' : '#128c7e', titleColor: messageorigin?.customerProfile?.name ? '#a791ff' : "#128c7e",
// titleColor: msg.messageorigin_direction === 'inbound' ? '#a791ff' : "#128c7e", // titleColor: msg.messageorigin_direction === 'inbound' ? '#a791ff' : "#128c7e",
id: msgContent.context?.id || msgContent.context?.message_id || msgContent.reaction?.message_id || messageorigin?.wamid, id: msgContent.context?.id || msgContent.context?.message_id || msgContent.reaction?.message_id || messageorigin?.wamid,
}, },
@ -683,7 +679,7 @@ export const parseRenderMessageList = (messages) => {
// conversationid: conversationid, // conversationid: conversationid,
// title: msg.customerProfile.name, // title: msg.customerProfile.name,
whatsapp_msg_type: (msg.msg_source || 'WABA') === 'WABA' ? msgContent.type : '', // 1.0接口没有msg_source whatsapp_msg_type: (msg.msg_source || 'WABA') === 'WABA' ? msgContent.type : '', // 1.0接口没有msg_source
} };
}); });
}; };
export const whatsappError = { export const whatsappError = {

Loading…
Cancel
Save