n8n/packages/editor-ui/src/components/EnterpriseEdition.ee.vue
2024-05-17 13:58:26 +02:00

32 lines
757 B
Vue

<template>
<div>
<slot v-if="canAccess" />
<slot v-else name="fallback" />
</div>
</template>
<script lang="ts">
import { type PropType, defineComponent } from 'vue';
import type { EnterpriseEditionFeatureValue } from '@/Interface';
import { mapStores } from 'pinia';
import { useSettingsStore } from '@/stores/settings.store';
export default defineComponent({
name: 'EnterpriseEdition',
props: {
features: {
type: Array as PropType<EnterpriseEditionFeatureValue[]>,
default: () => [],
},
},
computed: {
...mapStores(useSettingsStore),
canAccess(): boolean {
return this.features.reduce((acc: boolean, feature) => {
return acc && !!this.settingsStore.isEnterpriseFeatureEnabled(feature);
}, true);
},
},
});
</script>