fix: msg time; sender name

2.0/email-builder
Lei OT 10 months ago
parent 8f5fc6551d
commit bb968b8a36

@ -398,24 +398,24 @@ export const whatsappMsgTypeMapped = {
},
text: {
type: 'text',
data: (msg) => ({ id: msg.wamid, text: autoLinkText(msg?.text?.body), originText: msg?.text?.body, title: msg?.customerProfile?.name || '' }),
data: (msg) => ({ id: msg.wamid, text: autoLinkText(msg?.text?.body), originText: msg?.text?.body, title: msg?.customerProfile?.name || msg?.from || '' }),
renderForReply: (msg) => ({ id: msg.wamid, message: msg?.text?.body }),
},
image: {
type: 'photo',
data: (msg) => ({
id: msg.wamid,
text: msg.image.caption,
text: msg.image?.caption,
onPhotoError: ({ currentTarget }) => {
currentTarget.onerror = null;
currentTarget.src="https://hiana-crm.oss-accelerate.aliyuncs.com/WAMedia/afe412d4-3acf-4e79-a623-048aeb4d696a.png";
},
data: {
id: msg.wamid,
uri: msg.image.link,
uri: msg.image?.link,
width: 'auto',
height: 200,
alt: msg.image.caption || '',
alt: msg.image?.caption || '',
status: {
click: true,
loading: 0,
@ -426,7 +426,7 @@ export const whatsappMsgTypeMapped = {
}),
renderForReply: (msg) => ({
id: msg.wamid,
photoURL: msg.image.link,
photoURL: msg.image?.link,
width: 'auto',
height: 200,
alt: msg.image?.caption || '',
@ -439,7 +439,7 @@ export const whatsappMsgTypeMapped = {
id: msg.wamid,
data: {
id: msg.wamid,
uri: msg.sticker.link,
uri: msg.sticker?.link,
width: '100%',
height: 120,
alt: '',
@ -602,8 +602,7 @@ export const parseRenderMessageItem = (msg) => {
dateString: dayjs(msg?.sendTime || msg.createTime).format('MM-DD HH:mm'),
from: msg.from,
sender: msg.from,
senderName: msg?.customerProfile?.name || msg?.fromName || msg?.from || 'me', // msg.from,
// title: msg.customerProfile.name,
senderName: msg.msg_direction === 'inbound' ? (msg?.customerProfile?.name || msg?.fromName || msg?.from || '') : 'me',
customer_name: msg?.customerProfile?.name || '',
whatsapp_name: msg?.customerProfile?.name || '',
whatsapp_phone_number: isEmpty(msg?.customerProfile) ? msg.to : msg.from,
@ -669,13 +668,13 @@ export const parseRenderMessageList = (messages) => {
...(whatsappMsgTypeMapped?.[msgType]?.data(msgContent) || {}),
type: msgContent.type,
...(typeof whatsappMsgTypeMapped[msgType].type === 'function' ? whatsappMsgTypeMapped[msgType].type(msg) : { type: whatsappMsgTypeMapped[msgType].type || 'text' }),
date: msgContent?.sendTime || msg.msgtime || '',
dateText: dayjs(msgContent?.sendTime || msg.msgtime).format('MM-DD HH:mm'),
dateString: dayjs(msgContent?.sendTime || msg.msgtime).format('MM-DD HH:mm'),
date: msg.msgtime, // msgContent?.sendTime || msg.msgtime || '',
dateText: dayjs(msg.msgtime).format('MM-DD HH:mm'),
dateString: dayjs(msg.msgtime).format('MM-DD HH:mm'),
localDate: (msg.msgtime || '').replace('T', ' '),
from: msgContent.from,
sender: msgContent.from,
senderName: msgContent?.customerProfile?.name || 'me', // msgContent.from,
senderName: msg.msg_direction === 'inbound' ? (msgContent?.customerProfile?.name || msgContent.from) : 'me',
replyButton: ['text', 'document', 'image', 'email'].includes(msgContent.type) && (msgContent?.status || '') !== 'failed',
// 用forwarded表示Resend, 与Reply互斥
forwarded: msg.msg_direction === 'outbound'

Loading…
Cancel
Save