fix: remove enterprise mode gating

This commit is contained in:
2026-07-12 22:19:51 +08:00
parent 813faa4cd7
commit f39943629f
17 changed files with 44 additions and 156 deletions
@@ -3,9 +3,7 @@ import { computed, onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { storeToRefs } from 'pinia';
import { useAlert } from 'dashboard/composables';
import { useAccount } from 'dashboard/composables/useAccount';
import { useCaptain } from 'dashboard/composables/useCaptain';
import { useConfig } from 'dashboard/composables/useConfig';
import { useCaptainConfigStore } from 'dashboard/store/captain/preferences';
import SettingsLayout from '../SettingsLayout.vue';
@@ -17,8 +15,6 @@ import CaptainPaywall from 'next/captain/pageComponents/Paywall.vue';
const { t } = useI18n();
const { captainEnabled } = useCaptain();
const { isEnterprise, enterprisePlanName } = useConfig();
const { isOnChatwootCloud } = useAccount();
const captainConfigStore = useCaptainConfigStore();
const { uiFlags } = storeToRefs(captainConfigStore);
@@ -35,13 +31,11 @@ const modelFeatures = computed(() => [
key: 'assistant',
title: t('CAPTAIN_SETTINGS.MODEL_CONFIG.ASSISTANT.TITLE'),
description: t('CAPTAIN_SETTINGS.MODEL_CONFIG.ASSISTANT.DESCRIPTION'),
enterprise: true,
},
{
key: 'copilot',
title: t('CAPTAIN_SETTINGS.MODEL_CONFIG.COPILOT.TITLE'),
description: t('CAPTAIN_SETTINGS.MODEL_CONFIG.COPILOT.DESCRIPTION'),
enterprise: true,
},
]);
@@ -51,45 +45,12 @@ const featureToggles = computed(() => [
},
{
key: 'help_center_search',
enterprise: true,
},
{
key: 'audio_transcription',
enterprise: true,
},
]);
const shouldShowFeature = feature => {
// Cloud will always see these features as long as captain is enabled
if (isOnChatwootCloud.value && captainEnabled) {
return true;
}
if (feature.enterprise) {
// if the app is in enterprise mode, then we can show the feature
// this is not the installation plan, but when the enterprise folder is missing
return isEnterprise;
}
return true;
};
const isFeatureAccessible = feature => {
// Cloud will always see these features as long as captain is enabled
if (isOnChatwootCloud.value && captainEnabled) {
return true;
}
if (feature.enterprise) {
// plan is shown, but is it accessible?
// This ensures that the instance has purchased the enterprise license, and only then we allow
// access
return isEnterprise && enterprisePlanName === 'enterprise';
}
return true;
};
async function handleFeatureToggle({ feature, enabled }) {
try {
await captainConfigStore.updatePreferences({
@@ -144,9 +105,8 @@ onMounted(() => {
<div class="grid gap-4">
<ModelSelector
v-for="feature in modelFeatures"
v-show="shouldShowFeature(feature)"
:key="feature.key"
:is-allowed="isFeatureAccessible(feature)"
is-allowed
:feature-key="feature.key"
:title="feature.title"
:description="feature.description"
@@ -164,9 +124,8 @@ onMounted(() => {
<div class="grid gap-4">
<FeatureToggle
v-for="feature in featureToggles"
v-show="shouldShowFeature(feature)"
:key="feature.key"
:is-allowed="isFeatureAccessible(feature)"
is-allowed
:feature-key="feature.key"
@change="handleFeatureToggle"
@model-change="handleModelChange"
@@ -6,7 +6,6 @@ import { vOnClickOutside } from '@vueuse/components';
import { useVuelidate } from '@vuelidate/core';
import { minValue } from '@vuelidate/validators';
import { useAlert } from 'dashboard/composables';
import { useConfig } from 'dashboard/composables/useConfig';
import SettingsFieldSection from 'dashboard/components-next/Settings/SettingsFieldSection.vue';
import SettingsAccordion from 'dashboard/components-next/Settings/SettingsAccordion.vue';
import NextButton from 'dashboard/components-next/button/Button.vue';
@@ -28,7 +27,6 @@ const store = useStore();
const route = useRoute();
const router = useRouter();
const { t } = useI18n();
const { isEnterprise } = useConfig();
const selectedAgentIds = ref([]);
const isAgentListUpdating = ref(false);
@@ -406,10 +404,7 @@ onMounted(() => {
:description="assignmentDescription"
@update:model-value="handleToggleAutoAssignment"
>
<template
v-if="enableAutoAssignment && (isEnterprise || hasAssignmentV2)"
#editor
>
<template v-if="enableAutoAssignment" #editor>
<!-- assignment_v2 UI -->
<template v-if="hasAssignmentV2">
<!-- Policy Card - When policy is attached -->
@@ -637,7 +632,7 @@ onMounted(() => {
</template>
<!-- Old UI for non-assignment_v2 -->
<template v-else-if="isEnterprise">
<template v-else>
<div class="p-4">
<woot-input
v-model="maxAssignmentLimit"
@@ -4,7 +4,6 @@ import { useStore } from 'dashboard/composables/store';
import { useMapGetter } from 'dashboard/composables/store.js';
import { useRouter } from 'vue-router';
import { useAccount } from 'dashboard/composables/useAccount';
import { useConfig } from 'dashboard/composables/useConfig';
import { differenceInDays } from 'date-fns';
import { useAdmin } from 'dashboard/composables/useAdmin';
import { useI18n } from 'vue-i18n';
@@ -23,7 +22,6 @@ const router = useRouter();
const store = useStore();
const { t } = useI18n();
const { accountId, currentAccount } = useAccount();
const { isEnterprise } = useConfig();
const { isAdmin } = useAdmin();
const isOnChatwootCloud = useMapGetter('globalConfig/isOnChatwootCloud');
@@ -103,7 +101,7 @@ const routeToBilling = () => {
};
onMounted(() => {
if (isEnterprise) {
if (isOnChatwootCloud.value) {
fetchLimits();
}
});