|
|
|
@ -12,13 +12,28 @@ import dayjs from 'dayjs';
|
|
|
|
|
export const fetchTemplates = async (params) => {
|
|
|
|
|
const data = await fetchJSON(`${API_HOST}/listtemplates`, params);
|
|
|
|
|
const canUseTemplates = (data?.result?.items || [])
|
|
|
|
|
.filter((_t) => _t.status === 'APPROVED' && _t.name !== 'say_hello_from_trip_advisor')
|
|
|
|
|
.map((ele) => ({ ...ele, components_origin: ele.components, components: groupBy(ele.components, (_c) => _c.type.toLowerCase()) }));
|
|
|
|
|
const topName = ['free_style_7', 'online_inquiry_received','say_hello_again', 'first_message_for_not_reply', 'free_style_2', 'free_style_1', 'free_style_3', 'free_style_4'];
|
|
|
|
|
.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, }));
|
|
|
|
|
const topName = [
|
|
|
|
|
'order_updated_specialist_assigned_sharon',
|
|
|
|
|
'online_inquiry_received',
|
|
|
|
|
'say_hello_again',
|
|
|
|
|
'first_message_for_not_reply',
|
|
|
|
|
'order_updated_specialist_assigned_christy',
|
|
|
|
|
'free_style_2',
|
|
|
|
|
'free_style_3',
|
|
|
|
|
'free_style_4',
|
|
|
|
|
]
|
|
|
|
|
const top = sortArrayByOrder( canUseTemplates.filter((_t) => topName.includes(_t.name)), 'name', topName);
|
|
|
|
|
const raw = canUseTemplates.filter((_t) => !topName.includes(_t.name));
|
|
|
|
|
return [...top, ...raw];
|
|
|
|
|
};
|
|
|
|
|
/**
|
|
|
|
|
* ↑上面的模板名称bak
|
|
|
|
|
* order_updated_specialist_assigned_sharon : free_style_7
|
|
|
|
|
* order_updated_specialist_assigned_christy : free_style_1
|
|
|
|
|
* online_inquiry_received: say_hello_from_trip_advisor
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
export const CONVERSATION_PAGE_SIZE = 20;
|
|
|
|
|
/**
|
|
|
|
|