1
0
Fork 0
mirror of synced 2024-09-10 14:35:47 +12:00

Merge pull request #6724 from Budibase/fix/intercom-account-portal-only

only add account portal people to intercom
This commit is contained in:
Martin McKeaveney 2022-07-15 11:31:13 +01:00 committed by GitHub
commit 0836f39bea
2 changed files with 21 additions and 20 deletions

View file

@ -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,
} })
} }
/** /**

View file

@ -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