import type { AppProps } from 'next/app' ; import type { LayoutProps } from '@vercel/examples-ui/layout' ; import { getLayout } from '@vercel/examples-ui' ; import '@vercel/examples-ui/globals.css' ; import Cookies from 'js-cookie' ; import { usePostHog } from '@lib/posthog' ; import { PostHog } from 'posthog-js' ; export default function MyApp ( { Component , pageProps } ) { const Layout = getLayout < LayoutProps > ( Component ) ; usePostHog ( process . env . NEXT_PUBLIC_POSTHOG_PROJECT_API_KEY , { api_host : process . env . NEXT_PUBLIC_POSTHOG_HOST , loaded : ( posthog ) => { Cookies . set ( 'distinct_id' , posthog . get_distinct_id ( ) ) ; } , } ) ; return ( < Layout title = "AB testing with PostHog" path = "edge-functions/feature-flag-posthog" deployButton = { { env : [ 'NEXT_PUBLIC_POSTHOG_PROJECT_API_KEY' ] , } } > < Component { ... pageProps } / > < /Layout>); }