'use client' import { components } from 'api-types' import { useRouter } from 'next/compat/router' import { usePathname } from 'next/navigation' import Script from 'next/script' import { useCallback, useEffect, useRef } from 'react' import { useLatest } from 'react-use' import { useUser } from './auth' import { hasConsented } from './consent-state' import { IS_PLATFORM, IS_PROD, LOCAL_STORAGE_KEYS } from './constants' import { useFeatureFlags } from './feature-flags' import { post } from './fetchWrappers' import { ensurePlatformSuffix, isBrowser } from './helpers' import { useParams, useTelemetryCookie } from './hooks' import { TelemetryEvent } from './telemetry-constants' import { clearTelemetryDataCookie, getSharedTelemetryData, getTelemetryCookieOptions, } from './telemetry-utils' import { posthogClient } from './posthog-client' export { posthogClient } const { TELEMETRY_DATA } = LOCAL_STORAGE_KEYS // Reexports GoogleTagManager with the right API key set export const TelemetryTagManager = () => { const isGTMEnabled = Boolean(IS_PLATFORM && process.env.NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID) if (!isGTMEnabled) { return } return (