mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-11-03 00:53:53 +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').
135 lines
5.0 KiB
TypeScript
135 lines
5.0 KiB
TypeScript
import { Image } from 'expo-image'
|
|
import { Platform, StyleSheet, Button, View } from 'react-native'
|
|
import { Link } from 'expo-router'
|
|
|
|
import { HelloWave } from '@/components/HelloWave'
|
|
import ParallaxScrollView from '@/components/ParallaxScrollView'
|
|
import { ThemedText } from '@/components/ThemedText'
|
|
import { ThemedView } from '@/components/ThemedView'
|
|
import { insights } from '../insights'
|
|
import { useState } from 'react'
|
|
|
|
export default function HomeScreen() {
|
|
const [buttonText, setButtonText] = useState(
|
|
`Tap the Explore tab to learn more about what's included in this starter app.`
|
|
)
|
|
const [replayStatus, setReplayStatus] = useState('Unknown')
|
|
|
|
const handleClick = () => {
|
|
insights.capture('button_clicked', { name: 'example' })
|
|
setButtonText('button_clicked' + new Date().toISOString())
|
|
}
|
|
|
|
const handleStartRecording = async (resumeCurrent: boolean) => {
|
|
try {
|
|
await insights.startSessionRecording(resumeCurrent)
|
|
setReplayStatus(`Started (resume=${resumeCurrent})`)
|
|
} catch (e) {
|
|
setReplayStatus(`Error: ${e}`)
|
|
}
|
|
|
|
const handleStopRecording = async () => {
|
|
try {
|
|
await insights.stopSessionRecording()
|
|
setReplayStatus('Stopped')
|
|
} catch (e) {
|
|
setReplayStatus(`Error: ${e}`)
|
|
}
|
|
|
|
const handleCheckStatus = async () => {
|
|
try {
|
|
const isActive = await insights.isSessionReplayActive()
|
|
setReplayStatus(`Active: ${isActive}`)
|
|
} catch (e) {
|
|
setReplayStatus(`Error: ${e}`)
|
|
}
|
|
|
|
const handleCheckStatus = async () => {
|
|
try {
|
|
const isActive = await insights.isSessionReplayActive()
|
|
setReplayStatus(`Active: ${isActive}`)
|
|
} catch (e) {
|
|
setReplayStatus(`Error: ${e}`)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<ParallaxScrollView
|
|
headerBackgroundColor={{ light: '#A1CEDC', dark: '#1D3D47' }}
|
|
headerImage={<Image source={require('@/assets/images/partial-react-logo.png')} style={styles.reactLogo} />}
|
|
>
|
|
<ThemedView style={styles.titleContainer}>
|
|
<ThemedText type="title">Welcome!</ThemedText>
|
|
<HelloWave />
|
|
</ThemedView>
|
|
<ThemedView style={styles.stepContainer}>
|
|
<ThemedText type="subtitle">Step 1: Try it</ThemedText>
|
|
<ThemedText>
|
|
Edit <ThemedText type="defaultSemiBold">app/(tabs)/index.tsx</ThemedText> to see changes. Press{' '}
|
|
<ThemedText type="defaultSemiBold">
|
|
{Platform.select({
|
|
ios: 'cmd + d',
|
|
android: 'cmd + m',
|
|
web: 'F12',
|
|
})}
|
|
</ThemedText>{' '}
|
|
to open developer tools.
|
|
</ThemedText>
|
|
</ThemedView>
|
|
<ThemedView style={styles.stepContainer}>
|
|
<ThemedText type="subtitle">Step 2: Explore</ThemedText>
|
|
<ThemedText onPress={handleClick}>{buttonText}</ThemedText>
|
|
</ThemedView>
|
|
<ThemedView style={styles.stepContainer}>
|
|
<ThemedText type="subtitle">Step 3: Get a fresh start</ThemedText>
|
|
<ThemedText>
|
|
{`When you're ready, run `}
|
|
<ThemedText type="defaultSemiBold">npm run reset-project</ThemedText> to get a fresh{' '}
|
|
<ThemedText type="defaultSemiBold">app</ThemedText> directory. This will move the current{' '}
|
|
<ThemedText type="defaultSemiBold">app</ThemedText> to{' '}
|
|
<ThemedText type="defaultSemiBold">app-example</ThemedText>.
|
|
</ThemedText>
|
|
</ThemedView>
|
|
<ThemedView style={styles.stepContainer}>
|
|
<ThemedText type="subtitle">Surveys</ThemedText>
|
|
<Link href="/surveys" asChild>
|
|
<Button title="Open survey demo" />
|
|
</Link>
|
|
</ThemedView>
|
|
<ThemedView style={styles.stepContainer}>
|
|
<ThemedText type="subtitle">Session Replay Controls</ThemedText>
|
|
<ThemedText>Status: {replayStatus}</ThemedText>
|
|
<View style={styles.buttonContainer}>
|
|
<Button title="Start (Resume)" onPress={() => handleStartRecording(true)} />
|
|
<Button title="Start (New)" onPress={() => handleStartRecording(false)} />
|
|
<Button title="Stop" onPress={handleStopRecording} />
|
|
<Button title="Check Status" onPress={handleCheckStatus} />
|
|
</View>
|
|
</ThemedView>
|
|
</ParallaxScrollView>
|
|
)
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
titleContainer: {
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
gap: 8,
|
|
},
|
|
stepContainer: {
|
|
gap: 8,
|
|
marginBottom: 8,
|
|
},
|
|
buttonContainer: {
|
|
gap: 8,
|
|
marginTop: 8,
|
|
},
|
|
reactLogo: {
|
|
height: 178,
|
|
width: 290,
|
|
bottom: 0,
|
|
left: 0,
|
|
position: 'absolute',
|
|
},
|
|
})
|