|
|
|
@ -322,7 +322,7 @@ const whatsappMsgMapped = {
|
|
|
|
|
...msgcontent,
|
|
|
|
|
...parseRenderMessageItem(msgcontent),
|
|
|
|
|
id: msgcontent.wamid,
|
|
|
|
|
status: msgStatusRenderMapped[msgcontent?.status || 'failed'],
|
|
|
|
|
status: msgStatusRenderMapped[msgcontent?.status || 'accepted'],
|
|
|
|
|
sender: 'me',
|
|
|
|
|
dateString: msgcontent.status === 'failed' ? `发送失败 ${whatsappError?.[msgcontent.errorCode] || msgcontent.errorMessage || ''} ❌` : '',
|
|
|
|
|
}),
|
|
|
|
@ -369,7 +369,7 @@ const whatsappMsgMapped = {
|
|
|
|
|
...msgcontent,
|
|
|
|
|
...parseRenderMessageItem(msgcontent),
|
|
|
|
|
id: msgcontent.wamid,
|
|
|
|
|
status: msgcontent.msg_direction === 'outbound' ? msgStatusRenderMapped[msgcontent?.status || 'failed'] : '',
|
|
|
|
|
status: msgcontent.msg_direction === 'outbound' ? msgStatusRenderMapped[msgcontent?.status || 'accepted'] : '',
|
|
|
|
|
sender: msgcontent.msg_direction === 'outbound' ? 'me' : msgcontent?.customerProfile?.name || '',
|
|
|
|
|
dateString: msgcontent.status === 'failed' ? `发送失败 ❌` : '',
|
|
|
|
|
}),
|
|
|
|
@ -419,7 +419,7 @@ const emailMsgMapped = {
|
|
|
|
|
...msgcontent,
|
|
|
|
|
...parseRenderMessageItem({...msgcontent, }),
|
|
|
|
|
id: msgcontent.id,
|
|
|
|
|
status: msgStatusRenderMapped[(msgcontent?.status || 'failed')],
|
|
|
|
|
status: msgStatusRenderMapped[(msgcontent?.status || 'accepted')],
|
|
|
|
|
sender: 'me',
|
|
|
|
|
dateString: msgcontent.status==='failed' ? `发送失败 ❌` : '',
|
|
|
|
|
}),
|
|
|
|
@ -467,7 +467,7 @@ export const receivedMsgTypeMapped = {
|
|
|
|
|
...msgcontent,
|
|
|
|
|
actionId: msgcontent.actionId,
|
|
|
|
|
id: msgcontent.wamid,
|
|
|
|
|
status: msgStatusRenderMapped[(msgcontent?.status || 'failed')],
|
|
|
|
|
status: msgStatusRenderMapped[(msgcontent?.status || 'accepted')],
|
|
|
|
|
conversationid: msgcontent.actionId.split('.')[0], // msgcontent.conversation.sn,
|
|
|
|
|
date: msgcontent.createTime,
|
|
|
|
|
sender: 'me',
|
|
|
|
@ -735,9 +735,9 @@ export const parseRenderMessageItem = (msg) => {
|
|
|
|
|
whatsapp_phone_number: isEmpty(msg?.customerProfile) ? msg.to : msg.from,
|
|
|
|
|
// whatsapp_msg_type: msg.msg_source==='WABA' ? msg.type : '',
|
|
|
|
|
// whatsapp_msg_type: (msg.msg_source || 'WABA') === 'WABA' ? msg.type : '', // 1.0接口没有msg_source
|
|
|
|
|
statusCN: msgStatusRenderMappedCN[msg?.status || 'failed'],
|
|
|
|
|
statusTitle: msgStatusRenderMappedCN[msg?.status || 'failed'],
|
|
|
|
|
replyButton: !['waiting', 'failed'].includes(msg?.status || '') ,
|
|
|
|
|
statusCN: msgStatusRenderMappedCN[msg?.status || 'accepted'],
|
|
|
|
|
statusTitle: msgStatusRenderMappedCN[msg?.status || 'accepted'],
|
|
|
|
|
replyButton: !['accepted', 'waiting', 'failed'].includes(msg?.status || '') ,
|
|
|
|
|
...((isEmpty(msg.context) && isEmpty(msg.reaction)) || msg.context?.forwarded === true // || isEmpty(msg.messageorigin)
|
|
|
|
|
? {}
|
|
|
|
|
: {
|
|
|
|
@ -789,7 +789,7 @@ export const parseRenderMessageList = (messages) => {
|
|
|
|
|
msgContent.template = msg.msgtype === 'template' ? { ...msgContent.template, ...template } : {};
|
|
|
|
|
// const parseMethod = msgContent.bizType === 'whatsapp' ? cloneDeep(whatsappMsgTypeMapped) : {};
|
|
|
|
|
let waCode, waError = '';
|
|
|
|
|
if ((msgContent?.status || 'failed') === 'failed' && msgContent.errorMessage && msg.msg_direction === 'outbound') {
|
|
|
|
|
if ((msgContent?.status || 'accepted') === 'failed' && msgContent.errorMessage && msg.msg_direction === 'outbound') {
|
|
|
|
|
(waCode = msgContent.errorMessage.match(/\(#(\d+)\)/));
|
|
|
|
|
(waError = (whatsappError?.[waCode?.[1]] || whatsappError?.[msgContent.errorCode] || msgContent.errorMessage));
|
|
|
|
|
if (!isEmpty(msgContent.whatsappApiError)) {
|
|
|
|
@ -816,20 +816,20 @@ export const parseRenderMessageList = (messages) => {
|
|
|
|
|
from: msgContent.from,
|
|
|
|
|
sender: msgContent.from,
|
|
|
|
|
senderName: msgContent?.customerProfile?.name || msgContent.from || 'me',
|
|
|
|
|
replyButton: !['waiting', 'failed'].includes(msgContent?.status || '') ,
|
|
|
|
|
replyButton: !['accepted', 'waiting', 'failed'].includes(msgContent?.status || '') ,
|
|
|
|
|
// 用forwarded表示Resend, 与Reply互斥
|
|
|
|
|
forwarded: msg.msg_direction === 'outbound' && msg.msg_source === 'email' && ['email'].includes(msgContent.type) && (msgContent?.status || 'failed') === 'failed',
|
|
|
|
|
forwarded: msg.msg_direction === 'outbound' && msg.msg_source === 'email' && ['email'].includes(msgContent.type) && (msgContent?.status || 'accepted') === 'failed',
|
|
|
|
|
...(msg.msg_direction === 'outbound'
|
|
|
|
|
? {
|
|
|
|
|
sender: 'me',
|
|
|
|
|
senderName: 'me',
|
|
|
|
|
status: msgStatusRenderMapped[msgContent?.status || 'failed'],
|
|
|
|
|
dateString: msgStatusRenderMapped[msgContent?.status || 'failed'] === 'failed' ? `${(msg.msgtime || '').replace('T', ' ')} 发送失败 ${waError} ❌` : '',
|
|
|
|
|
statusCN: msgStatusRenderMappedCN[msgContent?.status || 'failed'],
|
|
|
|
|
statusTitle: msgStatusRenderMappedCN[msgContent?.status || 'failed'],
|
|
|
|
|
id: (msgContent?.status || 'failed') === 'failed' ? (msgContent.actionId || msgContent.id) : (msgTypeData.id || msg.id || msg.sn),
|
|
|
|
|
status: msgStatusRenderMapped[msgContent?.status || 'accepted'],
|
|
|
|
|
dateString: msgStatusRenderMapped[msgContent?.status || 'accepted'] === 'failed' ? `${(msg.msgtime || '').replace('T', ' ')} 发送失败 ${waError} ❌` : '',
|
|
|
|
|
statusCN: msgStatusRenderMappedCN[msgContent?.status || 'accepted'],
|
|
|
|
|
statusTitle: msgStatusRenderMappedCN[msgContent?.status || 'accepted'],
|
|
|
|
|
id: (msgContent?.status || 'accepted') === 'failed' ? (msgContent.actionId || msgContent.id) : (msgTypeData.id || msg.id || msg.sn),
|
|
|
|
|
actionId: msgContent.actionId,
|
|
|
|
|
replyButton: !['waiting', 'failed'].includes(msgContent?.status || 'failed') ,
|
|
|
|
|
replyButton: !['accepted', 'waiting', 'failed'].includes(msgContent?.status || 'accepted') ,
|
|
|
|
|
}
|
|
|
|
|
: {}),
|
|
|
|
|
...(isEmpty(messageorigin) && (isEmpty(msgContent.context) || msgContent.context?.forwarded === true)
|
|
|
|
|