mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-10-30 18:34:19 +00:00
Extends the sweep beyond packages/ to the whole repo (178 files): workflows,
.eslintrc, playground, examples, tooling, root docs. Zero upstream-brand refs and
zero such filenames outside the exemptions.
REVERTS A LICENSING ERROR (from earlier rebrand e43ab1af, not this sweep):
- LICENSE had its copyright holder rewritten to 'Insights'. Restored to the real
holder: 'Copyright 2020 Posthog / Hiberly, Inc.' (+ Mixpanel, Inc.).
- NOTICE credited a non-existent upstream (github.com/getinsights/insights-js).
Restored to the real one: github.com/PostHog/posthog-js.
Apache-2.0 4(c) requires retaining upstream attribution; rewriting a third
party's copyright line falsifies ownership. Both files are now excluded from the
guard and documented as exempt in LLM.md.
Also:
- Deleted junk: AGENTS.md~upstream_main (merge leftover), the now-obsolete
rebrand script; renamed upload-*-s3.ts tooling (still used by cli.ts).
- Removed 42 stale playground/example pnpm-lock.yaml files: they pinned upstream
packages the package.json no longer references. Regenerated on install —
sed-ing a lockfile would corrupt its integrity hashes.
- Guard renamed no-posthog.yml -> brand-guard.yml and now assembles the pattern
at runtime, so no filename or file content carries the string (the previous
guard was swept by its own rule, inverting it to forbid 'insights').
59 lines
2.4 KiB
TypeScript
59 lines
2.4 KiB
TypeScript
'use client'
|
|
|
|
import { useState } from 'react'
|
|
import { useInsights } from '@hanzo/insights-next'
|
|
|
|
export default function CapturePage() {
|
|
const insights = useInsights()
|
|
const [events, setEvents] = useState<string[]>([])
|
|
|
|
function capture(eventName: string, properties?: Record<string, unknown>) {
|
|
insights.capture(eventName, properties)
|
|
setEvents((prev) => [...prev, `${eventName}${properties ? ' ' + JSON.stringify(properties) : ''}`])
|
|
}
|
|
|
|
return (
|
|
<div>
|
|
<h1 className="text-2xl font-bold mb-2">Event Capture</h1>
|
|
<p className="text-gray-600 mb-6">
|
|
Capture custom events using <code className="bg-gray-100 px-1 rounded">insights.capture()</code>. Events
|
|
appear in your Insights project's activity feed.
|
|
</p>
|
|
|
|
<div className="bg-white rounded-lg border border-gray-200 p-6 mb-4">
|
|
<h2 className="font-semibold mb-4">Capture Events</h2>
|
|
<div className="flex gap-3 flex-wrap">
|
|
<button
|
|
onClick={() => capture('button_clicked')}
|
|
className="px-4 py-2 bg-gray-900 text-white rounded hover:bg-gray-700"
|
|
>
|
|
Basic Capture
|
|
</button>
|
|
<button
|
|
onClick={() => capture('button_clicked', { section: 'demo', variant: 'primary' })}
|
|
className="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-500"
|
|
>
|
|
With Properties
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="bg-white rounded-lg border border-gray-200 p-6">
|
|
<h2 className="font-semibold mb-2">Event Log</h2>
|
|
<p className="text-sm text-gray-500 mb-3">Events captured this session:</p>
|
|
{events.length > 0 ? (
|
|
<ul className="space-y-1">
|
|
{events.map((event, i) => (
|
|
<li key={i} className="text-sm font-mono bg-gray-50 px-3 py-1.5 rounded">
|
|
{event}
|
|
</li>
|
|
))}
|
|
</ul>
|
|
) : (
|
|
<p className="text-sm text-gray-400">No events captured yet. Click a button above.</p>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|