refactor(bulk-report-replies): abstract controls injector behind a port

The injector shouldn't be tightly coupled with the node watch handler.
This was a control freak antipattern, and it wouldn't let us inject
other dependencies to this class, as well as being able to replace it
with another implementation in the future (e.g. for TW basic).

Bug: twpowertools:192
Change-Id: I6a6a636c64950960705fe8037698e136d7c5b571
diff --git a/src/entryPoints/communityConsole/contentScripts/main.ts b/src/entryPoints/communityConsole/contentScripts/main.ts
index 5b50d4f..cc25b69 100644
--- a/src/entryPoints/communityConsole/contentScripts/main.ts
+++ b/src/entryPoints/communityConsole/contentScripts/main.ts
@@ -61,6 +61,7 @@
 import { OptionsModifierAdapter } from '../../../infrastructure/services/options/OptionsModifier.adapter';
 import ThreadToolbarInjectHandler from '../../../features/threadToolbar/presentation/nodeWatcherHandlers/inject.handler';
 import ThreadToolbar from '../../../features/threadToolbar/core/threadToolbar';
+import { BulkReportControlsInjectorAdapter } from '../../../features/bulkReportReplies/infrastructure/ui/injectors/bulkReportControls.injector.adapter';
 
 const scriptRunner = createScriptRunner();
 scriptRunner.run();
@@ -103,7 +104,10 @@
             ],
             [
               'bulkReportRepliesMessageCard',
-              new BulkReportRepliesMessageCardHandler(optionsProvider),
+              new BulkReportRepliesMessageCardHandler(
+                optionsProvider,
+                new BulkReportControlsInjectorAdapter(),
+              ),
             ],
             ['ccDarkThemeEcApp', new CCDarkThemeEcAppHandler(optionsProvider)],
             [
diff --git a/src/features/bulkReportReplies/infrastructure/ui/injectors/bulkReportControls.injector.adapter.ts b/src/features/bulkReportReplies/infrastructure/ui/injectors/bulkReportControls.injector.adapter.ts
new file mode 100644
index 0000000..2c8dff7
--- /dev/null
+++ b/src/features/bulkReportReplies/infrastructure/ui/injectors/bulkReportControls.injector.adapter.ts
@@ -0,0 +1,11 @@
+import { BulkReportControlsInjectorPort } from '../../../ui/injectors/bulkReportControls.injector.port';
+
+export class BulkReportControlsInjectorAdapter
+  implements BulkReportControlsInjectorPort
+{
+  inject(messageActions: Element) {
+    const controls = document.createElement('bulk-report-controls');
+    // TODO(https://iavm.xyz/b/twpowertools/192): Add message ID to the controls.
+    messageActions.append(controls);
+  }
+}
diff --git a/src/features/bulkReportReplies/presentation/nodeWatcherHandlers/messageCard.handler.ts b/src/features/bulkReportReplies/presentation/nodeWatcherHandlers/messageCard.handler.ts
index 1084566..2f098d0 100644
--- a/src/features/bulkReportReplies/presentation/nodeWatcherHandlers/messageCard.handler.ts
+++ b/src/features/bulkReportReplies/presentation/nodeWatcherHandlers/messageCard.handler.ts
@@ -1,7 +1,7 @@
 import CssSelectorNodeWatcherHandler from '../../../../infrastructure/presentation/nodeWatcher/handlers/CssSelectorHandler.adapter';
 import { NodeMutation } from '../../../../presentation/nodeWatcher/NodeWatcherHandler';
 import { OptionsProviderPort } from '../../../../services/options/OptionsProvider';
-import BulkReportControlsInjector from '../../ui/injectors/bulkReportControls.injector';
+import { BulkReportControlsInjectorPort } from '../../ui/injectors/bulkReportControls.injector.port';
 
 /**
  * Injects the bulk report reply controls.
@@ -10,9 +10,10 @@
   cssSelector =
     ':is(.scTailwindThreadMessageMessagecardcontent:not(.scTailwindThreadMessageMessagecardpromoted), .scTailwindThreadMessageCommentcardcomment) sc-tailwind-thread-message-message-actions';
 
-  bulkReportControlsInjector = new BulkReportControlsInjector();
-
-  constructor(private optionsProvider: OptionsProviderPort) {
+  constructor(
+    private optionsProvider: OptionsProviderPort,
+    private bulkReportControlsInjector: BulkReportControlsInjectorPort,
+  ) {
     super();
   }
 
diff --git a/src/features/bulkReportReplies/ui/injectors/bulkReportControls.injector.port.ts b/src/features/bulkReportReplies/ui/injectors/bulkReportControls.injector.port.ts
new file mode 100644
index 0000000..44b8f61
--- /dev/null
+++ b/src/features/bulkReportReplies/ui/injectors/bulkReportControls.injector.port.ts
@@ -0,0 +1,3 @@
+export interface BulkReportControlsInjectorPort {
+  inject(messageActions: Element): void;
+};
diff --git a/src/features/bulkReportReplies/ui/injectors/bulkReportControls.injector.ts b/src/features/bulkReportReplies/ui/injectors/bulkReportControls.injector.ts
deleted file mode 100644
index 18bdff7..0000000
--- a/src/features/bulkReportReplies/ui/injectors/bulkReportControls.injector.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export default class BulkReportControlsInjector {
-  inject(messageActions: Element) {
-    const controls = document.createElement('bulk-report-controls');
-    // TODO(https://iavm.xyz/b/twpowertools/192): Add message ID to the controls.
-    messageActions.append(controls);
-  }
-}