chore: Add internal feature flags for Chatwoot Cloud (#10902)

This PR introduces internal feature flags for testing purposes. These
flags will not be displayed on regular instances to prevent customer
confusion.

Additionally, a new feature flag, `contact_chatwoot_support_team`, has
been added for Chatwoot Cloud. This flag disables contact support for
third-party onboarded accounts, as support will be handled by the
original affiliate team.

Co-authored-by: Pranav <pranav@chatwoot.com>
This commit is contained in:
Sojan Jose
2025-02-15 16:21:46 -08:00
committed by GitHub
parent ccf890d855
commit 3b141fca28
7 changed files with 53 additions and 14 deletions

View File

@@ -5,6 +5,7 @@ import { useMapGetter } from 'dashboard/composables/store';
import { useI18n } from 'vue-i18n';
import Avatar from 'next/avatar/Avatar.vue';
import SidebarProfileMenuStatus from './SidebarProfileMenuStatus.vue';
import { FEATURE_FLAGS } from 'dashboard/featureFlags';
import {
DropdownContainer,
@@ -21,14 +22,27 @@ defineOptions({
const { t } = useI18n();
const globalConfig = useMapGetter('globalConfig/get');
const currentUser = useMapGetter('getCurrentUser');
const currentUserAvailability = useMapGetter('getCurrentUserAvailability');
const accountId = useMapGetter('getCurrentAccountId');
const globalConfig = useMapGetter('globalConfig/get');
const isFeatureEnabledonAccount = useMapGetter(
'accounts/isFeatureEnabledonAccount'
);
const showChatSupport = computed(() => {
return (
isFeatureEnabledonAccount.value(
accountId.value,
FEATURE_FLAGS.CONTACT_CHATWOOT_SUPPORT_TEAM
) && globalConfig.value.chatwootInboxToken
);
});
const menuItems = computed(() => {
return [
{
show: !!globalConfig.value.chatwootInboxToken,
show: showChatSupport.value,
label: t('SIDEBAR_ITEMS.CONTACT_SUPPORT'),
icon: 'i-lucide-life-buoy',
click: () => {

View File

@@ -4,6 +4,7 @@ import Auth from '../../../api/auth';
import WootDropdownItem from 'shared/components/ui/dropdown/DropdownItem.vue';
import WootDropdownMenu from 'shared/components/ui/dropdown/DropdownMenu.vue';
import AvailabilityStatus from 'dashboard/components/layout/AvailabilityStatus.vue';
import { FEATURE_FLAGS } from '../../../featureFlags';
export default {
components: {
@@ -28,6 +29,7 @@ export default {
currentUser: 'getCurrentUser',
globalConfig: 'globalConfig/get',
accountId: 'getCurrentAccountId',
isFeatureEnabledonAccount: 'accounts/isFeatureEnabledonAccount',
}),
showChangeAccountOption() {
if (this.globalConfig.createNewAccountFromDashboard) {
@@ -37,6 +39,14 @@ export default {
const { accounts = [] } = this.currentUser;
return accounts.length > 1;
},
showChatSupport() {
return (
this.isFeatureEnabledonAccount(
this.accountId,
FEATURE_FLAGS.CONTACT_CHATWOOT_SUPPORT_TEAM
) && this.globalConfig.chatwootInboxToken
);
},
},
methods: {
handleProfileSettingClick(e, navigate) {
@@ -82,7 +92,7 @@ export default {
{{ $t('SIDEBAR_ITEMS.CHANGE_ACCOUNTS') }}
</woot-button>
</WootDropdownItem>
<WootDropdownItem v-if="globalConfig.chatwootInboxToken">
<WootDropdownItem v-if="showChatSupport">
<woot-button
variant="clear"
color-scheme="secondary"

View File

@@ -34,4 +34,5 @@ export const FEATURE_FLAGS = {
CUSTOM_ROLES: 'custom_roles',
CHATWOOT_V4: 'chatwoot_v4',
REPORT_V4: 'report_v4',
CONTACT_CHATWOOT_SUPPORT_TEAM: 'contact_chatwoot_support_team',
};