|
|
|
@ -147,7 +147,7 @@ const whatsappMsgMapped = {
|
|
|
|
|
contentObj = {
|
|
|
|
|
...contentObj,
|
|
|
|
|
type: 'error',
|
|
|
|
|
text: {body: `❌ Message failed to send.` }, // contentObj.errorMessage
|
|
|
|
|
text: {body: `❌ ${whatsappError?.[contentObj.errorCode] || contentObj.errorMessage}` }, // contentObj.errorMessage // Message failed to send.
|
|
|
|
|
id: contentObj.id,
|
|
|
|
|
wamid: contentObj.id,
|
|
|
|
|
};
|
|
|
|
@ -162,7 +162,7 @@ const whatsappMsgMapped = {
|
|
|
|
|
id: msgcontent.wamid,
|
|
|
|
|
status: msgStatusRenderMapped[(msgcontent?.status || 'failed')],
|
|
|
|
|
sender: 'me',
|
|
|
|
|
dateString: msgcontent.status==='failed' ? '发送失败 ❌' : '',
|
|
|
|
|
dateString: msgcontent.status==='failed' ? `发送失败 ${whatsappError?.[msgcontent.errorCode] || msgcontent.errorMessage} ❌` : '',
|
|
|
|
|
}),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
@ -191,7 +191,7 @@ export const receivedMsgTypeMapped = {
|
|
|
|
|
// 发送消息的同步返回: 发送失败时
|
|
|
|
|
getMsg: (result) => result,
|
|
|
|
|
contentToRender: () => null,
|
|
|
|
|
contentToUpdate: (msgcontent) => ({ ...msgcontent, id: msgcontent.actionId, status: msgcontent?.status || 'failed', dateString: '发送失败 ❌', conversationid: msgcontent.actionId.split('.')[0], }),
|
|
|
|
|
contentToUpdate: (msgcontent) => ({ ...msgcontent, id: msgcontent.actionId, status: msgcontent?.status || 'failed', dateString: `发送失败 ${msgcontent.error.message} ❌`, conversationid: msgcontent.actionId.split('.')[0], }),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
export const whatsappMsgTypeMapped = {
|
|
|
|
@ -338,7 +338,7 @@ export const parseRenderMessageList = (messages, conversationid = null) => {
|
|
|
|
|
sender: 'me',
|
|
|
|
|
senderName: 'me',
|
|
|
|
|
status: msgStatusRenderMapped[msgContent?.status || 'failed'],
|
|
|
|
|
dateString: msgStatusRenderMapped[msgContent?.status || 'failed'] === 'failed' ? '发送失败 ❌' : '',
|
|
|
|
|
dateString: msgStatusRenderMapped[msgContent?.status || 'failed'] === 'failed' ? `发送失败 ${whatsappError?.[msgContent.errorCode] || msgContent.errorMessage} ❌` : '',
|
|
|
|
|
}
|
|
|
|
|
: {}),
|
|
|
|
|
...(isEmpty(msg.messageorigin_AsJOSN) && isEmpty(msgContent.context)
|
|
|
|
@ -361,3 +361,10 @@ export const parseRenderMessageList = (messages, conversationid = null) => {
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
export const whatsappError = {
|
|
|
|
|
'131026': '消息无法投递. [未注册/使用旧版/未同意政策]',
|
|
|
|
|
'131047': '会话超过24小时.',
|
|
|
|
|
'131053': '文件上传失败.',
|
|
|
|
|
'131048': '账户被风控.', // 消息发送太多, 达到垃圾数量限制
|
|
|
|
|
'131031': '账户已锁定.',
|
|
|
|
|
};
|
|
|
|
|