mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 03:57:52 +00:00
feat: New automation actions (#4033)
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
<select
|
||||
v-model="action_name"
|
||||
class="action__question"
|
||||
@change="resetFilter()"
|
||||
:class="{ 'full-width': !inputType }"
|
||||
@change="resetAction()"
|
||||
>
|
||||
<option
|
||||
v-for="attribute in actionTypes"
|
||||
@@ -18,19 +19,38 @@
|
||||
</option>
|
||||
</select>
|
||||
<div class="filter__answer--wrap">
|
||||
<div class="multiselect-wrap--small">
|
||||
<multiselect
|
||||
<div v-if="inputType">
|
||||
<div
|
||||
v-if="inputType === 'multi_select'"
|
||||
class="multiselect-wrap--small"
|
||||
>
|
||||
<multiselect
|
||||
v-model="action_params"
|
||||
track-by="id"
|
||||
label="name"
|
||||
:placeholder="'Select'"
|
||||
:multiple="true"
|
||||
selected-label
|
||||
:select-label="$t('FORMS.MULTISELECT.ENTER_TO_SELECT')"
|
||||
deselect-label=""
|
||||
:max-height="160"
|
||||
:options="dropdownValues"
|
||||
:allow-empty="false"
|
||||
/>
|
||||
</div>
|
||||
<input
|
||||
v-else-if="inputType === 'email'"
|
||||
v-model="action_params"
|
||||
track-by="id"
|
||||
label="name"
|
||||
:placeholder="'Select'"
|
||||
:multiple="true"
|
||||
selected-label
|
||||
:select-label="$t('FORMS.MULTISELECT.ENTER_TO_SELECT')"
|
||||
deselect-label=""
|
||||
:max-height="160"
|
||||
:options="dropdownValues"
|
||||
:allow-empty="false"
|
||||
type="email"
|
||||
class="answer--text-input"
|
||||
placeholder="Enter email"
|
||||
/>
|
||||
<input
|
||||
v-else-if="inputType === 'url'"
|
||||
v-model="action_params"
|
||||
type="url"
|
||||
class="answer--text-input"
|
||||
placeholder="Enter url"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -91,13 +111,17 @@ export default {
|
||||
this.$emit('input', { ...payload, action_params: value });
|
||||
},
|
||||
},
|
||||
inputType() {
|
||||
return this.actionTypes.find(action => action.key === this.action_name)
|
||||
.inputType;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
removeAction() {
|
||||
this.$emit('removeAction');
|
||||
},
|
||||
resetFilter() {
|
||||
this.$emit('resetFilter');
|
||||
resetAction() {
|
||||
this.$emit('resetAction');
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -136,6 +160,10 @@ export default {
|
||||
max-width: 50%;
|
||||
}
|
||||
|
||||
.action__question.full-width {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.filter__answer--wrap {
|
||||
margin-right: var(--space-smaller);
|
||||
flex-grow: 1;
|
||||
|
||||
@@ -101,6 +101,7 @@
|
||||
getActionDropdownValues(automation.actions[i].action_name)
|
||||
"
|
||||
:v="$v.automation.actions.$each[i]"
|
||||
@resetAction="resetAction(i)"
|
||||
@removeAction="removeAction(i)"
|
||||
/>
|
||||
<div class="filter-actions">
|
||||
@@ -187,7 +188,13 @@ export default {
|
||||
required,
|
||||
$each: {
|
||||
action_params: {
|
||||
required,
|
||||
required: requiredIf(prop => {
|
||||
return !(
|
||||
prop.action_name === 'mute_conversation' ||
|
||||
prop.action_name === 'snooze_convresation' ||
|
||||
prop.action_name === 'resolve_convresation'
|
||||
);
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -351,7 +358,6 @@ export default {
|
||||
getActionDropdownValues(type) {
|
||||
switch (type) {
|
||||
case 'assign_team':
|
||||
case 'send_email_to_team':
|
||||
return this.$store.getters['teams/getTeams'];
|
||||
case 'add_label':
|
||||
return this.$store.getters['labels/getLabels'].map(i => {
|
||||
@@ -424,6 +430,9 @@ export default {
|
||||
).filterOperators[0].value;
|
||||
this.automation.conditions[index].values = '';
|
||||
},
|
||||
resetAction(index) {
|
||||
this.automation.actions[index].action_params = [];
|
||||
},
|
||||
showUserInput(operatorType) {
|
||||
if (operatorType === 'is_present' || operatorType === 'is_not_present')
|
||||
return false;
|
||||
|
||||
@@ -351,7 +351,6 @@ export default {
|
||||
getActionDropdownValues(type) {
|
||||
switch (type) {
|
||||
case 'assign_team':
|
||||
case 'send_email_to_team':
|
||||
return this.$store.getters['teams/getTeams'];
|
||||
case 'add_label':
|
||||
return this.$store.getters['labels/getLabels'].map(i => {
|
||||
|
||||
@@ -79,8 +79,33 @@ export const AUTOMATIONS = {
|
||||
// {
|
||||
// key: 'send_email_to_team',
|
||||
// name: 'Send an email to team',
|
||||
// attributeI18nKey: 'SEND_EMAIL_TO_TEAM',
|
||||
// attributeI18nKey: 'SEND_MESSAGE',
|
||||
// },
|
||||
{
|
||||
key: 'send_email_transcript',
|
||||
name: 'Send an email transcript',
|
||||
attributeI18nKey: 'SEND_EMAIL_TRANSCRIPT',
|
||||
},
|
||||
{
|
||||
key: 'mute_conversation',
|
||||
name: 'Mute conversation',
|
||||
attributeI18nKey: 'MUTE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'snooze_convresation',
|
||||
name: 'Snooze conversation',
|
||||
attributeI18nKey: 'MUTE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'resolve_convresation',
|
||||
name: 'Resolve conversation',
|
||||
attributeI18nKey: 'RESOLVE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'send_webhook_event',
|
||||
name: 'Send Webhook Event',
|
||||
attributeI18nKey: 'SEND_WEBHOOK_EVENT',
|
||||
},
|
||||
],
|
||||
},
|
||||
conversation_created: {
|
||||
@@ -120,15 +145,40 @@ export const AUTOMATIONS = {
|
||||
name: 'Assign a team',
|
||||
attributeI18nKey: 'ASSIGN_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'assign_agent',
|
||||
name: 'Assign an agent',
|
||||
attributeI18nKey: 'ASSIGN_AGENT',
|
||||
},
|
||||
// {
|
||||
// key: 'send_email_to_team',
|
||||
// name: 'Send an email to team',
|
||||
// attributeI18nKey: 'SEND_MESSAGE',
|
||||
// },
|
||||
{
|
||||
key: 'assign_agent',
|
||||
name: 'Assign an agent',
|
||||
attributeI18nKey: 'ASSIGN_AGENT',
|
||||
key: 'send_email_transcript',
|
||||
name: 'Send an email transcript',
|
||||
attributeI18nKey: 'SEND_EMAIL_TRANSCRIPT',
|
||||
},
|
||||
{
|
||||
key: 'mute_conversation',
|
||||
name: 'Mute conversation',
|
||||
attributeI18nKey: 'MUTE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'snooze_convresation',
|
||||
name: 'Snooze conversation',
|
||||
attributeI18nKey: 'MUTE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'resolve_convresation',
|
||||
name: 'Resolve conversation',
|
||||
attributeI18nKey: 'RESOLVE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'send_webhook_event',
|
||||
name: 'Send Webhook Event',
|
||||
attributeI18nKey: 'SEND_WEBHOOK_EVENT',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -183,16 +233,40 @@ export const AUTOMATIONS = {
|
||||
name: 'Assign a team',
|
||||
attributeI18nKey: 'ASSIGN_TEAM',
|
||||
},
|
||||
// {
|
||||
// key: 'send_email_to_team',
|
||||
// name: 'Send an email to team',
|
||||
// attributeI18nKey: 'SEND_EMAIL_TO_TEAM',
|
||||
// },
|
||||
{
|
||||
key: 'assign_agent',
|
||||
name: 'Assign an agent',
|
||||
attributeI18nKey: 'ASSIGN_AGENT',
|
||||
attributeKey: 'assignee_id',
|
||||
},
|
||||
// {
|
||||
// key: 'send_email_to_team',
|
||||
// name: 'Send an email to team',
|
||||
// attributeI18nKey: 'SEND_MESSAGE',
|
||||
// },
|
||||
{
|
||||
key: 'send_email_transcript',
|
||||
name: 'Send an email transcript',
|
||||
attributeI18nKey: 'SEND_EMAIL_TRANSCRIPT',
|
||||
},
|
||||
{
|
||||
key: 'mute_conversation',
|
||||
name: 'Mute conversation',
|
||||
attributeI18nKey: 'MUTE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'snooze_convresation',
|
||||
name: 'Snooze conversation',
|
||||
attributeI18nKey: 'MUTE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'resolve_convresation',
|
||||
name: 'Resolve conversation',
|
||||
attributeI18nKey: 'RESOLVE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'send_webhook_event',
|
||||
name: 'Send Webhook Event',
|
||||
attributeI18nKey: 'SEND_WEBHOOK_EVENT',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -217,13 +291,41 @@ export const AUTOMATION_ACTION_TYPES = [
|
||||
{
|
||||
key: 'assign_team',
|
||||
label: 'Assign a team',
|
||||
inputType: 'multi_select',
|
||||
},
|
||||
{
|
||||
key: 'add_label',
|
||||
label: 'Add a label',
|
||||
inputType: 'multi_select',
|
||||
},
|
||||
// {
|
||||
// key: 'send_email_to_team',
|
||||
// label: 'Send an email to team',
|
||||
// inputType: 'multi_select',
|
||||
// },
|
||||
{
|
||||
key: 'send_email_transcript',
|
||||
label: 'Send an email transcript',
|
||||
inputType: 'email',
|
||||
},
|
||||
{
|
||||
key: 'mute_conversation',
|
||||
label: 'Mute conversation',
|
||||
inputType: null,
|
||||
},
|
||||
{
|
||||
key: 'snooze_convresation',
|
||||
label: 'Snooze conversation',
|
||||
inputType: null,
|
||||
},
|
||||
{
|
||||
key: 'resolve_convresation',
|
||||
label: 'Resolve conversation',
|
||||
inputType: null,
|
||||
},
|
||||
{
|
||||
key: 'send_webhook_event',
|
||||
label: 'Send Webhook Event',
|
||||
inputType: 'url',
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user