Skip to content

: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.

chore(product-analytics): move the last product-only files into the product (#120254)

Thomas Obermüller916cdfbc974c
diff --git a/common/storybook/.storybook/README.md b/common/storybook/.storybook/README.md
index 05745cad0de4..ccef9cc56533 100644
--- a/common/storybook/.storybook/README.md
+++ b/common/storybook/.storybook/README.md
@@ -53,4 +53,4 @@ MyStoryViewports.parameters = {
Each width generates a separate snapshot file suffixed with the width name,
e.g. `my-story-viewports--medium--light.png`.
-See `frontend/src/scenes/insights/stories/TrendsLine.stories.tsx` for a working example.
+See `frontend/src/scenes/data-management/definition/DefinitionView.stories.tsx` for a working example.
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e45ce6d0d10d..f20f2f51c568 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -4474,6 +4474,9 @@ importers:
specifier: 18.3.1
version: 18.3.1
devDependencies:
+ '@storybook/react':
+ specifier: 'catalog:'
kea-test-utils:
specifier: 'catalog:'
version: 0.2.4([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))
@@ -4643,12 +4646,18 @@ importers:
'@storybook/react':
specifier: 'catalog:'
+ '@testing-library/dom':
+ specifier: '*'
+ version: 10.4.0
'@testing-library/jest-dom':
specifier: '*'
version: 5.17.0
'@testing-library/react':
specifier: '*'
+ '@testing-library/user-event':
+ specifier: '*'
+ version: 14.6.1(@testing-library/[email protected])
kea-test-utils:
specifier: 'catalog:'
version: 0.2.4([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))
diff --git a/frontend/src/scenes/persons-management/Persons.stories.tsx b/products/persons/frontend/pages/Persons.stories.tsx
similarity index 100%
rename from frontend/src/scenes/persons-management/Persons.stories.tsx
rename to products/persons/frontend/pages/Persons.stories.tsx
diff --git a/products/persons/package.json b/products/persons/package.json
index 08b507ea0f4a..852e93df75cd 100644
--- a/products/persons/package.json
+++ b/products/persons/package.json
@@ -9,6 +9,7 @@
"posthog-js": "catalog:"
},
"devDependencies": {
+ "@storybook/react": "catalog:",
"kea-test-utils": "catalog:"
},
"peerDependencies": {
diff --git a/frontend/src/scenes/insights/stories/MCPMissingCapability.stories.tsx b/products/product_analytics/frontend/insights/insightScene/MCPMissingCapability.stories.tsx
similarity index 91%
rename from frontend/src/scenes/insights/stories/MCPMissingCapability.stories.tsx
rename to products/product_analytics/frontend/insights/insightScene/MCPMissingCapability.stories.tsx
index e568096efe8b..c82c3ff17b1b 100644
--- a/frontend/src/scenes/insights/stories/MCPMissingCapability.stories.tsx
+++ b/products/product_analytics/frontend/insights/insightScene/MCPMissingCapability.stories.tsx
@@ -5,8 +5,7 @@ import { Meta, StoryObj } from '@storybook/react'
import { createInsightStory } from 'scenes/insights/__mocks__/createInsightScene'
import { mswDecorator } from '~/mocks/browser'
-
-import __mcpMissingCapability from '../../../mocks/fixtures/api/projects/team_id/insights/mcpMissingCapability.json'
+import __mcpMissingCapability from '~/mocks/fixtures/api/projects/team_id/insights/mcpMissingCapability.json'
type Story = StoryObj<{}>
const meta: Meta = {
diff --git a/frontend/src/scenes/insights/stories/SQLBoxPlot.stories.tsx b/products/product_analytics/frontend/insights/insightScene/SQLBoxPlot.stories.tsx
similarity index 97%
rename from frontend/src/scenes/insights/stories/SQLBoxPlot.stories.tsx
rename to products/product_analytics/frontend/insights/insightScene/SQLBoxPlot.stories.tsx
index 693fcdecc6ce..6a4be56e453c 100644
--- a/frontend/src/scenes/insights/stories/SQLBoxPlot.stories.tsx
+++ b/products/product_analytics/frontend/insights/insightScene/SQLBoxPlot.stories.tsx
@@ -6,10 +6,9 @@ import { useEffect, useRef } from 'react'
import { createInsightStory } from 'scenes/insights/__mocks__/createInsightScene'
import { mswDecorator } from '~/mocks/browser'
+import __sqlBoxPlot from '~/mocks/fixtures/api/projects/team_id/insights/sqlBoxPlot.json'
import { AccessControlLevel, AccessControlResourceType } from '~/types'
-import __sqlBoxPlot from '../../../mocks/fixtures/api/projects/team_id/insights/sqlBoxPlot.json'
-
const availableSources = {
Postgres: { name: 'Postgres', iconPath: '/static/services/postgres.png', fields: [], caption: '', featured: true },
Stripe: { name: 'Stripe', iconPath: '/static/services/stripe.png', fields: [], caption: '', featured: true },
diff --git a/frontend/src/scenes/insights/stories/SQLLineChart.stories.tsx b/products/product_analytics/frontend/insights/insightScene/SQLLineChart.stories.tsx
similarity index 84%
rename from frontend/src/scenes/insights/stories/SQLLineChart.stories.tsx
rename to products/product_analytics/frontend/insights/insightScene/SQLLineChart.stories.tsx
index 60ac3c44f416..e47ff39f4d43 100644
--- a/frontend/src/scenes/insights/stories/SQLLineChart.stories.tsx
+++ b/products/product_analytics/frontend/insights/insightScene/SQLLineChart.stories.tsx
@@ -5,11 +5,10 @@ import { Meta, StoryObj } from '@storybook/react'
import { createInsightStory } from 'scenes/insights/__mocks__/createInsightScene'
import { mswDecorator } from '~/mocks/browser'
-
-import __sqlBarChartValueLabels from '../../../mocks/fixtures/api/projects/team_id/insights/sqlBarChartValueLabels.json'
-import __sqlLineChart from '../../../mocks/fixtures/api/projects/team_id/insights/sqlLineChart.json'
-import __sqlLineChartBreakdown from '../../../mocks/fixtures/api/projects/team_id/insights/sqlLineChartBreakdown.json'
-import __sqlLineChartTrendLine from '../../../mocks/fixtures/api/projects/team_id/insights/sqlLineChartTrendLine.json'
+import __sqlBarChartValueLabels from '~/mocks/fixtures/api/projects/team_id/insights/sqlBarChartValueLabels.json'
+import __sqlLineChart from '~/mocks/fixtures/api/projects/team_id/insights/sqlLineChart.json'
+import __sqlLineChartBreakdown from '~/mocks/fixtures/api/projects/team_id/insights/sqlLineChartBreakdown.json'
+import __sqlLineChartTrendLine from '~/mocks/fixtures/api/projects/team_id/insights/sqlLineChartTrendLine.json'
type Story = StoryObj<{}>
const meta: Meta = {
diff --git a/frontend/src/scenes/insights/stories/SQLTableConditionalFormatting.stories.tsx b/products/product_analytics/frontend/insights/insightScene/SQLTableConditionalFormatting.stories.tsx
similarity index 100%
rename from frontend/src/scenes/insights/stories/SQLTableConditionalFormatting.stories.tsx
rename to products/product_analytics/frontend/insights/insightScene/SQLTableConditionalFormatting.stories.tsx
diff --git a/products/product_analytics/frontend/insights/shared/InsightSeriesTooltip.tsx b/products/product_analytics/frontend/insights/shared/InsightSeriesTooltip.tsx
index 7e043506c063..ef557da34902 100644
--- a/products/product_analytics/frontend/insights/shared/InsightSeriesTooltip.tsx
+++ b/products/product_analytics/frontend/insights/shared/InsightSeriesTooltip.tsx
@@ -11,7 +11,6 @@ import { shortTimeZone } from 'lib/utils/timezones'
import { formatAggregationAxisValue } from 'scenes/insights/aggregationAxisFormat'
import { formatAggregationValue } from 'scenes/insights/utils'
import type { ResultSeries } from 'scenes/insights/utils/resultSeries'
-import { getResultSeriesName } from 'scenes/insights/utils/resultSeriesName'
import { teamLogic } from 'scenes/teamLogic'
import { propertyDefinitionsModel } from '~/models/propertyDefinitionsModel'
@@ -26,6 +25,7 @@ import {
SeriesDatum,
} from 'products/product_analytics/frontend/insights/shared/InsightTooltip/insightTooltipUtils'
+import { getResultSeriesName } from './resultSeriesName'
import { getSeriesIdentification, type SeriesIdentification } from './seriesIdentification'
// ── Types ──────────────────────────────────────────────────────────────────
diff --git a/products/product_analytics/frontend/insights/shared/InsightsTable/InsightsTable.tsx b/products/product_analytics/frontend/insights/shared/InsightsTable/InsightsTable.tsx
index 00b5af4fde2f..1a0b22d02427 100644
--- a/products/product_analytics/frontend/insights/shared/InsightsTable/InsightsTable.tsx
+++ b/products/product_analytics/frontend/insights/shared/InsightsTable/InsightsTable.tsx
@@ -12,7 +12,6 @@ import { entityFilterLogic } from 'scenes/insights/filters/ActionFilter/entityFi
import { insightLogic } from 'scenes/insights/insightLogic'
import { formatBreakdownLabel } from 'scenes/insights/utils'
import { getResultSeries, getResultSeriesIndex } from 'scenes/insights/utils/resultSeries'
-import { getResultSeriesName } from 'scenes/insights/utils/resultSeriesName'
import { teamLogic } from 'scenes/teamLogic'
import { cohortsModel } from '~/models/cohortsModel'
@@ -21,6 +20,7 @@ import { extractDisplayLabel } from '~/queries/nodes/DataTable/utils'
import { hasBreakdownFilter } from '~/queries/utils'
import { ChartDisplayType, TrendsFilterType } from '~/types'
+import { getResultSeriesName } from 'products/product_analytics/frontend/insights/shared/resultSeriesName'
import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'
import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'
diff --git a/frontend/src/scenes/insights/utils/resultSeriesName.ts b/products/product_analytics/frontend/insights/shared/resultSeriesName.ts
similarity index 88%
rename from frontend/src/scenes/insights/utils/resultSeriesName.ts
rename to products/product_analytics/frontend/insights/shared/resultSeriesName.ts
index 8c9cf240a46e..6f2a679df611 100644
--- a/frontend/src/scenes/insights/utils/resultSeriesName.ts
+++ b/products/product_analytics/frontend/insights/shared/resultSeriesName.ts
@@ -1,7 +1,6 @@
import { toDisplayEntityFilter } from 'lib/components/EntityFilterInfo'
import { getDisplayNameFromEntityFilter } from 'scenes/insights/utils'
-
-import type { ResultSeries } from './resultSeries'
+import type { ResultSeries } from 'scenes/insights/utils/resultSeries'
/**
* The name a result row's series displays under, by the rules `EntityFilterInfo` applies to the same node. Null
diff --git a/products/product_analytics/frontend/insights/shared/seriesIdentification.ts b/products/product_analytics/frontend/insights/shared/seriesIdentification.ts
index dad15dc0e1d1..2fcc3dfda3af 100644
--- a/products/product_analytics/frontend/insights/shared/seriesIdentification.ts
+++ b/products/product_analytics/frontend/insights/shared/seriesIdentification.ts
@@ -1,5 +1,6 @@
import type { ResultSeries } from 'scenes/insights/utils/resultSeries'
-import { getResultSeriesName } from 'scenes/insights/utils/resultSeriesName'
+
+import { getResultSeriesName } from './resultSeriesName'
export type SeriesIdentification = 'none' | 'name' | 'letter-and-name'
diff --git a/products/product_analytics/frontend/insights/trends/TrendsBarChart/getAggregatedDisplayLabel.ts b/products/product_analytics/frontend/insights/trends/TrendsBarChart/getAggregatedDisplayLabel.ts
index 42fa427be7ce..7fcca5474924 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsBarChart/getAggregatedDisplayLabel.ts
+++ b/products/product_analytics/frontend/insights/trends/TrendsBarChart/getAggregatedDisplayLabel.ts
@@ -1,11 +1,11 @@
import { formatBreakdownLabel } from 'scenes/insights/utils'
import { getResultSeries } from 'scenes/insights/utils/resultSeries'
-import { getResultSeriesName } from 'scenes/insights/utils/resultSeriesName'
import { FormatPropertyValueForDisplayFunction } from '~/models/propertyDefinitionsModel'
import { BreakdownFilter, InsightQueryNode } from '~/queries/schema/schema-general'
import { CohortType } from '~/types'
+import { getResultSeriesName } from 'products/product_analytics/frontend/insights/shared/resultSeriesName'
import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'
import { humanizeSeriesLabel } from '../shared/humanizeSeriesLabel'
diff --git a/products/product_analytics/frontend/insights/trends/shared/getTrendsSeriesDisplayLabel.ts b/products/product_analytics/frontend/insights/trends/shared/getTrendsSeriesDisplayLabel.ts
index 70f50d332b1e..ab9b63480103 100644
--- a/products/product_analytics/frontend/insights/trends/shared/getTrendsSeriesDisplayLabel.ts
+++ b/products/product_analytics/frontend/insights/trends/shared/getTrendsSeriesDisplayLabel.ts
@@ -1,7 +1,6 @@
import { alphabet } from 'lib/utils/strings'
import { formatBreakdownLabel } from 'scenes/insights/utils'
import { getResultSeries } from 'scenes/insights/utils/resultSeries'
-import { getResultSeriesName } from 'scenes/insights/utils/resultSeriesName'
import type { FormatPropertyValueForDisplayFunction } from '~/models/propertyDefinitionsModel'
import type { BreakdownFilter, InsightQueryNode } from '~/queries/schema/schema-general'
@@ -9,6 +8,7 @@ import type { CohortType } from '~/types'
import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'
+import { getResultSeriesName } from '../../shared/resultSeriesName'
import type { SeriesIdentification } from '../../shared/seriesIdentification'
import { humanizeSeriesLabel } from './humanizeSeriesLabel'
diff --git a/products/product_analytics/package.json b/products/product_analytics/package.json
index b200e8ce9056..71a786267031 100644
--- a/products/product_analytics/package.json
+++ b/products/product_analytics/package.json
@@ -15,8 +15,10 @@
},
"devDependencies": {
"@storybook/react": "catalog:",
+ "@testing-library/dom": "*",
"@testing-library/jest-dom": "*",
"@testing-library/react": "*",
+ "@testing-library/user-event": "*",
"kea-test-utils": "catalog:",
"timekeeper": "*"
},