mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-11-02 14:31:14 +00:00
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)
35 lines
986 B
TypeScript
35 lines
986 B
TypeScript
import { useInsights } from '@hanzo/insights/react'
|
|
import { useEffect, useState } from 'react'
|
|
|
|
export default function Home() {
|
|
const insights = useInsights()
|
|
|
|
const [otherHost, setOtherHost] = useState('')
|
|
|
|
useEffect(() => {
|
|
setOtherHost(window.location.origin.includes('other-localhost') ? 'localhost' : 'other-localhost')
|
|
})
|
|
|
|
return (
|
|
<>
|
|
<h1>Iframes</h1>
|
|
|
|
<h2>Cross origin iframe</h2>
|
|
<p>
|
|
This loads the same page but from <b>other-localhost</b> which you need to add to your hosts file.
|
|
</p>
|
|
|
|
{otherHost && (
|
|
<iframe
|
|
className="border rounded"
|
|
src={`http://${otherHost}:3000/`}
|
|
style={{ width: '100%', height: '500px' }}
|
|
onLoad={() => {
|
|
insights.capture('iframe loaded')
|
|
}}
|
|
/>
|
|
)}
|
|
</>
|
|
)
|
|
}
|