From ec323a69ea4362d154e32bb285588de413a2bc39 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 13 Jul 2020 18:09:32 +0100 Subject: [PATCH] identify user in builder --- packages/builder/rollup.config.js | 4 ++-- packages/builder/src/builderStore/index.js | 2 +- packages/builder/src/components/settings/tabs/APIKeys.svelte | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/builder/rollup.config.js b/packages/builder/rollup.config.js index c89a34c9f9..347cd82ffd 100644 --- a/packages/builder/rollup.config.js +++ b/packages/builder/rollup.config.js @@ -180,8 +180,8 @@ export default { "process.env.NODE_ENV": JSON.stringify( production ? "production" : "development" ), - "process.env.POSTHOG_TOKEN": process.env.POSTHOG_TOKEN, - "process.env.POSTHOG_URL": process.env.POSTHOG_URL, + "process.env.POSTHOG_TOKEN": JSON.stringify(process.env.POSTHOG_TOKEN), + "process.env.POSTHOG_URL": JSON.stringify(process.env.POSTHOG_URL) }), svelte({ diff --git a/packages/builder/src/builderStore/index.js b/packages/builder/src/builderStore/index.js index 159733baab..0feb0c7aa3 100644 --- a/packages/builder/src/builderStore/index.js +++ b/packages/builder/src/builderStore/index.js @@ -11,7 +11,7 @@ export const initialise = async () => { try { if (process.env.NODE_ENV === "production") { posthog.init(process.env.POSTHOG_TOKEN, { - api_host: process.env.POSTHOG_URL, + api_host: process.env.POSTHOG_URL }) } } catch (err) { diff --git a/packages/builder/src/components/settings/tabs/APIKeys.svelte b/packages/builder/src/components/settings/tabs/APIKeys.svelte index 9a7f9e044e..cfb1ff67e4 100644 --- a/packages/builder/src/components/settings/tabs/APIKeys.svelte +++ b/packages/builder/src/components/settings/tabs/APIKeys.svelte @@ -2,12 +2,14 @@ import { Input, Button } from "@budibase/bbui" import { store } from "builderStore" import api from "builderStore/api" + import posthog from "posthog-js" let keys = { budibase: "", sendGrid: "" } async function updateKey([key, value]) { const response = await api.put(`/api/keys/${key}`, { value }) const res = await response.json() + if (key === "budibase") posthog.identify(value); keys = { ...keys, ...res } }