From 32d885a19b2ead2a704fc5342a569de438b71b39 Mon Sep 17 00:00:00 2001
From: Fayaz Ahmed <15716057+fayazara@users.noreply.github.com>
Date: Wed, 12 Oct 2022 11:50:20 +0530
Subject: [PATCH] feat: Add macros routes and views (#5604)
---
.../layout/config/sidebarItems/settings.js | 60 +++++++++++--------
.../dashboard/i18n/locale/en/index.js | 2 +
.../dashboard/i18n/locale/en/macros.json | 5 ++
.../dashboard/i18n/locale/en/settings.json | 8 ++-
.../dashboard/settings/macros/Index.vue | 11 ++++
.../dashboard/settings/macros/MacroEditor.vue | 9 +++
.../settings/macros/macros.routes.js | 38 ++++++++++++
.../dashboard/settings/settings.routes.js | 2 +
.../FluentIcon/dashboard-icons.json | 1 +
config/features.yml | 2 +
10 files changed, 112 insertions(+), 26 deletions(-)
create mode 100644 app/javascript/dashboard/i18n/locale/en/macros.json
create mode 100644 app/javascript/dashboard/routes/dashboard/settings/macros/Index.vue
create mode 100644 app/javascript/dashboard/routes/dashboard/settings/macros/MacroEditor.vue
create mode 100644 app/javascript/dashboard/routes/dashboard/settings/macros/macros.routes.js
diff --git a/app/javascript/dashboard/components/layout/config/sidebarItems/settings.js b/app/javascript/dashboard/components/layout/config/sidebarItems/settings.js
index 9ea287963..83a0c2309 100644
--- a/app/javascript/dashboard/components/layout/config/sidebarItems/settings.js
+++ b/app/javascript/dashboard/components/layout/config/sidebarItems/settings.js
@@ -5,34 +5,37 @@ const settings = accountId => ({
routes: [
'agent_bots',
'agent_list',
- 'canned_list',
- 'labels_list',
- 'settings_inbox',
'attributes_list',
- 'settings_inbox_new',
- 'settings_inbox_list',
- 'settings_inbox_show',
- 'settings_inboxes_page_channel',
- 'settings_inboxes_add_agents',
- 'settings_inbox_finish',
- 'settings_integrations',
- 'settings_integrations_webhook',
- 'settings_integrations_integration',
- 'settings_applications',
- 'settings_integrations_dashboard_apps',
- 'settings_applications_webhook',
- 'settings_applications_integration',
- 'general_settings',
+ 'automation_list',
+ 'billing_settings_index',
+ 'canned_list',
'general_settings_index',
+ 'general_settings',
+ 'labels_list',
+ 'macros_edit',
+ 'macros_new',
+ 'macros_wrapper',
+ 'settings_applications_integration',
+ 'settings_applications_webhook',
+ 'settings_applications',
+ 'settings_inbox_finish',
+ 'settings_inbox_list',
+ 'settings_inbox_new',
+ 'settings_inbox_show',
+ 'settings_inbox',
+ 'settings_inboxes_add_agents',
+ 'settings_inboxes_page_channel',
+ 'settings_integrations_dashboard_apps',
+ 'settings_integrations_integration',
+ 'settings_integrations_webhook',
+ 'settings_integrations',
+ 'settings_teams_add_agents',
+ 'settings_teams_edit_finish',
+ 'settings_teams_edit_members',
+ 'settings_teams_edit',
+ 'settings_teams_finish',
'settings_teams_list',
'settings_teams_new',
- 'settings_teams_add_agents',
- 'settings_teams_finish',
- 'settings_teams_edit',
- 'settings_teams_edit_members',
- 'settings_teams_edit_finish',
- 'billing_settings_index',
- 'automation_list',
],
menuItems: [
{
@@ -89,6 +92,15 @@ const settings = accountId => ({
toStateName: 'agent_bots',
featureFlagKey: 'agent_bots',
},
+ {
+ icon: 'flash-settings',
+ label: 'MACROS',
+ hasSubMenu: false,
+ toState: frontendURL(`accounts/${accountId}/settings/macros`),
+ toStateName: 'macros_wrapper',
+ beta: true,
+ featureFlagKey: 'macros',
+ },
{
icon: 'chat-multiple',
label: 'CANNED_RESPONSES',
diff --git a/app/javascript/dashboard/i18n/locale/en/index.js b/app/javascript/dashboard/i18n/locale/en/index.js
index 6e45310b0..93e560119 100644
--- a/app/javascript/dashboard/i18n/locale/en/index.js
+++ b/app/javascript/dashboard/i18n/locale/en/index.js
@@ -18,6 +18,7 @@ import integrationApps from './integrationApps.json';
import integrations from './integrations.json';
import labelsMgmt from './labelsMgmt.json';
import login from './login.json';
+import macros from './macros.json';
import report from './report.json';
import resetPassword from './resetPassword.json';
import setNewPassword from './setNewPassword.json';
@@ -47,6 +48,7 @@ export default {
...integrations,
...labelsMgmt,
...login,
+ ...macros,
...report,
...resetPassword,
...setNewPassword,
diff --git a/app/javascript/dashboard/i18n/locale/en/macros.json b/app/javascript/dashboard/i18n/locale/en/macros.json
new file mode 100644
index 000000000..3923e4374
--- /dev/null
+++ b/app/javascript/dashboard/i18n/locale/en/macros.json
@@ -0,0 +1,5 @@
+{
+ "MACROS": {
+ "HEADER": "Macros"
+ }
+}
diff --git a/app/javascript/dashboard/i18n/locale/en/settings.json b/app/javascript/dashboard/i18n/locale/en/settings.json
index a99bfc2e8..c5f954b1c 100644
--- a/app/javascript/dashboard/i18n/locale/en/settings.json
+++ b/app/javascript/dashboard/i18n/locale/en/settings.json
@@ -99,7 +99,11 @@
},
"AVAILABILITY": {
"LABEL": "Availability",
- "STATUSES_LIST": ["Online", "Busy", "Offline"]
+ "STATUSES_LIST": [
+ "Online",
+ "Busy",
+ "Offline"
+ ]
},
"EMAIL": {
"LABEL": "Your email address",
@@ -186,6 +190,7 @@
"LABELS": "Labels",
"CUSTOM_ATTRIBUTES": "Custom Attributes",
"AUTOMATION": "Automation",
+ "MACROS": "Macros",
"TEAMS": "Teams",
"BILLING": "Billing",
"CUSTOM_VIEWS_FOLDER": "Folders",
@@ -230,7 +235,6 @@
"DESCRIPTION": "View your previous invoices, edit your billing details, or cancel your subscription.",
"BUTTON_TXT": "Go to the billing portal"
},
-
"CHAT_WITH_US": {
"TITLE": "Need help?",
"DESCRIPTION": "Do you face any issues in billing? We are here to help.",
diff --git a/app/javascript/dashboard/routes/dashboard/settings/macros/Index.vue b/app/javascript/dashboard/routes/dashboard/settings/macros/Index.vue
new file mode 100644
index 000000000..39f017fef
--- /dev/null
+++ b/app/javascript/dashboard/routes/dashboard/settings/macros/Index.vue
@@ -0,0 +1,11 @@
+
+
+ Macros
+
+
+
+
+
+
diff --git a/app/javascript/dashboard/routes/dashboard/settings/macros/MacroEditor.vue b/app/javascript/dashboard/routes/dashboard/settings/macros/MacroEditor.vue
new file mode 100644
index 000000000..2de1f787c
--- /dev/null
+++ b/app/javascript/dashboard/routes/dashboard/settings/macros/MacroEditor.vue
@@ -0,0 +1,9 @@
+
+ MacrosEditor
+
+
+
+
+
diff --git a/app/javascript/dashboard/routes/dashboard/settings/macros/macros.routes.js b/app/javascript/dashboard/routes/dashboard/settings/macros/macros.routes.js
new file mode 100644
index 000000000..9752b79fb
--- /dev/null
+++ b/app/javascript/dashboard/routes/dashboard/settings/macros/macros.routes.js
@@ -0,0 +1,38 @@
+import SettingsContent from '../Wrapper';
+import Macros from './Index';
+const MacroEditor = () => import('./MacroEditor');
+import { frontendURL } from 'dashboard/helper/URLHelper';
+
+export default {
+ routes: [
+ {
+ path: frontendURL('accounts/:accountId/settings/macros'),
+ component: SettingsContent,
+ props: {
+ headerTitle: 'MACROS.HEADER',
+ icon: 'flash-settings',
+ showNewButton: false,
+ },
+ children: [
+ {
+ path: '',
+ name: 'macros_wrapper',
+ component: Macros,
+ roles: ['administrator', 'agent'],
+ },
+ {
+ path: 'new',
+ name: 'macros_new',
+ component: MacroEditor,
+ roles: ['administrator', 'agent'],
+ },
+ {
+ path: ':macroId/edit',
+ name: 'macros_edit',
+ component: MacroEditor,
+ roles: ['administrator', 'agent'],
+ },
+ ],
+ },
+ ],
+};
diff --git a/app/javascript/dashboard/routes/dashboard/settings/settings.routes.js b/app/javascript/dashboard/routes/dashboard/settings/settings.routes.js
index b4ac93570..7c8cc11fa 100644
--- a/app/javascript/dashboard/routes/dashboard/settings/settings.routes.js
+++ b/app/javascript/dashboard/routes/dashboard/settings/settings.routes.js
@@ -11,6 +11,7 @@ import inbox from './inbox/inbox.routes';
import integrationapps from './integrationapps/integrations.routes';
import integrations from './integrations/integrations.routes';
import labels from './labels/labels.routes';
+import macros from './macros/macros.routes';
import profile from './profile/profile.routes';
import reports from './reports/reports.routes';
import store from '../../../store';
@@ -41,6 +42,7 @@ export default {
...integrationapps.routes,
...integrations.routes,
...labels.routes,
+ ...macros.routes,
...profile.routes,
...reports.routes,
...teams.routes,
diff --git a/app/javascript/shared/components/FluentIcon/dashboard-icons.json b/app/javascript/shared/components/FluentIcon/dashboard-icons.json
index 0bce7c813..9a5eaa893 100644
--- a/app/javascript/shared/components/FluentIcon/dashboard-icons.json
+++ b/app/javascript/shared/components/FluentIcon/dashboard-icons.json
@@ -80,6 +80,7 @@
"filter-outline": "M13.5 16a.75.75 0 0 1 0 1.5h-3a.75.75 0 0 1 0-1.5h3Zm3-5a.75.75 0 0 1 0 1.5h-9a.75.75 0 0 1 0-1.5h9Zm3-5a.75.75 0 0 1 0 1.5h-15a.75.75 0 0 1 0-1.5h15Z",
"file-upload-outline": "M6 2a2 2 0 0 0-2 2v5.207a5.48 5.48 0 0 1 1-.185V4a1 1 0 0 1 1-1h4v3.5A1.5 1.5 0 0 0 11.5 8H15v8a1 1 0 0 1-1 1h-3.6a5.507 5.507 0 0 1-.657 1H14a2 2 0 0 0 2-2V7.414a1.5 1.5 0 0 0-.44-1.06l-3.914-3.915A1.5 1.5 0 0 0 10.586 2H6Zm8.793 5H11.5a.5.5 0 0 1-.5-.5V3.207L14.793 7ZM5.5 19a4.5 4.5 0 1 0 0-9a4.5 4.5 0 0 0 0 9Zm2.354-4.854a.5.5 0 1 1-.708.708L6 13.707V16.5a.5.5 0 0 1-1 0v-2.793l-1.146 1.147a.5.5 0 1 1-.708-.707l2-2A.5.5 0 0 1 5.497 12h.006a.498.498 0 0 1 .348.144l.003.003l2 2Z",
"flash-on-outline": "m8.294 14-1.767 7.068c-.187.746.736 1.256 1.269.701L19.79 9.27A.75.75 0 0 0 19.25 8h-4.46l1.672-5.013A.75.75 0 0 0 15.75 2h-7a.75.75 0 0 0-.721.544l-3 10.5A.75.75 0 0 0 5.75 14h2.544Zm4.745-5.487a.75.75 0 0 0 .711.987h3.74l-8.824 9.196 1.316-5.264a.75.75 0 0 0-.727-.932h-2.51l2.57-9h5.394l-1.67 5.013Z",
+ "flash-settings-outline": "M6.19 2.77c.13-.455.547-.77 1.02-.77h5.25c.724 0 1.236.71 1.007 1.398l-.002.008L12.204 7h2.564c.946 0 1.407 1.144.766 1.811l-.003.004l-.237.242a5.545 5.545 0 0 0-1.374-.027l.894-.912a.056.056 0 0 0 .017-.032a.084.084 0 0 0-.007-.044a.079.079 0 0 0-.025-.034c-.005-.004-.013-.008-.031-.008h-3.27a.5.5 0 0 1-.471-.666L12.52 3.08a.062.062 0 0 0-.06-.08H7.211a.062.062 0 0 0-.06.045l-2.25 7.874c-.01.04.019.08.06.08H6.87a.5.5 0 0 1 .485.62l-1.325 5.3a.086.086 0 0 0-.003.03a.02.02 0 0 0 .003.011a.08.08 0 0 0 .072.04a.03.03 0 0 0 .01-.004a.087.087 0 0 0 .024-.018l.003-.004l2.882-2.94a5.573 5.573 0 0 0 .054 1.372l-2.22 2.267c-.754.782-2.059.06-1.795-.996l1.17-4.679H4.96a1.062 1.062 0 0 1-1.021-1.354l2.25-7.873Zm5.877 8.673a2 2 0 0 1-1.431 2.478l-.461.118a4.702 4.702 0 0 0 .01 1.016l.35.083a2 2 0 0 1 1.456 2.519l-.127.422c.257.204.537.378.835.518l.325-.344a2 2 0 0 1 2.91.002l.337.358c.292-.135.568-.302.822-.498l-.157-.556a2 2 0 0 1 1.431-2.479l.46-.117a4.702 4.702 0 0 0-.01-1.017l-.348-.082a2 2 0 0 1-1.456-2.52l.126-.421a4.32 4.32 0 0 0-.835-.519l-.325.344a2 2 0 0 1-2.91-.001l-.337-.358a4.316 4.316 0 0 0-.821.497l.156.557ZM14.5 15.5a1 1 0 1 1 0-2a1 1 0 0 1 0 2Z",
"folder-outline": "M8.207 4c.46 0 .908.141 1.284.402l.156.12L12.022 6.5h7.728a2.25 2.25 0 0 1 2.229 1.938l.016.158.005.154v9a2.25 2.25 0 0 1-2.096 2.245L19.75 20H4.25a2.25 2.25 0 0 1-2.245-2.096L2 17.75V6.25a2.25 2.25 0 0 1 2.096-2.245L4.25 4h3.957Zm1.44 5.979a2.25 2.25 0 0 1-1.244.512l-.196.009-4.707-.001v7.251c0 .38.282.694.648.743l.102.007h15.5a.75.75 0 0 0 .743-.648l.007-.102v-9a.75.75 0 0 0-.648-.743L19.75 8h-7.729L9.647 9.979ZM8.207 5.5H4.25a.75.75 0 0 0-.743.648L3.5 6.25v2.749L8.207 9a.75.75 0 0 0 .395-.113l.085-.06 1.891-1.578-1.89-1.575a.75.75 0 0 0-.377-.167L8.207 5.5Z",
"globe-outline": "M12 1.999c5.524 0 10.002 4.478 10.002 10.002 0 5.523-4.478 10.001-10.002 10.001-5.524 0-10.002-4.478-10.002-10.001C1.998 6.477 6.476 1.999 12 1.999ZM14.939 16.5H9.06c.652 2.414 1.786 4.002 2.939 4.002s2.287-1.588 2.939-4.002Zm-7.43 0H4.785a8.532 8.532 0 0 0 4.094 3.411c-.522-.82-.953-1.846-1.27-3.015l-.102-.395Zm11.705 0h-2.722c-.324 1.335-.792 2.5-1.373 3.411a8.528 8.528 0 0 0 3.91-3.127l.185-.283ZM7.094 10H3.735l-.005.017a8.525 8.525 0 0 0-.233 1.984c0 1.056.193 2.067.545 3h3.173a20.847 20.847 0 0 1-.123-5Zm8.303 0H8.603a18.966 18.966 0 0 0 .135 5h6.524a18.974 18.974 0 0 0 .135-5Zm4.868 0h-3.358c.062.647.095 1.317.095 2a20.3 20.3 0 0 1-.218 3h3.173a8.482 8.482 0 0 0 .544-3c0-.689-.082-1.36-.236-2ZM8.88 4.09l-.023.008A8.531 8.531 0 0 0 4.25 8.5h3.048c.314-1.752.86-3.278 1.583-4.41ZM12 3.499l-.116.005C10.62 3.62 9.396 5.622 8.83 8.5h6.342c-.566-2.87-1.783-4.869-3.045-4.995L12 3.5Zm3.12.59.107.175c.669 1.112 1.177 2.572 1.475 4.237h3.048a8.533 8.533 0 0 0-4.339-4.29l-.291-.121Z",
"globe-desktop-outline": "M22.002 12C22.002 6.477 17.524 2 12 2 6.476 1.999 2 6.477 2 12.001c0 5.186 3.947 9.45 9.001 9.952V20.11c-.778-.612-1.478-1.905-1.939-3.61h1.94V15H8.737a18.969 18.969 0 0 1-.135-5h6.794c.068.64.105 1.31.105 2h1.5c0-.684-.033-1.353-.095-2h3.358c.154.64.237 1.31.237 2h1.5ZM4.786 16.5h2.722l.102.396c.317 1.17.748 2.195 1.27 3.015a8.532 8.532 0 0 1-4.094-3.41ZM3.736 10h3.358a20.847 20.847 0 0 0-.095 2c0 1.043.075 2.051.217 3H4.043a8.483 8.483 0 0 1-.544-3c0-.682.08-1.347.232-1.983L3.736 10Zm5.122-5.902.023-.008C8.16 5.222 7.611 6.748 7.298 8.5H4.25c.905-2 2.56-3.587 4.608-4.402Zm3.026-.594L12 3.5l.126.006c1.262.126 2.48 2.125 3.045 4.995H8.83c.568-2.878 1.79-4.88 3.055-4.996Zm3.343.76-.107-.174.291.121a8.533 8.533 0 0 1 4.339 4.29h-3.048c-.298-1.665-.806-3.125-1.475-4.237Z M12 19a1 1 0 0 0 1 1h3v2h-.5a.5.5 0 1 0 0 1h4a.5.5 0 0 0 0-1H19v-2h3a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1h-9a1 1 0 0 0-1 1v5Z",
diff --git a/config/features.yml b/config/features.yml
index 01bfe00e5..ec779cd08 100644
--- a/config/features.yml
+++ b/config/features.yml
@@ -17,3 +17,5 @@
enabled: true
- name: agent_bots
enabled: false
+- name: macros
+ enabled: false