fix: remove enterprise mode gating
This commit is contained in:
@@ -5,7 +5,6 @@ import {
|
||||
useStore,
|
||||
} from 'dashboard/composables/store.js';
|
||||
import { useAccount } from 'dashboard/composables/useAccount';
|
||||
import { useConfig } from 'dashboard/composables/useConfig';
|
||||
import { useCamelCase } from 'dashboard/composables/useTransformKeys';
|
||||
import { useAlert } from 'dashboard/composables';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -17,7 +16,6 @@ export function useCaptain() {
|
||||
const store = useStore();
|
||||
const { t } = useI18n();
|
||||
const { isCloudFeatureEnabled, currentAccount } = useAccount();
|
||||
const { isEnterprise } = useConfig();
|
||||
const uiFlags = useMapGetter('accounts/getUIFlags');
|
||||
const currentChat = useMapGetter('getSelectedChat');
|
||||
const replyMode = useMapGetter('draftMessages/getReplyEditorMode');
|
||||
@@ -36,7 +34,7 @@ export function useCaptain() {
|
||||
return isCloudFeatureEnabled(FEATURE_FLAGS.CAPTAIN_TASKS);
|
||||
});
|
||||
|
||||
// === Limits (Enterprise) ===
|
||||
// === Limits ===
|
||||
const captainLimits = computed(() => {
|
||||
return currentAccount.value?.limits?.captain;
|
||||
});
|
||||
@@ -58,9 +56,7 @@ export function useCaptain() {
|
||||
const isFetchingLimits = computed(() => uiFlags.value.isFetchingLimits);
|
||||
|
||||
const fetchLimits = () => {
|
||||
if (isEnterprise) {
|
||||
store.dispatch('accounts/limits');
|
||||
}
|
||||
store.dispatch('accounts/limits');
|
||||
};
|
||||
|
||||
// === Error Handling ===
|
||||
@@ -225,7 +221,7 @@ export function useCaptain() {
|
||||
captainEnabled,
|
||||
captainTasksEnabled,
|
||||
|
||||
// Limits (Enterprise)
|
||||
// Limits
|
||||
captainLimits,
|
||||
documentLimits,
|
||||
responseLimits,
|
||||
|
||||
@@ -23,19 +23,6 @@ export function useConfig() {
|
||||
*/
|
||||
const enabledLanguages = config.enabledLanguages;
|
||||
|
||||
/**
|
||||
* Indicates whether the current instance is an enterprise version.
|
||||
* @type {boolean}
|
||||
*/
|
||||
const isEnterprise = config.isEnterprise === 'true';
|
||||
|
||||
/**
|
||||
* The name of the enterprise plan, if applicable.
|
||||
* Returns "community" or "enterprise"
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
const enterprisePlanName = config.enterprisePlanName;
|
||||
|
||||
/**
|
||||
* Indicates whether inbox webhook events (ENABLE_INBOX_EVENTS) are enabled.
|
||||
* @type {boolean}
|
||||
@@ -46,8 +33,6 @@ export function useConfig() {
|
||||
hostURL,
|
||||
vapidPublicKey,
|
||||
enabledLanguages,
|
||||
isEnterprise,
|
||||
enterprisePlanName,
|
||||
inboxEventsEnabled,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { computed, unref } from 'vue';
|
||||
import { unref } from 'vue';
|
||||
import { useMapGetter } from 'dashboard/composables/store';
|
||||
import { useAccount } from 'dashboard/composables/useAccount';
|
||||
import { useConfig } from 'dashboard/composables/useConfig';
|
||||
import {
|
||||
getUserPermissions,
|
||||
hasPermissions,
|
||||
@@ -18,7 +17,6 @@ export function usePolicy() {
|
||||
'globalConfig/isACustomBrandedInstance'
|
||||
);
|
||||
|
||||
const { isEnterprise, enterprisePlanName } = useConfig();
|
||||
const { accountId } = useAccount();
|
||||
|
||||
const getUserPermissionsForAccount = () => {
|
||||
@@ -39,7 +37,7 @@ export function usePolicy() {
|
||||
const checkInstallationType = config => {
|
||||
if (Array.isArray(config) && config.length > 0) {
|
||||
const installationCheck = {
|
||||
[INSTALLATION_TYPES.ENTERPRISE]: isEnterprise,
|
||||
[INSTALLATION_TYPES.ENTERPRISE]: true,
|
||||
[INSTALLATION_TYPES.CLOUD]: isOnChatwootCloud.value,
|
||||
[INSTALLATION_TYPES.COMMUNITY]: true,
|
||||
};
|
||||
@@ -55,12 +53,6 @@ export function usePolicy() {
|
||||
return PREMIUM_FEATURES.includes(featureFlag);
|
||||
};
|
||||
|
||||
const hasPremiumEnterprise = computed(() => {
|
||||
if (isEnterprise) return enterprisePlanName !== 'community';
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
const shouldShow = (featureFlag, permissions, installationTypes) => {
|
||||
const flag = unref(featureFlag);
|
||||
const perms = unref(permissions);
|
||||
@@ -84,22 +76,6 @@ export function usePolicy() {
|
||||
return isFeatureFlagEnabled(flag) || isPremiumFeature(flag);
|
||||
}
|
||||
|
||||
if (isEnterprise) {
|
||||
// in enterprise, if the feature is premium but they don't have an enterprise plan
|
||||
// we should it anyway this is to show upsells on enterprise regardless of the feature flag
|
||||
// Feature flag is only honored if they have a premium plan
|
||||
//
|
||||
// In case they have a premium plan, the check on feature flag alone is enough
|
||||
// because the second condition will always be false
|
||||
// That means once subscribed, the feature can be disabled by the admin
|
||||
//
|
||||
// the paywall should be managed by the individual component
|
||||
return (
|
||||
isFeatureFlagEnabled(flag) ||
|
||||
(isPremiumFeature(flag) && !hasPremiumEnterprise.value)
|
||||
);
|
||||
}
|
||||
|
||||
// default to true
|
||||
return true;
|
||||
};
|
||||
@@ -113,14 +89,8 @@ export function usePolicy() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isPremiumFeature(flag)) {
|
||||
if (isOnChatwootCloud.value) {
|
||||
return !isFeatureFlagEnabled(flag);
|
||||
}
|
||||
|
||||
if (isEnterprise) {
|
||||
return !hasPremiumEnterprise.value;
|
||||
}
|
||||
if (isPremiumFeature(flag) && isOnChatwootCloud.value) {
|
||||
return !isFeatureFlagEnabled(flag);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user