:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
// Pure JSONContent factories for notebook nodes.
//
// Kept in a standalone module so callers (e.g. SlashCommands) can build node content without
// pulling in the node modules themselves. The node modules import `createPostHogWidgetNode` from
// `NodeWrapper`, and `NodeWrapper` imports `SlashCommandsPopover` from `SlashCommands` — putting
// the builders in either node module creates a circular import that surfaces as
// `createPostHogWidgetNode is not a function` at module-evaluation time.
import { JSONContent } from 'lib/components/RichContentEditor/types'
import { NodeKind, QuerySchema } from '~/queries/schema/schema-general'
import { InsightQueryNode } from '~/queries/schema/schema-general'
import { NotebookNodeType } from '../types'
export function buildNodeEmbed(): JSONContent {
return {
type: NotebookNodeType.Embed,
attrs: {
__init: {
showSettings: true,
},
},
}
}
export function buildNodeQueryContent(query: QuerySchema): JSONContent {
return {
type: NotebookNodeType.Query,
attrs: {
query: query,
showSettings: true,
},
}
}
export function buildInsightVizQueryContent(source: InsightQueryNode): JSONContent {
return buildNodeQueryContent({ kind: NodeKind.InsightVizNode, source: source })
}