get process env in JS file (#13414)

This commit is contained in:
melohagan 2024-04-08 09:58:59 +01:00 committed by GitHub
parent 0b36dc8567
commit fe2c6d5ec1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 5 deletions

View File

@ -72,7 +72,7 @@
"fast-json-patch": "^3.1.1", "fast-json-patch": "^3.1.1",
"json-format-highlight": "^1.0.4", "json-format-highlight": "^1.0.4",
"lodash": "4.17.21", "lodash": "4.17.21",
"posthog-js": "^1.116.6", "posthog-js": "^1.118.0",
"remixicon": "2.5.0", "remixicon": "2.5.0",
"sanitize-html": "^2.7.0", "sanitize-html": "^2.7.0",
"shortid": "2.2.15", "shortid": "2.2.15",

View File

@ -38,6 +38,10 @@ class AnalyticsHub {
intercom.show(user) intercom.show(user)
} }
initPosthog() {
posthog.init()
}
async logout() { async logout() {
posthog.logout() posthog.logout()
intercom.logout() intercom.logout()

View File

@ -33,13 +33,10 @@
import { TOUR_STEP_KEYS } from "components/portal/onboarding/tours.js" import { TOUR_STEP_KEYS } from "components/portal/onboarding/tours.js"
import { goto } from "@roxi/routify" import { goto } from "@roxi/routify"
import { onMount } from "svelte" import { onMount } from "svelte"
import PosthogClient from "../../analytics/PosthogClient"
export let application export let application
export let loaded export let loaded
const posthog = new PosthogClient(process.env.POSTHOG_TOKEN)
let unpublishModal let unpublishModal
let updateAppModal let updateAppModal
let revertModal let revertModal
@ -156,7 +153,7 @@
} }
onMount(() => { onMount(() => {
posthog.init() analytics.initPosthog()
}) })
</script> </script>