refactor: migrate standalone scripts to the new DI architecture
Bug: twpowertools:226
Change-Id: Ie32b0200a31626bde06f3bdb0655790bb5a76802
diff --git a/src/entryPoints/communityConsole/contentScripts/main.ts b/src/entryPoints/communityConsole/contentScripts/main.ts
index 4812d53..c4f994f 100644
--- a/src/entryPoints/communityConsole/contentScripts/main.ts
+++ b/src/entryPoints/communityConsole/contentScripts/main.ts
@@ -5,6 +5,7 @@
AutoRefreshDependency,
ExtraInfoDependency,
OptionsProviderDependency,
+ StartupDataStorageDependency,
WorkflowsImportDependency,
} from '../../../common/architecture/dependenciesProvider/DependenciesProvider';
import { Context } from '../../../common/architecture/entrypoint/Context';
@@ -28,7 +29,7 @@
import ScriptSorterAdapter from '../../../infrastructure/presentation/scripts/ScriptSorter.adapter';
import { SortedScriptsProviderAdapter } from '../../../infrastructure/presentation/scripts/SortedScriptsProvider.adapter';
import { NodeWatcherHandler } from '../../../presentation/nodeWatcher/NodeWatcherHandler';
-import StandaloneScripts from '../../../scripts/Scripts';
+import StandaloneScripts from '../../../presentation/standaloneScripts/Scripts';
import CCInfiniteScrollSetUpHandler from '../../../features/infiniteScroll/presentation/nodeWatcherHandlers/ccInfiniteScrollSetUp.handler';
import CCInfiniteScrollLoadMoreBarHandler from '../../../features/infiniteScroll/presentation/nodeWatcherHandlers/ccInfiniteScrollLoadMoreBar.handler';
import CCInfiniteScrollLoadMoreBtnHandler from '../../../features/infiniteScroll/presentation/nodeWatcherHandlers/ccInfiniteScrollLoadMoreBtn.handler';
@@ -45,6 +46,8 @@
import CCExtraInfoThreadReplyHandler from '../../../features/extraInfo/presentation/nodeWatcherHandlers/thread/ccExtraInfoThreadReply.handler';
import CCExtraInfoInjectScript from '../../../features/extraInfo/presentation/scripts/ccExtraInfoInject.script';
import CCExtraInfoStylesScript from '../../../features/extraInfo/presentation/scripts/ccExtraInfoStyles.script';
+import InjectLitComponentsScript from '../../../presentation/standaloneScripts/litComponents/injectLitComponents.script';
+import ApplyStartupDataModificationsOnMainScript from '../../../presentation/standaloneScripts/startupDataStorage/applyStartupDataModificationsOnMain.script';
const scriptRunner = createScriptRunner();
scriptRunner.run();
@@ -56,6 +59,9 @@
const optionsProvider = dependenciesProvider.getDependency(
OptionsProviderDependency,
);
+ const startupDataStorage = dependenciesProvider.getDependency(
+ StartupDataStorageDependency,
+ );
const workflowsImport = dependenciesProvider.getDependency(
WorkflowsImportDependency,
);
@@ -152,6 +158,10 @@
new CCExtraInfoStylesScript(),
new WorkflowsImportStylesheetScript(),
+ // Standalone scripts
+ new ApplyStartupDataModificationsOnMainScript(startupDataStorage),
+ new InjectLitComponentsScript(),
+
// Non-DI scripts (legacy, should be migrated to use a DI approach)
...new Features().getScripts(context),
...new StandaloneScripts().getScripts(context),
diff --git a/src/entryPoints/communityConsole/contentScripts/start.ts b/src/entryPoints/communityConsole/contentScripts/start.ts
index 4cbfd9d..e7023a2 100644
--- a/src/entryPoints/communityConsole/contentScripts/start.ts
+++ b/src/entryPoints/communityConsole/contentScripts/start.ts
@@ -22,10 +22,14 @@
import ScriptRunner from '../../../infrastructure/presentation/scripts/ScriptRunner';
import ScriptSorterAdapter from '../../../infrastructure/presentation/scripts/ScriptSorter.adapter';
import { SortedScriptsProviderAdapter } from '../../../infrastructure/presentation/scripts/SortedScriptsProvider.adapter';
-import StandaloneScripts from '../../../scripts/Scripts';
+import StandaloneScripts from '../../../presentation/standaloneScripts/Scripts';
import LoadDraftsSetupScript from '../../../features/loadDrafts/presentation/scripts/setup.script';
import WorkflowsImportSetUpScript from '../../../features/workflows/presentation/scripts/importSetUp.script';
import CCExtraInfoSetUpScript from '../../../features/extraInfo/presentation/scripts/ccExtraInfoSetUp.script';
+import MWI18nServerScript from '../../../presentation/standaloneScripts/mainWorldServers/MWI18nServerScript.script';
+import MWOptionsWatcherServerScript from '../../../presentation/standaloneScripts/mainWorldServers/MWOptionsWatcherServerScript.script';
+import ApplyStartupDataModificationsOnStartScript from '../../../presentation/standaloneScripts/startupDataStorage/applyStartupDataModificationsOnStart.script';
+import XHRInterceptorScript from '../../../presentation/standaloneScripts/xhrInterceptor/xhrInterceptor.script';
const scriptRunner = createScriptRunner();
scriptRunner.run();
@@ -62,6 +66,12 @@
new LoadDraftsSetupScript(optionsProvider, startupDataStorage),
new WorkflowsImportSetUpScript(workflowsImport),
+ // Standalone scripts
+ new ApplyStartupDataModificationsOnStartScript(startupDataStorage),
+ new MWI18nServerScript(),
+ new MWOptionsWatcherServerScript(),
+ new XHRInterceptorScript(),
+
// Non-DI scripts (legacy, should be migrated to use a DI approach)
...new Features().getScripts(context),
...new StandaloneScripts().getScripts(context),