Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions apps/web/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,3 @@ NEXT_PUBLIC_SANITY_PROJECT_ID=jeixxcw8
MANAGEPROMPT_SECRET=
MANAGEPROMPT_CHANGEGPT_WORKFLOW_ID=

# PostHog
NEXT_PUBLIC_POSTHOG_KEY=
NEXT_PUBLIC_POSTHOG_HOST=
21 changes: 1 addition & 20 deletions apps/web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const ContentSecurityPolicy = `
style-src 'self' data: 'unsafe-inline' maxcdn.bootstrapcdn.com cdn.jsdelivr.net cdn.zapier.com fonts.googleapis.com;
img-src 'self' * data: blob:;
font-src 'self' data: maxcdn.bootstrapcdn.com cdn.jsdelivr.net fonts.gstatic.com;
connect-src 'self' wss: *.supabase.co *.changes.page manageprompt.com zapier.com *.zapier.com www.google.com *.atlassian.com us.i.posthog.com;
connect-src 'self' wss: *.supabase.co *.changes.page manageprompt.com zapier.com *.zapier.com www.google.com *.atlassian.com;
worker-src 'self' blob:;
report-to default
`;
Expand Down Expand Up @@ -66,25 +66,6 @@ const moduleExports = {
"cdn.sanity.io",
],
},
// PostHog rewrites for ingest and static assets
async rewrites() {
return [
{
source: "/ingest/static/:path*",
destination: "https://us-assets.i.posthog.com/static/:path*",
},
{
source: "/ingest/:path*",
destination: "https://us.i.posthog.com/:path*",
},
{
source: "/ingest/decide",
destination: "https://us.i.posthog.com/decide",
},
];
},
// This is required to support PostHog trailing slash API requests
skipTrailingSlashRedirect: true,
};

// ensure that your source maps include changes from all other Webpack plugins
Expand Down
3 changes: 1 addition & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@supabase/supabase-js": "^2.39.3",
"@tailwindcss/typography": "^0.5.1",
"@types/canvas-confetti": "^1.6.4",
"@vercel/analytics": "^1.5.0",
"@vercel/og": "^0.0.20",
"canvas-confetti": "^1.9.3",
"capture-node": "^2.2.0",
Expand All @@ -45,8 +46,6 @@
"next-sitemap": "^4.2.3",
"nprogress": "^0.2.0",
"openai": "^3.2.1",
"posthog-js": "^1.242.2",
"posthog-node": "^4.17.1",
"postmark": "^3.0.15",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
26 changes: 4 additions & 22 deletions apps/web/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { Analytics } from "@vercel/analytics/next";
import dynamic from "next/dynamic";
import localFont from "next/font/local";
import Head from "next/head";
import { Router } from "next/router";
import posthog from "posthog-js";
import { PostHogProvider } from "posthog-js/react";
import { useEffect } from "react";
import "../styles/global.css";
import { UserContextProvider } from "../utils/useUser";

Expand All @@ -31,24 +28,8 @@ const geist = localFont({
export default function App({ Component, pageProps }) {
const getLayout = Component.getLayout || ((page) => page);

useEffect(() => {
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, {
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
loaded: (ph) => {
if (process.env.NODE_ENV === "development") ph.debug();
},
debug: process.env.NODE_ENV === "development",
});

const handleRouteChange = () => posthog.capture("$pageview");
Router.events.on("routeChangeComplete", handleRouteChange);
return () => {
Router.events.off("routeChangeComplete", handleRouteChange);
};
}, []);

return (
<PostHogProvider client={posthog}>
<>
<Head>
<meta
name="viewport"
Expand All @@ -64,6 +45,7 @@ export default function App({ Component, pageProps }) {
{getLayout(<Component {...pageProps} />)}
<ProgressBar />
</UserContextProvider>
</PostHogProvider>
<Analytics />
</>
);
}
10 changes: 0 additions & 10 deletions apps/web/utils/posthog.ts

This file was deleted.

6 changes: 0 additions & 6 deletions apps/web/utils/useUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
User,
} from "@supabase/supabase-js";
import { useRouter } from "next/router";
import posthog from "posthog-js";
import {
createContext,
useCallback,
Expand Down Expand Up @@ -70,7 +69,6 @@ export const UserContextProvider = ({
const signOut = useCallback(async () => {
const { error } = await supabase.auth.signOut();

posthog.reset();
setBillingDetails(null);
await router.replace(ROUTES.HOME);

Expand Down Expand Up @@ -109,10 +107,6 @@ export const UserContextProvider = ({
fetchBilling().then(() => {
setLoading(false);
});
posthog.identify(user.id, {
email: user.email,
name: user.user_metadata?.full_name,
});
} else {
setLoading(false);
}
Expand Down
99 changes: 34 additions & 65 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.