Browse Source
Merge pull request #6724 from Budibase/fix/intercom-account-portal-only
only add account portal people to intercom
master
Martin McKeaveney
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
21 additions and
20 deletions
-
packages/builder/src/analytics/IntercomClient.js
-
packages/builder/src/stores/portal/auth.js
|
|
|
@ -52,13 +52,13 @@ export default class IntercomClient { |
|
|
|
* @param {Object} user - user to identify |
|
|
|
* @returns Intercom global object |
|
|
|
*/ |
|
|
|
show(user = {}) { |
|
|
|
if (this.initialised && user?.admin && user?.cloud) { |
|
|
|
return window.Intercom("boot", { |
|
|
|
app_id: this.token, |
|
|
|
...user, |
|
|
|
}) |
|
|
|
} |
|
|
|
show(user = {}, enabled) { |
|
|
|
if (!this.initialised || !enabled) return |
|
|
|
|
|
|
|
return window.Intercom("boot", { |
|
|
|
app_id: this.token, |
|
|
|
...user, |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
@ -54,23 +54,24 @@ export function createAuthStore() { |
|
|
|
}) |
|
|
|
|
|
|
|
if (user) { |
|
|
|
const adminStore = get(admin) |
|
|
|
analytics |
|
|
|
.activate() |
|
|
|
.then(() => { |
|
|
|
analytics.identify(user._id) |
|
|
|
analytics.showChat({ |
|
|
|
email: user.email, |
|
|
|
created_at: (user.createdAt || Date.now()) / 1000, |
|
|
|
name: user.account?.name, |
|
|
|
user_id: user._id, |
|
|
|
tenant: user.tenantId, |
|
|
|
admin: user?.admin?.global, |
|
|
|
builder: user?.builder?.global, |
|
|
|
"Company size": user.account?.size, |
|
|
|
"Job role": user.account?.profession, |
|
|
|
cloud: adminStore.cloud, |
|
|
|
}) |
|
|
|
analytics.showChat( |
|
|
|
{ |
|
|
|
email: user.email, |
|
|
|
created_at: (user.createdAt || Date.now()) / 1000, |
|
|
|
name: user.account?.name, |
|
|
|
user_id: user._id, |
|
|
|
tenant: user.tenantId, |
|
|
|
admin: user?.admin?.global, |
|
|
|
builder: user?.builder?.global, |
|
|
|
"Company size": user.account?.size, |
|
|
|
"Job role": user.account?.profession, |
|
|
|
}, |
|
|
|
!!user?.account |
|
|
|
) |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
// This request may fail due to browser extensions blocking requests
|
|
|
|
|