chore: Add feature flags in the settings console (#5657)
This commit is contained in:
@@ -16,6 +16,8 @@ import {
|
||||
ICON_CONVERSATION_REPORTS,
|
||||
} from './CommandBarIcons';
|
||||
import { frontendURL } from '../../../helper/URLHelper';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { FEATURE_FLAGS } from '../../../featureFlags';
|
||||
|
||||
const GO_TO_COMMANDS = [
|
||||
{
|
||||
@@ -86,6 +88,7 @@ const GO_TO_COMMANDS = [
|
||||
id: 'open_agent_settings',
|
||||
section: 'COMMAND_BAR.SECTIONS.SETTINGS',
|
||||
title: 'COMMAND_BAR.COMMANDS.GO_TO_SETTINGS_AGENTS',
|
||||
featureFlag: FEATURE_FLAGS.AGENT_MANAGEMENT,
|
||||
icon: ICON_AGENT_REPORTS,
|
||||
path: accountId => `accounts/${accountId}/settings/agents/list`,
|
||||
role: ['administrator'],
|
||||
@@ -93,6 +96,7 @@ const GO_TO_COMMANDS = [
|
||||
{
|
||||
id: 'open_team_settings',
|
||||
title: 'COMMAND_BAR.COMMANDS.GO_TO_SETTINGS_TEAMS',
|
||||
featureFlag: FEATURE_FLAGS.TEAM_MANAGEMENT,
|
||||
section: 'COMMAND_BAR.SECTIONS.SETTINGS',
|
||||
icon: ICON_TEAM_REPORTS,
|
||||
path: accountId => `accounts/${accountId}/settings/teams/list`,
|
||||
@@ -101,6 +105,7 @@ const GO_TO_COMMANDS = [
|
||||
{
|
||||
id: 'open_inbox_settings',
|
||||
title: 'COMMAND_BAR.COMMANDS.GO_TO_SETTINGS_INBOXES',
|
||||
featureFlag: FEATURE_FLAGS.INBOX_MANAGEMENT,
|
||||
section: 'COMMAND_BAR.SECTIONS.SETTINGS',
|
||||
icon: ICON_INBOXES,
|
||||
path: accountId => `accounts/${accountId}/settings/inboxes/list`,
|
||||
@@ -109,6 +114,7 @@ const GO_TO_COMMANDS = [
|
||||
{
|
||||
id: 'open_label_settings',
|
||||
title: 'COMMAND_BAR.COMMANDS.GO_TO_SETTINGS_LABELS',
|
||||
featureFlag: FEATURE_FLAGS.LABELS,
|
||||
section: 'COMMAND_BAR.SECTIONS.SETTINGS',
|
||||
icon: ICON_LABELS,
|
||||
path: accountId => `accounts/${accountId}/settings/labels/list`,
|
||||
@@ -117,6 +123,7 @@ const GO_TO_COMMANDS = [
|
||||
{
|
||||
id: 'open_canned_response_settings',
|
||||
title: 'COMMAND_BAR.COMMANDS.GO_TO_SETTINGS_CANNED_RESPONSES',
|
||||
featureFlag: FEATURE_FLAGS.CANNED_RESPONSES,
|
||||
section: 'COMMAND_BAR.SECTIONS.SETTINGS',
|
||||
icon: ICON_CANNED_RESPONSE,
|
||||
path: accountId => `accounts/${accountId}/settings/canned-response/list`,
|
||||
@@ -125,6 +132,7 @@ const GO_TO_COMMANDS = [
|
||||
{
|
||||
id: 'open_applications_settings',
|
||||
title: 'COMMAND_BAR.COMMANDS.GO_TO_SETTINGS_APPLICATIONS',
|
||||
featureFlag: FEATURE_FLAGS.INTEGRATIONS,
|
||||
section: 'COMMAND_BAR.SECTIONS.SETTINGS',
|
||||
icon: ICON_APPS,
|
||||
path: accountId => `accounts/${accountId}/settings/applications`,
|
||||
@@ -158,8 +166,20 @@ const GO_TO_COMMANDS = [
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
...mapGetters({
|
||||
accountId: 'getCurrentAccountId',
|
||||
isFeatureEnabledonAccount: 'accounts/isFeatureEnabledonAccount',
|
||||
}),
|
||||
goToCommandHotKeys() {
|
||||
let commands = GO_TO_COMMANDS;
|
||||
let commands = GO_TO_COMMANDS.filter(cmd => {
|
||||
if (cmd.featureFlag) {
|
||||
return this.isFeatureEnabledonAccount(
|
||||
this.accountId,
|
||||
cmd.featureFlag
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
if (!this.isAdmin) {
|
||||
commands = commands.filter(command => command.role.includes('agent'));
|
||||
|
||||
@@ -10,7 +10,7 @@ export default {
|
||||
component: SettingsContent,
|
||||
props: {
|
||||
headerTitle: 'GENERAL_SETTINGS.TITLE',
|
||||
icon: 'settings',
|
||||
icon: 'briefcase',
|
||||
showNewButton: false,
|
||||
},
|
||||
children: [
|
||||
|
||||
@@ -25,7 +25,7 @@ export default {
|
||||
roles: ['administrator', 'agent'],
|
||||
redirect: () => {
|
||||
if (store.getters.getCurrentRole === 'administrator') {
|
||||
return frontendURL('accounts/:accountId/settings/agents');
|
||||
return frontendURL('accounts/:accountId/settings/general');
|
||||
}
|
||||
return frontendURL('accounts/:accountId/settings/canned-response');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user