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').
66 lines
3.0 KiB
TypeScript
66 lines
3.0 KiB
TypeScript
import Link from 'next/link'
|
|
import { getInsights } from '@hanzo/insights-next'
|
|
|
|
export default async function ServerFlagsPage() {
|
|
const insights = await getInsights()
|
|
const allFlags = await insights.getAllFlags()
|
|
const { distinctId, sessionId } = insights.getContext() ?? {}
|
|
|
|
insights.capture({ event: 'server_flags_page_viewed' })
|
|
|
|
return (
|
|
<div>
|
|
<h1 className="text-2xl font-bold mb-2">Server-Side Feature Flags</h1>
|
|
<p className="text-gray-600 mb-6">
|
|
This page is a server component. It uses <code className="bg-gray-100 px-1 rounded">getInsights</code>{' '}
|
|
from <code className="bg-gray-100 px-1 rounded">@hanzo/insights-next</code> to evaluate feature flags and
|
|
capture events server-side.
|
|
</p>
|
|
|
|
<div className="bg-white rounded-lg border border-gray-200 p-6 mb-4">
|
|
<h2 className="font-semibold mb-2">Identity</h2>
|
|
<p className="text-sm">
|
|
Distinct ID: <code className="bg-gray-100 px-1 rounded">{distinctId ?? 'unknown'}</code>
|
|
</p>
|
|
<p className="text-sm">
|
|
Session ID: <code className="bg-gray-100 px-1 rounded">{sessionId ?? 'unknown'}</code>
|
|
</p>
|
|
<p className="text-sm text-gray-500 mt-1">
|
|
Identity is automatically read from the Insights cookie set by insights-js on the client. Try logging
|
|
in on the{' '}
|
|
<Link href="/auth" className="text-blue-600 underline">
|
|
Auth page
|
|
</Link>{' '}
|
|
and refreshing this page to see the identity change.
|
|
</p>
|
|
</div>
|
|
|
|
<div className="bg-white rounded-lg border border-gray-200 p-6">
|
|
<h2 className="font-semibold mb-2">All Feature Flags</h2>
|
|
{Object.keys(allFlags).length > 0 ? (
|
|
<table className="w-full text-sm">
|
|
<thead>
|
|
<tr className="border-b">
|
|
<th className="text-left py-2">Flag</th>
|
|
<th className="text-left py-2">Value</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{Object.entries(allFlags).map(([key, value]) => (
|
|
<tr key={key} className="border-b last:border-0">
|
|
<td className="py-2 font-mono">{key}</td>
|
|
<td className="py-2">{String(value)}</td>
|
|
</tr>
|
|
))}
|
|
</tbody>
|
|
</table>
|
|
) : (
|
|
<p className="text-sm text-gray-500">
|
|
No feature flags found. Create some flags in your Insights project to see them here.
|
|
</p>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|