: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
chore(trends): move the trends core into products/product_analytics (#99781)
Thomas Obermüller685d0f2e8f4c
diff --git a/frontend/src/lib/components/Cards/InsightCard/InsightDetails.tsx b/frontend/src/lib/components/Cards/InsightCard/InsightDetails.tsxindex 93d43ff3a8d8..5f1fcbea65ea 100644--- a/frontend/src/lib/components/Cards/InsightCard/InsightDetails.tsx+++ b/frontend/src/lib/components/Cards/InsightCard/InsightDetails.tsx@@ -31,7 +31,6 @@ import { capitalizeFirstLetter } from 'lib/utils/strings'import { BreakdownTag } from 'scenes/insights/filters/BreakdownFilter/BreakdownTag'import { humanizePathsEventTypes, hasUnsupportedBreakdownForDataWarehouseTrends } from 'scenes/insights/utils'import { QUERY_TYPES_METADATA } from 'scenes/saved-insights/SavedInsights'-import { MathCategory, apiValueToMathType, mathsLogic } from 'scenes/trends/mathsLogic'import { urls } from 'scenes/urls'import {@@ -83,6 +82,11 @@ import {} from '~/types'import { journeysSummaryParts } from 'products/product_analytics/frontend/insights/journeys/journeysSummary'+import {+ MathCategory,+ apiValueToMathType,+ mathsLogic,+} from 'products/product_analytics/frontend/insights/trends/mathsLogic'import { PropertyKeyInfo } from '../../PropertyKeyInfo'import { TZLabel } from '../../TZLabel'diff --git a/frontend/src/lib/components/InsightLabel/index.tsx b/frontend/src/lib/components/InsightLabel/index.tsxindex d0ebb5945b57..73fd2347d916 100644--- a/frontend/src/lib/components/InsightLabel/index.tsx+++ b/frontend/src/lib/components/InsightLabel/index.tsx@@ -13,11 +13,12 @@ import { Tooltip } from 'lib/lemon-ui/Tooltip'import { hexToRGBA } from 'lib/utils/colors'import { capitalizeFirstLetter, midEllipsis } from 'lib/utils/strings'import { formatEventName } from 'scenes/insights/utils'-import { mathsLogic } from 'scenes/trends/mathsLogic'import { groupsModel } from '~/models/groupsModel'import { ActionFilter, BreakdownKeyType } from '~/types'+import { mathsLogic } from 'products/product_analytics/frontend/insights/trends/mathsLogic'+import { TaxonomicFilterGroupType } from '../TaxonomicFilter/types'export enum IconSize {diff --git a/frontend/src/lib/components/InsightLegend/InsightLegend.tsx b/frontend/src/lib/components/InsightLegend/InsightLegend.tsxindex 09c1d7a6af4d..da97428cee49 100644--- a/frontend/src/lib/components/InsightLegend/InsightLegend.tsx+++ b/frontend/src/lib/components/InsightLegend/InsightLegend.tsx@@ -4,7 +4,8 @@ import clsx from 'clsx'import { useValues } from 'kea'import { insightLogic } from 'scenes/insights/insightLogic'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'++import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'import { InsightLegendRow } from './InsightLegendRow'diff --git a/frontend/src/lib/components/InsightLegend/InsightLegendRow.tsx b/frontend/src/lib/components/InsightLegend/InsightLegendRow.tsxindex 83cd0e9ce215..955a30431ea3 100644--- a/frontend/src/lib/components/InsightLegend/InsightLegendRow.tsx+++ b/frontend/src/lib/components/InsightLegend/InsightLegendRow.tsx@@ -12,12 +12,13 @@ import { insightLogic } from 'scenes/insights/insightLogic'import { formatBreakdownLabel, getTrendResultCustomizationKey } from 'scenes/insights/utils'import { formatCompareLabel } from 'scenes/insights/views/InsightsTable/columns/SeriesColumn'import { teamLogic } from 'scenes/teamLogic'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'-import { IndexedTrendResult } from 'scenes/trends/types'import { cohortsModel } from '~/models/cohortsModel'import { propertyDefinitionsModel } from '~/models/propertyDefinitionsModel'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+type InsightLegendRowProps = {item: IndexedTrendResultreadOnly?: booleandiff --git a/frontend/src/lib/components/SmoothingFilter/SmoothingFilter.tsx b/frontend/src/lib/components/SmoothingFilter/SmoothingFilter.tsxindex c8ba109d0200..7a00e5fa9caf 100644--- a/frontend/src/lib/components/SmoothingFilter/SmoothingFilter.tsx+++ b/frontend/src/lib/components/SmoothingFilter/SmoothingFilter.tsx@@ -5,7 +5,8 @@ import { LemonSelect } from '@posthog/lemon-ui'import { insightLogic } from 'scenes/insights/insightLogic'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'++import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'import { smoothingOptions } from './smoothings'diff --git a/frontend/src/queries/nodes/DataTable/BackToSource.tsx b/frontend/src/queries/nodes/DataTable/BackToSource.tsxindex a6a8c236463a..9beff00d8d65 100644--- a/frontend/src/queries/nodes/DataTable/BackToSource.tsx+++ b/frontend/src/queries/nodes/DataTable/BackToSource.tsx@@ -5,13 +5,14 @@ import { IconArrowLeft } from '@posthog/icons'import { LemonButton } from 'lib/lemon-ui/LemonButton'import { summarizeInsightQuery } from 'scenes/insights/summarizeInsight'-import { mathsLogic } from 'scenes/trends/mathsLogic'import { urls } from 'scenes/urls'import { cohortsModel } from '~/models/cohortsModel'import { groupsModel } from '~/models/groupsModel'import { dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'+import { mathsLogic } from 'products/product_analytics/frontend/insights/trends/mathsLogic'+export function BackToSource(): JSX.Element | null {const { aggregationLabel } = useValues(groupsModel)const { cohortsById } = useValues(cohortsModel)diff --git a/frontend/src/queries/nodes/InsightViz/DisplayOptions.tsx b/frontend/src/queries/nodes/InsightViz/DisplayOptions.tsxindex 0db4cc81921e..39df5d090a12 100644--- a/frontend/src/queries/nodes/InsightViz/DisplayOptions.tsx+++ b/frontend/src/queries/nodes/InsightViz/DisplayOptions.tsx@@ -38,13 +38,13 @@ import { insightLogic } from 'scenes/insights/insightLogic'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'import { ConfidenceLevelInput } from 'scenes/insights/views/LineGraph/ConfidenceLevelInput'import { MovingAverageIntervalsInput } from 'scenes/insights/views/LineGraph/MovingAverageIntervalsInput'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'import { isTrendsQuery } from '~/queries/utils'import { ChartDisplayType } from '~/types'import { RetentionCohortLabelStartIndexPicker } from 'products/product_analytics/frontend/insights/retention/filters/RetentionCohortLabelStartIndexPicker'import { RetentionDashboardDisplayPicker } from 'products/product_analytics/frontend/insights/retention/filters/RetentionDashboardDisplayPicker'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'import { displayMatches, isDefaultTrendsLineDisplay, LINE_DISPLAYS } from './displayTypes'diff --git a/frontend/src/queries/nodes/InsightViz/InsightVizDisplay.tsx b/frontend/src/queries/nodes/InsightViz/InsightVizDisplay.tsxindex 07258cd1e27e..483521e1c1b7 100644--- a/frontend/src/queries/nodes/InsightViz/InsightVizDisplay.tsx+++ b/frontend/src/queries/nodes/InsightViz/InsightVizDisplay.tsx@@ -35,7 +35,6 @@ import { BoxPlotResultsTable } from 'scenes/insights/views/BoxPlot/BoxPlotResultimport { InsightsTable } from 'scenes/insights/views/InsightsTable/InsightsTable'import { Paths } from 'scenes/paths/Paths'import { PathCanvasLabel } from 'scenes/paths/PathsLabel'-import { TrendInsight } from 'scenes/trends/Trends'import { WebAnalyticsInsight } from 'scenes/web-analytics/WebAnalyticsInsight'import { SceneSection } from '~/layout/scenes/components/SceneSection'@@ -60,6 +59,7 @@ import { FunnelTimeToConvertTable } from 'products/product_analytics/frontend/inimport { FunnelTrendsTable } from 'products/product_analytics/frontend/insights/funnels/FunnelTrendsTable/FunnelTrendsTable'import { Journeys } from 'products/product_analytics/frontend/insights/journeys/Journeys'import { RetentionContainer } from 'products/product_analytics/frontend/insights/retention/RetentionContainer'+import { TrendInsight } from 'products/product_analytics/frontend/insights/trends/Trends'import { InsightDisplayConfig } from './InsightDisplayConfig'import { InsightResultMetadata } from './InsightResultMetadata'diff --git a/frontend/src/queries/nodes/InsightViz/ResultCustomizationsModal.tsx b/frontend/src/queries/nodes/InsightViz/ResultCustomizationsModal.tsxindex 0b1e7f869d76..9c75a993cb10 100644--- a/frontend/src/queries/nodes/InsightViz/ResultCustomizationsModal.tsx+++ b/frontend/src/queries/nodes/InsightViz/ResultCustomizationsModal.tsx@@ -9,13 +9,14 @@ import { dataThemeLogic } from 'scenes/dataThemeLogic'import { insightLogic } from 'scenes/insights/insightLogic'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'import { formatBreakdownLabel } from 'scenes/insights/utils'-import { IndexedTrendResult } from 'scenes/trends/types'import { cohortsModel } from '~/models/cohortsModel'import { propertyDefinitionsModel } from '~/models/propertyDefinitionsModel'import { ResultCustomizationBy } from '~/queries/schema/schema-general'import { FlattenedFunnelStepByBreakdown } from '~/types'+import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { resultCustomizationsModalLogic } from './resultCustomizationsModalLogic'export function ResultCustomizationsModal(): JSX.Element | null {diff --git a/frontend/src/queries/nodes/InsightViz/insightDisplayOptions.tsx b/frontend/src/queries/nodes/InsightViz/insightDisplayOptions.tsxindex 34f9a0d22cb8..d5ae2b992566 100644--- a/frontend/src/queries/nodes/InsightViz/insightDisplayOptions.tsx+++ b/frontend/src/queries/nodes/InsightViz/insightDisplayOptions.tsx@@ -6,13 +6,13 @@ import { smoothingOptions } from 'lib/components/SmoothingFilter/smoothings'import { PIE_DISPLAY_TYPES } from 'lib/constants'import { insightLogic } from 'scenes/insights/insightLogic'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'import type { TrendsFilter } from '~/queries/schema/schema-general'import { hasBreakdownFilter } from '~/queries/utils'import { ChartDisplayType } from '~/types'import { funnelDataLogic } from 'products/product_analytics/frontend/insights/funnels/funnelDataLogic'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'import { DisplayOption, DisplayOptions } from './DisplayOptions'import { BAR_DISPLAYS, displayMatches, isDefaultTrendsLineDisplay, LINE_DISPLAYS } from './displayTypes'diff --git a/frontend/src/queries/nodes/InsightViz/resultCustomizationsModalLogic.ts b/frontend/src/queries/nodes/InsightViz/resultCustomizationsModalLogic.tsindex 025267ca333f..20a0353b1957 100644--- a/frontend/src/queries/nodes/InsightViz/resultCustomizationsModalLogic.ts+++ b/frontend/src/queries/nodes/InsightViz/resultCustomizationsModalLogic.ts@@ -9,13 +9,13 @@ import {getTrendResultCustomization,getTrendResultCustomizationKey,} from 'scenes/insights/utils'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'-import { IndexedTrendResult } from 'scenes/trends/types'import { ResultCustomizationBy, TrendsFilter } from '~/queries/schema/schema-general'import { FlattenedFunnelStepByBreakdown, InsightLogicProps } from '~/types'import { funnelDataLogic } from 'products/product_analytics/frontend/insights/funnels/funnelDataLogic'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'import type { DataColorTheme } from '../../../lib/colors'import type { FunnelStepWithConversionMetrics } from '../../../types'diff --git a/frontend/src/scenes/experiments/experimentLogic.tsx b/frontend/src/scenes/experiments/experimentLogic.tsxindex a53dac34df03..04b5b7799181 100644--- a/frontend/src/scenes/experiments/experimentLogic.tsx+++ b/frontend/src/scenes/experiments/experimentLogic.tsx@@ -44,7 +44,6 @@ import { insightDataLogic } from 'scenes/insights/insightDataLogic'import { projectLogic } from 'scenes/projectLogic'import { experimentsConfigLogic } from 'scenes/settings/environment/experimentsConfigLogic'import { teamLogic } from 'scenes/teamLogic'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'import { urls } from 'scenes/urls'import { refreshTreeItem } from '~/layout/panel-layout/ProjectTree/projectTreeLogic'@@ -105,6 +104,7 @@ import {isSingleVariantShipped,} from 'products/experiments/frontend/scenes/experimentsLogic'import { funnelDataLogic } from 'products/product_analytics/frontend/insights/funnels/funnelDataLogic'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'import type { ProductIntentProperties } from '../../lib/utils/product-intents'import type { Noun } from '../../models/groupsModel'diff --git a/frontend/src/scenes/insights/EditorFilters/PercentStackViewFilter.tsx b/frontend/src/scenes/insights/EditorFilters/PercentStackViewFilter.tsxindex 027319b6eb3c..6781148a4244 100644--- a/frontend/src/scenes/insights/EditorFilters/PercentStackViewFilter.tsx+++ b/frontend/src/scenes/insights/EditorFilters/PercentStackViewFilter.tsx@@ -1,7 +1,8 @@import { useActions, useValues } from 'kea'import { LemonCheckbox } from 'lib/lemon-ui/LemonCheckbox'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'++import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'import { insightLogic } from '../insightLogic'diff --git a/frontend/src/scenes/insights/EditorFilters/ResultCustomizationByPicker.tsx b/frontend/src/scenes/insights/EditorFilters/ResultCustomizationByPicker.tsxindex f5574af86634..4b60cfa919b4 100644--- a/frontend/src/scenes/insights/EditorFilters/ResultCustomizationByPicker.tsx+++ b/frontend/src/scenes/insights/EditorFilters/ResultCustomizationByPicker.tsx@@ -3,10 +3,11 @@ import { useActions, useValues } from 'kea'import { LemonSegmentedButton } from '@posthog/lemon-ui'import { insightLogic } from 'scenes/insights/insightLogic'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'import { ResultCustomizationBy } from '~/queries/schema/schema-general'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+export function ResultCustomizationByPicker(): JSX.Element | null {const { insightProps } = useValues(insightLogic)const { resultCustomizationBy } = useValues(trendsDataLogic(insightProps))diff --git a/frontend/src/scenes/insights/EditorFilters/ShowPieTotalFilter.tsx b/frontend/src/scenes/insights/EditorFilters/ShowPieTotalFilter.tsxindex 13fd114b1657..405ec2ce8884 100644--- a/frontend/src/scenes/insights/EditorFilters/ShowPieTotalFilter.tsx+++ b/frontend/src/scenes/insights/EditorFilters/ShowPieTotalFilter.tsx@@ -3,10 +3,11 @@ import { useActions, useValues } from 'kea'import { LemonCheckbox } from '@posthog/lemon-ui'import { insightLogic } from 'scenes/insights/insightLogic'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'import { ChartDisplayType } from '~/types'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import { insightVizDataLogic } from '../insightVizDataLogic'export function ShowPieTotalFilter(): JSX.Element | null {diff --git a/frontend/src/scenes/insights/EditorFilters/StackBreakdownFilter.tsx b/frontend/src/scenes/insights/EditorFilters/StackBreakdownFilter.tsxindex c46296908e6c..53e428bc1235 100644--- a/frontend/src/scenes/insights/EditorFilters/StackBreakdownFilter.tsx+++ b/frontend/src/scenes/insights/EditorFilters/StackBreakdownFilter.tsx@@ -1,7 +1,8 @@import { useActions, useValues } from 'kea'import { LemonCheckbox } from 'lib/lemon-ui/LemonCheckbox'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'++import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'import { insightLogic } from '../insightLogic'diff --git a/frontend/src/scenes/insights/__mocks__/createInsightVizStory.tsx b/frontend/src/scenes/insights/__mocks__/createInsightVizStory.tsxindex 80032db410f9..c280942e4889 100644--- a/frontend/src/scenes/insights/__mocks__/createInsightVizStory.tsx+++ b/frontend/src/scenes/insights/__mocks__/createInsightVizStory.tsx@@ -2,7 +2,6 @@ import { BindLogic } from 'kea'import { CSSProperties, useState } from 'react'import { insightLogic } from 'scenes/insights/insightLogic'-import { TrendInsight } from 'scenes/trends/Trends'import { dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'import type { DataNodeLogicProps } from '~/queries/nodes/DataNode/dataNodeLogic'@@ -11,6 +10,8 @@ import { getCachedResults } from '~/queries/nodes/InsightViz/utils'import { InsightVizNode } from '~/queries/schema/schema-general'import { InsightLogicProps, InsightShortId, InsightType, QueryBasedInsightModel } from '~/types'+import { TrendInsight } from 'products/product_analytics/frontend/insights/trends/Trends'+let uniqueNode = 0interface InsightVizStoryProps {diff --git a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterGroup/ActionFilterGroup.tsx b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterGroup/ActionFilterGroup.tsxindex 7aa10cdd73af..f8b18800968d 100644--- a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterGroup/ActionFilterGroup.tsx+++ b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterGroup/ActionFilterGroup.tsx@@ -24,10 +24,11 @@ import {import { SortableDragIcon } from 'lib/lemon-ui/icons'import { LemonDropdown } from 'lib/lemon-ui/LemonDropdown'import { teamLogic } from 'scenes/teamLogic'-import { MathCategory, mathsLogic } from 'scenes/trends/mathsLogic'import { BaseMathType, EntityTypes, InsightType } from '~/types'+import { MathCategory, mathsLogic } from 'products/product_analytics/frontend/insights/trends/mathsLogic'+import { ActionFilterRow, MathSelector, taxonomicFilterGroupTypeToEntityType } from '../ActionFilterRow/ActionFilterRow'import { getDefaultMathHogQLExpression } from '../ActionFilterRow/mathUtils'import { MathAvailability } from '../ActionFilterRow/types'diff --git a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterGroup/actionFilterGroupLogic.ts b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterGroup/actionFilterGroupLogic.tsindex 0e4ed0bbf8ef..bdcf6c3b197b 100644--- a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterGroup/actionFilterGroupLogic.ts+++ b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterGroup/actionFilterGroupLogic.ts@@ -2,12 +2,17 @@ import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reduimport { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'import { uuid } from 'lib/utils/dom'-import { MathCategory, mathTypeToApiValues, mathsLogic } from 'scenes/trends/mathsLogic'import { AnyPropertyFilter, EntityType, EntityTypes, FilterLogicalOperator } from '~/types'+import {+ MathCategory,+ mathTypeToApiValues,+ mathsLogic,+} from 'products/product_analytics/frontend/insights/trends/mathsLogic'+import type { MathDefinition } from 'products/product_analytics/frontend/insights/trends/mathsLogic'+import type { ActionFilter, AnyDataWarehouseFilter, EntityFilter } from '../../../../../types'-import type { MathDefinition } from '../../../../trends/mathsLogic'import { LocalFilter, entityFilterLogic } from '../entityFilterLogic'export interface ActionFilterGroupLogicProps {diff --git a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.tsx b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.tsxindex e6db5599a9b9..abdd3529c3b5 100644--- a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.tsx+++ b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow.tsx@@ -32,7 +32,6 @@ import { insightDataLogic } from 'scenes/insights/insightDataLogic'import { insightLogic } from 'scenes/insights/insightLogic'import { isAllEventsEntityFilter } from 'scenes/insights/utils'import { teamLogic } from 'scenes/teamLogic'-import { MathCategory, mathTypeToApiValues, mathsLogic } from 'scenes/trends/mathsLogic'import { actionsModel } from '~/models/actionsModel'import { DatabaseSerializedFieldType, NodeKind } from '~/queries/schema/schema-general'@@ -47,6 +46,11 @@ import {} from '~/types'import { funnelDataLogic } from 'products/product_analytics/frontend/insights/funnels/funnelDataLogic'+import {+ MathCategory,+ mathTypeToApiValues,+ mathsLogic,+} from 'products/product_analytics/frontend/insights/trends/mathsLogic'import { ActionFilterRowMenu } from './ActionFilterRowMenu'import { getValue, taxonomicFilterGroupTypeToEntityType } from './actionFilterRowUtils'diff --git a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/MathSelector.tsx b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/MathSelector.tsxindex a5f3657f521b..44dd6cadaa0f 100644--- a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/MathSelector.tsx+++ b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/MathSelector.tsx@@ -1,6 +1,6 @@import { LemonSelect } from '@posthog/lemon-ui'-import { apiValueToMathType } from 'scenes/trends/mathsLogic'+import { apiValueToMathType } from 'products/product_analytics/frontend/insights/trends/mathsLogic'import type { MathSelectorProps } from './types'import { useMathSelectorOptions } from './useMathSelectorOptions'diff --git a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/mathUtils.ts b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/mathUtils.tsindex b060f89732bd..8fd363d08643 100644--- a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/mathUtils.ts+++ b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/mathUtils.ts@@ -1,7 +1,10 @@-import { COUNT_PER_ACTOR_MATH_DEFINITIONS, PROPERTY_MATH_DEFINITIONS } from 'scenes/trends/mathsLogic'-import { CountPerActorMathType, InsightType, PropertyMathType } from '~/types'+import {+ COUNT_PER_ACTOR_MATH_DEFINITIONS,+ PROPERTY_MATH_DEFINITIONS,+} from 'products/product_analytics/frontend/insights/trends/mathsLogic'+// Property math types that can be meaningfully aggregated when rolling up histogram buckets// e.g. taking p99 of p99 values doesn't make senseexport const SUPPORTED_PROPERTY_MATH_FOR_HISTOGRAM_BREAKDOWN = new Set([diff --git a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/useMathSelectorOptions.test.tsx b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/useMathSelectorOptions.test.tsxindex 66feb0872c0e..b8393ce30d24 100644--- a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/useMathSelectorOptions.test.tsx+++ b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/useMathSelectorOptions.test.tsx@@ -6,14 +6,14 @@ import { cleanup, render, screen, waitFor } from '@testing-library/react'import userEvent from '@testing-library/user-event'import { Provider } from 'kea'-import { apiValueToMathType } from 'scenes/trends/mathsLogic'-import { useAvailableFeatures } from '~/mocks/features'import { useMocks } from '~/mocks/jest'import { groupsModel } from '~/models/groupsModel'import { initKeaTests } from '~/test/init'import { AvailableFeature, BaseMathType, OrganizationType } from '~/types'+import { apiValueToMathType } from 'products/product_analytics/frontend/insights/trends/mathsLogic'+import { MathAvailability } from './types'import { useMathSelectorOptions } from './useMathSelectorOptions'diff --git a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/useMathSelectorOptions.tsx b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/useMathSelectorOptions.tsxindex c188f019f894..b5680548b0cd 100644--- a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/useMathSelectorOptions.tsx+++ b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/useMathSelectorOptions.tsx@@ -5,13 +5,6 @@ import { IconWarning } from '@posthog/icons'import { LemonSelect, LemonSelectOption, LemonSelectOptions } from '@posthog/lemon-ui'import { capitalizeFirstLetter } from 'lib/utils/strings'-import {- COUNT_PER_ACTOR_MATH_DEFINITIONS,- MathDefinition,- PROPERTY_MATH_DEFINITIONS,- mathTypeToApiValues,- mathsLogic,-} from 'scenes/trends/mathsLogic'import { MathType } from '~/queries/schema/schema-general'import {@@ -24,6 +17,13 @@ import {import { BaseMathType, ChartDisplayType, CountPerActorMathType, HogQLMathType, PropertyMathType } from '~/types'import { GroupIntroductionFooter } from 'products/groups/frontend/components/GroupsIntroduction'+import {+ COUNT_PER_ACTOR_MATH_DEFINITIONS,+ MathDefinition,+ PROPERTY_MATH_DEFINITIONS,+ mathTypeToApiValues,+ mathsLogic,+} from 'products/product_analytics/frontend/insights/trends/mathsLogic'import {getDefaultPropertyMathType,diff --git a/frontend/src/scenes/insights/insightLogic.tsx b/frontend/src/scenes/insights/insightLogic.tsxindex a1522f9e5d97..09d77d69a776 100644--- a/frontend/src/scenes/insights/insightLogic.tsx+++ b/frontend/src/scenes/insights/insightLogic.tsx@@ -38,8 +38,6 @@ import { summarizeInsight } from 'scenes/insights/summarizeInsight'import { savedInsightsLogic } from 'scenes/saved-insights/savedInsightsLogic'import { sceneLogic } from 'scenes/sceneLogic'import { Scene } from 'scenes/sceneTypes'-import { mathsLogic } from 'scenes/trends/mathsLogic'-import { IndexedTrendResult } from 'scenes/trends/types'import { urls } from 'scenes/urls'import { userLogic } from 'scenes/userLogic'@@ -74,6 +72,9 @@ import {} from '~/types'import { insightAlertsLogic } from 'products/alerts/frontend/logic/insightAlertsLogic'+import { mathsLogic } from 'products/product_analytics/frontend/insights/trends/mathsLogic'+import type { MathDefinition } from 'products/product_analytics/frontend/insights/trends/mathsLogic'+import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'import type { AlertType } from '../../../../products/alerts/frontend/types'import type { InsightFilterOverrideContextApi } from '../../../../products/product_analytics/frontend/generated/api.schemas'@@ -83,7 +84,6 @@ import type { Noun } from '../../models/groupsModel'import type { QueryStatus, ResolvedDateRangeResponse } from '../../queries/schema/schema-general'import type { CohortType, DashboardTileBasicType, TeamPublicType, TeamType, UserBasicType, UserType } from '../../types'import { teamLogic } from '../teamLogic'-import type { MathDefinition } from '../trends/mathsLogic'import { insightDataLogic, isInsightSceneInstance } from './insightDataLogic'import { getInsightId } from './utils'import { insightsApi } from './utils/api'@@ -972,7 +972,12 @@ export const insightLogic: LogicWrapper<insightLogicType> = kea<insightLogicTypedeferToUserWording?: boolean) => import('~/models/groupsModel').Noun,cohortsById: Partial<Record<number | string, import('~/types').CohortType>>,- mathDefinitions: Partial<Record<string, import('scenes/trends/mathsLogic').MathDefinition>>+ mathDefinitions: Partial<+ Record<+ string,+ import('products/product_analytics/frontend/insights/trends/mathsLogic').MathDefinition+ >+ >) =>summarizeInsight(query, {aggregationLabel,diff --git a/frontend/src/scenes/insights/insightVizDataLogic.ts b/frontend/src/scenes/insights/insightVizDataLogic.tsindex c449cd0bab96..2c61b8d83b5f 100644--- a/frontend/src/scenes/insights/insightVizDataLogic.ts+++ b/frontend/src/scenes/insights/insightVizDataLogic.ts@@ -26,7 +26,6 @@ import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'import { AggregationType } from 'scenes/insights/views/InsightsTable/insightsTableDataLogic'import { sceneLogic } from 'scenes/sceneLogic'import { filterTestAccountsDefaultsLogic } from 'scenes/settings/environment/filterTestAccountDefaultsLogic'-import { BASE_MATH_DEFINITIONS } from 'scenes/trends/mathsLogic'import { actionsModel } from '~/models/actionsModel'import {@@ -117,6 +116,7 @@ import {} from '~/types'import { getClampedFunnelStepRange } from 'products/product_analytics/frontend/insights/funnels/funnelUtils'+import { BASE_MATH_DEFINITIONS } from 'products/product_analytics/frontend/insights/trends/mathsLogic'import type { DataColorTheme } from '../../lib/colors'import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'diff --git a/frontend/src/scenes/insights/summarizeInsight.test.ts b/frontend/src/scenes/insights/summarizeInsight.test.tsindex 2fdcd74efe5f..7a1a4131d8bb 100644--- a/frontend/src/scenes/insights/summarizeInsight.test.ts+++ b/frontend/src/scenes/insights/summarizeInsight.test.ts@@ -1,13 +1,5 @@import { RETENTION_FIRST_OCCURRENCE_MATCHING_FILTERS, RETENTION_RECURRING } from 'lib/constants'import { SummaryContext, summarizeInsight } from 'scenes/insights/summarizeInsight'-import {- BASE_MATH_DEFINITIONS,- COUNT_PER_ACTOR_MATH_DEFINITIONS,- HOGQL_MATH_DEFINITIONS,- MathCategory,- MathDefinition,- PROPERTY_MATH_DEFINITIONS,-} from 'scenes/trends/mathsLogic'import { Noun } from '~/models/groupsModel'import {@@ -33,6 +25,15 @@ import {PropertyMathType,} from '~/types'+import {+ BASE_MATH_DEFINITIONS,+ COUNT_PER_ACTOR_MATH_DEFINITIONS,+ HOGQL_MATH_DEFINITIONS,+ MathCategory,+ MathDefinition,+ PROPERTY_MATH_DEFINITIONS,+} from 'products/product_analytics/frontend/insights/trends/mathsLogic'+const aggregationLabel = (groupTypeIndex: number | null | undefined): Noun =>groupTypeIndex != undefined? {diff --git a/frontend/src/scenes/insights/summarizeInsight.ts b/frontend/src/scenes/insights/summarizeInsight.tsindex d98ec8cce06a..071e56608768 100644--- a/frontend/src/scenes/insights/summarizeInsight.ts+++ b/frontend/src/scenes/insights/summarizeInsight.ts@@ -8,8 +8,6 @@ import {getDisplayNameFromEntityNode,humanizePathsEventTypes,} from 'scenes/insights/utils'-import { MathCategory, apiValueToMathType, mathsLogic } from 'scenes/trends/mathsLogic'-import type { mathsLogicType } from 'scenes/trends/mathsLogic'import { cohortsModel } from '~/models/cohortsModel'import type { cohortsModelType } from '~/models/cohortsModel'@@ -45,6 +43,12 @@ import { BreakdownKeyType, BreakdownType, EntityFilter, FilterType, FunnelVizTypimport { summarizeJourneys } from 'products/product_analytics/frontend/insights/journeys/journeysSummary'import { retentionOptions } from 'products/product_analytics/frontend/insights/retention/constants'+import {+ MathCategory,+ apiValueToMathType,+ mathsLogic,+} from 'products/product_analytics/frontend/insights/trends/mathsLogic'+import type { mathsLogicType } from 'products/product_analytics/frontend/insights/trends/mathsLogic'function summarizeSingularBreakdown(breakdown: BreakdownKeyType | undefined,diff --git a/frontend/src/scenes/insights/utils.test.ts b/frontend/src/scenes/insights/utils.test.tsindex 8bfe31da5e05..c57943657e71 100644--- a/frontend/src/scenes/insights/utils.test.ts+++ b/frontend/src/scenes/insights/utils.test.ts@@ -11,7 +11,6 @@ import {NOT_IN_COHORT_ID,} from 'scenes/insights/utils'import { teamLogic } from 'scenes/teamLogic'-import { IndexedTrendResult } from 'scenes/trends/types'import {ActionsNode,@@ -24,6 +23,8 @@ import {import { isEventsNode } from '~/queries/utils'import { BaseMathType, CompareLabelType, Entity, EntityFilter, FilterType, InsightType, TeamType } from '~/types'+import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+const createFilter = (id?: Entity['id'], name?: string, custom_name?: string): EntityFilter => {return {custom_name,diff --git a/frontend/src/scenes/insights/utils.tsx b/frontend/src/scenes/insights/utils.tsxindex e81cb3a94d8f..76b39a69073f 100644--- a/frontend/src/scenes/insights/utils.tsx+++ b/frontend/src/scenes/insights/utils.tsx@@ -14,7 +14,6 @@ import { objectsEqual } from 'lib/utils/objects'import { removeUndefinedAndNull } from 'lib/utils/objects'import { ensureStringIsNotBlank } from 'lib/utils/strings'import { teamLogic } from 'scenes/teamLogic'-import { IndexedTrendResult } from 'scenes/trends/types'import { urls } from 'scenes/urls'import { propertyFilterTypeToPropertyDefinitionType } from '~/lib/components/PropertyFilters/utils'@@ -69,6 +68,8 @@ import {PropertyOperator,} from '~/types'+import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { insightLogic } from './insightLogic'export const isAllEventsEntityFilter = (filter: EntityFilter | ActionFilter | null | undefined): boolean => {diff --git a/frontend/src/scenes/insights/views/InsightsTable/InsightsTable.tsx b/frontend/src/scenes/insights/views/InsightsTable/InsightsTable.tsxindex 87b263f642f2..cd14c11933fc 100644--- a/frontend/src/scenes/insights/views/InsightsTable/InsightsTable.tsx+++ b/frontend/src/scenes/insights/views/InsightsTable/InsightsTable.tsx@@ -11,8 +11,6 @@ import { formatAggregationAxisValue } from 'scenes/insights/aggregationAxisFormaimport { insightLogic } from 'scenes/insights/insightLogic'import { formatBreakdownLabel } from 'scenes/insights/utils'import { teamLogic } from 'scenes/teamLogic'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'-import { IndexedTrendResult } from 'scenes/trends/types'import { cohortsModel } from '~/models/cohortsModel'import { propertyDefinitionsModel } from '~/models/propertyDefinitionsModel'@@ -20,6 +18,9 @@ import { extractDisplayLabel } from '~/queries/nodes/DataTable/utils'import { hasBreakdownFilter } from '~/queries/utils'import { ChartDisplayType, TrendsFilterType } from '~/types'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { entityFilterLogic } from '../../filters/ActionFilter/entityFilterLogic'import {AggregationColumnItem,diff --git a/frontend/src/scenes/insights/views/InsightsTable/columns/AggregationColumn.tsx b/frontend/src/scenes/insights/views/InsightsTable/columns/AggregationColumn.tsxindex 96f627b92fb7..e69d84878d4c 100644--- a/frontend/src/scenes/insights/views/InsightsTable/columns/AggregationColumn.tsx+++ b/frontend/src/scenes/insights/views/InsightsTable/columns/AggregationColumn.tsx@@ -11,12 +11,13 @@ import { average, median } from 'lib/utils/numbers'import { formatAggregationAxisValue } from 'scenes/insights/aggregationAxisFormat'import { formatAggregationValue } from 'scenes/insights/utils'import { teamLogic } from 'scenes/teamLogic'-import { IndexedTrendResult } from 'scenes/trends/types'import { propertyDefinitionsModel } from '~/models/propertyDefinitionsModel'import { TrendsFilter } from '~/queries/schema/schema-general'import { TrendsFilterType } from '~/types'+import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { CalcColumnState } from '../InsightsTable'export const CALC_COLUMN_LABELS: Record<CalcColumnState, string> = {diff --git a/frontend/src/scenes/insights/views/InsightsTable/columns/BreakdownColumn.tsx b/frontend/src/scenes/insights/views/InsightsTable/columns/BreakdownColumn.tsxindex e03545e6cadf..9cbb11973f68 100644--- a/frontend/src/scenes/insights/views/InsightsTable/columns/BreakdownColumn.tsx+++ b/frontend/src/scenes/insights/views/InsightsTable/columns/BreakdownColumn.tsx@@ -6,10 +6,11 @@ import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'import stringWithWBR from 'lib/utils/stringWithWBR'import { isURL } from 'lib/utils/url'import { formatBreakdownType } from 'scenes/insights/utils'-import { IndexedTrendResult } from 'scenes/trends/types'import { BreakdownFilter } from '~/queries/schema/schema-general'+import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+interface BreakdownColumnTitleProps {breakdownFilter: BreakdownFilterisPinned?: booleandiff --git a/frontend/src/scenes/insights/views/InsightsTable/columns/ColorCustomizationColumn.tsx b/frontend/src/scenes/insights/views/InsightsTable/columns/ColorCustomizationColumn.tsxindex 65b3c334eeec..ed2b605cbe64 100644--- a/frontend/src/scenes/insights/views/InsightsTable/columns/ColorCustomizationColumn.tsx+++ b/frontend/src/scenes/insights/views/InsightsTable/columns/ColorCustomizationColumn.tsx@@ -3,11 +3,12 @@ import { useActions, useValues } from 'kea'import { LemonColorButton } from '@posthog/lemon-ui'import { insightLogic } from 'scenes/insights/insightLogic'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'-import { IndexedTrendResult } from 'scenes/trends/types'import { resultCustomizationsModalLogic } from '~/queries/nodes/InsightViz/resultCustomizationsModalLogic'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+export function ColorCustomizationColumnTitle(): JSX.Element {return <>Color</>}diff --git a/frontend/src/scenes/insights/views/InsightsTable/columns/SeriesCheckColumn.tsx b/frontend/src/scenes/insights/views/InsightsTable/columns/SeriesCheckColumn.tsxindex 11a8450425ca..3b3d625d8dc2 100644--- a/frontend/src/scenes/insights/views/InsightsTable/columns/SeriesCheckColumn.tsx+++ b/frontend/src/scenes/insights/views/InsightsTable/columns/SeriesCheckColumn.tsx@@ -1,5 +1,6 @@import { LemonCheckbox } from 'lib/lemon-ui/LemonCheckbox'-import { IndexedTrendResult } from 'scenes/trends/types'++import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'type SeriesCheckColumnTitleProps = {indexedResults: IndexedTrendResult[]diff --git a/frontend/src/scenes/insights/views/InsightsTable/columns/SeriesColumn.tsx b/frontend/src/scenes/insights/views/InsightsTable/columns/SeriesColumn.tsxindex bf543f8da0bd..f53e3b7ca3e4 100644--- a/frontend/src/scenes/insights/views/InsightsTable/columns/SeriesColumn.tsx+++ b/frontend/src/scenes/insights/views/InsightsTable/columns/SeriesColumn.tsx@@ -4,10 +4,11 @@ import { Tooltip } from '@posthog/lemon-ui'import { InsightLabel } from 'lib/components/InsightLabel'import { capitalizeFirstLetter } from 'lib/utils/strings'-import { IndexedTrendResult } from 'scenes/trends/types'import { TrendResult } from '~/types'+import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+type SeriesColumnItemProps = {item: IndexedTrendResultindexedResults: IndexedTrendResult[]diff --git a/frontend/src/scenes/insights/views/InsightsTable/columns/ValueColumn.tsx b/frontend/src/scenes/insights/views/InsightsTable/columns/ValueColumn.tsxindex f739a3a828ff..4eef62beebaa 100644--- a/frontend/src/scenes/insights/views/InsightsTable/columns/ValueColumn.tsx+++ b/frontend/src/scenes/insights/views/InsightsTable/columns/ValueColumn.tsx@@ -2,12 +2,13 @@ import { ReactNode, memo } from 'react'import { DateDisplay } from 'lib/components/DateDisplay'import { formatAggregationValue } from 'scenes/insights/utils'-import { IndexedTrendResult } from 'scenes/trends/types'import { FormatPropertyValueForDisplayFunction } from '~/models/propertyDefinitionsModel'import { ResolvedDateRangeResponse } from '~/queries/schema/schema-general'import { IntervalType } from '~/types'+import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+type ValueColumnTitleProps = {index: numberindexedResults: IndexedTrendResult[]diff --git a/frontend/src/scenes/insights/views/InsightsTable/columns/WorldMapColumn.tsx b/frontend/src/scenes/insights/views/InsightsTable/columns/WorldMapColumn.tsxindex d166d95a280b..60149e651645 100644--- a/frontend/src/scenes/insights/views/InsightsTable/columns/WorldMapColumn.tsx+++ b/frontend/src/scenes/insights/views/InsightsTable/columns/WorldMapColumn.tsx@@ -1,6 +1,7 @@import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'import { COUNTRY_CODE_TO_LONG_NAME } from 'lib/utils/country'-import { IndexedTrendResult } from 'scenes/trends/types'++import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'export function WorldMapColumnTitle(): JSX.Element {return <PropertyKeyInfo disableIcon disablePopover value="$geoip_country_name" />diff --git a/frontend/src/scenes/insights/views/InsightsTable/insightsTableDataLogic.test.ts b/frontend/src/scenes/insights/views/InsightsTable/insightsTableDataLogic.test.tsindex 4b7a29139ab4..452aec201abd 100644--- a/frontend/src/scenes/insights/views/InsightsTable/insightsTableDataLogic.test.ts+++ b/frontend/src/scenes/insights/views/InsightsTable/insightsTableDataLogic.test.ts@@ -2,8 +2,6 @@ import { expectLogic } from 'kea-test-utils'import { insightDataLogic } from 'scenes/insights/insightDataLogic'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'-import { IndexedTrendResult } from 'scenes/trends/types'import { useMocks } from '~/mocks/jest'import { dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'@@ -18,6 +16,9 @@ import {PropertyMathType,} from '~/types'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { AggregationType, compareResultKey, insightsTableDataLogic } from './insightsTableDataLogic'describe('insightsTableDataLogic', () => {diff --git a/frontend/src/scenes/insights/views/InsightsTable/insightsTableDataLogic.ts b/frontend/src/scenes/insights/views/InsightsTable/insightsTableDataLogic.tsindex 688432b68e20..a7b4867363a9 100644--- a/frontend/src/scenes/insights/views/InsightsTable/insightsTableDataLogic.ts+++ b/frontend/src/scenes/insights/views/InsightsTable/insightsTableDataLogic.ts@@ -2,11 +2,12 @@ import { MakeLogicType, actions, connect, kea, key, path, props, reducers, selecimport { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'-import { IndexedTrendResult } from 'scenes/trends/types'import { ChartDisplayType, CompareLabelType, InsightLogicProps } from '~/types'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import type {AnyDataWarehouseNode,AnyEntityNode,diff --git a/frontend/src/scenes/insights/views/LineGraph/ConfidenceLevelInput.tsx b/frontend/src/scenes/insights/views/LineGraph/ConfidenceLevelInput.tsxindex 6548d6ae70c0..21e1ae3db4de 100644--- a/frontend/src/scenes/insights/views/LineGraph/ConfidenceLevelInput.tsx+++ b/frontend/src/scenes/insights/views/LineGraph/ConfidenceLevelInput.tsx@@ -6,10 +6,11 @@ import { LemonInput, Tooltip } from '@posthog/lemon-ui'import { insightLogic } from 'scenes/insights/insightLogic'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'import { isTrendsQuery } from '~/queries/utils'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+export function ConfidenceLevelInput(): JSX.Element {const { insightProps } = useValues(insightLogic)const { confidenceLevel, showConfidenceIntervals } = useValues(trendsDataLogic(insightProps))diff --git a/frontend/src/scenes/insights/views/LineGraph/MovingAverageIntervalsInput.tsx b/frontend/src/scenes/insights/views/LineGraph/MovingAverageIntervalsInput.tsxindex 649d855563b6..293508e40f63 100644--- a/frontend/src/scenes/insights/views/LineGraph/MovingAverageIntervalsInput.tsx+++ b/frontend/src/scenes/insights/views/LineGraph/MovingAverageIntervalsInput.tsx@@ -6,10 +6,14 @@ import { LemonInput, Tooltip } from '@posthog/lemon-ui'import { insightLogic } from 'scenes/insights/insightLogic'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'-import { INTERVAL_TO_DEFAULT_MOVING_AVERAGE_PERIOD, trendsDataLogic } from 'scenes/trends/trendsDataLogic'import { isTrendsQuery } from '~/queries/utils'+import {+ INTERVAL_TO_DEFAULT_MOVING_AVERAGE_PERIOD,+ trendsDataLogic,+} from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+export function MovingAverageIntervalsInput(): JSX.Element {const { insightProps } = useValues(insightLogic)const { movingAverageIntervals, showMovingAverage } = useValues(trendsDataLogic(insightProps))diff --git a/frontend/src/scenes/insights/views/Metric/Metric.tsx b/frontend/src/scenes/insights/views/Metric/Metric.tsxindex e364ee7a46a1..294265e18ea0 100644--- a/frontend/src/scenes/insights/views/Metric/Metric.tsx+++ b/frontend/src/scenes/insights/views/Metric/Metric.tsx@@ -19,10 +19,11 @@ import {import { InsightEmptyState } from 'scenes/insights/EmptyStates'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'import { teamLogic } from 'scenes/teamLogic'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'import { ChartDisplayType, ChartParams, TrendResult } from '~/types'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import { insightLogic } from '../../insightLogic'import {computeMetricSummary,diff --git a/frontend/src/test/insight-testing/interactions.ts b/frontend/src/test/insight-testing/interactions.tsindex dbf6d72c5990..6493d5d273ca 100644--- a/frontend/src/test/insight-testing/interactions.ts+++ b/frontend/src/test/insight-testing/interactions.ts@@ -11,12 +11,13 @@ import {} from '@posthog/quill-charts/testing'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'-import { IndexedTrendResult } from 'scenes/trends/types'import { TrendsQuery } from '~/queries/schema/schema-general'import { InsightLogicProps } from '~/types'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { INSIGHT_TEST_ID } from './render-insight'import { trendsSeries } from './test-data'import { type InsightTooltipAccessor, createInsightTooltipAccessor } from './tooltip-helpers'diff --git a/products/alerts/frontend/logic/alertFormLogic.ts b/products/alerts/frontend/logic/alertFormLogic.tsindex 541dbdb6da7c..7093039f6bfe 100644--- a/products/alerts/frontend/logic/alertFormLogic.ts+++ b/products/alerts/frontend/logic/alertFormLogic.ts@@ -10,7 +10,6 @@ import api, { ApiError } from 'lib/api'import { tryShowMCPHint } from 'lib/components/MCPHint/mcpHintLogic'import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'import { urls } from 'scenes/urls'import { userLogic } from 'scenes/userLogic'@@ -31,6 +30,7 @@ import {isSubDailyAlertInterval,} from 'products/alerts/frontend/logic/alertIntervalHelpers'import { resolveSnoozeUntil } from 'products/alerts/frontend/utils'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'import {AlertConfig,diff --git a/products/alerts/frontend/views/EditAlertModal.tsx b/products/alerts/frontend/views/EditAlertModal.tsxindex a1229a9f4ff9..40a6ee2aad24 100644--- a/products/alerts/frontend/views/EditAlertModal.tsx+++ b/products/alerts/frontend/views/EditAlertModal.tsx@@ -12,7 +12,6 @@ import { insightLogic } from 'scenes/insights/insightLogic'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'import { getDisplayNameFromEntityNode } from 'scenes/insights/utils'import { teamLogic } from 'scenes/teamLogic'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'import { urls } from 'scenes/urls'import { AlertCalculationInterval, AlertConditionType, InsightThresholdType } from '~/queries/schema/schema-general'@@ -36,6 +35,7 @@ import { isSubDailyAlertInterval } from 'products/alerts/frontend/logic/alertIntimport { quietHoursFormError } from 'products/alerts/frontend/logic/scheduleRestrictionValidation'import { deriveAlertCheckPreviewSeries } from 'products/alerts/frontend/logic/trendsAlertPreview'import { InsightAlertNotificationSection } from 'products/alerts/frontend/views/InsightAlertNotificationSection'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'import { alertFormLogic, canCheckOngoingInterval, insightAlertKindForQuery } from '../logic/alertFormLogic'import { alertLogic } from '../logic/alertLogic'diff --git a/products/product_analytics/frontend/insights/retention/filters/RetentionAggregationSelector.tsx b/products/product_analytics/frontend/insights/retention/filters/RetentionAggregationSelector.tsxindex 997e87461a46..2c646d38690e 100644--- a/products/product_analytics/frontend/insights/retention/filters/RetentionAggregationSelector.tsx+++ b/products/product_analytics/frontend/insights/retention/filters/RetentionAggregationSelector.tsx@@ -10,11 +10,12 @@ import { Tooltip } from 'lib/lemon-ui/Tooltip'import { databaseTableListLogic } from 'scenes/data-management/database/databaseTableListLogic'import { insightLogic } from 'scenes/insights/insightLogic'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'-import { PROPERTY_MATH_DEFINITIONS } from 'scenes/trends/mathsLogic'import { DatabaseSchemaField, RetentionFilter } from '~/queries/schema/schema-general'import { PropertyMathType } from '~/types'+import { PROPERTY_MATH_DEFINITIONS } from 'products/product_analytics/frontend/insights/trends/mathsLogic'+const aggregationTypeToTaxonomicType = {event: TaxonomicFilterGroupType.EventProperties,person: TaxonomicFilterGroupType.PersonProperties,diff --git a/products/product_analytics/frontend/insights/shared/hasTrendsChartData.test.ts b/products/product_analytics/frontend/insights/shared/hasTrendsChartData.test.tsindex c6e8f0b87e2c..f9eaf9691e1f 100644--- a/products/product_analytics/frontend/insights/shared/hasTrendsChartData.test.ts+++ b/products/product_analytics/frontend/insights/shared/hasTrendsChartData.test.ts@@ -1,4 +1,4 @@-import type { IndexedTrendResult } from 'scenes/trends/types'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'import { hasTrendsChartData } from './hasTrendsChartData'diff --git a/products/product_analytics/frontend/insights/shared/hasTrendsChartData.ts b/products/product_analytics/frontend/insights/shared/hasTrendsChartData.tsindex 55d9c2a5509d..b1a98334d1c1 100644--- a/products/product_analytics/frontend/insights/shared/hasTrendsChartData.ts+++ b/products/product_analytics/frontend/insights/shared/hasTrendsChartData.ts@@ -1,4 +1,4 @@-import type { IndexedTrendResult } from 'scenes/trends/types'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'// Gate the empty state on the whole result set, not just the first series — trendsDataLogic// re-sorts and interleaves results for compare mode, breakdown ordering, and unstacked bars, sodiff --git a/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.tsx b/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.tsxindex 18dec2daf549..aa3dc46a5090 100644--- a/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.tsx+++ b/products/product_analytics/frontend/insights/stickiness/StickinessBarChart/StickinessBarChart.tsx@@ -10,8 +10,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 { trendsDataLogic } from 'scenes/trends/trendsDataLogic'-import type { IndexedTrendResult } from 'scenes/trends/types'import { cohortsModel } from '~/models/cohortsModel'import { groupsModel } from '~/models/groupsModel'@@ -20,6 +18,9 @@ import { InsightVizNode } from '~/queries/schema/schema-general'import { QueryContext } from '~/queries/types'import { ChartDisplayType } from '~/types'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { hasTrendsChartData } from '../../shared/hasTrendsChartData'import { InsightSeriesTooltip } from '../../shared/InsightSeriesTooltip'import { makeChartErrorHandler } from '../../trends/shared/chartErrorHandler'diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.tsx b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.tsxindex e53b9f18e574..bc24d3c07a5f 100644--- a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.tsx+++ b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.tsx@@ -10,8 +10,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 { trendsDataLogic } from 'scenes/trends/trendsDataLogic'-import type { IndexedTrendResult } from 'scenes/trends/types'import { cohortsModel } from '~/models/cohortsModel'import { groupsModel } from '~/models/groupsModel'@@ -19,6 +17,9 @@ import { propertyDefinitionsModel } from '~/models/propertyDefinitionsModel'import { InsightVizNode } from '~/queries/schema/schema-general'import { QueryContext } from '~/queries/types'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { chartStyleCurve } from '../../shared/chartStyleAdapter'import { hasTrendsChartData } from '../../shared/hasTrendsChartData'import { InsightSeriesTooltip } from '../../shared/InsightSeriesTooltip'diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/handleStickinessChartClick.test.tsx b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/handleStickinessChartClick.test.tsxindex 31ff7071ed7d..804f4ec8f15d 100644--- a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/handleStickinessChartClick.test.tsx+++ b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/handleStickinessChartClick.test.tsx@@ -1,10 +1,10 @@import { render } from '@testing-library/react'-import type { IndexedTrendResult } from 'scenes/trends/types'-import { NodeKind } from '~/queries/schema/schema-general'import { CompareLabelType, EntityTypes } from '~/types'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { handleStickinessChartClick, type StickinessChartClickDeps } from './handleStickinessChartClick'// `IndexedTrendResult['days']` is declared `string[]`, but the backend servesdiff --git a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/handleStickinessChartClick.tsx b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/handleStickinessChartClick.tsxindex 032f879547b1..1946317a6684 100644--- a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/handleStickinessChartClick.tsx+++ b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/handleStickinessChartClick.tsx@@ -1,13 +1,14 @@import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'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 } from '~/queries/schema/schema-general'import { QueryContext } from '~/queries/types'import { IntervalType } from '~/types'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { datasetToActorsQuery } from 'products/product_analytics/frontend/insights/trends/viz/datasetToActorsQuery'+export interface StickinessChartClickDeps {context?: QueryContext<InsightVizNode>hasPersonsModal: booleandiff --git a/frontend/src/scenes/trends/Trends.tsx b/products/product_analytics/frontend/insights/trends/Trends.tsxsimilarity index 100%rename from frontend/src/scenes/trends/Trends.tsxrename to products/product_analytics/frontend/insights/trends/Trends.tsxdiff --git a/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.stories.tsx b/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.stories.tsxindex a70dcec1496e..ab5710dfb74d 100644--- a/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.stories.tsx+++ b/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.stories.tsx@@ -8,7 +8,6 @@ import {insightSceneStoryParameters,} from 'scenes/insights/__mocks__/createInsightScene'import { insightLogic } from 'scenes/insights/insightLogic'-import { TrendInsight } from 'scenes/trends/Trends'import { mswDecorator } from '~/mocks/browser'import trendsValueFixture from '~/mocks/fixtures/api/projects/team_id/insights/trendsValue.json'@@ -19,6 +18,8 @@ import { getCachedResults } from '~/queries/nodes/InsightViz/utils'import type { InsightLogicProps, InsightShortId } from '~/types'import { InsightType } from '~/types'+import { TrendInsight } from 'products/product_analytics/frontend/insights/trends/Trends'+import { TrendsBarChart } from './TrendsBarChart'type Story = StoryObj<{}>diff --git a/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.tsxindex d8f2772bc8db..fc4d841940bd 100644--- a/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.tsx+++ b/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart.tsx@@ -21,8 +21,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 { trendsDataLogic } from 'scenes/trends/trendsDataLogic'-import type { IndexedTrendResult } from 'scenes/trends/types'import { cohortsModel } from '~/models/cohortsModel'import { groupsModel } from '~/models/groupsModel'@@ -32,6 +30,9 @@ import { QueryContext } from '~/queries/types'import { getStackBreakdownValues } from '~/queries/utils'import { ChartDisplayType } from '~/types'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { hasTrendsChartData } from '../../shared/hasTrendsChartData'import { InsightSeriesTooltip } from '../../shared/InsightSeriesTooltip'import { INSIGHT_TOOLTIP_CONFIG } from '../../shared/tooltipConfig'diff --git a/products/product_analytics/frontend/insights/trends/TrendsBarChart/getAggregatedDisplayLabel.test.ts b/products/product_analytics/frontend/insights/trends/TrendsBarChart/getAggregatedDisplayLabel.test.tsindex 19e711752797..c68966ace398 100644--- a/products/product_analytics/frontend/insights/trends/TrendsBarChart/getAggregatedDisplayLabel.test.ts+++ b/products/product_analytics/frontend/insights/trends/TrendsBarChart/getAggregatedDisplayLabel.test.ts@@ -1,7 +1,7 @@-import type { IndexedTrendResult } from 'scenes/trends/types'-import type { BreakdownFilter } from '~/queries/schema/schema-general'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { type AggregatedDisplayLabelDeps, getAggregatedDisplayLabel } from './getAggregatedDisplayLabel'const mkResult = (overrides: Partial<IndexedTrendResult>): IndexedTrendResult =>diff --git a/products/product_analytics/frontend/insights/trends/TrendsBarChart/getAggregatedDisplayLabel.ts b/products/product_analytics/frontend/insights/trends/TrendsBarChart/getAggregatedDisplayLabel.tsindex 738fe405d13d..7def54a21a66 100644--- a/products/product_analytics/frontend/insights/trends/TrendsBarChart/getAggregatedDisplayLabel.ts+++ b/products/product_analytics/frontend/insights/trends/TrendsBarChart/getAggregatedDisplayLabel.ts@@ -1,10 +1,11 @@import { formatBreakdownLabel, getDisplayNameFromEntityFilter } from 'scenes/insights/utils'-import type { IndexedTrendResult } from 'scenes/trends/types'import { FormatPropertyValueForDisplayFunction } from '~/models/propertyDefinitionsModel'import { BreakdownFilter } from '~/queries/schema/schema-general'import { CohortType } from '~/types'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { humanizeSeriesLabel } from '../shared/humanizeSeriesLabel'export interface AggregatedDisplayLabelDeps {diff --git a/products/product_analytics/frontend/insights/trends/TrendsBarChart/handleTrendsBarAggregatedChartClick.test.ts b/products/product_analytics/frontend/insights/trends/TrendsBarChart/handleTrendsBarAggregatedChartClick.test.tsindex c5f2beaebee7..ec5fb8f777b9 100644--- a/products/product_analytics/frontend/insights/trends/TrendsBarChart/handleTrendsBarAggregatedChartClick.test.ts+++ b/products/product_analytics/frontend/insights/trends/TrendsBarChart/handleTrendsBarAggregatedChartClick.test.ts@@ -1,8 +1,8 @@-import type { IndexedTrendResult } from 'scenes/trends/types'-import { NodeKind } from '~/queries/schema/schema-general'import { EntityTypes } from '~/types'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import type { TrendsChartClickDeps } from '../shared/handleTrendsChartClick'import { handleTrendsBarAggregatedChartClick } from './handleTrendsBarAggregatedChartClick'diff --git a/products/product_analytics/frontend/insights/trends/TrendsBarChart/handleTrendsBarAggregatedChartClick.ts b/products/product_analytics/frontend/insights/trends/TrendsBarChart/handleTrendsBarAggregatedChartClick.tsindex ae03c6534133..1555408b4eff 100644--- a/products/product_analytics/frontend/insights/trends/TrendsBarChart/handleTrendsBarAggregatedChartClick.ts+++ b/products/product_analytics/frontend/insights/trends/TrendsBarChart/handleTrendsBarAggregatedChartClick.ts@@ -1,4 +1,4 @@-import { datasetToActorsQuery } from 'scenes/trends/viz/datasetToActorsQuery'+import { datasetToActorsQuery } from 'products/product_analytics/frontend/insights/trends/viz/datasetToActorsQuery'import type { TrendsChartClickDeps } from '../shared/handleTrendsChartClick'diff --git a/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/TrendsLifecycleChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/TrendsLifecycleChart.tsxindex 9bc152a7910a..e4628f70f2f5 100644--- a/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/TrendsLifecycleChart.tsx+++ b/products/product_analytics/frontend/insights/trends/TrendsLifecycleChart/TrendsLifecycleChart.tsx@@ -14,13 +14,14 @@ 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 { InsightVizNode } from '~/queries/schema/schema-general'import { QueryContext } from '~/queries/types'import type { LifecycleToggle } from '~/types'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { hasTrendsChartData } from '../../shared/hasTrendsChartData'import { InsightSeriesTooltip } from '../../shared/InsightSeriesTooltip'import { buildBaseLegendConfig } from '../shared/buildBaseLegendConfig'diff --git a/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsxindex a3a417445668..fb89641ee88b 100644--- a/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx+++ b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx@@ -7,7 +7,6 @@ import { dimensions, dragSelection, rawDrag, setupJsdom, setupSyncRaf } from '@pimport { FEATURE_FLAGS } from 'lib/constants'import { removeProjectIdIfPresent } from 'lib/utils/kea-router'-import type { IndexedTrendResult } from 'scenes/trends/types'import { urls } from 'scenes/urls'import { ExportType } from '~/exporter/types'@@ -27,6 +26,8 @@ import {import { buildAnnotation } from '~/test/insight-testing/test-data'import { AnnotationScope, ChartDisplayType, InsightShortId } from '~/types'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { extendLabelsToLongestSeries } from './TrendsLineChart'// The full InsightViz tree is heavy to mount under jsdom; on contended CI shardsdiff --git a/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.tsxindex bb29628354ee..e2e0c2273654 100644--- a/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.tsx+++ b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.tsx@@ -17,8 +17,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 { trendsDataLogic } from 'scenes/trends/trendsDataLogic'-import type { IndexedTrendResult } from 'scenes/trends/types'import { urls } from 'scenes/urls'import { cohortsModel } from '~/models/cohortsModel'@@ -28,6 +26,9 @@ import { InsightVizNode } from '~/queries/schema/schema-general'import { QueryContext } from '~/queries/types'import { ChartDisplayType, type IntervalType } from '~/types'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { chartStyleCurve } from '../../shared/chartStyleAdapter'import { hasTrendsChartData } from '../../shared/hasTrendsChartData'import { InsightSeriesTooltip } from '../../shared/InsightSeriesTooltip'diff --git a/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.tsxindex 84c50aa0b5e2..1876fd56e04c 100644--- a/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.tsx+++ b/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.tsx@@ -16,9 +16,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 { trendsDataLogic } from 'scenes/trends/trendsDataLogic'-import type { IndexedTrendResult } from 'scenes/trends/types'-import { datasetToActorsQuery } from 'scenes/trends/viz/datasetToActorsQuery'import { cohortsModel } from '~/models/cohortsModel'import { groupsModel } from '~/models/groupsModel'@@ -27,6 +24,10 @@ import { InsightVizNode } from '~/queries/schema/schema-general'import { QueryContext } from '~/queries/types'import { ChartDisplayType } from '~/types'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { datasetToActorsQuery } from 'products/product_analytics/frontend/insights/trends/viz/datasetToActorsQuery'+import { InsightSeriesTooltip } from '../../shared/InsightSeriesTooltip'import { getTrendsSeriesDisplayLabel } from '../shared/getTrendsSeriesDisplayLabel'import type { TrendsSeriesMeta } from '../shared/trendsSeriesMeta'diff --git a/products/product_analytics/frontend/insights/trends/TrendsPieChart/persons-modal-parity.test.ts b/products/product_analytics/frontend/insights/trends/TrendsPieChart/persons-modal-parity.test.tsindex 28626c856bc3..b5e6cbb107af 100644--- a/products/product_analytics/frontend/insights/trends/TrendsPieChart/persons-modal-parity.test.ts+++ b/products/product_analytics/frontend/insights/trends/TrendsPieChart/persons-modal-parity.test.ts@@ -1,10 +1,10 @@-import type { IndexedTrendResult } from 'scenes/trends/types'-import { datasetToActorsQuery } from 'scenes/trends/viz/datasetToActorsQuery'-import type { InsightActorsQuery } from '~/queries/schema/schema-general'import { NodeKind } from '~/queries/schema/schema-general'import type { ActionFilter, GraphDataset } from '~/types'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { datasetToActorsQuery } from 'products/product_analytics/frontend/insights/trends/viz/datasetToActorsQuery'+/** Verifies that the hog-charts TrendsPieChart click handler builds the same `InsightActorsQuery`* as the legacy ActionsPie. Both call `datasetToActorsQuery` — ActionsPie passes a `GraphDataset`* whose `breakdownValues` / `compareLabels` arrays carry one entry per slice plus the slicediff --git a/products/product_analytics/frontend/insights/trends/TrendsPieChart/trendsPieTransforms.test.ts b/products/product_analytics/frontend/insights/trends/TrendsPieChart/trendsPieTransforms.test.tsindex c0a00185f778..eb87c6e81c70 100644--- a/products/product_analytics/frontend/insights/trends/TrendsPieChart/trendsPieTransforms.test.ts+++ b/products/product_analytics/frontend/insights/trends/TrendsPieChart/trendsPieTransforms.test.ts@@ -1,4 +1,4 @@-import type { IndexedTrendResult } from 'scenes/trends/types'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'import { buildTrendsPieSeries } from './trendsPieTransforms'diff --git a/products/product_analytics/frontend/insights/trends/TrendsPieChart/trendsPieTransforms.ts b/products/product_analytics/frontend/insights/trends/TrendsPieChart/trendsPieTransforms.tsindex 71b300d1a98b..e1ea3c357807 100644--- a/products/product_analytics/frontend/insights/trends/TrendsPieChart/trendsPieTransforms.ts+++ b/products/product_analytics/frontend/insights/trends/TrendsPieChart/trendsPieTransforms.ts@@ -1,6 +1,6 @@import type { Series } from '@posthog/quill-charts'-import type { IndexedTrendResult } from 'scenes/trends/types'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'import { humanizeSeriesLabel } from '../shared/humanizeSeriesLabel'import type { TrendsSeriesMeta } from '../shared/trendsSeriesMeta'diff --git a/products/product_analytics/frontend/insights/trends/TrendsSlopeChart/TrendsSlopeChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsSlopeChart/TrendsSlopeChart.tsxindex 37ab757dc77c..ceedb3bba5df 100644--- a/products/product_analytics/frontend/insights/trends/TrendsSlopeChart/TrendsSlopeChart.tsx+++ b/products/product_analytics/frontend/insights/trends/TrendsSlopeChart/TrendsSlopeChart.tsx@@ -10,12 +10,13 @@ import { InsightEmptyState } from 'scenes/insights/EmptyStates'import { insightLogic } from 'scenes/insights/insightLogic'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'import { teamLogic } from 'scenes/teamLogic'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'-import type { IndexedTrendResult } from 'scenes/trends/types'import { InsightVizNode } from '~/queries/schema/schema-general'import { QueryContext } from '~/queries/types'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { makeChartErrorHandler } from '../shared/chartErrorHandler'interface TrendsSlopeChartProps {diff --git a/frontend/src/scenes/trends/__mocks__/trendsDataLogicMocks.ts b/products/product_analytics/frontend/insights/trends/__mocks__/trendsDataLogicMocks.tssimilarity index 100%rename from frontend/src/scenes/trends/__mocks__/trendsDataLogicMocks.tsrename to products/product_analytics/frontend/insights/trends/__mocks__/trendsDataLogicMocks.tsdiff --git a/frontend/src/scenes/trends/mathsLogic.tsx b/products/product_analytics/frontend/insights/trends/mathsLogic.tsxsimilarity index 99%rename from frontend/src/scenes/trends/mathsLogic.tsxrename to products/product_analytics/frontend/insights/trends/mathsLogic.tsxindex 23c546652146..0a7bad93b110 100644--- a/frontend/src/scenes/trends/mathsLogic.tsx+++ b/products/product_analytics/frontend/insights/trends/mathsLogic.tsx@@ -2,8 +2,10 @@ import { MakeLogicType, connect, kea, path, selectors } from 'kea'import { groupsAccessLogic } from 'lib/introductions/groupsAccessLogic'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'import { groupsModel } from '~/models/groupsModel'+import type { Noun } from '~/models/groupsModel'import { MathType } from '~/queries/schema/schema-general'import {BaseMathType,@@ -14,10 +16,7 @@ import {HogQLMathType,PropertyMathType,} from '~/types'--import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'-import type { Noun } from '../../models/groupsModel'-import type { GroupType, GroupTypeIndex } from '../../types'+import type { GroupType, GroupTypeIndex } from '~/types'export enum MathCategory {EventCount,diff --git a/products/product_analytics/frontend/insights/trends/shared/TrendsAlertOverlays.tsx b/products/product_analytics/frontend/insights/trends/shared/TrendsAlertOverlays.tsxindex c26808d26f96..d1f95b430a10 100644--- a/products/product_analytics/frontend/insights/trends/shared/TrendsAlertOverlays.tsx+++ b/products/product_analytics/frontend/insights/trends/shared/TrendsAlertOverlays.tsx@@ -3,11 +3,10 @@ import React, { useMemo } from 'react'import { AnomalyPointsLayer, ReferenceLines } from '@posthog/quill-charts'-import type { IndexedTrendResult } from 'scenes/trends/types'-import type { InsightLogicProps } from '~/types'import { insightAlertsLogic } from 'products/alerts/frontend/logic/insightAlertsLogic'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'import { buildAnomalyMarkers } from './anomalyPointsAdapter'import { alertThresholdsToReferenceLines } from './goalLinesAdapter'diff --git a/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.test.ts b/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.test.tsindex 3492d07d1409..a998f5b45fb4 100644--- a/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.test.ts+++ b/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.test.ts@@ -1,8 +1,7 @@-import type { IndexedTrendResult } from 'scenes/trends/types'-import { EntityTypes } from '~/types'import type { AnomalyPoint } from 'products/alerts/frontend/types'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'import { buildAnomalyMarkers } from './anomalyPointsAdapter'diff --git a/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.ts b/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.tsindex 67f574ed47c5..5184d2c9e75a 100644--- a/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.ts+++ b/products/product_analytics/frontend/insights/trends/shared/anomalyPointsAdapter.ts@@ -1,8 +1,7 @@import type { AnomalyMarker as BaseAnomalyMarker } from '@posthog/quill-charts'-import type { IndexedTrendResult } from 'scenes/trends/types'-import type { AnomalyPoint } from 'products/alerts/frontend/types'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'export interface AnomalyMarker extends BaseAnomalyMarker {/** Originating alert anomaly score (0..1) if available. */diff --git a/products/product_analytics/frontend/insights/trends/shared/getTrendsSeriesDisplayLabel.test.ts b/products/product_analytics/frontend/insights/trends/shared/getTrendsSeriesDisplayLabel.test.tsindex 47c955ebbf1b..3ea4ed083d93 100644--- a/products/product_analytics/frontend/insights/trends/shared/getTrendsSeriesDisplayLabel.test.ts+++ b/products/product_analytics/frontend/insights/trends/shared/getTrendsSeriesDisplayLabel.test.ts@@ -1,4 +1,4 @@-import type { IndexedTrendResult } from 'scenes/trends/types'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'import { getTrendsSeriesDisplayLabel, type TrendsSeriesLabelDeps } from './getTrendsSeriesDisplayLabel'diff --git a/products/product_analytics/frontend/insights/trends/shared/getTrendsSeriesDisplayLabel.ts b/products/product_analytics/frontend/insights/trends/shared/getTrendsSeriesDisplayLabel.tsindex 9e7f0cf78c2b..787136de44df 100644--- a/products/product_analytics/frontend/insights/trends/shared/getTrendsSeriesDisplayLabel.ts+++ b/products/product_analytics/frontend/insights/trends/shared/getTrendsSeriesDisplayLabel.ts@@ -1,10 +1,11 @@import { formatBreakdownLabel, getDisplayNameFromEntityFilter } from 'scenes/insights/utils'-import type { IndexedTrendResult } from 'scenes/trends/types'import type { FormatPropertyValueForDisplayFunction } from '~/models/propertyDefinitionsModel'import type { BreakdownFilter } from '~/queries/schema/schema-general'import type { CohortType } from '~/types'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { humanizeSeriesLabel } from './humanizeSeriesLabel'export interface TrendsSeriesLabelDeps {diff --git a/products/product_analytics/frontend/insights/trends/shared/handleTrendsChartClick.test.tsx b/products/product_analytics/frontend/insights/trends/shared/handleTrendsChartClick.test.tsxindex e39f4869d3ab..21c6db3d15c2 100644--- a/products/product_analytics/frontend/insights/trends/shared/handleTrendsChartClick.test.tsx+++ b/products/product_analytics/frontend/insights/trends/shared/handleTrendsChartClick.test.tsx@@ -1,8 +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 'products/product_analytics/frontend/insights/trends/types'+import { handleTrendsChartClick, type TrendsChartClickDeps } from './handleTrendsChartClick'function makeTrendResult(overrides: Partial<IndexedTrendResult> = {}): IndexedTrendResult {diff --git a/products/product_analytics/frontend/insights/trends/shared/handleTrendsChartClick.tsx b/products/product_analytics/frontend/insights/trends/shared/handleTrendsChartClick.tsxindex b6487c8d1c67..61fc61276b3f 100644--- a/products/product_analytics/frontend/insights/trends/shared/handleTrendsChartClick.tsx+++ b/products/product_analytics/frontend/insights/trends/shared/handleTrendsChartClick.tsx@@ -1,12 +1,13 @@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 { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+import { datasetToActorsQuery } from 'products/product_analytics/frontend/insights/trends/viz/datasetToActorsQuery'+export interface TrendsChartClickDeps {context?: QueryContext<InsightVizNode>hasPersonsModal: booleandiff --git a/products/product_analytics/frontend/insights/trends/shared/trendsSeriesMeta.ts b/products/product_analytics/frontend/insights/trends/shared/trendsSeriesMeta.tsindex 3d76a243d5f0..dc635c2322d6 100644--- a/products/product_analytics/frontend/insights/trends/shared/trendsSeriesMeta.ts+++ b/products/product_analytics/frontend/insights/trends/shared/trendsSeriesMeta.ts@@ -1,9 +1,10 @@import type { SeriesDatum } from 'scenes/insights/InsightTooltip/insightTooltipUtils'-import type { IndexedTrendResult } from 'scenes/trends/types'import type { Noun } from '~/models/groupsModel'import type { ActionFilter } from '~/types'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+export type TrendsSeriesMeta = {action?: ActionFilter/** Series name for results without an `action` — formula results carry their formula label here. */diff --git a/products/product_analytics/frontend/insights/trends/shared/useInsightsLegendConfig.test.tsx b/products/product_analytics/frontend/insights/trends/shared/useInsightsLegendConfig.test.tsxindex 633afe2c232f..484ac1c37588 100644--- a/products/product_analytics/frontend/insights/trends/shared/useInsightsLegendConfig.test.tsx+++ b/products/product_analytics/frontend/insights/trends/shared/useInsightsLegendConfig.test.tsx@@ -7,7 +7,6 @@ import { insightDataLogic } from 'scenes/insights/insightDataLogic'import { insightLogic } from 'scenes/insights/insightLogic'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'import { getTrendResultCustomizationKey } from 'scenes/insights/utils'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'import { dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'import {@@ -21,6 +20,8 @@ import {import { initKeaTests } from '~/test/init'import { InsightLogicProps, InsightModel } from '~/types'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import { useInsightsLegendConfig } from './useInsightsLegendConfig'const insightProps: InsightLogicProps = { dashboardItemId: undefined }diff --git a/products/product_analytics/frontend/insights/trends/shared/useInsightsLegendConfig.tsx b/products/product_analytics/frontend/insights/trends/shared/useInsightsLegendConfig.tsxindex 177efbb79ec2..9a306f76525f 100644--- a/products/product_analytics/frontend/insights/trends/shared/useInsightsLegendConfig.tsx+++ b/products/product_analytics/frontend/insights/trends/shared/useInsightsLegendConfig.tsx@@ -6,11 +6,12 @@ import type { ChartLegendConfig } from '@posthog/quill-charts'import { useChartLegendSeriesMenu } from 'lib/components/ChartLegendSeriesMenu/useChartLegendSeriesMenu'import { insightLogic } from 'scenes/insights/insightLogic'import { getTrendResultCustomizationKey } from 'scenes/insights/utils'-import { trendsDataLogic } from 'scenes/trends/trendsDataLogic'-import type { IndexedTrendResult } from 'scenes/trends/types'import { InsightLogicProps } from '~/types'+import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'+import type { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'+interface UseInsightsLegendConfigOptions {insightProps: InsightLogicPropsinSharedMode?: booleandiff --git a/frontend/src/scenes/trends/trendsDataLogic.test.ts b/products/product_analytics/frontend/insights/trends/trendsDataLogic.test.tssimilarity index 100%rename from frontend/src/scenes/trends/trendsDataLogic.test.tsrename to products/product_analytics/frontend/insights/trends/trendsDataLogic.test.tsdiff --git a/frontend/src/scenes/trends/trendsDataLogic.ts b/products/product_analytics/frontend/insights/trends/trendsDataLogic.tssimilarity index 99%rename from frontend/src/scenes/trends/trendsDataLogic.tsrename to products/product_analytics/frontend/insights/trends/trendsDataLogic.tsindex cf2cb53ec3ce..87fdc8ebe31e 100644--- a/frontend/src/scenes/trends/trendsDataLogic.ts+++ b/products/product_analytics/frontend/insights/trends/trendsDataLogic.ts@@ -1,6 +1,7 @@import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'import { DataColorTheme, DataColorToken } from 'lib/colors'+import type { Intervals } from 'lib/components/IntervalFilter/intervals'import { PIE_DISPLAY_TYPES } from 'lib/constants'import { dayjs } from 'lib/dayjs'import { isMultiSeriesFormula } from 'lib/utils/strings'@@ -39,20 +40,6 @@ import {TrendsFilter,TrendsQuery,} from '~/queries/schema/schema-general'-import { hasBreakdownFilter } from '~/queries/utils'-import {- ChartDisplayType,- CountPerActorMathType,- HogQLMathType,- InsightLogicProps,- IntervalType,- LifecycleToggle,- PropertyMathType,- TrendAPIResponse,- TrendResult,-} from '~/types'--import type { Intervals } from '../../lib/components/IntervalFilter/intervals'import type {AnyDataWarehouseNode,AnyEntityNode,@@ -88,8 +75,21 @@ import type {VizSpecificOptions,WebOverviewQuery,WebStatsTableQuery,-} from '../../queries/schema/schema-general'-import type { PathsV2Query } from '../../queries/schema/schema-general'+} from '~/queries/schema/schema-general'+import type { PathsV2Query } from '~/queries/schema/schema-general'+import { hasBreakdownFilter } from '~/queries/utils'+import {+ ChartDisplayType,+ CountPerActorMathType,+ HogQLMathType,+ InsightLogicProps,+ IntervalType,+ LifecycleToggle,+ PropertyMathType,+ TrendAPIResponse,+ TrendResult,+} from '~/types'+import { IndexedTrendResult } from './types'export const RESULT_CUSTOMIZATION_DEFAULT = ResultCustomizationBy.Valuediff --git a/frontend/src/scenes/trends/types.ts b/products/product_analytics/frontend/insights/trends/types.tssimilarity index 100%rename from frontend/src/scenes/trends/types.tsrename to products/product_analytics/frontend/insights/trends/types.tsdiff --git a/frontend/src/scenes/trends/viz/datasetToActorsQuery.ts b/products/product_analytics/frontend/insights/trends/viz/datasetToActorsQuery.tssimilarity index 100%rename from frontend/src/scenes/trends/viz/datasetToActorsQuery.tsrename to products/product_analytics/frontend/insights/trends/viz/datasetToActorsQuery.ts