Adrià Vilanova MartÃnez | c78c3ad | 2024-05-18 00:35:51 +0200 | [diff] [blame] | 1 | import DependenciesProviderSingleton, { |
| 2 | WorkflowsDependency, |
| 3 | WorkflowsImportDependency, |
| 4 | } from '../../../common/architecture/dependenciesProvider/DependenciesProvider'; |
| 5 | import { |
| 6 | ScriptEnvironment, |
| 7 | ScriptPage, |
| 8 | ScriptRunPhase, |
| 9 | } from '../../../common/architecture/scripts/Script'; |
| 10 | import NodeWatcherScript from '../../../common/architecture/scripts/nodeWatcher/NodeWatcherScript'; |
| 11 | import WorkflowsImport from '../core/communityConsole/import'; |
| 12 | import Workflows from '../core/communityConsole/workflows'; |
| 13 | import WorkflowsImportCRTagsHandler from '../nodeWatcherHandlers/crTags.handler'; |
| 14 | import WorkflowsThreadListActionBarHandler from '../nodeWatcherHandlers/threadListActionBar.handler'; |
| 15 | |
| 16 | export interface WorkflowsNodeWatcherDependencies { |
| 17 | workflows: Workflows; |
| 18 | workflowsImport: WorkflowsImport; |
| 19 | } |
| 20 | |
| 21 | export default class WorkflowsNodeWatcherScript extends NodeWatcherScript<WorkflowsNodeWatcherDependencies> { |
| 22 | public page = ScriptPage.CommunityConsole; |
| 23 | public environment = ScriptEnvironment.ContentScript; |
| 24 | public runPhase = ScriptRunPhase.Main; |
| 25 | public handlers = new Map([ |
| 26 | ['workflowsImportCRTags', WorkflowsImportCRTagsHandler], |
| 27 | ['workflowsThreadListActionBar', WorkflowsThreadListActionBarHandler], |
| 28 | ]); |
| 29 | |
| 30 | protected optionsFactory(): WorkflowsNodeWatcherDependencies { |
| 31 | const dependenciesProvider = DependenciesProviderSingleton.getInstance(); |
| 32 | return { |
| 33 | workflows: dependenciesProvider.getDependency(WorkflowsDependency), |
| 34 | workflowsImport: dependenciesProvider.getDependency( |
| 35 | WorkflowsImportDependency, |
| 36 | ), |
| 37 | }; |
| 38 | } |
| 39 | } |