export declare const TRACKER_COMPONENT_SOURCE = "import { useEffect } from 'react'\nimport { useRouter } from 'next/router'\nimport {\n initTeleportAnalytics,\n resetCommerceView,\n trackCommerceEvent,\n trackCommerceView,\n trackRouteChange,\n trackRouteLeave,\n} from '../../lib/teleport-analytics'\n\nconst AnalyticsTracker = () => {\n const router = useRouter()\n\n useEffect(() => {\n initTeleportAnalytics()\n\n // The commerce funnel is fired from WORKFLOWS (add-to-cart, checkout), whose\n // handlers are serialized function bodies evaluated at runtime \u2014 they have no\n // module scope and cannot import anything. A global is the only channel they\n // can reach, so the tracker publishes one here.\n //\n // Callers guard with \"window.tpTrackCommerce && window.tpTrackCommerce(...)\",\n // so a project with analytics disabled (where this component is never\n // emitted) simply does nothing instead of throwing inside a checkout.\n window.tpTrackCommerce = trackCommerceEvent\n\n // A page declares its funnel step with a data attribute (see\n // trackCommerceView). Deferred to the next frame because the marker element\n // is part of the page that is still painting when this effect runs.\n const reportCommerceView = () => {\n window.requestAnimationFrame(() => trackCommerceView())\n }\n reportCommerceView()\n\n const handleRouteChangeStart = (url) => trackRouteLeave(url)\n const handleRouteChangeComplete = (url) => {\n trackRouteChange(url)\n // A client-side navigation is a new page load as far as the funnel is\n // concerned, so the once-per-view guard has to be released first.\n resetCommerceView()\n reportCommerceView()\n }\n\n router.events.on('routeChangeStart', handleRouteChangeStart)\n router.events.on('routeChangeComplete', handleRouteChangeComplete)\n\n return () => {\n router.events.off('routeChangeStart', handleRouteChangeStart)\n router.events.off('routeChangeComplete', handleRouteChangeComplete)\n // Left in place deliberately on unmount: this component lives in _app for\n // the whole session, and removing the global during a fast-refresh remount\n // would break any in-flight checkout handler holding a reference to it.\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n return null\n}\n\nexport default AnalyticsTracker\n"; //# sourceMappingURL=tracker-component.d.ts.map