From 59fa68e0639b3aa8e6a0db7e4421d51a9c9d0c94 Mon Sep 17 00:00:00 2001 From: Kharhamel Date: Fri, 8 Oct 2021 11:53:45 +0200 Subject: [PATCH] FIX: updated posthog client version and fixed a bug with its toolbar --- front/package.json | 2 +- front/src/Administration/AnalyticsClient.ts | 4 ++++ front/yarn.lock | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/front/package.json b/front/package.json index 8fd4f4c3..ec81d8a7 100644 --- a/front/package.json +++ b/front/package.json @@ -50,7 +50,7 @@ "phaser": "^3.54.0", "phaser-animated-tiles": "workadventure/phaser-animated-tiles#da68bbededd605925621dd4f03bd27e69284b254", "phaser3-rex-plugins": "^1.1.42", - "posthog-js": "^1.13.12", + "posthog-js": "^1.14.1", "queue-typescript": "^1.0.1", "quill": "1.3.6", "quill-delta-to-html": "^0.12.0", diff --git a/front/src/Administration/AnalyticsClient.ts b/front/src/Administration/AnalyticsClient.ts index f73a1981..c8f13e3c 100644 --- a/front/src/Administration/AnalyticsClient.ts +++ b/front/src/Administration/AnalyticsClient.ts @@ -1,4 +1,6 @@ import { POSTHOG_API_KEY, POSTHOG_URL } from "../Enum/EnvironmentVariable"; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +declare let window: any; class AnalyticsClient { // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -8,6 +10,8 @@ class AnalyticsClient { if (POSTHOG_API_KEY && POSTHOG_URL) { this.posthogPromise = import("posthog-js").then(({ default: posthog }) => { posthog.init(POSTHOG_API_KEY, { api_host: POSTHOG_URL, disable_cookie: true }); + //the posthog toolbar need a reference in window to be able to work + window.posthog = posthog; return posthog; }); } else { diff --git a/front/yarn.lock b/front/yarn.lock index b2c0f785..f94e659f 100644 --- a/front/yarn.lock +++ b/front/yarn.lock @@ -4494,10 +4494,10 @@ postcss@^8.2.10: nanoid "^3.1.23" source-map "^0.6.1" -posthog-js@^1.13.12: - version "1.13.12" - resolved "https://registry.yarnpkg.com/posthog-js/-/posthog-js-1.13.12.tgz#b54efcb92de43724c889048135ccaae3dc4b874c" - integrity sha512-MU1I0zSVhdCcnWI8jAZLtbNJmjfg9AnhUDq5dUzNkb0qPXtNz17BekalnNwDMKs0Zlek3UCOVsIpyc85M+VRNA== +posthog-js@^1.14.1: + version "1.14.1" + resolved "https://registry.yarnpkg.com/posthog-js/-/posthog-js-1.14.1.tgz#68553b9074c686784b994b3f433ad035b241deaa" + integrity sha512-gVFk6fsTxG9T+5oqZghffYovENSrs05v3hQMiRQENtGlsHGpt1fnoQ52En8Vg5brMxqLv1XZO4lMgm12/ubH0Q== dependencies: "@sentry/types" "^6.11.0" fflate "^0.4.1"