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(insights): move trends bar/line charts into product_analytics (#59674)

Sam Pennington127e540f5b18
diff --git a/frontend/src/scenes/funnels/viz/funnel-line-chart/FunnelLineChart.tsx b/frontend/src/scenes/funnels/viz/funnel-line-chart/FunnelLineChart.tsx
index e1840e64d922..0c18aa8f8c74 100644
--- a/frontend/src/scenes/funnels/viz/funnel-line-chart/FunnelLineChart.tsx
+++ b/frontend/src/scenes/funnels/viz/funnel-line-chart/FunnelLineChart.tsx
@@ -9,7 +9,6 @@ import { insightLogic } from 'scenes/insights/insightLogic'
import type { SeriesDatum } from 'scenes/insights/InsightTooltip/insightTooltipUtils'
import { teamLogic } from 'scenes/teamLogic'
import { openPersonsModal } from 'scenes/trends/persons-modal/PersonsModal'
-import { AnnotationsLayer } from 'scenes/trends/viz/shared/AnnotationsLayer'
import { themeLogic } from '~/layout/navigation-3000/themeLogic'
import { cohortsModel } from '~/models/cohortsModel'
@@ -19,6 +18,8 @@ import { propertyDefinitionsModel } from '~/models/propertyDefinitionsModel'
import { isFunnelsQuery } from '~/queries/utils'
import { ChartParams, type FunnelStepWithConversionMetrics } from '~/types'
+import { AnnotationsLayer } from 'products/product_analytics/frontend/insights/trends/shared/AnnotationsLayer'
+
import { funnelDataLogic } from '../../funnelDataLogic'
import { funnelPersonsModalLogic } from '../../funnelPersonsModalLogic'
import type { FunnelSeriesMeta } from '../shared/funnelSeriesMeta'
diff --git a/frontend/src/scenes/funnels/viz/funnel-line-chart/funnelChartTransforms.ts b/frontend/src/scenes/funnels/viz/funnel-line-chart/funnelChartTransforms.ts
index a194fbd3be3e..5d453d3f8c01 100644
--- a/frontend/src/scenes/funnels/viz/funnel-line-chart/funnelChartTransforms.ts
+++ b/frontend/src/scenes/funnels/viz/funnel-line-chart/funnelChartTransforms.ts
@@ -1,13 +1,14 @@
import type { Series, TimeSeriesLineChartConfig, TooltipConfig } from 'lib/hog-charts'
import type { SeriesDatum } from 'scenes/insights/InsightTooltip/insightTooltipUtils'
-import {
- buildTrendsLineTimeSeriesConfig,
- buildTrendsSeries,
-} from 'scenes/trends/viz/trends-line-chart/trendsChartTransforms'
import type { GoalLine as SchemaGoalLine, TrendsFilter } from '~/queries/schema/schema-general'
import type { FunnelStepWithNestedBreakdown, IntervalType } from '~/types'
+import {
+ buildTrendsLineTimeSeriesConfig,
+ buildTrendsSeries,
+} from 'products/product_analytics/frontend/insights/trends/TrendsLineChart/trendsChartTransforms'
+
import type { FunnelSeriesMeta } from '../shared/funnelSeriesMeta'
export type IndexedFunnelStep = FunnelStepWithNestedBreakdown & { id: number; seriesIndex: number }
diff --git a/frontend/src/scenes/retention/retentionChartTransforms.ts b/frontend/src/scenes/retention/retentionChartTransforms.ts
index 1a8410dc558b..8fa73bb5684a 100644
--- a/frontend/src/scenes/retention/retentionChartTransforms.ts
+++ b/frontend/src/scenes/retention/retentionChartTransforms.ts
@@ -2,7 +2,8 @@ import type { GoalLineConfig, Series, TimeSeriesLineChartConfig, TooltipConfig,
import type { GoalLine as SchemaGoalLine } from '~/queries/schema/schema-general'
-import { schemaGoalLinesToConfigs } from '../trends/viz/shared/goalLinesAdapter'
+import { schemaGoalLinesToConfigs } from 'products/product_analytics/frontend/insights/trends/shared/goalLinesAdapter'
+
import type { RetentionTrendPayload } from './types'
// `retentionGraphLogic.trendSeries` spreads `cohortRetention` onto each entry, so the
diff --git a/frontend/src/scenes/trends/Trends.tsx b/frontend/src/scenes/trends/Trends.tsx
index e0ea2cd61801..135eac8a837e 100644
--- a/frontend/src/scenes/trends/Trends.tsx
+++ b/frontend/src/scenes/trends/Trends.tsx
@@ -25,10 +25,14 @@ const TrendsCalendarHeatMap = lazy(() =>
const BoxPlotChart = lazy(() => import('scenes/insights/views/BoxPlot').then((m) => ({ default: m.BoxPlotChart })))
// Flag-gated — keep full d3 out of the eager Trends/Dashboard bundle
const TrendsLineChart = lazy(() =>
- import('./viz/trends-line-chart/TrendsLineChart').then((m) => ({ default: m.TrendsLineChart }))
+ import('products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart').then((m) => ({
+ default: m.TrendsLineChart,
+ }))
)
const TrendsBarChart = lazy(() =>
- import('./viz/trends-bar-chart/TrendsBarChart').then((m) => ({ default: m.TrendsBarChart }))
+ import('products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart').then((m) => ({
+ default: m.TrendsBarChart,
+ }))
)
interface Props {
diff --git a/frontend/src/test/insight-testing/interactions.ts b/frontend/src/test/insight-testing/interactions.ts
index 596a815cf4ef..307bd601e2ec 100644
--- a/frontend/src/test/insight-testing/interactions.ts
+++ b/frontend/src/test/insight-testing/interactions.ts
@@ -142,14 +142,14 @@ export const chart = {
index: number,
totalLabels = trendsSeries.pageviews.labels.length
): Promise<InsightTooltipAccessor> {
- const canvas = await screen.findByRole('img', { name: /chart with/i })
+ const canvas = await screen.findByRole('img', { name: /chart with/i }, { timeout: DEBOUNCE_TIMEOUT })
const wrapper = canvas.parentElement!
hoverAtIndex(wrapper, index, totalLabels)
const tooltip = await waitForHogChartTooltip()
return createInsightTooltipAccessor(tooltip)
},
async clickAtIndex(index: number, totalLabels = trendsSeries.pageviews.labels.length): Promise<void> {
- const canvas = await screen.findByRole('img', { name: /chart with/i })
+ const canvas = await screen.findByRole('img', { name: /chart with/i }, { timeout: DEBOUNCE_TIMEOUT })
const wrapper = canvas.parentElement!
await clickAtIndex(wrapper, index, totalLabels)
},
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 49f7d9bd0a6b..b0d0627401e1 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -3169,9 +3169,19 @@ importers:
kea-router:
specifier: 'catalog:'
+ posthog-js:
+ specifier: 'catalog:'
+ version: 1.376.0
react:
specifier: 18.3.1
version: 18.3.1
+ devDependencies:
+ '@storybook/react':
+ specifier: 'catalog:'
+ '@testing-library/react':
+ specifier: '*'
products/product_tours: {}
diff --git a/frontend/src/scenes/trends/viz/trends-bar-chart/TrendsBarChart.stories.tsx b/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.stories.tsx
similarity index 100%
rename from frontend/src/scenes/trends/viz/trends-bar-chart/TrendsBarChart.stories.tsx
rename to products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.stories.tsx
diff --git a/frontend/src/scenes/trends/viz/trends-bar-chart/TrendsBarChart.test.tsx b/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.test.tsx
similarity index 100%
rename from frontend/src/scenes/trends/viz/trends-bar-chart/TrendsBarChart.test.tsx
rename to products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.test.tsx
diff --git a/frontend/src/scenes/trends/viz/trends-bar-chart/TrendsBarChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.tsx
similarity index 98%
rename from frontend/src/scenes/trends/viz/trends-bar-chart/TrendsBarChart.tsx
rename to products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.tsx
index 3acf407e77f5..5cd72e55e02b 100644
--- a/frontend/src/scenes/trends/viz/trends-bar-chart/TrendsBarChart.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.tsx
@@ -17,18 +17,18 @@ import { InsightEmptyState } from 'scenes/insights/EmptyStates'
import { insightLogic } from 'scenes/insights/insightLogic'
import type { SeriesDatum } from 'scenes/insights/InsightTooltip/insightTooltipUtils'
import { teamLogic } from 'scenes/teamLogic'
+import { openPersonsModal } from 'scenes/trends/persons-modal/PersonsModal'
+import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'
+import type { IndexedTrendResult } from 'scenes/trends/types'
import { groupsModel } from '~/models/groupsModel'
import { InsightVizNode } from '~/queries/schema/schema-general'
import { QueryContext } from '~/queries/types'
import { ChartDisplayType } from '~/types'
-import { openPersonsModal } from '../../persons-modal/PersonsModal'
-import { trendsDataLogic } from '../../trendsDataLogic'
-import type { IndexedTrendResult } from '../../types'
-import { handleTrendsChartClick, type TrendsChartClickDeps } from '../handleTrendsChartClick'
import { AnnotationsLayer } from '../shared/AnnotationsLayer'
import { goalLinesToReferenceLines } from '../shared/goalLinesAdapter'
+import { handleTrendsChartClick, type TrendsChartClickDeps } from '../shared/handleTrendsChartClick'
import { TrendsAlertOverlays } from '../shared/TrendsAlertOverlays'
import { trendsFilterToYFormatterConfig } from '../shared/trendsAxisFormat'
import type { TrendsSeriesMeta } from '../shared/trendsSeriesMeta'
diff --git a/frontend/src/scenes/trends/viz/trends-bar-chart/handleTrendsBarAggregatedChartClick.test.ts b/products/product_analytics/frontend/insights/trends/TrendsBarChart/handleTrendsBarAggregatedChartClick.test.ts
similarity index 96%
rename from frontend/src/scenes/trends/viz/trends-bar-chart/handleTrendsBarAggregatedChartClick.test.ts
rename to products/product_analytics/frontend/insights/trends/TrendsBarChart/handleTrendsBarAggregatedChartClick.test.ts
index 033d5578d742..c5f2beaebee7 100644
--- a/frontend/src/scenes/trends/viz/trends-bar-chart/handleTrendsBarAggregatedChartClick.test.ts
+++ b/products/product_analytics/frontend/insights/trends/TrendsBarChart/handleTrendsBarAggregatedChartClick.test.ts
@@ -1,8 +1,9 @@
+import type { IndexedTrendResult } from 'scenes/trends/types'
+
import { NodeKind } from '~/queries/schema/schema-general'
import { EntityTypes } from '~/types'
-import type { IndexedTrendResult } from '../../types'
-import type { TrendsChartClickDeps } from '../handleTrendsChartClick'
+import type { TrendsChartClickDeps } from '../shared/handleTrendsChartClick'
import { handleTrendsBarAggregatedChartClick } from './handleTrendsBarAggregatedChartClick'
function makeTrendResult(overrides: Partial<IndexedTrendResult> = {}): IndexedTrendResult {
diff --git a/frontend/src/scenes/trends/viz/trends-bar-chart/handleTrendsBarAggregatedChartClick.ts b/products/product_analytics/frontend/insights/trends/TrendsBarChart/handleTrendsBarAggregatedChartClick.ts
similarity index 88%
rename from frontend/src/scenes/trends/viz/trends-bar-chart/handleTrendsBarAggregatedChartClick.ts
rename to products/product_analytics/frontend/insights/trends/TrendsBarChart/handleTrendsBarAggregatedChartClick.ts
index e0c850f9c6eb..ae03c6534133 100644
--- a/frontend/src/scenes/trends/viz/trends-bar-chart/handleTrendsBarAggregatedChartClick.ts
+++ b/products/product_analytics/frontend/insights/trends/TrendsBarChart/handleTrendsBarAggregatedChartClick.ts
@@ -1,5 +1,6 @@
-import { datasetToActorsQuery } from '../datasetToActorsQuery'
-import type { TrendsChartClickDeps } from '../handleTrendsChartClick'
+import { datasetToActorsQuery } from 'scenes/trends/viz/datasetToActorsQuery'
+
+import type { TrendsChartClickDeps } from '../shared/handleTrendsChartClick'
// Sparse-stacked: resolve by dataIndex, not series.key — buildPointClickData would otherwise
// dispatch the first non-excluded series regardless of which band was clicked.
diff --git a/frontend/src/scenes/trends/viz/trends-bar-chart/trendsBarChartTransforms.test.ts b/products/product_analytics/frontend/insights/trends/TrendsBarChart/trendsBarChartTransforms.test.ts
similarity index 100%
rename from frontend/src/scenes/trends/viz/trends-bar-chart/trendsBarChartTransforms.test.ts
rename to products/product_analytics/frontend/insights/trends/TrendsBarChart/trendsBarChartTransforms.test.ts
diff --git a/frontend/src/scenes/trends/viz/trends-bar-chart/trendsBarChartTransforms.ts b/products/product_analytics/frontend/insights/trends/TrendsBarChart/trendsBarChartTransforms.ts
similarity index 98%
rename from frontend/src/scenes/trends/viz/trends-bar-chart/trendsBarChartTransforms.ts
rename to products/product_analytics/frontend/insights/trends/TrendsBarChart/trendsBarChartTransforms.ts
index 6c6ca4387fa0..b31808055362 100644
--- a/frontend/src/scenes/trends/viz/trends-bar-chart/trendsBarChartTransforms.ts
+++ b/products/product_analytics/frontend/insights/trends/TrendsBarChart/trendsBarChartTransforms.ts
@@ -1,12 +1,12 @@
import type { Series, TimeSeriesBarChartConfig } from 'lib/hog-charts'
import { hexToRGBA } from 'lib/utils'
+import { COMPARE_PREVIOUS_DIM_OPACITY } from 'scenes/trends/viz/trendsAdapterConstants'
import type { CurrencyCode, GoalLine as SchemaGoalLine, TrendsFilter } from '~/queries/schema/schema-general'
import type { IntervalType } from '~/types'
import { schemaGoalLinesToConfigs } from '../shared/goalLinesAdapter'
import { buildTrendsYAxisConfig } from '../shared/trendsAxisFormat'
-import { COMPARE_PREVIOUS_DIM_OPACITY } from '../trendsAdapterConstants'
// Shape both IndexedTrendResult (kea) and TrendsResultItem (MCP) satisfy.
export interface TrendsBarResultLike {
diff --git a/frontend/src/scenes/trends/viz/trends-line-chart/TrendsLineChart.stories.tsx b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.stories.tsx
similarity index 88%
rename from frontend/src/scenes/trends/viz/trends-line-chart/TrendsLineChart.stories.tsx
rename to products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.stories.tsx
index 9ee13efb17b3..a1c0fca0e931 100644
--- a/frontend/src/scenes/trends/viz/trends-line-chart/TrendsLineChart.stories.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.stories.tsx
@@ -5,6 +5,9 @@ import { useState } from 'react'
import { insightLogic } from 'scenes/insights/insightLogic'
import { mswDecorator } from '~/mocks/browser'
+import trendsLineFixture from '~/mocks/fixtures/api/projects/team_id/insights/trendsLine.json'
+import trendsLineBreakdownFixture from '~/mocks/fixtures/api/projects/team_id/insights/trendsLineBreakdown.json'
+import trendsLineMultiFixture from '~/mocks/fixtures/api/projects/team_id/insights/trendsLineMulti.json'
import { dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'
import type { DataNodeLogicProps } from '~/queries/nodes/DataNode/dataNodeLogic'
import { insightVizDataNodeKey } from '~/queries/nodes/InsightViz/InsightViz'
@@ -107,21 +110,14 @@ function renderTrendsLineChart(insightFixture: any): JSX.Element {
)
}
-/* eslint-disable @typescript-eslint/no-var-requires */
export const Default: Story = {
- render: () =>
- renderTrendsLineChart(require('../../../../mocks/fixtures/api/projects/team_id/insights/trendsLineMulti.json')),
+ render: () => renderTrendsLineChart(trendsLineMultiFixture),
}
export const SingleSeries: Story = {
- render: () =>
- renderTrendsLineChart(require('../../../../mocks/fixtures/api/projects/team_id/insights/trendsLine.json')),
+ render: () => renderTrendsLineChart(trendsLineFixture),
}
export const Breakdown: Story = {
- render: () =>
- renderTrendsLineChart(
- require('../../../../mocks/fixtures/api/projects/team_id/insights/trendsLineBreakdown.json')
- ),
+ render: () => renderTrendsLineChart(trendsLineBreakdownFixture),
}
-/* eslint-enable @typescript-eslint/no-var-requires */
diff --git a/frontend/src/scenes/trends/viz/trends-line-chart/TrendsLineChart.test.tsx b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx
similarity index 100%
rename from frontend/src/scenes/trends/viz/trends-line-chart/TrendsLineChart.test.tsx
rename to products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx
diff --git a/frontend/src/scenes/trends/viz/trends-line-chart/TrendsLineChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.tsx
similarity index 96%
rename from frontend/src/scenes/trends/viz/trends-line-chart/TrendsLineChart.tsx
rename to products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.tsx
index 5aabdfa77766..4e863479fb1e 100644
--- a/frontend/src/scenes/trends/viz/trends-line-chart/TrendsLineChart.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.tsx
@@ -6,21 +6,21 @@ import { buildTheme } from 'lib/charts/utils/theme'
import { DEFAULT_Y_AXIS_ID, TimeSeriesLineChart } from 'lib/hog-charts'
import type { PointClickData, Series, TimeSeriesLineChartConfig, TooltipConfig, TooltipContext } from 'lib/hog-charts'
import { formatPercentStackAxisValue } from 'scenes/insights/aggregationAxisFormat'
+import { InsightEmptyState } from 'scenes/insights/EmptyStates'
import { insightLogic } from 'scenes/insights/insightLogic'
import type { SeriesDatum } from 'scenes/insights/InsightTooltip/insightTooltipUtils'
import { teamLogic } from 'scenes/teamLogic'
+import { openPersonsModal } from 'scenes/trends/persons-modal/PersonsModal'
+import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'
+import type { IndexedTrendResult } from 'scenes/trends/types'
import { themeLogic } from '~/layout/navigation-3000/themeLogic'
import { groupsModel } from '~/models/groupsModel'
import { InsightVizNode } from '~/queries/schema/schema-general'
import { QueryContext } from '~/queries/types'
-import { InsightEmptyState } from '../../../insights/EmptyStates'
-import { openPersonsModal } from '../../persons-modal/PersonsModal'
-import { trendsDataLogic } from '../../trendsDataLogic'
-import type { IndexedTrendResult } from '../../types'
-import { handleTrendsChartClick } from '../handleTrendsChartClick'
import { AnnotationsLayer } from '../shared/AnnotationsLayer'
+import { handleTrendsChartClick } from '../shared/handleTrendsChartClick'
import { TrendsAlertOverlays } from '../shared/TrendsAlertOverlays'
import type { TrendsSeriesMeta } from '../shared/trendsSeriesMeta'
import { TrendsTooltip } from '../shared/TrendsTooltip'
@@ -210,7 +210,6 @@ export function TrendsLineChart({ context, inSharedMode = false }: TrendsLineCha
insightData?.resolved_date_range,
querySource,
indexedResults,
- openPersonsModal,
]
)
diff --git a/frontend/src/scenes/trends/viz/trends-line-chart/trendsChartTransforms.test.ts b/products/product_analytics/frontend/insights/trends/TrendsLineChart/trendsChartTransforms.test.ts
similarity index 100%
rename from frontend/src/scenes/trends/viz/trends-line-chart/trendsChartTransforms.test.ts
rename to products/product_analytics/frontend/insights/trends/TrendsLineChart/trendsChartTransforms.test.ts
diff --git a/frontend/src/scenes/trends/viz/trends-line-chart/trendsChartTransforms.ts b/products/product_analytics/frontend/insights/trends/TrendsLineChart/trendsChartTransforms.ts
similarity index 100%
rename from frontend/src/scenes/trends/viz/trends-line-chart/trendsChartTransforms.ts
rename to products/product_analytics/frontend/insights/trends/TrendsLineChart/trendsChartTransforms.ts
diff --git a/frontend/src/scenes/trends/viz/shared/AnnotationsLayer.tsx b/products/product_analytics/frontend/insights/trends/shared/AnnotationsLayer.tsx
similarity index 100%
rename from frontend/src/scenes/trends/viz/shared/AnnotationsLayer.tsx
rename to products/product_analytics/frontend/insights/trends/shared/AnnotationsLayer.tsx
diff --git a/frontend/src/scenes/trends/viz/shared/TrendsAlertOverlays.tsx b/products/product_analytics/frontend/insights/trends/shared/TrendsAlertOverlays.tsx
similarity index 97%
rename from frontend/src/scenes/trends/viz/shared/TrendsAlertOverlays.tsx
rename to products/product_analytics/frontend/insights/trends/shared/TrendsAlertOverlays.tsx
index 5f5ce4e476fd..285ba9fbf6eb 100644
--- a/frontend/src/scenes/trends/viz/shared/TrendsAlertOverlays.tsx
+++ b/products/product_analytics/frontend/insights/trends/shared/TrendsAlertOverlays.tsx
@@ -3,10 +3,10 @@ import React, { useMemo } from 'react'
import { insightAlertsLogic } from 'lib/components/Alerts/insightAlertsLogic'
import { AnomalyPointsLayer, ReferenceLines } from 'lib/hog-charts'
+import type { IndexedTrendResult } from 'scenes/trends/types'
import type { InsightLogicProps } from '~/types'
-import type { IndexedTrendResult } from '../../types'
import { buildAnomalyMarkers } from './anomalyPointsAdapter'
import { alertThresholdsToReferenceLines } from './goalLinesAdapter'
diff --git a/frontend/src/scenes/trends/viz/shared/TrendsTooltip.tsx b/products/product_analytics/frontend/insights/trends/shared/TrendsTooltip.tsx
similarity index 100%
rename from frontend/src/scenes/trends/viz/shared/TrendsTooltip.tsx
rename to products/product_analytics/frontend/insights/trends/shared/TrendsTooltip.tsx
diff --git a/frontend/src/scenes/trends/viz/shared/anomalyPointsAdapter.test.ts b/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.test.ts
similarity index 98%
rename from frontend/src/scenes/trends/viz/shared/anomalyPointsAdapter.test.ts
rename to products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.test.ts
index 2453644c7b39..19e6ca5da499 100644
--- a/frontend/src/scenes/trends/viz/shared/anomalyPointsAdapter.test.ts
+++ b/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.test.ts
@@ -1,8 +1,8 @@
import type { AnomalyPoint } from 'lib/components/Alerts/types'
+import type { IndexedTrendResult } from 'scenes/trends/types'
import { EntityTypes } from '~/types'
-import type { IndexedTrendResult } from '../../types'
import { buildAnomalyMarkers } from './anomalyPointsAdapter'
function makeResult(overrides: Partial<IndexedTrendResult> = {}): IndexedTrendResult {
diff --git a/frontend/src/scenes/trends/viz/shared/anomalyPointsAdapter.ts b/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.ts
similarity index 97%
rename from frontend/src/scenes/trends/viz/shared/anomalyPointsAdapter.ts
rename to products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.ts
index 7ad12e6efbd9..6f532328e667 100644
--- a/frontend/src/scenes/trends/viz/shared/anomalyPointsAdapter.ts
+++ b/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.ts
@@ -1,7 +1,6 @@
import type { AnomalyPoint } from 'lib/components/Alerts/types'
import type { AnomalyMarker as BaseAnomalyMarker } from 'lib/hog-charts'
-
-import type { IndexedTrendResult } from '../../types'
+import type { IndexedTrendResult } from 'scenes/trends/types'
export interface AnomalyMarker extends BaseAnomalyMarker {
/** Originating alert anomaly score (0..1) if available. */
diff --git a/frontend/src/scenes/trends/viz/shared/goalLinesAdapter.test.ts b/products/product_analytics/frontend/insights/trends/shared/goalLinesAdapter.test.ts
similarity index 100%
rename from frontend/src/scenes/trends/viz/shared/goalLinesAdapter.test.ts
rename to products/product_analytics/frontend/insights/trends/shared/goalLinesAdapter.test.ts
diff --git a/frontend/src/scenes/trends/viz/shared/goalLinesAdapter.ts b/products/product_analytics/frontend/insights/trends/shared/goalLinesAdapter.ts
similarity index 100%
rename from frontend/src/scenes/trends/viz/shared/goalLinesAdapter.ts
rename to products/product_analytics/frontend/insights/trends/shared/goalLinesAdapter.ts
diff --git a/frontend/src/scenes/trends/viz/handleTrendsChartClick.test.tsx b/products/product_analytics/frontend/insights/trends/shared/handleTrendsChartClick.test.tsx
similarity index 99%
rename from frontend/src/scenes/trends/viz/handleTrendsChartClick.test.tsx
rename to products/product_analytics/frontend/insights/trends/shared/handleTrendsChartClick.test.tsx
index 2f4207cd178d..5f2181586a04 100644
--- a/frontend/src/scenes/trends/viz/handleTrendsChartClick.test.tsx
+++ b/products/product_analytics/frontend/insights/trends/shared/handleTrendsChartClick.test.tsx
@@ -1,7 +1,8 @@
+import type { IndexedTrendResult } from 'scenes/trends/types'
+
import { NodeKind } from '~/queries/schema/schema-general'
import { CompareLabelType, EntityTypes } from '~/types'
-import type { IndexedTrendResult } from '../types'
import { handleTrendsChartClick, type TrendsChartClickDeps } from './handleTrendsChartClick'
function makeTrendResult(overrides: Partial<IndexedTrendResult> = {}): IndexedTrendResult {
diff --git a/frontend/src/scenes/trends/viz/handleTrendsChartClick.tsx b/products/product_analytics/frontend/insights/trends/shared/handleTrendsChartClick.tsx
similarity index 92%
rename from frontend/src/scenes/trends/viz/handleTrendsChartClick.tsx
rename to products/product_analytics/frontend/insights/trends/shared/handleTrendsChartClick.tsx
index a976319614cc..c23589db86b7 100644
--- a/frontend/src/scenes/trends/viz/handleTrendsChartClick.tsx
+++ b/products/product_analytics/frontend/insights/trends/shared/handleTrendsChartClick.tsx
@@ -1,13 +1,12 @@
import { DateDisplay } from 'lib/components/DateDisplay'
+import type { OpenPersonsModalProps } from 'scenes/trends/persons-modal/PersonsModal'
+import type { IndexedTrendResult } from 'scenes/trends/types'
+import { datasetToActorsQuery } from 'scenes/trends/viz/datasetToActorsQuery'
import { InsightActorsQuery, InsightVizNode, ResolvedDateRangeResponse } from '~/queries/schema/schema-general'
import { QueryContext } from '~/queries/types'
import { IntervalType } from '~/types'
-import type { OpenPersonsModalProps } from '../persons-modal/PersonsModal'
-import type { IndexedTrendResult } from '../types'
-import { datasetToActorsQuery } from './datasetToActorsQuery'
-
export interface TrendsChartClickDeps {
context?: QueryContext<InsightVizNode>
hasPersonsModal: boolean
diff --git a/frontend/src/scenes/trends/viz/shared/trendsAxisFormat.test.ts b/products/product_analytics/frontend/insights/trends/shared/trendsAxisFormat.test.ts
similarity index 100%
rename from frontend/src/scenes/trends/viz/shared/trendsAxisFormat.test.ts
rename to products/product_analytics/frontend/insights/trends/shared/trendsAxisFormat.test.ts
diff --git a/frontend/src/scenes/trends/viz/shared/trendsAxisFormat.ts b/products/product_analytics/frontend/insights/trends/shared/trendsAxisFormat.ts
similarity index 100%
rename from frontend/src/scenes/trends/viz/shared/trendsAxisFormat.ts
rename to products/product_analytics/frontend/insights/trends/shared/trendsAxisFormat.ts
diff --git a/frontend/src/scenes/trends/viz/shared/trendsSeriesMeta.ts b/products/product_analytics/frontend/insights/trends/shared/trendsSeriesMeta.ts
similarity index 100%
rename from frontend/src/scenes/trends/viz/shared/trendsSeriesMeta.ts
rename to products/product_analytics/frontend/insights/trends/shared/trendsSeriesMeta.ts
diff --git a/products/product_analytics/package.json b/products/product_analytics/package.json
index c569651a72cc..1e2611521bc6 100644
--- a/products/product_analytics/package.json
+++ b/products/product_analytics/package.json
@@ -6,7 +6,12 @@
"dependencies": {
"kea": "catalog:",
"kea-loaders": "catalog:",
- "kea-router": "catalog:"
+ "kea-router": "catalog:",
+ "posthog-js": "catalog:"
+ },
+ "devDependencies": {
+ "@storybook/react": "catalog:",
+ "@testing-library/react": "*"
},
"peerDependencies": {
"@posthog/icons": "*",