diff --git a/src/actions/ConversationActions.js b/src/actions/ConversationActions.js index c0477e4..a5586ac 100644 --- a/src/actions/ConversationActions.js +++ b/src/actions/ConversationActions.js @@ -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', diff --git a/src/channel/bubbleMsgUtils.js b/src/channel/bubbleMsgUtils.js index 0fde5e8..c75d857 100644 --- a/src/channel/bubbleMsgUtils.js +++ b/src/channel/bubbleMsgUtils.js @@ -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: { diff --git a/src/views/Conversations/Online/Input/Template.jsx b/src/views/Conversations/Online/Input/Template.jsx index 090d187..38b61c0 100644 --- a/src/views/Conversations/Online/Input/Template.jsx +++ b/src/views/Conversations/Online/Input/Template.jsx @@ -117,7 +117,7 @@ const CategoryList = ({ dataSource, handleSendTemplate, valueMapped, onInput, ac title={ - {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)} {item.language.toUpperCase()}