n8n/packages/editor-ui/src/components/EnterpriseEdition.ee.vue
Iván Ovejero 5ca2148c7e
refactor(editor): Apply Prettier (no-changelog) (#4920)
*  Adjust `format` script

* 🔥 Remove exemption for `editor-ui`

* 🎨 Prettify

* 👕 Fix lint
2022-12-14 10:04:10 +01:00

35 lines
736 B
Vue

<template>
<div>
<slot v-if="canAccess" />
<slot name="fallback" v-else />
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import { EnterpriseEditionFeature } from '@/constants';
import { mapStores } from 'pinia';
import { useSettingsStore } from '@/stores/settings';
export default Vue.extend({
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>