refactor(flatten-threads): migrate to the new DI architecture

Bug: twpowertools:176
Change-Id: I7a24fb504ce53697112f11128d2d5249a5a7c7e7
diff --git a/src/features/flattenThreads/presentation/nodeWatcherHandlers/readdReplyBtn.handler.ts b/src/features/flattenThreads/presentation/nodeWatcherHandlers/readdReplyBtn.handler.ts
new file mode 100644
index 0000000..2eb3d33
--- /dev/null
+++ b/src/features/flattenThreads/presentation/nodeWatcherHandlers/readdReplyBtn.handler.ts
@@ -0,0 +1,23 @@
+import CssSelectorNodeWatcherHandler from '../../../../infrastructure/presentation/nodeWatcher/handlers/CssSelectorHandler.adapter';
+import {
+  NodeMutation,
+  NodeMutationType,
+} from '../../../../presentation/nodeWatcher/NodeWatcherHandler';
+import FlattenThreads from '../../core/flattenThreads';
+
+/** Readd reply button when the Community Console removes it */
+export default class FlattenThreadsReaddReplyBtnHandler extends CssSelectorNodeWatcherHandler {
+  cssSelector = 'twpt-flatten-thread-reply-button';
+  mutationTypesProcessed = [NodeMutationType.RemovedNode];
+
+  constructor(private flattenThreads: FlattenThreads) {
+    super();
+  }
+
+  onMutatedNode({ node, mutationRecord }: NodeMutation<HTMLElement>) {
+    this.flattenThreads.injectReplyBtn(
+      mutationRecord.target,
+      JSON.parse(node.getAttribute('extraInfo')),
+    );
+  }
+}