refactor(workflows): migrate to the new DI architecture
Bug: twpowertools:226
Change-Id: I8700cfd66883a667fc6ae0dffe9deb96f8d8cc80
diff --git a/src/entryPoints/communityConsole/contentScripts/main.ts b/src/entryPoints/communityConsole/contentScripts/main.ts
index bb7fe6a..9c70743 100644
--- a/src/entryPoints/communityConsole/contentScripts/main.ts
+++ b/src/entryPoints/communityConsole/contentScripts/main.ts
@@ -4,6 +4,7 @@
import DependenciesProviderSingleton, {
AutoRefreshDependency,
OptionsProviderDependency,
+ WorkflowsImportDependency,
} from '../../../common/architecture/dependenciesProvider/DependenciesProvider';
import { Context } from '../../../common/architecture/entrypoint/Context';
import {
@@ -30,6 +31,10 @@
import CCInfiniteScrollSetUpHandler from '../../../features/infiniteScroll/nodeWatcherHandlers/ccInfiniteScrollSetUp.handler';
import CCInfiniteScrollLoadMoreBarHandler from '../../../features/infiniteScroll/nodeWatcherHandlers/ccInfiniteScrollLoadMoreBar.handler';
import CCInfiniteScrollLoadMoreBtnHandler from '../../../features/infiniteScroll/nodeWatcherHandlers/ccInfiniteScrollLoadMoreBtn.handler';
+import WorkflowsThreadListActionBarHandler from '../../../features/workflows/presentation/nodeWatcherHandlers/threadListActionBar.handler';
+import WorkflowsImportCRTagsHandler from '../../../features/workflows/presentation/nodeWatcherHandlers/crTags.handler';
+import Workflows from '../../../features/workflows/core/communityConsole/workflows';
+import WorkflowsImportStylesheetScript from '../../../features/workflows/presentation/scripts/importStylesheet';
const scriptRunner = createScriptRunner();
scriptRunner.run();
@@ -40,6 +45,9 @@
const optionsProvider = dependenciesProvider.getDependency(
OptionsProviderDependency,
);
+ const workflowsImport = dependenciesProvider.getDependency(
+ WorkflowsImportDependency,
+ );
const ccInfiniteScroll = new CCInfiniteScroll();
@@ -88,11 +96,20 @@
'ccInfiniteScrollLoadMoreBtn',
new CCInfiniteScrollLoadMoreBtnHandler(ccInfiniteScroll),
],
+ [
+ 'workflowsImportCRTags',
+ new WorkflowsImportCRTagsHandler(workflowsImport),
+ ],
+ [
+ 'workflowsThreadListActionBar',
+ new WorkflowsThreadListActionBarHandler(new Workflows()),
+ ],
]),
),
// Individual feature scripts
new AutoRefreshStylesScript(),
+ new WorkflowsImportStylesheetScript(),
// Non-DI scripts (legacy, should be migrated to use a DI approach)
...new Features().getScripts(context),
diff --git a/src/entryPoints/communityConsole/contentScripts/start.ts b/src/entryPoints/communityConsole/contentScripts/start.ts
index c408b9f..73d2230 100644
--- a/src/entryPoints/communityConsole/contentScripts/start.ts
+++ b/src/entryPoints/communityConsole/contentScripts/start.ts
@@ -5,6 +5,7 @@
AutoRefreshDependency,
OptionsProviderDependency,
StartupDataStorageDependency,
+ WorkflowsImportDependency,
} from '../../../common/architecture/dependenciesProvider/DependenciesProvider';
import { Context } from '../../../common/architecture/entrypoint/Context';
import {
@@ -22,6 +23,7 @@
import { SortedScriptsProviderAdapter } from '../../../infrastructure/presentation/scripts/SortedScriptsProvider.adapter';
import StandaloneScripts from '../../../scripts/Scripts';
import LoadDraftsSetupScript from '../../../features/loadDrafts/presentation/scripts/setup.script';
+import WorkflowsImportSetUpScript from '../../../features/workflows/presentation/scripts/importSetUp.script';
const scriptRunner = createScriptRunner();
scriptRunner.run();
@@ -35,6 +37,9 @@
const startupDataStorage = dependenciesProvider.getDependency(
StartupDataStorageDependency,
);
+ const workflowsImport = dependenciesProvider.getDependency(
+ WorkflowsImportDependency,
+ );
const context: Context = {
page: ScriptPage.CommunityConsole,
@@ -51,6 +56,7 @@
new CCDarkThemeInjectForcedDarkTheme(),
new InteropThreadPageSetupScript(),
new LoadDraftsSetupScript(optionsProvider, startupDataStorage),
+ new WorkflowsImportSetUpScript(workflowsImport),
// Non-DI scripts (legacy, should be migrated to use a DI approach)
...new Features().getScripts(context),