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

55 lines
2.0 KiB
TypeScript

import Insights from 'insights-react-native'
// If you want to use Session relay on React Native web, use the @hanzo/insights SDK instead.
// Example:
//
// import insights from '@hanzo/insights'
//
// insights.init(process.env.EXPO_PUBLIC_INSIGHTS_PROJECT_API_KEY!, {
// host: process.env.EXPO_PUBLIC_INSIGHTS_API_HOST,
// debug: true,
// })
//
// export { insights }
export const insights = new Insights(process.env.EXPO_PUBLIC_INSIGHTS_PROJECT_API_KEY!, {
host: process.env.EXPO_PUBLIC_INSIGHTS_API_HOST,
flushAt: 1,
enableSessionReplay: true,
captureAppLifecycleEvents: true,
errorTracking: {
autocapture: {
uncaughtExceptions: true,
unhandledRejections: true,
console: ['error', 'warn'],
},
},
// Inject X-INSIGHTS-DISTINCT-ID and X-INSIGHTS-SESSION-ID on outgoing fetch
// requests to these hostnames. Used by the Tracing Headers screen to verify
// the patch works end-to-end; see https://insights.hanzo.ai/docs/llm-analytics/link-session-replay
addTracingHeaders: ['httpbin.org'],
logs: {
serviceName: 'expo-example',
environment: 'dev',
serviceVersion: '0.0.1',
// The /logs dev-tools panel toggles `beforeSendMode.current` at
// runtime. The closure here reads it on every capture, so the
// behavior switches without re-constructing the SDK or touching
// private internals. Customers wiring runtime-tunable filters
// should follow this pattern.
beforeSend: (record) => {
if (beforeSendMode.current === 'drop') return null
if (beforeSendMode.current === 'throw') throw new Error('beforeSend boom')
return record
},
},
// persistence: 'memory',
// if using WebView, you have to disable masking for text inputs and images
// sessionReplayConfig: {
// maskAllTextInputs: false,
// maskAllImages: false,
// },
})
insights.debug(true)