mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-30 21:45:01 +02:00
Use our analytics service properly (#9985)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
import { IntlString, translateCB } from '@hcengineering/platform'
|
||||
import contact, { getCurrentEmployee, SocialIdentityRef } from '@hcengineering/contact'
|
||||
import { buildSocialIdString, SocialIdType } from '@hcengineering/core'
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
|
||||
export let mailboxOptions: MailboxOptions
|
||||
|
||||
@@ -83,6 +84,7 @@
|
||||
loading = false
|
||||
formatError(err)
|
||||
console.error('Failed to create mailbox', err)
|
||||
Analytics.handleError(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
import { getAccountClient } from '../utils'
|
||||
import contact, { getCurrentEmployee } from '@hcengineering/contact'
|
||||
import { buildSocialIdString, SocialIdType } from '@hcengineering/core'
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
|
||||
export let mailbox: MailboxInfo
|
||||
export let mailboxIdx: number
|
||||
@@ -49,8 +50,9 @@
|
||||
loadingRequested()
|
||||
try {
|
||||
await deleteMailbox()
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
console.error('Failed to delete mailbox', err)
|
||||
Analytics.handleError(err)
|
||||
}
|
||||
reloadRequested()
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
import { onMount } from 'svelte'
|
||||
import { MailboxInfo, MailboxOptions } from '@hcengineering/account-client'
|
||||
import MailboxItem from './MailboxItem.svelte'
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
|
||||
let boxesLoading = true
|
||||
let optionsLoading = true
|
||||
@@ -61,6 +62,7 @@
|
||||
.catch((err: any) => {
|
||||
optionsLoading = false
|
||||
console.error('Failed to load mailbox options', err)
|
||||
Analytics.handleError(err)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
import setting from '../plugin'
|
||||
import { getAccountClient } from '../utils'
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
|
||||
const query = createQuery()
|
||||
const currentAccount = getCurrentAccount()
|
||||
@@ -61,8 +62,8 @@
|
||||
try {
|
||||
await accountClient.updateWorkspaceRole(personUuid, value)
|
||||
workspaceMembers[personUuid] = value
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
} catch (e: any) {
|
||||
Analytics.handleError(e)
|
||||
}
|
||||
}
|
||||
let search = ''
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
label = setting.string.Saved
|
||||
} catch (e: any) {
|
||||
Analytics.handleError(e)
|
||||
console.error(e)
|
||||
label = presentation.string.Save
|
||||
saved = false
|
||||
error = true
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
await disconnect(integration)
|
||||
}
|
||||
} catch (err: any) {
|
||||
console.error('Error disconnecting integration:', err)
|
||||
Analytics.handleError(err)
|
||||
const errorMessage: string = err.message ?? 'Unknown error'
|
||||
const integrationError = errorMessage.includes('Failed to fetch')
|
||||
? setting.string.ServiceIsUnavailable
|
||||
@@ -102,7 +102,7 @@
|
||||
await disconnectAll(integration)
|
||||
}
|
||||
} catch (err: any) {
|
||||
console.error('Error disconnecting integration:', err)
|
||||
Analytics.handleError(err)
|
||||
const errorMessage: string = err.message ?? 'Unknown error'
|
||||
const integrationError = errorMessage.includes('Failed to fetch')
|
||||
? setting.string.ServiceIsUnavailable
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
import IntegrationCard from './IntegrationCard.svelte'
|
||||
import IntegrationErrorNotification from './IntegrationErrorNotification.svelte'
|
||||
import { getAccountClient } from '../../utils'
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
|
||||
const typeQuery = createQuery()
|
||||
|
||||
@@ -76,7 +77,7 @@
|
||||
|
||||
if (error != null) {
|
||||
const decodedError = decodeURIComponent(error)
|
||||
console.error('Integration error:', decodedError)
|
||||
Analytics.handleError(new Error(`Integration error: ${decodedError}`))
|
||||
await showErrorNotification(decodedError)
|
||||
// Clean up integrationError parameter from the URL
|
||||
urlParams.delete('integrationError')
|
||||
@@ -89,8 +90,8 @@
|
||||
}
|
||||
subscribe()
|
||||
startRefreshTimer()
|
||||
} catch (err) {
|
||||
console.error('Error loading integrations:', err)
|
||||
} catch (err: any) {
|
||||
Analytics.handleError(err)
|
||||
await showLoadErrorNotification()
|
||||
connections = []
|
||||
integrations = []
|
||||
@@ -149,8 +150,8 @@
|
||||
connections = await accountClient.listIntegrations({ workspaceUuid: null })
|
||||
integrations = await accountClient.listIntegrations({ workspaceUuid: workspace })
|
||||
lastEventTime = Date.now() // Update last event time after successful refresh
|
||||
} catch (err) {
|
||||
console.error('Error refreshing integrations:', err)
|
||||
} catch (err: any) {
|
||||
Analytics.handleError(err)
|
||||
}
|
||||
})()
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
import AddSocialId from './AddSocialId.svelte'
|
||||
import setting from '../../plugin'
|
||||
import { getAccountClient } from '../../utils'
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
|
||||
export let provider: SocialIdentityProvider
|
||||
export let onAdded: (socialId: SocialId) => void | Promise<void>
|
||||
@@ -62,7 +63,7 @@
|
||||
retryOn = otpInfo.retryOn
|
||||
canResend = false
|
||||
} catch (err: any) {
|
||||
console.error(err)
|
||||
Analytics.handleError(err)
|
||||
if (err instanceof PlatformError) {
|
||||
status = err.status
|
||||
} else {
|
||||
@@ -97,7 +98,9 @@
|
||||
|
||||
const newSocialId = socialIds.find((it) => it._id === newSocialIdLoginInfo.socialId)
|
||||
if (newSocialId == null) {
|
||||
console.error(`New social id ${newSocialIdLoginInfo.socialId} not found in the updated social ids list`)
|
||||
Analytics.handleError(
|
||||
new Error(`New social id ${newSocialIdLoginInfo.socialId} not found in the updated social ids list`)
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -142,7 +145,7 @@
|
||||
}
|
||||
dispatch('close')
|
||||
} catch (err: any) {
|
||||
console.error(err)
|
||||
Analytics.handleError(err)
|
||||
if (err instanceof PlatformError) {
|
||||
status = err.status
|
||||
} else {
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
import setting from '../../plugin'
|
||||
import { getAccountClient } from '../../utils'
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
|
||||
export let socialId: SocialId
|
||||
export let socialIdProvider: SocialIdentityProvider
|
||||
@@ -79,7 +80,7 @@
|
||||
currAcc = updatedAccount
|
||||
dispatch('released')
|
||||
} catch (err: any) {
|
||||
console.error(err)
|
||||
Analytics.handleError(err)
|
||||
void setPlatformStatus(unknownError(err))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user