From 0975fa64134eed5eec8cf7463da1669f583778a9 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Fri, 15 Jul 2022 09:32:46 +0100 Subject: [PATCH] only show intercom in cloud --- packages/builder/src/analytics/IntercomClient.js | 12 ++++++------ packages/builder/src/stores/portal/auth.js | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/builder/src/analytics/IntercomClient.js b/packages/builder/src/analytics/IntercomClient.js index 6d5bf9e93e..e7a8539267 100644 --- a/packages/builder/src/analytics/IntercomClient.js +++ b/packages/builder/src/analytics/IntercomClient.js @@ -53,12 +53,12 @@ export default class IntercomClient { * @returns Intercom global object */ show(user = {}) { - if (!this.initialised || !user?.admin) return - - return window.Intercom("boot", { - app_id: this.token, - ...user, - }) + if (this.initialised && user?.admin && user?.cloud) { + return window.Intercom("boot", { + app_id: this.token, + ...user, + }) + } } /** diff --git a/packages/builder/src/stores/portal/auth.js b/packages/builder/src/stores/portal/auth.js index 5e8b28f6e7..636e80de99 100644 --- a/packages/builder/src/stores/portal/auth.js +++ b/packages/builder/src/stores/portal/auth.js @@ -54,6 +54,7 @@ export function createAuthStore() { }) if (user) { + const adminStore = get(admin) analytics .activate() .then(() => { @@ -68,6 +69,7 @@ export function createAuthStore() { builder: user?.builder?.global, "Company size": user.account?.size, "Job role": user.account?.profession, + cloud: adminStore.cloud, }) }) .catch(() => {