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').
1.6 KiB
1.6 KiB
@insights/next App Router Example
A Next.js 15 App Router example demonstrating all features of the @insights/next package.
Setup
-
Copy the environment template:
cp .env.local.example .env.local -
Add your Insights API key to
.env.local:NEXT_PUBLIC_INSIGHTS_KEY=phc_your_key_here NEXT_PUBLIC_INSIGHTS_HOST=https://us.i.insights.com -
From the monorepo root, export packages as tarballs:
pnpm package:watch -
In a new terminal, install dependencies and start the dev server from this directory:
pnpm install pnpm dev
Demos
| Route | Feature | Description |
|---|---|---|
/auth |
Identity | Log in/out with insights.identify() and insights.reset() |
/server-flags |
Server Components | Evaluate feature flags server-side |
/client-hooks |
React Hooks | Use useFeatureFlag and friends |
/ssr-bootstrap |
SSR Bootstrap | Feature flags on first render with no flicker |
/capture |
Event Capture | Capture custom events from client components |
Feature Flags
Create these flags in your Insights project to see the demos in action:
example-flag-- Used by the Client Hooks and SSR Bootstrap demos. Can be boolean or multivariate.