fix(workflows): only inject the import button when appropriate

Bug: twpowertools:214

Change-Id: I2c0a580cd7629d4b9eb816fef41895e15112b9a1
diff --git a/src/features/workflows/core/communityConsole/import.js b/src/features/workflows/core/communityConsole/import.js
index 5fde499..09ffc0a 100644
--- a/src/features/workflows/core/communityConsole/import.js
+++ b/src/features/workflows/core/communityConsole/import.js
@@ -16,7 +16,8 @@
     // Only set this class up if the Community Console was opened with the
     // purpose of importing CRs to the workflow manager.
     const searchParams = new URLSearchParams(document.location.search);
-    if (!searchParams.has(kImportParam)) return;
+    this.isSetUp = searchParams.has(kImportParam);
+    if (!this.isSetUp) return;
 
     this.selectedId = searchParams.get(kSelectedIdParam);
 
@@ -100,7 +101,8 @@
     });
   }
 
-  addButtonIfEnabled(tags) {
+  addButtonIfApplicable(tags) {
+    if (!this.isSetUp) return;
     isOptionEnabled('workflows').then(isEnabled => {
       if (isEnabled) this.addButton(tags);
     });
diff --git a/src/features/workflows/nodeWatcherHandlers/crTags.handler.ts b/src/features/workflows/nodeWatcherHandlers/crTags.handler.ts
index 27c10d9..fbaee19 100644
--- a/src/features/workflows/nodeWatcherHandlers/crTags.handler.ts
+++ b/src/features/workflows/nodeWatcherHandlers/crTags.handler.ts
@@ -9,6 +9,6 @@
   cssSelector = 'ec-canned-response-row .tags';
 
   onMutatedNode(mutation: NodeMutation) {
-    this.options.workflowsImport.addButtonIfEnabled(mutation.node);
+    this.options.workflowsImport.addButtonIfApplicable(mutation.node);
   }
 }