From d81aa4cdf33c6f904dcc40601d077bc70267e76f Mon Sep 17 00:00:00 2001 From: Fortune Ikechi Date: Thu, 26 Sep 2024 15:48:34 +0100 Subject: [PATCH] fixes--added posthog to docusaurus (#164) * fixes--added posthog to docusaurus Signed-off-by: Fortune Ikechi * updated posthog link Signed-off-by: Fortune Ikechi * remove commented code Signed-off-by: Fortune Ikechi --------- Signed-off-by: Fortune Ikechi --- docusaurus.config.js | 20 +++++++++----------- package-lock.json | 10 ++++++++++ package.json | 1 + static/scripts/posthog.js | 4 +++- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 3f520b9208..358c1d7b49 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -41,13 +41,6 @@ const config = { locales: ["en"], }, - scripts: [ - "https://app.posthog.com/static/array.js", - { - src: "/scripts/posthog.js", - async: true, - }, - ], presets: [ [ @@ -78,6 +71,14 @@ const config = { ], plugins: [ + [ + "posthog-docusaurus", + { + apiKey: "phc_erld9bkOOEawzcjlc0GovYRGCopzSibVHG4WKE4G5QX", + appUrl: "https://us.i.posthog.com", // optional, defaults to "https://us.i.posthog.com" + enableInDevelopment: false, // optional + }, + ], [ "@docusaurus/plugin-client-redirects", { @@ -201,10 +202,7 @@ const config = { to: "/composer", label: "Composer", }, - // { - // to: "/runtime", - // label: "Runtime", - // }, + { to: "/aiwarp", label: "AI-Warp", diff --git a/package-lock.json b/package-lock.json index 69ba60033e..5b1bf9974f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,7 @@ "install": "^0.13.0", "npm": "^10.8.3", "param-case": "^4.0.0", + "posthog-docusaurus": "^2.0.1", "prism-react-renderer": "^2.3.1", "prismjs": "^1.29.0", "process": "^0.11.10", @@ -18490,6 +18491,15 @@ "postcss": "^8.4.31" } }, + "node_modules/posthog-docusaurus": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/posthog-docusaurus/-/posthog-docusaurus-2.0.1.tgz", + "integrity": "sha512-MnZvqxvaEt48sUHdz2pvZLKBd8KCXGESq98vTpTSm8uVxtAM3ljc2orZdDErSAKp+WozVEDlQnXTCZ1wzswSYw==", + "license": "MIT", + "engines": { + "node": ">=10.15.1" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", diff --git a/package.json b/package.json index 79bc3a6ad5..257be3cd48 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "install": "^0.13.0", "npm": "^10.8.3", "param-case": "^4.0.0", + "posthog-docusaurus": "^2.0.1", "prism-react-renderer": "^2.3.1", "prismjs": "^1.29.0", "process": "^0.11.10", diff --git a/static/scripts/posthog.js b/static/scripts/posthog.js index 5b9cef21bf..0257d98301 100644 --- a/static/scripts/posthog.js +++ b/static/scripts/posthog.js @@ -1,2 +1,4 @@ !function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys onSessionId".split(" "),n=0;n