blob: 6bd74b0c973334cd3a38f5a525e6c04d20e93669 [file] [log] [blame]
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +02001import Feature from '../common/architecture/features/Feature';
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +02002import InfiniteScrollFeature from './infiniteScroll/infiniteScroll.feature';
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +02003import ScriptFilterListProvider from '../common/architecture/scripts/ScriptFilterListProvider';
Adrià Vilanova Martínez66836fd2024-05-04 22:43:06 +02004import ExtraInfoFeature from './extraInfo/extraInfo.feature';
Adrià Vilanova Martínezc78c3ad2024-05-18 00:35:51 +02005import WorkflowsFeature from './workflows/workflows.feature';
Adrià Vilanova61f782f2024-05-31 22:57:24 +00006import LoadDraftsFeature from './loadDrafts/loadDrafts.feature';
7import InteropThreadPageFeature from './interopThreadPage/interopThreadPage.feature';
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +02008
9export type ConcreteFeatureClass = { new (): Feature };
10
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +020011export default class Features extends ScriptFilterListProvider {
Adrià Vilanova Martínez58cc67c2024-04-21 16:43:01 +020012 private features: ConcreteFeatureClass[] = [
Adrià Vilanova Martínez66836fd2024-05-04 22:43:06 +020013 ExtraInfoFeature,
Adrià Vilanova Martínez58cc67c2024-04-21 16:43:01 +020014 InfiniteScrollFeature,
Adrià Vilanova61f782f2024-05-31 22:57:24 +000015 InteropThreadPageFeature,
16 LoadDraftsFeature,
Adrià Vilanova Martínezc78c3ad2024-05-18 00:35:51 +020017 WorkflowsFeature,
Adrià Vilanova Martínez58cc67c2024-04-21 16:43:01 +020018 ];
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020019 private initializedFeatures: Feature[];
20
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +020021 protected getUnfilteredScriptsList() {
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020022 const features = this.getFeatures();
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +020023 return features.map((feature) => feature.getScripts()).flat(1);
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020024 }
25
26 private getFeatures() {
27 if (this.initializedFeatures === undefined) {
28 this.initializedFeatures = this.features.map((feature) => new feature());
29 }
30 return this.initializedFeatures;
31 }
32}