Files
zeekay 1b367e2b62 chore: rebase the tree onto upstream master
The tree was a debranded snapshot of upstream taken around 2026-02-20, and
upstream has moved about five months since. This replaces it with upstream
master, mechanically re-derived: bin/debrand does the rename, and the
pipeline and squashed migrations are restored from the shipped tree.

Not a merge. The previous import replaced the tree wholesale in a single
commit, so there is no shared content history to merge against. Reproducing
the rename on the new tree is what actually converges.

What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints,
compose files, LLM.md, and insights/migrations. The squashed initial
migration is load-bearing — the live database records it by name, so
upstream's ~918 individual migrations cannot come back.

Nine products are dropped as unreferenced. Twenty-one more that we do not run
are kept anyway because the core app still imports them; unpicking those is a
refactor and does not belong in a rebase.

This base does not build yet, and the reasons are not in the rename:
upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against
our 4.2, and the dependency manifests still name upstream packages that we
republish under our own names. Those are decisions, not renames.
2026-08-01 15:44:40 -07:00

208 lines
8.3 KiB
TypeScript

import { OnboardingComponentsContext, createInstallation } from 'scenes/onboarding/shared/OnboardingDocsContentWrapper'
import { StepDefinition } from '../steps'
import { SDK_DEFAULTS_DATE } from './_snippets/sdkDefaults'
export const getNuxtClientSteps = (ctx: OnboardingComponentsContext): StepDefinition[] => {
const { CodeBlock, Markdown, CalloutBox, dedent } = ctx
return [
{
title: 'Install the package',
badge: 'required',
content: (
<>
<Markdown>Install the Insights JavaScript library using your package manager:</Markdown>
<CodeBlock
blocks={[
{
language: 'bash',
file: 'npm',
code: dedent`
npm install insights-js
`,
},
{
language: 'bash',
file: 'yarn',
code: dedent`
yarn add insights-js
`,
},
{
language: 'bash',
file: 'pnpm',
code: dedent`
pnpm add insights-js
`,
},
]}
/>
<CalloutBox type="fyi" title="Nuxt version">
<Markdown>
This guide is for Nuxt v3.0 and above. For Nuxt v2.16 and below, see our [Nuxt
docs](https://hanzo.ai/docs/libraries/nuxt-js#nuxt-v216-and-below).
</Markdown>
</CalloutBox>
</>
),
},
{
title: 'Add environment variables',
badge: 'required',
content: (
<>
<Markdown>Add your Insights project token and host to your `nuxt.config.js` file:</Markdown>
<CodeBlock
blocks={[
{
language: 'javascript',
file: 'nuxt.config.js',
code: dedent`
export default defineNuxtConfig({
runtimeConfig: {
public: {
insightsPublicKey: '<ph_project_token>',
insightsHost: '<ph_client_api_host>',
insightsDefaults: '${SDK_DEFAULTS_DATE}'
}
}
})
`,
},
]}
/>
</>
),
},
{
title: 'Create a plugin',
badge: 'required',
content: (
<>
<Markdown>
Create a new plugin by creating a new file `insights.client.js` in your plugins directory:
</Markdown>
<CodeBlock
blocks={[
{
language: 'javascript',
file: 'plugins/insights.client.js',
code: dedent`
import { defineNuxtPlugin } from '#app'
import insights from 'insights-js'
export default defineNuxtPlugin(nuxtApp => {
const runtimeConfig = useRuntimeConfig();
const insightsClient = insights.init(runtimeConfig.public.insightsPublicKey, {
api_host: runtimeConfig.public.insightsHost,
defaults: runtimeConfig.public.insightsDefaults,
loaded: (insights) => {
if (import.meta.env.MODE === 'development') insights.debug();
}
})
return {
provide: {
insights: () => insightsClient
}
}
})
`,
},
]}
/>
</>
),
},
]
}
export const getNuxtServerSteps = (ctx: OnboardingComponentsContext): StepDefinition[] => {
const { CodeBlock, Markdown, dedent } = ctx
return [
{
title: 'Server-side setup',
badge: 'optional',
content: (
<>
<Markdown>
To capture events from server routes, install `insights-node` and instantiate it directly. You
can also use it to evaluate feature flags on the server:
</Markdown>
<CodeBlock
blocks={[
{
language: 'bash',
file: 'npm',
code: dedent`
npm install insights-node
`,
},
{
language: 'bash',
file: 'yarn',
code: dedent`
yarn add insights-node
`,
},
{
language: 'bash',
file: 'pnpm',
code: dedent`
pnpm add insights-node
`,
},
]}
/>
<CodeBlock
blocks={[
{
language: 'javascript',
file: 'server/api/example.js',
code: dedent`
import { Insights } from 'insights-node'
export default defineEventHandler(async (event) => {
const runtimeConfig = useRuntimeConfig()
const insights = new Insights(
runtimeConfig.public.insightsPublicKey,
{ host: runtimeConfig.public.insightsHost }
)
insights.capture({
distinctId: 'distinct_id_of_the_user',
event: 'event_name'
})
await insights.shutdown()
})
`,
},
]}
/>
</>
),
},
]
}
export const getNuxtSteps = (ctx: OnboardingComponentsContext): StepDefinition[] => {
const { snippets } = ctx
const JSEventCapture = snippets?.JSEventCapture
return [
...getNuxtClientSteps(ctx),
...getNuxtServerSteps(ctx),
{
title: 'Send events',
badge: undefined,
content: <>{JSEventCapture && <JSEventCapture />}</>,
},
]
}
export const NuxtInstallation = createInstallation(getNuxtSteps)