: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(insights): delete converters the series pickers no longer use (#116787)
Thomas Obermüller27b44d537ff8
diff --git a/frontend/src/lib/components/Sharing/SharingModal.tsx b/frontend/src/lib/components/Sharing/SharingModal.tsxindex 15fa267325de..be77f735267c 100644--- a/frontend/src/lib/components/Sharing/SharingModal.tsx+++ b/frontend/src/lib/components/Sharing/SharingModal.tsx@@ -34,7 +34,7 @@ import { projectLogic } from 'scenes/projectLogic'import { urls } from 'scenes/urls'import { AccessControlPopoutCTA } from '~/layout/navigation-3000/sidepanel/panels/access_control/AccessControlPopoutCTA'-import { nodeKindToInsightType } from '~/queries/nodes/InsightQuery/utils/queryNodeToFilter'+import { nodeKindToInsightType } from '~/queries/nodes/InsightQuery/defaults'import { AnyResponseType, Node } from '~/queries/schema/schema-general'import { NodeKind } from '~/queries/schema/schema-general'import { isDataTableNode, isDataVisualizationNode, isInsightVizNode } from '~/queries/utils'diff --git a/frontend/src/queries/nodes/InsightQuery/defaults.ts b/frontend/src/queries/nodes/InsightQuery/defaults.tsindex 6fedfa05a0b3..02955cf941fc 100644--- a/frontend/src/queries/nodes/InsightQuery/defaults.ts+++ b/frontend/src/queries/nodes/InsightQuery/defaults.ts@@ -12,7 +12,7 @@ import {StickinessQuery,TrendsQuery,} from '~/queries/schema/schema-general'-import { BaseMathType, ChartDisplayType, FunnelVizType, PathType, RetentionPeriod } from '~/types'+import { BaseMathType, ChartDisplayType, FunnelVizType, InsightType, PathType, RetentionPeriod } from '~/types'import { STEP_SOURCE_PRESETS } from 'products/product_analytics/frontend/insights/journeys/stepSourcePresets'@@ -164,6 +164,16 @@ export type ProductAnalyticsInsightNodeKind = Exclude<NodeKind.WebStatsTableQuery | NodeKind.WebOverviewQuery>+export const nodeKindToInsightType: Record<ProductAnalyticsInsightNodeKind, InsightType> = {+ [NodeKind.TrendsQuery]: InsightType.TRENDS,+ [NodeKind.FunnelsQuery]: InsightType.FUNNELS,+ [NodeKind.RetentionQuery]: InsightType.RETENTION,+ [NodeKind.PathsQuery]: InsightType.PATHS,+ [NodeKind.PathsV2Query]: InsightType.JOURNEYS,+ [NodeKind.StickinessQuery]: InsightType.STICKINESS,+ [NodeKind.LifecycleQuery]: InsightType.LIFECYCLE,+}+/** Legacy exports for backwards compatibility - use getNodeKindToDefaultQuery() instead */export const trendsQueryDefault = getTrendsQueryDefault()export const calendarHeatmapQueryDefault = getCalendarHeatmapQueryDefault()diff --git a/frontend/src/queries/nodes/InsightQuery/utils/actionsAndEventsToSeries.test.ts b/frontend/src/queries/nodes/InsightQuery/utils/actionsAndEventsToSeries.test.tsdeleted file mode 100644index 58226454c33b..000000000000--- a/frontend/src/queries/nodes/InsightQuery/utils/actionsAndEventsToSeries.test.ts+++ /dev/null@@ -1,150 +0,0 @@-import { MathAvailability } from 'scenes/insights/filters/ActionFilter/ActionFilterRow/types'--import { NodeKind } from '~/queries/schema/schema-general'-import { ActionFilter, BaseMathType, FunnelDatawarehouseFilter, LifecycleDatawarehouseFilter } from '~/types'--import { actionsAndEventsToSeries } from './actionsAndEventsToSeries'--describe('actionsAndEventsToSeries', () => {- it('sorts series by order', () => {- const actions: ActionFilter[] = [{ type: 'actions', id: '1', order: 1, name: 'item2', math: 'total' }]- const events: ActionFilter[] = [- { id: '$pageview', type: 'events', order: 0, name: 'item1' },- { id: '$autocapture', type: 'events', order: 2, name: 'item3' },- ]-- const result = actionsAndEventsToSeries({ actions, events }, false, MathAvailability.None)-- expect(result[0].name).toEqual('item1')- expect(result[1].name).toEqual('item2')- expect(result[2].name).toEqual('item3')- })-- it('sorts elements without order first', () => {- const actions: ActionFilter[] = [{ type: 'actions', id: '1', name: 'itemWithOrder', math: 'total' }]- const events: ActionFilter[] = [- { id: '$pageview', type: 'events', order: 0, name: 'item1' },- { id: '$autocapture', type: 'events', order: 2, name: 'item2' },- ]-- const result = actionsAndEventsToSeries({ actions, events }, false, MathAvailability.None)-- expect(result[0].name).toEqual('itemWithOrder')- expect(result[1].name).toEqual('item1')- expect(result[2].name).toEqual('item2')- })-- it('assumes typeless series is an event series', () => {- const events: ActionFilter[] = [{ id: '$pageview', order: 0, name: 'item1' } as any]-- const result = actionsAndEventsToSeries({ events }, false, MathAvailability.None)-- expect(result[0].kind).toEqual(NodeKind.EventsNode)- })-- it('converts funnels math types', () => {- const actions: ActionFilter[] = [- { type: 'actions', id: '1', order: 0, name: 'item1', math: 'total' },- { type: 'actions', id: '1', order: 1, name: 'item2', math: 'first_time_for_user' },- ]- const events: ActionFilter[] = [- { id: '$pageview', type: 'events', order: 2, name: 'item3', math: 'total' },- { id: '$autocapture', type: 'events', order: 3, name: 'item4', math: 'first_time_for_user' },- ]-- const result = actionsAndEventsToSeries({ events, actions }, false, MathAvailability.FunnelsOnly)-- expect(result).toEqual([- {- kind: NodeKind.ActionsNode,- id: '1',- name: 'item1',- },- {- kind: NodeKind.ActionsNode,- id: '1',- name: 'item2',- math: BaseMathType.FirstTimeForUser,- },- {- kind: NodeKind.EventsNode,- event: '$pageview',- name: 'item3',- },- {- kind: NodeKind.EventsNode,- event: '$autocapture',- name: 'item4',- math: BaseMathType.FirstTimeForUser,- },- ])- })-- it('converts lifecycle data warehouse series to lifecycle nodes', () => {- const data_warehouse: LifecycleDatawarehouseFilter[] = [- {- type: 'data_warehouse',- id: 'warehouse_orders',- order: 0,- name: 'Orders',- table_name: 'warehouse_orders',- timestamp_field: 'timestamp',- aggregation_target_field: 'order_id',- created_at_field: 'created_at',- },- ]-- const result = actionsAndEventsToSeries(- { data_warehouse },- true,- MathAvailability.None,- NodeKind.LifecycleDataWarehouseNode- )-- expect(result).toEqual([- {- kind: NodeKind.LifecycleDataWarehouseNode,- id: 'warehouse_orders',- name: 'Orders',- table_name: 'warehouse_orders',- timestamp_field: 'timestamp',- aggregation_target_field: 'order_id',- created_at_field: 'created_at',- },- ])- })-- it('converts funnels data warehouse series to funnels nodes', () => {- const data_warehouse: FunnelDatawarehouseFilter[] = [- {- type: 'data_warehouse' as const,- id: 'warehouse_orders',- order: 0,- name: 'Orders',- table_name: 'warehouse_orders',- timestamp_field: 'timestamp',- id_field: 'id',- aggregation_target_field: 'person_id',- },- ]-- const result = actionsAndEventsToSeries(- { data_warehouse },- true,- MathAvailability.FunnelsOnly,- NodeKind.FunnelsDataWarehouseNode- )-- expect(result).toEqual([- {- kind: NodeKind.FunnelsDataWarehouseNode,- id: 'warehouse_orders',- name: 'Orders',- table_name: 'warehouse_orders',- timestamp_field: 'timestamp',- id_field: 'id',- aggregation_target_field: 'person_id',- },- ])- })-})diff --git a/frontend/src/queries/nodes/InsightQuery/utils/queryNodeToFilter.ts b/frontend/src/queries/nodes/InsightQuery/utils/queryNodeToFilter.tsindex 415f9d1ea437..4a19ce1b0de5 100644--- a/frontend/src/queries/nodes/InsightQuery/utils/queryNodeToFilter.ts+++ b/frontend/src/queries/nodes/InsightQuery/utils/queryNodeToFilter.ts@@ -1,7 +1,7 @@import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'import { objectClean } from 'lib/utils/objects'-import { ProductAnalyticsInsightNodeKind } from '~/queries/nodes/InsightQuery/defaults'+import { ProductAnalyticsInsightNodeKind, nodeKindToInsightType } from '~/queries/nodes/InsightQuery/defaults'import {AnyDataWarehouseNode,AnyEntityNode,@@ -60,10 +60,7 @@ const getFilterId = (node: AnyEntityNode<AnyDataWarehouseNode> | GroupNode): anyreturn node.event}-export const seriesNodeToFilter = (- node: AnyEntityNode<AnyDataWarehouseNode> | GroupNode,- index?: number-): ActionFilter => {+const seriesNodeToFilter = (node: AnyEntityNode<AnyDataWarehouseNode> | GroupNode, index?: number): ActionFilter => {const entity: ActionFilter = objectClean({type: isAnyDataWarehouseNode(node)? EntityTypes.DATA_WAREHOUSE@@ -119,7 +116,7 @@ export const seriesNodeToFilter = (return entity}-export const seriesToActionsAndEvents = (+const seriesToActionsAndEvents = (series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode)[]): Required<FilterTypeActionsAndEvents> => {const actions: ActionFilter[] = []@@ -162,16 +159,6 @@ export const hiddenLegendItemsToKeys = ({} as Record<string, boolean | undefined>)-export const nodeKindToInsightType: Record<ProductAnalyticsInsightNodeKind, InsightType> = {- [NodeKind.TrendsQuery]: InsightType.TRENDS,- [NodeKind.FunnelsQuery]: InsightType.FUNNELS,- [NodeKind.RetentionQuery]: InsightType.RETENTION,- [NodeKind.PathsQuery]: InsightType.PATHS,- [NodeKind.PathsV2Query]: InsightType.JOURNEYS,- [NodeKind.StickinessQuery]: InsightType.STICKINESS,- [NodeKind.LifecycleQuery]: InsightType.LIFECYCLE,-}-const nodeKindToFilterKey: Record<ProductAnalyticsInsightNodeKind, string> = {[NodeKind.TrendsQuery]: 'trendsFilter',[NodeKind.FunnelsQuery]: 'funnelsFilter',diff --git a/frontend/src/queries/nodes/InsightQuery/utils/actionsAndEventsToSeries.ts b/frontend/src/scenes/dashboard/dashboardTemplateEntities.tssimilarity index 70%rename from frontend/src/queries/nodes/InsightQuery/utils/actionsAndEventsToSeries.tsrename to frontend/src/scenes/dashboard/dashboardTemplateEntities.tsindex 34027d5307a2..ae90704b81a1 100644--- a/frontend/src/queries/nodes/InsightQuery/utils/actionsAndEventsToSeries.ts+++ b/frontend/src/scenes/dashboard/dashboardTemplateEntities.ts@@ -6,6 +6,7 @@ import {funnelsMathTypes,} from 'scenes/insights/filters/ActionFilter/cleanSeriesNodes'+import { cleanEntityProperties } from '~/queries/nodes/InsightQuery/utils/cleanProperties'import {ActionsNode,AnyDataWarehouseNode,@@ -32,16 +33,6 @@ import {isGroupFilter,} from '~/types'-import { cleanEntityProperties } from './cleanProperties'--export type FilterTypeActionsAndEvents = {- events?: ActionFilter[]- actions?: ActionFilter[]- data_warehouse?: AnyDataWarehouseFilter[]- new_entity?: ActionFilter[]- groups?: ActionFilter[]-}-type DataWarehouseNodeKind =| NodeKind.DataWarehouseNode| NodeKind.FunnelsDataWarehouseNode@@ -175,52 +166,6 @@ export const legacyEntityToNode = () as any}-type FilterTypeActionsAndEventsWithGroups = FilterTypeActionsAndEvents & { groups: ActionFilter[] }-type FilterTypeActionsAndEventsWithoutGroups = Omit<FilterTypeActionsAndEvents, 'groups'> & { groups?: undefined }--export function actionsAndEventsToSeries(- filters: FilterTypeActionsAndEventsWithGroups,- includeProperties: boolean,- includeMath: MathAvailability,- dataWarehouseNodeKind?: NodeKind.DataWarehouseNode-): (AnyEntityNode | GroupNode)[]-export function actionsAndEventsToSeries(- filters: FilterTypeActionsAndEventsWithoutGroups,- includeProperties: boolean,- includeMath: MathAvailability,- dataWarehouseNodeKind: NodeKind.LifecycleDataWarehouseNode-): AnyEntityNode<LifecycleDataWarehouseNode>[]-export function actionsAndEventsToSeries(- filters: FilterTypeActionsAndEventsWithoutGroups,- includeProperties: boolean,- includeMath: MathAvailability,- dataWarehouseNodeKind: NodeKind.FunnelsDataWarehouseNode-): AnyEntityNode<FunnelsDataWarehouseNode>[]-export function actionsAndEventsToSeries(- filters: FilterTypeActionsAndEventsWithoutGroups,- includeProperties: boolean,- includeMath: MathAvailability,- dataWarehouseNodeKind?: NodeKind.DataWarehouseNode-): AnyEntityNode[]-export function actionsAndEventsToSeries(- { actions, events, data_warehouse, new_entity, groups }: FilterTypeActionsAndEvents,- includeProperties: boolean,- includeMath: MathAvailability,- dataWarehouseNodeKind: DataWarehouseNodeKind = NodeKind.DataWarehouseNode-): (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<AnyDataWarehouseNode>)[] {- const series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<AnyDataWarehouseNode>)[] = [- ...(actions || []),- ...(events || []),- ...(data_warehouse || []),- ...(new_entity || []),- ...(groups || []),- ]- .sort((a, b) => (a.order || b.order ? (!a.order ? -1 : !b.order ? 1 : a.order - b.order) : 0))- .map((f) => legacyEntityToNode(f, includeProperties, includeMath, dataWarehouseNodeKind))-- return series-}-export const sanitizeRetentionEntity = (entity: RetentionEntity | undefined): RetentionEntity | undefined => {if (!entity) {return undefined@@ -237,12 +182,3 @@ export const sanitizeRetentionEntity = (entity: RetentionEntity | undefined): Re...('custom_name' in entity ? { custom_name } : {}),}}--/** Expand GroupNodes into individual EventsNode/ActionsNode for insight types that don't support GroupNode */-export const expandGroupNodes = (- series: (EventsNode | ActionsNode | DataWarehouseNode | GroupNode)[]-): (EventsNode | ActionsNode | DataWarehouseNode)[] => {- return series.flatMap((item) =>- item.kind === NodeKind.GroupNode ? (item.nodes as (EventsNode | ActionsNode | DataWarehouseNode)[]) : [item]- )-}diff --git a/frontend/src/scenes/dashboard/newDashboardLogic.test.tsx b/frontend/src/scenes/dashboard/newDashboardLogic.test.tsxindex d7196d62d05a..1b55439775f4 100644--- a/frontend/src/scenes/dashboard/newDashboardLogic.test.tsx+++ b/frontend/src/scenes/dashboard/newDashboardLogic.test.tsx@@ -59,7 +59,32 @@ describe('template function in newDashboardLogic', () => {})})- it('replaces variables in query based tiles', () => {+ it.each([+ [+ 'replaces variables in query based tiles',+ NodeKind.TrendsQuery,+ { id: '$pageview' },+ { event: '$pageview', kind: 'EventsNode', math: 'total' },+ ],+ [+ "removes the math property from query based tiles that don't support it",+ NodeKind.LifecycleQuery,+ { id: '$pageview' },+ { event: '$pageview', kind: 'EventsNode' },+ ],+ [+ 'keeps a funnel math in funnel tiles',+ NodeKind.FunnelsQuery,+ { id: '$pageview', math: 'first_time_for_user' as any },+ { event: '$pageview', kind: 'EventsNode', math: 'first_time_for_user' },+ ],+ [+ 'removes a math that funnel tiles do not support',+ NodeKind.FunnelsQuery,+ { id: '$pageview', math: 'total' as any },+ { event: '$pageview', kind: 'EventsNode' },+ ],+ ])('%s', (_, queryKind, variableDefault, expected) => {expect(applyTemplate({ a: '{VARIABLE_1}' },@@ -67,49 +92,15 @@ describe('template function in newDashboardLogic', () => {{id: 'VARIABLE_1',name: 'a',- default: {- id: '$pageview',- },+ default: variableDefault,description: 'The description of the variable',required: true,type: 'event',},],- NodeKind.TrendsQuery+ queryKind)- ).toEqual({- a: {- event: '$pageview',- kind: 'EventsNode',- math: 'total',- },- })- })-- it("removes the math property from query based tiles that don't support it", () => {- expect(- applyTemplate(- { a: '{VARIABLE_1}' },- [- {- id: 'VARIABLE_1',- name: 'a',- default: {- id: '$pageview',- },- description: 'The description of the variable',- required: true,- type: 'event',- },- ],- NodeKind.LifecycleQuery- )- ).toEqual({- a: {- event: '$pageview',- kind: 'EventsNode',- },- })+ ).toEqual({ a: expected })})it('removes the math property from retention insight tiles', () => {diff --git a/frontend/src/scenes/dashboard/newDashboardLogic.ts b/frontend/src/scenes/dashboard/newDashboardLogic.tsindex 06191b51d21f..2b161235c352 100644--- a/frontend/src/scenes/dashboard/newDashboardLogic.ts+++ b/frontend/src/scenes/dashboard/newDashboardLogic.ts@@ -26,10 +26,6 @@ import { urls } from 'scenes/urls'import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'import { dashboardsModel } from '~/models/dashboardsModel'-import {- legacyEntityToNode,- sanitizeRetentionEntity,-} from '~/queries/nodes/InsightQuery/utils/actionsAndEventsToSeries'import { getQueryBasedDashboard } from '~/queries/nodes/InsightViz/utils'import { NodeKind } from '~/queries/schema/schema-general'import { isInsightVizNode } from '~/queries/utils'@@ -50,6 +46,7 @@ import {} from 'products/mcp_analytics/frontend/nudge/mcpAnalyticsNudgeLogic'import { UNFILED_DASHBOARDS_FOLDER } from './dashboardConstants'+import { legacyEntityToNode, sanitizeRetentionEntity } from './dashboardTemplateEntities'export interface NewDashboardForm {name: stringdiff --git a/frontend/src/scenes/experiments/Metrics/Selectors.tsx b/frontend/src/scenes/experiments/Metrics/Selectors.tsxindex e888c59d7a5d..19d299477b20 100644--- a/frontend/src/scenes/experiments/Metrics/Selectors.tsx+++ b/frontend/src/scenes/experiments/Metrics/Selectors.tsx@@ -1,20 +1,4 @@-import { useValues } from 'kea'--import { IconInfo } from '@posthog/icons'-import { LemonInput, LemonSelect, LemonSelectOption, LemonSelectSection } from '@posthog/lemon-ui'--import { HogQLEditor } from 'lib/components/HogQLEditor/HogQLEditor'import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'-import { groupsAccessLogic } from 'lib/introductions/groupsAccessLogic'-import { Tooltip } from 'lib/lemon-ui/Tooltip'-import { capitalizeFirstLetter, pluralize } from 'lib/utils/strings'--import { groupsModel } from '~/models/groupsModel'-import { BreakdownAttributionType, FunnelConversionWindowTimeUnit, StepOrderValue } from '~/types'--import { GroupIntroductionFooter } from 'products/groups/frontend/components/GroupsIntroduction'-import { FUNNEL_STEP_COUNT_LIMIT } from 'products/product_analytics/frontend/insights/funnels/editor/FunnelsQuerySteps'-import { TIME_INTERVAL_BOUNDS } from 'products/product_analytics/frontend/insights/funnels/funnelUtils'export const commonActionFilterProps = {// Offers events whose data is moving out of the events table. Exposure is still measured with@@ -40,217 +24,3 @@ export const commonActionFilterProps = {TaxonomicFilterGroupType.DataWarehousePersonProperties,],}--// Forked from https://github.com/PostHog/posthog/blob/master/products/product_analytics/frontend/insights/shared/AggregationSelect.tsx-export function FunnelAggregationSelect({- value,- onChange,-}: {- value: string- onChange: (value: string) => void-}): JSX.Element {- const { groupTypes, aggregationLabel } = useValues(groupsModel)- const { needsUpgradeForGroups, canStartUsingGroups } = useValues(groupsAccessLogic)-- const UNIQUE_USERS = 'person_id'- const baseValues = [UNIQUE_USERS]- const optionSections: LemonSelectSection<string>[] = [- {- title: 'Event Aggregation',- options: [- {- value: UNIQUE_USERS,- label: 'Unique users',- },- ],- },- ]- if (needsUpgradeForGroups || canStartUsingGroups) {- // if (false) {- optionSections[0].footer = <GroupIntroductionFooter needsUpgrade={needsUpgradeForGroups} />- } else {- Array.from(groupTypes.values()).forEach((groupType) => {- baseValues.push(`$group_${groupType.group_type_index}`)- optionSections[0].options.push({- value: `$group_${groupType.group_type_index}`,- label: `Unique ${aggregationLabel(groupType.group_type_index).plural}`,- })- })- }-- baseValues.push(`properties.$session_id`)- optionSections[0].options.push({- value: 'properties.$session_id',- label: `Unique sessions`,- })- optionSections[0].options.push({- label: 'Custom SQL expression',- options: [- {- // This is a bit of a hack so that the HogQL option is only highlighted as active when the user has- // set a custom value (because actually _all_ the options are HogQL)- value: !value || baseValues.includes(value) ? '' : value,- label: <span className="font-mono">{value}</span>,- labelInMenu: function CustomHogQLOptionWrapped({ onSelect }) {- return (- // eslint-disable-next-line react/forbid-dom-props- <div className="w-120" style={{ maxWidth: 'max(60vw, 20rem)' }}>- <HogQLEditor- onChange={onSelect}- value={value}- placeholder={- "Enter SQL expression, such as:\n- distinct_id\n- properties.$session_id\n- concat(distinct_id, ' ', properties.$session_id)\n- if(1 < 2, 'one', 'two')"- }- />- </div>- )- },- },- ],- })-- return (- <div className="flex items-center w-full gap-2">- <span>Aggregating by</span>- <LemonSelect- className="flex-1"- value={value}- onChange={onChange}- options={optionSections}- dropdownMatchSelectWidth={false}- />- </div>- )-}--// Forked from https://github.com/PostHog/posthog/blob/master/products/product_analytics/frontend/insights/funnels/filters/FunnelConversionWindowFilter.tsx-export function FunnelConversionWindowFilter({- funnelWindowInterval,- funnelWindowIntervalUnit,- onFunnelWindowIntervalChange,- onFunnelWindowIntervalUnitChange,-}: {- funnelWindowInterval: number | undefined- funnelWindowIntervalUnit: FunnelConversionWindowTimeUnit | undefined- onFunnelWindowIntervalChange: (funnelWindowInterval: number | undefined) => void- onFunnelWindowIntervalUnitChange: (funnelWindowIntervalUnit: FunnelConversionWindowTimeUnit) => void-}): JSX.Element {- const options: LemonSelectOption<FunnelConversionWindowTimeUnit>[] = Object.keys(TIME_INTERVAL_BOUNDS).map(- (unit) => ({- label: capitalizeFirstLetter(pluralize(funnelWindowInterval ?? 7, unit, `${unit}s`, false)),- value: unit as FunnelConversionWindowTimeUnit,- })- )- const intervalBounds = TIME_INTERVAL_BOUNDS[funnelWindowIntervalUnit ?? FunnelConversionWindowTimeUnit.Day]-- return (- <div className="flex items-center gap-2">- <span className="flex whitespace-nowrap">- Conversion window limit- <Tooltip- title={- <>- <b>Recommended!</b> Limit to participants that converted within a specific time frame.- Participants that do not convert in this time frame will be considered as drop-offs.- </>- }- >- <IconInfo className="w-4 info-indicator" />- </Tooltip>- </span>- <div className="flex items-center gap-2">- <LemonInput- type="number"- className="max-w-20"- fullWidth={false}- min={intervalBounds[0]}- max={intervalBounds[1]}- value={funnelWindowInterval}- onChange={onFunnelWindowIntervalChange}- />- <LemonSelect- dropdownMatchSelectWidth={false}- value={funnelWindowIntervalUnit}- onChange={onFunnelWindowIntervalUnitChange}- options={options}- />- </div>- </div>- )-}--// Forked from https://github.com/PostHog/posthog/blob/master/products/product_analytics/frontend/insights/funnels/editor/FunnelAttributionFilter.tsx-export function FunnelAttributionSelect({- value,- onChange,- stepsLength,-}: {- value: BreakdownAttributionType | `${BreakdownAttributionType.Step}/${number}`- onChange: (value: BreakdownAttributionType | `${BreakdownAttributionType.Step}/${number}`) => void- stepsLength: number-}): JSX.Element {- const funnelOrderType = undefined-- return (- <div className="flex items-center w-full gap-2">- <div className="flex">- <span>Attribution type</span>- <Tooltip- docLink="https://posthog.com/docs/product-analytics/funnels#attribution-types"- title={- <div className="deprecated-space-y-2">- <div>- When breaking down funnels, it's possible that the same properties don't exist on every- event. For example, if you want to break down by browser on a funnel that contains both- frontend and backend events.- </div>- <div>- In this case, you can choose from which step the properties should be selected from by- modifying the attribution type. There are four modes to choose from:- </div>- <ul className="list-disc pl-4">- <li>First touchpoint: the first property value seen in any of the steps is chosen.</li>- <li>Last touchpoint: the last property value seen from all steps is chosen.</li>- <li>- All steps: the property value must be seen in all steps to be considered in the- funnel.- </li>- <li>Specific step: only the property value seen at the selected step is chosen.</li>- </ul>- </div>- }- >- <IconInfo className="text-xl text-secondary shrink-0 ml-1" />- </Tooltip>- </div>- <LemonSelect- value={value}- placeholder="Attribution"- options={[- { value: BreakdownAttributionType.FirstTouch, label: 'First touchpoint' },- { value: BreakdownAttributionType.LastTouch, label: 'Last touchpoint' },- { value: BreakdownAttributionType.AllSteps, label: 'All steps' },- {- value: BreakdownAttributionType.Step,- label: 'Any step',- hidden: funnelOrderType !== StepOrderValue.UNORDERED,- },- {- label: 'Specific step',- options: Array(FUNNEL_STEP_COUNT_LIMIT)- .fill(null)- .map((_, stepIndex) => ({- value: `${BreakdownAttributionType.Step}/${stepIndex}` as const,- label: `Step ${stepIndex + 1}`,- hidden: stepIndex >= stepsLength,- })),- hidden: funnelOrderType === StepOrderValue.UNORDERED,- },- ]}- onChange={onChange}- dropdownMaxContentWidth={true}- data-attr="breakdown-attributions"- />- </div>- )-}diff --git a/frontend/src/scenes/insights/InsightNav/expandGroupNodes.ts b/frontend/src/scenes/insights/InsightNav/expandGroupNodes.tsnew file mode 100644index 000000000000..a364b83d81cb--- /dev/null+++ b/frontend/src/scenes/insights/InsightNav/expandGroupNodes.ts@@ -0,0 +1,10 @@+import { ActionsNode, DataWarehouseNode, EventsNode, GroupNode, NodeKind } from '~/queries/schema/schema-general'++/** Expand GroupNodes into individual EventsNode/ActionsNode for insight types that don't support GroupNode */+export const expandGroupNodes = (+ series: (EventsNode | ActionsNode | DataWarehouseNode | GroupNode)[]+): (EventsNode | ActionsNode | DataWarehouseNode)[] => {+ return series.flatMap((item) =>+ item.kind === NodeKind.GroupNode ? (item.nodes as (EventsNode | ActionsNode | DataWarehouseNode)[]) : [item]+ )+}diff --git a/frontend/src/scenes/insights/InsightNav/insightNavLogic.tsx b/frontend/src/scenes/insights/InsightNav/insightNavLogic.tsxindex 0edeefe76b31..a3c78d98f8f0 100644--- a/frontend/src/scenes/insights/InsightNav/insightNavLogic.tsx+++ b/frontend/src/scenes/insights/InsightNav/insightNavLogic.tsx@@ -16,8 +16,7 @@ import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'import { filterTestAccountsDefaultsLogic } from 'scenes/settings/environment/filterTestAccountDefaultsLogic'import { urls } from 'scenes/urls'-import { expandGroupNodes } from '~/queries/nodes/InsightQuery/utils/actionsAndEventsToSeries'-import { nodeKindToInsightType } from '~/queries/nodes/InsightQuery/utils/queryNodeToFilter'+import { nodeKindToInsightType } from '~/queries/nodes/InsightQuery/defaults'import { getDefaultQuery } from '~/queries/nodes/InsightViz/utils'import {ActionsNode,@@ -92,6 +91,7 @@ import { PRODUCT_ANALYTICS_DEFAULT_QUERY_TAGS } from 'products/product_analyticsimport type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'import type { Node } from '../../../queries/schema/schema-general'import { MathAvailability } from '../filters/ActionFilter/ActionFilterRow/types'+import { expandGroupNodes } from './expandGroupNodes'export interface Tab {label: string | JSX.Elementdiff --git a/frontend/src/scenes/insights/filters/ActionFilter/legacyFilters.ts b/frontend/src/scenes/insights/filters/ActionFilter/legacyFilters.tsindex 7ff9194e98f2..c5409e559cf8 100644--- a/frontend/src/scenes/insights/filters/ActionFilter/legacyFilters.ts+++ b/frontend/src/scenes/insights/filters/ActionFilter/legacyFilters.ts@@ -2,7 +2,7 @@ import { convertPropertyGroupToProperties } from 'lib/components/PropertyFiltersimport { uuid } from 'lib/utils/dom'import { AnyEntityNode, GroupNode, NodeKind } from '~/queries/schema/schema-general'-import { ActionFilter, Entity, EntityTypes, FilterType } from '~/types'+import { ActionFilter, EntityTypes, FilterType } from '~/types'import {SeriesNode,@@ -148,8 +148,6 @@ export type LocalFilter = ActionFilter & {[key: string]: any}-export type BareEntity = Pick<Entity, 'id' | 'name'>-export function toLocalFilters(filters: Partial<FilterType>): LocalFilter[] {const localFilters = [...(filters[EntityTypes.ACTIONS] || []),@@ -169,19 +167,3 @@ export function toLocalFilters(filters: Partial<FilterType>): LocalFilter[] {: { ...filter, uuid: uuid() })}--export function toFilters(localFilters: LocalFilter[]): FilterType {- const filters = localFilters.map((filter, index) => ({- ...filter,- order: index,- // The first step of a funnel cannot be optional- optionalInFunnel: index == 0 ? undefined : filter.optionalInFunnel,- }))-- return {- [EntityTypes.ACTIONS]: filters.filter((filter) => filter.type === EntityTypes.ACTIONS),- [EntityTypes.EVENTS]: filters.filter((filter) => filter.type === EntityTypes.EVENTS),- [EntityTypes.DATA_WAREHOUSE]: filters.filter((filter) => filter.type === EntityTypes.DATA_WAREHOUSE),- [EntityTypes.GROUPS]: filters.filter((filter) => filter.type === EntityTypes.GROUPS),- } as FilterType-}diff --git a/frontend/src/scenes/insights/insightDataLogic.tsx b/frontend/src/scenes/insights/insightDataLogic.tsxindex f97b8796202d..c8fedf000c54 100644--- a/frontend/src/scenes/insights/insightDataLogic.tsx+++ b/frontend/src/scenes/insights/insightDataLogic.tsx@@ -39,7 +39,7 @@ import {rowCountFromResponse,} from '~/queries/nodes/DataVisualization/dataVisualizationLogic'import { sqlVisualizationDisabledReason } from '~/queries/nodes/DataVisualization/sqlVisualizationSupport'-import { nodeKindToInsightType } from '~/queries/nodes/InsightQuery/utils/queryNodeToFilter'+import { nodeKindToInsightType } from '~/queries/nodes/InsightQuery/defaults'import { insightVizDataNodeKey } from '~/queries/nodes/InsightViz/insightVizKeys'import { getDefaultQuery, queryFromKind } from '~/queries/nodes/InsightViz/utils'import { queryExportContext } from '~/queries/query'diff --git a/frontend/src/scenes/insights/utils/queryUtils.ts b/frontend/src/scenes/insights/utils/queryUtils.tsindex 5c41733fa68c..411b8f126958 100644--- a/frontend/src/scenes/insights/utils/queryUtils.ts+++ b/frontend/src/scenes/insights/utils/queryUtils.ts@@ -2,7 +2,7 @@ import { objectCleanWithEmpty, objectsEqual, removeUndefinedAndNull } from 'lib/import { isValidRE2 } from 'lib/utils/regexp'import { Variable } from '~/queries/nodes/DataVisualization/types'-import { nodeKindToInsightType } from '~/queries/nodes/InsightQuery/utils/queryNodeToFilter'+import { nodeKindToInsightType } from '~/queries/nodes/InsightQuery/defaults'import { getDefaultQuery } from '~/queries/nodes/InsightViz/utils'import {DataNode,diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex eafaff1395df..1374d19268bf 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -1759,8 +1759,6 @@ export interface FunnelExclusionLegacy extends Partial<EntityFilter> {funnel_to_step: number}-export type EntityFilterTypes = EntityFilter | ActionFilter | null-export interface PersonType {id?: stringuuid?: stringdiff --git a/products/experiments/frontend/legacy/index.ts b/products/experiments/frontend/legacy/index.tsindex 592e240eb5f4..c2d6653db894 100644--- a/products/experiments/frontend/legacy/index.ts+++ b/products/experiments/frontend/legacy/index.ts@@ -8,10 +8,6 @@ export { LegacyExperimentView } from './LegacyExperimentView'export { legacyExperimentLogic } from './legacyExperimentLogic'export { legacyExperimentModalsLogic } from './legacyExperimentModalsLogic'-// Metrics-export { TrendsMetricForm } from './metrics/TrendsMetricForm'-export { FunnelsMetricForm } from './metrics/FunnelsMetricForm'-// Shared Metricsexport { LegacySharedTrendsMetricForm } from './sharedMetrics/LegacySharedTrendsMetricForm'export { LegacySharedFunnelsMetricForm } from './sharedMetrics/LegacySharedFunnelsMetricForm'diff --git a/products/experiments/frontend/legacy/metrics/FunnelsMetricForm.tsx b/products/experiments/frontend/legacy/metrics/FunnelsMetricForm.tsxdeleted file mode 100644index 91076a371f0a..000000000000--- a/products/experiments/frontend/legacy/metrics/FunnelsMetricForm.tsx+++ /dev/null@@ -1,210 +0,0 @@-import { useActions, useValues } from 'kea'--import { LemonLabel } from '@posthog/lemon-ui'-import { LemonInput } from '@posthog/lemon-ui'--import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'-import { TestAccountFilterSwitch } from 'lib/components/TestAccountFiltersSwitch'-import { EXPERIMENT_DEFAULT_DURATION } from 'lib/constants'-import { LemonBanner } from 'lib/lemon-ui/LemonBanner'-import { ActionFilter } from 'scenes/insights/filters/ActionFilter/ActionFilter'-import { MathAvailability } from 'scenes/insights/filters/ActionFilter/ActionFilterRow/types'-import { getHogQLValue } from 'scenes/insights/filters/aggregationTarget'-import { teamLogic } from 'scenes/teamLogic'--import { actionsAndEventsToSeries } from '~/queries/nodes/InsightQuery/utils/actionsAndEventsToSeries'-import { queryNodeToFilter } from '~/queries/nodes/InsightQuery/utils/queryNodeToFilter'-import { Query } from '~/queries/Query/Query'-import { AnyEntityNode, ExperimentFunnelsQuery, NodeKind } from '~/queries/schema/schema-general'-import { experimentLogic } from '~/scenes/experiments/experimentLogic'-import {- FunnelAggregationSelect,- FunnelAttributionSelect,- FunnelConversionWindowFilter,- commonActionFilterProps,-} from '~/scenes/experiments/Metrics/Selectors'-import { BreakdownAttributionType, FilterType } from '~/types'--export function FunnelsMetricForm({ isSecondary = false }: { isSecondary?: boolean }): JSX.Element {- const { currentTeam } = useValues(teamLogic)- const { experiment, isExperimentLaunched, editingPrimaryMetricUuid, editingSecondaryMetricUuid } =- useValues(experimentLogic)- const { setFunnelsMetric } = useActions(experimentLogic)- const hasFilters = (currentTeam?.test_account_filters || []).length > 0-- const metrics = isSecondary ? experiment.metrics_secondary : experiment.metrics- const metricUuid = isSecondary ? editingSecondaryMetricUuid : editingPrimaryMetricUuid-- if (!metricUuid) {- return <></>- }-- const currentMetric = metrics.find((m) => m.uuid === metricUuid) as ExperimentFunnelsQuery-- if (!currentMetric) {- return <></>- }-- const actionFilterProps = {- ...commonActionFilterProps,- actionsTaxonomicGroupTypes: [TaxonomicFilterGroupType.Events, TaxonomicFilterGroupType.Actions],- }-- return (- <>- <div className="mb-4">- <LemonLabel>Name (optional)</LemonLabel>- <LemonInput- value={currentMetric.name}- onChange={(newName) => {- if (!currentMetric.uuid) {- return- }- setFunnelsMetric({- uuid: currentMetric.uuid,- name: newName,- isSecondary,- })- }}- />- </div>- <ActionFilter- bordered- filters={queryNodeToFilter(currentMetric.funnels_query)}- setFilters={({ actions, events, data_warehouse }: Partial<FilterType>): void => {- const series = actionsAndEventsToSeries(- { actions, events, data_warehouse } as any,- true,- MathAvailability.None- ) as AnyEntityNode[]-- if (!currentMetric.uuid) {- return- }- setFunnelsMetric({- uuid: currentMetric.uuid,- series,- isSecondary,- })- }}- typeKey="experiment-metric"- mathAvailability={MathAvailability.None}- buttonCopy="Add funnel step"- showSeriesIndicator={true}- seriesIndicatorType="numeric"- sortable={true}- showNestedArrow={true}- {...actionFilterProps}- />- <div className="mt-4 deprecated-space-y-4">- <FunnelAggregationSelect- value={getHogQLValue(- currentMetric.funnels_query.aggregation_group_type_index ?? undefined,- currentMetric.funnels_query.funnelsFilter?.funnelAggregateByHogQL ?? undefined- )}- onChange={(value) => {- if (!currentMetric.uuid) {- return- }- setFunnelsMetric({- uuid: currentMetric.uuid,- funnelAggregateByHogQL: value,- isSecondary,- })- }}- />- <FunnelConversionWindowFilter- funnelWindowInterval={currentMetric.funnels_query?.funnelsFilter?.funnelWindowInterval}- funnelWindowIntervalUnit={currentMetric.funnels_query?.funnelsFilter?.funnelWindowIntervalUnit}- onFunnelWindowIntervalChange={(funnelWindowInterval) => {- if (!currentMetric.uuid) {- return- }- setFunnelsMetric({- uuid: currentMetric.uuid,- funnelWindowInterval: funnelWindowInterval,- isSecondary,- })- }}- onFunnelWindowIntervalUnitChange={(funnelWindowIntervalUnit) => {- if (!currentMetric.uuid) {- return- }- setFunnelsMetric({- uuid: currentMetric.uuid,- funnelWindowIntervalUnit: funnelWindowIntervalUnit || undefined,- isSecondary,- })- }}- />- <FunnelAttributionSelect- value={(() => {- const breakdownAttributionType =- currentMetric.funnels_query?.funnelsFilter?.breakdownAttributionType- const breakdownAttributionValue =- currentMetric.funnels_query?.funnelsFilter?.breakdownAttributionValue-- const currentValue: BreakdownAttributionType | `${BreakdownAttributionType.Step}/${number}` =- !breakdownAttributionType- ? BreakdownAttributionType.FirstTouch- : breakdownAttributionType === BreakdownAttributionType.Step- ? `${breakdownAttributionType}/${breakdownAttributionValue || 0}`- : breakdownAttributionType-- return currentValue- })()}- onChange={(value) => {- if (!currentMetric.uuid) {- return- }- const [breakdownAttributionType, breakdownAttributionValue] = (value || '').split('/')- setFunnelsMetric({- uuid: currentMetric.uuid,- breakdownAttributionType: breakdownAttributionType as BreakdownAttributionType,- breakdownAttributionValue: breakdownAttributionValue- ? parseInt(breakdownAttributionValue)- : undefined,- isSecondary,- })- }}- stepsLength={currentMetric.funnels_query?.series?.length}- />- <TestAccountFilterSwitch- checked={(() => {- const val = currentMetric.funnels_query?.filterTestAccounts- return hasFilters ? !!val : false- })()}- onChange={(checked: boolean) => {- if (!currentMetric.uuid) {- return- }- setFunnelsMetric({- uuid: currentMetric.uuid,- filterTestAccounts: checked,- isSecondary,- })- }}- fullWidth- />- </div>- {isExperimentLaunched && (- <LemonBanner type="info" className="mt-3 mb-3">- Preview insights are generated based on {EXPERIMENT_DEFAULT_DURATION} days of data. This can cause a- mismatch between the preview and the actual results.- </LemonBanner>- )}- <div className="mt-4">- <Query- query={{- kind: NodeKind.InsightVizNode,- source: currentMetric.funnels_query,- showTable: false,- showLastComputation: true,- showLastComputationRefresh: false,- }}- readOnly- />- </div>- </>- )-}diff --git a/products/experiments/frontend/legacy/metrics/TrendsMetricForm.tsx b/products/experiments/frontend/legacy/metrics/TrendsMetricForm.tsxdeleted file mode 100644index 52c74425cb23..000000000000--- a/products/experiments/frontend/legacy/metrics/TrendsMetricForm.tsx+++ /dev/null@@ -1,313 +0,0 @@-import { useActions, useValues } from 'kea'-import { useState } from 'react'--import { LemonInput, LemonLabel, LemonTabs, LemonTag } from '@posthog/lemon-ui'--import { TestAccountFilterSwitch } from 'lib/components/TestAccountFiltersSwitch'-import { EXPERIMENT_DEFAULT_DURATION } from 'lib/constants'-import { dayjs } from 'lib/dayjs'-import { LemonBanner } from 'lib/lemon-ui/LemonBanner'-import { experimentLogic } from 'scenes/experiments/experimentLogic'-import { ActionFilter } from 'scenes/insights/filters/ActionFilter/ActionFilter'-import { MathAvailability } from 'scenes/insights/filters/ActionFilter/ActionFilterRow/types'-import { teamLogic } from 'scenes/teamLogic'--import { actionsAndEventsToSeries } from '~/queries/nodes/InsightQuery/utils/actionsAndEventsToSeries'-import { queryNodeToFilter } from '~/queries/nodes/InsightQuery/utils/queryNodeToFilter'-import { Query } from '~/queries/Query/Query'-import { AnyEntityNode, ExperimentTrendsQuery, InsightQueryNode, NodeKind } from '~/queries/schema/schema-general'-import { commonActionFilterProps } from '~/scenes/experiments/Metrics/Selectors'-import { BaseMathType, ChartDisplayType, FilterType } from '~/types'--import { SelectableCard } from 'products/experiments/frontend/components/SelectableCard'-import { LEGACY_EXPERIMENT_ALLOWED_MATH_TYPES } from 'products/experiments/frontend/constants'--export function TrendsMetricForm({ isSecondary = false }: { isSecondary?: boolean }): JSX.Element {- const { experiment, isExperimentLaunched, editingPrimaryMetricUuid, editingSecondaryMetricUuid } =- useValues(experimentLogic)- const { setTrendsMetric, setTrendsExposureMetric, setExperiment } = useActions(experimentLogic)- const { currentTeam } = useValues(teamLogic)- const hasFilters = (currentTeam?.test_account_filters || []).length > 0- const [activeTab, setActiveTab] = useState('main')-- const metrics = isSecondary ? experiment.metrics_secondary : experiment.metrics- const metricUuid = isSecondary ? editingSecondaryMetricUuid : editingPrimaryMetricUuid-- if (!metricUuid) {- return <></>- }-- const currentMetric = metrics.find((m) => m.uuid === metricUuid) as ExperimentTrendsQuery-- if (!currentMetric) {- return <></>- }-- const isDataWarehouseMetric = currentMetric.count_query?.series[0]?.kind === NodeKind.DataWarehouseNode-- return (- <>- <LemonTabs- activeKey={activeTab}- onChange={(newKey) => setActiveTab(newKey)}- tabs={[- {- key: 'main',- label: 'Main metric',- content: (- <>- <div className="mb-4">- <LemonLabel>Name (optional)</LemonLabel>- <LemonInput- value={currentMetric.name}- onChange={(newName) => {- if (!currentMetric.uuid) {- return- }- setTrendsMetric({- uuid: currentMetric.uuid,- name: newName,- isSecondary,- })- }}- />- </div>- <ActionFilter- bordered- filters={queryNodeToFilter(currentMetric.count_query)}- setFilters={({ actions, events, data_warehouse }: Partial<FilterType>): void => {- const series = actionsAndEventsToSeries(- { actions, events, data_warehouse } as any,- true,- MathAvailability.All- ) as AnyEntityNode[]-- // Custom exposure metrics are not supported for data warehouse metrics- if (series[0].kind === NodeKind.DataWarehouseNode) {- const metricsField = isSecondary ? 'metrics_secondary' : 'metrics'- setExperiment({- ...experiment,- [metricsField]: metrics.map((metric) =>- metric.uuid === metricUuid- ? { ...metric, exposure_query: undefined }- : metric- ),- })- }-- if (!currentMetric.uuid) {- return- }- setTrendsMetric({- uuid: currentMetric.uuid,- series,- isSecondary,- })- }}- typeKey="experiment-metric"- buttonCopy="Add graph series"- showSeriesIndicator={true}- entitiesLimit={1}- showNumericalPropsOnly={true}- allowedMathTypes={LEGACY_EXPERIMENT_ALLOWED_MATH_TYPES}- {...commonActionFilterProps}- />- <div className="mt-4 deprecated-space-y-4">- <TestAccountFilterSwitch- checked={hasFilters ? !!currentMetric.count_query?.filterTestAccounts : false}- onChange={(checked: boolean) => {- if (!currentMetric.uuid) {- return- }- setTrendsMetric({- uuid: currentMetric.uuid,- filterTestAccounts: checked,- isSecondary,- })- }}- fullWidth- />- </div>- {isExperimentLaunched && (- <LemonBanner type="info" className="mt-3 mb-3">- Preview insights are generated based on {EXPERIMENT_DEFAULT_DURATION} days of- data. This can cause a mismatch between the preview and the actual results.- </LemonBanner>- )}- <div className="mt-4">- <Query- query={{- kind: NodeKind.InsightVizNode,- source: currentMetric.count_query,- showTable: false,- showLastComputation: true,- showLastComputationRefresh: false,- }}- readOnly- />- </div>- </>- ),- },- {- key: 'exposure',- label: 'Exposure',- content: (- <>- <div className="flex gap-4 mb-4">- <SelectableCard- title="Default"- description={- <>- Uses the number of unique users who trigger the{' '}- <LemonTag>$feature_flag_called</LemonTag> event as your exposure count.- This is the recommended setting for most experiments, as it accurately- tracks variant exposure.- </>- }- selected={!currentMetric.exposure_query}- onClick={() => {- const metricsField = isSecondary ? 'metrics_secondary' : 'metrics'- setExperiment({- ...experiment,- [metricsField]: metrics.map((metric) =>- metric.uuid === metricUuid- ? { ...metric, exposure_query: undefined }- : metric- ),- })- }}- />- <SelectableCard- title="Custom"- description="Define your own exposure metric for specific use cases, such as counting by sessions instead of users. This gives you full control but requires careful configuration."- selected={!!currentMetric.exposure_query}- {...(isDataWarehouseMetric- ? {- disabled: true,- disabledReason:- 'Custom exposure events are not supported for data warehouse metrics. Please contact support if you need this feature.',- }- : { disabled: false })}- onClick={() => {- const metricsField = isSecondary ? 'metrics_secondary' : 'metrics'- setExperiment({- ...experiment,- [metricsField]: metrics.map((metric) =>- metric.uuid === metricUuid- ? {- ...metric,- exposure_query: {- kind: NodeKind.TrendsQuery,- series: [- {- kind: NodeKind.EventsNode,- name: '$feature_flag_called',- event: '$feature_flag_called',- math: BaseMathType.UniqueUsers,- },- ],- interval: 'day',- dateRange: {- date_from: dayjs()- .subtract(EXPERIMENT_DEFAULT_DURATION, 'day')- .format('YYYY-MM-DDTHH:mm'),- date_to: dayjs()- .endOf('d')- .format('YYYY-MM-DDTHH:mm'),- explicitDate: true,- },- trendsFilter: {- display: ChartDisplayType.ActionsLineGraph,- },- filterTestAccounts: true,- },- }- : metric- ),- })- }}- />- </div>- {currentMetric.exposure_query && (- <>- <ActionFilter- bordered- filters={queryNodeToFilter(- currentMetric.exposure_query as InsightQueryNode- )}- setFilters={({- actions,- events,- data_warehouse,- }: Partial<FilterType>): void => {- const series = actionsAndEventsToSeries(- { actions, events, data_warehouse } as any,- true,- MathAvailability.All- ) as AnyEntityNode[]-- if (!currentMetric.uuid) {- return- }- setTrendsExposureMetric({- uuid: currentMetric.uuid,- series,- isSecondary,- })- }}- typeKey="experiment-metric"- buttonCopy="Add graph series"- showSeriesIndicator={true}- entitiesLimit={1}- showNumericalPropsOnly={true}- {...commonActionFilterProps}- />- <div className="mt-4 deprecated-space-y-4">- <TestAccountFilterSwitch- checked={(() => {- const val = currentMetric.exposure_query?.filterTestAccounts- return hasFilters ? !!val : false- })()}- onChange={(checked: boolean) => {- if (!currentMetric.uuid) {- return- }- setTrendsExposureMetric({- uuid: currentMetric.uuid,- filterTestAccounts: checked,- isSecondary,- })- }}- fullWidth- />- </div>- {isExperimentLaunched && (- <LemonBanner type="info" className="mt-3 mb-3">- Preview insights are generated based on {EXPERIMENT_DEFAULT_DURATION}{' '}- days of data. This can cause a mismatch between the preview and the- actual results.- </LemonBanner>- )}- <div className="mt-4">- <Query- query={{- kind: NodeKind.InsightVizNode,- source: currentMetric.exposure_query,- showTable: false,- showLastComputation: true,- showLastComputationRefresh: false,- }}- readOnly- />- </div>- </>- )}- </>- ),- },- ]}- />- </>- )-}diff --git a/products/product_analytics/frontend/insights/funnels/filters/FunnelStepsPicker.tsx b/products/product_analytics/frontend/insights/funnels/filters/FunnelStepsPicker.tsxindex cda7316fce8b..c624e9a507d0 100644--- a/products/product_analytics/frontend/insights/funnels/filters/FunnelStepsPicker.tsx+++ b/products/product_analytics/frontend/insights/funnels/filters/FunnelStepsPicker.tsx@@ -5,8 +5,6 @@ import { LemonSelect, LemonSelectOption, LemonSelectOptions } from '@posthog/lemimport { EntityFilterInfo } from 'lib/components/EntityFilterInfo'import { insightLogic } from 'scenes/insights/insightLogic'-import { seriesNodeToFilter } from '~/queries/nodes/InsightQuery/utils/queryNodeToFilter'-import { funnelDataLogic } from '../funnelDataLogic'export function FunnelStepsPicker(): JSX.Element | null {@@ -36,7 +34,7 @@ export function FunnelStepsPicker(): JSX.Element | null {labelInMenu: (<><span>Step {stepIndex + 1} – </span>- <EntityFilterInfo filter={seriesNodeToFilter(filterSteps[stepIndex])} />+ <EntityFilterInfo filter={filterSteps[stepIndex]} /></>),}diff --git a/products/product_analytics/frontend/insights/retention/retentionPeopleLogic.ts b/products/product_analytics/frontend/insights/retention/retentionPeopleLogic.tsindex 60324de16dd2..555551323860 100644--- a/products/product_analytics/frontend/insights/retention/retentionPeopleLogic.ts+++ b/products/product_analytics/frontend/insights/retention/retentionPeopleLogic.ts@@ -1,11 +1,10 @@-import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers } from 'kea'import { loaders } from 'kea-loaders'import api from 'lib/api'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'-import { queryNodeToFilter } from '~/queries/nodes/InsightQuery/utils/queryNodeToFilter'import { NodeKind, RetentionQuery } from '~/queries/schema/schema-general'import type {DataNode,@@ -32,7 +31,6 @@ import type {} from '~/queries/schema/schema-general'import type { PathsV2Query } from '~/queries/schema/schema-general'import { InsightLogicProps } from '~/types'-import type { FilterType } from '~/types'import { queryForActors } from './queries'import { RetentionTablePeoplePayload } from './types'@@ -52,7 +50,6 @@ export interface retentionPeopleLogicValues {| WebOverviewQuery| WebStatsTableQuery| null // insightVizDataLogic- apiFilters: Partial<FilterType>people: RetentionTablePeoplePayloadpeopleLoading: booleanpeopleLoadingMore: boolean@@ -156,21 +153,6 @@ export interface retentionPeopleLogicActions {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface retentionPeopleLogicMeta {key: string- __keaTypeGenInternalSelectorTypes: {- apiFilters: (- querySource:- | FunnelsQuery- | LifecycleQuery- | PathsQuery- | PathsV2Query- | RetentionQuery- | StickinessQuery- | TrendsQuery- | WebOverviewQuery- | WebStatsTableQuery- | null- ) => Partial<FilterType>- }}export type retentionPeopleLogicType = MakeLogicType<@@ -228,23 +210,6 @@ export const retentionPeopleLogic = kea<retentionPeopleLogicType>([},],}),- selectors(() => ({- apiFilters: [- (s) => [s.querySource],- (- querySource:- | RetentionQuery- | null- | import('~/queries/schema/schema-general').FunnelsQuery- | import('~/queries/schema/schema-general').LifecycleQuery- | import('~/queries/schema/schema-general').PathsQuery- | import('~/queries/schema/schema-general').StickinessQuery- | import('~/queries/schema/schema-general').TrendsQuery- | import('~/queries/schema/schema-general').WebOverviewQuery- | import('~/queries/schema/schema-general').WebStatsTableQuery- ) => (querySource ? queryNodeToFilter(querySource) : {}),- ],- })),listeners(({ actions, values }) => ({loadDataSuccess: () => {// clear people when changing the insight filtersdiff --git a/products/product_analytics/frontend/insights/trends/types.ts b/products/product_analytics/frontend/insights/trends/types.tsindex af9f06e502c4..57aa4a695b33 100644--- a/products/product_analytics/frontend/insights/trends/types.ts+++ b/products/product_analytics/frontend/insights/trends/types.ts@@ -1,10 +1,4 @@-import { ActionFilter, ActorType, FilterType, GraphDataset, TrendResult } from '~/types'--export interface TrendResponse {- result: TrendResult[]- filters: FilterType- next?: string-}+import { TrendResult } from '~/types'export interface IndexedTrendResult extends TrendResult {/**@@ -21,19 +15,3 @@ export interface IndexedTrendResult extends TrendResult {* */colorIndex: number}--export interface TrendActors {- seriesId?: number // The series identifier for this particular point (i.e. index of series)- people: ActorType[]- count: number- missingPersons: number- day: string | number- label: string- action?: ActionFilter- breakdown_value?: string | number- next?: string- loadingMore?: boolean- funnelStep?: number- pathsDropoff?: boolean- crossDataset?: GraphDataset[]-}