chore: Cleanup feature flags (#6096)

- Add more feature flags for CRM, auto_resolution, and reports
- Add a SuperAdmin link in the sidebar if the user is a super-admin
- SuperAdmin could view all the features on an account irrespective of whether the feature is enabled.
This commit is contained in:
Pranav Raj S
2022-12-19 09:08:30 -08:00
committed by GitHub
parent ca88eb55f4
commit 2dfe38ae4d
14 changed files with 99 additions and 15 deletions

View File

@@ -32,6 +32,7 @@ const GO_TO_COMMANDS = [
id: 'goto_contacts_dashboard',
title: 'COMMAND_BAR.COMMANDS.GO_TO_CONTACTS_DASHBOARD',
section: 'COMMAND_BAR.SECTIONS.GENERAL',
featureFlag: FEATURE_FLAGS.CRM,
icon: ICON_CONTACT_DASHBOARD,
path: accountId => `accounts/${accountId}/contacts`,
role: ['administrator', 'agent'],
@@ -40,6 +41,7 @@ const GO_TO_COMMANDS = [
id: 'open_reports_overview',
section: 'COMMAND_BAR.SECTIONS.REPORTS',
title: 'COMMAND_BAR.COMMANDS.GO_TO_REPORTS_OVERVIEW',
featureFlag: FEATURE_FLAGS.REPORTS,
icon: ICON_REPORTS_OVERVIEW,
path: accountId => `accounts/${accountId}/reports/overview`,
role: ['administrator'],
@@ -48,6 +50,7 @@ const GO_TO_COMMANDS = [
id: 'open_conversation_reports',
section: 'COMMAND_BAR.SECTIONS.REPORTS',
title: 'COMMAND_BAR.COMMANDS.GO_TO_CONVERSATION_REPORTS',
featureFlag: FEATURE_FLAGS.REPORTS,
icon: ICON_CONVERSATION_REPORTS,
path: accountId => `accounts/${accountId}/reports/conversation`,
role: ['administrator'],
@@ -56,6 +59,7 @@ const GO_TO_COMMANDS = [
id: 'open_agent_reports',
section: 'COMMAND_BAR.SECTIONS.REPORTS',
title: 'COMMAND_BAR.COMMANDS.GO_TO_AGENT_REPORTS',
featureFlag: FEATURE_FLAGS.REPORTS,
icon: ICON_AGENT_REPORTS,
path: accountId => `accounts/${accountId}/reports/agent`,
role: ['administrator'],
@@ -64,6 +68,7 @@ const GO_TO_COMMANDS = [
id: 'open_label_reports',
section: 'COMMAND_BAR.SECTIONS.REPORTS',
title: 'COMMAND_BAR.COMMANDS.GO_TO_LABEL_REPORTS',
featureFlag: FEATURE_FLAGS.REPORTS,
icon: ICON_LABEL_REPORTS,
path: accountId => `accounts/${accountId}/reports/label`,
role: ['administrator'],
@@ -72,6 +77,7 @@ const GO_TO_COMMANDS = [
id: 'open_inbox_reports',
section: 'COMMAND_BAR.SECTIONS.REPORTS',
title: 'COMMAND_BAR.COMMANDS.GO_TO_INBOX_REPORTS',
featureFlag: FEATURE_FLAGS.REPORTS,
icon: ICON_INBOX_REPORTS,
path: accountId => `accounts/${accountId}/reports/inboxes`,
role: ['administrator'],
@@ -80,6 +86,7 @@ const GO_TO_COMMANDS = [
id: 'open_team_reports',
section: 'COMMAND_BAR.SECTIONS.REPORTS',
title: 'COMMAND_BAR.COMMANDS.GO_TO_TEAM_REPORTS',
featureFlag: FEATURE_FLAGS.REPORTS,
icon: ICON_TEAM_REPORTS,
path: accountId => `accounts/${accountId}/reports/teams`,
role: ['administrator'],

View File

@@ -62,7 +62,10 @@
"
/>
</label>
<label :class="{ error: $v.autoResolveDuration.$error }">
<label
v-if="showAutoResolutionConfig"
:class="{ error: $v.autoResolveDuration.$error }"
>
{{ $t('GENERAL_SETTINGS.FORM.AUTO_RESOLVE_DURATION.LABEL') }}
<input
v-model="autoResolveDuration"
@@ -120,6 +123,7 @@ import { mapGetters } from 'vuex';
import alertMixin from 'shared/mixins/alertMixin';
import configMixin from 'shared/mixins/configMixin';
import accountMixin from '../../../../mixins/account';
import { FEATURE_FLAGS } from '../../../../featureFlags';
const semver = require('semver');
export default {
@@ -153,7 +157,15 @@ export default {
globalConfig: 'globalConfig/get',
getAccount: 'accounts/getAccount',
uiFlags: 'accounts/getUIFlags',
accountId: 'getCurrentAccountId',
isFeatureEnabledonAccount: 'accounts/isFeatureEnabledonAccount',
}),
showAutoResolutionConfig() {
return this.isFeatureEnabledonAccount(
this.accountId,
FEATURE_FLAGS.AUTO_RESOLVE_CONVERSATIONS
);
},
hasAnUpdateAvailable() {
if (!semver.valid(this.latestChatwootVersion)) {
return false;