diff --git a/frontend/src/scenes/experiments/Metrics/SecondaryGoalFunnels.tsx b/frontend/src/scenes/experiments/Metrics/SecondaryGoalFunnels.tsx
index a0e903fdeab84..fe704d9f7a953 100644
--- a/frontend/src/scenes/experiments/Metrics/SecondaryGoalFunnels.tsx
+++ b/frontend/src/scenes/experiments/Metrics/SecondaryGoalFunnels.tsx
@@ -2,18 +2,18 @@ import { LemonLabel } from '@posthog/lemon-ui'
import { LemonInput } from '@posthog/lemon-ui'
import { useActions, useValues } from 'kea'
import { TestAccountFilterSwitch } from 'lib/components/TestAccountFiltersSwitch'
-import { EXPERIMENT_DEFAULT_DURATION, FEATURE_FLAGS } from 'lib/constants'
+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/ActionFilterRow'
import { getHogQLValue } from 'scenes/insights/filters/AggregationSelect'
import { teamLogic } from 'scenes/teamLogic'
-import { actionsAndEventsToSeries, filtersToQueryNode } from '~/queries/nodes/InsightQuery/utils/filtersToQueryNode'
+import { actionsAndEventsToSeries } from '~/queries/nodes/InsightQuery/utils/filtersToQueryNode'
import { queryNodeToFilter } from '~/queries/nodes/InsightQuery/utils/queryNodeToFilter'
import { Query } from '~/queries/Query/Query'
import { ExperimentFunnelsQuery, NodeKind } from '~/queries/schema'
-import { BreakdownAttributionType, FilterType, FunnelsFilterType } from '~/types'
+import { BreakdownAttributionType, FilterType } from '~/types'
import { experimentLogic } from '../experimentLogic'
import {
@@ -25,8 +25,8 @@ import {
export function SecondaryGoalFunnels({ metricIdx }: { metricIdx: number }): JSX.Element {
const { currentTeam } = useValues(teamLogic)
- const { experiment, isExperimentRunning, featureFlags } = useValues(experimentLogic)
- const { setExperiment, setFunnelsMetric } = useActions(experimentLogic)
+ const { experiment, isExperimentRunning } = useValues(experimentLogic)
+ const { setFunnelsMetric } = useActions(experimentLogic)
const hasFilters = (currentTeam?.test_account_filters || []).length > 0
const currentMetric = experiment.metrics_secondary[metricIdx] as ExperimentFunnelsQuery
@@ -35,104 +35,31 @@ export function SecondaryGoalFunnels({ metricIdx }: { metricIdx: number }): JSX.
Name (optional)
{
- // :FLAG: CLEAN UP AFTER MIGRATION
- if (featureFlags[FEATURE_FLAGS.EXPERIMENTS_HOGQL]) {
- return currentMetric.name
- }
- return experiment.secondary_metrics[metricIdx].name
- })()}
+ value={currentMetric.name}
onChange={(newName) => {
- if (featureFlags[FEATURE_FLAGS.EXPERIMENTS_HOGQL]) {
- setFunnelsMetric({
- metricIdx,
- name: newName,
- isSecondary: true,
- })
- } else {
- setExperiment({
- secondary_metrics: experiment.secondary_metrics.map((metric, idx) =>
- idx === metricIdx ? { ...metric, name: newName } : metric
- ),
- })
- }
+ setFunnelsMetric({
+ metricIdx,
+ name: newName,
+ isSecondary: true,
+ })
}}
/>
{
- // :FLAG: CLEAN UP AFTER MIGRATION
- if (featureFlags[FEATURE_FLAGS.EXPERIMENTS_HOGQL]) {
- return queryNodeToFilter(currentMetric.funnels_query)
- }
- return experiment.secondary_metrics[metricIdx].filters
- })()}
+ filters={queryNodeToFilter(currentMetric.funnels_query)}
setFilters={({ actions, events, data_warehouse }: Partial): void => {
- // :FLAG: CLEAN UP AFTER MIGRATION
- if (featureFlags[FEATURE_FLAGS.EXPERIMENTS_HOGQL]) {
- const series = actionsAndEventsToSeries(
- { actions, events, data_warehouse } as any,
- true,
- MathAvailability.None
- )
+ const series = actionsAndEventsToSeries(
+ { actions, events, data_warehouse } as any,
+ true,
+ MathAvailability.None
+ )
- setFunnelsMetric({
- metricIdx,
- series,
- isSecondary: true,
- })
- } else {
- if (actions?.length) {
- setExperiment({
- secondary_metrics: experiment.secondary_metrics.map((metric, idx) =>
- idx === metricIdx
- ? {
- ...metric,
- filters: {
- ...metric.filters,
- actions,
- events: undefined,
- data_warehouse: undefined,
- },
- }
- : metric
- ),
- })
- } else if (events?.length) {
- setExperiment({
- secondary_metrics: experiment.secondary_metrics.map((metric, idx) =>
- idx === metricIdx
- ? {
- ...metric,
- filters: {
- ...metric.filters,
- events,
- actions: undefined,
- data_warehouse: undefined,
- },
- }
- : metric
- ),
- })
- } else if (data_warehouse?.length) {
- setExperiment({
- secondary_metrics: experiment.secondary_metrics.map((metric, idx) =>
- idx === metricIdx
- ? {
- ...metric,
- filters: {
- ...metric.filters,
- data_warehouse,
- actions: undefined,
- events: undefined,
- },
- }
- : metric
- ),
- })
- }
- }
+ setFunnelsMetric({
+ metricIdx,
+ series,
+ isSecondary: true,
+ })
}}
typeKey="experiment-metric"
mathAvailability={MathAvailability.None}
@@ -145,129 +72,42 @@ export function SecondaryGoalFunnels({ metricIdx }: { metricIdx: number }): JSX.
/>
{
- // :FLAG: CLEAN UP AFTER MIGRATION
- if (featureFlags[FEATURE_FLAGS.EXPERIMENTS_HOGQL]) {
- return getHogQLValue(
- currentMetric.funnels_query.aggregation_group_type_index ?? undefined,
- currentMetric.funnels_query.funnelsFilter?.funnelAggregateByHogQL ?? undefined
- )
- }
- return getHogQLValue(
- experiment.secondary_metrics[metricIdx].filters.aggregation_group_type_index,
- (experiment.secondary_metrics[metricIdx].filters as FunnelsFilterType)
- .funnel_aggregate_by_hogql
- )
- })()}
+ value={getHogQLValue(
+ currentMetric.funnels_query.aggregation_group_type_index ?? undefined,
+ currentMetric.funnels_query.funnelsFilter?.funnelAggregateByHogQL ?? undefined
+ )}
onChange={(value) => {
- // :FLAG: CLEAN UP AFTER MIGRATION
- if (featureFlags[FEATURE_FLAGS.EXPERIMENTS_HOGQL]) {
- setFunnelsMetric({
- metricIdx,
- funnelAggregateByHogQL: value,
- isSecondary: true,
- })
- } else {
- setExperiment({
- secondary_metrics: experiment.secondary_metrics.map((metric, idx) =>
- idx === metricIdx
- ? {
- ...metric,
- filters: {
- ...metric.filters,
- funnel_aggregate_by_hogql: value,
- },
- }
- : metric
- ),
- })
- }
+ setFunnelsMetric({
+ metricIdx,
+ funnelAggregateByHogQL: value,
+ isSecondary: true,
+ })
}}
/>
{
- // :FLAG: CLEAN UP AFTER MIGRATION
- if (featureFlags[FEATURE_FLAGS.EXPERIMENTS_HOGQL]) {
- return currentMetric.funnels_query?.funnelsFilter?.funnelWindowInterval
- }
- return (experiment.secondary_metrics[metricIdx].filters as FunnelsFilterType)
- .funnel_window_interval
- })()}
- funnelWindowIntervalUnit={(() => {
- // :FLAG: CLEAN UP AFTER MIGRATION
- if (featureFlags[FEATURE_FLAGS.EXPERIMENTS_HOGQL]) {
- return currentMetric.funnels_query?.funnelsFilter?.funnelWindowIntervalUnit
- }
- return (experiment.secondary_metrics[metricIdx].filters as FunnelsFilterType)
- .funnel_window_interval_unit
- })()}
+ funnelWindowInterval={currentMetric.funnels_query?.funnelsFilter?.funnelWindowInterval}
+ funnelWindowIntervalUnit={currentMetric.funnels_query?.funnelsFilter?.funnelWindowIntervalUnit}
onFunnelWindowIntervalChange={(funnelWindowInterval) => {
- // :FLAG: CLEAN UP AFTER MIGRATION
- if (featureFlags[FEATURE_FLAGS.EXPERIMENTS_HOGQL]) {
- setFunnelsMetric({
- metricIdx,
- funnelWindowInterval: funnelWindowInterval,
- isSecondary: true,
- })
- } else {
- setExperiment({
- secondary_metrics: experiment.secondary_metrics.map((metric, idx) =>
- idx === metricIdx
- ? {
- ...metric,
- filters: {
- ...metric.filters,
- funnel_window_interval: funnelWindowInterval,
- },
- }
- : metric
- ),
- })
- }
+ setFunnelsMetric({
+ metricIdx,
+ funnelWindowInterval: funnelWindowInterval,
+ isSecondary: true,
+ })
}}
onFunnelWindowIntervalUnitChange={(funnelWindowIntervalUnit) => {
- // :FLAG: CLEAN UP AFTER MIGRATION
- if (featureFlags[FEATURE_FLAGS.EXPERIMENTS_HOGQL]) {
- setFunnelsMetric({
- metricIdx,
- funnelWindowIntervalUnit: funnelWindowIntervalUnit || undefined,
- isSecondary: true,
- })
- } else {
- setExperiment({
- secondary_metrics: experiment.secondary_metrics.map((metric, idx) =>
- idx === metricIdx
- ? {
- ...metric,
- filters: {
- ...metric.filters,
- funnel_window_interval_unit: funnelWindowIntervalUnit || undefined,
- },
- }
- : metric
- ),
- })
- }
+ setFunnelsMetric({
+ metricIdx,
+ funnelWindowIntervalUnit: funnelWindowIntervalUnit || undefined,
+ isSecondary: true,
+ })
}}
/>
{
- // :FLAG: CLEAN UP AFTER MIGRATION
- let breakdownAttributionType
- let breakdownAttributionValue
- if (featureFlags[FEATURE_FLAGS.EXPERIMENTS_HOGQL]) {
- breakdownAttributionType =
- currentMetric.funnels_query?.funnelsFilter?.breakdownAttributionType
- breakdownAttributionValue =
- currentMetric.funnels_query?.funnelsFilter?.breakdownAttributionValue
- } else {
- breakdownAttributionType = (
- experiment.secondary_metrics[metricIdx].filters as FunnelsFilterType
- ).breakdown_attribution_type
- breakdownAttributionValue = (
- experiment.secondary_metrics[metricIdx].filters as FunnelsFilterType
- ).breakdown_attribution_value
- }
+ const breakdownAttributionType =
+ currentMetric.funnels_query?.funnelsFilter?.breakdownAttributionType
+ const breakdownAttributionValue =
+ currentMetric.funnels_query?.funnelsFilter?.breakdownAttributionValue
const currentValue: BreakdownAttributionType | `${BreakdownAttributionType.Step}/${number}` =
!breakdownAttributionType
@@ -280,83 +120,25 @@ export function SecondaryGoalFunnels({ metricIdx }: { metricIdx: number }): JSX.
})()}
onChange={(value) => {
const [breakdownAttributionType, breakdownAttributionValue] = (value || '').split('/')
- // :FLAG: CLEAN UP AFTER MIGRATION
- if (featureFlags[FEATURE_FLAGS.EXPERIMENTS_HOGQL]) {
- setFunnelsMetric({
- metricIdx,
- breakdownAttributionType: breakdownAttributionType as BreakdownAttributionType,
- breakdownAttributionValue: breakdownAttributionValue
- ? parseInt(breakdownAttributionValue)
- : undefined,
- isSecondary: true,
- })
- } else {
- setExperiment({
- secondary_metrics: experiment.secondary_metrics.map((metric, idx) =>
- idx === metricIdx
- ? {
- ...metric,
- filters: {
- ...metric.filters,
- breakdown_attribution_type:
- breakdownAttributionType as BreakdownAttributionType,
- breakdown_attribution_value: breakdownAttributionValue
- ? parseInt(breakdownAttributionValue)
- : 0,
- },
- }
- : metric
- ),
- })
- }
+ setFunnelsMetric({
+ metricIdx,
+ breakdownAttributionType: breakdownAttributionType as BreakdownAttributionType,
+ breakdownAttributionValue: breakdownAttributionValue
+ ? parseInt(breakdownAttributionValue)
+ : undefined,
+ isSecondary: true,
+ })
}}
- stepsLength={(() => {
- // :FLAG: CLEAN UP AFTER MIGRATION
- if (featureFlags[FEATURE_FLAGS.EXPERIMENTS_HOGQL]) {
- return currentMetric.funnels_query?.series?.length
- }
- return Math.max(
- experiment.secondary_metrics[metricIdx].filters.actions?.length ?? 0,
- experiment.secondary_metrics[metricIdx].filters.events?.length ?? 0,
- experiment.secondary_metrics[metricIdx].filters.data_warehouse?.length ?? 0
- )
- })()}
+ stepsLength={currentMetric.funnels_query?.series?.length}
/>
{
- // :FLAG: CLEAN UP AFTER MIGRATION
- if (featureFlags[FEATURE_FLAGS.EXPERIMENTS_HOGQL]) {
- const val = (experiment.metrics_secondary[metricIdx] as ExperimentFunnelsQuery)
- .funnels_query?.filterTestAccounts
- return hasFilters ? !!val : false
- }
- return hasFilters
- ? !!experiment.secondary_metrics[metricIdx].filters.filter_test_accounts
- : false
- })()}
+ checked={hasFilters ? !!currentMetric.funnels_query?.filterTestAccounts : false}
onChange={(checked: boolean) => {
- // :FLAG: CLEAN UP AFTER MIGRATION
- if (featureFlags[FEATURE_FLAGS.EXPERIMENTS_HOGQL]) {
- setFunnelsMetric({
- metricIdx,
- filterTestAccounts: checked,
- isSecondary: true,
- })
- } else {
- setExperiment({
- secondary_metrics: experiment.secondary_metrics.map((metric, idx) =>
- idx === metricIdx
- ? {
- ...metric,
- filters: {
- ...metric.filters,
- filter_test_accounts: checked,
- },
- }
- : metric
- ),
- })
- }
+ setFunnelsMetric({
+ metricIdx,
+ filterTestAccounts: checked,
+ isSecondary: true,
+ })
}}
fullWidth
/>
@@ -368,17 +150,10 @@ export function SecondaryGoalFunnels({ metricIdx }: { metricIdx: number }): JSX.
)}
- {/* :FLAG: CLEAN UP AFTER MIGRATION */}
{
- // :FLAG: CLEAN UP AFTER MIGRATION
- if (featureFlags[FEATURE_FLAGS.EXPERIMENTS_HOGQL]) {
- return currentMetric.funnels_query
- }
- return filtersToQueryNode(experiment.secondary_metrics[metricIdx].filters)
- })(),
+ source: currentMetric.funnels_query,
showTable: false,
showLastComputation: true,
showLastComputationRefresh: false,