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 0999a1a8e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 20 deletions

View File

@ -52,14 +52,14 @@ 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", { return window.Intercom("boot", {
app_id: this.token, app_id: this.token,
...user, ...user,
}) })
} }
}
/** /**
* Update intercom user details and messages. * Update intercom user details and messages.

View File

@ -54,12 +54,12 @@ 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, email: user.email,
created_at: (user.createdAt || Date.now()) / 1000, created_at: (user.createdAt || Date.now()) / 1000,
name: user.account?.name, name: user.account?.name,
@ -69,8 +69,9 @@ export function createAuthStore() {
builder: user?.builder?.global, builder: user?.builder?.global,
"Company size": user.account?.size, "Company size": user.account?.size,
"Job role": user.account?.profession, "Job role": user.account?.profession,
cloud: adminStore.cloud, },
}) !!user?.account
)
}) })
.catch(() => { .catch(() => {
// This request may fail due to browser extensions blocking requests // This request may fail due to browser extensions blocking requests