Files
Automata/packages/editor-ui/src/components/EnterpriseEdition.ee.vue
कारतोफ्फेलस्क्रिप्ट™ 68cff4c59e refactor(editor): Improve linting for component and prop names (no-changelog) (#8169)
2023-12-28 09:49:58 +01:00

35 lines
768 B
Vue

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