Merge pull request #6724 from Budibase/fix/intercom-account-portal-only
only add account portal people to intercom
This commit is contained in:
commit
0836f39bea
2 changed files with 21 additions and 20 deletions
|
@ -52,13 +52,13 @@ export default class IntercomClient {
|
||||||
* @param {Object} user - user to identify
|
* @param {Object} user - user to identify
|
||||||
* @returns Intercom global object
|
* @returns Intercom global object
|
||||||
*/
|
*/
|
||||||
show(user = {}) {
|
show(user = {}, enabled) {
|
||||||
if (this.initialised && user?.admin && user?.cloud) {
|
if (!this.initialised || !enabled) return
|
||||||
return window.Intercom("boot", {
|
|
||||||
app_id: this.token,
|
return window.Intercom("boot", {
|
||||||
...user,
|
app_id: this.token,
|
||||||
})
|
...user,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -54,23 +54,24 @@ export function createAuthStore() {
|
||||||
})
|
})
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
const adminStore = get(admin)
|
|
||||||
analytics
|
analytics
|
||||||
.activate()
|
.activate()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
analytics.identify(user._id)
|
analytics.identify(user._id)
|
||||||
analytics.showChat({
|
analytics.showChat(
|
||||||
email: user.email,
|
{
|
||||||
created_at: (user.createdAt || Date.now()) / 1000,
|
email: user.email,
|
||||||
name: user.account?.name,
|
created_at: (user.createdAt || Date.now()) / 1000,
|
||||||
user_id: user._id,
|
name: user.account?.name,
|
||||||
tenant: user.tenantId,
|
user_id: user._id,
|
||||||
admin: user?.admin?.global,
|
tenant: user.tenantId,
|
||||||
builder: user?.builder?.global,
|
admin: user?.admin?.global,
|
||||||
"Company size": user.account?.size,
|
builder: user?.builder?.global,
|
||||||
"Job role": user.account?.profession,
|
"Company size": user.account?.size,
|
||||||
cloud: adminStore.cloud,
|
"Job role": user.account?.profession,
|
||||||
})
|
},
|
||||||
|
!!user?.account
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
// This request may fail due to browser extensions blocking requests
|
// This request may fail due to browser extensions blocking requests
|
||||||
|
|
Loading…
Reference in a new issue