|
|
|
@ -14,6 +14,9 @@ export const replaceTemplateString = (str, replacements) => {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated 在渲染时处理
|
|
|
|
|
*/
|
|
|
|
|
export const autoLinkText = (text) => {
|
|
|
|
|
return text;
|
|
|
|
|
// let regex = /(https?:\/\/[^\s]+)/g;
|
|
|
|
@ -401,15 +404,11 @@ export const whatsappMsgTypeMapped = {
|
|
|
|
|
message: '[位置]',
|
|
|
|
|
}),
|
|
|
|
|
},
|
|
|
|
|
// contact: 'contact',
|
|
|
|
|
// 'contact-card': 'contact-card',
|
|
|
|
|
// 'contact-card-with-photo': 'contact-card-with-photo',
|
|
|
|
|
// 'contact-card-with-photo-and-label': 'contact-card-with-photo-and-label',
|
|
|
|
|
template: {
|
|
|
|
|
type: 'text',
|
|
|
|
|
data: (msg) => {
|
|
|
|
|
const templateDataMapped = msg.template?.components ? msg.template.components.reduce((r, v) => ({ ...r, [v.type]: v }), {}) : null;
|
|
|
|
|
return { id: msg.wamid, text: autoLinkText(templateDataMapped?.body?.text || templateDataMapped?.body?.parameters?.[0]?.text || ''), 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;
|
|
|
|
|