From fe2c6d5ec1701cb039c3bd94364d569968ebb5cd Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Mon, 8 Apr 2024 09:58:59 +0100 Subject: [PATCH] get process env in JS file (#13414) --- packages/builder/package.json | 2 +- packages/builder/src/analytics/index.js | 4 ++++ packages/builder/src/components/deploy/AppActions.svelte | 5 +---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/builder/package.json b/packages/builder/package.json index 253f5a0c14..f29ae3f7f2 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -72,7 +72,7 @@ "fast-json-patch": "^3.1.1", "json-format-highlight": "^1.0.4", "lodash": "4.17.21", - "posthog-js": "^1.116.6", + "posthog-js": "^1.118.0", "remixicon": "2.5.0", "sanitize-html": "^2.7.0", "shortid": "2.2.15", diff --git a/packages/builder/src/analytics/index.js b/packages/builder/src/analytics/index.js index 3a80a05d7f..a0ddfe1d42 100644 --- a/packages/builder/src/analytics/index.js +++ b/packages/builder/src/analytics/index.js @@ -38,6 +38,10 @@ class AnalyticsHub { intercom.show(user) } + initPosthog() { + posthog.init() + } + async logout() { posthog.logout() intercom.logout() diff --git a/packages/builder/src/components/deploy/AppActions.svelte b/packages/builder/src/components/deploy/AppActions.svelte index 1d7bb4f65e..30b95d639e 100644 --- a/packages/builder/src/components/deploy/AppActions.svelte +++ b/packages/builder/src/components/deploy/AppActions.svelte @@ -33,13 +33,10 @@ import { TOUR_STEP_KEYS } from "components/portal/onboarding/tours.js" import { goto } from "@roxi/routify" import { onMount } from "svelte" - import PosthogClient from "../../analytics/PosthogClient" export let application export let loaded - const posthog = new PosthogClient(process.env.POSTHOG_TOKEN) - let unpublishModal let updateAppModal let revertModal @@ -156,7 +153,7 @@ } onMount(() => { - posthog.init() + analytics.initPosthog() })