Merge branch 'master' into BUDI-9237
This commit is contained in:
commit
2664bf4f7e
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
||||||
"version": "3.8.6",
|
"version": "3.9.0",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"concurrency": 20,
|
"concurrency": 20,
|
||||||
"command": {
|
"command": {
|
||||||
|
|
|
@ -2,9 +2,12 @@ import { API } from "@/api"
|
||||||
import PosthogClient from "./PosthogClient"
|
import PosthogClient from "./PosthogClient"
|
||||||
import { Events, EventSource } from "./constants"
|
import { Events, EventSource } from "./constants"
|
||||||
|
|
||||||
const posthog = new PosthogClient(process.env.POSTHOG_TOKEN)
|
const posthog = new PosthogClient(process.env.POSTHOG_TOKEN!)
|
||||||
|
|
||||||
class AnalyticsHub {
|
class AnalyticsHub {
|
||||||
|
private initialised: boolean
|
||||||
|
private clients: PosthogClient[]
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.clients = [posthog]
|
this.clients = [posthog]
|
||||||
this.initialised = false
|
this.initialised = false
|
||||||
|
@ -21,13 +24,13 @@ class AnalyticsHub {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
identify(id) {
|
identify(id: string) {
|
||||||
posthog.identify(id)
|
posthog.identify(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
captureException(_err) {}
|
captureException(_err: any) {}
|
||||||
|
|
||||||
captureEvent(eventName, props = {}) {
|
captureEvent(eventName: string, props = {}) {
|
||||||
posthog.captureEvent(eventName, props)
|
posthog.captureEvent(eventName, props)
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ class AuthStore extends BudiStore<PortalAuthStore> {
|
||||||
analytics
|
analytics
|
||||||
.activate()
|
.activate()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
analytics.identify(user._id)
|
analytics.identify(user._id!)
|
||||||
})
|
})
|
||||||
.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 New Issue