-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b61e888
commit dd47a76
Showing
22 changed files
with
108 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
NEXT_PUBLIC_SUPABASE_URL= | ||
NEXT_PUBLIC_SUPABASE_ANON_KEY= | ||
SUPABASE_URL= | ||
SUPABASE_ANON_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* eslint-disable no-restricted-properties */ | ||
import { createEnv } from '@t3-oss/env-nextjs'; | ||
import { z } from 'zod'; | ||
|
||
export const clientEnv = createEnv({ | ||
client: { | ||
NEXT_PUBLIC_VERCEL_ENV: z | ||
.enum(['development', 'preview', 'production']) | ||
.optional(), | ||
NEXT_PUBLIC_POSTHOG_KEY: z.string().min(1), | ||
}, | ||
runtimeEnv: { | ||
NEXT_PUBLIC_VERCEL_ENV: process.env.NEXT_PUBLIC_VERCEL_ENV, | ||
NEXT_PUBLIC_POSTHOG_KEY: process.env.NEXT_PUBLIC_POSTHOG_KEY, | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import { serverEnv } from './env/server-env'; | ||
|
||
export async function register() { | ||
if (typeof globalThis.EdgeRuntime !== 'string') { | ||
if (serverEnv.NEXT_RUNTIME === 'nodejs') { | ||
await import('../sentry.server.config'); | ||
} else { | ||
} | ||
|
||
if (serverEnv.NEXT_RUNTIME === 'edge') { | ||
await import('../sentry.edge.config'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
'use client'; | ||
|
||
import { clientEnv } from '@/env/client'; | ||
import { clientEnv } from '@/env/client-env'; | ||
import posthog from 'posthog-js'; | ||
import { PostHogProvider } from 'posthog-js/react'; | ||
|
||
if ( | ||
typeof window !== 'undefined' && | ||
clientEnv.NEXT_PUBLIC_VERCEL_ENV === 'production' | ||
) { | ||
posthog.init(clientEnv.NEXT_PUBLIC_POSTHOG_KEY, { | ||
api_host: '/_proxy/posthog', | ||
ui_host: 'https://eu.posthog.com', | ||
person_profiles: 'identified_only', | ||
capture_pageview: false, | ||
capture_pageleave: true, | ||
loaded: (posthog) => { | ||
if (clientEnv.NEXT_PUBLIC_VERCEL_ENV === 'development') | ||
posthog.debug(true); | ||
}, | ||
}); | ||
} | ||
import { useEffect } from 'react'; | ||
|
||
interface AnalyticsProviderProps { | ||
children: React.ReactNode; | ||
enabled?: boolean; | ||
} | ||
export function AnalyticsProvider({ children }: AnalyticsProviderProps) { | ||
export function AnalyticsProvider({ | ||
children, | ||
enabled = false, | ||
}: AnalyticsProviderProps) { | ||
useEffect(() => { | ||
if (enabled && typeof window !== 'undefined') { | ||
posthog.init(clientEnv.NEXT_PUBLIC_POSTHOG_KEY, { | ||
api_host: '/_proxy/posthog', | ||
ui_host: 'https://eu.posthog.com', | ||
person_profiles: 'identified_only', | ||
capture_pageview: false, | ||
capture_pageleave: true, | ||
loaded: (posthog) => { | ||
if (clientEnv.NEXT_PUBLIC_VERCEL_ENV === 'development') | ||
posthog.debug(true); | ||
}, | ||
}); | ||
} | ||
}, [enabled]); | ||
|
||
return <PostHogProvider client={posthog}>{children}</PostHogProvider>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.