n8n/packages/editor-ui/src/components/EnterpriseEdition.ee.vue
Iván Ovejero d5c44987f4
refactor(editor): Add infix to Pinia stores (no-changelog) (#6149)
*  Add infix to Pinia stores

*  Fix paths in mocks

* 🐛 Fix import
2023-05-05 10:41:54 +02:00

35 lines
768 B
Vue

<template>
<div>
<slot v-if="canAccess" />
<slot name="fallback" v-else />
</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>