|
|
|
@ -534,6 +534,15 @@ export const parseRenderMessageList = (messages) => {
|
|
|
|
|
msgContent.template = msg.msgtype === 'template' ? { ...msgContent.template, ...msg.template_AsJOSN } : {};
|
|
|
|
|
const msgType = Object.keys(whatsappMsgTypeMapped).includes(msgContent.type) ? msgContent.type : 'unsupported';
|
|
|
|
|
// const parseMethod = msgContent.bizType === 'whatsapp' ? cloneDeep(whatsappMsgTypeMapped) : {};
|
|
|
|
|
let waCode, waError = '';
|
|
|
|
|
if ((msgContent?.status || 'failed') === '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)) {
|
|
|
|
|
waError = whatsappError?.[msgContent.whatsappApiError.code] || msgContent.whatsappApiError.message;
|
|
|
|
|
waError += `\n[${msgContent.errorCode}] ${whatsappError?.[msgContent.errorCode] || msgContent.errorMessage}`;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
...msg,
|
|
|
|
|
msgOrigin: msgContent,
|
|
|
|
@ -552,7 +561,7 @@ export const parseRenderMessageList = (messages) => {
|
|
|
|
|
sender: 'me',
|
|
|
|
|
senderName: 'me',
|
|
|
|
|
status: msgStatusRenderMapped[msgContent?.status || 'failed'],
|
|
|
|
|
dateString: msgStatusRenderMapped[msgContent?.status || 'failed'] === 'failed' ? `${(msg.msgtime || '').replace('T', ' ')} 发送失败 ${whatsappError?.[msgContent.errorCode] || msgContent.errorMessage || ''} ❌` : '',
|
|
|
|
|
dateString: msgStatusRenderMapped[msgContent?.status || 'failed'] === 'failed' ? `${(msg.msgtime || '').replace('T', ' ')} 发送失败 ${waError} ❌` : '',
|
|
|
|
|
statusCN: msgStatusRenderMappedCN[msgContent?.status || 'failed'],
|
|
|
|
|
statusTitle: msgStatusRenderMappedCN[msgContent?.status || 'failed'],
|
|
|
|
|
}
|
|
|
|
|