mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 03:57:52 +00:00
chore(i18n): Improvements in automation and macros (#11231)
# Pull Request Template ## Description This PR includes, 1. **Sort Accounts List** – Orders the accounts list alphabetically for better organization. 2. **Add Missing Translations in Automation** – Includes missing translations for actions, events, and conditions dropdown. 3. **Fix Missing Translation in Macros** – Adds missing translations in the macros action select dropdown. 4. Translate "Automation System" Username – Ensures the "Automation System" username is properly translated. Fixes: https://linear.app/chatwoot/issue/CW-4198/issues-[converso] ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules
This commit is contained in:
@@ -26,6 +26,12 @@ const showAccountSwitcher = computed(
|
||||
() => userAccounts.value.length > 1 && currentAccount.value.name
|
||||
);
|
||||
|
||||
const sortedCurrentUserAccounts = computed(() => {
|
||||
return [...(currentUser.value.accounts || [])].sort((a, b) =>
|
||||
a.name.localeCompare(b.name)
|
||||
);
|
||||
});
|
||||
|
||||
const onChangeAccount = newId => {
|
||||
const accountUrl = `/app/accounts/${newId}/dashboard`;
|
||||
window.location.href = accountUrl;
|
||||
@@ -70,7 +76,7 @@ const emitNewAccount = () => {
|
||||
<DropdownBody v-if="showAccountSwitcher" class="min-w-80 z-50">
|
||||
<DropdownSection :title="t('SIDEBAR_ITEMS.SWITCH_ACCOUNT')">
|
||||
<DropdownItem
|
||||
v-for="account in currentUser.accounts"
|
||||
v-for="account in sortedCurrentUserAccounts"
|
||||
:id="`account-${account.id}`"
|
||||
:key="account.id"
|
||||
class="cursor-pointer"
|
||||
|
||||
@@ -36,7 +36,7 @@ describe('#resolveActionName', () => {
|
||||
expect(resolveActionName(MACRO_ACTION_TYPES[1].key)).not.toEqual(
|
||||
MACRO_ACTION_TYPES[0].label
|
||||
);
|
||||
expect(resolveActionName('change_priority')).toEqual('Change Priority');
|
||||
expect(resolveActionName('change_priority')).toEqual('CHANGE_PRIORITY'); // Translated
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -126,6 +126,44 @@
|
||||
"ATLEAST_ONE_CONDITION_REQUIRED": "At least one condition is required",
|
||||
"ATLEAST_ONE_ACTION_REQUIRED": "At least one action is required"
|
||||
},
|
||||
"NONE_OPTION": "None"
|
||||
"NONE_OPTION": "None",
|
||||
"EVENTS": {
|
||||
"CONVERSATION_CREATED": "Conversation Created",
|
||||
"CONVERSATION_UPDATED": "Conversation Updated",
|
||||
"MESSAGE_CREATED": "Message Created",
|
||||
"CONVERSATION_OPENED": "Conversation Opened"
|
||||
},
|
||||
"ACTIONS": {
|
||||
"ASSIGN_AGENT": "Assign to Agent",
|
||||
"ASSIGN_TEAM": "Assign a Team",
|
||||
"ADD_LABEL": "Add a Label",
|
||||
"REMOVE_LABEL": "Remove a Label",
|
||||
"SEND_EMAIL_TO_TEAM": "Send an Email to Team",
|
||||
"SEND_EMAIL_TRANSCRIPT": "Send an Email Transcript",
|
||||
"MUTE_CONVERSATION": "Mute Conversation",
|
||||
"SNOOZE_CONVERSATION": "Snooze Conversation",
|
||||
"RESOLVE_CONVERSATION": "Resolve Conversation",
|
||||
"SEND_WEBHOOK_EVENT": "Send Webhook Event",
|
||||
"SEND_ATTACHMENT": "Send Attachment",
|
||||
"SEND_MESSAGE": "Send a Message",
|
||||
"CHANGE_PRIORITY": "Change Priority",
|
||||
"ADD_SLA": "Add SLA"
|
||||
},
|
||||
"ATTRIBUTES": {
|
||||
"MESSAGE_TYPE": "Message Type",
|
||||
"MESSAGE_CONTAINS": "Message Contains",
|
||||
"EMAIL": "Email",
|
||||
"INBOX": "Inbox",
|
||||
"CONVERSATION_LANGUAGE": "Conversation Language",
|
||||
"PHONE_NUMBER": "Phone Number",
|
||||
"STATUS": "Status",
|
||||
"BROWSER_LANGUAGE": "Browser Language",
|
||||
"MAIL_SUBJECT": "Email Subject",
|
||||
"COUNTRY_NAME": "Country",
|
||||
"REFERER_LINK": "Referrer Link",
|
||||
"ASSIGNEE_NAME": "Assignee",
|
||||
"TEAM_NAME": "Team",
|
||||
"PRIORITY": "Priority"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,21 @@
|
||||
"ACTION_PARAMETERS_REQUIRED": "Action parameters are required",
|
||||
"ATLEAST_ONE_CONDITION_REQUIRED": "At least one condition is required",
|
||||
"ATLEAST_ONE_ACTION_REQUIRED": "At least one action is required"
|
||||
},
|
||||
"ACTIONS": {
|
||||
"ASSIGN_TEAM": "Assign a Team",
|
||||
"ASSIGN_AGENT": "Assign an Agent",
|
||||
"ADD_LABEL": "Add a Label",
|
||||
"REMOVE_LABEL": "Remove a Label",
|
||||
"REMOVE_ASSIGNED_TEAM": "Remove Assigned Team",
|
||||
"SEND_EMAIL_TRANSCRIPT": "Send an Email Transcript",
|
||||
"MUTE_CONVERSATION": "Mute Conversation",
|
||||
"SNOOZE_CONVERSATION": "Snooze Conversation",
|
||||
"RESOLVE_CONVERSATION": "Resolve Conversation",
|
||||
"SEND_ATTACHMENT": "Send Attachment",
|
||||
"SEND_MESSAGE": "Send a Message",
|
||||
"CHANGE_PRIORITY": "Change Priority",
|
||||
"ADD_PRIVATE_NOTE": "Add a Private Note"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,6 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
automationRuleEvent: AUTOMATION_RULE_EVENTS[0].key,
|
||||
automationRuleEvents: AUTOMATION_RULE_EVENTS,
|
||||
automationMutated: false,
|
||||
show: true,
|
||||
showDeleteConfirmationModal: false,
|
||||
@@ -96,6 +95,12 @@ export default {
|
||||
accountId: 'getCurrentAccountId',
|
||||
isFeatureEnabledonAccount: 'accounts/isFeatureEnabledonAccount',
|
||||
}),
|
||||
automationRuleEvents() {
|
||||
return AUTOMATION_RULE_EVENTS.map(event => ({
|
||||
...event,
|
||||
value: this.$t(`AUTOMATION.EVENTS.${event.value}`),
|
||||
}));
|
||||
},
|
||||
hasAutomationMutated() {
|
||||
if (
|
||||
this.automation.conditions[0].values ||
|
||||
@@ -105,10 +110,14 @@ export default {
|
||||
return false;
|
||||
},
|
||||
automationActionTypes() {
|
||||
const isSLAEnabled = this.isFeatureEnabled('sla');
|
||||
return isSLAEnabled
|
||||
const actionTypes = this.isFeatureEnabled('sla')
|
||||
? AUTOMATION_ACTION_TYPES
|
||||
: AUTOMATION_ACTION_TYPES.filter(action => action.key !== 'add_sla');
|
||||
: AUTOMATION_ACTION_TYPES.filter(({ key }) => key !== 'add_sla');
|
||||
|
||||
return actionTypes.map(action => ({
|
||||
...action,
|
||||
label: this.$t(`AUTOMATION.ACTIONS.${action.label}`),
|
||||
}));
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
@@ -137,6 +146,26 @@ export default {
|
||||
this.$emit('saveAutomation', automation, this.mode);
|
||||
}
|
||||
},
|
||||
getTranslatedAttributes(type, event) {
|
||||
return getAttributes(type, event).map(attribute => {
|
||||
// Skip translation
|
||||
// 1. If customAttributeType key is present then its rendering attributes from API
|
||||
// 2. If contact_custom_attribute or conversation_custom_attribute is present then its rendering section title
|
||||
const skipTranslation =
|
||||
attribute.customAttributeType ||
|
||||
[
|
||||
'contact_custom_attribute',
|
||||
'conversation_custom_attribute',
|
||||
].includes(attribute.key);
|
||||
|
||||
return {
|
||||
...attribute,
|
||||
name: skipTranslation
|
||||
? attribute.name
|
||||
: this.$t(`AUTOMATION.ATTRIBUTES.${attribute.name}`),
|
||||
};
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -204,7 +233,7 @@ export default {
|
||||
:key="i"
|
||||
v-model="automation.conditions[i]"
|
||||
:filter-attributes="
|
||||
getAttributes(automationTypes, automation.event_name)
|
||||
getTranslatedAttributes(automationTypes, automation.event_name)
|
||||
"
|
||||
:input-type="
|
||||
getInputType(
|
||||
|
||||
@@ -70,7 +70,6 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
automationRuleEvent: AUTOMATION_RULE_EVENTS[0].key,
|
||||
automationRuleEvents: AUTOMATION_RULE_EVENTS,
|
||||
automationMutated: false,
|
||||
show: true,
|
||||
showDeleteConfirmationModal: false,
|
||||
@@ -84,6 +83,12 @@ export default {
|
||||
accountId: 'getCurrentAccountId',
|
||||
isFeatureEnabledonAccount: 'accounts/isFeatureEnabledonAccount',
|
||||
}),
|
||||
automationRuleEvents() {
|
||||
return AUTOMATION_RULE_EVENTS.map(event => ({
|
||||
...event,
|
||||
value: this.$t(`AUTOMATION.EVENTS.${event.value}`),
|
||||
}));
|
||||
},
|
||||
hasAutomationMutated() {
|
||||
if (
|
||||
this.automation.conditions[0].values ||
|
||||
@@ -93,10 +98,14 @@ export default {
|
||||
return false;
|
||||
},
|
||||
automationActionTypes() {
|
||||
const isSLAEnabled = this.isFeatureEnabled('sla');
|
||||
return isSLAEnabled
|
||||
const actionTypes = this.isFeatureEnabled('sla')
|
||||
? AUTOMATION_ACTION_TYPES
|
||||
: AUTOMATION_ACTION_TYPES.filter(action => action.key !== 'add_sla');
|
||||
: AUTOMATION_ACTION_TYPES.filter(({ key }) => key !== 'add_sla');
|
||||
|
||||
return actionTypes.map(action => ({
|
||||
...action,
|
||||
label: this.$t(`AUTOMATION.ACTIONS.${action.label}`),
|
||||
}));
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
@@ -127,6 +136,26 @@ export default {
|
||||
this.$emit('saveAutomation', automation, this.mode);
|
||||
}
|
||||
},
|
||||
getTranslatedAttributes(type, event) {
|
||||
return getAttributes(type, event).map(attribute => {
|
||||
// Skip translation
|
||||
// 1. If customAttributeType key is present then its rendering attributes from API
|
||||
// 2. If contact_custom_attribute or conversation_custom_attribute is present then its rendering section title
|
||||
const skipTranslation =
|
||||
attribute.customAttributeType ||
|
||||
[
|
||||
'contact_custom_attribute',
|
||||
'conversation_custom_attribute',
|
||||
].includes(attribute.key);
|
||||
|
||||
return {
|
||||
...attribute,
|
||||
name: skipTranslation
|
||||
? attribute.name
|
||||
: this.$t(`AUTOMATION.ATTRIBUTES.${attribute.name}`),
|
||||
};
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -187,7 +216,7 @@ export default {
|
||||
:key="i"
|
||||
v-model="automation.conditions[i]"
|
||||
:filter-attributes="
|
||||
getAttributes(automationTypes, automation.event_name)
|
||||
getTranslatedAttributes(automationTypes, automation.event_name)
|
||||
"
|
||||
:input-type="
|
||||
getInputType(
|
||||
|
||||
@@ -10,43 +10,37 @@ export const AUTOMATIONS = {
|
||||
conditions: [
|
||||
{
|
||||
key: 'message_type',
|
||||
name: 'Message Type',
|
||||
attributeI18nKey: 'MESSAGE_TYPE',
|
||||
name: 'MESSAGE_TYPE',
|
||||
inputType: 'search_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'content',
|
||||
name: 'Message Content',
|
||||
attributeI18nKey: 'MESSAGE_CONTAINS',
|
||||
name: 'MESSAGE_CONTAINS',
|
||||
inputType: 'comma_separated_plain_text',
|
||||
filterOperators: OPERATOR_TYPES_2,
|
||||
},
|
||||
{
|
||||
key: 'email',
|
||||
name: 'Email',
|
||||
attributeI18nKey: 'EMAIL',
|
||||
name: 'EMAIL',
|
||||
inputType: 'plain_text',
|
||||
filterOperators: OPERATOR_TYPES_2,
|
||||
},
|
||||
{
|
||||
key: 'inbox_id',
|
||||
name: 'Inbox',
|
||||
attributeI18nKey: 'INBOX',
|
||||
name: 'INBOX',
|
||||
inputType: 'multi_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'conversation_language',
|
||||
name: 'Conversation Language',
|
||||
attributeI18nKey: 'CONVERSATION_LANGUAGE',
|
||||
name: 'CONVERSATION_LANGUAGE',
|
||||
inputType: 'multi_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'phone_number',
|
||||
name: 'Phone Number',
|
||||
attributeI18nKey: 'PHONE_NUMBER',
|
||||
name: 'PHONE_NUMBER',
|
||||
inputType: 'plain_text',
|
||||
filterOperators: OPERATOR_TYPES_6,
|
||||
},
|
||||
@@ -54,64 +48,52 @@ export const AUTOMATIONS = {
|
||||
actions: [
|
||||
{
|
||||
key: 'assign_agent',
|
||||
name: 'Assign to agent',
|
||||
attributeI18nKey: 'ASSIGN_AGENT',
|
||||
name: 'ASSIGN_AGENT',
|
||||
},
|
||||
{
|
||||
key: 'assign_team',
|
||||
name: 'Assign a team',
|
||||
attributeI18nKey: 'ASSIGN_TEAM',
|
||||
name: 'ASSIGN_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'add_label',
|
||||
name: 'Add a label',
|
||||
attributeI18nKey: 'ADD_LABEL',
|
||||
name: 'ADD_LABEL',
|
||||
},
|
||||
{
|
||||
key: 'remove_label',
|
||||
name: 'Remove a label',
|
||||
attributeI18nKey: 'REMOVE_LABEL',
|
||||
name: 'REMOVE_LABEL',
|
||||
},
|
||||
{
|
||||
key: 'send_email_to_team',
|
||||
name: 'Send an email to team',
|
||||
attributeI18nKey: 'SEND_EMAIL_TO_TEAM',
|
||||
name: 'SEND_EMAIL_TO_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'send_message',
|
||||
name: 'Send a message',
|
||||
attributeI18nKey: 'SEND_MESSAGE',
|
||||
name: 'SEND_MESSAGE',
|
||||
},
|
||||
{
|
||||
key: 'send_email_transcript',
|
||||
name: 'Send an email transcript',
|
||||
attributeI18nKey: 'SEND_EMAIL_TRANSCRIPT',
|
||||
name: 'SEND_EMAIL_TRANSCRIPT',
|
||||
},
|
||||
{
|
||||
key: 'mute_conversation',
|
||||
name: 'Mute conversation',
|
||||
attributeI18nKey: 'MUTE_CONVERSATION',
|
||||
name: 'MUTE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'snooze_conversation',
|
||||
name: 'Snooze conversation',
|
||||
attributeI18nKey: 'MUTE_CONVERSATION',
|
||||
name: 'SNOOZE_CONVERSATION',
|
||||
},
|
||||
|
||||
{
|
||||
key: 'resolve_conversation',
|
||||
name: 'Resolve conversation',
|
||||
attributeI18nKey: 'RESOLVE_CONVERSATION',
|
||||
name: 'RESOLVE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'send_webhook_event',
|
||||
name: 'Send Webhook Event',
|
||||
attributeI18nKey: 'SEND_WEBHOOK_EVENT',
|
||||
name: 'SEND_WEBHOOK_EVENT',
|
||||
},
|
||||
{
|
||||
key: 'send_attachment',
|
||||
name: 'Send Attachment',
|
||||
attributeI18nKey: 'SEND_ATTACHMENT',
|
||||
name: 'SEND_ATTACHMENT',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -119,71 +101,61 @@ export const AUTOMATIONS = {
|
||||
conditions: [
|
||||
{
|
||||
key: 'status',
|
||||
name: 'Status',
|
||||
attributeI18nKey: 'STATUS',
|
||||
name: 'STATUS',
|
||||
inputType: 'multi_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'browser_language',
|
||||
name: 'Browser Language',
|
||||
attributeI18nKey: 'BROWSER_LANGUAGE',
|
||||
name: 'BROWSER_LANGUAGE',
|
||||
inputType: 'search_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'mail_subject',
|
||||
name: 'Email Subject',
|
||||
attributeI18nKey: 'MAIL_SUBJECT',
|
||||
name: 'MAIL_SUBJECT',
|
||||
inputType: 'plain_text',
|
||||
filterOperators: OPERATOR_TYPES_2,
|
||||
},
|
||||
{
|
||||
key: 'country_code',
|
||||
name: 'Country',
|
||||
attributeI18nKey: 'COUNTRY_NAME',
|
||||
name: 'COUNTRY_NAME',
|
||||
inputType: 'search_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'phone_number',
|
||||
name: 'Phone Number',
|
||||
attributeI18nKey: 'PHONE_NUMBER',
|
||||
name: 'PHONE_NUMBER',
|
||||
inputType: 'plain_text',
|
||||
filterOperators: OPERATOR_TYPES_6,
|
||||
},
|
||||
{
|
||||
key: 'referer',
|
||||
name: 'Referrer Link',
|
||||
attributeI18nKey: 'REFERER_LINK',
|
||||
name: 'REFERER_LINK',
|
||||
inputType: 'plain_text',
|
||||
filterOperators: OPERATOR_TYPES_2,
|
||||
},
|
||||
{
|
||||
key: 'email',
|
||||
name: 'Email',
|
||||
attributeI18nKey: 'EMAIL',
|
||||
name: 'EMAIL',
|
||||
inputType: 'plain_text',
|
||||
filterOperators: OPERATOR_TYPES_2,
|
||||
},
|
||||
{
|
||||
key: 'inbox_id',
|
||||
name: 'Inbox',
|
||||
attributeI18nKey: 'INBOX',
|
||||
name: 'INBOX',
|
||||
inputType: 'multi_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'conversation_language',
|
||||
name: 'Conversation Language',
|
||||
attributeI18nKey: 'CONVERSATION_LANGUAGE',
|
||||
name: 'CONVERSATION_LANGUAGE',
|
||||
inputType: 'multi_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'priority',
|
||||
name: 'Priority',
|
||||
attributeI18nKey: 'PRIORITY',
|
||||
name: 'PRIORITY',
|
||||
inputType: 'multi_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
@@ -191,58 +163,47 @@ export const AUTOMATIONS = {
|
||||
actions: [
|
||||
{
|
||||
key: 'assign_agent',
|
||||
name: 'Assign to agent',
|
||||
attributeI18nKey: 'ASSIGN_AGENT',
|
||||
name: 'ASSIGN_AGENT',
|
||||
},
|
||||
{
|
||||
key: 'assign_team',
|
||||
name: 'Assign a team',
|
||||
attributeI18nKey: 'ASSIGN_TEAM',
|
||||
name: 'ASSIGN_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'assign_agent',
|
||||
name: 'Assign an agent',
|
||||
attributeI18nKey: 'ASSIGN_AGENT',
|
||||
name: 'ASSIGN_AGENT',
|
||||
},
|
||||
{
|
||||
key: 'send_email_to_team',
|
||||
name: 'Send an email to team',
|
||||
attributeI18nKey: 'SEND_EMAIL_TO_TEAM',
|
||||
name: 'SEND_EMAIL_TO_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'send_message',
|
||||
name: 'Send a message',
|
||||
attributeI18nKey: 'SEND_MESSAGE',
|
||||
name: 'SEND_MESSAGE',
|
||||
},
|
||||
{
|
||||
key: 'send_email_transcript',
|
||||
name: 'Send an email transcript',
|
||||
attributeI18nKey: 'SEND_EMAIL_TRANSCRIPT',
|
||||
name: 'SEND_EMAIL_TRANSCRIPT',
|
||||
},
|
||||
{
|
||||
key: 'mute_conversation',
|
||||
name: 'Mute conversation',
|
||||
attributeI18nKey: 'MUTE_CONVERSATION',
|
||||
name: 'MUTE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'snooze_conversation',
|
||||
name: 'Snooze conversation',
|
||||
attributeI18nKey: 'MUTE_CONVERSATION',
|
||||
name: 'SNOOZE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'resolve_conversation',
|
||||
name: 'Resolve conversation',
|
||||
attributeI18nKey: 'RESOLVE_CONVERSATION',
|
||||
name: 'RESOLVE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'send_webhook_event',
|
||||
name: 'Send Webhook Event',
|
||||
attributeI18nKey: 'SEND_WEBHOOK_EVENT',
|
||||
name: 'SEND_WEBHOOK_EVENT',
|
||||
},
|
||||
{
|
||||
key: 'send_attachment',
|
||||
name: 'Send Attachment',
|
||||
attributeI18nKey: 'SEND_ATTACHMENT',
|
||||
name: 'SEND_ATTACHMENT',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -250,85 +211,73 @@ export const AUTOMATIONS = {
|
||||
conditions: [
|
||||
{
|
||||
key: 'status',
|
||||
name: 'Status',
|
||||
attributeI18nKey: 'STATUS',
|
||||
name: 'STATUS',
|
||||
inputType: 'multi_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'browser_language',
|
||||
name: 'Browser Language',
|
||||
attributeI18nKey: 'BROWSER_LANGUAGE',
|
||||
name: 'BROWSER_LANGUAGE',
|
||||
inputType: 'search_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'mail_subject',
|
||||
name: 'Email Subject',
|
||||
attributeI18nKey: 'MAIL_SUBJECT',
|
||||
name: 'MAIL_SUBJECT',
|
||||
inputType: 'plain_text',
|
||||
filterOperators: OPERATOR_TYPES_2,
|
||||
},
|
||||
{
|
||||
key: 'country_code',
|
||||
name: 'Country',
|
||||
attributeI18nKey: 'COUNTRY_NAME',
|
||||
name: 'COUNTRY_NAME',
|
||||
inputType: 'search_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'referer',
|
||||
name: 'Referrer Link',
|
||||
attributeI18nKey: 'REFERER_LINK',
|
||||
name: 'REFERER_LINK',
|
||||
inputType: 'plain_text',
|
||||
filterOperators: OPERATOR_TYPES_2,
|
||||
},
|
||||
{
|
||||
key: 'phone_number',
|
||||
name: 'Phone Number',
|
||||
attributeI18nKey: 'PHONE_NUMBER',
|
||||
name: 'PHONE_NUMBER',
|
||||
inputType: 'plain_text',
|
||||
filterOperators: OPERATOR_TYPES_6,
|
||||
},
|
||||
{
|
||||
key: 'assignee_id',
|
||||
name: 'Assignee',
|
||||
attributeI18nKey: 'ASSIGNEE_NAME',
|
||||
name: 'ASSIGNEE_NAME',
|
||||
inputType: 'search_select',
|
||||
filterOperators: OPERATOR_TYPES_3,
|
||||
},
|
||||
{
|
||||
key: 'team_id',
|
||||
name: 'Team',
|
||||
attributeI18nKey: 'TEAM_NAME',
|
||||
name: 'TEAM_NAME',
|
||||
inputType: 'search_select',
|
||||
filterOperators: OPERATOR_TYPES_3,
|
||||
},
|
||||
{
|
||||
key: 'email',
|
||||
name: 'Email',
|
||||
attributeI18nKey: 'EMAIL',
|
||||
name: 'EMAIL',
|
||||
inputType: 'plain_text',
|
||||
filterOperators: OPERATOR_TYPES_2,
|
||||
},
|
||||
{
|
||||
key: 'inbox_id',
|
||||
name: 'Inbox',
|
||||
attributeI18nKey: 'INBOX',
|
||||
name: 'INBOX',
|
||||
inputType: 'multi_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'conversation_language',
|
||||
name: 'Conversation Language',
|
||||
attributeI18nKey: 'CONVERSATION_LANGUAGE',
|
||||
name: 'CONVERSATION_LANGUAGE',
|
||||
inputType: 'multi_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'priority',
|
||||
name: 'Priority',
|
||||
attributeI18nKey: 'PRIORITY',
|
||||
name: 'PRIORITY',
|
||||
inputType: 'multi_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
@@ -336,58 +285,47 @@ export const AUTOMATIONS = {
|
||||
actions: [
|
||||
{
|
||||
key: 'assign_agent',
|
||||
name: 'Assign to agent',
|
||||
attributeI18nKey: 'ASSIGN_AGENT',
|
||||
name: 'ASSIGN_AGENT',
|
||||
},
|
||||
{
|
||||
key: 'assign_team',
|
||||
name: 'Assign a team',
|
||||
attributeI18nKey: 'ASSIGN_TEAM',
|
||||
name: 'ASSIGN_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'assign_agent',
|
||||
name: 'Assign an agent',
|
||||
attributeI18nKey: 'ASSIGN_AGENT',
|
||||
name: 'ASSIGN_AGENT',
|
||||
},
|
||||
{
|
||||
key: 'send_email_to_team',
|
||||
name: 'Send an email to team',
|
||||
attributeI18nKey: 'SEND_EMAIL_TO_TEAM',
|
||||
name: 'SEND_EMAIL_TO_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'send_message',
|
||||
name: 'Send a message',
|
||||
attributeI18nKey: 'SEND_MESSAGE',
|
||||
name: 'SEND_MESSAGE',
|
||||
},
|
||||
{
|
||||
key: 'send_email_transcript',
|
||||
name: 'Send an email transcript',
|
||||
attributeI18nKey: 'SEND_EMAIL_TRANSCRIPT',
|
||||
name: 'SEND_EMAIL_TRANSCRIPT',
|
||||
},
|
||||
{
|
||||
key: 'mute_conversation',
|
||||
name: 'Mute conversation',
|
||||
attributeI18nKey: 'MUTE_CONVERSATION',
|
||||
name: 'MUTE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'snooze_conversation',
|
||||
name: 'Snooze conversation',
|
||||
attributeI18nKey: 'MUTE_CONVERSATION',
|
||||
name: 'SNOOZE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'resolve_conversation',
|
||||
name: 'Resolve conversation',
|
||||
attributeI18nKey: 'RESOLVE_CONVERSATION',
|
||||
name: 'RESOLVE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'send_webhook_event',
|
||||
name: 'Send Webhook Event',
|
||||
attributeI18nKey: 'SEND_WEBHOOK_EVENT',
|
||||
name: 'SEND_WEBHOOK_EVENT',
|
||||
},
|
||||
{
|
||||
key: 'send_attachment',
|
||||
name: 'Send Attachment',
|
||||
attributeI18nKey: 'SEND_ATTACHMENT',
|
||||
name: 'SEND_ATTACHMENT',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -395,78 +333,67 @@ export const AUTOMATIONS = {
|
||||
conditions: [
|
||||
{
|
||||
key: 'browser_language',
|
||||
name: 'Browser Language',
|
||||
attributeI18nKey: 'BROWSER_LANGUAGE',
|
||||
name: 'BROWSER_LANGUAGE',
|
||||
inputType: 'search_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'email',
|
||||
name: 'Email',
|
||||
attributeI18nKey: 'EMAIL',
|
||||
name: 'EMAIL',
|
||||
inputType: 'plain_text',
|
||||
filterOperators: OPERATOR_TYPES_2,
|
||||
},
|
||||
{
|
||||
key: 'mail_subject',
|
||||
name: 'Email Subject',
|
||||
attributeI18nKey: 'MAIL_SUBJECT',
|
||||
name: 'MAIL_SUBJECT',
|
||||
inputType: 'plain_text',
|
||||
filterOperators: OPERATOR_TYPES_2,
|
||||
},
|
||||
{
|
||||
key: 'country_code',
|
||||
name: 'Country',
|
||||
attributeI18nKey: 'COUNTRY_NAME',
|
||||
name: 'COUNTRY_NAME',
|
||||
inputType: 'search_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'referer',
|
||||
name: 'Referrer Link',
|
||||
attributeI18nKey: 'REFERER_LINK',
|
||||
name: 'REFERER_LINK',
|
||||
inputType: 'plain_text',
|
||||
filterOperators: OPERATOR_TYPES_2,
|
||||
},
|
||||
{
|
||||
key: 'assignee_id',
|
||||
name: 'Assignee',
|
||||
attributeI18nKey: 'ASSIGNEE_NAME',
|
||||
name: 'ASSIGNEE_NAME',
|
||||
inputType: 'search_select',
|
||||
filterOperators: OPERATOR_TYPES_3,
|
||||
},
|
||||
{
|
||||
key: 'phone_number',
|
||||
name: 'Phone Number',
|
||||
attributeI18nKey: 'PHONE_NUMBER',
|
||||
name: 'PHONE_NUMBER',
|
||||
inputType: 'plain_text',
|
||||
filterOperators: OPERATOR_TYPES_6,
|
||||
},
|
||||
{
|
||||
key: 'team_id',
|
||||
name: 'Team',
|
||||
attributeI18nKey: 'TEAM_NAME',
|
||||
name: 'TEAM_NAME',
|
||||
inputType: 'search_select',
|
||||
filterOperators: OPERATOR_TYPES_3,
|
||||
},
|
||||
{
|
||||
key: 'inbox_id',
|
||||
name: 'Inbox',
|
||||
attributeI18nKey: 'INBOX',
|
||||
name: 'INBOX',
|
||||
inputType: 'multi_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'conversation_language',
|
||||
name: 'Conversation Language',
|
||||
attributeI18nKey: 'CONVERSATION_LANGUAGE',
|
||||
name: 'CONVERSATION_LANGUAGE',
|
||||
inputType: 'multi_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
{
|
||||
key: 'priority',
|
||||
name: 'Priority',
|
||||
attributeI18nKey: 'PRIORITY',
|
||||
name: 'PRIORITY',
|
||||
inputType: 'multi_select',
|
||||
filterOperators: OPERATOR_TYPES_1,
|
||||
},
|
||||
@@ -474,53 +401,43 @@ export const AUTOMATIONS = {
|
||||
actions: [
|
||||
{
|
||||
key: 'assign_agent',
|
||||
name: 'Assign to agent',
|
||||
attributeI18nKey: 'ASSIGN_AGENT',
|
||||
name: 'ASSIGN_AGENT',
|
||||
},
|
||||
{
|
||||
key: 'assign_team',
|
||||
name: 'Assign a team',
|
||||
attributeI18nKey: 'ASSIGN_TEAM',
|
||||
name: 'ASSIGN_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'assign_agent',
|
||||
name: 'Assign an agent',
|
||||
attributeI18nKey: 'ASSIGN_AGENT',
|
||||
name: 'ASSIGN_AGENT',
|
||||
},
|
||||
{
|
||||
key: 'send_email_to_team',
|
||||
name: 'Send an email to team',
|
||||
attributeI18nKey: 'SEND_EMAIL_TO_TEAM',
|
||||
name: 'SEND_EMAIL_TO_TEAM',
|
||||
},
|
||||
{
|
||||
key: 'send_message',
|
||||
name: 'Send a message',
|
||||
attributeI18nKey: 'SEND_MESSAGE',
|
||||
name: 'SEND_MESSAGE',
|
||||
},
|
||||
{
|
||||
key: 'send_email_transcript',
|
||||
name: 'Send an email transcript',
|
||||
attributeI18nKey: 'SEND_EMAIL_TRANSCRIPT',
|
||||
name: 'SEND_EMAIL_TRANSCRIPT',
|
||||
},
|
||||
{
|
||||
key: 'mute_conversation',
|
||||
name: 'Mute conversation',
|
||||
attributeI18nKey: 'MUTE_CONVERSATION',
|
||||
name: 'MUTE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'snooze_conversation',
|
||||
name: 'Snooze conversation',
|
||||
attributeI18nKey: 'MUTE_CONVERSATION',
|
||||
name: 'SNOOZE_CONVERSATION',
|
||||
},
|
||||
{
|
||||
key: 'send_webhook_event',
|
||||
name: 'Send Webhook Event',
|
||||
attributeI18nKey: 'SEND_WEBHOOK_EVENT',
|
||||
name: 'SEND_WEBHOOK_EVENT',
|
||||
},
|
||||
{
|
||||
key: 'send_attachment',
|
||||
name: 'Send Attachment',
|
||||
attributeI18nKey: 'SEND_ATTACHMENT',
|
||||
name: 'SEND_ATTACHMENT',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -529,91 +446,91 @@ export const AUTOMATIONS = {
|
||||
export const AUTOMATION_RULE_EVENTS = [
|
||||
{
|
||||
key: 'conversation_created',
|
||||
value: 'Conversation Created',
|
||||
value: 'CONVERSATION_CREATED',
|
||||
},
|
||||
{
|
||||
key: 'conversation_updated',
|
||||
value: 'Conversation Updated',
|
||||
value: 'CONVERSATION_UPDATED',
|
||||
},
|
||||
{
|
||||
key: 'message_created',
|
||||
value: 'Message Created',
|
||||
value: 'MESSAGE_CREATED',
|
||||
},
|
||||
{
|
||||
key: 'conversation_opened',
|
||||
value: 'Conversation Opened',
|
||||
value: 'CONVERSATION_OPENED',
|
||||
},
|
||||
];
|
||||
|
||||
export const AUTOMATION_ACTION_TYPES = [
|
||||
{
|
||||
key: 'assign_agent',
|
||||
label: 'Assign to agent',
|
||||
label: 'ASSIGN_AGENT',
|
||||
inputType: 'search_select',
|
||||
},
|
||||
{
|
||||
key: 'assign_team',
|
||||
label: 'Assign a team',
|
||||
label: 'ASSIGN_TEAM',
|
||||
inputType: 'search_select',
|
||||
},
|
||||
{
|
||||
key: 'add_label',
|
||||
label: 'Add a label',
|
||||
label: 'ADD_LABEL',
|
||||
inputType: 'multi_select',
|
||||
},
|
||||
{
|
||||
key: 'remove_label',
|
||||
label: 'Remove a label',
|
||||
label: 'REMOVE_LABEL',
|
||||
inputType: 'multi_select',
|
||||
},
|
||||
{
|
||||
key: 'send_email_to_team',
|
||||
label: 'Send an email to team',
|
||||
label: 'SEND_EMAIL_TO_TEAM',
|
||||
inputType: 'team_message',
|
||||
},
|
||||
{
|
||||
key: 'send_email_transcript',
|
||||
label: 'Send an email transcript',
|
||||
label: 'SEND_EMAIL_TRANSCRIPT',
|
||||
inputType: 'email',
|
||||
},
|
||||
{
|
||||
key: 'mute_conversation',
|
||||
label: 'Mute conversation',
|
||||
label: 'MUTE_CONVERSATION',
|
||||
inputType: null,
|
||||
},
|
||||
{
|
||||
key: 'snooze_conversation',
|
||||
label: 'Snooze conversation',
|
||||
label: 'SNOOZE_CONVERSATION',
|
||||
inputType: null,
|
||||
},
|
||||
{
|
||||
key: 'resolve_conversation',
|
||||
label: 'Resolve conversation',
|
||||
label: 'RESOLVE_CONVERSATION',
|
||||
inputType: null,
|
||||
},
|
||||
{
|
||||
key: 'send_webhook_event',
|
||||
label: 'Send Webhook Event',
|
||||
label: 'SEND_WEBHOOK_EVENT',
|
||||
inputType: 'url',
|
||||
},
|
||||
{
|
||||
key: 'send_attachment',
|
||||
label: 'Send Attachment',
|
||||
label: 'SEND_ATTACHMENT',
|
||||
inputType: 'attachment',
|
||||
},
|
||||
{
|
||||
key: 'send_message',
|
||||
label: 'Send a message',
|
||||
label: 'SEND_MESSAGE',
|
||||
inputType: 'textarea',
|
||||
},
|
||||
{
|
||||
key: 'change_priority',
|
||||
label: 'Change Priority',
|
||||
label: 'CHANGE_PRIORITY',
|
||||
inputType: 'search_select',
|
||||
},
|
||||
{
|
||||
key: 'add_sla',
|
||||
label: 'Add SLA',
|
||||
label: 'ADD_SLA',
|
||||
inputType: 'search_select',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -21,7 +21,13 @@ const { getMacroDropdownValues } = useMacros();
|
||||
|
||||
const macro = ref(null);
|
||||
const mode = ref('CREATE');
|
||||
const macroActionTypes = MACRO_ACTION_TYPES;
|
||||
|
||||
const macroActionTypes = computed(() => {
|
||||
return MACRO_ACTION_TYPES.map(type => ({
|
||||
...type,
|
||||
label: t(`MACROS.ACTIONS.${type.label}`),
|
||||
}));
|
||||
});
|
||||
|
||||
provide('macroActionTypes', macroActionTypes);
|
||||
|
||||
@@ -38,7 +44,7 @@ const formatMacro = macroData => {
|
||||
const formattedActions = macroData.actions.map(action => {
|
||||
let actionParams = [];
|
||||
if (action.action_params.length) {
|
||||
const inputType = macroActionTypes.find(
|
||||
const inputType = macroActionTypes.value.find(
|
||||
item => item.key === action.action_name
|
||||
).inputType;
|
||||
if (inputType === 'multi_select' || inputType === 'search_select') {
|
||||
|
||||
@@ -42,7 +42,7 @@ const showActionInput = computed(() => {
|
||||
actionData.value.action_name === 'send_message'
|
||||
)
|
||||
return false;
|
||||
const type = macroActionTypes.find(
|
||||
const type = macroActionTypes.value.find(
|
||||
action => action.key === actionData.value.action_name
|
||||
).inputType;
|
||||
return !!type;
|
||||
|
||||
@@ -1,67 +1,67 @@
|
||||
export const MACRO_ACTION_TYPES = [
|
||||
{
|
||||
key: 'assign_team',
|
||||
label: 'Assign a team',
|
||||
label: 'ASSIGN_TEAM',
|
||||
inputType: 'search_select',
|
||||
},
|
||||
{
|
||||
key: 'assign_agent',
|
||||
label: 'Assign an agent',
|
||||
label: 'ASSIGN_AGENT',
|
||||
inputType: 'search_select',
|
||||
},
|
||||
{
|
||||
key: 'add_label',
|
||||
label: 'Add a label',
|
||||
label: 'ADD_LABEL',
|
||||
inputType: 'multi_select',
|
||||
},
|
||||
{
|
||||
key: 'remove_label',
|
||||
label: 'Remove a label',
|
||||
label: 'REMOVE_LABEL',
|
||||
inputType: 'multi_select',
|
||||
},
|
||||
{
|
||||
key: 'remove_assigned_team',
|
||||
label: 'Remove Assigned Team',
|
||||
label: 'REMOVE_ASSIGNED_TEAM',
|
||||
inputType: null,
|
||||
},
|
||||
{
|
||||
key: 'send_email_transcript',
|
||||
label: 'Send an email transcript',
|
||||
label: 'SEND_EMAIL_TRANSCRIPT',
|
||||
inputType: 'email',
|
||||
},
|
||||
{
|
||||
key: 'mute_conversation',
|
||||
label: 'Mute conversation',
|
||||
label: 'MUTE_CONVERSATION',
|
||||
inputType: null,
|
||||
},
|
||||
{
|
||||
key: 'snooze_conversation',
|
||||
label: 'Snooze conversation',
|
||||
label: 'SNOOZE_CONVERSATION',
|
||||
inputType: null,
|
||||
},
|
||||
{
|
||||
key: 'resolve_conversation',
|
||||
label: 'Resolve conversation',
|
||||
label: 'RESOLVE_CONVERSATION',
|
||||
inputType: null,
|
||||
},
|
||||
{
|
||||
key: 'send_attachment',
|
||||
label: 'Send Attachment',
|
||||
label: 'SEND_ATTACHMENT',
|
||||
inputType: 'attachment',
|
||||
},
|
||||
{
|
||||
key: 'send_message',
|
||||
label: 'Send a message',
|
||||
label: 'SEND_MESSAGE',
|
||||
inputType: 'textarea',
|
||||
},
|
||||
{
|
||||
key: 'add_private_note',
|
||||
label: 'Add a private note',
|
||||
label: 'ADD_PRIVATE_NOTE',
|
||||
inputType: 'textarea',
|
||||
},
|
||||
{
|
||||
key: 'change_priority',
|
||||
label: 'Change Priority',
|
||||
label: 'CHANGE_PRIORITY',
|
||||
inputType: 'search_select',
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user