Prompt users to reload the CC when the extension updates

When the extension updates, it stops working in the Community Console.
Thus, this change adds logic so when the extension detects it has been
recently installed or updated it injects a banner to the top of the CC
with a message which prompts the user to reload the page.

Fixed: twpowertools:82
Change-Id: I0c901c72574c7c64d9ba94f56be96a12f7770049
diff --git a/src/updateNotifier/index.js b/src/updateNotifier/index.js
new file mode 100644
index 0000000..b4c0bb0
--- /dev/null
+++ b/src/updateNotifier/index.js
@@ -0,0 +1,25 @@
+export default class UpdateNotifier {
+  getCommunityConsoleTabs() {
+    return new Promise(res => {
+      chrome.tabs.query(
+          {url: 'https://support.google.com/s/community*'}, tabs => res(tabs));
+    });
+  }
+
+  notify(reason) {
+    this.getCommunityConsoleTabs().then(tabs => {
+      for (const tab of tabs) {
+        const script = reason === 'install' ? 'handleInstall.bundle.js' :
+                                              'handleUpdate.bundle.js';
+        // #!if browser_target == 'chromium_mv3'
+        chrome.scripting.executeScript({
+          target: {tabId: tab.id},
+          files: [script],
+        });
+        // #!else
+        chrome.tabs.executeScript(tab.id, {file: script});
+        // #!endif
+      }
+    });
+  }
+}