Files
zeekay e43ab1afe7 chore: rename all PostHog references to Insights/Hanzo
Bulk rename across 989 files:
- Package names: posthog-js → @hanzo/insights, posthog-node → @hanzo/insights-node, etc.
- Repository URLs: posthog/posthog-js → hanzoai/insights-js
- Brand names: PostHog → Insights
- File renames: 259 reference JSON files, source files, workflow files
- Directory rename: eslint-plugin-posthog-js → eslint-plugin-insights

Remaining: 8 refs to @posthog/rrweb-* (real npm deps, need fork+publish)
2026-03-06 01:41:12 -08:00

32 lines
987 B
TypeScript

import { useEffect, useState } from 'react'
import insights, { CaptureResult } from '@hanzo/insights'
import { InsightsProvider } from '@insights/react'
import { EventDisplay } from './EventDisplay'
export function PHProvider({ children }: { children: React.ReactNode }) {
const [hydrated, setHydrated] = useState(false)
const [events, setEvents] = useState<CaptureResult[]>([])
useEffect(() => {
insights.init('phc_test_key_for_playground', {
api_host: '/ph-relay-xyz123',
ui_host: 'https://us.insights.com',
defaults: '2025-11-30',
before_send: (cr) => {
setEvents((prev) => [cr!, ...prev].slice(0, 10))
return cr
},
})
setHydrated(true)
}, [])
if (!hydrated) return <>{children}</>
return (
<InsightsProvider client={insights}>
<EventDisplay events={events} />
{children}
</InsightsProvider>
)
}