mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-18 07:35:19 +00:00
Co-authored-by: Ishaan Shrivastava <ishaan@storyteller.ai>
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import { RemixBrowser } from "@remix-run/react";
|
|
import { startTransition, StrictMode, useEffect } from "react";
|
|
import { hydrateRoot } from "react-dom/client";
|
|
import { posthog } from "posthog-js";
|
|
import { PostHogProvider } from "posthog-js/react";
|
|
import EnvironmentVariables from "~/Classes/EnvironmentVariables";
|
|
|
|
function PosthogInit() {
|
|
useEffect(() => {
|
|
const data = EnvironmentVariables.values;
|
|
|
|
const apiKey = data.REACT_APP_PUBLIC_POSTHOG_KEY as string;
|
|
posthog.init(apiKey, {
|
|
//HACK: This is the default host from Netlify, but need to figure out why it isn't working on prod.
|
|
// api_host: data.DEPLOY_PRIME_URL + "/ingest" as string,
|
|
api_host: "https://studio.storyteller.ai/ingest" as string,
|
|
ui_host: data.REACT_APP_PUBLIC_POSTHOG_UI as string,
|
|
});
|
|
}, []);
|
|
|
|
return null;
|
|
}
|
|
|
|
startTransition(() => {
|
|
hydrateRoot(
|
|
document,
|
|
<StrictMode>
|
|
<PostHogProvider client={posthog}>
|
|
<RemixBrowser />
|
|
</PostHogProvider>
|
|
<PosthogInit />
|
|
</StrictMode>,
|
|
);
|
|
});
|