perf: 更新模板显示

dev/emitter
Lei OT 1 year ago
parent e993f4195a
commit 30b78a4132

@ -13,7 +13,7 @@ export const fetchTemplates = async (params) => {
const data = await fetchJSON(`${API_HOST}/listtemplates`, params);
const canUseTemplates = (data?.result?.items || [])
.filter((_t) => _t.status === 'APPROVED' && !['say_hello_from_trip_advisor','free_style_7','free_style_1'].includes(_t.name))
.map((ele, i) => ({ ...ele, components_origin: ele.components, components: groupBy(ele.components, (_c) => _c.type.toLowerCase()), key:ele.name, }));
.map((ele, i) => ({ ...ele, components_origin: ele.components, components: groupBy(ele.components, (_c) => _c.type.toLowerCase()), key:ele.name, displayName: ele.name.includes('specialist') ? `specialist_followup` : ele.name}));
const topName = [
'order_updated_specialist_assigned_sharon',
'online_inquiry_received',

@ -444,7 +444,7 @@ export const whatsappMsgTypeMapped = {
},
text: {
type: 'text',
data: (msg) => ({ id: msg.wamid, text: autoLinkText(msg?.text?.body), originText: msg?.text?.body, title: msg?.customerProfile?.name || msg?.from || '', }),
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: {
@ -612,11 +612,11 @@ export const whatsappMsgTypeMapped = {
type: 'text',
data: (msg) => {
const templateDataMapped = msg.template?.components ? msg.template.components.reduce((r, v) => ({ ...r, [v.type]: v }), {}) : {};
return { id: msg.wamid, text: autoLinkText(templateDataMapped?.body?.text || `......${(templateDataMapped?.body?.parameters || []).map(pv => pv?.text || '').join('......')}......`), title: msg.template.name };
return { id: msg.wamid, text: autoLinkText(templateDataMapped?.body?.text || `......${(templateDataMapped?.body?.parameters || []).map(pv => pv?.text || '').join('......')}......`), title: '模板消息', }; // msg.template.name
},
renderForReply: (msg) => {
const templateDataMapped = msg.template?.components ? msg.template.components.reduce((r, v) => ({ ...r, [v.type]: v }), {}) : null;
return { id: msg.wamid, message: templateDataMapped?.body?.text || templateDataMapped?.body?.parameters?.[0]?.text || '', title: `${msg.template.name}` };
return { id: msg.wamid, message: templateDataMapped?.body?.text || templateDataMapped?.body?.parameters?.[0]?.text || '', title: '模板消息', }; // `${msg.template.name}`
},
},
email: {

@ -117,7 +117,7 @@ const CategoryList = ({ dataSource, handleSendTemplate, valueMapped, onInput, ac
title={
<Flex justify={'space-between'}>
<span>
{item.components.header?.[0]?.text || (item.name.includes('specialist') ? `specialist_followup` : item.name)}
{item.components.header?.[0]?.text || (item.name.includes('specialist') ? `specialist_followup` : item.displayName)}
<Tag style={{ ...TagColorStyle(item.language.toUpperCase(), true) }} className='ml-1'>
{item.language.toUpperCase()}
</Tag>

Loading…
Cancel
Save