Files
zeekay 043ac58d3c chore: sweep upstream brand from ALL files; restore LICENSE/NOTICE attribution
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').
2026-07-16 09:54:05 -07:00

85 lines
3.2 KiB
TypeScript

'use client'
import { useState } from 'react'
import Link from 'next/link'
import { useInsights } from '@hanzo/insights-next'
export default function AuthPage() {
const insights = useInsights()
const [email, setEmail] = useState('[email protected]')
const [loggedInAs, setLoggedInAs] = useState<string | null>(() => {
if (typeof window !== 'undefined') {
return localStorage.getItem('insights-example-user')
}
return null
})
function handleLogin(e: React.FormEvent) {
e.preventDefault()
if (!email) return
insights.identify(email, { email })
localStorage.setItem('insights-example-user', email)
setLoggedInAs(email)
setEmail('')
window.dispatchEvent(new Event('auth-change'))
}
function handleLogout() {
insights.reset()
localStorage.removeItem('insights-example-user')
setLoggedInAs(null)
window.dispatchEvent(new Event('auth-change'))
}
return (
<div>
<h1 className="text-2xl font-bold mb-2">Authentication</h1>
<p className="text-gray-600 mb-6">
This demo uses <code className="bg-gray-100 px-1 rounded">insights.identify()</code> and{' '}
<code className="bg-gray-100 px-1 rounded">insights.reset()</code> to manage user identity. After logging
in, visit the{' '}
<Link href="/server-flags" className="text-blue-600 underline">
Server Flags
</Link>{' '}
page to see the same identity reflected server-side.
</p>
{loggedInAs ? (
<div className="bg-white rounded-lg border border-gray-200 p-6">
<p className="mb-4">
Logged in as <strong>{loggedInAs}</strong>
</p>
<p className="text-sm text-gray-500 mb-4">
Distinct ID: <code className="bg-gray-100 px-1 rounded">{insights.get_distinct_id()}</code>
</p>
<button
onClick={handleLogout}
className="px-4 py-2 bg-gray-900 text-white rounded hover:bg-gray-700"
>
Log out
</button>
</div>
) : (
<form onSubmit={handleLogin} className="bg-white rounded-lg border border-gray-200 p-6">
<label htmlFor="email" className="block mb-2 text-sm font-medium">
Email
</label>
<input
id="email"
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
placeholder="[email protected]"
className="w-full px-3 py-2 border border-gray-300 rounded mb-4"
required
/>
<button type="submit" className="px-4 py-2 bg-gray-900 text-white rounded hover:bg-gray-700">
Log in
</button>
</form>
)}
</div>
)
}