From f9190c1ed779ac5b7041b24d7d3de248de5f8685 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 28 Jan 2021 19:32:13 +0000 Subject: [PATCH 1/3] privacy features + allow builder usage without cloud API key --- packages/builder/src/analytics.js | 13 +++ .../DatasourceNavigator/icons/ArangoDB.svelte | 53 ++++++++---- .../components/settings/tabs/APIKeys.svelte | 10 ++- .../start/BuilderSettingsModal.svelte | 21 +++++ .../components/start/CreateAppModal.svelte | 42 +--------- .../pages/[application]/deploy/index.svelte | 12 +++ packages/builder/src/pages/index.svelte | 5 +- packages/server/yarn.lock | 81 ++++++++++++++++++- 8 files changed, 172 insertions(+), 65 deletions(-) diff --git a/packages/builder/src/analytics.js b/packages/builder/src/analytics.js index f59d71ac30..c68f228c12 100644 --- a/packages/builder/src/analytics.js +++ b/packages/builder/src/analytics.js @@ -106,6 +106,16 @@ function highlightFeedbackIcon() { return isFeedbackTimeElapsed(firstRunStr) } +// Opt In/Out +const ifAnalyticsEnabled = func => () => { + if (analyticsEnabled && process.env.POSTHOG_TOKEN) { + return func() + } +} +const disabled = () => posthog.has_opted_out_capturing() +const optIn = () => posthog.opt_in_capturing() +const optOut = () => posthog.opt_out_capturing() + export default { activate, identify, @@ -115,4 +125,7 @@ export default { requestFeedbackOnDeploy, submitFeedback, highlightFeedbackIcon, + disabled: ifAnalyticsEnabled(disabled), + optIn: ifAnalyticsEnabled(optIn), + optOut: ifAnalyticsEnabled(optOut), } diff --git a/packages/builder/src/components/backend/DatasourceNavigator/icons/ArangoDB.svelte b/packages/builder/src/components/backend/DatasourceNavigator/icons/ArangoDB.svelte index 0be4ca2663..d305c08af0 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/icons/ArangoDB.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/icons/ArangoDB.svelte @@ -3,20 +3,39 @@ export let height = "100" - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + diff --git a/packages/builder/src/components/settings/tabs/APIKeys.svelte b/packages/builder/src/components/settings/tabs/APIKeys.svelte index 8e569596a4..82e66a12fd 100644 --- a/packages/builder/src/components/settings/tabs/APIKeys.svelte +++ b/packages/builder/src/components/settings/tabs/APIKeys.svelte @@ -1,6 +1,7 @@