feat: Adds automation view for assigning an agent (#6131)

* feat: Adds automation view for assigning an agent

Co-authored-by: Tejaswini Chile <tejaswini@chatwoot.com>
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Sivin Varghese
2023-01-10 11:35:56 +05:30
committed by GitHub
parent 28c8023bad
commit add33d032c
7 changed files with 39 additions and 10 deletions

View File

@@ -97,8 +97,9 @@ export const generateConditionOptions = (options, key = 'id') => {
});
};
export const getActionOptions = ({ teams, labels, type }) => {
export const getActionOptions = ({ agents, teams, labels, type }) => {
const actionsMap = {
assign_agent: agents,
assign_team: teams,
send_email_to_team: teams,
add_label: generateConditionOptions(labels, 'title'),
@@ -178,7 +179,7 @@ export const getDefaultConditions = eventName => {
export const getDefaultActions = () => {
return [
{
action_name: 'assign_team',
action_name: 'assign_agent',
action_params: [],
},
];
@@ -213,7 +214,7 @@ export const isCustomAttribute = (attrs, key) => {
export const generateCustomAttributes = (
conversationAttributes = [],
contactAttribtues = [],
contactAttributes = [],
conversationlabel,
contactlabel
) => {
@@ -228,14 +229,14 @@ export const generateCustomAttributes = (
...conversationAttributes
);
}
if (contactAttribtues.length) {
if (contactAttributes.length) {
customAttributes.push(
{
key: `contact_custom_attribute`,
name: contactlabel,
disabled: true,
},
...contactAttribtues
...contactAttributes
);
}
return customAttributes;