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

240 lines
8.8 KiB
TypeScript

import { combineUrl } from 'kea-router'
import { FEATURE_FLAGS, INSIGHT_VISUAL_ORDER } from 'lib/constants'
import { urls } from 'scenes/urls'
import { examples } from '~/queries/examples'
import {
DashboardFilter,
InsightsQLFilters,
InsightsQLQuery,
InsightsQLVariable,
Node,
NodeKind,
ProductItemCategory,
ProductKey,
TileFilters,
} from '~/queries/schema/schema-general'
import { isDataTableNode, isDataVisualizationNode, isInsightsQLQuery } from '~/queries/utils'
import { AlertType } from 'products/alerts/frontend/types'
import {
DashboardType,
InsightSceneSource,
InsightShortId,
InsightType,
ProductManifest,
} from '../../frontend/src/types'
export const manifest: ProductManifest = {
name: 'Product Analytics',
urls: {
insights: (): string => '/insights',
insightNew: ({
type,
dashboardId,
query,
sceneSource,
}: {
type?: InsightType
dashboardId?: DashboardType['id'] | null
query?: Node
sceneSource?: InsightSceneSource
} = {}): string => {
// Redirect InsightsQL queries to SQL editor
if (isInsightsQLQuery(query)) {
return urls.sqlEditor({ query: query.query })
}
// Redirect DataNode and DataViz queries with InsightsQL source to SQL editor,
// passing the whole node so display/chartSettings/filters survive the trip
if ((isDataVisualizationNode(query) || isDataTableNode(query)) && isInsightsQLQuery(query.source)) {
return urls.sqlEditor({ query })
}
return combineUrl('/insights/new', dashboardId ? { dashboard: dashboardId } : {}, {
...(type ? { insight: type } : {}),
...(query ? { q: typeof query === 'string' ? query : JSON.stringify(query) } : {}),
...(sceneSource ? { sceneSource } : {}),
}).url
},
insightNewInsightsQL: ({ query, filters }: { query: string; filters?: InsightsQLFilters }): string =>
urls.insightNew({
query: {
kind: NodeKind.DataTableNode,
source: { kind: 'InsightsQLQuery', query, filters },
} as any,
}),
insightEdit: (id: InsightShortId, dashboardId?: number): string =>
`/insights/${id}/edit${dashboardId ? `?dashboard=${dashboardId}` : ''}`,
insightView: (
id: InsightShortId,
dashboardId?: number,
variablesOverride?: Record<string, InsightsQLVariable>,
filtersOverride?: DashboardFilter,
tileFiltersOverride?: TileFilters
): string => {
const params = [
{ param: 'dashboard', value: dashboardId },
{ param: 'variables_override', value: variablesOverride },
{ param: 'filters_override', value: filtersOverride },
{ param: 'tile_filters_override', value: tileFiltersOverride },
]
.filter((n) => Boolean(n.value))
.map((n) => `${n.param}=${encodeURIComponent(JSON.stringify(n.value))}`)
.join('&')
return `/insights/${id}${params.length ? `?${params}` : ''}`
},
insightSubcriptions: (id: InsightShortId): string => `/insights/${id}/subscriptions`,
insightSubcription: (id: InsightShortId, subscriptionId: string): string =>
`/insights/${id}/subscriptions/${subscriptionId}`,
insightSharing: (id: InsightShortId): string => `/insights/${id}/sharing`,
savedInsights: (tab?: string): string => `/insights${tab ? `?tab=${tab}` : ''}`,
insightAlerts: (insightShortId: InsightShortId): string => `/insights/${insightShortId}/alerts`,
insightAlert: (insightShortId: InsightShortId, alertId: AlertType['id']): string =>
`/insights/${insightShortId}/alerts?alert_id=${alertId}`,
insightQuickStart: (): string => '/insights/quick-start',
},
fileSystemTypes: {
insight: {
name: 'Insight',
iconType: 'product_analytics',
href: (ref: string) => urls.insightView(ref as InsightShortId),
iconColor: ['var(--color-product-product-analytics-light)'],
filterKey: 'insight',
},
},
treeItemsNew: [
{
path: `Insight/Trends`,
type: 'insight',
href: urls.insightNew({ type: InsightType.TRENDS }),
iconType: 'insight/trends',
visualOrder: INSIGHT_VISUAL_ORDER.trends,
sceneKeys: ['Insight'],
},
{
path: `Insight/Funnel`,
type: 'insight',
href: urls.insightNew({ type: InsightType.FUNNELS }),
iconType: 'insight/funnels',
visualOrder: INSIGHT_VISUAL_ORDER.funnel,
sceneKeys: ['Insight'],
},
{
path: `Insight/Retention`,
type: 'insight',
href: urls.insightNew({ type: InsightType.RETENTION }),
iconType: 'insight/retention',
visualOrder: INSIGHT_VISUAL_ORDER.retention,
sceneKeys: ['Insight'],
},
{
path: `Insight/User paths`,
type: 'insight',
href: urls.insightNew({ type: InsightType.PATHS }),
iconType: 'insight/paths',
visualOrder: INSIGHT_VISUAL_ORDER.paths,
sceneKeys: ['Insight'],
},
{
path: `Insight/Stickiness`,
type: 'insight',
href: urls.insightNew({ type: InsightType.STICKINESS }),
iconType: 'insight/stickiness',
visualOrder: INSIGHT_VISUAL_ORDER.stickiness,
sceneKeys: ['Insight'],
},
{
path: `Insight/Lifecycle`,
type: 'insight',
href: urls.insightNew({ type: InsightType.LIFECYCLE }),
iconType: 'insight/lifecycle',
visualOrder: INSIGHT_VISUAL_ORDER.lifecycle,
sceneKeys: ['Insight'],
},
{
path: `Insight/SQL`,
type: 'insight',
href: urls.sqlEditor({ query: (examples.InsightsQLForDataVisualization as InsightsQLQuery).query }),
// The sibling insight items get a "New " prefix automatically because their hrefs include "new";
// the SQL editor href doesn't, so set the label explicitly to stay consistent.
displayLabel: 'New SQL',
iconType: 'insight/script',
visualOrder: INSIGHT_VISUAL_ORDER.sql,
sceneKeys: ['Insight'],
},
],
treeItemsProducts: [
{
path: 'Product analytics',
intents: [ProductKey.PRODUCT_ANALYTICS],
category: ProductItemCategory.ANALYTICS,
type: 'insight',
href: urls.insights(),
iconType: 'product_analytics',
iconColor: ['var(--color-product-product-analytics-light)'],
sceneKey: 'SavedInsights',
sceneKeys: ['SavedInsights', 'Insight'],
},
{
path: 'Notebooks',
intents: [ProductKey.NOTEBOOKS],
category: ProductItemCategory.TOOLS,
type: 'notebook',
iconType: 'notebook',
href: urls.notebooks(),
sceneKey: 'Notebooks',
sceneKeys: ['Notebook', 'Notebooks'],
},
],
treeItemsMetadata: [
{
path: 'Event definitions',
category: 'Schema',
iconType: 'event_definition',
href: urls.eventDefinitions(),
sceneKey: 'EventDefinitions',
sceneKeys: ['EventDefinition', 'EventDefinitions'],
},
{
path: 'Property definitions',
category: 'Schema',
iconType: 'property_definition',
href: urls.propertyDefinitions(),
sceneKey: 'PropertyDefinitions',
sceneKeys: ['PropertyDefinition', 'PropertyDefinitions'],
},
{
path: 'Property groups',
category: 'Schema',
iconType: 'event_definition',
href: urls.schemaManagement(),
flag: FEATURE_FLAGS.SCHEMA_MANAGEMENT,
},
{
path: 'SQL variables',
category: 'Schema',
href: urls.variables(),
sceneKeys: ['SqlVariableEdit'],
},
{
path: 'Annotations',
category: 'Metadata',
iconType: 'annotation',
href: urls.annotations(),
sceneKey: 'Annotations',
sceneKeys: ['Annotations'],
},
{
path: 'Comments',
category: 'Metadata',
iconType: 'comment',
href: urls.comments(),
sceneKey: 'Comments',
sceneKeys: ['Comments'],
},
],
}