Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(frontend): inline Kea types batch 9 (#71463)

Marius Andrad08fe48b8ee0
diff --git a/.kearc b/.kearc
index 4efe43c31fd7..6e1af709b93d 100644
--- a/.kearc
+++ b/.kearc
@@ -4,7 +4,7 @@
"typesPath": "./frontend/src",
"writePaths": true,
"inlinePaths": [
- "./scenes/notebooks",
+ "./frontend/src/scenes/notebooks",
"./.kea-inline-batch-01-slot-01",
"./.kea-inline-separator-01",
"./.kea-inline-separator-01-b",
@@ -114,18 +114,18 @@
"./.kea-inline-batch-08-slot-13",
"./.kea-inline-separator-08",
"./.kea-inline-separator-08-b",
- "./.kea-inline-batch-09-slot-01",
- "./.kea-inline-batch-09-slot-02",
- "./.kea-inline-batch-09-slot-03",
- "./.kea-inline-batch-09-slot-04",
- "./.kea-inline-batch-09-slot-05",
- "./.kea-inline-batch-09-slot-06",
- "./.kea-inline-batch-09-slot-07",
- "./.kea-inline-batch-09-slot-08",
- "./.kea-inline-batch-09-slot-09",
- "./.kea-inline-batch-09-slot-10",
- "./.kea-inline-batch-09-slot-11",
- "./.kea-inline-batch-09-slot-12",
- "./.kea-inline-batch-09-slot-13"
+ "./frontend/src/scenes/Unsubscribe",
+ "./frontend/src/scenes/funnels",
+ "./frontend/src/scenes/insights",
+ "./frontend/src/scenes/marketing-analytics",
+ "./frontend/src/scenes/paths",
+ "./frontend/src/scenes/sites",
+ "./products/actions",
+ "./products/customer_analytics",
+ "./products/endpoints",
+ "./products/legal_documents",
+ "./products/live_debugger",
+ "./products/replay_vision",
+ "./products/tracing"
]
}
diff --git a/frontend/src/scenes/Unsubscribe/unsubscribeLogic.ts b/frontend/src/scenes/Unsubscribe/unsubscribeLogic.ts
index 7a2bd77f57ac..7a4ed41d2420 100644
--- a/frontend/src/scenes/Unsubscribe/unsubscribeLogic.ts
+++ b/frontend/src/scenes/Unsubscribe/unsubscribeLogic.ts
@@ -1,10 +1,41 @@
-import { actions, afterMount, kea, path } from 'kea'
+import { MakeLogicType, actions, afterMount, kea, path } from 'kea'
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
import api from 'lib/api'
-import type { unsubscribeLogicType } from './unsubscribeLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface unsubscribeLogicValues {
+ unsubscription: boolean
+ unsubscriptionLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface unsubscribeLogicActions {
+ attemptUnsubscribe: (token: string) => {
+ token: string
+ }
+ attemptUnsubscribeFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ attemptUnsubscribeSuccess: (
+ unsubscription: boolean,
+ payload?: {
+ token: string
+ }
+ ) => {
+ unsubscription: boolean
+ payload?: {
+ token: string
+ }
+ }
+}
+
+export type unsubscribeLogicType = MakeLogicType<unsubscribeLogicValues, unsubscribeLogicActions>
export const unsubscribeLogic = kea<unsubscribeLogicType>([
path(['scenes', 'Unsubscribe', 'unsubscribeLogic']),
diff --git a/frontend/src/scenes/funnels/FunnelFlowGraph/funnelFlowGraphLogic.ts b/frontend/src/scenes/funnels/FunnelFlowGraph/funnelFlowGraphLogic.ts
index 81712ab891bb..0f444ca3780a 100644
--- a/frontend/src/scenes/funnels/FunnelFlowGraph/funnelFlowGraphLogic.ts
+++ b/frontend/src/scenes/funnels/FunnelFlowGraph/funnelFlowGraphLogic.ts
@@ -1,6 +1,6 @@
import { Edge, MarkerType, Node } from '@xyflow/react'
import type { ElkExtendedEdge, ElkNode } from 'elkjs/lib/elk.bundled.js'
-import { actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
import { subscriptions } from 'kea-subscriptions'
import { getElk } from 'lib/elk'
@@ -9,8 +9,9 @@ import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'
import { InsightLogicProps } from '~/types'
import { FunnelStepWithConversionMetrics } from '~/types'
+import type { PathsLink } from '../../../queries/schema/schema-general'
+import type { FunnelStepWithNestedBreakdown } from '../../../types'
import { funnelDataLogic } from '../funnelDataLogic'
-import type { funnelFlowGraphLogicType } from './funnelFlowGraphLogicType'
import { funnelPathsExpansionLogic } from './funnelPathsExpansionLogic'
import {
bridgeConfigForExpansion,
@@ -21,6 +22,7 @@ import {
PATH_NODE_WIDTH,
PathFlowNodeData,
} from './pathFlowUtils'
+import type { PathExpansion } from './pathFlowUtils'
export const NODE_HEIGHT = 160
export const NODE_WIDTH = 300
@@ -119,6 +121,101 @@ export interface FunnelFlowLogicProps extends InsightLogicProps {
mode?: FunnelFlowGraphMode
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelFlowGraphLogicValues {
+ isStepOptional: (step: number) => boolean // funnelDataLogic
+ stepNames: FunnelStepWithNestedBreakdown[] // funnelDataLogic
+ visibleStepsWithConversionMetrics: FunnelStepWithConversionMetrics[] // funnelDataLogic
+ expandedPath: PathExpansion | null // funnelPathsExpansionLogic
+ expandedPathResults: PathsLink[] | null // funnelPathsExpansionLogic
+ edgeType: string
+ edges: Edge[]
+ expandedPathElements: {
+ edges: Edge<PathFlowEdgeData>[]
+ hiddenEdgeId: string | null
+ nodes: Node<PathFlowNodeData>[]
+ } | null
+ fitViewOptions: {
+ maxZoom: number
+ padding: number
+ }
+ funnelEdges: Edge<FunnelFlowEdgeData>[]
+ funnelNodes: Node<FunnelFlowNodeData>[]
+ isProfileMode: boolean
+ laidOutNodes: AnyFlowNode[]
+ nodeHeight: number
+ nodeType: string
+ nodeWidth: number
+ nodes: AnyFlowNode[]
+ pathNodeType: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelFlowGraphLogicActions {
+ setLaidOutNodes: (laidOutNodes: AnyFlowNode[]) => {
+ laidOutNodes: AnyFlowNode[]
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelFlowGraphLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ isProfileMode: (arg: any) => boolean
+ nodeType: (arg: any) => string
+ pathNodeType: (arg: any) => string
+ edgeType: (isProfileMode: boolean) => string
+ nodeWidth: (isProfileMode: boolean) => number
+ nodeHeight: (isProfileMode: boolean) => number
+ fitViewOptions: (isProfileMode: boolean) => {
+ maxZoom: number
+ padding: number
+ }
+ funnelNodes: (
+ visibleStepsWithConversionMetrics: FunnelStepWithConversionMetrics[],
+ stepNames: FunnelStepWithNestedBreakdown[],
+ isStepOptional: (step: number) => boolean,
+ nodeType: string,
+ nodeWidth: number,
+ nodeHeight: number
+ ) => Node<FunnelFlowNodeData>[]
+ funnelEdges: (funnelNodes: Node<FunnelFlowNodeData>[], edgeType: string) => Edge<FunnelFlowEdgeData>[]
+ expandedPathElements: (
+ funnelNodes: Node<FunnelFlowNodeData>[],
+ expandedPath: PathExpansion | null,
+ expandedPathResults: PathsLink[] | null,
+ pathNodeType: string
+ ) => {
+ edges: Edge<PathFlowEdgeData>[]
+ hiddenEdgeId: string | null
+ nodes: Node<PathFlowNodeData>[]
+ } | null
+ nodes: (
+ funnelNodes: Node<FunnelFlowNodeData>[],
+ expandedPathElements: {
+ edges: Edge<PathFlowEdgeData>[]
+ hiddenEdgeId: string | null
+ nodes: Node<PathFlowNodeData>[]
+ } | null
+ ) => AnyFlowNode[]
+ edges: (
+ funnelEdges: Edge<FunnelFlowEdgeData>[],
+ expandedPathElements: {
+ edges: Edge<PathFlowEdgeData>[]
+ hiddenEdgeId: string | null
+ nodes: Node<PathFlowNodeData>[]
+ } | null
+ ) => Edge[]
+ }
+}
+
+export type funnelFlowGraphLogicType = MakeLogicType<
+ funnelFlowGraphLogicValues,
+ funnelFlowGraphLogicActions,
+ FunnelFlowLogicProps,
+ funnelFlowGraphLogicMeta
+>
+
export const funnelFlowGraphLogic = kea<funnelFlowGraphLogicType>([
path((key) => ['scenes', 'funnels', 'FunnelFlowGraph', 'funnelFlowGraphLogic', key]),
props({} as FunnelFlowLogicProps),
@@ -156,18 +253,21 @@ export const funnelFlowGraphLogic = kea<funnelFlowGraphLogicType>([
() => [(_, props) => props.mode],
(mode): string => (mode === 'builder' ? 'builderPathNode' : 'pathNode'),
],
- edgeType: [(s) => [s.isProfileMode], (isProfileMode): string => (isProfileMode ? 'profile' : 'journey')],
+ edgeType: [
+ (s) => [s.isProfileMode],
+ (isProfileMode: boolean): string => (isProfileMode ? 'profile' : 'journey'),
+ ],
nodeWidth: [
(s) => [s.isProfileMode],
- (isProfileMode): number => (isProfileMode ? PROFILE_NODE_WIDTH : NODE_WIDTH),
+ (isProfileMode: boolean): number => (isProfileMode ? PROFILE_NODE_WIDTH : NODE_WIDTH),
],
nodeHeight: [
(s) => [s.isProfileMode],
- (isProfileMode): number => (isProfileMode ? PROFILE_NODE_HEIGHT : NODE_HEIGHT),
+ (isProfileMode: boolean): number => (isProfileMode ? PROFILE_NODE_HEIGHT : NODE_HEIGHT),
],
fitViewOptions: [
(s) => [s.isProfileMode],
- (isProfileMode) => (isProfileMode ? PROFILE_FIT_VIEW_OPTIONS : FIT_VIEW_OPTIONS),
+ (isProfileMode: boolean) => (isProfileMode ? PROFILE_FIT_VIEW_OPTIONS : FIT_VIEW_OPTIONS),
],
funnelNodes: [
(s) => [
@@ -178,7 +278,14 @@ export const funnelFlowGraphLogic = kea<funnelFlowGraphLogicType>([
s.nodeWidth,
s.nodeHeight,
],
- (steps, stepNames, isStepOptional, nodeType, nodeWidth, nodeHeight): Node<FunnelFlowNodeData>[] => {
+ (
+ steps: FunnelStepWithConversionMetrics[],
+ stepNames: import('~/types').FunnelStepWithNestedBreakdown[],
+ isStepOptional: (step: number) => boolean,
+ nodeType: string,
+ nodeWidth: number,
+ nodeHeight: number
+ ): Node<FunnelFlowNodeData>[] => {
const stepsToMap: FunnelStepWithConversionMetrics[] =
steps.length > 0
? steps
@@ -204,7 +311,7 @@ export const funnelFlowGraphLogic = kea<funnelFlowGraphLogicType>([
],
funnelEdges: [
(s) => [s.funnelNodes, s.edgeType],
- (nodes, edgeType): Edge<FunnelFlowEdgeData>[] =>
+ (nodes: Node<FunnelFlowNodeData>[], edgeType: string): Edge<FunnelFlowEdgeData>[] =>
nodes.slice(0, -1).map((node, index) => {
const targetNode = nodes[index + 1]
const touchesOptionalStep = targetNode.data.isOptional
@@ -241,10 +348,10 @@ export const funnelFlowGraphLogic = kea<funnelFlowGraphLogicType>([
expandedPathElements: [
(s) => [s.funnelNodes, s.expandedPath, s.expandedPathResults, s.pathNodeType],
(
- funnelNodes,
- expandedPath,
- expandedPathResults,
- pathNodeType
+ funnelNodes: Node<FunnelFlowNodeData>[],
+ expandedPath: null | import('./pathFlowUtils').PathExpansion,
+ expandedPathResults: import('../../../queries/schema').PathsLink[] | null,
+ pathNodeType: string
): {
nodes: Node<PathFlowNodeData>[]
edges: Edge<PathFlowEdgeData>[]
@@ -274,7 +381,14 @@ export const funnelFlowGraphLogic = kea<funnelFlowGraphLogicType>([
],
nodes: [
(s) => [s.funnelNodes, s.expandedPathElements],
- (funnelNodes, expandedPathElements): AnyFlowNode[] => {
+ (
+ funnelNodes: Node<FunnelFlowNodeData>[],
+ expandedPathElements: {
+ edges: Edge<PathFlowEdgeData>[]
+ hiddenEdgeId: string | null
+ nodes: Node<PathFlowNodeData>[]
+ } | null
+ ): AnyFlowNode[] => {
if (!expandedPathElements) {
return funnelNodes
}
@@ -283,7 +397,14 @@ export const funnelFlowGraphLogic = kea<funnelFlowGraphLogicType>([
],
edges: [
(s) => [s.funnelEdges, s.expandedPathElements],
- (funnelEdges, expandedPathElements): Edge[] => {
+ (
+ funnelEdges: Edge<FunnelFlowEdgeData>[],
+ expandedPathElements: {
+ edges: Edge<PathFlowEdgeData>[]
+ hiddenEdgeId: string | null
+ nodes: Node<PathFlowNodeData>[]
+ } | null
+ ): Edge[] => {
if (!expandedPathElements) {
return funnelEdges
}
diff --git a/frontend/src/scenes/funnels/FunnelFlowGraph/funnelPathsExpansionLogic.ts b/frontend/src/scenes/funnels/FunnelFlowGraph/funnelPathsExpansionLogic.ts
index bedd2739e8ff..4a538099b19e 100644
--- a/frontend/src/scenes/funnels/FunnelFlowGraph/funnelPathsExpansionLogic.ts
+++ b/frontend/src/scenes/funnels/FunnelFlowGraph/funnelPathsExpansionLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { lemonToast } from '@posthog/lemon-ui'
@@ -9,12 +9,58 @@ import { performQuery } from '~/queries/query'
import { PathsLink, PathsQuery } from '~/queries/schema/schema-general'
import { InsightLogicProps } from '~/types'
+import type { FunnelsQuery } from '../../../queries/schema/schema-general'
import { funnelDataLogic } from '../funnelDataLogic'
-import type { funnelPathsExpansionLogicType } from './funnelPathsExpansionLogicType'
import { buildPathsQuery, PathExpansion, pathExpansionCacheKey } from './pathFlowUtils'
const DEFAULT_LOGIC_KEY = 'default_funnel_paths_expansion'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelPathsExpansionLogicValues {
+ querySource: FunnelsQuery | null // funnelDataLogic
+ expandedPath: PathExpansion | null
+ expandedPathCacheKey: string | null
+ expandedPathResults: PathsLink[] | null
+ pathsLoading: boolean
+ pathsResultsCache: Record<string, PathsLink[]>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelPathsExpansionLogicActions {
+ collapsePath: () => {
+ value: true
+ }
+ expandPath: (expansion: PathExpansion) => {
+ expansion: PathExpansion
+ }
+ setPathsResults: (
+ cacheKey: string,
+ results: PathsLink[]
+ ) => {
+ cacheKey: string
+ results: PathsLink[]
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelPathsExpansionLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ expandedPathCacheKey: (expandedPath: PathExpansion | null) => string | null
+ expandedPathResults: (
+ expandedPathCacheKey: string | null,
+ pathsResultsCache: Record<string, PathsLink[]>
+ ) => PathsLink[] | null
+ }
+}
+
+export type funnelPathsExpansionLogicType = MakeLogicType<
+ funnelPathsExpansionLogicValues,
+ funnelPathsExpansionLogicActions,
+ InsightLogicProps,
+ funnelPathsExpansionLogicMeta
+>
+
export const funnelPathsExpansionLogic = kea<funnelPathsExpansionLogicType>([
path((key) => ['scenes', 'funnels', 'FunnelFlowGraph', 'funnelPathsExpansionLogic', key]),
props({} as InsightLogicProps),
@@ -57,11 +103,12 @@ export const funnelPathsExpansionLogic = kea<funnelPathsExpansionLogicType>([
selectors({
expandedPathCacheKey: [
(s) => [s.expandedPath],
- (expandedPath): string | null => (expandedPath ? pathExpansionCacheKey(expandedPath) : null),
+ (expandedPath: PathExpansion | null): string | null =>
+ expandedPath ? pathExpansionCacheKey(expandedPath) : null,
],
expandedPathResults: [
(s) => [s.expandedPathCacheKey, s.pathsResultsCache],
- (cacheKey, pathsResultsCache): PathsLink[] | null =>
+ (cacheKey: string | null, pathsResultsCache: Record<string, PathsLink[]>): PathsLink[] | null =>
cacheKey ? (pathsResultsCache[cacheKey] ?? null) : null,
],
}),
diff --git a/frontend/src/scenes/funnels/funnelCorrelationDetailsLogic.ts b/frontend/src/scenes/funnels/funnelCorrelationDetailsLogic.ts
index fae6a4d5a116..defb8be9b2f9 100644
--- a/frontend/src/scenes/funnels/funnelCorrelationDetailsLogic.ts
+++ b/frontend/src/scenes/funnels/funnelCorrelationDetailsLogic.ts
@@ -1,12 +1,62 @@
-import { actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'
import { FunnelCorrelation, InsightLogicProps } from '~/types'
-import type { funnelCorrelationDetailsLogicType } from './funnelCorrelationDetailsLogicType'
+import type { FunnelStepWithNestedBreakdown } from '../../types'
import { funnelDataLogic } from './funnelDataLogic'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelCorrelationDetailsLogicValues {
+ steps: FunnelStepWithNestedBreakdown[] // funnelDataLogic
+ correlationDetails: FunnelCorrelation | null
+ correlationDetailsModalOpen: boolean
+ correlationMatrixAndScore: {
+ correlationScore: number
+ correlationScoreStrength: 'moderate' | 'strong' | 'weak' | null
+ falseNegative: number
+ falsePositive: number
+ trueNegative: number
+ truePositive: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelCorrelationDetailsLogicActions {
+ closeCorrelationDetailsModal: () => {
+ value: true
+ }
+ openCorrelationDetailsModal: (payload: FunnelCorrelation) => {
+ payload: FunnelCorrelation
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelCorrelationDetailsLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ correlationMatrixAndScore: (
+ correlationDetails: FunnelCorrelation | null,
+ steps: FunnelStepWithNestedBreakdown[]
+ ) => {
+ correlationScore: number
+ correlationScoreStrength: 'moderate' | 'strong' | 'weak' | null
+ falseNegative: number
+ falsePositive: number
+ trueNegative: number
+ truePositive: number
+ }
+ }
+}
+
+export type funnelCorrelationDetailsLogicType = MakeLogicType<
+ funnelCorrelationDetailsLogicValues,
+ funnelCorrelationDetailsLogicActions,
+ InsightLogicProps,
+ funnelCorrelationDetailsLogicMeta
+>
+
export const funnelCorrelationDetailsLogic = kea<funnelCorrelationDetailsLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps('insight_funnel')),
@@ -40,8 +90,8 @@ export const funnelCorrelationDetailsLogic = kea<funnelCorrelationDetailsLogicTy
correlationMatrixAndScore: [
(s) => [s.correlationDetails, s.steps],
(
- correlationDetails,
- steps
+ correlationDetails: FunnelCorrelation | null,
+ steps: import('~/types').FunnelStepWithNestedBreakdown[]
): {
truePositive: number
falsePositive: number
diff --git a/frontend/src/scenes/funnels/funnelCorrelationLogic.ts b/frontend/src/scenes/funnels/funnelCorrelationLogic.ts
index f5cb97f23310..d9c28e18523e 100644
--- a/frontend/src/scenes/funnels/funnelCorrelationLogic.ts
+++ b/frontend/src/scenes/funnels/funnelCorrelationLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, defaults, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, defaults, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { lemonToast } from '@posthog/lemon-ui'
@@ -16,10 +16,124 @@ import {
import { setLatestVersionsOnQuery } from '~/queries/utils'
import { FunnelCorrelation, FunnelCorrelationType, InsightLogicProps } from '~/types'
-import type { funnelCorrelationLogicType } from './funnelCorrelationLogicType'
+import type { FunnelsQuery } from '../../queries/schema/schema-general'
+import type { TeamPublicType, TeamType } from '../../types'
import { funnelDataLogic } from './funnelDataLogic'
import { appendToCorrelationConfig } from './funnelUtils'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelCorrelationLogicValues {
+ querySource: FunnelsQuery | null // funnelDataLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ __ignore: FunnelCorrelationResultsType | null
+ correlationTypes: FunnelCorrelationType[]
+ correlationValues: FunnelCorrelation[]
+ correlations: Record<'events', FunnelCorrelation[]>
+ correlationsLoading: boolean
+ eventHasPropertyCorrelations: (eventName: string) => boolean
+ eventWithPropertyCorrelations: Record<string, FunnelCorrelation[]>
+ eventWithPropertyCorrelationsLoading: boolean
+ eventWithPropertyCorrelationsValues: Record<string, FunnelCorrelation[]>
+ excludedEventNames: string[]
+ excludedEventPropertyNames: string[]
+ isEventExcluded: (eventName: string) => boolean
+ isEventPropertyExcluded: (propertyName: string) => boolean
+ loadedEventCorrelationsTableOnce: boolean
+ nestedTableExpandedKeys: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelCorrelationLogicActions {
+ addNestedTableExpandedKey: (expandKey: string) => {
+ expandKey: string
+ }
+ excludeEventFromProject: (eventName: string) => {
+ eventName: string
+ }
+ excludeEventPropertyFromProject: (
+ eventName: string,
+ propertyName: string
+ ) => {
+ eventName: string
+ propertyName: string
+ }
+ loadEventCorrelations: (_: any) => any
+ loadEventCorrelationsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadEventCorrelationsSuccess: (
+ correlations: {
+ events: FunnelCorrelation[]
+ },
+ payload?: any
+ ) => {
+ correlations: {
+ events: FunnelCorrelation[]
+ }
+ payload?: any
+ }
+ loadEventWithPropertyCorrelations: (eventName: string) => string
+ loadEventWithPropertyCorrelationsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadEventWithPropertyCorrelationsSuccess: (
+ eventWithPropertyCorrelations: {
+ [x: string]: FunnelCorrelation[]
+ },
+ payload?: string
+ ) => {
+ eventWithPropertyCorrelations: {
+ [x: string]: FunnelCorrelation[]
+ }
+ payload?: string
+ }
+ removeNestedTableExpandedKey: (expandKey: string) => {
+ expandKey: string
+ }
+ setCorrelationTypes: (types: FunnelCorrelationType[]) => {
+ types: FunnelCorrelationType[]
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelCorrelationLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ correlationValues: (
+ correlations: Record<'events', FunnelCorrelation[]>,
+ correlationTypes: FunnelCorrelationType[],
+ excludedEventNames: string[]
+ ) => FunnelCorrelation[]
+ excludedEventNames: (currentTeam: TeamPublicType | TeamType | null) => string[]
+ isEventExcluded: (excludedEventNames: string[]) => (eventName: string) => boolean
+ excludedEventPropertyNames: (currentTeam: TeamPublicType | TeamType | null) => string[]
+ isEventPropertyExcluded: (excludedEventPropertyNames: string[]) => (propertyName: string) => boolean
+ eventWithPropertyCorrelationsValues: (
+ eventWithPropertyCorrelations: Record<string, FunnelCorrelation[]>,
+ correlationTypes: FunnelCorrelationType[],
+ excludedEventPropertyNames: string[]
+ ) => Record<string, FunnelCorrelation[]>
+ eventHasPropertyCorrelations: (
+ eventWithPropertyCorrelationsValues: Record<string, FunnelCorrelation[]>
+ ) => (eventName: string) => boolean
+ }
+}
+
+export type funnelCorrelationLogicType = MakeLogicType<
+ funnelCorrelationLogicValues,
+ funnelCorrelationLogicActions,
+ InsightLogicProps,
+ funnelCorrelationLogicMeta
+>
+
export const funnelCorrelationLogic = kea<funnelCorrelationLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps('insight_funnel')),
@@ -155,7 +269,11 @@ export const funnelCorrelationLogic = kea<funnelCorrelationLogicType>([
// event correlation
correlationValues: [
(s) => [s.correlations, s.correlationTypes, s.excludedEventNames],
- (correlations, correlationTypes, excludedEventNames): FunnelCorrelation[] => {
+ (
+ correlations: Record<'events', FunnelCorrelation[]>,
+ correlationTypes: FunnelCorrelationType[],
+ excludedEventNames: string[]
+ ): FunnelCorrelation[] => {
return correlations.events
?.filter(
(correlation) =>
@@ -178,30 +296,32 @@ export const funnelCorrelationLogic = kea<funnelCorrelationLogicType>([
],
excludedEventNames: [
(s) => [s.currentTeam],
- (currentTeam): string[] => currentTeam?.correlation_config?.excluded_event_names || [],
+ (currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType): string[] =>
+ currentTeam?.correlation_config?.excluded_event_names || [],
],
isEventExcluded: [
(s) => [s.excludedEventNames],
- (excludedEventNames) => (eventName: string) =>
+ (excludedEventNames: string[]) => (eventName: string) =>
excludedEventNames.find((name) => name === eventName) !== undefined,
],
// event property correlation
excludedEventPropertyNames: [
(s) => [s.currentTeam],
- (currentTeam): string[] => currentTeam?.correlation_config?.excluded_event_property_names || [],
+ (currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType): string[] =>
+ currentTeam?.correlation_config?.excluded_event_property_names || [],
],
isEventPropertyExcluded: [
(s) => [s.excludedEventPropertyNames],
- (excludedEventPropertyNames) => (propertyName: string) =>
+ (excludedEventPropertyNames: string[]) => (propertyName: string) =>
excludedEventPropertyNames.find((name) => name === propertyName) !== undefined,
],
eventWithPropertyCorrelationsValues: [
(s) => [s.eventWithPropertyCorrelations, s.correlationTypes, s.excludedEventPropertyNames],
(
- eventWithPropertyCorrelations,
- correlationTypes,
- excludedEventPropertyNames
+ eventWithPropertyCorrelations: Record<string, FunnelCorrelation[]>,
+ correlationTypes: FunnelCorrelationType[],
+ excludedEventPropertyNames: string[]
): Record<string, FunnelCorrelation[]> => {
const eventWithPropertyCorrelationsValues: Record<string, FunnelCorrelation[]> = {}
for (const key in eventWithPropertyCorrelations) {
@@ -231,7 +351,9 @@ export const funnelCorrelationLogic = kea<funnelCorrelationLogicType>([
],
eventHasPropertyCorrelations: [
(s) => [s.eventWithPropertyCorrelationsValues],
- (eventWithPropertyCorrelationsValues): ((eventName: string) => boolean) => {
+ (
+ eventWithPropertyCorrelationsValues: Record<string, FunnelCorrelation[]>
+ ): ((eventName: string) => boolean) => {
return (eventName) => {
return !!eventWithPropertyCorrelationsValues[eventName]
}
diff --git a/frontend/src/scenes/funnels/funnelCorrelationUsageLogic.ts b/frontend/src/scenes/funnels/funnelCorrelationUsageLogic.ts
index 932a2721cbdc..acba20d3bd65 100644
--- a/frontend/src/scenes/funnels/funnelCorrelationUsageLogic.ts
+++ b/frontend/src/scenes/funnels/funnelCorrelationUsageLogic.ts
@@ -1,4 +1,4 @@
-import { BreakPointFunction, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, BreakPointFunction, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { visibilitySensorLogic } from 'lib/components/VisibilitySensor/visibilitySensorLogic'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
@@ -8,13 +8,175 @@ import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'
import { EntityTypes, FunnelCorrelationResultsType, InsightLogicProps } from '~/types'
+import type {
+ DataNode,
+ ErrorTrackingQueryResponse,
+ FunnelsQuery,
+ HogQLAutocompleteResponse,
+ HogQLMetadataResponse,
+ HogQLQueryResponse,
+ HogQueryResponse,
+ LifecycleQuery,
+ LogAttributesQueryResponse,
+ LogValuesQueryResponse,
+ MetricsQueryResponse,
+ Node,
+ PathsQuery,
+ RefreshType,
+ RetentionQuery,
+ SessionsQueryResponse,
+ StickinessQuery,
+ TraceSpansAggregationQueryResponse,
+ TraceSpansAttributeBreakdownQueryResponse,
+ TraceSpansQueryResponse,
+ TrendsQuery,
+ WebOverviewQuery,
+ WebStatsTableQuery,
+} from '../../queries/schema/schema-general'
+import type { FunnelCorrelation, FunnelCorrelationType } from '../../types'
import { funnelCorrelationLogic } from './funnelCorrelationLogic'
-import type { funnelCorrelationUsageLogicType } from './funnelCorrelationUsageLogicType'
import { funnelDataLogic } from './funnelDataLogic'
import { funnelPersonsModalLogic } from './funnelPersonsModalLogic'
import { funnelPropertyCorrelationLogic } from './funnelPropertyCorrelationLogic'
import { parseEventAndProperty } from './funnelUtils'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelCorrelationUsageLogicValues {
+ isInDashboardContext: boolean // insightLogic
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null // insightVizDataLogic
+ correlationPropKey: string
+ shouldReportCorrelationViewed: boolean
+ shouldReportPropertyCorrelationViewed: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelCorrelationUsageLogicActions {
+ reportCorrelationInteraction: (
+ correlationType: FunnelCorrelation['result_type'],
+ action: string,
+ props?: Record<string, any>
+ ) => {
+ action: string
+ correlationType: FunnelCorrelationResultsType
+ props: Record<string, any> | undefined
+ } // eventUsageLogic
+ reportCorrelationViewed: (
+ query: Node | null,
+ delay?: number,
+ propertiesTable?: boolean
+ ) => {
+ delay: number | undefined
+ propertiesTable: boolean | undefined
+ query: Node<Record<string, any>> | null
+ } // eventUsageLogic
+ excludeEventFromProject: (eventName: string) => {
+ eventName: string
+ } // funnelCorrelationLogic
+ excludeEventPropertyFromProject: (
+ eventName: string,
+ propertyName: string
+ ) => {
+ eventName: string
+ propertyName: string
+ } // funnelCorrelationLogic
+ loadEventWithPropertyCorrelations: (eventName: string) => string // funnelCorrelationLogic
+ setCorrelationTypes: (types: FunnelCorrelationType[]) => {
+ types: FunnelCorrelationType[]
+ } // funnelCorrelationLogic
+ hideSkewWarning: () => {
+ value: true
+ } // funnelDataLogic
+ openCorrelationPersonsModal: (
+ correlation: FunnelCorrelation,
+ success: boolean
+ ) => {
+ correlation: FunnelCorrelation
+ success: boolean
+ } // funnelPersonsModalLogic
+ excludePropertyFromProject: (propertyName: string) => {
+ propertyName: string
+ } // funnelPropertyCorrelationLogic
+ setPropertyCorrelationTypes: (types: FunnelCorrelationType[]) => {
+ types: FunnelCorrelationType[]
+ } // funnelPropertyCorrelationLogic
+ setPropertyNames: (propertyNames: string[]) => {
+ propertyNames: string[]
+ } // funnelPropertyCorrelationLogic
+ loadDataSuccess: (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ | undefined,
+ payload?:
+ | {
+ overrideQuery: DataNode<Record<string, any>> | undefined
+ pollOnly: boolean
+ queryId: string
+ refresh: RefreshType | undefined
+ }
+ | undefined
+ ) => {
+ payload?: {
+ overrideQuery: DataNode<Record<string, any>> | undefined
+ pollOnly: boolean
+ queryId: string
+ refresh: RefreshType | undefined
+ }
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ | undefined
+ } // insightVizDataLogic
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelCorrelationUsageLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ correlationPropKey: (arg: any) => string
+ }
+}
+
+export type funnelCorrelationUsageLogicType = MakeLogicType<
+ funnelCorrelationUsageLogicValues,
+ funnelCorrelationUsageLogicActions,
+ InsightLogicProps,
+ funnelCorrelationUsageLogicMeta
+>
+
export const funnelCorrelationUsageLogic = kea<funnelCorrelationUsageLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps('insight_funnel')),
diff --git a/frontend/src/scenes/funnels/funnelDataLogic.ts b/frontend/src/scenes/funnels/funnelDataLogic.ts
index 023739bda7d7..2c417847d453 100644
--- a/frontend/src/scenes/funnels/funnelDataLogic.ts
+++ b/frontend/src/scenes/funnels/funnelDataLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { router } from 'kea-router'
import { DataColorTheme, DataColorToken } from 'lib/colors'
@@ -40,7 +40,27 @@ import {
FilterType,
} from '~/types'
-import type { funnelDataLogicType } from './funnelDataLogicType'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
+import type {
+ AnyDataWarehouseNode,
+ AnyEntityNode,
+ BreakdownFilter,
+ DataWarehouseNode,
+ FunnelsQuerySeriesNodeUnion,
+ GoalLine,
+ GroupNode,
+ InsightFilter,
+ LifecycleQuery,
+ PathsQuery,
+ ResultCustomizationByValue,
+ RetentionQuery,
+ StickinessQuery,
+ TrendsQuery,
+ WebOverviewQuery,
+ WebStatsTableQuery,
+} from '../../queries/schema/schema-general'
+import type { BreakdownKeyType, FunnelStep, IntervalType, LabelGroupType } from '../../types'
+import type { QuerySourceUpdate } from '../insights/insightVizDataLogic'
import {
TIME_INTERVAL_BOUNDS,
aggregateBreakdownCompareResult,
@@ -160,6 +180,335 @@ function isFunnelsQueryOrLegacyFilter(
return isFunnelsQuery(querySource)
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelDataLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun // groupsModel
+ breakdownFilter: BreakdownFilter | null | undefined // insightVizDataLogic
+ funnelsFilter: FunnelsFilter | null | undefined // insightVizDataLogic
+ getTheme: (themeId: number | string | null | undefined) => DataColorTheme | null // insightVizDataLogic
+ goalLines: GoalLine[] | null | undefined // insightVizDataLogic
+ hasDataWarehouseSeries: boolean // insightVizDataLogic
+ insightData: Record<string, any> // insightVizDataLogic
+ insightDataError: Record<string, any> | null // insightVizDataLogic
+ insightFilter: InsightFilter | null | undefined // insightVizDataLogic
+ interval: IntervalType | null | undefined // insightVizDataLogic
+ labelGroupType: LabelGroupType // insightVizDataLogic
+ legendPosition: string | null | undefined // insightVizDataLogic
+ showLegend: boolean | null | undefined // insightVizDataLogic
+ showValuesOnSeries: boolean | null | undefined // insightVizDataLogic
+ vizQuerySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null // insightVizDataLogic
+ vizSeries: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined // insightVizDataLogic
+ searchParams: Record<string, any> // router
+ advancedOptionsUsedCount: number
+ aggregationTargetLabel: Noun
+ breakdownSorting: string | undefined
+ conversionMetrics: FunnelTimeConversionMetrics
+ conversionWindow: Required<FunnelConversionWindow>
+ conversionWindowInterval: number | null
+ conversionWindowUnit: FunnelConversionWindowTimeUnit | null
+ disableFunnelBreakdownBaseline: boolean
+ exclusionDefaultStepRange: FunnelExclusionSteps
+ exclusionFilters: FilterType
+ flattenedBreakdowns: FlattenedFunnelStepByBreakdown[]
+ getFunnelsColor: (dataset: FlattenedFunnelStepByBreakdown | FunnelStepWithConversionMetrics) => string
+ getFunnelsColorToken: (
+ dataset: FlattenedFunnelStepByBreakdown | FunnelStepWithConversionMetrics
+ ) => [DataColorTheme | null, DataColorToken | null]
+ hasFunnelResults: boolean
+ hiddenLegendBreakdowns: string[] | undefined
+ histogramGraphData: HistogramGraphDatum[] | null
+ histogramGraphDataPrevious: HistogramGraphDatum[] | null
+ incompletenessOffsetFromEnd: number
+ indexedSteps: {
+ action_id: string
+ average_conversion_time: number | null
+ breakdown?: BreakdownKeyType | undefined
+ breakdown_value?: BreakdownKeyType | undefined
+ breakdowns?: BreakdownKeyType[] | undefined
+ colorIndex: number
+ compare: boolean | undefined
+ compare_label?: 'current' | 'previous' | undefined
+ converted_people_url: string
+ count: number
+ custom_name?: string | null | undefined
+ data?: number[] | undefined
+ days?: string[] | undefined
+ dropped_people_url: string | null
+ id: number
+ labels?: string[] | undefined
+ median_conversion_time: number | null
+ name: string
+ nested_breakdown?: FunnelStep[] | undefined
+ order: number
+ people?: string[] | undefined
+ seriesIndex: number
+ type: EntityType
+ }[]
+ isBreakdownCompareFunnel: boolean
+ isComparedFunnel: boolean
+ isEmptyFunnel: boolean | null
+ isFunnelWithEnoughSteps: boolean
+ isFunnelWithIncompleteDataWarehouseStep: boolean
+ isSkewed: boolean
+ isStepOptional: (step: number) => boolean
+ isStepsFunnel: boolean | null
+ isTimeToConvertFunnel: boolean | null
+ isTrendsFunnel: boolean | null
+ numericBinCount: number
+ querySource: FunnelsQuery | null
+ resultCustomizations: Record<string, ResultCustomizationByValue> | undefined
+ results: FunnelResultType
+ series: FunnelsQuerySeriesNodeUnion[] | null
+ skewWarningHidden: boolean
+ stepNames: FunnelStepWithNestedBreakdown[]
+ steps: FunnelStepWithNestedBreakdown[]
+ stepsWithConversionMetrics: FunnelStepWithConversionMetrics[]
+ timeConversionResults: FunnelsTimeConversionBins | null
+ timeConversionResultsPrevious: FunnelsTimeConversionBins | null
+ visibleStepsWithConversionMetrics: FunnelStepWithConversionMetrics[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelDataLogicActions {
+ cancelChanges: () => {
+ value: true
+ } // insightDataLogic
+ updateInsightFilter: (insightFilter: InsightFilter) => {
+ insightFilter: InsightFilter
+ } // insightVizDataLogic
+ updateQuerySource: (querySource: QuerySourceUpdate) => {
+ querySource: QuerySourceUpdate
+ } // insightVizDataLogic
+ push: (
+ url: string,
+ searchInput?: string | Record<string, any>,
+ hashInput?: string | Record<string, any>
+ ) => {
+ hashInput: string | Record<string, any>
+ searchInput: string | Record<string, any>
+ url: string
+ } // router
+ commitConversionWindow: () => {
+ value: true
+ }
+ hideSkewWarning: () => {
+ value: true
+ }
+ setBreakdownSorting: (breakdownSorting: string | undefined) => {
+ breakdownSorting: string | undefined
+ }
+ setConversionWindowInterval: (funnelWindowInterval: number) => {
+ funnelWindowInterval: number
+ }
+ setConversionWindowUnit: (funnelWindowIntervalUnit: FunnelConversionWindowTimeUnit) => {
+ funnelWindowIntervalUnit: FunnelConversionWindowTimeUnit
+ }
+ setHiddenLegendBreakdowns: (hiddenLegendBreakdowns: string[]) => {
+ hiddenLegendBreakdowns: string[]
+ }
+ toggleLegendBreakdownVisibility: (breakdown: string) => {
+ breakdown: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelDataLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ querySource: (
+ vizQuerySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => FunnelsQuery | null
+ series: (
+ vizQuerySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null,
+ vizSeries: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined
+ ) => FunnelsQuerySeriesNodeUnion[] | null
+ isStepsFunnel: (funnelsFilter: FunnelsFilter | null | undefined) => boolean | null
+ isTimeToConvertFunnel: (funnelsFilter: FunnelsFilter | null | undefined) => boolean | null
+ isTrendsFunnel: (funnelsFilter: FunnelsFilter | null | undefined) => boolean | null
+ isEmptyFunnel: (querySource: FunnelsQuery | null) => boolean | null
+ aggregationTargetLabel: (
+ querySource: FunnelsQuery | null,
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun
+ ) => Noun
+ results: (
+ insightData: Record<string, any>,
+ vizQuerySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null,
+ querySource: FunnelsQuery | null
+ ) => FunnelResultType
+ steps: (
+ insightData: Record<string, any>,
+ vizQuerySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null,
+ querySource: FunnelsQuery | null,
+ breakdownFilter: BreakdownFilter | null | undefined,
+ results: FunnelResultType,
+ isTimeToConvertFunnel: boolean | null,
+ isStepsFunnel: boolean | null
+ ) => FunnelStepWithNestedBreakdown[]
+ stepNames: (querySource: FunnelsQuery | null) => FunnelStepWithNestedBreakdown[]
+ isComparedFunnel: (steps: FunnelStepWithNestedBreakdown[]) => boolean
+ isBreakdownCompareFunnel: (results: FunnelResultType, isStepsFunnel: boolean | null) => boolean
+ stepsWithConversionMetrics: (
+ steps: FunnelStepWithNestedBreakdown[],
+ funnelsFilter: FunnelsFilter | null | undefined,
+ querySource: FunnelsQuery | null
+ ) => FunnelStepWithConversionMetrics[]
+ disableFunnelBreakdownBaseline: (arg: any) => boolean
+ flattenedBreakdowns: (
+ stepsWithConversionMetrics: FunnelStepWithConversionMetrics[],
+ funnelsFilter: FunnelsFilter | null | undefined,
+ disableFunnelBreakdownBaseline: boolean,
+ breakdownSorting: string | undefined,
+ isComparedFunnel: boolean,
+ isBreakdownCompareFunnel: boolean
+ ) => FlattenedFunnelStepByBreakdown[]
+ hiddenLegendBreakdowns: (funnelsFilter: FunnelsFilter | null | undefined) => string[] | undefined
+ breakdownSorting: (funnelsFilter: FunnelsFilter | null | undefined) => string | undefined
+ resultCustomizations: (
+ funnelsFilter: FunnelsFilter | null | undefined
+ ) => Record<string, ResultCustomizationByValue> | undefined
+ visibleStepsWithConversionMetrics: (
+ stepsWithConversionMetrics: FunnelStepWithConversionMetrics[],
+ flattenedBreakdowns: FlattenedFunnelStepByBreakdown[],
+ hiddenLegendBreakdowns: string[] | undefined,
+ isComparedFunnel: boolean,
+ isBreakdownCompareFunnel: boolean
+ ) => FunnelStepWithConversionMetrics[]
+ timeConversionResults: (
+ results: FunnelResultType,
+ funnelsFilter: FunnelsFilter | null | undefined
+ ) => FunnelsTimeConversionBins | null
+ timeConversionResultsPrevious: (
+ results: FunnelResultType,
+ funnelsFilter: FunnelsFilter | null | undefined
+ ) => FunnelsTimeConversionBins | null
+ histogramGraphData: (timeConversionResults: FunnelsTimeConversionBins | null) => HistogramGraphDatum[] | null
+ histogramGraphDataPrevious: (
+ timeConversionResultsPrevious: FunnelsTimeConversionBins | null
+ ) => HistogramGraphDatum[] | null
+ hasFunnelResults: (
+ insightData: Record<string, any>,
+ funnelsFilter: FunnelsFilter | null | undefined,
+ steps: FunnelStepWithNestedBreakdown[],
+ histogramGraphData: HistogramGraphDatum[] | null,
+ querySource: FunnelsQuery | null,
+ stepNames: FunnelStepWithNestedBreakdown[]
+ ) => boolean
+ numericBinCount: (
+ funnelsFilter: FunnelsFilter | null | undefined,
+ timeConversionResults: FunnelsTimeConversionBins | null
+ ) => number
+ conversionMetrics: (
+ steps: FunnelStepWithNestedBreakdown[],
+ funnelsFilter: FunnelsFilter | null | undefined,
+ timeConversionResults: FunnelsTimeConversionBins | null,
+ insightData: Record<string, any>
+ ) => FunnelTimeConversionMetrics
+ conversionWindow: (funnelsFilter: FunnelsFilter | null | undefined) => Required<FunnelConversionWindow>
+ incompletenessOffsetFromEnd: (
+ steps: FunnelStepWithNestedBreakdown[],
+ conversionWindow: Required<FunnelConversionWindow>
+ ) => number
+ advancedOptionsUsedCount: (funnelsFilter: FunnelsFilter | null | undefined) => number
+ isSkewed: (conversionMetrics: FunnelTimeConversionMetrics, skewWarningHidden: boolean) => boolean
+ indexedSteps: (steps: FunnelStepWithNestedBreakdown[]) => {
+ action_id: string
+ average_conversion_time: number | null
+ breakdown?: BreakdownKeyType | undefined
+ breakdown_value?: BreakdownKeyType | undefined
+ breakdowns?: BreakdownKeyType[] | undefined
+ colorIndex: number
+ compare: boolean | undefined
+ compare_label?: 'current' | 'previous' | undefined
+ converted_people_url: string
+ count: number
+ custom_name?: string | null | undefined
+ data?: number[] | undefined
+ days?: string[] | undefined
+ dropped_people_url: string | null
+ id: number
+ labels?: string[] | undefined
+ median_conversion_time: number | null
+ name: string
+ nested_breakdown?: FunnelStep[] | undefined
+ order: number
+ people?: string[] | undefined
+ seriesIndex: number
+ type: EntityType
+ }[]
+ getFunnelsColorToken: (
+ resultCustomizations: Record<string, ResultCustomizationByValue> | undefined,
+ getTheme: (themeId: number | string | null | undefined) => DataColorTheme | null,
+ breakdownFilter: BreakdownFilter | null | undefined,
+ querySource: FunnelsQuery | null
+ ) => (
+ dataset: FlattenedFunnelStepByBreakdown | FunnelStepWithConversionMetrics
+ ) => [DataColorTheme | null, DataColorToken | null]
+ getFunnelsColor: (
+ getFunnelsColorToken: (
+ dataset: FlattenedFunnelStepByBreakdown | FunnelStepWithConversionMetrics
+ ) => [DataColorTheme | null, DataColorToken | null]
+ ) => (dataset: FlattenedFunnelStepByBreakdown | FunnelStepWithConversionMetrics) => string
+ isStepOptional: (querySource: FunnelsQuery | null) => (step: number) => boolean
+ isFunnelWithEnoughSteps: (series: FunnelsQuerySeriesNodeUnion[] | null) => boolean
+ isFunnelWithIncompleteDataWarehouseStep: (series: FunnelsQuerySeriesNodeUnion[] | null) => boolean
+ exclusionDefaultStepRange: (querySource: FunnelsQuery | null) => FunnelExclusionSteps
+ exclusionFilters: (funnelsFilter: FunnelsFilter | null | undefined) => FilterType
+ }
+}
+
+export type funnelDataLogicType = MakeLogicType<
+ funnelDataLogicValues,
+ funnelDataLogicActions,
+ InsightLogicProps,
+ funnelDataLogicMeta
+>
+
export const funnelDataLogic = kea<funnelDataLogicType>([
path((key) => ['scenes', 'funnels', 'funnelDataLogic', key]),
props({} as InsightLogicProps),
@@ -240,17 +589,50 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
selectors(({ props }) => ({
querySource: [
(s) => [s.vizQuerySource],
- (vizQuerySource) => (isFunnelsQuery(vizQuerySource) ? vizQuerySource : null),
+ (
+ vizQuerySource:
+ | FunnelsQuery
+ | null
+ | import('~/queries/schema/schema-general').LifecycleQuery
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').RetentionQuery
+ | import('~/queries/schema/schema-general').StickinessQuery
+ | import('~/queries/schema/schema-general').TrendsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (isFunnelsQuery(vizQuerySource) ? vizQuerySource : null),
],
series: [
(s) => [s.vizQuerySource, s.vizSeries],
- (vizQuerySource, series) => (isFunnelsQuery(vizQuerySource) ? (series as FunnelsQuery['series']) : null),
+ (
+ vizQuerySource:
+ | FunnelsQuery
+ | null
+ | import('~/queries/schema/schema-general').LifecycleQuery
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').RetentionQuery
+ | import('~/queries/schema/schema-general').StickinessQuery
+ | import('~/queries/schema/schema-general').TrendsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery,
+ series:
+ | (
+ | import('~/queries/schema/schema-general').AnyEntityNode<
+ import('~/queries/schema/schema-general').AnyDataWarehouseNode
+ >
+ | import('~/queries/schema/schema-general').GroupNode<
+ import('~/queries/schema/schema-general').DataWarehouseNode
+ >
+ )[]
+ | null
+ | undefined
+ ) => (isFunnelsQuery(vizQuerySource) ? (series as FunnelsQuery['series']) : null),
],
isStepsFunnel: [
(s) => [s.funnelsFilter],
- (funnelsFilter): boolean | null => {
+ (funnelsFilter: FunnelsFilter | null | undefined): boolean | null => {
return funnelsFilter === null
? null
: funnelsFilter === undefined
@@ -260,20 +642,20 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
],
isTimeToConvertFunnel: [
(s) => [s.funnelsFilter],
- (funnelsFilter): boolean | null => {
+ (funnelsFilter: FunnelsFilter | null | undefined): boolean | null => {
return funnelsFilter === null ? null : funnelsFilter?.funnelVizType === FunnelVizType.TimeToConvert
},
],
isTrendsFunnel: [
(s) => [s.funnelsFilter],
- (funnelsFilter): boolean | null => {
+ (funnelsFilter: FunnelsFilter | null | undefined): boolean | null => {
return funnelsFilter === null ? null : funnelsFilter?.funnelVizType === FunnelVizType.Trends
},
],
isEmptyFunnel: [
(s) => [s.querySource],
- (q): boolean | null => {
+ (q: FunnelsQuery | null): boolean | null => {
return isFunnelsQuery(q)
? q.series.filter((n) => n.kind === NodeKind.EventsNode || n.kind === NodeKind.ActionsNode)
.length === 0
@@ -283,7 +665,10 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
aggregationTargetLabel: [
(s) => [s.querySource, s.aggregationLabel],
- (querySource, aggregationLabel): Noun => {
+ (
+ querySource: FunnelsQuery | null,
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun
+ ): Noun => {
if (!querySource) {
return { singular: '', plural: '' }
}
@@ -300,7 +685,20 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
results: [
(s) => [s.insightData, s.vizQuerySource, s.querySource],
- (insightData, vizQuerySource, querySource): FunnelResultType => {
+ (
+ insightData: Record<string, any>,
+ vizQuerySource:
+ | FunnelsQuery
+ | null
+ | import('~/queries/schema/schema-general').LifecycleQuery
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').RetentionQuery
+ | 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: FunnelsQuery | null
+ ): FunnelResultType => {
// Web analytics queries should not be processed as funnels, even though their response
// structure may look similar. InsightVizDisplay unconditionally mounts funnelDataLogic,
// so we need explicit guards to prevent web analytics data from being misinterpreted.
@@ -348,13 +746,22 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
s.isStepsFunnel,
],
(
- insightData,
- _vizQuerySource,
- querySource,
- breakdownFilter,
- results,
- isTimeToConvertFunnel,
- isStepsFunnel
+ insightData: Record<string, any>,
+ _vizQuerySource:
+ | FunnelsQuery
+ | null
+ | import('~/queries/schema/schema-general').LifecycleQuery
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').RetentionQuery
+ | 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: FunnelsQuery | null,
+ breakdownFilter: null | import('~/queries/schema/schema-general').BreakdownFilter | undefined,
+ results: FunnelResultType,
+ isTimeToConvertFunnel: boolean | null,
+ isStepsFunnel: boolean | null
): FunnelStepWithNestedBreakdown[] => {
if (!isFunnelsQueryOrLegacyFilter(insightData, querySource)) {
return []
@@ -390,7 +797,7 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
],
stepNames: [
(s) => [s.querySource],
- (querySource): FunnelStepWithNestedBreakdown[] => {
+ (querySource: FunnelsQuery | null): FunnelStepWithNestedBreakdown[] => {
if (!querySource?.series?.length) {
return []
}
@@ -425,7 +832,7 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
// visibility machinery must be bypassed for it.
isComparedFunnel: [
(s) => [s.steps],
- (steps): boolean =>
+ (steps: FunnelStepWithNestedBreakdown[]): boolean =>
Array.isArray(steps) &&
steps.some((step) => step.nested_breakdown?.some((series) => series.compare_label != null)),
],
@@ -435,7 +842,8 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
// breakdown machinery entirely, the latter keeps it (table, hidden legend) around the grouped bars.
isBreakdownCompareFunnel: [
(s) => [s.results, s.isStepsFunnel],
- (results, isStepsFunnel): boolean => !!isStepsFunnel && isFunnelStepsBreakdownCompareResult(results),
+ (results: FunnelResultType, isStepsFunnel: boolean | null): boolean =>
+ !!isStepsFunnel && isFunnelStepsBreakdownCompareResult(results),
],
stepsWithConversionMetrics: [
(s) => [s.steps, s.funnelsFilter, s.querySource],
@@ -500,13 +908,17 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
],
hiddenLegendBreakdowns: [
(s) => [s.funnelsFilter],
- (funnelsFilter): string[] | undefined => funnelsFilter?.hiddenLegendBreakdowns,
+ (funnelsFilter: FunnelsFilter | null | undefined): string[] | undefined =>
+ funnelsFilter?.hiddenLegendBreakdowns,
],
breakdownSorting: [
(s) => [s.funnelsFilter],
(funnelsFilter: FunnelsFilter | null | undefined): string | undefined => funnelsFilter?.breakdownSorting,
],
- resultCustomizations: [(s) => [s.funnelsFilter], (funnelsFilter) => funnelsFilter?.resultCustomizations],
+ resultCustomizations: [
+ (s) => [s.funnelsFilter],
+ (funnelsFilter: FunnelsFilter | null | undefined) => funnelsFilter?.resultCustomizations,
+ ],
visibleStepsWithConversionMetrics: [
(s) => [
s.stepsWithConversionMetrics,
@@ -613,7 +1025,10 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
*/
timeConversionResults: [
(s) => [s.results, s.funnelsFilter],
- (results, funnelsFilter): FunnelsTimeConversionBins | null => {
+ (
+ results: FunnelResultType,
+ funnelsFilter: FunnelsFilter | null | undefined
+ ): FunnelsTimeConversionBins | null => {
if (funnelsFilter?.funnelVizType !== FunnelVizType.TimeToConvert) {
return null
}
@@ -630,7 +1045,10 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
],
timeConversionResultsPrevious: [
(s) => [s.results, s.funnelsFilter],
- (results, funnelsFilter): FunnelsTimeConversionBins | null => {
+ (
+ results: FunnelResultType,
+ funnelsFilter: FunnelsFilter | null | undefined
+ ): FunnelsTimeConversionBins | null => {
if (funnelsFilter?.funnelVizType !== FunnelVizType.TimeToConvert || !Array.isArray(results)) {
return null
}
@@ -643,17 +1061,24 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
],
histogramGraphData: [
(s) => [s.timeConversionResults],
- (timeConversionResults): HistogramGraphDatum[] | null =>
+ (timeConversionResults: FunnelsTimeConversionBins | null): HistogramGraphDatum[] | null =>
timeConversionBinsToHistogramData(timeConversionResults),
],
histogramGraphDataPrevious: [
(s) => [s.timeConversionResultsPrevious],
- (timeConversionResultsPrevious): HistogramGraphDatum[] | null =>
+ (timeConversionResultsPrevious: FunnelsTimeConversionBins | null): HistogramGraphDatum[] | null =>
timeConversionBinsToHistogramData(timeConversionResultsPrevious),
],
hasFunnelResults: [
(s) => [s.insightData, s.funnelsFilter, s.steps, s.histogramGraphData, s.querySource, s.stepNames],
- (insightData, funnelsFilter, steps, histogramGraphData, querySource, stepNames) => {
+ (
+ insightData: Record<string, any>,
+ funnelsFilter: FunnelsFilter | null | undefined,
+ steps: FunnelStepWithNestedBreakdown[],
+ histogramGraphData: HistogramGraphDatum[] | null,
+ querySource: FunnelsQuery | null,
+ stepNames: FunnelStepWithNestedBreakdown[]
+ ) => {
if (!isFunnelsQueryOrLegacyFilter(insightData, querySource)) {
return false
}
@@ -673,7 +1098,10 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
],
numericBinCount: [
(s) => [s.funnelsFilter, s.timeConversionResults],
- (funnelsFilter, timeConversionResults): number => {
+ (
+ funnelsFilter: FunnelsFilter | null | undefined,
+ timeConversionResults: FunnelsTimeConversionBins | null
+ ): number => {
if (funnelsFilter?.binCount === BIN_COUNT_AUTO) {
return timeConversionResults?.bins?.length ?? 0
}
@@ -683,7 +1111,12 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
conversionMetrics: [
(s) => [s.steps, s.funnelsFilter, s.timeConversionResults, s.insightData],
- (steps, funnelsFilter, timeConversionResults, insightData): FunnelTimeConversionMetrics => {
+ (
+ steps: FunnelStepWithNestedBreakdown[],
+ funnelsFilter: FunnelsFilter | null | undefined,
+ timeConversionResults: FunnelsTimeConversionBins | null,
+ insightData: Record<string, any>
+ ): FunnelTimeConversionMetrics => {
// steps should be empty in time conversion view. Return metrics precalculated on backend
if (funnelsFilter?.funnelVizType === FunnelVizType.TimeToConvert) {
return {
@@ -726,7 +1159,7 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
],
conversionWindow: [
(s) => [s.funnelsFilter],
- (funnelsFilter): Required<FunnelConversionWindow> => {
+ (funnelsFilter: FunnelsFilter | null | undefined): Required<FunnelConversionWindow> => {
const { funnelWindowInterval, funnelWindowIntervalUnit } = funnelsFilter || {}
return {
funnelWindowInterval: funnelWindowInterval || 14,
@@ -736,7 +1169,7 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
],
incompletenessOffsetFromEnd: [
(s) => [s.steps, s.conversionWindow],
- (steps, conversionWindow) => {
+ (steps: FunnelStepWithNestedBreakdown[], conversionWindow: Required<FunnelConversionWindow>) => {
if (steps?.[0]?.days === undefined) {
return 0
}
@@ -757,7 +1190,7 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
*/
advancedOptionsUsedCount: [
(s) => [s.funnelsFilter],
- (funnelsFilter): number => {
+ (funnelsFilter: FunnelsFilter | null | undefined): number => {
let count = 0
if (funnelsFilter?.funnelOrderType && funnelsFilter?.funnelOrderType !== StepOrderValue.ORDERED) {
count = count + 1
@@ -777,13 +1210,13 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
isSkewed: [
(s) => [s.conversionMetrics, s.skewWarningHidden],
- (conversionMetrics, skewWarningHidden): boolean => {
+ (conversionMetrics: FunnelTimeConversionMetrics, skewWarningHidden: boolean): boolean => {
return !skewWarningHidden && (conversionMetrics.totalRate < 0.1 || conversionMetrics.totalRate > 0.9)
},
],
indexedSteps: [
(s) => [s.steps],
- (steps) => {
+ (steps: FunnelStepWithNestedBreakdown[]) => {
if (!Array.isArray(steps)) {
return []
}
@@ -818,7 +1251,14 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
],
getFunnelsColorToken: [
(s) => [s.resultCustomizations, s.getTheme, s.breakdownFilter, s.querySource],
- (resultCustomizations, getTheme, breakdownFilter, querySource) => {
+ (
+ resultCustomizations:
+ | Record<string, import('~/queries/schema/schema-general').ResultCustomizationByValue>
+ | undefined,
+ getTheme: (themeId: number | string | null | undefined) => DataColorTheme | null,
+ breakdownFilter: null | import('~/queries/schema/schema-general').BreakdownFilter | undefined,
+ querySource: FunnelsQuery | null
+ ) => {
return (
dataset: FlattenedFunnelStepByBreakdown | FunnelStepWithConversionMetrics
): [DataColorTheme | null, DataColorToken | null] => {
@@ -862,7 +1302,11 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
],
getFunnelsColor: [
(s) => [s.getFunnelsColorToken],
- (getFunnelsColorToken) => {
+ (
+ getFunnelsColorToken: (
+ dataset: FlattenedFunnelStepByBreakdown | FunnelStepWithConversionMetrics
+ ) => [DataColorTheme | null, DataColorToken | null]
+ ) => {
return (dataset: FlattenedFunnelStepByBreakdown | FunnelStepWithConversionMetrics) => {
const [colorTheme, colorToken] = getFunnelsColorToken(dataset)
const color = colorTheme && colorToken ? getColorFromToken(colorTheme, colorToken) : '#000000'
@@ -888,10 +1332,15 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
],
// Validations
- isFunnelWithEnoughSteps: [(s) => [s.series], (series) => isFunnelWithEnoughSteps(series)],
+ isFunnelWithEnoughSteps: [
+ (s) => [s.series],
+ (series: import('~/queries/schema/schema-general').FunnelsQuerySeriesNodeUnion[] | null) =>
+ isFunnelWithEnoughSteps(series),
+ ],
isFunnelWithIncompleteDataWarehouseStep: [
(s) => [s.series],
- (series) => isFunnelWithIncompleteDataWarehouseStep(series),
+ (series: import('~/queries/schema/schema-general').FunnelsQuerySeriesNodeUnion[] | null) =>
+ isFunnelWithIncompleteDataWarehouseStep(series),
],
// Exclusion filters
@@ -904,7 +1353,7 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
],
exclusionFilters: [
(s) => [s.funnelsFilter],
- (funnelsFilter): FilterType => ({
+ (funnelsFilter: FunnelsFilter | null | undefined): FilterType => ({
events: funnelsFilter?.exclusions?.map(({ funnelFromStep, funnelToStep, ...rest }, index) => ({
funnel_from_step: funnelFromStep,
funnel_to_step: funnelToStep,
diff --git a/frontend/src/scenes/funnels/funnelPersonsModalLogic.ts b/frontend/src/scenes/funnels/funnelPersonsModalLogic.ts
index 261c713d60a3..cc402f56fc9a 100644
--- a/frontend/src/scenes/funnels/funnelPersonsModalLogic.ts
+++ b/frontend/src/scenes/funnels/funnelPersonsModalLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, selectors } from 'kea'
import { elementsToAction } from 'scenes/activity/explore/createActionFromEvent'
import { insightLogic } from 'scenes/insights/insightLogic'
@@ -24,12 +24,75 @@ import {
PropertyOperator,
} from '~/types'
+import type { FunnelsFilter, FunnelsQuery } from '../../queries/schema/schema-general'
+import type { FunnelStepWithNestedBreakdown } from '../../types'
import { funnelDataLogic } from './funnelDataLogic'
-import type { funnelPersonsModalLogicType } from './funnelPersonsModalLogicType'
import { parseBreakdownValue, parseEventAndProperty } from './funnelUtils'
const DEFAULT_FUNNEL_LOGIC_KEY = 'default_funnel_key'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelPersonsModalLogicValues {
+ funnelsFilter: FunnelsFilter | null | undefined // funnelDataLogic
+ querySource: FunnelsQuery | null // funnelDataLogic
+ steps: FunnelStepWithNestedBreakdown[] // funnelDataLogic
+ isInDashboardContext: boolean // insightLogic
+ isInExperimentContext: boolean // insightLogic
+ canOpenPersonModal: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelPersonsModalLogicActions {
+ openCorrelationPersonsModal: (
+ correlation: FunnelCorrelation,
+ success: boolean
+ ) => {
+ correlation: FunnelCorrelation
+ success: boolean
+ }
+ openPersonsModalForSeries: ({
+ step,
+ series,
+ converted,
+ }: {
+ converted: boolean
+ series: Omit<FunnelStepWithConversionMetrics, 'nested_breakdown'>
+ step: FunnelStep
+ }) => {
+ converted: boolean
+ series: Omit<FunnelStepWithConversionMetrics, 'nested_breakdown'>
+ step: FunnelStep
+ }
+ openPersonsModalForStep: ({
+ step,
+ stepIndex,
+ converted,
+ }: {
+ converted: boolean
+ step: FunnelStep
+ stepIndex?: number
+ }) => {
+ converted: boolean
+ step: FunnelStep
+ stepIndex: number | undefined
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelPersonsModalLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ canOpenPersonModal: (funnelsFilter: FunnelsFilter | null | undefined) => boolean
+ }
+}
+
+export type funnelPersonsModalLogicType = MakeLogicType<
+ funnelPersonsModalLogicValues,
+ funnelPersonsModalLogicActions,
+ InsightLogicProps,
+ funnelPersonsModalLogicMeta
+>
+
export const funnelPersonsModalLogic = kea<funnelPersonsModalLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps(DEFAULT_FUNNEL_LOGIC_KEY)),
@@ -80,7 +143,7 @@ export const funnelPersonsModalLogic = kea<funnelPersonsModalLogicType>([
selectors({
canOpenPersonModal: [
(s) => [s.funnelsFilter],
- (funnelsFilter): boolean => {
+ (funnelsFilter: null | import('~/queries/schema/schema-general').FunnelsFilter | undefined): boolean => {
if (funnelsFilter?.customAggregationTarget) {
return false
}
diff --git a/frontend/src/scenes/funnels/funnelPropertyCorrelationLogic.ts b/frontend/src/scenes/funnels/funnelPropertyCorrelationLogic.ts
index 1d71fcf428c6..81a4988b6d74 100644
--- a/frontend/src/scenes/funnels/funnelPropertyCorrelationLogic.ts
+++ b/frontend/src/scenes/funnels/funnelPropertyCorrelationLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, defaults, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, defaults, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { lemonToast } from '@posthog/lemon-ui'
@@ -10,9 +10,10 @@ import { FunnelCorrelationQuery, FunnelsActorsQuery, NodeKind } from '~/queries/
import { setLatestVersionsOnQuery } from '~/queries/utils'
import { FunnelCorrelation, FunnelCorrelationResultsType, FunnelCorrelationType, InsightLogicProps } from '~/types'
+import type { FunnelsQuery } from '../../queries/schema/schema-general'
+import type { TeamPublicType, TeamType } from '../../types'
import { teamLogic } from '../teamLogic'
import { funnelCorrelationLogic } from './funnelCorrelationLogic'
-import type { funnelPropertyCorrelationLogicType } from './funnelPropertyCorrelationLogicType'
import { appendToCorrelationConfig } from './funnelUtils'
// List of events that should be excluded, if we don't have an explicit list of
@@ -39,6 +40,77 @@ export const DEFAULT_EXCLUDED_PERSON_PROPERTIES = [
'$initial_geoip_subdivision_name',
]
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelPropertyCorrelationLogicValues {
+ querySource: FunnelsQuery | null // funnelCorrelationLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ __ignore: FunnelCorrelationResultsType | null
+ excludedPropertyNames: string[]
+ isPropertyExcludedFromProject: (propertyName: string) => boolean
+ loadedPropertyCorrelationsTableOnce: boolean
+ propertyCorrelationTypes: FunnelCorrelationType[]
+ propertyCorrelationValues: FunnelCorrelation[]
+ propertyCorrelations: Record<'events', FunnelCorrelation[]>
+ propertyCorrelationsLoading: boolean
+ propertyNames: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelPropertyCorrelationLogicActions {
+ excludePropertyFromProject: (propertyName: string) => {
+ propertyName: string
+ }
+ loadPropertyCorrelations: (_: any) => any
+ loadPropertyCorrelationsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPropertyCorrelationsSuccess: (
+ propertyCorrelations: {
+ events: FunnelCorrelation[]
+ },
+ payload?: any
+ ) => {
+ propertyCorrelations: {
+ events: FunnelCorrelation[]
+ }
+ payload?: any
+ }
+ setAllProperties: () => {
+ value: true
+ }
+ setPropertyCorrelationTypes: (types: FunnelCorrelationType[]) => {
+ types: FunnelCorrelationType[]
+ }
+ setPropertyNames: (propertyNames: string[]) => {
+ propertyNames: string[]
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelPropertyCorrelationLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ propertyCorrelationValues: (
+ propertyCorrelations: Record<'events', FunnelCorrelation[]>,
+ propertyCorrelationTypes: FunnelCorrelationType[],
+ excludedPropertyNames: string[]
+ ) => FunnelCorrelation[]
+ excludedPropertyNames: (currentTeam: TeamPublicType | TeamType | null) => string[]
+ isPropertyExcludedFromProject: (excludedPropertyNames: string[]) => (propertyName: string) => boolean
+ }
+}
+
+export type funnelPropertyCorrelationLogicType = MakeLogicType<
+ funnelPropertyCorrelationLogicValues,
+ funnelPropertyCorrelationLogicActions,
+ InsightLogicProps,
+ funnelPropertyCorrelationLogicMeta
+>
+
export const funnelPropertyCorrelationLogic = kea<funnelPropertyCorrelationLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps('insight_funnel')),
@@ -129,7 +201,11 @@ export const funnelPropertyCorrelationLogic = kea<funnelPropertyCorrelationLogic
selectors({
propertyCorrelationValues: [
(s) => [s.propertyCorrelations, s.propertyCorrelationTypes, s.excludedPropertyNames],
- (propertyCorrelations, propertyCorrelationTypes, excludedPropertyNames): FunnelCorrelation[] => {
+ (
+ propertyCorrelations: Record<'events', FunnelCorrelation[]>,
+ propertyCorrelationTypes: FunnelCorrelationType[],
+ excludedPropertyNames: string[]
+ ): FunnelCorrelation[] => {
return propertyCorrelations.events
.filter(
(correlation) =>
@@ -152,12 +228,12 @@ export const funnelPropertyCorrelationLogic = kea<funnelPropertyCorrelationLogic
],
excludedPropertyNames: [
(s) => [s.currentTeam],
- (currentTeam): string[] =>
+ (currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType): string[] =>
currentTeam?.correlation_config?.excluded_person_property_names || DEFAULT_EXCLUDED_PERSON_PROPERTIES,
],
isPropertyExcludedFromProject: [
(s) => [s.excludedPropertyNames],
- (excludedPropertyNames) => (propertyName: string) =>
+ (excludedPropertyNames: string[]) => (propertyName: string) =>
excludedPropertyNames.find((name) => name === propertyName) !== undefined,
],
}),
diff --git a/frontend/src/scenes/insights/EditorFilters/funnelDataWarehouseStepDefinitionPopoverLogic.ts b/frontend/src/scenes/insights/EditorFilters/funnelDataWarehouseStepDefinitionPopoverLogic.ts
index ff00228fa123..cb3ff53bb42e 100644
--- a/frontend/src/scenes/insights/EditorFilters/funnelDataWarehouseStepDefinitionPopoverLogic.ts
+++ b/frontend/src/scenes/insights/EditorFilters/funnelDataWarehouseStepDefinitionPopoverLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import posthog from 'posthog-js'
import { definitionPopoverLogic } from 'lib/components/DefinitionPopover/definitionPopoverLogic'
@@ -16,7 +16,13 @@ import { InsightLogicProps } from '~/types'
import { DataWarehouseTableForInsight } from 'products/data_warehouse/frontend/types'
-import type { funnelDataWarehouseStepDefinitionPopoverLogicType } from './funnelDataWarehouseStepDefinitionPopoverLogicType'
+import type { TaxonomicDefinitionTypes } from '../../../lib/components/TaxonomicFilter/types'
+import type {
+ DatabaseSchemaField,
+ DatabaseSchemaSchema,
+ DatabaseSchemaSource,
+ FunnelsQuery,
+} from '../../../queries/schema/schema-general'
export type FunnelFieldKey = 'id_field' | 'timestamp_field' | 'aggregation_target_field'
@@ -38,6 +44,168 @@ export interface FunnelDataWarehouseStepDefinitionPopoverLogicProps {
insightProps: InsightLogicProps
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelDataWarehouseStepDefinitionPopoverLogicValues {
+ definition: Partial<TaxonomicDefinitionTypes> // definitionPopoverLogic
+ localDefinition: Partial<TaxonomicDefinitionTypes> // definitionPopoverLogic
+ querySource: FunnelsQuery | null // funnelDataLogic
+ activeField: DataWarehousePopoverField | undefined
+ activeFieldIsHogQL: boolean
+ activeFieldKey: FunnelFieldKey
+ activeFieldKeyOptions: {
+ label: string
+ value: FunnelFieldKey
+ }[]
+ activeFieldOptions: (
+ | {
+ label: string
+ value: string
+ }
+ | {
+ label: string
+ type: DatabaseSerializedFieldType
+ value: string
+ }
+ )[]
+ activeFieldValue: string | undefined
+ columnOptions: {
+ label: string
+ type: DatabaseSerializedFieldType
+ value: string
+ }[]
+ dataWarehousePopoverFields: DataWarehousePopoverField[]
+ isAggregatingByGroup: boolean
+ isAggregatingByHogQL: boolean
+ linkedTables: string[]
+ previewExpressionColumns: TablePreviewExpressionColumn[]
+ previewSelectedKey: string | undefined
+ previewTable: {
+ aggregation_target_field?: string | undefined
+ distinct_id_field?: string | undefined
+ fields: {
+ [k: string]: DatabaseSchemaField
+ }
+ format?: string | undefined
+ id: string
+ id_field?: string | undefined
+ name: string
+ row_count?: number | undefined
+ schema?: DatabaseSchemaSchema | undefined
+ search_aliases?: string[] | undefined
+ source?: DatabaseSchemaSource | undefined
+ timestamp_field?: string | undefined
+ type: 'data_warehouse'
+ url_pattern?: string | undefined
+ }
+ scopedLocalDefinition: Partial<TaxonomicDefinitionTypes>
+ selectedItemMeta: any
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelDataWarehouseStepDefinitionPopoverLogicActions {
+ setLocalDefinition: (item: Partial<TaxonomicDefinitionTypes>) => {
+ item: Partial<TaxonomicDefinitionTypes>
+ } // definitionPopoverLogic
+ selectTable: () => {
+ value: true
+ }
+ setActiveFieldKey: (activeFieldKey: FunnelFieldKey) => {
+ activeFieldKey: FunnelFieldKey
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface funnelDataWarehouseStepDefinitionPopoverLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ dataWarehousePopoverFields: (
+ dataWarehousePopoverFields: DataWarehousePopoverField[]
+ ) => DataWarehousePopoverField[]
+ selectedItemMeta: (arg: any) => any
+ columnOptions: (table: DataWarehouseTableForInsight) => {
+ label: string
+ type: DatabaseSerializedFieldType
+ value: string
+ }[]
+ linkedTables: (table: DataWarehouseTableForInsight) => string[]
+ activeFieldKeyOptions: (dataWarehousePopoverFields: DataWarehousePopoverField[]) => {
+ label: string
+ value: FunnelFieldKey
+ }[]
+ activeField: (
+ dataWarehousePopoverFields: DataWarehousePopoverField[],
+ activeFieldKey: FunnelFieldKey
+ ) => DataWarehousePopoverField | undefined
+ scopedLocalDefinition: (
+ definition: Partial<TaxonomicDefinitionTypes>,
+ localDefinition: Partial<TaxonomicDefinitionTypes>,
+ table: DataWarehouseTableForInsight,
+ selectedItemMeta: any
+ ) => Partial<TaxonomicDefinitionTypes>
+ activeFieldValue: (
+ scopedLocalDefinition: Partial<TaxonomicDefinitionTypes>,
+ activeFieldKey: FunnelFieldKey
+ ) => string | undefined
+ previewTable: (table: DataWarehouseTableForInsight) => {
+ aggregation_target_field?: string | undefined
+ distinct_id_field?: string | undefined
+ fields: {
+ [k: string]: DatabaseSchemaField
+ }
+ format?: string | undefined
+ id: string
+ id_field?: string | undefined
+ name: string
+ row_count?: number | undefined
+ schema?: DatabaseSchemaSchema | undefined
+ search_aliases?: string[] | undefined
+ source?: DatabaseSchemaSource | undefined
+ timestamp_field?: string | undefined
+ type: 'data_warehouse'
+ url_pattern?: string | undefined
+ }
+ previewExpressionColumns: (
+ table: DataWarehouseTableForInsight,
+ dataWarehousePopoverFields: DataWarehousePopoverField[],
+ scopedLocalDefinition: Partial<TaxonomicDefinitionTypes>
+ ) => TablePreviewExpressionColumn[]
+ previewSelectedKey: (
+ previewExpressionColumns: TablePreviewExpressionColumn[],
+ activeFieldKey: FunnelFieldKey,
+ activeFieldValue: string | undefined
+ ) => string | undefined
+ activeFieldOptions: (
+ columnOptions: {
+ label: string
+ type: DatabaseSerializedFieldType
+ value: string
+ }[],
+ activeField: DataWarehousePopoverField | undefined,
+ activeFieldKey: FunnelFieldKey
+ ) => (
+ | {
+ label: string
+ value: string
+ }
+ | {
+ label: string
+ type: DatabaseSerializedFieldType
+ value: string
+ }
+ )[]
+ activeFieldIsHogQL: (activeFieldValue: string | undefined, table: DataWarehouseTableForInsight) => boolean
+ isAggregatingByGroup: (querySource: FunnelsQuery | null) => boolean
+ isAggregatingByHogQL: (querySource: FunnelsQuery | null, isAggregatingByGroup: boolean) => boolean
+ }
+}
+
+export type funnelDataWarehouseStepDefinitionPopoverLogicType = MakeLogicType<
+ funnelDataWarehouseStepDefinitionPopoverLogicValues,
+ funnelDataWarehouseStepDefinitionPopoverLogicActions,
+ FunnelDataWarehouseStepDefinitionPopoverLogicProps,
+ funnelDataWarehouseStepDefinitionPopoverLogicMeta
+>
+
export const funnelDataWarehouseStepDefinitionPopoverLogic = kea<funnelDataWarehouseStepDefinitionPopoverLogicType>([
props({} as FunnelDataWarehouseStepDefinitionPopoverLogicProps),
key((props) => props.table.name),
@@ -58,7 +226,10 @@ export const funnelDataWarehouseStepDefinitionPopoverLogic = kea<funnelDataWareh
selectTable: true,
})),
selectors({
- dataWarehousePopoverFields: [(_, props) => [props.dataWarehousePopoverFields], (fields) => fields],
+ dataWarehousePopoverFields: [
+ (_, props) => [props.dataWarehousePopoverFields],
+ (fields: DataWarehousePopoverField[]) => fields,
+ ],
selectedItemMeta: [() => [(_, props) => props.selectedItemMeta], (selectedItemMeta) => selectedItemMeta],
}),
reducers({
@@ -77,7 +248,7 @@ export const funnelDataWarehouseStepDefinitionPopoverLogic = kea<funnelDataWareh
// `{ name, id }` without re-attaching the full schema). Empty
// array prevents the `Object.values(undefined)` crash; the
// user reopens via the table picker to get full options.
- (table) =>
+ (table: DataWarehouseTableForInsight) =>
table.fields
? Object.values(table.fields).map((column) => ({
label: `${column.name} (${column.type})`,
@@ -88,7 +259,7 @@ export const funnelDataWarehouseStepDefinitionPopoverLogic = kea<funnelDataWareh
],
linkedTables: [
(_, p) => [p.table],
- (table) =>
+ (table: DataWarehouseTableForInsight) =>
table.fields
? Object.values(table.fields)
.filter((field) => LINKED_TABLE_TYPES.includes(field.type))
@@ -97,7 +268,7 @@ export const funnelDataWarehouseStepDefinitionPopoverLogic = kea<funnelDataWareh
],
activeFieldKeyOptions: [
(s) => [s.dataWarehousePopoverFields],
- (dataWarehousePopoverFields) =>
+ (dataWarehousePopoverFields: DataWarehousePopoverField[]) =>
EDITABLE_FIELD_ORDER.map((key) => ({
value: key,
label: dataWarehousePopoverFields.find((f) => f.key === key)?.label ?? key,
@@ -105,24 +276,31 @@ export const funnelDataWarehouseStepDefinitionPopoverLogic = kea<funnelDataWareh
],
activeField: [
(s) => [s.dataWarehousePopoverFields, s.activeFieldKey],
- (dataWarehousePopoverFields, activeFieldKey) =>
+ (dataWarehousePopoverFields: DataWarehousePopoverField[], activeFieldKey: FunnelFieldKey) =>
dataWarehousePopoverFields.find((f) => f.key === activeFieldKey),
],
scopedLocalDefinition: [
(s, p) => [s.definition, s.localDefinition, p.table, s.selectedItemMeta],
- (definition, localDefinition, table, selectedItemMeta) =>
+ (
+ definition: Partial<import('lib/components/TaxonomicFilter/types').TaxonomicDefinitionTypes>,
+ localDefinition: Partial<import('lib/components/TaxonomicFilter/types').TaxonomicDefinitionTypes>,
+ table: DataWarehouseTableForInsight,
+ selectedItemMeta
+ ) =>
definition.name === table.name
? localDefinition
: getDataWarehouseItemWithFieldDefaults(table, selectedItemMeta),
],
activeFieldValue: [
(s) => [s.scopedLocalDefinition, s.activeFieldKey],
- (scopedLocalDefinition, activeFieldKey) =>
- (scopedLocalDefinition as Partial<Record<FunnelFieldKey, string | undefined>>)[activeFieldKey],
+ (
+ scopedLocalDefinition: Partial<import('lib/components/TaxonomicFilter/types').TaxonomicDefinitionTypes>,
+ activeFieldKey: FunnelFieldKey
+ ) => (scopedLocalDefinition as Partial<Record<FunnelFieldKey, string | undefined>>)[activeFieldKey],
],
previewTable: [
(_, p) => [p.table],
- (table) => ({
+ (table: DataWarehouseTableForInsight) => ({
...table,
fields: table.fields
? Object.fromEntries(
@@ -133,7 +311,11 @@ export const funnelDataWarehouseStepDefinitionPopoverLogic = kea<funnelDataWareh
],
previewExpressionColumns: [
(s, p) => [p.table, s.dataWarehousePopoverFields, s.scopedLocalDefinition],
- (table, dataWarehousePopoverFields, scopedLocalDefinition): TablePreviewExpressionColumn[] => {
+ (
+ table: DataWarehouseTableForInsight,
+ dataWarehousePopoverFields: DataWarehousePopoverField[],
+ scopedLocalDefinition: Partial<import('lib/components/TaxonomicFilter/types').TaxonomicDefinitionTypes>
+ ): TablePreviewExpressionColumn[] => {
const tableFieldNames = new Set(
table.fields ? Object.values(table.fields).map((field) => field.name) : []
)
@@ -176,13 +358,25 @@ export const funnelDataWarehouseStepDefinitionPopoverLogic = kea<funnelDataWareh
],
previewSelectedKey: [
(s) => [s.previewExpressionColumns, s.activeFieldKey, s.activeFieldValue],
- (previewExpressionColumns, activeFieldKey, activeFieldValue) =>
+ (
+ previewExpressionColumns: TablePreviewExpressionColumn[],
+ activeFieldKey: FunnelFieldKey,
+ activeFieldValue: string | undefined
+ ) =>
previewExpressionColumns.find((column) => column.key.startsWith(`__${activeFieldKey}_hogql_expression`))
?.key ?? activeFieldValue,
],
activeFieldOptions: [
(s) => [s.columnOptions, s.activeField, s.activeFieldKey],
- (columnOptions, activeField, activeFieldKey) => {
+ (
+ columnOptions: {
+ label: string
+ type: DatabaseSerializedFieldType
+ value: string
+ }[],
+ activeField: DataWarehousePopoverField | undefined,
+ activeFieldKey: FunnelFieldKey
+ ) => {
const filteredColumnOptions = columnOptions.filter((column) =>
ALLOWED_COLUMN_TYPES_BY_FIELD_KEY[activeFieldKey].includes(column.type)
)
@@ -197,17 +391,20 @@ export const funnelDataWarehouseStepDefinitionPopoverLogic = kea<funnelDataWareh
],
activeFieldIsHogQL: [
(s, p) => [s.activeFieldValue, p.table],
- (activeFieldValue, table) =>
+ (activeFieldValue: string | undefined, table: DataWarehouseTableForInsight) =>
!table.fields || !Object.values(table.fields).some((field) => field.name === activeFieldValue),
],
isAggregatingByGroup: [
(s) => [s.querySource],
- (querySource) => querySource?.aggregation_group_type_index != null,
+ (querySource: null | import('~/queries/schema/schema-general').FunnelsQuery) =>
+ querySource?.aggregation_group_type_index != null,
],
isAggregatingByHogQL: [
(s) => [s.querySource, s.isAggregatingByGroup],
- (querySource, isAggregatingByGroup) =>
- Boolean(querySource?.funnelsFilter?.funnelAggregateByHogQL) && !isAggregatingByGroup,
+ (
+ querySource: null | import('~/queries/schema/schema-general').FunnelsQuery,
+ isAggregatingByGroup: boolean
+ ) => Boolean(querySource?.funnelsFilter?.funnelAggregateByHogQL) && !isAggregatingByGroup,
],
}),
listeners(({ values, props }) => ({
diff --git a/frontend/src/scenes/insights/EditorFilters/goalLinesLogic.ts b/frontend/src/scenes/insights/EditorFilters/goalLinesLogic.ts
index e42133e23e15..4acf1d195f9b 100644
--- a/frontend/src/scenes/insights/EditorFilters/goalLinesLogic.ts
+++ b/frontend/src/scenes/insights/EditorFilters/goalLinesLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
import { subscriptions } from 'kea-subscriptions'
import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'
@@ -13,11 +13,70 @@ import {
import { isFunnelsQuery, isRetentionQuery, isTrendsQuery } from '~/queries/utils'
import { InsightLogicProps } from '~/types'
+import type {
+ LifecycleQuery,
+ PathsQuery,
+ StickinessQuery,
+ WebOverviewQuery,
+ WebStatsTableQuery,
+} from '../../../queries/schema/schema-general'
import { insightVizDataLogic } from '../insightVizDataLogic'
-import type { goalLinesLogicType } from './goalLinesLogicType'
+import type { QuerySourceUpdate } from '../insightVizDataLogic'
export type PoeModeTypes = HogQLQueryModifiers['personsOnEventsMode'] | null
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface goalLinesLogicValues {
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null // insightVizDataLogic
+ goalLines: GoalLine[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface goalLinesLogicActions {
+ updateQuerySource: (querySource: QuerySourceUpdate) => {
+ querySource: QuerySourceUpdate
+ } // insightVizDataLogic
+ addGoalLine: () => {
+ value: true
+ }
+ removeGoalLine: (goalLineIndex: number) => {
+ goalLineIndex: number
+ }
+ setGoalLines: (goalLines: GoalLine[]) => {
+ goalLines: GoalLine[]
+ }
+ updateGoalLine: (
+ goalLineIndex: number,
+ key: keyof GoalLine,
+ value: NonNullable<GoalLine[keyof GoalLine]>
+ ) => {
+ goalLineIndex: number
+ key: keyof GoalLine
+ value: NonNullable<boolean | number | string | undefined>
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface goalLinesLogicMeta {
+ key: string
+}
+
+export type goalLinesLogicType = MakeLogicType<
+ goalLinesLogicValues,
+ goalLinesLogicActions,
+ InsightLogicProps,
+ goalLinesLogicMeta
+>
+
export const goalLinesLogic = kea<goalLinesLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps('new')),
diff --git a/frontend/src/scenes/insights/EditorFilters/poeFilterLogic.ts b/frontend/src/scenes/insights/EditorFilters/poeFilterLogic.ts
index 080615b5e169..6c990aeb40d6 100644
--- a/frontend/src/scenes/insights/EditorFilters/poeFilterLogic.ts
+++ b/frontend/src/scenes/insights/EditorFilters/poeFilterLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
import { subscriptions } from 'kea-subscriptions'
import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'
@@ -6,11 +6,58 @@ import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'
import { HogQLQueryModifiers } from '~/queries/schema/schema-general'
import { InsightLogicProps } from '~/types'
+import type {
+ FunnelsQuery,
+ LifecycleQuery,
+ PathsQuery,
+ RetentionQuery,
+ StickinessQuery,
+ TrendsQuery,
+ WebOverviewQuery,
+ WebStatsTableQuery,
+} from '../../../queries/schema/schema-general'
import { insightVizDataLogic } from '../insightVizDataLogic'
-import type { poeFilterLogicType } from './poeFilterLogicType'
+import type { QuerySourceUpdate } from '../insightVizDataLogic'
export type PoeModeTypes = HogQLQueryModifiers['personsOnEventsMode'] | null
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface poeFilterLogicValues {
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null // insightVizDataLogic
+ poeMode: PoeModeTypes
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface poeFilterLogicActions {
+ updateQuerySource: (querySource: QuerySourceUpdate) => {
+ querySource: QuerySourceUpdate
+ } // insightVizDataLogic
+ setPoeMode: (poeMode: PoeModeTypes) => {
+ poeMode: PoeModeTypes
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface poeFilterLogicMeta {
+ key: string
+}
+
+export type poeFilterLogicType = MakeLogicType<
+ poeFilterLogicValues,
+ poeFilterLogicActions,
+ InsightLogicProps,
+ poeFilterLogicMeta
+>
+
export const poeFilterLogic = kea<poeFilterLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps('new')),
diff --git a/frontend/src/scenes/insights/EmptyStates/sampleDataStateLogic.ts b/frontend/src/scenes/insights/EmptyStates/sampleDataStateLogic.ts
index 7ea7be9d833e..15b3905eb11d 100644
--- a/frontend/src/scenes/insights/EmptyStates/sampleDataStateLogic.ts
+++ b/frontend/src/scenes/insights/EmptyStates/sampleDataStateLogic.ts
@@ -1,10 +1,30 @@
-import { connect, kea, path, selectors } from 'kea'
+import { MakeLogicType, connect, kea, path, selectors } from 'kea'
import { teamLogic } from 'scenes/teamLogic'
import { isSharedView } from '~/exporter/exporterViewLogic'
-import type { sampleDataStateLogicType } from './sampleDataStateLogicType'
+import type { TeamPublicType, TeamType } from '../../../types'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sampleDataStateLogicValues {
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ shouldShowSampleData: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface sampleDataStateLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ shouldShowSampleData: (currentTeam: TeamPublicType | TeamType | null) => boolean
+ }
+}
+
+export type sampleDataStateLogicType = MakeLogicType<
+ sampleDataStateLogicValues,
+ {},
+ Record<string, any>,
+ sampleDataStateLogicMeta
+>
/**
* Gates the pre-ingestion sample-data placeholder: only projects that never ingested an event see
@@ -22,8 +42,9 @@ export const sampleDataStateLogic = kea<sampleDataStateLogicType>([
// omits `ingested_event`, so it reads as `undefined` and would otherwise falsely flag
// every empty tile on a real, data-carrying project as "never ingested". External
// viewers should just see the normal "No data" state.
- (currentTeam): boolean =>
- !isSharedView() && !!currentTeam && !currentTeam.ingested_event && !currentTeam.is_demo,
+ (
+ currentTeam: null | import('../../../types').TeamPublicType | import('../../../types').TeamType
+ ): boolean => !isSharedView() && !!currentTeam && !currentTeam.ingested_event && !currentTeam.is_demo,
],
}),
])
diff --git a/frontend/src/scenes/insights/InsightNav/insightNavLogic.tsx b/frontend/src/scenes/insights/InsightNav/insightNavLogic.tsx
index d7d516bea15e..c91ee5f8b907 100644
--- a/frontend/src/scenes/insights/InsightNav/insightNavLogic.tsx
+++ b/frontend/src/scenes/insights/InsightNav/insightNavLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { router } from 'kea-router'
import { FEATURE_FLAGS } from 'lib/constants'
@@ -69,8 +69,9 @@ import { BaseMathType, InsightLogicProps, InsightType, IntervalType } from '~/ty
import { PRODUCT_ANALYTICS_DEFAULT_QUERY_TAGS } from 'products/product_analytics/frontend/constants'
+import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
+import type { Node } from '../../../queries/schema/schema-general'
import { MathAvailability } from '../filters/ActionFilter/ActionFilterRow/ActionFilterRow'
-import type { insightNavLogicType } from './insightNavLogicType'
export interface Tab {
label: string | JSX.Element
@@ -400,6 +401,45 @@ function getCommonVisualizationProperties(
return {} as Partial<EmptyCommonVisualizationProperties>
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightNavLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ filterTestAccountsDefault: boolean // filterTestAccountsDefaultsLogic
+ query: Node | null // insightDataLogic
+ activeView: InsightType
+ queryPropertyCache: QueryPropertyCache | null
+ tabs: Tab[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightNavLogicActions {
+ setQuery: (query: Node<Record<string, any>> | null) => {
+ query: Node<Record<string, any>> | null
+ } // insightDataLogic
+ setActiveView: (view: InsightType) => {
+ view: InsightType
+ }
+ updateQueryPropertyCache: (cache: QueryPropertyCache) => {
+ cache: QueryPropertyCache
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightNavLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ activeView: (query: Node<Record<string, any>> | null) => InsightType
+ tabs: (activeView: InsightType, query: Node<Record<string, any>> | null, featureFlags: FeatureFlagsSet) => Tab[]
+ }
+}
+
+export type insightNavLogicType = MakeLogicType<
+ insightNavLogicValues,
+ insightNavLogicActions,
+ InsightLogicProps,
+ insightNavLogicMeta
+>
+
export const insightNavLogic = kea<insightNavLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps('new')),
@@ -433,7 +473,7 @@ export const insightNavLogic = kea<insightNavLogicType>([
selectors({
activeView: [
(s) => [s.query],
- (query) => {
+ (query: null | import('~/queries/schema/schema-general').Node) => {
if (isDataTableNode(query)) {
return InsightType.JSON
} else if (containsHogQLQuery(query)) {
@@ -452,7 +492,11 @@ export const insightNavLogic = kea<insightNavLogicType>([
],
tabs: [
(s) => [s.activeView, s.query, s.featureFlags],
- (activeView, query, featureFlags) => {
+ (
+ activeView: InsightType,
+ query: null | import('~/queries/schema/schema-general').Node,
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet
+ ) => {
const tabs: Tab[] = [
{
label: 'Trends',
diff --git a/frontend/src/scenes/insights/dataRetention/dataRetentionBannerLogic.ts b/frontend/src/scenes/insights/dataRetention/dataRetentionBannerLogic.ts
index 734b23f11bf0..1f4d747eb880 100644
--- a/frontend/src/scenes/insights/dataRetention/dataRetentionBannerLogic.ts
+++ b/frontend/src/scenes/insights/dataRetention/dataRetentionBannerLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, path, reducers, selectors } from 'kea'
import { dayjs } from 'lib/dayjs'
import { organizationLogic } from 'scenes/organizationLogic'
@@ -6,7 +6,7 @@ import { teamLogic } from 'scenes/teamLogic'
import { TeamType } from '~/types'
-import type { dataRetentionBannerLogicType } from './dataRetentionBannerLogicType'
+import type { OrganizationType, TeamPublicType } from '../../../types'
const SNOOZE_DAYS = 30
// Don't nag accounts that can't yet have at-risk data: only warn once the account is within 90 days of its
@@ -22,6 +22,45 @@ function retentionMonthsLabel(months: number): string {
return `${months} month${months === 1 ? '' : 's'}`
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataRetentionBannerLogicValues {
+ currentOrganization: OrganizationType | null // organizationLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ accountAgeEligible: boolean
+ isSnoozed: boolean
+ retentionEnforced: boolean
+ retentionMonths: number | null
+ retentionPeriodLabel: string | null
+ snoozedUntil: string | null
+ warningEligible: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataRetentionBannerLogicActions {
+ snooze: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface dataRetentionBannerLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ retentionEnforced: (currentTeam: TeamPublicType | TeamType | null) => boolean
+ retentionMonths: (currentTeam: TeamPublicType | TeamType | null) => number | null
+ retentionPeriodLabel: (retentionMonths: number | null) => string | null
+ isSnoozed: (snoozedUntil: string | null) => boolean
+ accountAgeEligible: (currentOrganization: OrganizationType | null, retentionMonths: number | null) => boolean
+ warningEligible: (retentionEnforced: boolean, accountAgeEligible: boolean, isSnoozed: boolean) => boolean
+ }
+}
+
+export type dataRetentionBannerLogicType = MakeLogicType<
+ dataRetentionBannerLogicValues,
+ dataRetentionBannerLogicActions,
+ Record<string, any>,
+ dataRetentionBannerLogicMeta
+>
+
// Global (per-browser) snooze + plan-derived eligibility for the events data-retention warning. The per-insight
// "does this query's range exceed retention" check lives in insightRetentionBannerLogic; this one stays a singleton
// so the snooze is shared across every insight rather than dismissed once per insight.
@@ -45,23 +84,29 @@ export const dataRetentionBannerLogic = kea<dataRetentionBannerLogicType>([
selectors({
retentionEnforced: [
(s) => [s.currentTeam],
- (currentTeam): boolean => !!(currentTeam as TeamType | null)?.events_retention_enforced,
+ (currentTeam: TeamType | null | import('~/types').TeamPublicType): boolean =>
+ !!(currentTeam as TeamType | null)?.events_retention_enforced,
],
retentionMonths: [
(s) => [s.currentTeam],
- (currentTeam): number | null => (currentTeam as TeamType | null)?.event_retention_months ?? null,
+ (currentTeam: TeamType | null | import('~/types').TeamPublicType): number | null =>
+ (currentTeam as TeamType | null)?.event_retention_months ?? null,
],
retentionPeriodLabel: [
(s) => [s.retentionMonths],
- (retentionMonths): string | null => (retentionMonths ? retentionMonthsLabel(retentionMonths) : null),
+ (retentionMonths: number | null): string | null =>
+ retentionMonths ? retentionMonthsLabel(retentionMonths) : null,
],
isSnoozed: [
(s) => [s.snoozedUntil],
- (snoozedUntil): boolean => !!snoozedUntil && dayjs(snoozedUntil).isAfter(dayjs()),
+ (snoozedUntil: string | null): boolean => !!snoozedUntil && dayjs(snoozedUntil).isAfter(dayjs()),
],
accountAgeEligible: [
(s) => [s.currentOrganization, s.retentionMonths],
- (currentOrganization, retentionMonths): boolean => {
+ (
+ currentOrganization: null | import('~/types').OrganizationType,
+ retentionMonths: number | null
+ ): boolean => {
if (!currentOrganization?.created_at || !retentionMonths) {
return false
}
@@ -73,7 +118,7 @@ export const dataRetentionBannerLogic = kea<dataRetentionBannerLogicType>([
],
warningEligible: [
(s) => [s.retentionEnforced, s.accountAgeEligible, s.isSnoozed],
- (retentionEnforced, accountAgeEligible, isSnoozed): boolean =>
+ (retentionEnforced: boolean, accountAgeEligible: boolean, isSnoozed: boolean): boolean =>
retentionEnforced && accountAgeEligible && !isSnoozed,
],
}),
diff --git a/frontend/src/scenes/insights/dataRetention/insightRetentionBannerLogic.ts b/frontend/src/scenes/insights/dataRetention/insightRetentionBannerLogic.ts
index 473030b01f0c..31500ea19d59 100644
--- a/frontend/src/scenes/insights/dataRetention/insightRetentionBannerLogic.ts
+++ b/frontend/src/scenes/insights/dataRetention/insightRetentionBannerLogic.ts
@@ -1,4 +1,4 @@
-import { connect, kea, key, path, props, selectors } from 'kea'
+import { MakeLogicType, connect, kea, key, path, props, selectors } from 'kea'
import { dayjs } from 'lib/dayjs'
import { insightDataLogic } from 'scenes/insights/insightDataLogic'
@@ -8,8 +8,40 @@ import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'
import { isDataVisualizationNode, isHogQLQuery } from '~/queries/utils'
import { InsightLogicProps } from '~/types'
+import type { DateRange, Node } from '../../../queries/schema/schema-general'
import { dataRetentionBannerLogic } from './dataRetentionBannerLogic'
-import type { insightRetentionBannerLogicType } from './insightRetentionBannerLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightRetentionBannerLogicValues {
+ retentionMonths: number | null // dataRetentionBannerLogic
+ warningEligible: boolean // dataRetentionBannerLogic
+ insightData: Record<string, any> // insightDataLogic
+ query: Node | null // insightDataLogic
+ dateRange: DateRange | null | undefined // insightVizDataLogic
+ rangeExceedsRetention: boolean
+ shouldShowBanner: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightRetentionBannerLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ rangeExceedsRetention: (
+ dateRange: DateRange | null | undefined,
+ insightData: Record<string, any>,
+ retentionMonths: number | null,
+ query: Node<Record<string, any>> | null
+ ) => boolean
+ shouldShowBanner: (warningEligible: boolean, rangeExceedsRetention: boolean) => boolean
+ }
+}
+
+export type insightRetentionBannerLogicType = MakeLogicType<
+ insightRetentionBannerLogicValues,
+ {},
+ InsightLogicProps,
+ insightRetentionBannerLogicMeta
+>
// Per-insight half of the retention warning: does this insight's range reach past the team's retention window?
// "All time" is treated as exceeding (it resolves to the earliest event, so a team with only recent data wouldn't
@@ -31,7 +63,12 @@ export const insightRetentionBannerLogic = kea<insightRetentionBannerLogicType>(
selectors({
rangeExceedsRetention: [
(s) => [s.dateRange, s.insightData, s.retentionMonths, s.query],
- (dateRange, insightData, retentionMonths, query): boolean => {
+ (
+ dateRange: null | import('../../../queries/schema').DateRange | undefined,
+ insightData: Record<string, any>,
+ retentionMonths: number | null,
+ query: null | import('../../../queries/schema').Node
+ ): boolean => {
if (!retentionMonths) {
return false
}
@@ -52,7 +89,8 @@ export const insightRetentionBannerLogic = kea<insightRetentionBannerLogicType>(
],
shouldShowBanner: [
(s) => [s.warningEligible, s.rangeExceedsRetention],
- (warningEligible, rangeExceedsRetention): boolean => warningEligible && rangeExceedsRetention,
+ (warningEligible: boolean, rangeExceedsRetention: boolean): boolean =>
+ warningEligible && rangeExceedsRetention,
],
}),
])
diff --git a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterGroup/actionFilterGroupLogic.ts b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterGroup/actionFilterGroupLogic.ts
index 82d45e626986..4100c0af147a 100644
--- a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterGroup/actionFilterGroupLogic.ts
+++ b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterGroup/actionFilterGroupLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { uuid } from 'lib/utils/dom'
@@ -6,8 +6,9 @@ import { MathCategory, mathTypeToApiValues, mathsLogic } from 'scenes/trends/mat
import { AnyPropertyFilter, EntityType, EntityTypes, FilterLogicalOperator } from '~/types'
+import type { ActionFilter, AnyDataWarehouseFilter, EntityFilter } from '../../../../../types'
+import type { MathDefinition } from '../../../../trends/mathsLogic'
import { LocalFilter, entityFilterLogic } from '../entityFilterLogic'
-import type { actionFilterGroupLogicType } from './actionFilterGroupLogicType'
export interface ActionFilterGroupLogicProps {
filterUuid: string
@@ -28,6 +29,190 @@ function getMathProps(filter: LocalFilter): Record<string, any> {
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionFilterGroupLogicValues {
+ localFilters: LocalFilter[] // entityFilterLogic
+ mathDefinitions: Partial<Record<string, MathDefinition>> // mathsLogic
+ groupFilter: LocalFilter | undefined
+ isHogQLDropdownVisible: boolean
+ nestedFilters: LocalFilter[]
+ operator: FilterLogicalOperator
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionFilterGroupLogicActions {
+ updateParentFilter: (
+ filter: (ActionFilter | AnyDataWarehouseFilter | EntityFilter) & {
+ index: number
+ table_name?: string
+ [key: string]: any
+ }
+ ) =>
+ | {
+ custom_name?: string | null | undefined
+ id: number | string | null
+ index: number
+ name?: string | null | undefined
+ optionalInFunnel?: boolean | undefined
+ order?: number | undefined
+ table_name?: string | undefined
+ type?: EntityType | undefined
+ [key: string]: any
+ }
+ | {
+ custom_name?: string | null | undefined
+ days?: string[] | undefined
+ id: number | string | null
+ index: number
+ math?: string | undefined
+ math_group_type_index?: number | null | undefined
+ math_hogql?: string | null | undefined
+ math_property?: string | null | undefined
+ math_property_type?: TaxonomicFilterGroupType | null | undefined
+ name?: string | null | undefined
+ nestedFilters?: EntityFilter[] | null | undefined
+ operator?: FilterLogicalOperator | null | undefined
+ optionalInFunnel?: boolean | undefined
+ order?: number | undefined
+ properties?: AnyPropertyFilter[] | undefined
+ table_name?: string | undefined
+ type: EntityType
+ [key: string]: any
+ }
+ | {
+ aggregation_target_field: string
+ created_at_field: string
+ custom_name?: string | null | undefined
+ days?: string[] | undefined
+ id: number | string | null
+ index: number
+ math?: string | undefined
+ math_group_type_index?: number | null | undefined
+ math_hogql?: string | null | undefined
+ math_property?: string | null | undefined
+ math_property_type?: TaxonomicFilterGroupType | null | undefined
+ name?: string | null | undefined
+ nestedFilters?: EntityFilter[] | null | undefined
+ operator?: FilterLogicalOperator | null | undefined
+ optionalInFunnel?: boolean | undefined
+ order?: number | undefined
+ properties?: AnyPropertyFilter[] | undefined
+ table_name: string
+ timestamp_field: string
+ type: EntityType
+ [key: string]: any
+ }
+ | {
+ aggregation_target_field: string
+ custom_name?: string | null | undefined
+ days?: string[] | undefined
+ id: number | string | null
+ id_field: string
+ index: number
+ math?: string | undefined
+ math_group_type_index?: number | null | undefined
+ math_hogql?: string | null | undefined
+ math_property?: string | null | undefined
+ math_property_type?: TaxonomicFilterGroupType | null | undefined
+ name?: string | null | undefined
+ nestedFilters?: EntityFilter[] | null | undefined
+ operator?: FilterLogicalOperator | null | undefined
+ optionalInFunnel?: boolean | undefined
+ order?: number | undefined
+ properties?: AnyPropertyFilter[] | undefined
+ table_name: string
+ timestamp_field: string
+ type: EntityType
+ [key: string]: any
+ }
+ | {
+ custom_name?: string | null | undefined
+ days?: string[] | undefined
+ distinct_id_field: string
+ id: number | string | null
+ id_field: string
+ index: number
+ math?: string | undefined
+ math_group_type_index?: number | null | undefined
+ math_hogql?: string | null | undefined
+ math_property?: string | null | undefined
+ math_property_type?: TaxonomicFilterGroupType | null | undefined
+ name?: string | null | undefined
+ nestedFilters?: EntityFilter[] | null | undefined
+ operator?: FilterLogicalOperator | null | undefined
+ optionalInFunnel?: boolean | undefined
+ order?: number | undefined
+ properties?: AnyPropertyFilter[] | undefined
+ table_name: string
+ timestamp_field: string
+ type: EntityType
+ [key: string]: any
+ } // entityFilterLogic
+ addNestedFilter: (
+ id: string,
+ name: string,
+ type: EntityType
+ ) => {
+ id: string
+ name: string
+ type: EntityType
+ }
+ removeNestedFilter: (nestedIndex: number) => {
+ nestedIndex: number
+ }
+ setHogQLDropdownVisible: (visible: boolean) => {
+ visible: boolean
+ }
+ setMath: (
+ selectedMath: string | undefined,
+ defaultMathHogQLExpression: string
+ ) => {
+ defaultMathHogQLExpression: string
+ selectedMath: string | undefined
+ }
+ setMathHogQL: (hogql: string) => {
+ hogql: string
+ }
+ setMathProperty: (
+ property: string,
+ propertyType: TaxonomicFilterGroupType
+ ) => {
+ property: string
+ propertyType: TaxonomicFilterGroupType
+ }
+ updateNestedFilter: (
+ nestedIndex: number,
+ updates: Partial<LocalFilter>
+ ) => {
+ nestedIndex: number
+ updates: Partial<LocalFilter>
+ }
+ updateNestedFilterProperties: (
+ nestedIndex: number,
+ properties: AnyPropertyFilter[]
+ ) => {
+ nestedIndex: number
+ properties: AnyPropertyFilter[]
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionFilterGroupLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ groupFilter: (localFilters: LocalFilter[], groupIndex: number) => LocalFilter | undefined
+ nestedFilters: (groupFilter: LocalFilter | undefined) => LocalFilter[]
+ operator: (groupFilter: LocalFilter | undefined) => FilterLogicalOperator
+ }
+}
+
+export type actionFilterGroupLogicType = MakeLogicType<
+ actionFilterGroupLogicValues,
+ actionFilterGroupLogicActions,
+ ActionFilterGroupLogicProps,
+ actionFilterGroupLogicMeta
+>
+
export const actionFilterGroupLogic = kea<actionFilterGroupLogicType>([
path(['scenes', 'insights', 'filters', 'ActionFilter', 'ActionFilterGroup', 'actionFilterGroupLogic']),
props({} as ActionFilterGroupLogicProps),
@@ -66,11 +251,11 @@ export const actionFilterGroupLogic = kea<actionFilterGroupLogicType>([
selectors({
groupFilter: [
(s, p) => [s.localFilters, p.groupIndex],
- (localFilters, groupIndex): LocalFilter | undefined => localFilters[groupIndex],
+ (localFilters: LocalFilter[], groupIndex: number): LocalFilter | undefined => localFilters[groupIndex],
],
nestedFilters: [
(s) => [s.groupFilter],
- (groupFilter): LocalFilter[] =>
+ (groupFilter: LocalFilter | undefined): LocalFilter[] =>
((groupFilter?.nestedFilters as LocalFilter[] | undefined) || []).map((val, i) => ({
...val,
order: i,
@@ -78,7 +263,8 @@ export const actionFilterGroupLogic = kea<actionFilterGroupLogicType>([
],
operator: [
(s) => [s.groupFilter],
- (groupFilter): FilterLogicalOperator => groupFilter?.operator || FilterLogicalOperator.Or,
+ (groupFilter: LocalFilter | undefined): FilterLogicalOperator =>
+ groupFilter?.operator || FilterLogicalOperator.Or,
],
}),
diff --git a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterGroup/nestedFilterLogic.ts b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterGroup/nestedFilterLogic.ts
index 02836ca01439..0a68c2b03bb8 100644
--- a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterGroup/nestedFilterLogic.ts
+++ b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterGroup/nestedFilterLogic.ts
@@ -1,10 +1,9 @@
-import { actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { AnyPropertyFilter } from '~/types'
import { LocalFilter } from '../entityFilterLogic'
import { actionFilterGroupLogic } from './actionFilterGroupLogic'
-import type { nestedFilterLogicType } from './nestedFilterLogicType'
export interface NestedFilterLogicProps {
groupFilterUuid: string
@@ -13,6 +12,80 @@ export interface NestedFilterLogicProps {
groupIndex: number
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface nestedFilterLogicValues {
+ entityFilterVisible: Record<number, boolean>
+ filterVisible: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface nestedFilterLogicActions {
+ removeNestedFilter: (nestedIndex: number) => {
+ nestedIndex: number
+ } // actionFilterGroupLogic
+ updateNestedFilter: (
+ nestedIndex: number,
+ updates: Partial<LocalFilter>
+ ) => {
+ nestedIndex: number
+ updates: Partial<LocalFilter>
+ } // actionFilterGroupLogic
+ updateNestedFilterProperties: (
+ nestedIndex: number,
+ properties: AnyPropertyFilter[]
+ ) => {
+ nestedIndex: number
+ properties: AnyPropertyFilter[]
+ } // actionFilterGroupLogic
+ convertFilterToGroup: () => {}
+ duplicateFilter: () => {}
+ removeLocalFilter: (filter: { index: number }) => {
+ filter: {
+ index: number
+ }
+ }
+ selectFilter: () => {}
+ setEntityFilterVisibility: (
+ index: number,
+ value: boolean
+ ) => {
+ index: number
+ value: boolean
+ }
+ updateFilter: (
+ filter: Partial<LocalFilter> & {
+ index: number
+ }
+ ) => {
+ filter: Partial<LocalFilter> & {
+ index: number
+ }
+ }
+ updateFilterMath: () => {}
+ updateFilterOptional: () => {}
+ updateFilterProperty: (filter: { index: number; properties: AnyPropertyFilter[] }) => {
+ filter: {
+ index: number
+ properties: AnyPropertyFilter[]
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface nestedFilterLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ entityFilterVisible: (filterVisible: boolean, nestedIndex: number) => Record<number, boolean>
+ }
+}
+
+export type nestedFilterLogicType = MakeLogicType<
+ nestedFilterLogicValues,
+ nestedFilterLogicActions,
+ NestedFilterLogicProps,
+ nestedFilterLogicMeta
+>
+
/**
* Minimal logic for nested filters within an ActionFilterGroup.
* Implements only the actions required by ActionFilterRow and delegates
@@ -59,7 +132,7 @@ export const nestedFilterLogic = kea<nestedFilterLogicType>([
selectors({
entityFilterVisible: [
(s, p) => [s.filterVisible, p.nestedIndex],
- (filterVisible, nestedIndex): Record<number, boolean> => ({
+ (filterVisible: boolean, nestedIndex: number): Record<number, boolean> => ({
[nestedIndex]: filterVisible,
}),
],
diff --git a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/types.ts b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/types.ts
index 21d789e2e2f4..b6bb68d8a282 100644
--- a/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/types.ts
+++ b/frontend/src/scenes/insights/filters/ActionFilter/ActionFilterRow/types.ts
@@ -16,7 +16,7 @@ import {
} from '~/types'
import { LocalFilter } from '../entityFilterLogic'
-import { entityFilterLogicType } from '../entityFilterLogicType'
+import type { entityFilterLogicType } from '../entityFilterLogic'
export enum MathAvailability {
All,
diff --git a/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.ts b/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.ts
index 4b93a57f8970..2664e928a4be 100644
--- a/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.ts
+++ b/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.ts
@@ -1,5 +1,5 @@
import { deepEqual as equal } from 'fast-equals'
-import { actions, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { convertPropertyGroupToProperties } from 'lib/components/PropertyFilters/utils'
import { defaultDataWarehousePopoverFields } from 'lib/components/TaxonomicFilter/taxonomicFilterLogic'
@@ -21,7 +21,7 @@ import {
FilterType,
} from '~/types'
-import type { entityFilterLogicType } from './entityFilterLogicType'
+import type { TaxonomicFilterGroupType } from '../../../../lib/components/TaxonomicFilter/types'
export type LocalFilter = ActionFilter & {
order: number
@@ -113,6 +113,224 @@ export interface EntityFilterProps {
dataWarehousePopoverFields?: DataWarehousePopoverField[]
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface entityFilterLogicValues {
+ entityFilterVisible: boolean[]
+ filters: FilterType
+ localFilters: LocalFilter[]
+ modalVisible: boolean
+ selectedFilter: ActionFilter | EntityFilter | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface entityFilterLogicActions {
+ addFilter: () => {
+ value: true
+ }
+ convertFilterToGroup: (index: number) => {
+ index: number
+ }
+ duplicateFilter: (filter: ActionFilter | EntityFilter) => {
+ filter: ActionFilter | EntityFilter
+ }
+ hideModal: () => {
+ value: true
+ }
+ removeLocalFilter: (
+ filter: Partial<EntityFilter> & {
+ index: number
+ }
+ ) => {
+ index: number
+ type: EntityType | undefined
+ }
+ renameFilter: (custom_name: string) => {
+ custom_name: string
+ }
+ renameLocalFilter: (
+ index: number,
+ custom_name: string
+ ) => {
+ custom_name: string
+ index: number
+ }
+ selectFilter: (filter: ActionFilter | EntityFilter | null) => {
+ filter: ActionFilter | EntityFilter | null
+ }
+ setEntityFilterVisibility: (
+ index: number,
+ value: boolean
+ ) => {
+ index: number
+ value: boolean
+ }
+ setFilters: (filters: LocalFilter[]) => {
+ filters: LocalFilter[]
+ }
+ setLocalFilters: (filters: FilterType) => {
+ filters: FilterType
+ }
+ showModal: () => {
+ value: true
+ }
+ splitLocalFilter: (index: number) => {
+ index: number
+ }
+ updateFilter: (
+ filter: (ActionFilter | AnyDataWarehouseFilter | EntityFilter) & {
+ index: number
+ table_name?: string
+ [key: string]: any
+ }
+ ) =>
+ | {
+ custom_name?: string | null | undefined
+ id: number | string | null
+ index: number
+ name?: string | null | undefined
+ optionalInFunnel?: boolean | undefined
+ order?: number | undefined
+ table_name?: string | undefined
+ type?: EntityType | undefined
+ [key: string]: any
+ }
+ | {
+ custom_name?: string | null | undefined
+ days?: string[] | undefined
+ id: number | string | null
+ index: number
+ math?: string | undefined
+ math_group_type_index?: number | null | undefined
+ math_hogql?: string | null | undefined
+ math_property?: string | null | undefined
+ math_property_type?: TaxonomicFilterGroupType | null | undefined
+ name?: string | null | undefined
+ nestedFilters?: EntityFilter[] | null | undefined
+ operator?: FilterLogicalOperator | null | undefined
+ optionalInFunnel?: boolean | undefined
+ order?: number | undefined
+ properties?: AnyPropertyFilter[] | undefined
+ table_name?: string | undefined
+ type: EntityType
+ [key: string]: any
+ }
+ | {
+ aggregation_target_field: string
+ custom_name?: string | null | undefined
+ days?: string[] | undefined
+ id: number | string | null
+ id_field: string
+ index: number
+ math?: string | undefined
+ math_group_type_index?: number | null | undefined
+ math_hogql?: string | null | undefined
+ math_property?: string | null | undefined
+ math_property_type?: TaxonomicFilterGroupType | null | undefined
+ name?: string | null | undefined
+ nestedFilters?: EntityFilter[] | null | undefined
+ operator?: FilterLogicalOperator | null | undefined
+ optionalInFunnel?: boolean | undefined
+ order?: number | undefined
+ properties?: AnyPropertyFilter[] | undefined
+ table_name: string
+ timestamp_field: string
+ type: EntityType
+ [key: string]: any
+ }
+ | {
+ custom_name?: string | null | undefined
+ days?: string[] | undefined
+ distinct_id_field: string
+ id: number | string | null
+ id_field: string
+ index: number
+ math?: string | undefined
+ math_group_type_index?: number | null | undefined
+ math_hogql?: string | null | undefined
+ math_property?: string | null | undefined
+ math_property_type?: TaxonomicFilterGroupType | null | undefined
+ name?: string | null | undefined
+ nestedFilters?: EntityFilter[] | null | undefined
+ operator?: FilterLogicalOperator | null | undefined
+ optionalInFunnel?: boolean | undefined
+ order?: number | undefined
+ properties?: AnyPropertyFilter[] | undefined
+ table_name: string
+ timestamp_field: string
+ type: EntityType
+ [key: string]: any
+ }
+ | {
+ aggregation_target_field: string
+ created_at_field: string
+ custom_name?: string | null | undefined
+ days?: string[] | undefined
+ id: number | string | null
+ index: number
+ math?: string | undefined
+ math_group_type_index?: number | null | undefined
+ math_hogql?: string | null | undefined
+ math_property?: string | null | undefined
+ math_property_type?: TaxonomicFilterGroupType | null | undefined
+ name?: string | null | undefined
+ nestedFilters?: EntityFilter[] | null | undefined
+ operator?: FilterLogicalOperator | null | undefined
+ optionalInFunnel?: boolean | undefined
+ order?: number | undefined
+ properties?: AnyPropertyFilter[] | undefined
+ table_name: string
+ timestamp_field: string
+ type: EntityType
+ [key: string]: any
+ }
+ updateFilterMath: (
+ filter: Partial<ActionFilter> & {
+ index: number
+ }
+ ) => {
+ index: number
+ math: string | undefined
+ math_group_type_index: number | null | undefined
+ math_hogql: string | null | undefined
+ math_property: string | null | undefined
+ math_property_type: TaxonomicFilterGroupType | null | undefined
+ type: EntityType
+ }
+ updateFilterOptional: (
+ filter: Partial<ActionFilter> & {
+ index: number
+ }
+ ) => {
+ index: number
+ optionalInFunnel: boolean | undefined
+ type: EntityType
+ }
+ updateFilterProperty: (
+ filter: Partial<EntityFilter> & {
+ index?: number
+ properties: AnyPropertyFilter[]
+ }
+ ) => {
+ index: number | undefined
+ properties: AnyPropertyFilter[]
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface entityFilterLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ filters: (localFilters: LocalFilter[]) => FilterType
+ }
+}
+
+export type entityFilterLogicType = MakeLogicType<
+ entityFilterLogicValues,
+ entityFilterLogicActions,
+ EntityFilterProps,
+ entityFilterLogicMeta
+>
+
export const entityFilterLogic = kea<entityFilterLogicType>([
props({} as EntityFilterProps),
key((props) => props.typeKey),
@@ -234,7 +452,7 @@ export const entityFilterLogic = kea<entityFilterLogicType>([
})),
selectors({
- filters: [(s) => [s.localFilters], (localFilters): FilterType => toFilters(localFilters)],
+ filters: [(s) => [s.localFilters], (localFilters: LocalFilter[]): FilterType => toFilters(localFilters)],
}),
listeners(({ actions, values, props }) => ({
diff --git a/frontend/src/scenes/insights/filters/ActionFilter/renameModalLogic.ts b/frontend/src/scenes/insights/filters/ActionFilter/renameModalLogic.ts
index 759e346e8f58..1166ecb5e0dd 100644
--- a/frontend/src/scenes/insights/filters/ActionFilter/renameModalLogic.ts
+++ b/frontend/src/scenes/insights/filters/ActionFilter/renameModalLogic.ts
@@ -1,17 +1,44 @@
-import { actions, connect, kea, key, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, path, props, reducers } from 'kea'
import { entityFilterLogic } from 'scenes/insights/filters/ActionFilter/entityFilterLogic'
import { getDisplayNameFromEntityFilter } from 'scenes/insights/utils'
import { EntityFilterTypes } from '~/types'
-import type { renameModalLogicType } from './renameModalLogicType'
+import type { ActionFilter, EntityFilter } from '../../../../types'
export interface RenameModalProps {
filter: EntityFilterTypes
typeKey: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface renameModalLogicValues {
+ name: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface renameModalLogicActions {
+ selectFilter: (filter: ActionFilter | EntityFilter | null) => {
+ filter: ActionFilter | EntityFilter | null
+ } // entityFilterLogic
+ setName: (name: string) => {
+ name: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface renameModalLogicMeta {
+ key: string
+}
+
+export type renameModalLogicType = MakeLogicType<
+ renameModalLogicValues,
+ renameModalLogicActions,
+ RenameModalProps,
+ renameModalLogicMeta
+>
+
export const renameModalLogic = kea<renameModalLogicType>([
props({} as RenameModalProps),
key((props) => props.typeKey),
diff --git a/frontend/src/scenes/insights/filters/BreakdownFilter/breakdownTagLogic.ts b/frontend/src/scenes/insights/filters/BreakdownFilter/breakdownTagLogic.ts
index ff5cd8089a4f..6691f43faf76 100644
--- a/frontend/src/scenes/insights/filters/BreakdownFilter/breakdownTagLogic.ts
+++ b/frontend/src/scenes/insights/filters/BreakdownFilter/breakdownTagLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import {
breakdownFilterToTaxonomicFilterType,
@@ -14,7 +14,15 @@ import { cohortsModel } from '~/models/cohortsModel'
import { propertyDefinitionsModel } from '~/models/propertyDefinitionsModel'
import { AvailableFeature, InsightLogicProps } from '~/types'
-import type { breakdownTagLogicType } from './breakdownTagLogicType'
+import type { TaxonomicFilterValue } from '../../../../lib/components/TaxonomicFilter/types'
+import type { Breakdown, BreakdownFilter } from '../../../../queries/schema/schema-general'
+import type {
+ CohortType,
+ PropertyDefinition,
+ PropertyDefinitionType,
+ TeamPublicType,
+ TeamType,
+} from '../../../../types'
import { taxonomicBreakdownFilterLogic } from './taxonomicBreakdownFilterLogic'
import { isURLNormalizeable } from './taxonomicBreakdownFilterUtils'
@@ -25,6 +33,168 @@ export interface BreakdownTagLogicProps {
isTrends: boolean
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface breakdownTagLogicValues {
+ cohortsById: Partial<Record<number | string, CohortType>> // cohortsModel
+ getPropertyDefinition: (
+ s: TaxonomicFilterValue,
+ type: PropertyDefinitionType,
+ groupTypeIndex?: number
+ ) => PropertyDefinition | null // propertyDefinitionsModel
+ breakdownFilter: BreakdownFilter // taxonomicBreakdownFilterLogic
+ globalBinCount: number | undefined // taxonomicBreakdownFilterLogic
+ globalHistogramBinsUsed: boolean // taxonomicBreakdownFilterLogic
+ globalNormalizeBreakdownUrl: boolean // taxonomicBreakdownFilterLogic
+ globalPathCleaningEnabled: boolean // taxonomicBreakdownFilterLogic
+ isMultipleBreakdownsEnabled: boolean // taxonomicBreakdownFilterLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean // userLogic
+ breakdown: number | string
+ breakdownType: string
+ hasAdvancedPaths: boolean
+ hasPathCleaningFilters: boolean
+ histogramBinCount: number | undefined
+ histogramBinsUsed: boolean
+ isHistogramable: boolean
+ isNormalizeable: boolean
+ isPathCleaningAvailable: boolean
+ localHistogramBinCount: number | undefined
+ localNormalizeBreakdownURL: boolean | undefined
+ multipleBreakdown: Breakdown | undefined
+ normalizeBreakdownURL: boolean
+ pathCleaningEnabled: boolean
+ propertyDefinition: PropertyDefinition | null
+ taxonomicBreakdownType: TaxonomicFilterGroupType | undefined
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface breakdownTagLogicActions {
+ removeBreakdownFromList: (
+ breakdown: number | string,
+ breakdownType: string
+ ) => {
+ breakdown: number | string
+ breakdownType: string
+ } // taxonomicBreakdownFilterLogic
+ setHistogramBinCountInList: (
+ breakdown: number | string,
+ breakdownType: string,
+ count: number | undefined
+ ) => {
+ breakdown: number | string
+ breakdownType: string
+ count: number | undefined
+ } // taxonomicBreakdownFilterLogic
+ setHistogramBinsUsedInList: (
+ breakdown: number | string,
+ breakdownType: string,
+ binsUsed: boolean,
+ binCount?: number | undefined
+ ) => {
+ binCount: number | undefined
+ binsUsed: boolean
+ breakdown: number | string
+ breakdownType: string
+ } // taxonomicBreakdownFilterLogic
+ setNormalizeBreakdownURLInList: (
+ breakdown: number | string,
+ breakdownType: string,
+ normalizeBreakdownURL: boolean
+ ) => {
+ breakdown: number | string
+ breakdownType: string
+ normalizeBreakdownURL: boolean
+ } // taxonomicBreakdownFilterLogic
+ setPathCleaningEnabledInList: (
+ breakdown: number | string,
+ breakdownType: string,
+ pathCleaningEnabled: boolean
+ ) => {
+ breakdown: number | string
+ breakdownType: string
+ pathCleaningEnabled: boolean
+ } // taxonomicBreakdownFilterLogic
+ removeBreakdown: () => {
+ value: true
+ }
+ setHistogramBinCount: (count: number) => {
+ count: number
+ }
+ setHistogramBinsUsed: (binsUsed: boolean) => {
+ binsUsed: boolean
+ }
+ setNormalizeBreakdownURL: (normalizeURL: boolean) => {
+ normalizeURL: boolean
+ }
+ setPathCleaningEnabled: (pathCleaningEnabled: boolean) => {
+ pathCleaningEnabled: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface breakdownTagLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ breakdown: (breakdown: number | string) => number | string
+ breakdownType: (breakdownType: string) => string
+ propertyDefinition: (
+ getPropertyDefinition: (
+ s: TaxonomicFilterValue,
+ type: PropertyDefinitionType,
+ groupTypeIndex?: number
+ ) => PropertyDefinition | null,
+ breakdown: number | string,
+ breakdownType: string
+ ) => PropertyDefinition | null
+ isHistogramable: (isTrends: boolean, propertyDefinition: PropertyDefinition | null) => boolean
+ isNormalizeable: (propertyDefinition: PropertyDefinition | null) => boolean
+ multipleBreakdown: (
+ breakdownFilter: BreakdownFilter,
+ breakdown: number | string,
+ breakdownType: string
+ ) => Breakdown | undefined
+ histogramBinsUsed: (
+ isMultipleBreakdownsEnabled: boolean,
+ multipleBreakdown: Breakdown | undefined,
+ globalHistogramBinsUsed: boolean
+ ) => boolean
+ histogramBinCount: (
+ isMultipleBreakdownsEnabled: boolean,
+ localHistogramBinCount: number | undefined,
+ globalBinCount: number | undefined,
+ multipleBreakdown: Breakdown | undefined
+ ) => number | undefined
+ normalizeBreakdownURL: (
+ isMultipleBreakdownsEnabled: boolean,
+ localNormalizeBreakdownURL: boolean | undefined,
+ globalNormalizeBreakdownUrl: boolean,
+ multipleBreakdown: Breakdown | undefined
+ ) => boolean
+ pathCleaningEnabled: (globalPathCleaningEnabled: boolean) => boolean
+ hasAdvancedPaths: (
+ hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean
+ ) => boolean
+ hasPathCleaningFilters: (currentTeam: TeamPublicType | TeamType | null) => boolean
+ isPathCleaningAvailable: (
+ isNormalizeable: boolean,
+ hasAdvancedPaths: boolean,
+ hasPathCleaningFilters: boolean
+ ) => boolean
+ taxonomicBreakdownType: (
+ isMultipleBreakdownsEnabled: boolean,
+ breakdownFilter: BreakdownFilter,
+ multipleBreakdown: Breakdown | undefined
+ ) => TaxonomicFilterGroupType | undefined
+ }
+}
+
+export type breakdownTagLogicType = MakeLogicType<
+ breakdownTagLogicValues,
+ breakdownTagLogicActions,
+ BreakdownTagLogicProps,
+ breakdownTagLogicMeta
+>
+
export const breakdownTagLogic = kea<breakdownTagLogicType>([
props({} as BreakdownTagLogicProps),
key(({ insightProps, breakdown }) => `${keyForInsightLogicProps('new')(insightProps)}-${breakdown}`),
@@ -90,31 +260,44 @@ export const breakdownTagLogic = kea<breakdownTagLogicType>([
],
}),
selectors({
- breakdown: [(_, props) => [props.breakdown], (breakdown) => breakdown],
- breakdownType: [(_, props) => [props.breakdownType], (breakdownType) => breakdownType],
+ breakdown: [(_, props) => [props.breakdown], (breakdown: number | string) => breakdown],
+ breakdownType: [(_, props) => [props.breakdownType], (breakdownType: string) => breakdownType],
propertyDefinition: [
(s, p) => [s.getPropertyDefinition, p.breakdown, p.breakdownType],
- (getPropertyDefinition, breakdown, breakdownType) =>
- getPropertyDefinition(breakdown, propertyFilterTypeToPropertyDefinitionType(breakdownType)),
+ (
+ getPropertyDefinition: (
+ s: import('lib/components/TaxonomicFilter/types').TaxonomicFilterValue,
+ type: import('~/types').PropertyDefinitionType,
+ groupTypeIndex?: number
+ ) => null | import('~/types').PropertyDefinition,
+ breakdown: number | string,
+ breakdownType: string
+ ) => getPropertyDefinition(breakdown, propertyFilterTypeToPropertyDefinitionType(breakdownType)),
],
isHistogramable: [
(s, p) => [p.isTrends, s.propertyDefinition],
- (isTrends, propertyDefinition) => isTrends && !!propertyDefinition?.is_numerical,
+ (isTrends: boolean, propertyDefinition: null | import('~/types').PropertyDefinition) =>
+ isTrends && !!propertyDefinition?.is_numerical,
],
isNormalizeable: [
(s) => [s.propertyDefinition],
- (propertyDefinition) => isURLNormalizeable(propertyDefinition?.name || ''),
+ (propertyDefinition: null | import('~/types').PropertyDefinition) =>
+ isURLNormalizeable(propertyDefinition?.name || ''),
],
multipleBreakdown: [
(s) => [s.breakdownFilter, s.breakdown, s.breakdownType],
- ({ breakdowns }, breakdown, breakdownType) =>
+ ({ breakdowns }, breakdown: number | string, breakdownType: string) =>
breakdowns?.find(
(savedBreakdown) => savedBreakdown.property === breakdown && savedBreakdown.type === breakdownType
),
],
histogramBinsUsed: [
(s) => [s.isMultipleBreakdownsEnabled, s.multipleBreakdown, s.globalHistogramBinsUsed],
- (isMultipleBreakdownsEnabled, multipleBreakdown, globalHistogramBinsUsed) => {
+ (
+ isMultipleBreakdownsEnabled: boolean,
+ multipleBreakdown: import('../../../../queries/schema').Breakdown | undefined,
+ globalHistogramBinsUsed: boolean
+ ) => {
if (isMultipleBreakdownsEnabled) {
return multipleBreakdown?.histogram_bin_count != null
}
@@ -124,7 +307,12 @@ export const breakdownTagLogic = kea<breakdownTagLogicType>([
],
histogramBinCount: [
(s) => [s.isMultipleBreakdownsEnabled, s.localHistogramBinCount, s.globalBinCount, s.multipleBreakdown],
- (isMultipleBreakdownsEnabled, localHistogramBinCount, globalBinCount, multipleBreakdown) => {
+ (
+ isMultipleBreakdownsEnabled: boolean,
+ localHistogramBinCount: number | undefined,
+ globalBinCount: number | undefined,
+ multipleBreakdown: import('../../../../queries/schema').Breakdown | undefined
+ ) => {
if (isMultipleBreakdownsEnabled) {
return localHistogramBinCount ?? multipleBreakdown?.histogram_bin_count ?? 10
}
@@ -140,10 +328,10 @@ export const breakdownTagLogic = kea<breakdownTagLogicType>([
s.multipleBreakdown,
],
(
- isMultipleBreakdownsEnabled,
- localNormalizeBreakdownURL,
- globalNormalizeBreakdownUrl,
- multipleBreakdown
+ isMultipleBreakdownsEnabled: boolean,
+ localNormalizeBreakdownURL: boolean | undefined,
+ globalNormalizeBreakdownUrl: boolean,
+ multipleBreakdown: import('../../../../queries/schema').Breakdown | undefined
) => {
if (isMultipleBreakdownsEnabled) {
return localNormalizeBreakdownURL ?? multipleBreakdown?.normalize_url ?? true
@@ -154,24 +342,30 @@ export const breakdownTagLogic = kea<breakdownTagLogicType>([
],
pathCleaningEnabled: [
(s) => [s.globalPathCleaningEnabled],
- (globalPathCleaningEnabled) => globalPathCleaningEnabled,
+ (globalPathCleaningEnabled: boolean) => globalPathCleaningEnabled,
],
hasAdvancedPaths: [
(s) => [s.hasAvailableFeature],
- (hasAvailableFeature) => hasAvailableFeature(AvailableFeature.PATHS_ADVANCED),
+ (hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean) =>
+ hasAvailableFeature(AvailableFeature.PATHS_ADVANCED),
],
hasPathCleaningFilters: [
(s) => [s.currentTeam],
- (currentTeam) => (currentTeam?.path_cleaning_filters || []).length > 0,
+ (currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType) =>
+ (currentTeam?.path_cleaning_filters || []).length > 0,
],
isPathCleaningAvailable: [
(s) => [s.isNormalizeable, s.hasAdvancedPaths, s.hasPathCleaningFilters],
- (isNormalizeable, hasAdvancedPaths, hasPathCleaningFilters) =>
+ (isNormalizeable: boolean, hasAdvancedPaths: boolean, hasPathCleaningFilters: boolean) =>
isNormalizeable && hasAdvancedPaths && hasPathCleaningFilters,
],
taxonomicBreakdownType: [
(s) => [s.isMultipleBreakdownsEnabled, s.breakdownFilter, s.multipleBreakdown],
- (isMultipleBreakdownsEnabled, breakdownFilter, multipleBreakdown): TaxonomicFilterGroupType | undefined => {
+ (
+ isMultipleBreakdownsEnabled: boolean,
+ breakdownFilter: import('../../../../queries/schema').BreakdownFilter,
+ multipleBreakdown: import('../../../../queries/schema').Breakdown | undefined
+ ): TaxonomicFilterGroupType | undefined => {
let breakdownType = isMultipleBreakdownsEnabled
? filterToTaxonomicFilterType(
multipleBreakdown?.type,
diff --git a/frontend/src/scenes/insights/filters/BreakdownFilter/taxonomicBreakdownFilterLogic.ts b/frontend/src/scenes/insights/filters/BreakdownFilter/taxonomicBreakdownFilterLogic.ts
index 881c7a56aaaa..dbeaac0824a3 100644
--- a/frontend/src/scenes/insights/filters/BreakdownFilter/taxonomicBreakdownFilterLogic.ts
+++ b/frontend/src/scenes/insights/filters/BreakdownFilter/taxonomicBreakdownFilterLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, defaults, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, defaults, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import {
breakdownFilterToTaxonomicFilterType,
@@ -18,7 +18,9 @@ import { propertyDefinitionsModel } from '~/models/propertyDefinitionsModel'
import { Breakdown, BreakdownFilter } from '~/queries/schema/schema-general'
import { BreakdownType, ChartDisplayType, InsightLogicProps } from '~/types'
-import type { taxonomicBreakdownFilterLogicType } from './taxonomicBreakdownFilterLogicType'
+import type { FeatureFlagsSet } from '../../../../lib/logic/featureFlagLogic'
+import type { DatabaseSchemaField } from '../../../../queries/schema/schema-general'
+import type { PropertyDefinition, PropertyDefinitionType } from '../../../../types'
import { isCohortBreakdown, isMultipleBreakdownType, isURLNormalizeable } from './taxonomicBreakdownFilterUtils'
// Kept in sync with the `@maxItems` on `BreakdownFilter.breakdowns` in schema-general.ts.
@@ -34,6 +36,294 @@ export type TaxonomicBreakdownFilterLogicProps = {
updateDisplay: ((display: ChartDisplayType | undefined) => void) | null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface taxonomicBreakdownFilterLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ currentDataWarehouseSchemaColumns: DatabaseSchemaField[] // insightVizDataLogic
+ hasDataWarehouseSeries: boolean // insightVizDataLogic
+ isSingleSeriesDefinition: boolean // insightVizDataLogic
+ getPropertyDefinition: (
+ s: TaxonomicFilterValue,
+ type: PropertyDefinitionType,
+ groupTypeIndex?: number
+ ) => PropertyDefinition | null // propertyDefinitionsModel
+ __ignore: TaxonomicFilterGroupType | null
+ addBreakdownDisabledReason: string | null
+ breakdownArray: Breakdown[] | (number | string)[]
+ breakdownCohortArray: (number | string | Breakdown)[]
+ breakdownFilter: BreakdownFilter
+ breakdownHideOtherAggregation: boolean | null | undefined
+ breakdownLimit: number
+ breakdownOptionsOpened: boolean
+ hasGlobalBreakdownOptions: boolean
+ histogramBinCount: number | undefined
+ histogramBinsUsed: boolean
+ includeSessions: boolean
+ isMultipleBreakdownsEnabled: boolean
+ localBreakdownHideOtherAggregation: boolean | undefined
+ localBreakdownLimit: number | undefined
+ localHistogramBinCount: number | undefined
+ localNormalizeBreakdownURL: boolean | undefined
+ localPathCleaningEnabled: boolean | undefined
+ normalizeBreakdownUrl: boolean
+ pathCleaningEnabled: boolean
+ taxonomicBreakdownType:
+ | TaxonomicFilterGroupType.Metadata
+ | TaxonomicFilterGroupType.Actions
+ | TaxonomicFilterGroupType.CohortsWithAllUsers
+ | TaxonomicFilterGroupType.DataWarehouse
+ | TaxonomicFilterGroupType.DataWarehouseSourceTables
+ | TaxonomicFilterGroupType.DataWarehouseProperties
+ | TaxonomicFilterGroupType.DataWarehousePersonProperties
+ | TaxonomicFilterGroupType.Elements
+ | TaxonomicFilterGroupType.Events
+ | TaxonomicFilterGroupType.InternalEvents
+ | TaxonomicFilterGroupType.InternalEventProperties
+ | TaxonomicFilterGroupType.EventProperties
+ | TaxonomicFilterGroupType.EventFeatureFlags
+ | TaxonomicFilterGroupType.EventMetadata
+ | TaxonomicFilterGroupType.NumericalEventProperties
+ | TaxonomicFilterGroupType.PersonProperties
+ | TaxonomicFilterGroupType.PersonMetadata
+ | TaxonomicFilterGroupType.PageviewUrls
+ | TaxonomicFilterGroupType.PageviewEvents
+ | TaxonomicFilterGroupType.Screens
+ | TaxonomicFilterGroupType.ScreenEvents
+ | TaxonomicFilterGroupType.EmailAddresses
+ | TaxonomicFilterGroupType.AutocaptureEvents
+ | TaxonomicFilterGroupType.CustomEvents
+ | TaxonomicFilterGroupType.Wildcards
+ | TaxonomicFilterGroupType.GroupsPrefix
+ | TaxonomicFilterGroupType.Persons
+ | TaxonomicFilterGroupType.FeatureFlags
+ | TaxonomicFilterGroupType.Insights
+ | TaxonomicFilterGroupType.Experiments
+ | TaxonomicFilterGroupType.Plugins
+ | TaxonomicFilterGroupType.Dashboards
+ | TaxonomicFilterGroupType.GroupNamesPrefix
+ | TaxonomicFilterGroupType.SessionProperties
+ | TaxonomicFilterGroupType.HogQLExpression
+ | TaxonomicFilterGroupType.Notebooks
+ | TaxonomicFilterGroupType.LogEntries
+ | TaxonomicFilterGroupType.ErrorTrackingIssues
+ | TaxonomicFilterGroupType.Logs
+ | TaxonomicFilterGroupType.LogAttributes
+ | TaxonomicFilterGroupType.LogResourceAttributes
+ | TaxonomicFilterGroupType.MetricAttributes
+ | TaxonomicFilterGroupType.Spans
+ | TaxonomicFilterGroupType.SpanAttributes
+ | TaxonomicFilterGroupType.SpanResourceAttributes
+ | TaxonomicFilterGroupType.Replay
+ | TaxonomicFilterGroupType.ReplaySavedFilters
+ | TaxonomicFilterGroupType.RevenueAnalyticsProperties
+ | TaxonomicFilterGroupType.Resources
+ | TaxonomicFilterGroupType.ErrorTrackingProperties
+ | TaxonomicFilterGroupType.ActivityLogProperties
+ | TaxonomicFilterGroupType.MCPProperties
+ | TaxonomicFilterGroupType.MaxAIContext
+ | TaxonomicFilterGroupType.WorkflowVariables
+ | TaxonomicFilterGroupType.SuggestedFilters
+ | TaxonomicFilterGroupType.RecentFilters
+ | TaxonomicFilterGroupType.PinnedFilters
+ | TaxonomicFilterGroupType.Empty
+ | undefined
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface taxonomicBreakdownFilterLogicActions {
+ addBreakdown: (
+ breakdown: TaxonomicFilterValue,
+ taxonomicGroup: TaxonomicFilterGroup
+ ) => {
+ breakdown: TaxonomicFilterValue
+ taxonomicGroup: TaxonomicFilterGroup
+ }
+ removeBreakdown: (
+ breakdown: number | string,
+ breakdownType: string
+ ) => {
+ breakdown: number | string
+ breakdownType: string
+ }
+ replaceBreakdown: (
+ previousBreakdown: {
+ type: string
+ value: number | string
+ },
+ newBreakdown: {
+ group: TaxonomicFilterGroup
+ value: TaxonomicFilterValue
+ }
+ ) => {
+ newBreakdown: {
+ group: TaxonomicFilterGroup
+ value: TaxonomicFilterValue
+ }
+ previousBreakdown: {
+ type: string
+ value: number | string
+ }
+ }
+ setBreakdownHideOtherAggregation: (hidden: boolean) => {
+ hidden: boolean
+ }
+ setBreakdownLimit: (value: number | undefined) => {
+ value: number | undefined
+ }
+ setHistogramBinCount: (
+ breakdown: number | string,
+ breakdownType: string,
+ count: number | undefined
+ ) => {
+ breakdown: number | string
+ breakdownType: string
+ count: number | undefined
+ }
+ setHistogramBinsUsed: (
+ breakdown: number | string,
+ breakdownType: string,
+ binsUsed: boolean,
+ binCount?: number
+ ) => {
+ binCount: number | undefined
+ binsUsed: boolean
+ breakdown: number | string
+ breakdownType: string
+ }
+ setNormalizeBreakdownURL: (
+ breakdown: number | string,
+ breakdownType: string,
+ normalizeBreakdownURL: boolean
+ ) => {
+ breakdown: number | string
+ breakdownType: string
+ normalizeBreakdownURL: boolean
+ }
+ setPathCleaningEnabled: (
+ breakdown: number | string,
+ breakdownType: string,
+ pathCleaningEnabled: boolean
+ ) => {
+ breakdown: number | string
+ breakdownType: string
+ pathCleaningEnabled: boolean
+ }
+ toggleBreakdownOptions: (opened: boolean) => {
+ opened: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface taxonomicBreakdownFilterLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ isMultipleBreakdownsEnabled: (isTrends: boolean) => boolean
+ breakdownFilter: (breakdownFilter: BreakdownFilter) => BreakdownFilter
+ includeSessions: (isTrends: boolean) => boolean
+ addBreakdownDisabledReason: (
+ breakdownFilter: BreakdownFilter,
+ isMultipleBreakdownsEnabled: boolean,
+ hasDataWarehouseSeries: boolean,
+ isFunnels: boolean,
+ isTrends: boolean,
+ isSingleSeriesDefinition: boolean
+ ) => string | null
+ taxonomicBreakdownType: (
+ breakdownFilter: BreakdownFilter
+ ) =>
+ | TaxonomicFilterGroupType.Metadata
+ | TaxonomicFilterGroupType.Actions
+ | TaxonomicFilterGroupType.CohortsWithAllUsers
+ | TaxonomicFilterGroupType.DataWarehouse
+ | TaxonomicFilterGroupType.DataWarehouseSourceTables
+ | TaxonomicFilterGroupType.DataWarehouseProperties
+ | TaxonomicFilterGroupType.DataWarehousePersonProperties
+ | TaxonomicFilterGroupType.Elements
+ | TaxonomicFilterGroupType.Events
+ | TaxonomicFilterGroupType.InternalEvents
+ | TaxonomicFilterGroupType.InternalEventProperties
+ | TaxonomicFilterGroupType.EventProperties
+ | TaxonomicFilterGroupType.EventFeatureFlags
+ | TaxonomicFilterGroupType.EventMetadata
+ | TaxonomicFilterGroupType.NumericalEventProperties
+ | TaxonomicFilterGroupType.PersonProperties
+ | TaxonomicFilterGroupType.PersonMetadata
+ | TaxonomicFilterGroupType.PageviewUrls
+ | TaxonomicFilterGroupType.PageviewEvents
+ | TaxonomicFilterGroupType.Screens
+ | TaxonomicFilterGroupType.ScreenEvents
+ | TaxonomicFilterGroupType.EmailAddresses
+ | TaxonomicFilterGroupType.AutocaptureEvents
+ | TaxonomicFilterGroupType.CustomEvents
+ | TaxonomicFilterGroupType.Wildcards
+ | TaxonomicFilterGroupType.GroupsPrefix
+ | TaxonomicFilterGroupType.Persons
+ | TaxonomicFilterGroupType.FeatureFlags
+ | TaxonomicFilterGroupType.Insights
+ | TaxonomicFilterGroupType.Experiments
+ | TaxonomicFilterGroupType.Plugins
+ | TaxonomicFilterGroupType.Dashboards
+ | TaxonomicFilterGroupType.GroupNamesPrefix
+ | TaxonomicFilterGroupType.SessionProperties
+ | TaxonomicFilterGroupType.HogQLExpression
+ | TaxonomicFilterGroupType.Notebooks
+ | TaxonomicFilterGroupType.LogEntries
+ | TaxonomicFilterGroupType.ErrorTrackingIssues
+ | TaxonomicFilterGroupType.Logs
+ | TaxonomicFilterGroupType.LogAttributes
+ | TaxonomicFilterGroupType.LogResourceAttributes
+ | TaxonomicFilterGroupType.MetricAttributes
+ | TaxonomicFilterGroupType.Spans
+ | TaxonomicFilterGroupType.SpanAttributes
+ | TaxonomicFilterGroupType.SpanResourceAttributes
+ | TaxonomicFilterGroupType.Replay
+ | TaxonomicFilterGroupType.ReplaySavedFilters
+ | TaxonomicFilterGroupType.RevenueAnalyticsProperties
+ | TaxonomicFilterGroupType.Resources
+ | TaxonomicFilterGroupType.ErrorTrackingProperties
+ | TaxonomicFilterGroupType.ActivityLogProperties
+ | TaxonomicFilterGroupType.MCPProperties
+ | TaxonomicFilterGroupType.MaxAIContext
+ | TaxonomicFilterGroupType.WorkflowVariables
+ | TaxonomicFilterGroupType.SuggestedFilters
+ | TaxonomicFilterGroupType.RecentFilters
+ | TaxonomicFilterGroupType.PinnedFilters
+ | TaxonomicFilterGroupType.Empty
+ | undefined
+ breakdownArray: (
+ breakdownFilter: BreakdownFilter,
+ isMultipleBreakdownsEnabled: boolean
+ ) => Breakdown[] | (number | string)[]
+ breakdownCohortArray: (breakdownArray: Breakdown[] | (number | string)[]) => (number | string | Breakdown)[]
+ histogramBinsUsed: (breakdownFilter: BreakdownFilter) => boolean
+ histogramBinCount: (
+ breakdownFilter: BreakdownFilter,
+ localHistogramBinCount: number | undefined
+ ) => number | undefined
+ breakdownLimit: (breakdownFilter: BreakdownFilter, localBreakdownLimit: number | undefined) => number
+ hasGlobalBreakdownOptions: (breakdownFilter: BreakdownFilter) => boolean
+ normalizeBreakdownUrl: (
+ breakdownFilter: BreakdownFilter,
+ localNormalizeBreakdownURL: boolean | undefined
+ ) => boolean
+ pathCleaningEnabled: (
+ breakdownFilter: BreakdownFilter,
+ localPathCleaningEnabled: boolean | undefined
+ ) => boolean
+ breakdownHideOtherAggregation: (
+ breakdownFilter: BreakdownFilter,
+ localBreakdownHideOtherAggregation: boolean | undefined
+ ) => boolean | null | undefined
+ }
+}
+
+export type taxonomicBreakdownFilterLogicType = MakeLogicType<
+ taxonomicBreakdownFilterLogicValues,
+ taxonomicBreakdownFilterLogicActions,
+ TaxonomicBreakdownFilterLogicProps,
+ taxonomicBreakdownFilterLogicMeta
+>
+
export const taxonomicBreakdownFilterLogic = kea<taxonomicBreakdownFilterLogicType>([
props({} as TaxonomicBreakdownFilterLogicProps),
key((props) => keyForInsightLogicProps('new')(props.insightProps)),
@@ -148,9 +438,9 @@ export const taxonomicBreakdownFilterLogic = kea<taxonomicBreakdownFilterLogicTy
],
}),
selectors({
- isMultipleBreakdownsEnabled: [(_, p) => [p.isTrends], (isTrends) => isTrends],
- breakdownFilter: [(_, p) => [p.breakdownFilter], (breakdownFilter) => breakdownFilter],
- includeSessions: [(_, p) => [p.isTrends], (isTrends) => isTrends],
+ isMultipleBreakdownsEnabled: [(_, p) => [p.isTrends], (isTrends: boolean) => isTrends],
+ breakdownFilter: [(_, p) => [p.breakdownFilter], (breakdownFilter: BreakdownFilter) => breakdownFilter],
+ includeSessions: [(_, p) => [p.isTrends], (isTrends: boolean) => isTrends],
addBreakdownDisabledReason: [
(s, p) => [
s.breakdownFilter,
@@ -162,11 +452,11 @@ export const taxonomicBreakdownFilterLogic = kea<taxonomicBreakdownFilterLogicTy
],
(
{ breakdown, breakdowns, breakdown_type },
- isMultipleBreakdownsEnabled,
- hasDataWarehouseSeries,
- isFunnels,
- isTrends,
- isSingleSeriesDefinition
+ isMultipleBreakdownsEnabled: boolean,
+ hasDataWarehouseSeries: boolean,
+ isFunnels: boolean,
+ isTrends: boolean,
+ isSingleSeriesDefinition: boolean
): string | null => {
if (isMultipleBreakdownsEnabled && (!breakdown_type || isMultipleBreakdownType(breakdown_type))) {
if (!!breakdowns && breakdowns.length >= MAX_TRENDS_BREAKDOWNS) {
@@ -195,7 +485,7 @@ export const taxonomicBreakdownFilterLogic = kea<taxonomicBreakdownFilterLogicTy
],
taxonomicBreakdownType: [
(s) => [s.breakdownFilter],
- (breakdownFilter) => {
+ (breakdownFilter: BreakdownFilter) => {
let breakdownType = breakdownFilterToTaxonomicFilterType(breakdownFilter)
if (breakdownType === TaxonomicFilterGroupType.Cohorts) {
breakdownType = TaxonomicFilterGroupType.CohortsWithAllUsers
@@ -205,7 +495,7 @@ export const taxonomicBreakdownFilterLogic = kea<taxonomicBreakdownFilterLogicTy
],
breakdownArray: [
(s) => [s.breakdownFilter, s.isMultipleBreakdownsEnabled],
- ({ breakdown, breakdowns }, isMultipleBreakdownsEnabled): (string | number)[] | Breakdown[] => {
+ ({ breakdown, breakdowns }, isMultipleBreakdownsEnabled: boolean): (string | number)[] | Breakdown[] => {
if (isMultipleBreakdownsEnabled && breakdowns) {
return breakdowns
}
@@ -215,7 +505,8 @@ export const taxonomicBreakdownFilterLogic = kea<taxonomicBreakdownFilterLogicTy
],
breakdownCohortArray: [
(s) => [s.breakdownArray],
- (breakdownArray) => breakdownArray.map((b) => (isNaN(Number(b)) ? b : Number(b))),
+ (breakdownArray: Breakdown[] | (number | string)[]) =>
+ breakdownArray.map((b) => (isNaN(Number(b)) ? b : Number(b))),
],
histogramBinsUsed: [
(s) => [s.breakdownFilter],
@@ -223,32 +514,33 @@ export const taxonomicBreakdownFilterLogic = kea<taxonomicBreakdownFilterLogicTy
],
histogramBinCount: [
(s) => [s.breakdownFilter, s.localHistogramBinCount],
- (breakdownFilter, localHistogramBinCount) =>
+ (breakdownFilter: BreakdownFilter, localHistogramBinCount: number | undefined) =>
localHistogramBinCount || breakdownFilter?.breakdown_histogram_bin_count,
],
breakdownLimit: [
(s) => [s.breakdownFilter, s.localBreakdownLimit],
- (breakdownFilter, localBreakdownLimit) => localBreakdownLimit || breakdownFilter?.breakdown_limit || 25,
+ (breakdownFilter: BreakdownFilter, localBreakdownLimit: number | undefined) =>
+ localBreakdownLimit || breakdownFilter?.breakdown_limit || 25,
],
// Cohort breakdowns are over a user-picked set, so there's nothing to truncate
// and no long-tail to bucket as "Other". The global options panel is empty in that case.
hasGlobalBreakdownOptions: [
(s) => [s.breakdownFilter],
- (breakdownFilter) => breakdownFilter?.breakdown_type !== 'cohort',
+ (breakdownFilter: BreakdownFilter) => breakdownFilter?.breakdown_type !== 'cohort',
],
normalizeBreakdownUrl: [
(s) => [s.breakdownFilter, s.localNormalizeBreakdownURL],
- (breakdownFilter, localNormalizeBreakdownURL) =>
+ (breakdownFilter: BreakdownFilter, localNormalizeBreakdownURL: boolean | undefined) =>
localNormalizeBreakdownURL ?? breakdownFilter.breakdown_normalize_url ?? true,
],
pathCleaningEnabled: [
(s) => [s.breakdownFilter, s.localPathCleaningEnabled],
- (breakdownFilter, localPathCleaningEnabled) =>
+ (breakdownFilter: BreakdownFilter, localPathCleaningEnabled: boolean | undefined) =>
localPathCleaningEnabled ?? breakdownFilter.breakdown_path_cleaning ?? false,
],
breakdownHideOtherAggregation: [
(s) => [s.breakdownFilter, s.localBreakdownHideOtherAggregation],
- (breakdownFilter, localBreakdownHideOtherAggregation) =>
+ (breakdownFilter: BreakdownFilter, localBreakdownHideOtherAggregation: boolean | undefined) =>
localBreakdownHideOtherAggregation ?? breakdownFilter.breakdown_hide_other_aggregation,
],
}),
diff --git a/frontend/src/scenes/insights/insightDataLogic.tsx b/frontend/src/scenes/insights/insightDataLogic.tsx
index 532e047b8e3a..e3b76e0a9d2f 100644
--- a/frontend/src/scenes/insights/insightDataLogic.tsx
+++ b/frontend/src/scenes/insights/insightDataLogic.tsx
@@ -1,4 +1,5 @@
import {
+ MakeLogicType,
actions,
afterMount,
connect,
@@ -48,8 +49,40 @@ import { ExportContext, InsightLogicProps, InsightType } from '~/types'
import { DATAWAREHOUSE_EDITOR_ITEM_ID } from 'products/data_warehouse/frontend/utils'
+import type { AlertType } from '../../../../products/alerts/frontend/types'
+import type { InsightFilterOverrideContextApi } from '../../../../products/product_analytics/frontend/generated/api.schemas'
+import type {
+ AnyResponseType,
+ DashboardFilter,
+ DataNode,
+ ErrorTrackingQueryResponse,
+ EventsQueryResponse,
+ HogQLAutocompleteResponse,
+ HogQLMetadataResponse,
+ HogQLQueryResponse,
+ HogQueryResponse,
+ LogAttributesQueryResponse,
+ LogValuesQueryResponse,
+ LogsQueryResponse,
+ MetricsQueryResponse,
+ QuerySchema,
+ QueryStatus,
+ RefreshType,
+ SessionsQueryResponse,
+ TraceSpansAggregationQueryResponse,
+ TraceSpansAttributeBreakdownQueryResponse,
+ TraceSpansQueryResponse,
+ TraceSpansTreeQueryResponse,
+} from '../../queries/schema/schema-general'
+import type {
+ AccessControlLevel,
+ DashboardTileBasicType,
+ InsightShortId,
+ QueryBasedInsightModel,
+ SetInsightOptions,
+ UserBasicType,
+} from '../../types'
import { teamLogic } from '../teamLogic'
-import type { insightDataLogicType } from './insightDataLogicType'
import { insightDataTimingLogic } from './insightDataTimingLogic'
import { insightLogic } from './insightLogic'
import { insightSceneLogic } from './insightSceneLogic'
@@ -61,6 +94,341 @@ export const isInsightSceneInstance = (props: InsightLogicProps): boolean =>
sceneLogic.values.activeSceneId === Scene.Insight &&
insightSceneLogic.findMounted()?.values.insightLogicRef?.logic.key === keyForInsightLogicProps('new')(props)
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightDataLogicValues {
+ getInsightRefreshButtonDisabledReason: () => string // dataNodeLogic
+ insightDataError: Record<string, any> | null // dataNodeLogic
+ insightDataLoading: boolean // dataNodeLogic
+ insightDataRaw:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null // dataNodeLogic
+ insightLoadingTimeSeconds: number // dataNodeLogic
+ insightPollResponse: Record<string, QueryStatus | null> | null // dataNodeLogic
+ insightQuery: DataNode<Record<string, any>> // dataNodeLogic
+ queryId: string | null // dataNodeLogic
+ filterTestAccountsDefault: boolean // filterTestAccountsDefaultsLogic
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>> // insightLogic
+ savedInsight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>> // insightLogic
+ currentTeamId: number | null // teamLogic
+ canEditInSqlEditor: boolean
+ exportContext: ExportContext | undefined
+ generatedInsightMetadata: {
+ description: string
+ name: string
+ } | null
+ generatedInsightMetadataLoading: boolean
+ hogQL: string | null
+ hogQLVariables: Record<string, HogQLVariable> | undefined
+ insightData: Record<string, any>
+ internalQuery: Node | null
+ isDataWarehouseQuery: boolean
+ propsQuery: QuerySchema | null | undefined
+ query: Node | null
+ queryChanged: boolean
+ showDebugPanel: boolean
+ showQueryEditor: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightDataLogicActions {
+ loadData: (
+ refresh?: RefreshType,
+ alreadyRunningQueryId?: string,
+ overrideQuery?: DataNode<Record<string, any>>
+ ) => {
+ overrideQuery: DataNode<Record<string, any>> | undefined
+ pollOnly: boolean
+ queryId: string
+ refresh: RefreshType | undefined
+ } // dataNodeLogic
+ loadDataFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ } // dataNodeLogic
+ loadDataSuccess: (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ | undefined,
+ payload?: {
+ overrideQuery: DataNode<Record<string, any>> | undefined
+ pollOnly: boolean
+ queryId: string
+ refresh: RefreshType | undefined
+ }
+ ) => {
+ payload?: {
+ overrideQuery: DataNode<Record<string, any>> | undefined
+ pollOnly: boolean
+ queryId: string
+ refresh: RefreshType | undefined
+ }
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ | undefined
+ } // dataNodeLogic
+ setInsightData: (
+ response: Exclude<AnyResponseType, undefined>
+ ) =>
+ | ErrorTrackingQueryResponse
+ | EventsQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogsQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | TraceSpansTreeQueryResponse // dataNodeLogic
+ loadInsightSuccess: (
+ insight: {
+ _create_in_folder?: string | null | undefined
+ alerts?: AlertType[] | undefined
+ cache_target_age?: string | null | undefined
+ created_at: string
+ created_by: UserBasicType | null
+ dashboard_tiles: DashboardTileBasicType[] | null
+ dashboards: number[] | null
+ deleted: boolean
+ derived_name?: string | null | undefined
+ description?: string | undefined
+ disable_baseline?: boolean | undefined
+ favorited?: boolean | undefined
+ filter_override_context?: InsightFilterOverrideContextApi | null | undefined
+ id: number
+ is_cached?: boolean | undefined
+ is_sample: boolean
+ last_modified_at: string
+ last_modified_by: UserBasicType | null
+ last_refresh: string | null
+ last_viewed_at?: string | null | undefined
+ name: string
+ next?: string | undefined
+ next_allowed_client_refresh?: string | null | undefined
+ order: number | null
+ query: Node<Record<string, any>> | null
+ query_status?: QueryStatus | undefined
+ result: any
+ saved: boolean
+ short_id: InsightShortId
+ tags?: string[] | undefined
+ timezone?: string | null | undefined
+ updated_at: string
+ user_access_level: AccessControlLevel
+ view_count?: number | undefined
+ viewers?: UserBasicType[] | undefined
+ },
+ payload?:
+ | {
+ filtersOverride: DashboardFilter | null | undefined
+ shortId: InsightShortId
+ tileFiltersOverride: DashboardFilter | null | undefined
+ variablesOverride: Record<string, HogQLVariable> | null | undefined
+ }
+ | undefined
+ ) => {
+ insight: {
+ _create_in_folder?: string | null | undefined
+ alerts?: AlertType[] | undefined
+ cache_target_age?: string | null | undefined
+ created_at: string
+ created_by: UserBasicType | null
+ dashboard_tiles: DashboardTileBasicType[] | null
+ dashboards: number[] | null
+ deleted: boolean
+ derived_name?: string | null | undefined
+ description?: string | undefined
+ disable_baseline?: boolean | undefined
+ favorited?: boolean | undefined
+ filter_override_context?: InsightFilterOverrideContextApi | null | undefined
+ id: number
+ is_cached?: boolean | undefined
+ is_sample: boolean
+ last_modified_at: string
+ last_modified_by: UserBasicType | null
+ last_refresh: string | null
+ last_viewed_at?: string | null | undefined
+ name: string
+ next?: string | undefined
+ next_allowed_client_refresh?: string | null | undefined
+ order: number | null
+ query: Node<Record<string, any>> | null
+ query_status?: QueryStatus | undefined
+ result: any
+ saved: boolean
+ short_id: InsightShortId
+ tags?: string[] | undefined
+ timezone?: string | null | undefined
+ updated_at: string
+ user_access_level: AccessControlLevel
+ view_count?: number | undefined
+ viewers?: UserBasicType[] | undefined
+ }
+ payload?: {
+ filtersOverride: DashboardFilter | null | undefined
+ shortId: InsightShortId
+ tileFiltersOverride: DashboardFilter | null | undefined
+ variablesOverride: Record<string, HogQLVariable> | null | undefined
+ }
+ } // insightLogic
+ setInsight: (
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>,
+ options: SetInsightOptions
+ ) => {
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>
+ options: SetInsightOptions
+ } // insightLogic
+ setInsightMetadata: (
+ metadataUpdate: Partial<
+ Pick<QueryBasedInsightModel<Node<Record<string, any>>>, 'description' | 'favorited' | 'name' | 'tags'>
+ >
+ ) => {
+ metadataUpdate: Partial<
+ Pick<QueryBasedInsightModel<Node<Record<string, any>>>, 'description' | 'favorited' | 'name' | 'tags'>
+ >
+ } // insightLogic
+ renameInsightSuccess: (item: QueryBasedInsightModel) => {
+ item: QueryBasedInsightModel<Node<Record<string, any>>>
+ } // insightsModel
+ cancelChanges: () => {
+ value: true
+ }
+ generateInsightMetadata: () => any
+ generateInsightMetadataFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ generateInsightMetadataSuccess: (
+ generatedInsightMetadata: {
+ description: string
+ name: string
+ } | null,
+ payload?: any
+ ) => {
+ generatedInsightMetadata: {
+ description: string
+ name: string
+ } | null
+ payload?: any
+ }
+ persistDisplayOptions: (query: Node) => {
+ query: Node<Record<string, any>>
+ }
+ setQuery: (query: Node | null) => {
+ query: Node<Record<string, any>> | null
+ }
+ syncQueryFromProps: (query: Node | null) => {
+ query: Node<Record<string, any>> | null
+ }
+ toggleDebugPanel: () => {
+ value: true
+ }
+ toggleQueryEditorPanel: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightDataLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ query: (
+ propsQuery: QuerySchema | null | undefined,
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>,
+ internalQuery: Node<Record<string, any>> | null,
+ filterTestAccountsDefault: boolean,
+ isDataWarehouseQuery: boolean
+ ) => Node | null
+ isDataWarehouseQuery: (arg: any) => boolean
+ propsQuery: (arg: any) => QuerySchema | null | undefined
+ exportContext: (
+ query: Node<Record<string, any>> | null,
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>
+ ) => ExportContext | undefined
+ queryChanged: (
+ query: Node<Record<string, any>> | null,
+ savedInsight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>,
+ filterTestAccountsDefault: boolean
+ ) => boolean
+ insightData: (
+ insightDataRaw:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ ) => Record<string, any>
+ hogQL: (insightData: Record<string, any>, query: Node<Record<string, any>> | null) => string | null
+ hogQLVariables: (query: Node<Record<string, any>> | null) => Record<string, HogQLVariable> | undefined
+ canEditInSqlEditor: (hogQL: string | null, query: Node<Record<string, any>> | null) => boolean
+ }
+}
+
+export type insightDataLogicType = MakeLogicType<
+ insightDataLogicValues,
+ insightDataLogicActions,
+ InsightLogicProps,
+ insightDataLogicMeta
+>
+
export const insightDataLogic = kea<insightDataLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps('new')),
@@ -167,7 +535,13 @@ export const insightDataLogic = kea<insightDataLogicType>([
selectors({
query: [
(s) => [s.propsQuery, s.insight, s.internalQuery, s.filterTestAccountsDefault, s.isDataWarehouseQuery],
- (propsQuery, insight, internalQuery, filterTestAccountsDefault, isDataWarehouseQuery): Node | null =>
+ (
+ propsQuery: null | import('~/queries/schema/schema-general').QuerySchema | undefined,
+ insight: Partial<import('~/types').QueryBasedInsightModel<Node<Record<string, any>>>>,
+ internalQuery: Node | null,
+ filterTestAccountsDefault: boolean,
+ isDataWarehouseQuery: boolean
+ ): Node | null =>
internalQuery ||
propsQuery ||
insight.query ||
@@ -189,7 +563,10 @@ export const insightDataLogic = kea<insightDataLogicType>([
exportContext: [
(s) => [s.query, s.insight],
- (query, insight) => {
+ (
+ query: Node | null,
+ insight: Partial<import('~/types').QueryBasedInsightModel<Node<Record<string, any>>>>
+ ) => {
if (!query) {
// if we're here without a query then an empty query context is not the problem
return undefined
@@ -210,7 +587,11 @@ export const insightDataLogic = kea<insightDataLogicType>([
queryChanged: [
(s) => [s.query, s.savedInsight, s.filterTestAccountsDefault],
- (query, savedInsight, filterTestAccountsDefault) => {
+ (
+ query: Node | null,
+ savedInsight: Partial<import('~/types').QueryBasedInsightModel<Node<Record<string, any>>>>,
+ filterTestAccountsDefault: boolean
+ ) => {
let savedOrDefaultQuery
if (savedInsight.query) {
savedOrDefaultQuery = savedInsight.query as InsightVizNode | DataVisualizationNode
@@ -243,7 +624,23 @@ export const insightDataLogic = kea<insightDataLogicType>([
insightData: [
(s) => [s.insightDataRaw],
- (insightDataRaw): Record<string, any> => {
+ (
+ insightDataRaw:
+ | Record<string, any>
+ | null
+ | import('~/queries/schema/schema-general').ErrorTrackingQueryResponse
+ | import('~/queries/schema/schema-general').HogQLAutocompleteResponse
+ | import('~/queries/schema/schema-general').HogQLMetadataResponse
+ | import('~/queries/schema/schema-general').HogQLQueryResponse<any[]>
+ | import('~/queries/schema/schema-general').HogQueryResponse
+ | import('~/queries/schema/schema-general').LogAttributesQueryResponse
+ | import('~/queries/schema/schema-general').LogValuesQueryResponse
+ | import('~/queries/schema/schema-general').MetricsQueryResponse
+ | import('~/queries/schema/schema-general').SessionsQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansAggregationQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansAttributeBreakdownQueryResponse
+ | import('~/queries/schema/schema-general').TraceSpansQueryResponse
+ ): Record<string, any> => {
// :TRICKY: The queries return results as `results`, but insights expect `result`
return {
...insightDataRaw,
@@ -254,7 +651,7 @@ export const insightDataLogic = kea<insightDataLogicType>([
hogQL: [
(s) => [s.insightData, s.query],
- (insightData, query): string | null => {
+ (insightData: Record<string, any>, query: Node | null): string | null => {
// Try to get it from the query itself, so we don't have to wait for the response
if (isDataVisualizationNode(query) && isHogQLQuery(query.source)) {
return query.source.query
@@ -271,7 +668,7 @@ export const insightDataLogic = kea<insightDataLogicType>([
],
hogQLVariables: [
(s) => [s.query],
- (query): Record<string, HogQLVariable> | undefined => {
+ (query: Node | null): Record<string, HogQLVariable> | undefined => {
if (isDataVisualizationNode(query) && isHogQLQuery(query.source)) {
return query.source.variables
}
@@ -283,7 +680,7 @@ export const insightDataLogic = kea<insightDataLogicType>([
],
canEditInSqlEditor: [
(s) => [s.hogQL, s.query],
- (hogQL, query): boolean =>
+ (hogQL: string | null, query: Node | null): boolean =>
// We need a resolved hogql string, and the insight must not already be SQL-authored
// (otherwise "Edit in SQL editor" is a no-op).
hogQL != null &&
diff --git a/frontend/src/scenes/insights/insightDataTimingLogic.ts b/frontend/src/scenes/insights/insightDataTimingLogic.ts
index 5ca29c283666..a731c94fca74 100644
--- a/frontend/src/scenes/insights/insightDataTimingLogic.ts
+++ b/frontend/src/scenes/insights/insightDataTimingLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { teamLogic } from 'scenes/teamLogic'
@@ -7,9 +7,135 @@ import { DataNodeLogicProps, dataNodeLogic } from '~/queries/nodes/DataNode/data
import { insightVizDataNodeKey } from '~/queries/nodes/InsightViz/insightVizKeys'
import { InsightLogicProps } from '~/types'
-import type { insightDataTimingLogicType } from './insightDataTimingLogicType'
+import type {
+ DataNode,
+ ErrorTrackingQueryResponse,
+ HogQLAutocompleteResponse,
+ HogQLMetadataResponse,
+ HogQLQueryResponse,
+ HogQueryResponse,
+ LogAttributesQueryResponse,
+ LogValuesQueryResponse,
+ MetricsQueryResponse,
+ RefreshType,
+ SessionsQueryResponse,
+ TraceSpansAggregationQueryResponse,
+ TraceSpansAttributeBreakdownQueryResponse,
+ TraceSpansQueryResponse,
+} from '../../queries/schema/schema-general'
import { keyForInsightLogicProps } from './sharedUtils'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightDataTimingLogicValues {
+ query: DataNode<Record<string, any>> // dataNodeLogic
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null // dataNodeLogic
+ currentTeamId: number | null // teamLogic
+ queryStartTimes: Record<string, number>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightDataTimingLogicActions {
+ loadData: (
+ refresh?: RefreshType,
+ alreadyRunningQueryId?: string,
+ overrideQuery?: DataNode<Record<string, any>>
+ ) => {
+ overrideQuery: DataNode<Record<string, any>> | undefined
+ pollOnly: boolean
+ queryId: string
+ refresh: RefreshType | undefined
+ } // dataNodeLogic
+ loadDataCancellation: (payload: { queryId: string }) => {
+ queryId: string
+ } // dataNodeLogic
+ loadDataFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ } // dataNodeLogic
+ loadDataSuccess: (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ | undefined,
+ payload?: {
+ overrideQuery: DataNode<Record<string, any>> | undefined
+ pollOnly: boolean
+ queryId: string
+ refresh: RefreshType | undefined
+ }
+ ) => {
+ payload?: {
+ overrideQuery: DataNode<Record<string, any>> | undefined
+ pollOnly: boolean
+ queryId: string
+ refresh: RefreshType | undefined
+ }
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ | undefined
+ } // dataNodeLogic
+ removeQuery: (queryId: string) => {
+ queryId: string
+ }
+ startQuery: (queryId: string) => {
+ queryId: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightDataTimingLogicMeta {
+ key: string
+}
+
+export type insightDataTimingLogicType = MakeLogicType<
+ insightDataTimingLogicValues,
+ insightDataTimingLogicActions,
+ InsightLogicProps,
+ insightDataTimingLogicMeta
+>
+
export const insightDataTimingLogic = kea<insightDataTimingLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps('new')),
diff --git a/frontend/src/scenes/insights/insightLogic.tsx b/frontend/src/scenes/insights/insightLogic.tsx
index 893cd7f442f5..019a0f0647fb 100644
--- a/frontend/src/scenes/insights/insightLogic.tsx
+++ b/frontend/src/scenes/insights/insightLogic.tsx
@@ -1,4 +1,17 @@
-import { LogicWrapper, actions, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ LogicWrapper,
+ actions,
+ connect,
+ events,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ reducers,
+ selectors,
+} from 'kea'
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
import posthog from 'posthog-js'
@@ -62,9 +75,16 @@ import {
import { insightAlertsLogic } from 'products/alerts/frontend/logic/insightAlertsLogic'
+import type { AlertType } from '../../../../products/alerts/frontend/types'
+import type { InsightFilterOverrideContextApi } from '../../../../products/product_analytics/frontend/generated/api.schemas'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
+import type { ProductIntentProperties } from '../../lib/utils/product-intents'
+import type { Noun } from '../../models/groupsModel'
+import type { QueryStatus } 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 type { insightLogicType } from './insightLogicType'
import { getInsightId } from './utils'
import { insightsApi } from './utils/api'
@@ -81,6 +101,430 @@ export const createEmptyInsight = (
result: null,
})
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightLogicValues {
+ cohortsById: Partial<Record<number | string, CohortType>> // cohortsModel
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun // groupsModel
+ mathDefinitions: Partial<Record<string, MathDefinition>> // mathsLogic
+ activeSceneId: string | null // sceneLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ currentTeamId: number | null // teamLogic
+ user: UserType | null // userLogic
+ accessDeniedToInsight: boolean
+ canEditInsight: boolean
+ derivedName: string
+ editingDisabledReason: 'Discard overrides to edit the insight.' | null
+ hasDashboardItemId: boolean
+ hasOverrides: boolean
+ highlightedSeries: IndexedTrendResult | null
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>
+ insightChanged: boolean
+ insightFeedback: 'disliked' | 'liked' | null
+ insightId: number | null
+ insightLoading: boolean
+ insightName: string
+ insightProps: InsightLogicProps
+ insightSaving: boolean
+ isInDashboardContext: boolean
+ isInExperimentContext: boolean
+ isInViewMode: boolean
+ isSavingTags: boolean
+ isUsingPathsV1: boolean
+ isUsingPathsV2: boolean | string | undefined
+ previousQuery: Node | null
+ query: Node | null
+ savedInsight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>
+ showPersonsModal: boolean
+ suggestedQuery: Node | null
+ supportsCreatingExperiment: boolean | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightLogicActions {
+ loadTags: () => any // tagsModel
+ addProductIntent: (properties: ProductIntentProperties) => ProductIntentProperties // teamLogic
+ confirmDeleteInsight: (dashboardId: number | null) => {
+ dashboardId: number | null
+ }
+ deleteInsight: (dashboardId: number | null) => {
+ dashboardId: number | null
+ }
+ duplicateInsight: (
+ insight: QueryBasedInsightModel,
+ redirectToInsight?: any
+ ) => {
+ insight: QueryBasedInsightModel<Node<Record<string, any>>>
+ redirectToInsight: any
+ }
+ handleInsightSuggested: (suggestedInsight: Node | null) => {
+ suggestedInsight: Node<Record<string, any>> | null
+ }
+ highlightSeries: (series: IndexedTrendResult | null) => {
+ series: IndexedTrendResult | null
+ }
+ loadInsight: (
+ shortId: InsightShortId,
+ filtersOverride?: DashboardFilter | null,
+ variablesOverride?: Record<string, HogQLVariable> | null,
+ tileFiltersOverride?: DashboardFilter | null
+ ) => {
+ filtersOverride: DashboardFilter | null | undefined
+ shortId: InsightShortId
+ tileFiltersOverride: DashboardFilter | null | undefined
+ variablesOverride: Record<string, HogQLVariable> | null | undefined
+ }
+ loadInsightFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadInsightSuccess: (
+ insight: {
+ _create_in_folder?: string | null | undefined
+ alerts?: AlertType[] | undefined
+ cache_target_age?: string | null | undefined
+ created_at: string
+ created_by: UserBasicType | null
+ dashboard_tiles: DashboardTileBasicType[] | null
+ dashboards: number[] | null
+ deleted: boolean
+ derived_name?: string | null | undefined
+ description?: string | undefined
+ disable_baseline?: boolean | undefined
+ favorited?: boolean | undefined
+ filter_override_context?: InsightFilterOverrideContextApi | null | undefined
+ id: number
+ is_cached?: boolean | undefined
+ is_sample: boolean
+ last_modified_at: string
+ last_modified_by: UserBasicType | null
+ last_refresh: string | null
+ last_viewed_at?: string | null | undefined
+ name: string
+ next?: string | undefined
+ next_allowed_client_refresh?: string | null | undefined
+ order: number | null
+ query: Node<Record<string, any>> | null
+ query_status?: QueryStatus | undefined
+ result: any
+ saved: boolean
+ short_id: InsightShortId
+ tags?: string[] | undefined
+ timezone?: string | null | undefined
+ updated_at: string
+ user_access_level: AccessControlLevel
+ view_count?: number | undefined
+ viewers?: UserBasicType[] | undefined
+ },
+ payload?: {
+ filtersOverride: DashboardFilter | null | undefined
+ shortId: InsightShortId
+ tileFiltersOverride: DashboardFilter | null | undefined
+ variablesOverride: Record<string, HogQLVariable> | null | undefined
+ }
+ ) => {
+ insight: {
+ _create_in_folder?: string | null | undefined
+ alerts?: AlertType[] | undefined
+ cache_target_age?: string | null | undefined
+ created_at: string
+ created_by: UserBasicType | null
+ dashboard_tiles: DashboardTileBasicType[] | null
+ dashboards: number[] | null
+ deleted: boolean
+ derived_name?: string | null | undefined
+ description?: string | undefined
+ disable_baseline?: boolean | undefined
+ favorited?: boolean | undefined
+ filter_override_context?: InsightFilterOverrideContextApi | null | undefined
+ id: number
+ is_cached?: boolean | undefined
+ is_sample: boolean
+ last_modified_at: string
+ last_modified_by: UserBasicType | null
+ last_refresh: string | null
+ last_viewed_at?: string | null | undefined
+ name: string
+ next?: string | undefined
+ next_allowed_client_refresh?: string | null | undefined
+ order: number | null
+ query: Node<Record<string, any>> | null
+ query_status?: QueryStatus | undefined
+ result: any
+ saved: boolean
+ short_id: InsightShortId
+ tags?: string[] | undefined
+ timezone?: string | null | undefined
+ updated_at: string
+ user_access_level: AccessControlLevel
+ view_count?: number | undefined
+ viewers?: UserBasicType[] | undefined
+ }
+ payload?: {
+ filtersOverride: DashboardFilter | null | undefined
+ shortId: InsightShortId
+ tileFiltersOverride: DashboardFilter | null | undefined
+ variablesOverride: Record<string, HogQLVariable> | null | undefined
+ }
+ }
+ onReapplySuggestedInsight: () => {
+ value: true
+ }
+ onRejectSuggestedInsight: () => {
+ value: true
+ }
+ reloadSavedInsights: () => {
+ value: true
+ }
+ saveAs: (
+ redirectToViewMode?: boolean,
+ persist?: boolean,
+ folder?: string | null
+ ) => {
+ folder: string | null | undefined
+ persist: boolean | undefined
+ redirectToViewMode: boolean | undefined
+ }
+ saveAsConfirmation: (
+ name: string,
+ redirectToViewMode?: any,
+ persist?: any,
+ folder?: string | null
+ ) => {
+ folder: string | null | undefined
+ name: string
+ persist: any
+ redirectToViewMode: any
+ }
+ saveInsight: (
+ redirectToViewMode?: boolean,
+ folder?: string | null
+ ) => {
+ folder: string | null
+ redirectToViewMode: boolean
+ }
+ saveInsightFailure: () => {
+ value: true
+ }
+ saveInsightSuccess: () => {
+ value: true
+ }
+ setAccessDeniedToInsight: () => {
+ value: true
+ }
+ setInsight: (
+ insight: Partial<QueryBasedInsightModel>,
+ options: SetInsightOptions
+ ) => {
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>
+ options: SetInsightOptions
+ }
+ setInsightFeedback: (feedback: 'disliked' | 'liked') => {
+ feedback: 'disliked' | 'liked'
+ }
+ setInsightMetadata: (
+ metadataUpdate: Partial<Pick<QueryBasedInsightModel, 'description' | 'favorited' | 'name' | 'tags'>>
+ ) => {
+ metadataUpdate: Partial<
+ Pick<QueryBasedInsightModel<Node<Record<string, any>>>, 'description' | 'favorited' | 'name' | 'tags'>
+ >
+ }
+ setInsightMetadataFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ setInsightMetadataLocal: (
+ metadataUpdate: Partial<Pick<QueryBasedInsightModel, 'description' | 'favorited' | 'name' | 'tags'>>
+ ) => {
+ metadataUpdate: Partial<
+ Pick<QueryBasedInsightModel<Node<Record<string, any>>>, 'description' | 'favorited' | 'name' | 'tags'>
+ >
+ }
+ setInsightMetadataSuccess: (
+ insight: {
+ _create_in_folder?: string | null | undefined
+ alerts?: AlertType[] | undefined
+ cache_target_age?: string | null | undefined
+ created_at?: string | undefined
+ created_by?: UserBasicType | null | undefined
+ dashboard_tiles?: DashboardTileBasicType[] | null | undefined
+ dashboards?: number[] | null | undefined
+ deleted?: boolean | undefined
+ derived_name?: string | null | undefined
+ description?: string | undefined
+ disable_baseline?: boolean | undefined
+ favorited?: boolean | undefined
+ filter_override_context?: InsightFilterOverrideContextApi | null | undefined
+ id?: number | undefined
+ is_cached?: boolean | undefined
+ is_sample?: boolean | undefined
+ last_modified_at?: string | undefined
+ last_modified_by?: UserBasicType | null | undefined
+ last_refresh?: string | null | undefined
+ last_viewed_at?: string | null | undefined
+ name?: string | undefined
+ next?: string | undefined
+ next_allowed_client_refresh?: string | null | undefined
+ order?: number | null | undefined
+ query?: Node<Record<string, any>> | null | undefined
+ query_status?: QueryStatus | undefined
+ result?: any
+ saved?: boolean | undefined
+ short_id?: InsightShortId | undefined
+ tags?: string[] | undefined
+ timezone?: string | null | undefined
+ updated_at?: string | undefined
+ user_access_level?: AccessControlLevel | undefined
+ view_count?: number | undefined
+ viewers?: UserBasicType[] | undefined
+ },
+ payload?: {
+ metadataUpdate: Partial<
+ Pick<QueryBasedInsightModel<Node<Record<string, any>>>, 'description' | 'favorited' | 'name' | 'tags'>
+ >
+ }
+ ) => {
+ insight: {
+ _create_in_folder?: string | null | undefined
+ alerts?: AlertType[] | undefined
+ cache_target_age?: string | null | undefined
+ created_at?: string | undefined
+ created_by?: UserBasicType | null | undefined
+ dashboard_tiles?: DashboardTileBasicType[] | null | undefined
+ dashboards?: number[] | null | undefined
+ deleted?: boolean | undefined
+ derived_name?: string | null | undefined
+ description?: string | undefined
+ disable_baseline?: boolean | undefined
+ favorited?: boolean | undefined
+ filter_override_context?: InsightFilterOverrideContextApi | null | undefined
+ id?: number | undefined
+ is_cached?: boolean | undefined
+ is_sample?: boolean | undefined
+ last_modified_at?: string | undefined
+ last_modified_by?: UserBasicType | null | undefined
+ last_refresh?: string | null | undefined
+ last_viewed_at?: string | null | undefined
+ name?: string | undefined
+ next?: string | undefined
+ next_allowed_client_refresh?: string | null | undefined
+ order?: number | null | undefined
+ query?: Node<Record<string, any>> | null | undefined
+ query_status?: QueryStatus | undefined
+ result?: any
+ saved?: boolean | undefined
+ short_id?: InsightShortId | undefined
+ tags?: string[] | undefined
+ timezone?: string | null | undefined
+ updated_at?: string | undefined
+ user_access_level?: AccessControlLevel | undefined
+ view_count?: number | undefined
+ viewers?: UserBasicType[] | undefined
+ }
+ payload?: {
+ metadataUpdate: Partial<
+ Pick<QueryBasedInsightModel<Node<Record<string, any>>>, 'description' | 'favorited' | 'name' | 'tags'>
+ >
+ }
+ }
+ setPreviousQuery: (previousQuery: Node | null) => {
+ previousQuery: Node<Record<string, any>> | null
+ }
+ setSuggestedQuery: (suggestedQuery: Node | null) => {
+ suggestedQuery: Node<Record<string, any>> | null
+ }
+ updateInsight: (
+ insightUpdate: Partial<QueryBasedInsightModel>,
+ callback?: () => void
+ ) => {
+ callback: (() => void) | undefined
+ insightUpdate: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>
+ }
+ updateInsightFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateInsightSuccess: (
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>,
+ payload?: {
+ callback: (() => void) | undefined
+ insightUpdate: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>
+ }
+ ) => {
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>
+ payload?: {
+ callback: (() => void) | undefined
+ insightUpdate: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ insightProps: (arg: any) => InsightLogicProps
+ query: (arg: Node<Record<string, any>> | null) => Node | null
+ isInDashboardContext: (arg: any) => boolean
+ hasDashboardItemId: (arg: any) => boolean
+ isInExperimentContext: (location: { hash: string; pathname: string; search: string }) => boolean
+ isInViewMode: (location: { hash: string; pathname: string; search: string }) => boolean
+ derivedName: (
+ query: Node<Record<string, any>> | null,
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun,
+ cohortsById: Partial<Record<number | string, CohortType>>,
+ mathDefinitions: Partial<Record<string, MathDefinition>>
+ ) => string
+ insightName: (
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>,
+ derivedName: string
+ ) => string
+ insightId: (insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>) => number | null
+ canEditInsight: (insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>) => boolean
+ insightChanged: (
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>,
+ savedInsight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>
+ ) => boolean
+ showPersonsModal: (
+ query: Node<Record<string, any>> | null,
+ insightProps: InsightLogicProps<import('~/queries/schema/schema-general').QuerySchema>,
+ featureFlags: FeatureFlagsSet
+ ) => boolean
+ supportsCreatingExperiment: (
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>,
+ activeSceneId: string | null
+ ) => boolean | null
+ isUsingPathsV1: (featureFlags: FeatureFlagsSet) => boolean
+ isUsingPathsV2: (featureFlags: FeatureFlagsSet) => boolean | string | undefined
+ hasOverrides: (arg: any, arg2: any, arg3: any) => boolean
+ editingDisabledReason: (hasOverrides: boolean) => 'Discard overrides to edit the insight.' | null
+ }
+ __keaTypeGenInternalReducerActions: {
+ 'rename insight success (models.insightsModel)': (item: QueryBasedInsightModel) => {
+ payload: {
+ item: QueryBasedInsightModel<Node<Record<string, any>>>
+ }
+ type: 'rename insight success (models.insightsModel)'
+ }
+ }
+}
+
+export type insightLogicType = MakeLogicType<
+ insightLogicValues,
+ insightLogicActions,
+ InsightLogicProps,
+ insightLogicMeta
+>
+
export const insightLogic: LogicWrapper<insightLogicType> = kea<insightLogicType>([
props({ filtersOverride: null, variablesOverride: null, tileFiltersOverride: null } as InsightLogicProps),
key((props) => keyForInsightLogicProps('new')(props)),
@@ -452,7 +896,7 @@ export const insightLogic: LogicWrapper<insightLogicType> = kea<insightLogicType
insightProps: [() => [(_, props) => props], (props): InsightLogicProps => props],
query: [
(s) => [(state) => insightDataLogic.findMounted(s.insightProps(state))?.values.query || null],
- (node): Node | null => node,
+ (node: Node<Record<string, any>> | null): Node | null => node,
],
isInDashboardContext: [() => [(_, props) => props], ({ dashboardId }) => !!dashboardId],
hasDashboardItemId: [
@@ -467,18 +911,33 @@ export const insightLogic: LogicWrapper<insightLogicType> = kea<insightLogicType
isInViewMode: [() => [router.selectors.location], ({ pathname }) => /\/insights\/[a-zA-Z0-9]+$/.test(pathname)],
derivedName: [
(s) => [s.query, s.aggregationLabel, s.cohortsById, s.mathDefinitions],
- (query, aggregationLabel, cohortsById, mathDefinitions) =>
+ (
+ query: Node | null,
+ aggregationLabel: (
+ groupTypeIndex: number | null | undefined,
+ deferToUserWording?: boolean
+ ) => import('~/models/groupsModel').Noun,
+ cohortsById: Partial<Record<number | string, import('~/types').CohortType>>,
+ mathDefinitions: Partial<Record<string, import('scenes/trends/mathsLogic').MathDefinition>>
+ ) =>
summarizeInsight(query, {
aggregationLabel,
cohortsById,
mathDefinitions,
}).slice(0, 400),
],
- insightName: [(s) => [s.insight, s.derivedName], (insight, derivedName) => insight.name ?? derivedName],
- insightId: [(s) => [s.insight], (insight) => insight?.id || null],
+ insightName: [
+ (s) => [s.insight, s.derivedName],
+ (insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>, derivedName: string) =>
+ insight.name ?? derivedName,
+ ],
+ insightId: [
+ (s) => [s.insight],
+ (insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>) => insight?.id || null,
+ ],
canEditInsight: [
(s) => [s.insight],
- (insight) =>
+ (insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>) =>
insight.user_access_level
? accessLevelSatisfied(
AccessControlResourceType.Insight,
@@ -489,7 +948,10 @@ export const insightLogic: LogicWrapper<insightLogicType> = kea<insightLogicType
],
insightChanged: [
(s) => [s.insight, s.savedInsight],
- (insight, savedInsight): boolean => {
+ (
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>,
+ savedInsight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>
+ ): boolean => {
return (
(insight.name || '') !== (savedInsight.name || '') ||
(insight.description || '') !== (savedInsight.description || '') ||
@@ -518,11 +980,13 @@ export const insightLogic: LogicWrapper<insightLogicType> = kea<insightLogicType
],
isUsingPathsV1: [
(s) => [s.featureFlags],
- (featureFlags) => !featureFlags[FEATURE_FLAGS.PRODUCT_ANALYTICS_PATHS_V2],
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet) =>
+ !featureFlags[FEATURE_FLAGS.PRODUCT_ANALYTICS_PATHS_V2],
],
isUsingPathsV2: [
(s) => [s.featureFlags],
- (featureFlags) => featureFlags[FEATURE_FLAGS.PRODUCT_ANALYTICS_PATHS_V2],
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet) =>
+ featureFlags[FEATURE_FLAGS.PRODUCT_ANALYTICS_PATHS_V2],
],
hasOverrides: [
() => [
@@ -544,7 +1008,7 @@ export const insightLogic: LogicWrapper<insightLogicType> = kea<insightLogicType
],
editingDisabledReason: [
(s) => [s.hasOverrides],
- (hasOverrides) => (hasOverrides ? 'Discard overrides to edit the insight.' : null),
+ (hasOverrides: boolean) => (hasOverrides ? 'Discard overrides to edit the insight.' : null),
],
}),
listeners(({ actions, values, props }) => ({
diff --git a/frontend/src/scenes/insights/insightModalsLogic.ts b/frontend/src/scenes/insights/insightModalsLogic.ts
index c9c3a38d12c6..26cf4e86a3bc 100644
--- a/frontend/src/scenes/insights/insightModalsLogic.ts
+++ b/frontend/src/scenes/insights/insightModalsLogic.ts
@@ -1,11 +1,61 @@
-import { actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
import { InsightLogicProps } from '~/types'
import { insightLogic } from './insightLogic'
-import type { insightModalsLogicType } from './insightModalsLogicType'
import { keyForInsightLogicProps } from './sharedUtils'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightModalsLogicValues {
+ isAddToDashboardModalOpen: boolean
+ isTerraformModalOpen: boolean
+ pendingAddToDashboardAfterSave: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightModalsLogicActions {
+ saveInsight: (
+ redirectToViewMode?: boolean | undefined,
+ folder?: string | null | undefined
+ ) => {
+ folder: string | null
+ redirectToViewMode: boolean
+ } // insightLogic
+ saveInsightFailure: () => {
+ value: true
+ } // insightLogic
+ saveInsightSuccess: () => {
+ value: true
+ } // insightLogic
+ closeAddToDashboardModal: () => {
+ value: true
+ }
+ closeTerraformModal: () => {
+ value: true
+ }
+ openAddToDashboardModal: () => {
+ value: true
+ }
+ openTerraformModal: () => {
+ value: true
+ }
+ saveAndAddToDashboard: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightModalsLogicMeta {
+ key: string
+}
+
+export type insightModalsLogicType = MakeLogicType<
+ insightModalsLogicValues,
+ insightModalsLogicActions,
+ InsightLogicProps,
+ insightModalsLogicMeta
+>
+
export const insightModalsLogic = kea<insightModalsLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps('new')),
diff --git a/frontend/src/scenes/insights/insightSceneLogic.tsx b/frontend/src/scenes/insights/insightSceneLogic.tsx
index 6ad9a3e9a7d2..f29da0d39151 100644
--- a/frontend/src/scenes/insights/insightSceneLogic.tsx
+++ b/frontend/src/scenes/insights/insightSceneLogic.tsx
@@ -1,4 +1,16 @@
-import { BuiltLogic, actions, connect, kea, listeners, path, reducers, selectors, sharedListeners } from 'kea'
+import {
+ MakeLogicType,
+ BuiltLogic,
+ actions,
+ connect,
+ kea,
+ listeners,
+ path,
+ reducers,
+ selectors,
+ sharedListeners,
+} from 'kea'
+import type { BreakPointFunction } from 'kea'
import { urlToAction } from 'kea-router'
import { objectsEqual } from 'kea-test-utils'
@@ -10,7 +22,7 @@ import { isEmptyObject, isObject } from 'lib/utils/guards'
import { isDashboardFilterEmpty } from 'scenes/dashboard/dashboardFilterEmpty'
import { dashboardLogic } from 'scenes/dashboard/dashboardLogic'
import { createEmptyInsight, insightLogic } from 'scenes/insights/insightLogic'
-import { insightLogicType } from 'scenes/insights/insightLogicType'
+import type { insightLogicType } from 'scenes/insights/insightLogic'
import { MaxContextInput, createMaxContextHelpers } from 'scenes/max/maxTypes'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { sceneLogic } from 'scenes/sceneLogic'
@@ -55,9 +67,11 @@ import {
import { AlertType } from 'products/alerts/frontend/types'
import { PRODUCT_ANALYTICS_DEFAULT_QUERY_TAGS } from 'products/product_analytics/frontend/constants'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
+import type { QuerySchema } from '../../queries/schema/schema-general'
+import type { TeamPublicType, TeamType } from '../../types'
import { insightDataLogic } from './insightDataLogic'
-import { insightDataLogicType } from './insightDataLogicType'
-import type { insightSceneLogicType } from './insightSceneLogicType'
+import type { insightDataLogicType } from './insightDataLogic'
import { getInsightIconTypeFromQuery, parseDraftQueryFromURL } from './utils'
const NEW_INSIGHT = 'new' as const
@@ -99,6 +113,197 @@ function withDefaultProductAnalyticsTags(query: Node): Node {
return query
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightSceneLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ filterTestAccountsDefault: boolean // filterTestAccountsDefaultsLogic
+ disableNavigationHooks: boolean | undefined // preflightLogic
+ scenePanelIsPresent: boolean // sceneLayoutLogic
+ activeSceneId: string | null // sceneLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ currentTeamId: number | null // teamLogic
+ alertId: AlertType['id'] | null
+ breadcrumbs: Breadcrumb[]
+ dashboardId: DashboardType['id'] | null
+ dashboardName: DashboardType['name'] | null
+ filtersOverride: DashboardFilter | null
+ freshQuery: boolean
+ hasOverrides: boolean
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>> | null | undefined
+ insightData: Record<string, any> | null | undefined
+ insightDataLogicRef: {
+ logic: BuiltLogic<insightDataLogicType>
+ unmount: () => void
+ } | null
+ insightDataSelector:
+ | ((state: any, props?: InsightLogicProps<QuerySchema> | undefined) => Record<string, any>)
+ | undefined
+ insightId: InsightId | null
+ insightLogicRef: {
+ logic: BuiltLogic<insightLogicType>
+ unmount: () => void
+ } | null
+ insightMode: ItemMode
+ insightQuery: Node<Record<string, any>> | null | undefined
+ insightQuerySelector:
+ | ((state: any, props?: InsightLogicProps<QuerySchema> | undefined) => Node<Record<string, any>> | null)
+ | undefined
+ insightSelector:
+ | ((
+ state: any,
+ props?: InsightLogicProps<QuerySchema> | undefined
+ ) => Partial<QueryBasedInsightModel<Node<Record<string, any>>>>)
+ | undefined
+ itemId: number | string | null
+ maxContext: MaxContextInput[]
+ projectTreeRef: ProjectTreeRef
+ sceneSource: InsightSceneSource | null
+ sidePanelContext: SidePanelSceneContext | null
+ tileFiltersOverride: TileFilters | null
+ variablesOverride: Record<string, HogQLVariable> | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightSceneLogicActions {
+ setScenePanelIsPresent: (active: boolean) => {
+ active: boolean
+ } // sceneLayoutLogic
+ setFreshQuery: (freshQuery: boolean) => {
+ freshQuery: boolean
+ }
+ setInsightDataLogicRef: (
+ logic: BuiltLogic<insightDataLogicType> | null,
+ unmount: (() => void) | null
+ ) => {
+ logic: BuiltLogic<insightDataLogicType> | null
+ unmount: (() => void) | null
+ }
+ setInsightId: (insightId: InsightShortId) => {
+ insightId: InsightShortId
+ }
+ setInsightLogicRef: (
+ logic: BuiltLogic<insightLogicType> | null,
+ unmount: (() => void) | null
+ ) => {
+ logic: BuiltLogic<insightLogicType> | null
+ unmount: (() => void) | null
+ }
+ setInsightMode: (
+ insightMode: ItemMode,
+ source: InsightEventSource | null
+ ) => {
+ insightMode: ItemMode
+ source: InsightEventSource | null
+ }
+ setSceneState: (
+ insightId: InsightShortId,
+ insightMode: ItemMode,
+ itemId: string | undefined,
+ alertId: AlertType['id'] | undefined,
+ filtersOverride: DashboardFilter | undefined,
+ variablesOverride: Record<string, HogQLVariable> | undefined,
+ tileFiltersOverride: TileFilters | undefined,
+ dashboardId: DashboardType['id'] | undefined,
+ dashboardName: DashboardType['name'] | undefined,
+ sceneSource: InsightSceneSource | null
+ ) => {
+ alertId: string | undefined
+ dashboardId: number | undefined
+ dashboardName: string | undefined
+ filtersOverride: DashboardFilter | undefined
+ insightId: InsightShortId
+ insightMode: ItemMode
+ itemId: string | undefined
+ sceneSource: InsightSceneSource | null
+ tileFiltersOverride: TileFilters | undefined
+ variablesOverride: Record<string, HogQLVariable> | undefined
+ }
+ upgradeQuery: (query: Node) => {
+ query: Node<Record<string, any>>
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightSceneLogicMeta {
+ sharedListeners: {
+ reloadInsightLogic: (
+ payload: any,
+ breakpoint: BreakPointFunction,
+ action: {
+ type: string
+ payload: any
+ },
+ previousState: any
+ ) => void | Promise<void>
+ }
+ __keaTypeGenInternalSelectorTypes: {
+ insightQuerySelector: (
+ insightDataLogicRef: {
+ logic: BuiltLogic<insightDataLogicType>
+ unmount: () => void
+ } | null
+ ) =>
+ | ((state: any, props?: InsightLogicProps<QuerySchema> | undefined) => Node<Record<string, any>> | null)
+ | undefined
+ insightQuery: (
+ arg: Node<Record<string, any>> | null | undefined
+ ) => Node<Record<string, any>> | null | undefined
+ insightDataSelector: (
+ insightDataLogicRef: {
+ logic: BuiltLogic<insightDataLogicType>
+ unmount: () => void
+ } | null
+ ) => ((state: any, props?: InsightLogicProps<QuerySchema> | undefined) => Record<string, any>) | undefined
+ insightData: (arg: Record<string, any> | null | undefined) => Record<string, any> | null | undefined
+ insightSelector: (
+ insightLogicRef: {
+ logic: BuiltLogic<insightLogicType>
+ unmount: () => void
+ } | null
+ ) =>
+ | ((
+ state: any,
+ props?: InsightLogicProps<QuerySchema> | undefined
+ ) => Partial<QueryBasedInsightModel<Node<Record<string, any>>>>)
+ | undefined
+ insight: (
+ arg: Partial<QueryBasedInsightModel<Node<Record<string, any>>>> | null | undefined
+ ) => Partial<QueryBasedInsightModel<Node<Record<string, any>>>> | null | undefined
+ breadcrumbs: (
+ insightLogicRef: {
+ logic: BuiltLogic<insightLogicType>
+ unmount: () => void
+ } | null,
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>> | null | undefined,
+ insightQuery: Node<Record<string, any>> | null | undefined,
+ dashboardId: number | null,
+ dashboardName: string | null,
+ sceneSource: InsightSceneSource | null
+ ) => Breadcrumb[]
+ projectTreeRef: (insightId: InsightId) => ProjectTreeRef
+ sidePanelContext: (
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>> | null | undefined
+ ) => SidePanelSceneContext | null
+ maxContext: (
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>> | null | undefined,
+ filtersOverride: DashboardFilter | null,
+ variablesOverride: Record<string, HogQLVariable> | null
+ ) => MaxContextInput[]
+ hasOverrides: (
+ filtersOverride: DashboardFilter | null,
+ variablesOverride: Record<string, HogQLVariable> | null,
+ tileFiltersOverride: TileFilters | null
+ ) => boolean
+ }
+}
+
+export type insightSceneLogicType = MakeLogicType<
+ insightSceneLogicValues,
+ insightSceneLogicActions,
+ Record<string, any>,
+ insightSceneLogicMeta
+>
+
export const insightSceneLogic = kea<insightSceneLogicType>([
path(['scenes', 'insights', 'insightSceneLogic']),
connect(() => ({
@@ -242,7 +447,12 @@ export const insightSceneLogic = kea<insightSceneLogicType>([
selectors({
insightQuerySelector: [
(s) => [s.insightDataLogicRef],
- (insightDataLogicRef) => insightDataLogicRef?.logic.selectors.query,
+ (
+ insightDataLogicRef: {
+ logic: BuiltLogic<insightDataLogicType>
+ unmount: () => void
+ } | null
+ ) => insightDataLogicRef?.logic.selectors.query,
],
insightQuery: [
(s) => [
@@ -254,11 +464,16 @@ export const insightSceneLogic = kea<insightSceneLogicType>([
}
},
],
- (insightQuery) => insightQuery,
+ (insightQuery: Node<Record<string, any>> | null | undefined) => insightQuery,
],
insightDataSelector: [
(s) => [s.insightDataLogicRef],
- (insightDataLogicRef) => insightDataLogicRef?.logic.selectors.insightData,
+ (
+ insightDataLogicRef: {
+ logic: BuiltLogic<insightDataLogicType>
+ unmount: () => void
+ } | null
+ ) => insightDataLogicRef?.logic.selectors.insightData,
],
insightData: [
(s) => [
@@ -270,9 +485,17 @@ export const insightSceneLogic = kea<insightSceneLogicType>([
}
},
],
- (insightData) => insightData,
+ (insightData: Record<string, any> | null | undefined) => insightData,
+ ],
+ insightSelector: [
+ (s) => [s.insightLogicRef],
+ (
+ insightLogicRef: {
+ logic: BuiltLogic<insightLogicType>
+ unmount: () => void
+ } | null
+ ) => insightLogicRef?.logic.selectors.insight,
],
- insightSelector: [(s) => [s.insightLogicRef], (insightLogicRef) => insightLogicRef?.logic.selectors.insight],
insight: [
(s) => [
(state, props) => {
@@ -284,11 +507,21 @@ export const insightSceneLogic = kea<insightSceneLogicType>([
}
},
],
- (insight) => insight,
+ (insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>> | null | undefined) => insight,
],
breadcrumbs: [
(s) => [s.insightLogicRef, s.insight, s.insightQuery, s.dashboardId, s.dashboardName, s.sceneSource],
- (insightLogicRef, insight, insightQuery, dashboardId, dashboardName, sceneSource): Breadcrumb[] => {
+ (
+ insightLogicRef: {
+ logic: BuiltLogic<insightLogicType>
+ unmount: () => void
+ } | null,
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>> | null | undefined,
+ insightQuery: Node<Record<string, any>> | null | undefined,
+ dashboardId: DashboardType['id'] | null,
+ dashboardName: DashboardType['name'] | null,
+ sceneSource: InsightSceneSource | null
+ ): Breadcrumb[] => {
const dashboardLabel = dashboardName ?? 'Dashboard'
return [
...(dashboardId !== null
@@ -346,14 +579,16 @@ export const insightSceneLogic = kea<insightSceneLogicType>([
],
projectTreeRef: [
(s) => [s.insightId],
- (insightId): ProjectTreeRef => ({
+ (insightId: InsightId | null): ProjectTreeRef => ({
type: 'insight',
ref: insightId && insightId !== 'new' && !insightId.startsWith('new-') ? String(insightId) : null,
}),
],
[SIDE_PANEL_CONTEXT_KEY]: [
(s) => [s.insight],
- (insight): SidePanelSceneContext | null => {
+ (
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>> | null | undefined
+ ): SidePanelSceneContext | null => {
if (!insight?.id) {
// An unsaved insight has no numeric id yet. Still declare the Insight scope so
// sidePanelContextLogic does not fall back to the URL-based guesser (which would
@@ -379,7 +614,11 @@ export const insightSceneLogic = kea<insightSceneLogicType>([
],
maxContext: [
(s) => [s.insight, s.filtersOverride, s.variablesOverride],
- (insight: Partial<QueryBasedInsightModel>, filtersOverride, variablesOverride): MaxContextInput[] => {
+ (
+ insight: Partial<QueryBasedInsightModel>,
+ filtersOverride: DashboardFilter | null,
+ variablesOverride: Record<string, HogQLVariable> | null
+ ): MaxContextInput[] => {
if (!insight || !insight.short_id || !insight.query) {
return []
}
@@ -393,7 +632,11 @@ export const insightSceneLogic = kea<insightSceneLogicType>([
],
hasOverrides: [
(s) => [s.filtersOverride, s.variablesOverride, s.tileFiltersOverride],
- (filtersOverride, variablesOverride, tileFiltersOverride) =>
+ (
+ filtersOverride: DashboardFilter | null,
+ variablesOverride: Record<string, HogQLVariable> | null,
+ tileFiltersOverride: TileFilters | null
+ ) =>
!isDashboardFilterEmpty(filtersOverride) ||
(isObject(variablesOverride) && !isEmptyObject(variablesOverride)) ||
!isDashboardFilterEmpty(tileFiltersOverride),
diff --git a/frontend/src/scenes/insights/insightUsageLogic.ts b/frontend/src/scenes/insights/insightUsageLogic.ts
index e2d41e607dbf..014ef3682573 100644
--- a/frontend/src/scenes/insights/insightUsageLogic.ts
+++ b/frontend/src/scenes/insights/insightUsageLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
import { subscriptions } from 'kea-subscriptions'
import api from 'lib/api'
@@ -12,13 +12,59 @@ import { insightVizDataNodeKey } from '~/queries/nodes/InsightViz/insightVizKeys
import { Node } from '~/queries/schema/schema-general'
import { InsightLogicProps } from '~/types'
+import type { DataNode } from '../../queries/schema/schema-general'
+import type { QueryBasedInsightModel } from '../../types'
import { insightLogic } from './insightLogic'
import { insightSceneLogic } from './insightSceneLogic'
-import type { insightUsageLogicType } from './insightUsageLogicType'
import { keyForInsightLogicProps } from './sharedUtils'
const IS_TEST_MODE = process.env.NODE_ENV === 'test'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightUsageLogicValues {
+ query: DataNode<Record<string, any>> // dataNodeLogic
+ insight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>> // insightLogic
+ currentProjectId: number | null // projectLogic
+ isFirstLoad: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightUsageLogicActions {
+ reportInsightViewed: (
+ insightModel: Partial<QueryBasedInsightModel>,
+ query: Node | null,
+ isFirstLoad: boolean,
+ delay?: number
+ ) => {
+ delay: number | undefined
+ insightModel: Partial<QueryBasedInsightModel<Node<Record<string, any>>>>
+ isFirstLoad: boolean
+ query: Node<Record<string, any>> | null
+ } // eventUsageLogic
+ onQueryChange: (
+ query: Node | null,
+ previousQuery?: Node | null
+ ) => {
+ previousQuery: Node<Record<string, any>> | null | undefined
+ query: Node<Record<string, any>> | null
+ }
+ setNotFirstLoad: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightUsageLogicMeta {
+ key: string
+}
+
+export type insightUsageLogicType = MakeLogicType<
+ insightUsageLogicValues,
+ insightUsageLogicActions,
+ InsightLogicProps,
+ insightUsageLogicMeta
+>
+
export const insightUsageLogic = kea<insightUsageLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps('new')),
diff --git a/frontend/src/scenes/insights/insightVizDataLogic.ts b/frontend/src/scenes/insights/insightVizDataLogic.ts
index 9e5ed776bf76..f88ee2b85a3b 100644
--- a/frontend/src/scenes/insights/insightVizDataLogic.ts
+++ b/frontend/src/scenes/insights/insightVizDataLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import posthog from 'posthog-js'
import { lemonToast } from '@posthog/lemon-ui'
@@ -111,7 +111,42 @@ import {
SlowQueryPossibilities,
} from '~/types'
-import type { insightVizDataLogicType } from './insightVizDataLogicType'
+import type { DataColorTheme } from '../../lib/colors'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
+import type {
+ Breakdown,
+ DataNode,
+ DataWarehouseNode,
+ DatabaseSchemaDataWarehouseTable,
+ DatabaseSchemaViewTable,
+ ErrorTrackingQueryResponse,
+ EventsQueryResponse,
+ FunnelPathsFilter,
+ GoalLine,
+ HogQLAutocompleteResponse,
+ HogQLMetadataResponse,
+ HogQLQueryResponse,
+ HogQueryResponse,
+ LifecycleFilter,
+ LogAttributesQueryResponse,
+ LogValuesQueryResponse,
+ LogsQueryResponse,
+ MetricsQueryResponse,
+ PathsFilter,
+ PathsQuery,
+ RefreshType,
+ ResultCustomizationBy,
+ RetentionFilter,
+ SessionsQueryResponse,
+ StickinessFilter,
+ TraceSpansAggregationQueryResponse,
+ TraceSpansAttributeBreakdownQueryResponse,
+ TraceSpansQueryResponse,
+ TraceSpansTreeQueryResponse,
+ WebOverviewQuery,
+ WebStatsTableQuery,
+} from '../../queries/schema/schema-general'
+import type { AnyPropertyFilter, GroupTypeIndex, PropertyGroupFilter } from '../../types'
const SHOW_TIMEOUT_MESSAGE_AFTER = 5000
@@ -127,6 +162,1030 @@ const DISPLAYS_WITH_IN_CHART_LEGEND = [
export type QuerySourceUpdate = Omit<Partial<InsightQueryNode>, 'kind'>
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightVizDataLogicValues {
+ getTheme: (themeId: number | string | null | undefined) => DataColorTheme | null // dataThemeLogic
+ dataWarehouseTablesMap: Record<string, DatabaseSchemaDataWarehouseTable | DatabaseSchemaViewTable> // databaseTableListLogic
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ filterTestAccountsDefault: boolean // filterTestAccountsDefaultsLogic
+ insightData: Record<string, any> // insightDataLogic
+ insightDataError: Record<string, any> | null // insightDataLogic
+ insightDataLoading: boolean // insightDataLogic
+ insightQuery: DataNode<Record<string, any>> // insightDataLogic
+ query: Node | null // insightDataLogic
+ activeUsersMath: BaseMathType.MonthlyActiveUsers | BaseMathType.WeeklyActiveUsers | null
+ aggregationGroupTypeIndex: GroupTypeIndex | null | undefined
+ allEventNames: string[]
+ breakdownFilter: BreakdownFilter | null | undefined
+ compareFilter: CompareFilter | null | undefined
+ currentDataWarehouseSchemaColumns: DatabaseSchemaField[]
+ dateRange: DateRange | null | undefined
+ detailedResultsAggregationType: AggregationType | undefined
+ display: ChartDisplayType | null | undefined
+ enabledIntervals: Intervals
+ erroredQueryId: any
+ formula: string | null | undefined
+ formulaNodes: TrendsFormulaNode[]
+ formulas: string[] | null | undefined
+ funnelPathsFilter: FunnelPathsFilter | null | undefined
+ funnelsFilter: FunnelsFilter | null | undefined
+ goalLines: GoalLine[] | null | undefined
+ hasDataWarehouseSeries: boolean
+ hasDetailedResultsTable: boolean
+ hasFormula: boolean
+ hasLegend: boolean
+ hasOnlyDataWarehouseSeries: boolean
+ insightFilter: InsightFilter | null | undefined
+ interval: IntervalType | null | undefined
+ isAllEventsQuery: boolean
+ isBreakdownSeries: boolean
+ isFirstTimeForUserQuery: boolean
+ isFormulaModeOpenedExplicitly: boolean
+ isFunnels: boolean
+ isIntervalManuallySet: boolean
+ isLifecycle: boolean
+ isNonTimeSeriesDisplay: boolean
+ isPaths: boolean
+ isRetention: boolean
+ isSingleSeriesDefinition: boolean
+ isSingleSeriesOutput: boolean
+ isStickiness: boolean
+ isStrictFunnelQuery: boolean
+ isTrends: boolean
+ isTrendsLike: boolean
+ isUsingSessionAnalysis: boolean | Breakdown
+ isWebAnalytics: boolean
+ isWebOverview: boolean
+ isWebStatsTable: boolean
+ labelGroupType: LabelGroupType
+ legendPosition: string | null | undefined
+ lifecycleFilter: LifecycleFilter | null | undefined
+ localQuerySource: InsightQueryNode
+ pathsFilter: PathsFilter | null
+ properties: PropertyGroupFilter | AnyPropertyFilter[] | null | undefined
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ resultCustomizationBy: ResultCustomizationBy | null | undefined
+ retentionFilter: RetentionFilter | null
+ samplingFactor: number | null | undefined
+ series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined
+ shouldShowSessionAnalysisWarning: boolean
+ showAlertThresholdLines: boolean | null | undefined
+ showAnnotations: boolean | null | undefined
+ showLabelOnSeries: boolean | null | undefined
+ showLegend: boolean | null | undefined
+ showMultipleYAxes: boolean | null | undefined
+ showPercentStackView: boolean | null | undefined
+ showPercentagesOnSeries: boolean | null | undefined
+ showValuesOnSeries: boolean | null | undefined
+ slowQueryPossibilities: SlowQueryPossibilities[]
+ stickinessFilter: StickinessFilter | null | undefined
+ supportsBarValueStacking: boolean
+ supportsCompare: boolean
+ supportsDisplay: boolean
+ supportsPercentStackView: boolean
+ supportsResultCustomizationBy: boolean
+ supportsValueOnSeries: boolean
+ theme: DataColorTheme | null
+ timedOutQueryId: string | null
+ timezone: any
+ trendsFilter: TrendsFilter | null | undefined
+ usesInChartLegend: boolean
+ validationError: string | null
+ validationErrorCode: string | null
+ valueOnSeries: boolean
+ vizSpecificOptions: VizSpecificOptions | null | undefined
+ yAxisScaleType: string | null | undefined
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightVizDataLogicActions {
+ cancelChanges: () => {
+ value: true
+ } // insightDataLogic
+ loadData: (
+ refresh?: RefreshType | undefined,
+ alreadyRunningQueryId?: string | undefined,
+ overrideQuery?: DataNode<Record<string, any>> | undefined
+ ) => {
+ overrideQuery: DataNode<Record<string, any>> | undefined
+ pollOnly: boolean
+ queryId: string
+ refresh: RefreshType | undefined
+ } // insightDataLogic
+ loadDataFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ } // insightDataLogic
+ loadDataSuccess: (
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ | undefined,
+ payload?:
+ | {
+ overrideQuery: DataNode<Record<string, any>> | undefined
+ pollOnly: boolean
+ queryId: string
+ refresh: RefreshType | undefined
+ }
+ | undefined
+ ) => {
+ payload?: {
+ overrideQuery: DataNode<Record<string, any>> | undefined
+ pollOnly: boolean
+ queryId: string
+ refresh: RefreshType | undefined
+ }
+ response:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null
+ | undefined
+ } // insightDataLogic
+ setInsightData: (
+ response:
+ | ErrorTrackingQueryResponse
+ | EventsQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogsQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | TraceSpansTreeQueryResponse
+ ) =>
+ | ErrorTrackingQueryResponse
+ | EventsQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogsQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | TraceSpansTreeQueryResponse // insightDataLogic
+ setQuery: (query: Node<Record<string, any>> | null) => {
+ query: Node<Record<string, any>> | null
+ } // insightDataLogic
+ removeFormulaNode: (formulas: TrendsFormulaNode[]) => {
+ formulas: TrendsFormulaNode[]
+ }
+ saveInsight: (redirectToViewMode?: any) => {
+ redirectToViewMode: any
+ }
+ setDetailedResultsAggregationType: (detailedResultsAggregationType: AggregationType) => {
+ detailedResultsAggregationType: AggregationType
+ }
+ setIsIntervalManuallySet: (isIntervalManuallySet: boolean) => {
+ isIntervalManuallySet: boolean
+ }
+ setTimedOutQueryId: (id: string | null) => {
+ id: string | null
+ }
+ toggleFormulaMode: () => {
+ value: true
+ }
+ updateBreakdownFilter: (breakdownFilter: BreakdownFilter) => {
+ breakdownFilter: BreakdownFilter
+ }
+ updateCompareFilter: (compareFilter: CompareFilter) => {
+ compareFilter: CompareFilter
+ }
+ updateDateRange: (
+ dateRange: DateRange,
+ ignoreDebounce?: boolean
+ ) => {
+ dateRange: DateRange
+ ignoreDebounce: boolean
+ }
+ updateDisplay: (display: ChartDisplayType | undefined) => {
+ display: ChartDisplayType | undefined
+ }
+ updateInsightFilter: (insightFilter: InsightFilter) => {
+ insightFilter: InsightFilter
+ }
+ updateQuerySource: (querySource: QuerySourceUpdate) => {
+ querySource: QuerySourceUpdate
+ }
+ updateVizSpecificOptions: (vizSpecificOptions: VizSpecificOptions) => {
+ vizSpecificOptions: VizSpecificOptions
+ }
+ zoomDateRange: (
+ dateFrom: string,
+ dateTo: string
+ ) => {
+ dateFrom: string
+ dateTo: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightVizDataLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ querySource: (
+ query: Node<Record<string, any>> | null
+ ) =>
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ localQuerySource: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null,
+ filterTestAccountsDefault: boolean
+ ) => InsightQueryNode
+ isTrends: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ isFunnels: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ isRetention: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ isPaths: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ isStickiness: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ isLifecycle: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ isWebStatsTable: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ isWebOverview: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ isWebAnalytics: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ isTrendsLike: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ supportsDisplay: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ supportsCompare: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null,
+ display: ChartDisplayType | null | undefined,
+ dateRange: DateRange | null | undefined
+ ) => boolean
+ supportsPercentStackView: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ supportsBarValueStacking: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ supportsValueOnSeries: (
+ isTrends: boolean,
+ isFunnels: boolean,
+ isStickiness: boolean,
+ isLifecycle: boolean,
+ display: ChartDisplayType | null | undefined
+ ) => boolean
+ supportsResultCustomizationBy: (isTrends: boolean, display: ChartDisplayType | null | undefined) => boolean
+ dateRange: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => DateRange | null | undefined
+ breakdownFilter: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => BreakdownFilter | null | undefined
+ compareFilter: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => CompareFilter | null | undefined
+ display: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => ChartDisplayType | null | undefined
+ formula: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => string | null | undefined
+ formulas: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => string[] | null | undefined
+ formulaNodes: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => TrendsFormulaNode[]
+ series: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined
+ interval: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => IntervalType | null | undefined
+ properties: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => PropertyGroupFilter | AnyPropertyFilter[] | null | undefined
+ samplingFactor: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => number | null | undefined
+ showAlertThresholdLines: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean | null | undefined
+ showAnnotations: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean | null | undefined
+ showLegend: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean | null | undefined
+ legendPosition: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => string | null | undefined
+ showValuesOnSeries: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean | null | undefined
+ showPercentagesOnSeries: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean | null | undefined
+ showLabelOnSeries: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean | null | undefined
+ showPercentStackView: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean | null | undefined
+ yAxisScaleType: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => string | null | undefined
+ showMultipleYAxes: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean | null | undefined
+ resultCustomizationBy: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => ResultCustomizationBy | null | undefined
+ aggregationGroupTypeIndex: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => GroupTypeIndex | null | undefined
+ labelGroupType: (aggregationGroupTypeIndex: GroupTypeIndex | null | undefined) => LabelGroupType
+ goalLines: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => GoalLine[] | null | undefined
+ insightFilter: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => InsightFilter | null | undefined
+ trendsFilter: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => TrendsFilter | null | undefined
+ detailedResultsAggregationType: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => AggregationType | undefined
+ funnelsFilter: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => FunnelsFilter | null | undefined
+ retentionFilter: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => RetentionFilter | null
+ pathsFilter: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => PathsFilter | null
+ stickinessFilter: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => StickinessFilter | null | undefined
+ lifecycleFilter: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => LifecycleFilter | null | undefined
+ funnelPathsFilter: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => FunnelPathsFilter | null | undefined
+ vizSpecificOptions: (query: Node<Record<string, any>> | null) => VizSpecificOptions | null | undefined
+ isUsingSessionAnalysis: (
+ series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined,
+ breakdownFilter: BreakdownFilter | null | undefined,
+ properties: PropertyGroupFilter | AnyPropertyFilter[] | null | undefined
+ ) => boolean | Breakdown
+ shouldShowSessionAnalysisWarning: (
+ isUsingSessionAnalysis: boolean | Breakdown,
+ query: Node<Record<string, any>> | null
+ ) => boolean
+ isNonTimeSeriesDisplay: (display: ChartDisplayType | null | undefined) => boolean
+ isSingleSeriesOutput: (
+ isTrends: boolean,
+ formula: string | null | undefined,
+ formulas: string[] | null | undefined,
+ formulaNodes: TrendsFormulaNode[],
+ series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined,
+ breakdownFilter: BreakdownFilter | null | undefined
+ ) => boolean
+ isBreakdownSeries: (breakdownFilter: BreakdownFilter | null | undefined) => boolean
+ isSingleSeriesDefinition: (
+ isTrends: boolean,
+ formula: string | null | undefined,
+ formulas: string[] | null | undefined,
+ formulaNodes: TrendsFormulaNode[],
+ series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined
+ ) => boolean
+ hasDataWarehouseSeries: (
+ series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined
+ ) => boolean
+ hasOnlyDataWarehouseSeries: (
+ series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined
+ ) => boolean
+ currentDataWarehouseSchemaColumns: (
+ series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined,
+ isSingleSeriesOutput: boolean,
+ isTrends: boolean,
+ hasDataWarehouseSeries: boolean,
+ isBreakdownSeries: boolean,
+ dataWarehouseTablesMap: Record<string, DatabaseSchemaDataWarehouseTable | DatabaseSchemaViewTable>
+ ) => DatabaseSchemaField[]
+ valueOnSeries: (
+ isTrends: boolean,
+ isStickiness: boolean,
+ isLifecycle: boolean,
+ insightFilter: InsightFilter | null | undefined
+ ) => boolean
+ hasLegend: (
+ isTrends: boolean,
+ isStickiness: boolean,
+ isLifecycle: boolean,
+ display: ChartDisplayType | null | undefined
+ ) => boolean
+ usesInChartLegend: (
+ featureFlags: FeatureFlagsSet,
+ isTrends: boolean,
+ isStickiness: boolean,
+ isLifecycle: boolean,
+ display: ChartDisplayType | null | undefined
+ ) => boolean
+ hasDetailedResultsTable: (
+ isTrends: boolean,
+ isStickiness: boolean,
+ display: ChartDisplayType | null | undefined
+ ) => boolean
+ hasFormula: (formulaNodes: TrendsFormulaNode[], isFormulaModeOpenedExplicitly: boolean) => boolean
+ activeUsersMath: (
+ series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined
+ ) => BaseMathType.MonthlyActiveUsers | BaseMathType.WeeklyActiveUsers | null
+ enabledIntervals: (
+ activeUsersMath: BaseMathType.WeeklyActiveUsers | BaseMathType.MonthlyActiveUsers | null,
+ isTrends: boolean,
+ featureFlags: FeatureFlagsSet
+ ) => Intervals
+ erroredQueryId: (insightDataError: Record<string, any> | null) => any
+ validationError: (insightDataError: Record<string, any> | null) => string | null
+ validationErrorCode: (insightDataError: Record<string, any> | null) => string | null
+ timezone: (insightData: Record<string, any>) => any
+ allEventNames: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null,
+ actions: import('~/types').ActionType[]
+ ) => string[]
+ theme: (
+ getTheme: (themeId: number | string | null | undefined) => DataColorTheme | null,
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => DataColorTheme | null
+ isAllEventsQuery: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ isFirstTimeForUserQuery: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ isStrictFunnelQuery: (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null
+ ) => boolean
+ slowQueryPossibilities: (
+ isAllEventsQuery: boolean,
+ isFirstTimeForUserQuery: boolean,
+ isStrictFunnelQuery: boolean
+ ) => SlowQueryPossibilities[]
+ }
+}
+
+export type insightVizDataLogicType = MakeLogicType<
+ insightVizDataLogicValues,
+ insightVizDataLogicActions,
+ InsightLogicProps,
+ insightVizDataLogicMeta
+>
+
export const insightVizDataLogic = kea<insightVizDataLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps('new')),
@@ -200,7 +1259,7 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
selectors({
querySource: [
(s) => [s.query],
- (query) => {
+ (query: Node | null) => {
if (!isNodeWithSource(query) || !isInsightQueryNode(query.source)) {
return null
}
@@ -221,24 +1280,202 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
],
localQuerySource: [
(s) => [s.querySource, s.filterTestAccountsDefault],
- (querySource, filterTestAccountsDefault) =>
- querySource ? querySource : queryFromKind(NodeKind.TrendsQuery, filterTestAccountsDefault).source,
- ],
-
- isTrends: [(s) => [s.querySource], (q) => isTrendsQuery(q)],
- isFunnels: [(s) => [s.querySource], (q) => isFunnelsQuery(q)],
- isRetention: [(s) => [s.querySource], (q) => isRetentionQuery(q)],
- isPaths: [(s) => [s.querySource], (q) => isPathsQuery(q)],
- isStickiness: [(s) => [s.querySource], (q) => isStickinessQuery(q)],
- isLifecycle: [(s) => [s.querySource], (q) => isLifecycleQuery(q)],
- isWebStatsTable: [(s) => [s.querySource], (q) => isWebStatsTableQuery(q)],
- isWebOverview: [(s) => [s.querySource], (q) => isWebOverviewQuery(q)],
- isWebAnalytics: [(s) => [s.querySource], (q) => isWebAnalyticsInsightQuery(q)],
- isTrendsLike: [(s) => [s.querySource], (q) => isTrendsQuery(q) || isLifecycleQuery(q) || isStickinessQuery(q)], // this is for filtering out world map
- supportsDisplay: [(s) => [s.querySource], (q) => isTrendsQuery(q) || isStickinessQuery(q)],
+ (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery,
+ filterTestAccountsDefault: boolean
+ ) => (querySource ? querySource : queryFromKind(NodeKind.TrendsQuery, filterTestAccountsDefault).source),
+ ],
+
+ isTrends: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => isTrendsQuery(q),
+ ],
+ isFunnels: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => isFunnelsQuery(q),
+ ],
+ isRetention: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => isRetentionQuery(q),
+ ],
+ isPaths: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => isPathsQuery(q),
+ ],
+ isStickiness: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => isStickinessQuery(q),
+ ],
+ isLifecycle: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => isLifecycleQuery(q),
+ ],
+ isWebStatsTable: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => isWebStatsTableQuery(q),
+ ],
+ isWebOverview: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => isWebOverviewQuery(q),
+ ],
+ isWebAnalytics: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => isWebAnalyticsInsightQuery(q),
+ ],
+ isTrendsLike: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => isTrendsQuery(q) || isLifecycleQuery(q) || isStickinessQuery(q),
+ ], // this is for filtering out world map
+ supportsDisplay: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => isTrendsQuery(q) || isStickinessQuery(q),
+ ],
supportsCompare: [
(s) => [s.querySource, s.display, s.dateRange],
- (q, display, dateRange) => {
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery,
+ display: ChartDisplayType | null | undefined,
+ dateRange: DateRange | null | undefined
+ ) => {
if (dateRange?.date_from === 'all') {
return false
}
@@ -253,11 +1490,45 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
return false
},
],
- supportsPercentStackView: [(s) => [s.querySource], (q) => supportsPercentStackView(q)],
- supportsBarValueStacking: [(s) => [s.querySource], (q) => supportsBarValueStacking(q)],
+ supportsPercentStackView: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => supportsPercentStackView(q),
+ ],
+ supportsBarValueStacking: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => supportsBarValueStacking(q),
+ ],
supportsValueOnSeries: [
(s) => [s.isTrends, s.isFunnels, s.isStickiness, s.isLifecycle, s.display],
- (isTrends, isFunnels, isStickiness, isLifecycle, display) => {
+ (
+ isTrends: boolean,
+ isFunnels: boolean,
+ isStickiness: boolean,
+ isLifecycle: boolean,
+ display: ChartDisplayType | null | undefined
+ ) => {
if (isTrends || isStickiness) {
return !NON_VALUES_ON_SERIES_DISPLAY_TYPES.includes(display || ChartDisplayType.ActionsLineGraph)
} else if (isLifecycle || isFunnels) {
@@ -268,14 +1539,70 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
],
supportsResultCustomizationBy: [
(s) => [s.isTrends, s.display],
- (isTrends, display) =>
+ (isTrends: boolean, display: ChartDisplayType | null | undefined) =>
isTrends && [ChartDisplayType.ActionsLineGraph].includes(display || ChartDisplayType.ActionsLineGraph),
],
- dateRange: [(s) => [s.querySource], (q) => (q ? q.dateRange : null)],
- breakdownFilter: [(s) => [s.querySource], (q) => (q ? getBreakdown(q) : null)],
- compareFilter: [(s) => [s.querySource], (q) => (q ? getCompareFilter(q) : null)],
- display: [(s) => [s.querySource], (q) => (q ? getDisplay(q) : null)],
+ dateRange: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? q.dateRange : null),
+ ],
+ breakdownFilter: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getBreakdown(q) : null),
+ ],
+ compareFilter: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getCompareFilter(q) : null),
+ ],
+ display: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getDisplay(q) : null),
+ ],
formula: [
(s) => [s.querySource],
(querySource: InsightQueryNode | null) => (querySource ? getFormula(querySource) : null),
@@ -296,54 +1623,424 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
: []
},
],
- series: [(s) => [s.querySource], (q) => (q ? getSeries(q) : null)],
- interval: [(s) => [s.querySource], (q) => (q ? getInterval(q) : null)],
- properties: [(s) => [s.querySource], (q) => (q ? q.properties : null)],
- samplingFactor: [(s) => [s.querySource], (q) => (q && 'samplingFactor' in q ? q.samplingFactor : null)],
- showAlertThresholdLines: [(s) => [s.querySource], (q) => (q ? getShowAlertThresholdLines(q) : null)],
- showAnnotations: [(s) => [s.querySource], (q) => (q ? getShowAnnotations(q) : null)],
- showLegend: [(s) => [s.querySource], (q) => (q ? getShowLegend(q) : null)],
- legendPosition: [(s) => [s.querySource], (q) => (q ? getLegendPosition(q) : null)],
- showValuesOnSeries: [(s) => [s.querySource], (q) => (q ? getShowValuesOnSeries(q) : null)],
- showPercentagesOnSeries: [(s) => [s.querySource], (q) => (q ? getShowPercentagesOnSeries(q) : null)],
- showLabelOnSeries: [(s) => [s.querySource], (q) => (q ? getShowLabelsOnSeries(q) : null)],
- showPercentStackView: [(s) => [s.querySource], (q) => (q ? getShowPercentStackView(q) : null)],
- yAxisScaleType: [(s) => [s.querySource], (q) => (q ? getYAxisScaleType(q) : null)],
- showMultipleYAxes: [(s) => [s.querySource], (q) => (q ? getShowMultipleYAxes(q) : null)],
- resultCustomizationBy: [(s) => [s.querySource], (q) => (q ? getResultCustomizationBy(q) : null)],
- aggregationGroupTypeIndex: [(s) => [s.querySource], (q) => (q ? getAggregationGroupTypeIndex(q) : null)],
+ series: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getSeries(q) : null),
+ ],
+ interval: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getInterval(q) : null),
+ ],
+ properties: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? q.properties : null),
+ ],
+ samplingFactor: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q && 'samplingFactor' in q ? q.samplingFactor : null),
+ ],
+ showAlertThresholdLines: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getShowAlertThresholdLines(q) : null),
+ ],
+ showAnnotations: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getShowAnnotations(q) : null),
+ ],
+ showLegend: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getShowLegend(q) : null),
+ ],
+ legendPosition: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getLegendPosition(q) : null),
+ ],
+ showValuesOnSeries: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getShowValuesOnSeries(q) : null),
+ ],
+ showPercentagesOnSeries: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getShowPercentagesOnSeries(q) : null),
+ ],
+ showLabelOnSeries: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getShowLabelsOnSeries(q) : null),
+ ],
+ showPercentStackView: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getShowPercentStackView(q) : null),
+ ],
+ yAxisScaleType: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getYAxisScaleType(q) : null),
+ ],
+ showMultipleYAxes: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getShowMultipleYAxes(q) : null),
+ ],
+ resultCustomizationBy: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getResultCustomizationBy(q) : null),
+ ],
+ aggregationGroupTypeIndex: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q ? getAggregationGroupTypeIndex(q) : null),
+ ],
labelGroupType: [
(s) => [s.aggregationGroupTypeIndex],
- (aggregationGroupTypeIndex): LabelGroupType => aggregationGroupTypeIndex ?? 'people',
+ (aggregationGroupTypeIndex: null | import('~/types').GroupTypeIndex | undefined): LabelGroupType =>
+ aggregationGroupTypeIndex ?? 'people',
],
goalLines: [
(s) => [s.querySource],
- (q) => (isTrendsQuery(q) || isFunnelsQuery(q) || isRetentionQuery(q) ? getGoalLines(q) : null),
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (isTrendsQuery(q) || isFunnelsQuery(q) || isRetentionQuery(q) ? getGoalLines(q) : null),
],
insightFilter: [
(s) => [s.querySource],
- (q) => (q && !isWebAnalyticsInsightQuery(q) ? filterForQuery(q) : null),
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (q && !isWebAnalyticsInsightQuery(q) ? filterForQuery(q) : null),
+ ],
+ trendsFilter: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (isTrendsQuery(q) ? q.trendsFilter : null),
],
- trendsFilter: [(s) => [s.querySource], (q) => (isTrendsQuery(q) ? q.trendsFilter : null)],
detailedResultsAggregationType: [
(s) => [s.querySource],
- (querySource): AggregationType | undefined => {
+ (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ): AggregationType | undefined => {
if (isTrendsQuery(querySource)) {
return querySource.trendsFilter?.detailedResultsAggregationType as AggregationType | undefined
}
},
],
- funnelsFilter: [(s) => [s.querySource], (q) => (isFunnelsQuery(q) ? q.funnelsFilter : null)],
- retentionFilter: [(s) => [s.querySource], (q) => (isRetentionQuery(q) ? q.retentionFilter : null)],
- pathsFilter: [(s) => [s.querySource], (q) => (isPathsQuery(q) ? q.pathsFilter : null)],
- stickinessFilter: [(s) => [s.querySource], (q) => (isStickinessQuery(q) ? q.stickinessFilter : null)],
- lifecycleFilter: [(s) => [s.querySource], (q) => (isLifecycleQuery(q) ? q.lifecycleFilter : null)],
- funnelPathsFilter: [(s) => [s.querySource], (q) => (isPathsQuery(q) ? q.funnelPathsFilter : null)],
+ funnelsFilter: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (isFunnelsQuery(q) ? q.funnelsFilter : null),
+ ],
+ retentionFilter: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (isRetentionQuery(q) ? q.retentionFilter : null),
+ ],
+ pathsFilter: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (isPathsQuery(q) ? q.pathsFilter : null),
+ ],
+ stickinessFilter: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (isStickinessQuery(q) ? q.stickinessFilter : null),
+ ],
+ lifecycleFilter: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (isLifecycleQuery(q) ? q.lifecycleFilter : null),
+ ],
+ funnelPathsFilter: [
+ (s) => [s.querySource],
+ (
+ q:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => (isPathsQuery(q) ? q.funnelPathsFilter : null),
+ ],
vizSpecificOptions: [(s) => [s.query], (q: Node) => (isInsightVizNode(q) ? q.vizSpecificOptions : null)],
isUsingSessionAnalysis: [
(s) => [s.series, s.breakdownFilter, s.properties],
- (series, breakdownFilter, properties) => {
+ (
+ series:
+ | (
+ | AnyEntityNode<AnyDataWarehouseNode>
+ | GroupNode<import('~/queries/schema/schema-general').DataWarehouseNode>
+ )[]
+ | null
+ | undefined,
+ breakdownFilter: BreakdownFilter | null | undefined,
+ properties:
+ | import('~/types').AnyPropertyFilter[]
+ | null
+ | import('~/types').PropertyGroupFilter
+ | undefined
+ ) => {
const using_session_breakdown =
breakdownFilter?.breakdown_type === 'session' ||
breakdownFilter?.breakdowns?.find((breakdown) => breakdown.type === 'session')
@@ -368,12 +2065,15 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
],
shouldShowSessionAnalysisWarning: [
(s) => [s.isUsingSessionAnalysis, s.query],
- (isUsingSessionAnalysis, query) =>
- isUsingSessionAnalysis && !(isInsightVizNode(query) && query.suppressSessionAnalysisWarning),
+ (
+ isUsingSessionAnalysis: boolean | import('~/queries/schema/schema-general').Breakdown,
+ query: Node | null
+ ) => isUsingSessionAnalysis && !(isInsightVizNode(query) && query.suppressSessionAnalysisWarning),
],
isNonTimeSeriesDisplay: [
(s) => [s.display],
- (display) => !!display && NON_TIME_SERIES_DISPLAY_TYPES.includes(display),
+ (display: ChartDisplayType | null | undefined) =>
+ !!display && NON_TIME_SERIES_DISPLAY_TYPES.includes(display),
],
// Whether the insight will produce a single visual output (one line/bar).
@@ -398,7 +2098,7 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
],
isBreakdownSeries: [
(s) => [s.breakdownFilter],
- (breakdownFilter): boolean => {
+ (breakdownFilter: BreakdownFilter | null | undefined): boolean => {
return !!breakdownFilter?.breakdown || (breakdownFilter?.breakdowns?.length ?? 0) > 0
},
],
@@ -425,11 +2125,27 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
hasDataWarehouseSeries: [
(s) => [s.series],
- (series): boolean => (series || []).length > 0 && !!series?.some((node) => isAnyDataWarehouseNode(node)),
+ (
+ series:
+ | (
+ | AnyEntityNode<AnyDataWarehouseNode>
+ | GroupNode<import('~/queries/schema/schema-general').DataWarehouseNode>
+ )[]
+ | null
+ | undefined
+ ): boolean => (series || []).length > 0 && !!series?.some((node) => isAnyDataWarehouseNode(node)),
],
hasOnlyDataWarehouseSeries: [
(s) => [s.series],
- (series): boolean => {
+ (
+ series:
+ | (
+ | AnyEntityNode<AnyDataWarehouseNode>
+ | GroupNode<import('~/queries/schema/schema-general').DataWarehouseNode>
+ )[]
+ | null
+ | undefined
+ ): boolean => {
return !!series && series.length > 0 && series.every((node) => isAnyDataWarehouseNode(node))
},
],
@@ -444,12 +2160,22 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
s.dataWarehouseTablesMap,
],
(
- series,
- isSingleSeriesOutput,
- isTrends,
- hasDataWarehouseSeries,
- isBreakdownSeries,
- dataWarehouseTablesMap
+ series:
+ | (
+ | AnyEntityNode<AnyDataWarehouseNode>
+ | GroupNode<import('~/queries/schema/schema-general').DataWarehouseNode>
+ )[]
+ | null
+ | undefined,
+ isSingleSeriesOutput: boolean,
+ isTrends: boolean,
+ hasDataWarehouseSeries: boolean,
+ isBreakdownSeries: boolean,
+ dataWarehouseTablesMap: Record<
+ string,
+ | import('~/queries/schema/schema-general').DatabaseSchemaDataWarehouseTable
+ | import('~/queries/schema/schema-general').DatabaseSchemaViewTable
+ >
): DatabaseSchemaField[] => {
if (!hasDataWarehouseSeries || (isTrends && !isSingleSeriesOutput && !isBreakdownSeries)) {
return []
@@ -465,7 +2191,12 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
valueOnSeries: [
(s) => [s.isTrends, s.isStickiness, s.isLifecycle, s.insightFilter],
- (isTrends, isStickiness, isLifecycle, insightFilter): boolean => {
+ (
+ isTrends: boolean,
+ isStickiness: boolean,
+ isLifecycle: boolean,
+ insightFilter: InsightFilter | null | undefined
+ ): boolean => {
return !!(
((isTrends || isStickiness || isLifecycle) &&
(insightFilter as TrendsFilter)?.showValuesOnSeries) ||
@@ -478,7 +2209,12 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
hasLegend: [
(s) => [s.isTrends, s.isStickiness, s.isLifecycle, s.display],
- (isTrends, isStickiness, isLifecycle, display) =>
+ (
+ isTrends: boolean,
+ isStickiness: boolean,
+ isLifecycle: boolean,
+ display: ChartDisplayType | null | undefined
+ ) =>
(isTrends || isStickiness || isLifecycle) &&
!(display && DISPLAY_TYPES_WITHOUT_LEGEND.includes(display)),
],
@@ -488,7 +2224,13 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
// InsightDisplayConfig (which control to show) and InsightVizDisplay (suppress side legend).
usesInChartLegend: [
(s) => [s.featureFlags, s.isTrends, s.isStickiness, s.isLifecycle, s.display],
- (featureFlags, isTrends, isStickiness, isLifecycle, display): boolean => {
+ (
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet,
+ isTrends: boolean,
+ isStickiness: boolean,
+ isLifecycle: boolean,
+ display: ChartDisplayType | null | undefined
+ ): boolean => {
// Lifecycle always uses config.legend inside TimeSeriesBarChart — no flag gate needed.
if (isLifecycle) {
return true
@@ -518,12 +2260,23 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
activeUsersMath: [
(s) => [s.series],
- (series): BaseMathType.MonthlyActiveUsers | BaseMathType.WeeklyActiveUsers | null =>
- getActiveUsersMath(series),
+ (
+ series:
+ | (
+ | AnyEntityNode<AnyDataWarehouseNode>
+ | GroupNode<import('~/queries/schema/schema-general').DataWarehouseNode>
+ )[]
+ | null
+ | undefined
+ ): BaseMathType.MonthlyActiveUsers | BaseMathType.WeeklyActiveUsers | null => getActiveUsersMath(series),
],
enabledIntervals: [
(s) => [s.activeUsersMath, s.isTrends, s.featureFlags],
- (activeUsersMath, isTrends, featureFlags): Intervals => {
+ (
+ activeUsersMath: BaseMathType.MonthlyActiveUsers | BaseMathType.WeeklyActiveUsers | null,
+ isTrends: boolean,
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet
+ ): Intervals => {
const enabledIntervals: Intervals = { ...intervals }
if (featureFlags[FEATURE_FLAGS.PRODUCT_ANALYTICS_QUARTER_YEAR_INTERVALS]) {
@@ -570,36 +2323,73 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
erroredQueryId: [
(s) => [s.insightDataError],
- (insightDataError) => {
+ (insightDataError: Record<string, any> | null) => {
return insightDataError?.queryId || null
},
],
validationError: [
(s) => [s.insightDataError],
- (insightDataError): string | null => extractValidationError(insightDataError),
+ (insightDataError: Record<string, any> | null): string | null => extractValidationError(insightDataError),
],
validationErrorCode: [
(s) => [s.insightDataError],
- (insightDataError): string | null => extractValidationErrorCode(insightDataError),
+ (insightDataError: Record<string, any> | null): string | null =>
+ extractValidationErrorCode(insightDataError),
],
- timezone: [(s) => [s.insightData], (insightData) => insightData?.timezone || 'UTC'],
+ timezone: [(s) => [s.insightData], (insightData: Record<string, any>) => insightData?.timezone || 'UTC'],
// all events used in the insight (useful for fetching only relevant property definitions)
allEventNames: [
(s) => [s.querySource, actionsModel.selectors.actions],
- (querySource, actions) => (querySource ? getAllEventNames(querySource, actions) : []),
+ (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery,
+ actions: import('~/types').ActionType[]
+ ) => (querySource ? getAllEventNames(querySource, actions) : []),
],
theme: [
(s) => [s.getTheme, s.querySource],
- (getTheme, querySource) =>
- getTheme(querySource && 'dataColorTheme' in querySource ? querySource.dataColorTheme : undefined),
+ (
+ getTheme: (
+ themeId: number | string | null | undefined
+ ) => null | import('../../lib/colors').DataColorTheme,
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => getTheme(querySource && 'dataColorTheme' in querySource ? querySource.dataColorTheme : undefined),
],
isAllEventsQuery: [
(s) => [s.querySource],
- (querySource) => {
+ (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => {
return (
(querySource?.kind === NodeKind.TrendsQuery || querySource?.kind === NodeKind.FunnelsQuery) &&
querySource?.series?.some((s: { name?: string }) => s.name === 'All events')
@@ -608,7 +2398,18 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
],
isFirstTimeForUserQuery: [
(s) => [s.querySource],
- (querySource) => {
+ (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => {
return (
querySource?.kind === NodeKind.TrendsQuery &&
querySource?.series?.some((s: { math?: string }) =>
@@ -619,7 +2420,18 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
],
isStrictFunnelQuery: [
(s) => [s.querySource],
- (querySource) => {
+ (
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | null
+ | import('~/queries/schema/schema-general').PathsQuery
+ | import('~/queries/schema/schema-general').WebOverviewQuery
+ | import('~/queries/schema/schema-general').WebStatsTableQuery
+ ) => {
return (
querySource?.kind === NodeKind.FunnelsQuery &&
querySource?.funnelsFilter?.funnelOrderType === 'strict'
@@ -628,7 +2440,11 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
],
slowQueryPossibilities: [
(s) => [s.isAllEventsQuery, s.isFirstTimeForUserQuery, s.isStrictFunnelQuery],
- (isAllEventsQuery, isFirstTimeForUserQuery, isStrictFunnelQuery): SlowQueryPossibilities[] => {
+ (
+ isAllEventsQuery: boolean,
+ isFirstTimeForUserQuery: boolean,
+ isStrictFunnelQuery: boolean
+ ): SlowQueryPossibilities[] => {
const possibilities: SlowQueryPossibilities[] = []
if (isAllEventsQuery) {
possibilities.push('all_events')
diff --git a/frontend/src/scenes/insights/views/BoxPlot/boxPlotChartLogic.tsx b/frontend/src/scenes/insights/views/BoxPlot/boxPlotChartLogic.tsx
index 72b7a62c8587..b623c5885500 100644
--- a/frontend/src/scenes/insights/views/BoxPlot/boxPlotChartLogic.tsx
+++ b/frontend/src/scenes/insights/views/BoxPlot/boxPlotChartLogic.tsx
@@ -1,12 +1,23 @@
-import { connect, kea, key, path, props, selectors } from 'kea'
+import { MakeLogicType, connect, kea, key, path, props, selectors } from 'kea'
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
import { BoxPlotDatum } from '~/queries/schema/schema-general'
import { InsightLogicProps } from '~/types'
+import type {
+ FunnelsQuery,
+ LifecycleQuery,
+ PathsQuery,
+ RetentionQuery,
+ StickinessQuery,
+ TrendsFilter,
+ TrendsQuery,
+ WebOverviewQuery,
+ WebStatsTableQuery,
+} from '../../../../queries/schema/schema-general'
+import type { IntervalType } from '../../../../types'
import { keyForInsightLogicProps } from '../../sharedUtils'
-import type { boxPlotChartLogicType } from './boxPlotChartLogicType'
export interface BoxPlotChartDatum {
min: number
@@ -26,6 +37,42 @@ export interface BoxPlotSeriesData {
rawData: BoxPlotDatum[]
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface boxPlotChartLogicValues {
+ insightData: Record<string, any> // insightVizDataLogic
+ interval: IntervalType | null | undefined // insightVizDataLogic
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null // insightVizDataLogic
+ trendsFilter: TrendsFilter | null | undefined // insightVizDataLogic
+ yAxisScaleType: string | null | undefined // insightVizDataLogic
+ boxplotData: BoxPlotDatum[]
+ dateLabels: string[]
+ seriesGroups: BoxPlotSeriesData[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface boxPlotChartLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ boxplotData: (insightData: Record<string, any>) => BoxPlotDatum[]
+ seriesGroups: (
+ boxplotData: BoxPlotDatum[],
+ trendsFilter: TrendsFilter | null | undefined
+ ) => BoxPlotSeriesData[]
+ dateLabels: (seriesGroups: BoxPlotSeriesData[]) => string[]
+ }
+}
+
+export type boxPlotChartLogicType = MakeLogicType<boxPlotChartLogicValues, {}, InsightLogicProps, boxPlotChartLogicMeta>
+
export const boxPlotChartLogic = kea<boxPlotChartLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps('new')),
@@ -39,7 +86,7 @@ export const boxPlotChartLogic = kea<boxPlotChartLogicType>([
selectors({
boxplotData: [
(s) => [s.insightData],
- (insightData): BoxPlotDatum[] => {
+ (insightData: Record<string, any>): BoxPlotDatum[] => {
const result = insightData?.result ?? insightData?.results
// TODO: remove boxplot_data fallback once cached responses have rotated (added 2026-04-16)
const data = Array.isArray(result) && result.length > 0 ? result : insightData?.boxplot_data
@@ -51,7 +98,10 @@ export const boxPlotChartLogic = kea<boxPlotChartLogicType>([
],
seriesGroups: [
(s) => [s.boxplotData, s.trendsFilter],
- (boxplotData: BoxPlotDatum[], trendsFilter): BoxPlotSeriesData[] => {
+ (
+ boxplotData: BoxPlotDatum[],
+ trendsFilter: null | import('~/queries/schema/schema-general').TrendsFilter | undefined
+ ): BoxPlotSeriesData[] => {
const excludeOutliers = trendsFilter?.excludeBoxPlotOutliers !== false
const groupMap = new Map<number, { label: string; data: BoxPlotDatum[] }>()
diff --git a/frontend/src/scenes/insights/views/CalendarHeatMap/calendarHeatMapLogic.tsx b/frontend/src/scenes/insights/views/CalendarHeatMap/calendarHeatMapLogic.tsx
index 7c3ac1cfd77f..81199a9fe9d0 100644
--- a/frontend/src/scenes/insights/views/CalendarHeatMap/calendarHeatMapLogic.tsx
+++ b/frontend/src/scenes/insights/views/CalendarHeatMap/calendarHeatMapLogic.tsx
@@ -1,12 +1,28 @@
-import { actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
import { teamLogic } from 'scenes/teamLogic'
import { InsightLogicProps, TrendResult } from '~/types'
+import type { DataColorTheme } from '../../../../lib/colors'
+import type {
+ AnyDataWarehouseNode,
+ AnyEntityNode,
+ BreakdownFilter,
+ DataWarehouseNode,
+ FunnelsQuery,
+ GroupNode,
+ LifecycleQuery,
+ PathsQuery,
+ RetentionQuery,
+ StickinessQuery,
+ TrendsFilter,
+ TrendsQuery,
+ WebOverviewQuery,
+ WebStatsTableQuery,
+} from '../../../../queries/schema/schema-general'
import { keyForInsightLogicProps } from '../../sharedUtils'
-import type { calendarHeatMapLogicType } from './calendarHeatMapLogicType'
import { DaysAbbreviated, HoursAbbreviated } from './utils'
export interface CalendarHeatMapProcessedData {
@@ -22,6 +38,71 @@ export interface CalendarHeatMapProcessedData {
minColumnAggregation: number
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface calendarHeatMapLogicValues {
+ breakdownFilter: BreakdownFilter | null | undefined // insightVizDataLogic
+ insightData: Record<string, any> // insightVizDataLogic
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null // insightVizDataLogic
+ series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined // insightVizDataLogic
+ theme: DataColorTheme | null // insightVizDataLogic
+ trendsFilter: TrendsFilter | null | undefined // insightVizDataLogic
+ weekStartDay: number // teamLogic
+ columnLabels: string[]
+ currentTooltip: [number, number, number] | null
+ isTooltipShown: boolean
+ processedData: CalendarHeatMapProcessedData
+ rowLabels: string[]
+ tooltipCoordinates: [number, number] | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface calendarHeatMapLogicActions {
+ hideTooltip: () => {
+ value: true
+ }
+ showTooltip: (
+ row: number,
+ column: number,
+ value: number
+ ) => {
+ column: number
+ row: number
+ value: number
+ }
+ updateTooltipCoordinates: (
+ x: number,
+ y: number
+ ) => {
+ x: number
+ y: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface calendarHeatMapLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ processedData: (insightData: Record<string, any>, weekStartDay: number) => CalendarHeatMapProcessedData
+ rowLabels: (weekStartDay: number) => string[]
+ }
+}
+
+export type calendarHeatMapLogicType = MakeLogicType<
+ calendarHeatMapLogicValues,
+ calendarHeatMapLogicActions,
+ InsightLogicProps,
+ calendarHeatMapLogicMeta
+>
+
export const calendarHeatMapLogic = kea<calendarHeatMapLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps('new')),
@@ -63,7 +144,7 @@ export const calendarHeatMapLogic = kea<calendarHeatMapLogicType>([
selectors({
processedData: [
(s) => [s.insightData, s.weekStartDay],
- (insightData, weekStartDay): CalendarHeatMapProcessedData => {
+ (insightData: Record<string, any>, weekStartDay: number): CalendarHeatMapProcessedData => {
// Default empty data structure
const emptyData = {
matrix: Array(7)
@@ -193,7 +274,7 @@ export const calendarHeatMapLogic = kea<calendarHeatMapLogicType>([
],
rowLabels: [
(s) => [s.weekStartDay],
- (weekStartDay): string[] => {
+ (weekStartDay: number): string[] => {
return Array.from({ length: DaysAbbreviated.values.length }, (_, i) => {
const adjustedDay = (i + weekStartDay) % DaysAbbreviated.values.length
return DaysAbbreviated.values[adjustedDay]
diff --git a/frontend/src/scenes/insights/views/InsightsTable/insightsTableDataLogic.ts b/frontend/src/scenes/insights/views/InsightsTable/insightsTableDataLogic.ts
index 0be48f09b35b..688432b68e20 100644
--- a/frontend/src/scenes/insights/views/InsightsTable/insightsTableDataLogic.ts
+++ b/frontend/src/scenes/insights/views/InsightsTable/insightsTableDataLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'
@@ -7,7 +7,13 @@ import { IndexedTrendResult } from 'scenes/trends/types'
import { ChartDisplayType, CompareLabelType, InsightLogicProps } from '~/types'
-import type { insightsTableDataLogicType } from './insightsTableDataLogicType'
+import type {
+ AnyDataWarehouseNode,
+ AnyEntityNode,
+ CompareFilter,
+ DataWarehouseNode,
+ GroupNode,
+} from '../../../../queries/schema/schema-general'
export enum AggregationType {
Total = 'total',
@@ -19,6 +25,71 @@ export function compareResultKey(item: IndexedTrendResult): string {
return JSON.stringify([item.action?.order ?? 0, item.label ?? '', item.breakdown_value ?? ''])
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightsTableDataLogicValues {
+ display: ChartDisplayType | null | undefined // insightVizDataLogic
+ isTrends: boolean // insightVizDataLogic
+ persistedAggregationType: AggregationType | undefined // insightVizDataLogic
+ series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined // insightVizDataLogic
+ compareFilter: CompareFilter | null | undefined // trendsDataLogic
+ indexedResults: IndexedTrendResult[] // trendsDataLogic
+ aggregation: AggregationType
+ allowAggregation: boolean
+ displayResults: IndexedTrendResult[]
+ getPreviousResult: (item: IndexedTrendResult) => IndexedTrendResult | undefined
+ isColumnPinned: (columnKey: string) => boolean
+ pinnedBreakdownColumns: string[]
+ pinnedColumns: string[]
+ previousResultMap: Map<string, IndexedTrendResult>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightsTableDataLogicActions {
+ setDetailedResultsAggregationType: (detailedResultsAggregationType: AggregationType) => {
+ detailedResultsAggregationType: AggregationType
+ } // insightVizDataLogic
+ toggleColumnPin: (columnKey: string) => {
+ columnKey: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightsTableDataLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ pinnedColumns: (pinnedBreakdownColumns: string[]) => string[]
+ isColumnPinned: (pinnedBreakdownColumns: string[]) => (columnKey: string) => boolean
+ allowAggregation: (
+ isTrends: boolean,
+ display: ChartDisplayType | null | undefined,
+ series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined
+ ) => boolean
+ aggregation: (
+ series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined,
+ persistedAggregationType: AggregationType | undefined
+ ) => AggregationType
+ previousResultMap: (
+ compareFilter: CompareFilter | null | undefined,
+ indexedResults: IndexedTrendResult[]
+ ) => Map<string, IndexedTrendResult>
+ getPreviousResult: (
+ compareFilter: CompareFilter | null | undefined,
+ previousResultMap: Map<string, IndexedTrendResult>
+ ) => (item: IndexedTrendResult) => IndexedTrendResult | undefined
+ displayResults: (
+ compareFilter: CompareFilter | null | undefined,
+ indexedResults: IndexedTrendResult[]
+ ) => IndexedTrendResult[]
+ }
+}
+
+export type insightsTableDataLogicType = MakeLogicType<
+ insightsTableDataLogicValues,
+ insightsTableDataLogicActions,
+ InsightLogicProps,
+ insightsTableDataLogicMeta
+>
+
export const insightsTableDataLogic = kea<insightsTableDataLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps('new')),
@@ -56,13 +127,13 @@ export const insightsTableDataLogic = kea<insightsTableDataLogicType>([
selectors({
pinnedColumns: [
(s) => [s.pinnedBreakdownColumns],
- (pinnedBreakdownColumns): string[] => {
+ (pinnedBreakdownColumns: string[]): string[] => {
return ['label', ...pinnedBreakdownColumns]
},
],
isColumnPinned: [
(s) => [s.pinnedBreakdownColumns],
- (pinnedBreakdownColumns) =>
+ (pinnedBreakdownColumns: string[]) =>
(columnKey: string): boolean => {
return pinnedBreakdownColumns.includes(columnKey)
},
@@ -72,7 +143,21 @@ export const insightsTableDataLogic = kea<insightsTableDataLogicType>([
* Except when view type is Table or WorldMap */
allowAggregation: [
(s) => [s.isTrends, s.display, s.series],
- (isTrends, display, series) => {
+ (
+ isTrends: boolean,
+ display: ChartDisplayType | null | undefined,
+ series:
+ | (
+ | import('../../../../queries/schema').AnyEntityNode<
+ import('../../../../queries/schema').AnyDataWarehouseNode
+ >
+ | import('../../../../queries/schema').GroupNode<
+ import('../../../../queries/schema').DataWarehouseNode
+ >
+ )[]
+ | null
+ | undefined
+ ) => {
if (isTrends && (display === ChartDisplayType.ActionsTable || display === ChartDisplayType.WorldMap)) {
return true
}
@@ -82,7 +167,20 @@ export const insightsTableDataLogic = kea<insightsTableDataLogicType>([
],
aggregation: [
(s) => [s.series, s.persistedAggregationType],
- (series, persistedAggregationType) => {
+ (
+ series:
+ | (
+ | import('../../../../queries/schema').AnyEntityNode<
+ import('../../../../queries/schema').AnyDataWarehouseNode
+ >
+ | import('../../../../queries/schema').GroupNode<
+ import('../../../../queries/schema').DataWarehouseNode
+ >
+ )[]
+ | null
+ | undefined,
+ persistedAggregationType: AggregationType | undefined
+ ) => {
if (persistedAggregationType) {
return persistedAggregationType
}
@@ -93,7 +191,10 @@ export const insightsTableDataLogic = kea<insightsTableDataLogicType>([
],
previousResultMap: [
(s) => [s.compareFilter, s.indexedResults],
- (compareFilter, indexedResults): Map<string, IndexedTrendResult> => {
+ (
+ compareFilter: null | import('../../../../queries/schema').CompareFilter | undefined,
+ indexedResults: IndexedTrendResult[]
+ ): Map<string, IndexedTrendResult> => {
if (!compareFilter?.compare) {
return new Map()
}
@@ -108,7 +209,10 @@ export const insightsTableDataLogic = kea<insightsTableDataLogicType>([
],
getPreviousResult: [
(s) => [s.compareFilter, s.previousResultMap],
- (compareFilter, previousResultMap) =>
+ (
+ compareFilter: null | import('../../../../queries/schema').CompareFilter | undefined,
+ previousResultMap: Map<string, IndexedTrendResult>
+ ) =>
(item: IndexedTrendResult): IndexedTrendResult | undefined => {
if (!compareFilter?.compare) {
return undefined
@@ -118,7 +222,10 @@ export const insightsTableDataLogic = kea<insightsTableDataLogicType>([
],
displayResults: [
(s) => [s.compareFilter, s.indexedResults],
- (compareFilter, indexedResults): IndexedTrendResult[] => {
+ (
+ compareFilter: null | import('../../../../queries/schema').CompareFilter | undefined,
+ indexedResults: IndexedTrendResult[]
+ ): IndexedTrendResult[] => {
if (compareFilter?.compare) {
return indexedResults.filter((r) => r.compare_label === CompareLabelType.Current)
}
diff --git a/frontend/src/scenes/insights/views/RegionMap/regionMapLogic.tsx b/frontend/src/scenes/insights/views/RegionMap/regionMapLogic.tsx
index 22efc3d37873..5861d2fe17ac 100644
--- a/frontend/src/scenes/insights/views/RegionMap/regionMapLogic.tsx
+++ b/frontend/src/scenes/insights/views/RegionMap/regionMapLogic.tsx
@@ -1,11 +1,27 @@
-import { actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
import { InsightLogicProps, TrendResult } from '~/types'
+import type { DataColorTheme } from '../../../../lib/colors'
+import type {
+ AnyDataWarehouseNode,
+ AnyEntityNode,
+ BreakdownFilter,
+ DataWarehouseNode,
+ FunnelsQuery,
+ GroupNode,
+ LifecycleQuery,
+ PathsQuery,
+ RetentionQuery,
+ StickinessQuery,
+ TrendsFilter,
+ TrendsQuery,
+ WebOverviewQuery,
+ WebStatsTableQuery,
+} from '../../../../queries/schema/schema-general'
import { keyForInsightLogicProps } from '../../sharedUtils'
-import type { regionMapLogicType } from './regionMapLogicType'
const getTrendResults = (insightData: Record<string, any> | null | undefined): TrendResult[] =>
Array.isArray(insightData?.result) ? (insightData.result as TrendResult[]) : []
@@ -13,6 +29,71 @@ const getTrendResults = (insightData: Record<string, any> | null | undefined): T
const getSeriesValue = (series: TrendResult | null | undefined): number =>
series?.aggregated_value ?? series?.count ?? 0
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface regionMapLogicValues {
+ breakdownFilter: BreakdownFilter | null | undefined // insightVizDataLogic
+ insightData: Record<string, any> // insightVizDataLogic
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null // insightVizDataLogic
+ series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined // insightVizDataLogic
+ theme: DataColorTheme | null // insightVizDataLogic
+ trendsFilter: TrendsFilter | null | undefined // insightVizDataLogic
+ currentTooltip: [string, string, string, TrendResult | null] | null
+ isTooltipShown: boolean
+ maxAggregatedValue: number
+ subdivisionCodeToSeries: Record<string, TrendResult>
+ tooltipCoordinates: [number, number] | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface regionMapLogicActions {
+ hideTooltip: () => {
+ value: true
+ }
+ showTooltip: (
+ regionCode: string,
+ regionName: string,
+ countryCode: string,
+ regionSeries: TrendResult | null
+ ) => {
+ countryCode: string
+ regionCode: string
+ regionName: string
+ regionSeries: TrendResult | null
+ }
+ updateTooltipCoordinates: (
+ x: number,
+ y: number
+ ) => {
+ x: number
+ y: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface regionMapLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ subdivisionCodeToSeries: (insightData: Record<string, any>) => Record<string, TrendResult>
+ maxAggregatedValue: (insightData: Record<string, any>) => number
+ }
+}
+
+export type regionMapLogicType = MakeLogicType<
+ regionMapLogicValues,
+ regionMapLogicActions,
+ InsightLogicProps,
+ regionMapLogicMeta
+>
+
export const regionMapLogic = kea<regionMapLogicType>([
props({} as InsightLogicProps),
key(keyForInsightLogicProps('new')),
@@ -62,7 +143,7 @@ export const regionMapLogic = kea<regionMapLogicType>([
selectors({
subdivisionCodeToSeries: [
(s) => [s.insightData],
- (insightData): Record<string, TrendResult> => {
+ (insightData: Record<string, any>): Record<string, TrendResult> => {
const results = getTrendResults(insightData)
if (results.length === 0) {
return {}
@@ -83,7 +164,7 @@ export const regionMapLogic = kea<regionMapLogicType>([
],
maxAggregatedValue: [
(s) => [s.insightData],
- (insightData) => {
+ (insightData: Record<string, any>) => {
return getTrendResults(insightData).reduce((max, series) => Math.max(max, getSeriesValue(series)), 0)
},
],
diff --git a/frontend/src/scenes/insights/views/WorldMap/worldMapLogic.tsx b/frontend/src/scenes/insights/views/WorldMap/worldMapLogic.tsx
index beb4a7471c36..2e9bdb1dc5ec 100644
--- a/frontend/src/scenes/insights/views/WorldMap/worldMapLogic.tsx
+++ b/frontend/src/scenes/insights/views/WorldMap/worldMapLogic.tsx
@@ -1,11 +1,88 @@
-import { actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
import { InsightLogicProps, TrendResult } from '~/types'
+import type { DataColorTheme } from '../../../../lib/colors'
+import type {
+ AnyDataWarehouseNode,
+ AnyEntityNode,
+ BreakdownFilter,
+ DataWarehouseNode,
+ FunnelsQuery,
+ GroupNode,
+ LifecycleQuery,
+ PathsQuery,
+ RetentionQuery,
+ StickinessQuery,
+ TrendsFilter,
+ TrendsQuery,
+ WebOverviewQuery,
+ WebStatsTableQuery,
+} from '../../../../queries/schema/schema-general'
import { keyForInsightLogicProps } from '../../sharedUtils'
-import type { worldMapLogicType } from './worldMapLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface worldMapLogicValues {
+ breakdownFilter: BreakdownFilter | null | undefined // insightVizDataLogic
+ insightData: Record<string, any> // insightVizDataLogic
+ querySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null // insightVizDataLogic
+ series: (AnyEntityNode<AnyDataWarehouseNode> | GroupNode<DataWarehouseNode>)[] | null | undefined // insightVizDataLogic
+ theme: DataColorTheme | null // insightVizDataLogic
+ trendsFilter: TrendsFilter | null | undefined // insightVizDataLogic
+ countryCodeToSeries: Record<string, TrendResult>
+ currentTooltip: [string, TrendResult | null] | null
+ isTooltipShown: boolean
+ maxAggregatedValue: number
+ tooltipCoordinates: [number, number] | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface worldMapLogicActions {
+ hideTooltip: () => {
+ value: true
+ }
+ showTooltip: (
+ countryCode: string,
+ countrySeries: TrendResult | null
+ ) => {
+ countryCode: string
+ countrySeries: TrendResult | null
+ }
+ updateTooltipCoordinates: (
+ x: number,
+ y: number
+ ) => {
+ x: number
+ y: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface worldMapLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ countryCodeToSeries: (insightData: Record<string, any>) => Record<string, TrendResult>
+ maxAggregatedValue: (insightData: Record<string, any>) => number
+ }
+}
+
+export type worldMapLogicType = MakeLogicType<
+ worldMapLogicValues,
+ worldMapLogicActions,
+ InsightLogicProps,
+ worldMapLogicMeta
+>
export const worldMapLogic = kea<worldMapLogicType>([
props({} as InsightLogicProps),
@@ -46,7 +123,7 @@ export const worldMapLogic = kea<worldMapLogicType>([
selectors({
countryCodeToSeries: [
(s) => [s.insightData],
- (insightData): Record<string, TrendResult> =>
+ (insightData: Record<string, any>): Record<string, TrendResult> =>
Object.fromEntries(
Array.isArray(insightData?.result)
? (insightData?.result as TrendResult[]).map((series) => [series.breakdown_value, series])
@@ -55,7 +132,7 @@ export const worldMapLogic = kea<worldMapLogicType>([
],
maxAggregatedValue: [
(s) => [s.insightData],
- (insightData) =>
+ (insightData: Record<string, any>) =>
Array.isArray(insightData?.result)
? Math.max(...(insightData?.result as TrendResult[]).map((series) => series.aggregated_value))
: 0,
diff --git a/frontend/src/scenes/marketing-analytics/Onboarding/marketingOnboardingLogic.ts b/frontend/src/scenes/marketing-analytics/Onboarding/marketingOnboardingLogic.ts
index 83c89069aaf5..155f1c0eac8d 100644
--- a/frontend/src/scenes/marketing-analytics/Onboarding/marketingOnboardingLogic.ts
+++ b/frontend/src/scenes/marketing-analytics/Onboarding/marketingOnboardingLogic.ts
@@ -1,12 +1,51 @@
-import { actions, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, listeners, path, reducers, selectors } from 'kea'
import { MARKETING_ONBOARDING_STORAGE_KEYS } from './constants'
-import type { marketingOnboardingLogicType } from './marketingOnboardingLogicType'
export type MarketingOnboardingStep = 'welcome' | 'add-source' | 'conversion-goals' | 'done'
const STEP_ORDER: MarketingOnboardingStep[] = ['welcome', 'add-source', 'conversion-goals', 'done']
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface marketingOnboardingLogicValues {
+ currentStep: MarketingOnboardingStep
+ isLastStep: boolean
+ showOnboarding: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface marketingOnboardingLogicActions {
+ completeOnboarding: () => {
+ value: true
+ }
+ goToNextStep: () => {
+ value: true
+ }
+ resetOnboarding: () => {
+ value: true
+ }
+ setShowOnboarding: (show: boolean) => {
+ show: boolean
+ }
+ setStep: (step: MarketingOnboardingStep) => {
+ step: MarketingOnboardingStep
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface marketingOnboardingLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isLastStep: (currentStep: MarketingOnboardingStep) => boolean
+ }
+}
+
+export type marketingOnboardingLogicType = MakeLogicType<
+ marketingOnboardingLogicValues,
+ marketingOnboardingLogicActions,
+ Record<string, any>,
+ marketingOnboardingLogicMeta
+>
+
export const marketingOnboardingLogic = kea<marketingOnboardingLogicType>([
path(['scenes', 'marketing-analytics', 'Onboarding', 'marketingOnboardingLogic']),
@@ -42,7 +81,10 @@ export const marketingOnboardingLogic = kea<marketingOnboardingLogicType>([
}),
selectors({
- isLastStep: [(s) => [s.currentStep], (currentStep): boolean => currentStep === 'conversion-goals'],
+ isLastStep: [
+ (s) => [s.currentStep],
+ (currentStep: MarketingOnboardingStep): boolean => currentStep === 'conversion-goals',
+ ],
}),
listeners(({ actions, values }) => ({
diff --git a/frontend/src/scenes/paths/PathNodeCardButton.tsx b/frontend/src/scenes/paths/PathNodeCardButton.tsx
index ecf5fd030149..9737943337c9 100644
--- a/frontend/src/scenes/paths/PathNodeCardButton.tsx
+++ b/frontend/src/scenes/paths/PathNodeCardButton.tsx
@@ -11,7 +11,7 @@ import { userLogic } from 'scenes/userLogic'
import { PathsFilter } from '~/queries/schema/schema-general'
import { AvailableFeature } from '~/types'
-import { pathsDataLogicType } from './pathsDataLogicType'
+import type { pathsDataLogicType } from './pathsDataLogic'
import { PathNodeData, pageUrl } from './pathUtils'
type PathNodeCardButton = {
diff --git a/frontend/src/scenes/paths/PathNodeCardMenu.tsx b/frontend/src/scenes/paths/PathNodeCardMenu.tsx
index 7d2fcc54eb5b..9fee51ecdfe9 100644
--- a/frontend/src/scenes/paths/PathNodeCardMenu.tsx
+++ b/frontend/src/scenes/paths/PathNodeCardMenu.tsx
@@ -7,7 +7,7 @@ import { IconTrendingFlat, IconTrendingFlatDown } from 'lib/lemon-ui/icons'
import { humanFriendlyDuration } from 'lib/utils/durations'
import { PATH_NODE_CARD_WIDTH } from './constants'
-import { pathsDataLogicType } from './pathsDataLogicType'
+import type { pathsDataLogicType } from './pathsDataLogic'
type PathNodeCardMenuProps = {
name: string
diff --git a/frontend/src/scenes/paths/pathsDataLogic.ts b/frontend/src/scenes/paths/pathsDataLogic.ts
index 1b5c6bf12b04..056161905190 100644
--- a/frontend/src/scenes/paths/pathsDataLogic.ts
+++ b/frontend/src/scenes/paths/pathsDataLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, selectors } from 'kea'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
@@ -15,7 +15,23 @@ import { InsightActorsQuery, InsightVizNode, NodeKind, PathsLink, PathsQuery } f
import { isPathsQuery } from '~/queries/utils'
import { ActionFilter, InsightLogicProps, PathType, PropertyFilterType, PropertyOperator } from '~/types'
-import type { pathsDataLogicType } from './pathsDataLogicType'
+import type { DataColorTheme } from '../../lib/colors'
+import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
+import type {
+ DataNode,
+ DateRange,
+ FunnelPathsFilter,
+ FunnelsQuery,
+ InsightFilter,
+ LifecycleQuery,
+ PathsFilter,
+ RetentionQuery,
+ StickinessQuery,
+ TrendsQuery,
+ WebOverviewQuery,
+ WebStatsTableQuery,
+} from '../../queries/schema/schema-general'
+import type { QuerySourceUpdate } from '../insights/insightVizDataLogic'
import { PathNodeData } from './pathUtils'
import { Paths, PathsNode } from './types'
@@ -50,6 +66,67 @@ export const DEFAULT_STEP_LIMIT = 5
const DEFAULT_PATH_LOGIC_KEY = 'default_path_key'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface pathsDataLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ dateRange: DateRange | null | undefined // insightVizDataLogic
+ funnelPathsFilter: FunnelPathsFilter | null | undefined // insightVizDataLogic
+ insightData: Record<string, any> // insightVizDataLogic
+ insightDataError: Record<string, any> | null // insightVizDataLogic
+ insightDataLoading: boolean // insightVizDataLogic
+ insightQuery: DataNode<Record<string, any>> // insightVizDataLogic
+ pathsFilter: PathsFilter | null // insightVizDataLogic
+ theme: DataColorTheme | null // insightVizDataLogic
+ vizQuerySource:
+ | FunnelsQuery
+ | LifecycleQuery
+ | PathsQuery
+ | RetentionQuery
+ | StickinessQuery
+ | TrendsQuery
+ | WebOverviewQuery
+ | WebStatsTableQuery
+ | null // insightVizDataLogic
+ paths: Paths
+ results: PathsLink[]
+ taxonomicGroupTypes: TaxonomicFilterGroupType[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface pathsDataLogicActions {
+ updateInsightFilter: (insightFilter: InsightFilter) => {
+ insightFilter: InsightFilter
+ } // insightVizDataLogic
+ updateQuerySource: (querySource: QuerySourceUpdate) => {
+ querySource: QuerySourceUpdate
+ } // insightVizDataLogic
+ openPersonsModal: (props: { path_dropoff_key?: string; path_end_key?: string; path_start_key?: string }) => {
+ path_dropoff_key?: string | undefined
+ path_end_key?: string | undefined
+ path_start_key?: string | undefined
+ }
+ viewPathToFunnel: (pathItemCard: PathNodeData) => {
+ pathItemCard: PathNodeData
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface pathsDataLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ results: (insightQuery: DataNode<Record<string, any>>, insightData: Record<string, any>) => PathsLink[]
+ paths: (results: PathsLink[]) => Paths
+ taxonomicGroupTypes: (pathsFilter: PathsFilter | null) => TaxonomicFilterGroupType[]
+ }
+}
+
+export type pathsDataLogicType = MakeLogicType<
+ pathsDataLogicValues,
+ pathsDataLogicActions,
+ InsightLogicProps,
+ pathsDataLogicMeta
+>
+
export const pathsDataLogic = kea<pathsDataLogicType>([
path((key) => ['scenes', 'paths', 'pathsDataLogic', key]),
props({} as InsightLogicProps),
@@ -84,13 +161,16 @@ export const pathsDataLogic = kea<pathsDataLogicType>([
selectors({
results: [
(s) => [s.insightQuery, s.insightData],
- (insightQuery, insightData): PathsLink[] => {
+ (
+ insightQuery: import('~/queries/schema/schema-general').DataNode<Record<string, any>>,
+ insightData: Record<string, any>
+ ): PathsLink[] => {
return isPathsQuery(insightQuery) ? (insightData?.result ?? []) : []
},
],
paths: [
(s) => [s.results],
- (results): Paths => {
+ (results: PathsLink[]): Paths => {
const nodes: Record<string, PathsNode> = {}
for (const path of results) {
if (!nodes[path.source]) {
@@ -109,7 +189,7 @@ export const pathsDataLogic = kea<pathsDataLogicType>([
],
taxonomicGroupTypes: [
(s) => [s.pathsFilter],
- (pathsFilter) => {
+ (pathsFilter: null | import('~/queries/schema/schema-general').PathsFilter) => {
const taxonomicGroupTypes: TaxonomicFilterGroupType[] = []
if (pathsFilter?.includeEventTypes) {
if (pathsFilter?.includeEventTypes.includes(PathType.PageView)) {
diff --git a/frontend/src/scenes/paths/pathsInteractionLogic.ts b/frontend/src/scenes/paths/pathsInteractionLogic.ts
index 094441a8aca8..a35d64588f19 100644
--- a/frontend/src/scenes/paths/pathsInteractionLogic.ts
+++ b/frontend/src/scenes/paths/pathsInteractionLogic.ts
@@ -1,10 +1,9 @@
-import { actions, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'
import { InsightLogicProps } from '~/types'
-import type { pathsInteractionLogicType } from './pathsInteractionLogicType'
import {
PathNodeData,
activateNodes,
@@ -20,6 +19,80 @@ export type HoverTarget =
const DEFAULT_KEY = 'default_paths_interaction_key'
const CLEAR_HOVER_DEBOUNCE_MS = 30
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface pathsInteractionLogicValues {
+ activeIndices: {
+ linkIndices: Set<number>
+ nodeIndices: Set<number>
+ }
+ canvasHeight: number
+ cardHovered: boolean
+ hoverTarget: HoverTarget | null
+ nodes: PathNodeData[]
+ resolvedNodeCards: PathNodeData[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface pathsInteractionLogicActions {
+ clearHover: () => {
+ value: true
+ }
+ hoverLink: (
+ sourceIndex: number,
+ targetIndex: number,
+ linkIndex: number
+ ) => {
+ linkIndex: number
+ sourceIndex: number
+ targetIndex: number
+ }
+ hoverNode: (nodeIndex: number) => {
+ nodeIndex: number
+ }
+ requestClearHover: () => {
+ value: true
+ }
+ setCardHovered: (hovered: boolean) => {
+ hovered: boolean
+ }
+ setNodes: (
+ nodes: PathNodeData[],
+ canvasHeight: number
+ ) => {
+ canvasHeight: number
+ nodes: PathNodeData[]
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface pathsInteractionLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ activeIndices: (
+ hoverTarget: HoverTarget | null,
+ nodes: PathNodeData[]
+ ) => {
+ linkIndices: Set<number>
+ nodeIndices: Set<number>
+ }
+ resolvedNodeCards: (
+ nodes: PathNodeData[],
+ activeIndices: {
+ linkIndices: Set<number>
+ nodeIndices: Set<number>
+ },
+ canvasHeight: number
+ ) => PathNodeData[]
+ }
+}
+
+export type pathsInteractionLogicType = MakeLogicType<
+ pathsInteractionLogicValues,
+ pathsInteractionLogicActions,
+ InsightLogicProps,
+ pathsInteractionLogicMeta
+>
+
export const pathsInteractionLogic = kea<pathsInteractionLogicType>([
path((key) => ['scenes', 'paths', 'pathsInteractionLogic', key]),
props({} as InsightLogicProps),
diff --git a/frontend/src/scenes/sites/siteLogic.ts b/frontend/src/scenes/sites/siteLogic.ts
index a7cd78ee3991..fdd1af927815 100644
--- a/frontend/src/scenes/sites/siteLogic.ts
+++ b/frontend/src/scenes/sites/siteLogic.ts
@@ -1,22 +1,34 @@
-import { kea, path, props, selectors } from 'kea'
+import { MakeLogicType, kea, path, props, selectors } from 'kea'
import { Scene } from 'scenes/sceneTypes'
import { Breadcrumb } from '~/types'
-import type { siteLogicType } from './siteLogicType'
-
export interface SiteLogicProps {
url: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface siteLogicValues {
+ breadcrumbs: Breadcrumb[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface siteLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ breadcrumbs: (url: string) => Breadcrumb[]
+ }
+}
+
+export type siteLogicType = MakeLogicType<siteLogicValues, {}, SiteLogicProps, siteLogicMeta>
+
export const siteLogic = kea<siteLogicType>([
path(['scenes', 'sites', 'siteLogic']),
props({} as SiteLogicProps),
selectors({
breadcrumbs: [
(_, p) => [p.url],
- (url): Breadcrumb[] => [
+ (url: string): Breadcrumb[] => [
{
key: Scene.Site,
name: `Site`,
diff --git a/products/actions/frontend/logics/actionEditLogic.tsx b/products/actions/frontend/logics/actionEditLogic.tsx
index 8593e6f5ffd1..69ad7924cb3b 100644
--- a/products/actions/frontend/logics/actionEditLogic.tsx
+++ b/products/actions/frontend/logics/actionEditLogic.tsx
@@ -1,5 +1,6 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { loaders } from 'kea-loaders'
import { beforeUnload, router, urlToAction } from 'kea-router'
import { CombinedLocation } from 'kea-router/lib/utils'
@@ -19,7 +20,6 @@ import { ActionStepType, ActionType } from '~/types'
import type { ActionReferenceApi } from '../generated/api.schemas'
import { deleteActionWithWarning } from '../utils/deleteAction'
-import type { actionEditLogicType } from './actionEditLogicType'
import { actionLogic } from './actionLogic'
export const REFERENCE_TYPE_LABELS: Record<string, string> = {
@@ -43,6 +43,162 @@ export const DEFAULT_ACTION_STEP: ActionStepType = {
href_matching: 'contains',
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionEditLogicValues {
+ action: ActionType
+ actionAllErrors: Record<string, any>
+ actionChanged: boolean
+ actionErrors: DeepPartialMap<ActionType, ValidationErrorType>
+ actionHasErrors: boolean
+ actionLoading: boolean
+ actionManualErrors: Record<string, any>
+ actionTouched: boolean
+ actionTouches: Record<string, boolean>
+ actionValidationErrors: DeepPartialMap<ActionType, ValidationErrorType>
+ analyticsReferences: ActionReferenceApi[]
+ createNew: boolean
+ filteredReferences: ActionReferenceApi[]
+ hasCohortFilters: boolean
+ isActionSubmitting: boolean
+ isActionValid: boolean
+ originalAction: ActionType | null
+ originalActionHasCohortFilters: boolean
+ references: ActionReferenceApi[]
+ referencesLoading: boolean
+ referencesSearch: string
+ showActionErrors: boolean
+ showCohortDisablesFunctionsWarning: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionEditLogicActions {
+ loadActions: () => any // actionsModel
+ loadEventDefinitions: (url?: string | null) => {
+ url: string | null
+ } // eventDefinitionsTableLogic
+ loadTags: () => any // tagsModel
+ actionAlreadyExists: (actionId: number | null) => {
+ actionId: number | null
+ }
+ deleteAction: () => {
+ value: true
+ }
+ loadReferences: () => any
+ loadReferencesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadReferencesSuccess: (
+ references: ActionReferenceApi[],
+ payload?: any
+ ) => {
+ references: ActionReferenceApi[]
+ payload?: any
+ }
+ migrateToHogFunction: () => {
+ value: true
+ }
+ resetAction: (values?: ActionType) => {
+ values?: ActionType
+ }
+ setAction: (
+ action: Partial<ActionType>,
+ options?: SetActionProps
+ ) => {
+ action: Partial<ActionType>
+ options: SetActionProps
+ }
+ setActionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ setActionManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setActionSuccess: (
+ action: ActionType,
+ payload?: {
+ action: Partial<ActionType>
+ options: SetActionProps
+ }
+ ) => {
+ action: ActionType
+ payload?: {
+ action: Partial<ActionType>
+ options: SetActionProps
+ }
+ }
+ setActionValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setActionValues: (values: DeepPartial<ActionType>) => {
+ values: DeepPartial<ActionType>
+ }
+ setCreateNew: (createNew: boolean) => {
+ createNew: boolean
+ }
+ setOriginalAction: (action: ActionType | null) => {
+ action: ActionType | null
+ }
+ setReferencesSearch: (search: string) => {
+ search: string
+ }
+ submitAction: () => {
+ value: boolean
+ }
+ submitActionFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitActionRequest: (action: ActionType) => {
+ action: ActionType
+ }
+ submitActionSuccess: (action: ActionType) => {
+ action: ActionType
+ }
+ touchActionField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionEditLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ hasCohortFilters: (action: ActionType) => boolean
+ originalActionHasCohortFilters: (originalAction: ActionType | null) => boolean
+ showCohortDisablesFunctionsWarning: (
+ hasCohortFilters: boolean,
+ originalActionHasCohortFilters: boolean
+ ) => boolean
+ analyticsReferences: (references: ActionReferenceApi[]) => ActionReferenceApi[]
+ filteredReferences: (
+ analyticsReferences: ActionReferenceApi[],
+ referencesSearch: string
+ ) => ActionReferenceApi[]
+ }
+}
+
+export type actionEditLogicType = MakeLogicType<
+ actionEditLogicValues,
+ actionEditLogicActions,
+ ActionEditLogicProps,
+ actionEditLogicMeta
+>
+
export const actionEditLogic = kea<actionEditLogicType>([
path((key) => ['scenes', 'actions', 'actionEditLogic', key]),
props({} as ActionEditLogicProps),
@@ -178,19 +334,20 @@ export const actionEditLogic = kea<actionEditLogicType>([
selectors({
hasCohortFilters: [
(s) => [s.action],
- (action) =>
+ (action: ActionType) =>
action?.steps?.some((step: ActionStepType) => step.properties?.find((p: any) => p.type === 'cohort')) ??
false,
],
originalActionHasCohortFilters: [
(s) => [s.originalAction],
- (action) =>
+ (action: ActionType | null) =>
action?.steps?.some((step: ActionStepType) => step.properties?.find((p: any) => p.type === 'cohort')) ??
false,
],
showCohortDisablesFunctionsWarning: [
(s) => [s.hasCohortFilters, s.originalActionHasCohortFilters],
- (hasCohortFilters, originalActionHasCohortFilters) => hasCohortFilters && !originalActionHasCohortFilters,
+ (hasCohortFilters: boolean, originalActionHasCohortFilters: boolean) =>
+ hasCohortFilters && !originalActionHasCohortFilters,
],
}),
diff --git a/products/actions/frontend/logics/actionLogic.ts b/products/actions/frontend/logics/actionLogic.ts
index d497720693a0..dca779a120e7 100644
--- a/products/actions/frontend/logics/actionLogic.ts
+++ b/products/actions/frontend/logics/actionLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -10,13 +10,87 @@ import { urls } from 'scenes/urls'
import { SIDE_PANEL_CONTEXT_KEY, SidePanelSceneContext } from '~/layout/navigation-3000/sidepanel/types'
import { ActionStepType, ActionType, ActivityScope, Breadcrumb, HogFunctionType, ProjectTreeRef } from '~/types'
+import type { FeatureFlagsSet } from '../../../../frontend/src/lib/logic/featureFlagLogic'
import { actionEditLogic } from './actionEditLogic'
-import type { actionLogicType } from './actionLogicType'
export interface ActionLogicProps {
id: ActionType['id']
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ action: ActionType | null
+ actionLoading: boolean
+ breadcrumbs: Breadcrumb[]
+ hasCohortFilters: boolean
+ isComplete: boolean
+ matchingHogFunctions: HogFunctionType[] | null
+ matchingHogFunctionsLoading: boolean
+ pollTimeout: number | null
+ projectTreeRef: ProjectTreeRef
+ sidePanelContext: SidePanelSceneContext | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionLogicActions {
+ checkIsFinished: (action: any) => {
+ action: any
+ }
+ loadAction: () => any
+ loadActionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadActionSuccess: (
+ action: ActionType,
+ payload?: any
+ ) => {
+ action: ActionType
+ payload?: any
+ }
+ loadMatchingHogFunctions: () => any
+ loadMatchingHogFunctionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMatchingHogFunctionsSuccess: (
+ matchingHogFunctions: HogFunctionType[],
+ payload?: any
+ ) => {
+ matchingHogFunctions: HogFunctionType[]
+ payload?: any
+ }
+ setIsComplete: (isComplete: any) => {
+ isComplete: any
+ }
+ setPollTimeout: (pollTimeout: any) => {
+ pollTimeout: any
+ }
+ updateAction: (action: Partial<ActionType>) => {
+ action: Partial<ActionType>
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ projectTreeRef: (id: number) => ProjectTreeRef
+ hasCohortFilters: (action: ActionType | null) => boolean
+ breadcrumbs: (action: ActionType | null, arg: string | null) => Breadcrumb[]
+ sidePanelContext: (action: ActionType | null) => SidePanelSceneContext | null
+ }
+}
+
+export type actionLogicType = MakeLogicType<actionLogicValues, actionLogicActions, ActionLogicProps, actionLogicMeta>
+
export const actionLogic = kea<actionLogicType>([
props({} as ActionLogicProps),
key((props) => `${props.id || 'new'}`),
@@ -76,10 +150,10 @@ export const actionLogic = kea<actionLogicType>([
],
})),
selectors({
- projectTreeRef: [(_, p) => [p.id], (id): ProjectTreeRef => ({ type: 'action', ref: String(id) })],
+ projectTreeRef: [(_, p) => [p.id], (id: number): ProjectTreeRef => ({ type: 'action', ref: String(id) })],
hasCohortFilters: [
(s) => [s.action],
- (action) =>
+ (action: ActionType | null) =>
action?.steps?.some((step: ActionStepType) => step.properties?.find((p: any) => p.type === 'cohort')) ??
false,
],
@@ -89,7 +163,7 @@ export const actionLogic = kea<actionLogicType>([
s.action,
(state, props) => actionEditLogic.findMounted({ id: props?.id })?.selectors.action(state).name || null,
],
- (action, inProgressName): Breadcrumb[] => [
+ (action: ActionType | null, inProgressName: string | null): Breadcrumb[] => [
{
key: DataManagementTab.Actions,
name: 'Actions',
@@ -107,7 +181,7 @@ export const actionLogic = kea<actionLogicType>([
[SIDE_PANEL_CONTEXT_KEY]: [
(s) => [s.action],
- (action): SidePanelSceneContext | null => {
+ (action: ActionType | null): SidePanelSceneContext | null => {
return action?.id
? {
activity_scope: ActivityScope.ACTION,
diff --git a/products/actions/frontend/logics/actionsLogic.ts b/products/actions/frontend/logics/actionsLogic.ts
index f92a8acb12c9..3f5301d3db67 100644
--- a/products/actions/frontend/logics/actionsLogic.ts
+++ b/products/actions/frontend/logics/actionsLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, urlToAction } from 'kea-router'
@@ -13,7 +13,7 @@ import { urls } from 'scenes/urls'
import { SIDE_PANEL_CONTEXT_KEY, SidePanelSceneContext } from '~/layout/navigation-3000/sidepanel/types'
import { ActionType, ActivityScope, Breadcrumb } from '~/types'
-import type { actionsLogicType } from './actionsLogicType'
+import type { FeatureFlagsSet } from '../../../../frontend/src/lib/logic/featureFlagLogic'
export const ACTIONS_PER_PAGE = 50
@@ -31,6 +31,129 @@ const DEFAULT_FILTERS: ActionsFilters = {
ordering: '-created_by',
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionsLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ actionCount: number
+ actionsList: ActionType[]
+ actionsResponse: ActionsResponse
+ actionsResponseLoading: boolean
+ apiParams: string
+ breadcrumbs: Breadcrumb[]
+ filters: ActionsFilters
+ hasActiveFilters: boolean
+ page: number
+ searchTerm: string
+ shouldShowEmptyState: boolean
+ sidePanelContext: SidePanelSceneContext
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionsLogicActions {
+ loadActions: () => any
+ loadActionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadActionsSuccess: (
+ actionsResponse: {
+ count: number
+ results: ActionType[]
+ },
+ payload?: any
+ ) => {
+ actionsResponse: {
+ count: number
+ results: ActionType[]
+ }
+ payload?: any
+ }
+ pinAction: (action: ActionType) => ActionType
+ pinActionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ pinActionSuccess: (
+ actionsResponse: {
+ count: number
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: ActionType[]
+ },
+ payload?: ActionType
+ ) => {
+ actionsResponse: {
+ count: number
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: ActionType[]
+ }
+ payload?: ActionType
+ }
+ setFilters: (filters: Partial<ActionsFilters>) => {
+ filters: Partial<ActionsFilters>
+ }
+ setPage: (page: number) => {
+ page: number
+ }
+ setSearchTerm: (searchTerm: string) => {
+ searchTerm: string
+ }
+ unpinAction: (action: ActionType) => ActionType
+ unpinActionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ unpinActionSuccess: (
+ actionsResponse: {
+ count: number
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: ActionType[]
+ },
+ payload?: ActionType
+ ) => {
+ actionsResponse: {
+ count: number
+ next?: string | null | undefined
+ previous?: string | null | undefined
+ results: ActionType[]
+ }
+ payload?: ActionType
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ actionsList: (actionsResponse: ActionsResponse) => ActionType[]
+ actionCount: (actionsResponse: ActionsResponse) => number
+ apiParams: (searchTerm: string, filters: ActionsFilters, page: number, featureFlags: FeatureFlagsSet) => string
+ hasActiveFilters: (searchTerm: string, filters: ActionsFilters) => boolean
+ shouldShowEmptyState: (
+ actionCount: number,
+ actionsResponseLoading: boolean,
+ hasActiveFilters: boolean
+ ) => boolean
+ }
+}
+
+export type actionsLogicType = MakeLogicType<
+ actionsLogicValues,
+ actionsLogicActions,
+ Record<string, any>,
+ actionsLogicMeta
+>
+
export const actionsLogic = kea<actionsLogicType>([
path(['products', 'actions', 'actionsLogic']),
connect(() => ({
@@ -99,11 +222,16 @@ export const actionsLogic = kea<actionsLogicType>([
],
})),
selectors({
- actionsList: [(s) => [s.actionsResponse], (response): ActionType[] => response.results],
- actionCount: [(s) => [s.actionsResponse], (response): number => response.count],
+ actionsList: [(s) => [s.actionsResponse], (response: ActionsResponse): ActionType[] => response.results],
+ actionCount: [(s) => [s.actionsResponse], (response: ActionsResponse): number => response.count],
apiParams: [
(s) => [s.searchTerm, s.filters, s.page, s.featureFlags],
- (searchTerm, filters, page, featureFlags): string => {
+ (
+ searchTerm: string,
+ filters: ActionsFilters,
+ page: number,
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet
+ ): string => {
const params: Record<string, any> = {
limit: ACTIONS_PER_PAGE,
offset: (page - 1) * ACTIONS_PER_PAGE,
@@ -127,7 +255,7 @@ export const actionsLogic = kea<actionsLogicType>([
],
hasActiveFilters: [
(s) => [s.searchTerm, s.filters],
- (searchTerm, filters): boolean =>
+ (searchTerm: string, filters: ActionsFilters): boolean =>
!!searchTerm.trim() || filters.createdBy.length > 0 || filters.tags.length > 0,
],
shouldShowEmptyState: [
diff --git a/products/customer_analytics/frontend/components/AccountNotes/accountNotesLogic.ts b/products/customer_analytics/frontend/components/AccountNotes/accountNotesLogic.ts
index 02cec42ae9a7..427ba4bd2c17 100644
--- a/products/customer_analytics/frontend/components/AccountNotes/accountNotesLogic.ts
+++ b/products/customer_analytics/frontend/components/AccountNotes/accountNotesLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -14,15 +14,153 @@ import type {
PaginatedAccountNoteListApi,
} from 'products/customer_analytics/frontend/generated/api.schemas'
+import type { UserType } from '../../../../../frontend/src/types'
import { customerAnalyticsSceneLogic } from '../../customerAnalyticsSceneLogic'
import { AccountsEvents, type NotesTabFilterType } from '../Accounts/constants'
-import type { accountNotesLogicType } from './accountNotesLogicType'
const RESULTS_PER_PAGE = 50
const ACCOUNT_OPTIONS_LIMIT = 50
export type AccountFilterOption = { id: string; name: string }
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountNotesLogicValues {
+ mineOnly: boolean // customerAnalyticsSceneLogic
+ currentTeamId: number | null // teamLogic
+ user: UserType | null // userLogic
+ accountFilter: AccountFilterOption | null
+ accountNotes: AccountNoteApi[]
+ accountNotesResponse: PaginatedAccountNoteListApi | null
+ accountNotesResponseLoading: boolean
+ accountOptions: {
+ key: string
+ label: string
+ }[]
+ accountOptionsResponse: PaginatedAccountListApi | null
+ accountOptionsResponseLoading: boolean
+ accountSearch: string
+ assignedToCurrentUser: boolean
+ assignedToFilter: number[]
+ createdByCurrentUser: boolean
+ createdByFilter: number[]
+ currentUserId: number | null
+ page: number
+ pagination: PaginationManual
+ search: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountNotesLogicActions {
+ setMineOnly: (mineOnly: boolean) => {
+ mineOnly: boolean
+ } // customerAnalyticsSceneLogic
+ loadUserSuccess: (
+ user: UserType | null,
+ payload?: {
+ resetOnFailure: boolean | undefined
+ }
+ ) => {
+ payload?: {
+ resetOnFailure: boolean | undefined
+ }
+ user: UserType | null
+ } // userLogic
+ loadAccountNotes: () => {
+ value: true
+ }
+ loadAccountNotesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAccountNotesSuccess: (
+ accountNotesResponse: PaginatedAccountNoteListApi,
+ payload?: {
+ value: true
+ }
+ ) => {
+ accountNotesResponse: PaginatedAccountNoteListApi
+ payload?: {
+ value: true
+ }
+ }
+ loadAccountOptions: ({ query }: { query: string }) => {
+ query: string
+ }
+ loadAccountOptionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAccountOptionsSuccess: (
+ accountOptionsResponse: PaginatedAccountListApi,
+ payload?: {
+ query: string
+ }
+ ) => {
+ accountOptionsResponse: PaginatedAccountListApi
+ payload?: {
+ query: string
+ }
+ }
+ reportFilterChange: (filterType: NotesTabFilterType) => {
+ filterType: NotesTabFilterType
+ }
+ setAccountFilter: (account: AccountFilterOption | null) => {
+ account: AccountFilterOption | null
+ }
+ setAccountSearch: (query: string) => {
+ query: string
+ }
+ setAssignedToCurrentUser: (value: boolean) => {
+ value: boolean
+ }
+ setAssignedToFilter: (userIds: number[]) => {
+ userIds: number[]
+ }
+ setCreatedByCurrentUser: (value: boolean) => {
+ value: boolean
+ }
+ setCreatedByFilter: (userIds: number[]) => {
+ userIds: number[]
+ }
+ setPage: (page: number) => {
+ page: number
+ }
+ setSearch: (search: string) => {
+ search: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountNotesLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ accountNotes: (accountNotesResponse: PaginatedAccountNoteListApi | null) => AccountNoteApi[]
+ currentUserId: (user: UserType | null) => number | null
+ createdByCurrentUser: (createdByFilter: number[], currentUserId: number | null) => boolean
+ assignedToCurrentUser: (assignedToFilter: number[], currentUserId: number | null) => boolean
+ pagination: (page: number, accountNotesResponse: PaginatedAccountNoteListApi | null) => PaginationManual
+ accountOptions: (
+ accountOptionsResponse: PaginatedAccountListApi | null,
+ accountFilter: AccountFilterOption | null
+ ) => {
+ key: string
+ label: string
+ }[]
+ }
+}
+
+export type accountNotesLogicType = MakeLogicType<
+ accountNotesLogicValues,
+ accountNotesLogicActions,
+ Record<string, any>,
+ accountNotesLogicMeta
+>
+
export const accountNotesLogic = kea<accountNotesLogicType>([
path(['products', 'customer_analytics', 'frontend', 'components', 'AccountNotes', 'accountNotesLogic']),
connect(() => ({
@@ -98,7 +236,7 @@ export const accountNotesLogic = kea<accountNotesLogicType>([
(s) => [s.accountNotesResponse],
(response: PaginatedAccountNoteListApi | null): AccountNoteApi[] => response?.results ?? [],
],
- currentUserId: [(s) => [s.user], (user): number | null => user?.id ?? null],
+ currentUserId: [(s) => [s.user], (user: null | import('~/types').UserType): number | null => user?.id ?? null],
// "My notes" is a shorthand, not separate state: checked iff the created-by filter is exactly [me].
createdByCurrentUser: [
(s) => [s.createdByFilter, s.currentUserId],
diff --git a/products/customer_analytics/frontend/components/AccountPropertiesInput/accountPropertiesInputLogic.ts b/products/customer_analytics/frontend/components/AccountPropertiesInput/accountPropertiesInputLogic.ts
index a56560c9fbb9..9080fc592ab2 100644
--- a/products/customer_analytics/frontend/components/AccountPropertiesInput/accountPropertiesInputLogic.ts
+++ b/products/customer_analytics/frontend/components/AccountPropertiesInput/accountPropertiesInputLogic.ts
@@ -1,4 +1,4 @@
-import { afterMount, connect, kea, listeners, path } from 'kea'
+import { MakeLogicType, afterMount, connect, kea, listeners, path } from 'kea'
import { loaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -7,7 +7,36 @@ import { projectLogic } from 'scenes/projectLogic'
import { customPropertyDefinitionsList } from 'products/customer_analytics/frontend/generated/api'
import type { CustomPropertyDefinitionApi } from 'products/customer_analytics/frontend/generated/api.schemas'
-import type { accountPropertiesInputLogicType } from './accountPropertiesInputLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountPropertiesInputLogicValues {
+ currentProjectId: number | null // projectLogic
+ definitions: CustomPropertyDefinitionApi[]
+ definitionsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountPropertiesInputLogicActions {
+ loadDefinitions: () => any
+ loadDefinitionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDefinitionsSuccess: (
+ definitions: CustomPropertyDefinitionApi[],
+ payload?: any
+ ) => {
+ definitions: CustomPropertyDefinitionApi[]
+ payload?: any
+ }
+}
+
+export type accountPropertiesInputLogicType = MakeLogicType<
+ accountPropertiesInputLogicValues,
+ accountPropertiesInputLogicActions
+>
export const accountPropertiesInputLogic = kea<accountPropertiesInputLogicType>([
path([
diff --git a/products/customer_analytics/frontend/components/AccountRelationshipsInput/accountRelationshipsInputLogic.ts b/products/customer_analytics/frontend/components/AccountRelationshipsInput/accountRelationshipsInputLogic.ts
index af8f70f849cb..762a62ab5d72 100644
--- a/products/customer_analytics/frontend/components/AccountRelationshipsInput/accountRelationshipsInputLogic.ts
+++ b/products/customer_analytics/frontend/components/AccountRelationshipsInput/accountRelationshipsInputLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -7,7 +7,43 @@ import { projectLogic } from 'scenes/projectLogic'
import { accountRelationshipDefinitionsList } from 'products/customer_analytics/frontend/generated/api'
import type { AccountRelationshipDefinitionApi } from 'products/customer_analytics/frontend/generated/api.schemas'
-import type { accountRelationshipsInputLogicType } from './accountRelationshipsInputLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountRelationshipsInputLogicValues {
+ currentProjectId: number | null // projectLogic
+ definitions: AccountRelationshipDefinitionApi[]
+ definitionsLoading: boolean
+ pendingDefinitionIds: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountRelationshipsInputLogicActions {
+ addPendingDefinition: (definitionId: string) => {
+ definitionId: string
+ }
+ loadDefinitions: () => any
+ loadDefinitionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDefinitionsSuccess: (
+ definitions: AccountRelationshipDefinitionApi[],
+ payload?: any
+ ) => {
+ definitions: AccountRelationshipDefinitionApi[]
+ payload?: any
+ }
+ removePendingDefinition: (definitionId: string) => {
+ definitionId: string
+ }
+}
+
+export type accountRelationshipsInputLogicType = MakeLogicType<
+ accountRelationshipsInputLogicValues,
+ accountRelationshipsInputLogicActions
+>
export const accountRelationshipsInputLogic = kea<accountRelationshipsInputLogicType>([
path([
diff --git a/products/customer_analytics/frontend/components/Accounts/accountBillingLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountBillingLogic.ts
index 4658084f47e9..0f76a5a01125 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountBillingLogic.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountBillingLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, isBreakpoint, kea, key, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, isBreakpoint, kea, key, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -9,7 +9,7 @@ import { insightsApi } from 'scenes/insights/utils/api'
import { DataVisualizationNode, HogQLVariable, NodeKind } from '~/queries/schema/schema-general'
import { InsightShortId, QueryBasedInsightModel } from '~/types'
-import type { accountBillingLogicType } from './accountBillingLogicType'
+import type { Node } from '../../../../../frontend/src/queries/schema/schema-general'
export type AccountBillingKind = 'usage' | 'spend'
@@ -73,6 +73,63 @@ function buildVariableOverrides(
return overrides
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountBillingLogicValues {
+ dateRange: BillingDateRange
+ queryKeyFor: (shortId: string) => string
+ resolvedDateRange: BillingDateRange
+ savedInsights: QueryBasedInsightModel[] | null
+ savedInsightsLoading: boolean
+ variableOverridesByShortId: Record<string, Record<string, HogQLVariable>>
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountBillingLogicActions {
+ loadSavedInsights: (_?: any) => any
+ loadSavedInsightsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSavedInsightsSuccess: (
+ savedInsights: QueryBasedInsightModel<Node<Record<string, any>>>[],
+ payload?: any
+ ) => {
+ savedInsights: QueryBasedInsightModel<Node<Record<string, any>>>[]
+ payload?: any
+ }
+ setDateRange: (
+ dateFrom: string | null,
+ dateTo: string | null
+ ) => {
+ dateFrom: string | null
+ dateTo: string | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountBillingLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ resolvedDateRange: (dateRange: BillingDateRange) => BillingDateRange
+ variableOverridesByShortId: (
+ savedInsights: QueryBasedInsightModel<Node<Record<string, any>>>[] | null,
+ resolvedDateRange: BillingDateRange,
+ arg: any
+ ) => Record<string, Record<string, HogQLVariable>>
+ queryKeyFor: (resolvedDateRange: BillingDateRange, arg: any, arg2: any) => (shortId: string) => string
+ }
+}
+
+export type accountBillingLogicType = MakeLogicType<
+ accountBillingLogicValues,
+ accountBillingLogicActions,
+ AccountBillingLogicProps,
+ accountBillingLogicMeta
+>
+
export const accountBillingLogic = kea<accountBillingLogicType>([
path((key) => ['scenes', 'customerAnalytics', 'accounts', 'accountBillingLogic', key]),
props({} as AccountBillingLogicProps),
@@ -119,7 +176,7 @@ export const accountBillingLogic = kea<accountBillingLogicType>([
// The saved insights filter on a calendar date column, so the range must be resolved to absolute dates.
resolvedDateRange: [
(s) => [s.dateRange],
- (dateRange): BillingDateRange => {
+ (dateRange: BillingDateRange): BillingDateRange => {
const from = dateStringToDayJs(dateRange.date_from)
const to = dateRange.date_to ? dateStringToDayJs(dateRange.date_to) : dayjs()
return {
@@ -130,7 +187,11 @@ export const accountBillingLogic = kea<accountBillingLogicType>([
],
variableOverridesByShortId: [
(s) => [s.savedInsights, s.resolvedDateRange, (_, p) => p.externalId],
- (savedInsights, resolvedDateRange, externalId): Record<string, Record<string, HogQLVariable>> => {
+ (
+ savedInsights: QueryBasedInsightModel[] | null,
+ resolvedDateRange: BillingDateRange,
+ externalId
+ ): Record<string, Record<string, HogQLVariable>> => {
const overridesByShortId: Record<string, Record<string, HogQLVariable>> = {}
for (const insight of savedInsights ?? []) {
const overrides = buildVariableOverrides(insight, resolvedDateRange, externalId)
@@ -145,7 +206,7 @@ export const accountBillingLogic = kea<accountBillingLogicType>([
// change must remount it. Keying on the resolved range gives each insight a key that changes with the range.
queryKeyFor: [
(s) => [s.resolvedDateRange, (_, p) => p.accountId, (_, p) => p.kind],
- (resolvedDateRange, accountId, kind) =>
+ (resolvedDateRange: BillingDateRange, accountId, kind) =>
(shortId: string): string =>
`account-billing-${accountId}-${kind}-${shortId}-${resolvedDateRange.date_from}-${resolvedDateRange.date_to}`,
],
diff --git a/products/customer_analytics/frontend/components/Accounts/accountLinksLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountLinksLogic.ts
index 0779c3982218..5a11060004ac 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountLinksLogic.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountLinksLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { combineUrl, router } from 'kea-router'
import posthog from 'posthog-js'
@@ -14,7 +14,6 @@ import type {
PatchedAccountApiProperties,
} from 'products/customer_analytics/frontend/generated/api.schemas'
-import type { accountLinksLogicType } from './accountLinksLogicType'
import { SALESFORCE_ORIGIN } from './constants'
const ORGANIZATION_GROUP_TYPE_INDEX = 0
@@ -65,6 +64,88 @@ function revenueDashboardUrl(externalId: string, billingId: string | null): stri
return `${urls.dashboard(REVENUE_DASHBOARD_ID)}?query_variables=${encodeURIComponent(queryVariables)}`
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountLinksLogicValues {
+ currentTeamId: number | null // teamLogic
+ account: AccountApi | null
+ accountLoading: boolean
+ currentFieldValues: AccountLinkFieldValues
+ editorOpen: boolean
+ formValues: AccountLinkFieldValues
+ links: AccountLink[]
+ savingLinks: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountLinksLogicActions {
+ closeEditor: () => {
+ value: true
+ }
+ loadAccount: () => any
+ loadAccountFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadAccountSuccess: (
+ account: AccountApi | null,
+ payload?: any
+ ) => {
+ account: AccountApi | null
+ payload?: any
+ }
+ openEditor: () => {
+ value: true
+ }
+ saveFinished: () => {
+ value: true
+ }
+ saveLinks: () => {
+ value: true
+ }
+ saveStarted: () => {
+ value: true
+ }
+ setFieldValue: (
+ fieldKey: AccountLinkFieldKey,
+ value: string
+ ) => {
+ fieldKey: AccountLinkFieldKey
+ value: string
+ }
+ setFormValues: (values: AccountLinkFieldValues) => {
+ values: AccountLinkFieldValues
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountLinksLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ currentFieldValues: (account: AccountApi | null) => AccountLinkFieldValues
+ links: (
+ account: AccountApi | null,
+ currentLocation: {
+ hash: string
+ hashParams: Record<string, any>
+ method: string
+ pathname: string
+ search: string
+ searchParams: Record<string, any>
+ }
+ ) => AccountLink[]
+ }
+}
+
+export type accountLinksLogicType = MakeLogicType<
+ accountLinksLogicValues,
+ accountLinksLogicActions,
+ AccountLinksLogicProps,
+ accountLinksLogicMeta
+>
+
export const accountLinksLogic = kea<accountLinksLogicType>([
path((key) => ['scenes', 'customerAnalytics', 'accounts', 'accountLinksLogic', key]),
props({} as AccountLinksLogicProps),
@@ -132,7 +213,17 @@ export const accountLinksLogic = kea<accountLinksLogicType>([
],
links: [
(s) => [s.account, router.selectors.currentLocation],
- (account: AccountApi | null, currentLocation): AccountLink[] => {
+ (
+ account: AccountApi | null,
+ currentLocation: {
+ hash: string
+ hashParams: Record<string, any>
+ method: string
+ pathname: string
+ search: string
+ searchParams: Record<string, any>
+ }
+ ): AccountLink[] => {
const externalId = account?.external_id ?? null
const billingId = account?.properties?.billing_id ?? null
const slackChannelId = account?.properties?.slack_channel_id ?? null
diff --git a/products/customer_analytics/frontend/components/Accounts/accountNotebooksLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountNotebooksLogic.ts
index 416c13d49610..0af49d11f4db 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountNotebooksLogic.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountNotebooksLogic.ts
@@ -1,4 +1,17 @@
-import { actions, afterMount, connect, isBreakpoint, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ connect,
+ isBreakpoint,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ reducers,
+ selectors,
+} from 'kea'
import { loaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -15,7 +28,6 @@ import type {
PaginatedAccountNotebookListApi,
} from 'products/customer_analytics/frontend/generated/api.schemas'
-import type { accountNotebooksLogicType } from './accountNotebooksLogicType'
import { AccountsEvents } from './constants'
export const NOTES_PER_PAGE = 5
@@ -34,6 +46,98 @@ function sortingToOrdering(sorting: Sorting | null): string | undefined {
return sorting.order === -1 ? `-${sorting.columnKey}` : sorting.columnKey
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountNotebooksLogicValues {
+ currentTeamId: number | null // teamLogic
+ createdNote: AccountNotebookApi | null
+ createdNoteLoading: boolean
+ notebooks: AccountNotebookApi[] | null
+ notebooksCount: number
+ notebooksResponse: PaginatedAccountNotebookListApi | null
+ notebooksResponseLoading: boolean
+ page: number
+ pagination: PaginationManual
+ searchTerm: string
+ sorting: Sorting | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountNotebooksLogicActions {
+ selectNotebook: (
+ id: string,
+ options?:
+ | {
+ silent?: boolean
+ }
+ | undefined
+ ) => {
+ id: string
+ silent?: boolean | undefined
+ } // notebookPanelLogic
+ createNote: () => {
+ value: true
+ }
+ createNoteFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ createNoteSuccess: (
+ createdNote: AccountNotebookApi,
+ payload?: {
+ value: true
+ }
+ ) => {
+ createdNote: AccountNotebookApi
+ payload?: {
+ value: true
+ }
+ }
+ loadNotebooks: (_?: any) => any
+ loadNotebooksFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadNotebooksSuccess: (
+ notebooksResponse: PaginatedAccountNotebookListApi,
+ payload?: any
+ ) => {
+ notebooksResponse: PaginatedAccountNotebookListApi
+ payload?: any
+ }
+ setPage: (page: number) => {
+ page: number
+ }
+ setSearchTerm: (searchTerm: string) => {
+ searchTerm: string
+ }
+ setSorting: (sorting: Sorting | null) => {
+ sorting: Sorting | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountNotebooksLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ notebooks: (notebooksResponse: PaginatedAccountNotebookListApi | null) => AccountNotebookApi[] | null
+ notebooksCount: (notebooksResponse: PaginatedAccountNotebookListApi | null) => number
+ pagination: (page: number, notebooksCount: number) => PaginationManual
+ }
+}
+
+export type accountNotebooksLogicType = MakeLogicType<
+ accountNotebooksLogicValues,
+ accountNotebooksLogicActions,
+ AccountNotebooksLogicProps,
+ accountNotebooksLogicMeta
+>
+
export const accountNotebooksLogic = kea<accountNotebooksLogicType>([
path((key) => ['scenes', 'customerAnalytics', 'accounts', 'accountNotebooksLogic', key]),
props({} as AccountNotebooksLogicProps),
@@ -101,11 +205,18 @@ export const accountNotebooksLogic = kea<accountNotebooksLogicType>([
page: [1, { setPage: (_, { page }) => page }],
}),
selectors(({ actions }) => ({
- notebooks: [(s) => [s.notebooksResponse], (response): AccountNotebookApi[] | null => response?.results ?? null],
- notebooksCount: [(s) => [s.notebooksResponse], (response): number => response?.count ?? 0],
+ notebooks: [
+ (s) => [s.notebooksResponse],
+ (response: PaginatedAccountNotebookListApi | null): AccountNotebookApi[] | null =>
+ response?.results ?? null,
+ ],
+ notebooksCount: [
+ (s) => [s.notebooksResponse],
+ (response: PaginatedAccountNotebookListApi | null): number => response?.count ?? 0,
+ ],
pagination: [
(s) => [s.page, s.notebooksCount],
- (page, count): PaginationManual => ({
+ (page: number, count: number): PaginationManual => ({
controlled: true,
pageSize: NOTES_PER_PAGE,
currentPage: page,
diff --git a/products/customer_analytics/frontend/components/Accounts/accountOpportunitiesLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountOpportunitiesLogic.ts
index b51c683c03b6..2b6e9b8bbc57 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountOpportunitiesLogic.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountOpportunitiesLogic.ts
@@ -1,4 +1,4 @@
-import { afterMount, connect, kea, key, path, props } from 'kea'
+import { MakeLogicType, afterMount, connect, kea, key, path, props } from 'kea'
import { loaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -11,7 +11,6 @@ import { hogql } from '~/queries/utils'
import { accountsRetrieve } from 'products/customer_analytics/frontend/generated/api'
import { CUSTOMER_ANALYTICS_DEFAULT_QUERY_TAGS } from '../../constants'
-import type { accountOpportunitiesLogicType } from './accountOpportunitiesLogicType'
export interface AccountOpportunitiesLogicProps {
accountId: string
@@ -48,6 +47,44 @@ const isExpectedMissingTableError = (error: unknown): boolean => {
)
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountOpportunitiesLogicValues {
+ currentTeamId: number | null // teamLogic
+ opportunitiesResult: AccountOpportunitiesResult
+ opportunitiesResultLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountOpportunitiesLogicActions {
+ loadOpportunities: () => any
+ loadOpportunitiesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadOpportunitiesSuccess: (
+ opportunitiesResult: AccountOpportunitiesResult,
+ payload?: any
+ ) => {
+ opportunitiesResult: AccountOpportunitiesResult
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountOpportunitiesLogicMeta {
+ key: string
+}
+
+export type accountOpportunitiesLogicType = MakeLogicType<
+ accountOpportunitiesLogicValues,
+ accountOpportunitiesLogicActions,
+ AccountOpportunitiesLogicProps,
+ accountOpportunitiesLogicMeta
+>
+
export const accountOpportunitiesLogic = kea<accountOpportunitiesLogicType>([
path((key) => ['scenes', 'customerAnalytics', 'accounts', 'accountOpportunitiesLogic', key]),
props({} as AccountOpportunitiesLogicProps),
diff --git a/products/customer_analytics/frontend/components/Accounts/accountRelatedUsersLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountRelatedUsersLogic.ts
index 63b7020e5246..6bd65cf44156 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountRelatedUsersLogic.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountRelatedUsersLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, isBreakpoint, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, afterMount, isBreakpoint, kea, key, listeners, path, props, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -7,8 +7,6 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { OrganizationMemberType } from '~/types'
-import type { accountRelatedUsersLogicType } from './accountRelatedUsersLogicType'
-
// The account org-members endpoint returns a slim member shape — only id + user are serialized.
export type AccountOrganizationMember = Pick<OrganizationMemberType, 'id' | 'user'>
@@ -18,6 +16,47 @@ export interface AccountRelatedUsersLogicProps {
externalId: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountRelatedUsersLogicValues {
+ membersResponse: CountedPaginatedResponse<AccountOrganizationMember> | null
+ membersResponseLoading: boolean
+ page: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountRelatedUsersLogicActions {
+ loadMembers: (_?: any) => any
+ loadMembersFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMembersSuccess: (
+ membersResponse: CountedPaginatedResponse<Pick<OrganizationMemberType, 'id' | 'user'>>,
+ payload?: any
+ ) => {
+ membersResponse: CountedPaginatedResponse<Pick<OrganizationMemberType, 'id' | 'user'>>
+ payload?: any
+ }
+ setPage: (page: number) => {
+ page: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountRelatedUsersLogicMeta {
+ key: string
+}
+
+export type accountRelatedUsersLogicType = MakeLogicType<
+ accountRelatedUsersLogicValues,
+ accountRelatedUsersLogicActions,
+ AccountRelatedUsersLogicProps,
+ accountRelatedUsersLogicMeta
+>
+
export const accountRelatedUsersLogic = kea<accountRelatedUsersLogicType>([
path((key) => ['scenes', 'customerAnalytics', 'accounts', 'accountRelatedUsersLogic', key]),
props({} as AccountRelatedUsersLogicProps),
diff --git a/products/customer_analytics/frontend/components/Accounts/accountRelationshipsLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountRelationshipsLogic.ts
index 7b236d81e25b..94af5b72831b 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountRelationshipsLogic.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountRelationshipsLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -19,7 +19,6 @@ import type {
} from 'products/customer_analytics/frontend/generated/api.schemas'
import { ACCOUNTS_HOGQL_DATA_NODE_KEY, ACCOUNTS_METRICS_DATA_NODE_KEY } from '../../constants'
-import type { accountRelationshipsLogicType } from './accountRelationshipsLogicType'
import { accountsColumnConfigLogic, ROLE_KEY_BY_NAME } from './accountsColumnConfigLogic'
import { AccountsEvents } from './constants'
@@ -33,6 +32,86 @@ function refreshAccountsList(): void {
dataNodeLogic.findMounted({ key: ACCOUNTS_METRICS_DATA_NODE_KEY })?.actions.loadData('force_async')
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountRelationshipsLogicValues {
+ relationshipDefinitions: AccountRelationshipDefinitionApi[] // accountsColumnConfigLogic
+ currentTeamId: number | null // teamLogic
+ activeRelationships: AccountRelationshipApi[]
+ assignDefinition: AccountRelationshipDefinitionApi | null
+ assignDefinitionId: string | null
+ definitionFilter: string | null
+ definitionFilterOptions: AccountRelationshipDefinitionApi[]
+ displayedRelationships: AccountRelationshipApi[]
+ relationshipSaving: boolean
+ relationships: AccountRelationshipApi[] | null
+ relationshipsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountRelationshipsLogicActions {
+ assignRelationship: (
+ definition: AccountRelationshipDefinitionApi,
+ user: UserBasicType
+ ) => {
+ definition: AccountRelationshipDefinitionApi
+ user: UserBasicType
+ }
+ endRelationship: (relationship: AccountRelationshipApi) => {
+ relationship: AccountRelationshipApi
+ }
+ loadRelationships: () => any
+ loadRelationshipsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRelationshipsSuccess: (
+ relationships: AccountRelationshipApi[],
+ payload?: any
+ ) => {
+ relationships: AccountRelationshipApi[]
+ payload?: any
+ }
+ relationshipSaveFinished: () => {
+ value: true
+ }
+ relationshipSaveStarted: () => {
+ value: true
+ }
+ setAssignDefinitionId: (definitionId: string | null) => {
+ definitionId: string | null
+ }
+ setDefinitionFilter: (definitionId: string | null) => {
+ definitionId: string | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountRelationshipsLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ activeRelationships: (relationships: AccountRelationshipApi[] | null) => AccountRelationshipApi[]
+ displayedRelationships: (
+ relationships: AccountRelationshipApi[] | null,
+ definitionFilter: string | null
+ ) => AccountRelationshipApi[]
+ assignDefinition: (
+ assignDefinitionId: string | null,
+ relationshipDefinitions: AccountRelationshipDefinitionApi[]
+ ) => AccountRelationshipDefinitionApi | null
+ definitionFilterOptions: (relationships: AccountRelationshipApi[] | null) => AccountRelationshipDefinitionApi[]
+ }
+}
+
+export type accountRelationshipsLogicType = MakeLogicType<
+ accountRelationshipsLogicValues,
+ accountRelationshipsLogicActions,
+ AccountRelationshipsLogicProps,
+ accountRelationshipsLogicMeta
+>
+
export const accountRelationshipsLogic = kea<accountRelationshipsLogicType>([
path((key) => ['scenes', 'customerAnalytics', 'accounts', 'accountRelationshipsLogic', key]),
props({} as AccountRelationshipsLogicProps),
@@ -88,12 +167,15 @@ export const accountRelationshipsLogic = kea<accountRelationshipsLogicType>([
selectors({
activeRelationships: [
(s) => [s.relationships],
- (relationships): AccountRelationshipApi[] =>
+ (relationships: AccountRelationshipApi[] | null): AccountRelationshipApi[] =>
(relationships ?? []).filter((relationship) => !relationship.ended_at),
],
displayedRelationships: [
(s) => [s.relationships, s.definitionFilter],
- (relationships, definitionFilter): AccountRelationshipApi[] =>
+ (
+ relationships: AccountRelationshipApi[] | null,
+ definitionFilter: string | null
+ ): AccountRelationshipApi[] =>
(relationships ?? [])
.filter((relationship) => !definitionFilter || relationship.definition.id === definitionFilter)
.sort(
@@ -103,14 +185,17 @@ export const accountRelationshipsLogic = kea<accountRelationshipsLogicType>([
],
assignDefinition: [
(s) => [s.assignDefinitionId, s.relationshipDefinitions],
- (assignDefinitionId, relationshipDefinitions): AccountRelationshipDefinitionApi | null =>
+ (
+ assignDefinitionId: string | null,
+ relationshipDefinitions: AccountRelationshipDefinitionApi[]
+ ): AccountRelationshipDefinitionApi | null =>
relationshipDefinitions.find((definition) => definition.id === assignDefinitionId) ?? null,
],
// Limited to definitions in this account's timeline — any other filter value
// would just show an empty table.
definitionFilterOptions: [
(s) => [s.relationships],
- (relationships): AccountRelationshipDefinitionApi[] => {
+ (relationships: AccountRelationshipApi[] | null): AccountRelationshipDefinitionApi[] => {
const byId = new Map<string, AccountRelationshipDefinitionApi>()
for (const relationship of relationships ?? []) {
byId.set(relationship.definition.id, relationship.definition)
diff --git a/products/customer_analytics/frontend/components/Accounts/accountsColumnConfigLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountsColumnConfigLogic.ts
index d3f96d472773..561a8c93d411 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountsColumnConfigLogic.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountsColumnConfigLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { objectsEqual } from 'lib/utils/objects'
@@ -20,8 +20,6 @@ import type {
} from 'products/customer_analytics/frontend/generated/api.schemas'
import { joinsLogic } from 'products/data_warehouse/frontend/shared/logics/joinsLogic'
-import type { accountsColumnConfigLogicType } from './accountsColumnConfigLogicType'
-
// Mandatory — the backend emits it as `tuple(name, external_id, id)` so the
// row identity (id) and copy-able external_id ride along with the display name.
export const ACCOUNTS_NAME_COLUMN = 'name'
@@ -306,6 +304,132 @@ export function buildAccountColumnGroups(
]
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountsColumnConfigLogicValues {
+ allTablesMap: Record<string, DatabaseSchemaTable> // databaseTableListLogic
+ databaseLoading: boolean // databaseTableListLogic
+ warehouseJoins: DataWarehouseViewLink[] // joinsLogic
+ warehouseJoinsLoading: boolean // joinsLogic
+ currentProjectId: number | null // projectLogic
+ currentTeamId: number | null // teamLogic
+ accountsColumnGroups: AccountColumnGroup[]
+ aliasToDefinition: Record<string, CustomPropertyDefinitionApi>
+ aliasToRelationshipDefinition: Record<string, AccountRelationshipDefinitionApi>
+ columnConfiguratorVisible: boolean
+ customPropertyDefinitions: CustomPropertyDefinitionApi[]
+ customPropertyDefinitionsLoading: boolean
+ defaultSelectColumns: string[]
+ querySelectColumns: string[]
+ relationshipDefinitions: AccountRelationshipDefinitionApi[]
+ relationshipDefinitionsLoaded: boolean
+ relationshipDefinitionsLoading: boolean
+ roleKeyToDefinition: Partial<Record<AccountRoleKey, AccountRelationshipDefinitionApi>>
+ selectColumns: string[]
+ visibleColumnNames: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountsColumnConfigLogicActions {
+ loadDatabase: ({ force }?: { force?: boolean }) => {
+ force?: boolean
+ } // databaseTableListLogic
+ loadJoins: () => any // joinsLogic
+ hideColumnConfigurator: () => {
+ value: true
+ }
+ loadCustomPropertyDefinitions: () => any
+ loadCustomPropertyDefinitionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadCustomPropertyDefinitionsSuccess: (
+ customPropertyDefinitions: CustomPropertyDefinitionApi[],
+ payload?: any
+ ) => {
+ customPropertyDefinitions: CustomPropertyDefinitionApi[]
+ payload?: any
+ }
+ loadRelationshipDefinitions: () => any
+ loadRelationshipDefinitionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRelationshipDefinitionsSuccess: (
+ relationshipDefinitions: AccountRelationshipDefinitionApi[],
+ payload?: any
+ ) => {
+ relationshipDefinitions: AccountRelationshipDefinitionApi[]
+ payload?: any
+ }
+ moveColumn: (
+ oldIndex: number,
+ newIndex: number
+ ) => {
+ newIndex: number
+ oldIndex: number
+ }
+ resetColumns: () => {
+ value: true
+ }
+ selectColumn: (column: string) => {
+ column: string
+ }
+ setSelectColumns: (columns: string[]) => {
+ columns: string[]
+ }
+ showColumnConfigurator: () => {
+ value: true
+ }
+ unselectColumn: (column: string) => {
+ column: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountsColumnConfigLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ defaultSelectColumns: (relationshipDefinitions: AccountRelationshipDefinitionApi[]) => string[]
+ roleKeyToDefinition: (
+ relationshipDefinitions: AccountRelationshipDefinitionApi[]
+ ) => Partial<Record<AccountRoleKey, AccountRelationshipDefinitionApi>>
+ querySelectColumns: (
+ selectColumns: string[],
+ roleKeyToDefinition: Partial<
+ Record<'account_executive' | 'account_owner' | 'csm', AccountRelationshipDefinitionApi>
+ >
+ ) => string[]
+ visibleColumnNames: (querySelectColumns: string[]) => string[]
+ accountsColumnGroups: (
+ allTablesMap: Record<string, DatabaseSchemaTable>,
+ warehouseJoins: DataWarehouseViewLink[],
+ customPropertyDefinitions: CustomPropertyDefinitionApi[],
+ relationshipDefinitions: AccountRelationshipDefinitionApi[]
+ ) => AccountColumnGroup[]
+ aliasToDefinition: (
+ customPropertyDefinitions: CustomPropertyDefinitionApi[]
+ ) => Record<string, CustomPropertyDefinitionApi>
+ aliasToRelationshipDefinition: (
+ relationshipDefinitions: AccountRelationshipDefinitionApi[],
+ roleKeyToDefinition: Partial<
+ Record<'account_executive' | 'account_owner' | 'csm', AccountRelationshipDefinitionApi>
+ >
+ ) => Record<string, AccountRelationshipDefinitionApi>
+ }
+}
+
+export type accountsColumnConfigLogicType = MakeLogicType<
+ accountsColumnConfigLogicValues,
+ accountsColumnConfigLogicActions,
+ Record<string, any>,
+ accountsColumnConfigLogicMeta
+>
+
export const accountsColumnConfigLogic = kea<accountsColumnConfigLogicType>([
path(['scenes', 'customerAnalytics', 'accounts', 'accountsColumnConfigLogic']),
connect(() => ({
diff --git a/products/customer_analytics/frontend/components/Accounts/accountsExpansionLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountsExpansionLogic.ts
index 690d7cf36e69..2cab60be2052 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountsExpansionLogic.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountsExpansionLogic.ts
@@ -1,7 +1,6 @@
-import { actions, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, listeners, path, reducers, selectors } from 'kea'
import posthog from 'posthog-js'
-import type { accountsExpansionLogicType } from './accountsExpansionLogicType'
import { AccountsEvents } from './constants'
export type AccountExpansionTab = 'notes' | 'users' | 'relationships' | 'usage' | 'spend' | 'opportunities'
@@ -17,6 +16,52 @@ export const ACCOUNT_EXPANSION_TABS: AccountExpansionTab[] = [
export const DEFAULT_ACCOUNT_TAB: AccountExpansionTab = 'notes'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountsExpansionLogicValues {
+ activeTabByAccount: Record<string, AccountExpansionTab>
+ activeTabFor: (accountId: string) => AccountExpansionTab
+ expandedAccountIds: string[]
+ isAccountExpanded: (accountId: string) => boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountsExpansionLogicActions {
+ openAccountTab: (
+ accountId: string,
+ tab: AccountExpansionTab
+ ) => {
+ accountId: string
+ tab: AccountExpansionTab
+ }
+ setActiveTab: (
+ accountId: string,
+ tab: AccountExpansionTab
+ ) => {
+ accountId: string
+ tab: AccountExpansionTab
+ }
+ toggleAccountExpanded: (accountId: string) => {
+ accountId: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountsExpansionLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isAccountExpanded: (expandedAccountIds: string[]) => (accountId: string) => boolean
+ activeTabFor: (
+ activeTabByAccount: Record<string, AccountExpansionTab>
+ ) => (accountId: string) => AccountExpansionTab
+ }
+}
+
+export type accountsExpansionLogicType = MakeLogicType<
+ accountsExpansionLogicValues,
+ accountsExpansionLogicActions,
+ Record<string, any>,
+ accountsExpansionLogicMeta
+>
+
export const accountsExpansionLogic = kea<accountsExpansionLogicType>([
path(['scenes', 'customerAnalytics', 'accounts', 'accountsExpansionLogic']),
actions({
@@ -44,13 +89,13 @@ export const accountsExpansionLogic = kea<accountsExpansionLogicType>([
selectors({
isAccountExpanded: [
(s) => [s.expandedAccountIds],
- (expandedAccountIds) =>
+ (expandedAccountIds: string[]) =>
(accountId: string): boolean =>
expandedAccountIds.includes(accountId),
],
activeTabFor: [
(s) => [s.activeTabByAccount],
- (activeTabByAccount) =>
+ (activeTabByAccount: Record<string, AccountExpansionTab>) =>
(accountId: string): AccountExpansionTab =>
activeTabByAccount[accountId] ?? DEFAULT_ACCOUNT_TAB,
],
diff --git a/products/customer_analytics/frontend/components/Accounts/accountsLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountsLogic.ts
index e24c393dda1b..ea97e53b1129 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountsLogic.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountsLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { actionToUrl, router, urlToAction } from 'kea-router'
import posthog from 'posthog-js'
@@ -20,12 +20,14 @@ import {
accountsRelationshipsList,
} from 'products/customer_analytics/frontend/generated/api'
+import type { UserType } from '../../../../../frontend/src/types'
import {
ACCOUNTS_HOGQL_DATA_NODE_KEY,
ACCOUNTS_METRICS_DATA_NODE_KEY,
CUSTOMER_ANALYTICS_DEFAULT_QUERY_TAGS,
} from '../../constants'
import { customerAnalyticsSceneLogic } from '../../customerAnalyticsSceneLogic'
+import type { AccountRelationshipDefinitionApi } from '../../generated/api.schemas'
import { ACCOUNTS_NAME_COLUMN, accountsColumnConfigLogic, isLegacyRoleColumn } from './accountsColumnConfigLogic'
import {
ACCOUNT_EXPANSION_TABS,
@@ -33,7 +35,6 @@ import {
accountsExpansionLogic,
DEFAULT_ACCOUNT_TAB,
} from './accountsExpansionLogic'
-import type { accountsLogicType } from './accountsLogicType'
import { accountsOverviewTilesLogic, TileFilter } from './accountsOverviewTilesLogic'
import { normalizeRoleFilter } from './accountsViewState'
import { AccountsEvents } from './constants'
@@ -139,6 +140,218 @@ export interface AccountsViewUrlState {
tileFilter?: TileFilter
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountsLogicValues {
+ aliasToRelationshipDefinition: Record<string, AccountRelationshipDefinitionApi> // accountsColumnConfigLogic
+ defaultSelectColumns: string[] // accountsColumnConfigLogic
+ querySelectColumns: string[] // accountsColumnConfigLogic
+ relationshipDefinitionsLoaded: boolean // accountsColumnConfigLogic
+ selectColumns: string[] // accountsColumnConfigLogic
+ visibleColumnNames: string[] // accountsColumnConfigLogic
+ overviewMetrics: string[] // accountsOverviewTilesLogic
+ tileFilter: TileFilter | null // accountsOverviewTilesLogic
+ mineOnly: boolean // customerAnalyticsSceneLogic
+ currentTeamId: number | null // teamLogic
+ user: UserType | null // userLogic
+ accountIdFilter: string | null
+ accountsQuerySource: AccountsQuery | null
+ activeFilterCount: number
+ allRolesUnassigned: boolean
+ assignedToCurrentUser: boolean
+ assignedToFilter: RoleFilterValue
+ currentUserId: number | null
+ hogqlQuery: DataTableNode
+ isRoleSaving: (accountId: string, column: string) => boolean
+ metricsQuery: AccountsQuery | null
+ relationshipOverrides: Record<string, number[]>
+ savingRoles: Record<string, true>
+ searchInput: string
+ searchQuery: string
+ sortOrder: AccountSortOrder
+ tagsFilter: string[]
+ viewUrlState: AccountsViewUrlState
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountsLogicActions {
+ moveColumn: (
+ oldIndex: number,
+ newIndex: number
+ ) => {
+ newIndex: number
+ oldIndex: number
+ } // accountsColumnConfigLogic
+ resetColumns: () => {
+ value: true
+ } // accountsColumnConfigLogic
+ selectColumn: (column: string) => {
+ column: string
+ } // accountsColumnConfigLogic
+ setSelectColumns: (columns: string[]) => {
+ columns: string[]
+ } // accountsColumnConfigLogic
+ unselectColumn: (column: string) => {
+ column: string
+ } // accountsColumnConfigLogic
+ openAccountTab: (
+ accountId: string,
+ tab: AccountExpansionTab
+ ) => {
+ accountId: string
+ tab: AccountExpansionTab
+ } // accountsExpansionLogic
+ setTileFilter: (filter: TileFilter | null) => {
+ filter: TileFilter | null
+ } // accountsOverviewTilesLogic
+ setMineOnly: (mineOnly: boolean) => {
+ mineOnly: boolean
+ } // customerAnalyticsSceneLogic
+ ensureAllMembersLoaded: () => {
+ value: true
+ } // membersLogic
+ loadUserSuccess: (
+ user: UserType | null,
+ payload?: {
+ resetOnFailure: boolean | undefined
+ }
+ ) => {
+ payload?: {
+ resetOnFailure: boolean | undefined
+ }
+ user: UserType | null
+ } // userLogic
+ openAccount: (
+ accountId: string,
+ externalId: string | null,
+ name: string,
+ tab: AccountExpansionTab
+ ) => {
+ accountId: string
+ externalId: string | null
+ name: string
+ tab: AccountExpansionTab
+ }
+ refresh: () => {
+ value: true
+ }
+ reportFilterChange: (filterType: AccountFilterType) => {
+ filterType: AccountFilterType
+ }
+ roleUpdateFinished: (
+ accountId: string,
+ column: string
+ ) => {
+ accountId: string
+ column: string
+ }
+ roleUpdateStarted: (
+ accountId: string,
+ column: string
+ ) => {
+ accountId: string
+ column: string
+ }
+ setAccountIdFilter: (accountId: string | null) => {
+ accountId: string | null
+ }
+ setAllRolesUnassigned: (value: boolean) => {
+ value: boolean
+ }
+ setAssignedToCurrentUser: (value: boolean) => {
+ value: boolean
+ }
+ setAssignedToFilter: (value: RoleFilterValue) => {
+ value: RoleFilterValue
+ }
+ setRelationshipOverride: (
+ accountId: string,
+ column: string,
+ userIds: number[]
+ ) => {
+ accountId: string
+ column: string
+ userIds: number[]
+ }
+ setSearchInput: (query: string) => {
+ query: string
+ }
+ setSearchQuery: (query: string) => {
+ query: string
+ }
+ setSortOrder: (sortOrder: AccountSortOrder) => {
+ sortOrder: AccountSortOrder
+ }
+ setTagsFilter: (tags: string[]) => {
+ tags: string[]
+ }
+ toggleSort: (column: AccountSortableColumn) => {
+ column: string
+ }
+ updateAccountRole: (
+ accountId: string,
+ column: string,
+ user: UserBasicType | null
+ ) => {
+ accountId: string
+ column: string
+ user: UserBasicType | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ currentUserId: (user: UserType | null) => number | null
+ assignedToCurrentUser: (assignedToFilter: RoleFilterValue, currentUserId: number | null) => boolean
+ isRoleSaving: (savingRoles: Record<string, true>) => (accountId: string, column: string) => boolean
+ activeFilterCount: (
+ searchQuery: string,
+ tagsFilter: string[],
+ allRolesUnassigned: boolean,
+ assignedToFilter: RoleFilterValue
+ ) => number
+ viewUrlState: (
+ searchQuery: string,
+ tagsFilter: string[],
+ allRolesUnassigned: boolean,
+ assignedToFilter: RoleFilterValue,
+ sortOrder: AccountSortOrder,
+ selectColumns: string[],
+ defaultSelectColumns: string[],
+ tileFilter: TileFilter | null
+ ) => AccountsViewUrlState
+ hogqlQuery: (
+ searchQuery: string,
+ tagsFilter: string[],
+ allRolesUnassigned: boolean,
+ assignedToFilter: RoleFilterValue,
+ accountIdFilter: string | null,
+ tileFilter: TileFilter | null,
+ sortOrder: AccountSortOrder,
+ querySelectColumns: string[],
+ visibleColumnNames: string[]
+ ) => DataTableNode
+ accountsQuerySource: (hogqlQuery: DataTableNode, relationshipDefinitionsLoaded: boolean) => AccountsQuery | null
+ metricsQuery: (
+ overviewMetrics: string[],
+ searchQuery: string,
+ tagsFilter: string[],
+ allRolesUnassigned: boolean,
+ assignedToFilter: RoleFilterValue,
+ accountIdFilter: string | null,
+ tileFilter: TileFilter | null,
+ relationshipDefinitionsLoaded: boolean
+ ) => AccountsQuery | null
+ }
+}
+
+export type accountsLogicType = MakeLogicType<
+ accountsLogicValues,
+ accountsLogicActions,
+ Record<string, any>,
+ accountsLogicMeta
+>
+
export const accountsLogic = kea<accountsLogicType>([
path(['scenes', 'customerAnalytics', 'accounts', 'accountsLogic']),
connect(() => ({
@@ -285,7 +498,7 @@ export const accountsLogic = kea<accountsLogicType>([
],
}),
selectors({
- currentUserId: [(s) => [s.user], (user): number | null => user?.id ?? null],
+ currentUserId: [(s) => [s.user], (user: null | import('~/types').UserType): number | null => user?.id ?? null],
// The "My accounts" checkbox is checked exactly when the assigned-to
// filter is just the current user — i.e. the user-agnostic id filter
// happens to point at you.
diff --git a/products/customer_analytics/frontend/components/Accounts/accountsOverviewTilesLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountsOverviewTilesLogic.ts
index d68a8e073367..4369ca9495b8 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountsOverviewTilesLogic.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountsOverviewTilesLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import posthog from 'posthog-js'
import { v4 as uuidv4 } from 'uuid'
@@ -9,10 +9,23 @@ import { AccountsQueryResponse, DataNode } from '~/queries/schema/schema-general
import type { CustomPropertyDisplayTypeEnumApi } from 'products/customer_analytics/frontend/generated/api.schemas'
+import type {
+ ErrorTrackingQueryResponse,
+ HogQLAutocompleteResponse,
+ HogQLMetadataResponse,
+ HogQLQueryResponse,
+ HogQueryResponse,
+ LogAttributesQueryResponse,
+ LogValuesQueryResponse,
+ MetricsQueryResponse,
+ SessionsQueryResponse,
+ TraceSpansAggregationQueryResponse,
+ TraceSpansAttributeBreakdownQueryResponse,
+ TraceSpansQueryResponse,
+} from '../../../../../frontend/src/queries/schema/schema-general'
import { ACCOUNTS_METRICS_DATA_NODE_KEY } from '../../constants'
import { isNumericDisplayType } from '../../scenes/CustomerAnalyticsConfigurationScene/account/customPropertyTypes'
import { AccountColumnGroup, AccountColumnOption, accountsColumnConfigLogic } from './accountsColumnConfigLogic'
-import type { accountsOverviewTilesLogicType } from './accountsOverviewTilesLogicType'
import {
ACCOUNTS_OVERVIEW_LEGACY_TILES_PREFIX,
AccountsEvents,
@@ -187,6 +200,125 @@ function readLegacyOverviewTiles(): AccountsOverviewTile[] | null {
return null
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountsOverviewTilesLogicValues {
+ accountsColumnGroups: AccountColumnGroup[] // accountsColumnConfigLogic
+ accountsResponse:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null // dataNodeLogic
+ accountsResponseLoading: boolean // dataNodeLogic
+ editorVisible: boolean
+ metrics: string[]
+ numericColumnExpressions: Set<string>
+ numericColumns: AccountColumnOption[]
+ reconciledTiles: AccountsOverviewTile[]
+ selectedTileId: string | null
+ tileFilter: TileFilter | null
+ tileValues: Record<string, number | null>
+ tiles: AccountsOverviewTile[]
+ tilesLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountsOverviewTilesLogicActions {
+ addTile: (
+ tile: Omit<AccountsOverviewTile, 'id'> & {
+ id?: string
+ }
+ ) => {
+ tile: Omit<AccountsOverviewTile, 'id'> & {
+ id?: string | undefined
+ }
+ }
+ hideEditor: () => {
+ value: true
+ }
+ moveTile: (
+ oldIndex: number,
+ newIndex: number
+ ) => {
+ newIndex: number
+ oldIndex: number
+ }
+ removeTile: (id: string) => {
+ id: string
+ }
+ resetTiles: () => {
+ value: true
+ }
+ setTileFilter: (filter: TileFilter | null) => {
+ filter: TileFilter | null
+ }
+ setTiles: (tiles: AccountsOverviewTile[]) => {
+ tiles: AccountsOverviewTile[]
+ }
+ showEditor: () => {
+ value: true
+ }
+ toggleTileSelection: (tile: AccountsOverviewTile) => {
+ tile: AccountsOverviewTile
+ }
+ updateTile: (
+ id: string,
+ tile: Omit<AccountsOverviewTile, 'id'>
+ ) => {
+ id: string
+ tile: Omit<AccountsOverviewTile, 'id'>
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountsOverviewTilesLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ numericColumns: (accountsColumnGroups: AccountColumnGroup[]) => AccountColumnOption[]
+ numericColumnExpressions: (numericColumns: AccountColumnOption[]) => Set<string>
+ reconciledTiles: (
+ tiles: AccountsOverviewTile[],
+ numericColumnExpressions: Set<string>
+ ) => AccountsOverviewTile[]
+ metrics: (reconciledTiles: AccountsOverviewTile[]) => string[]
+ tileValues: (
+ accountsResponse:
+ | ErrorTrackingQueryResponse
+ | HogQLAutocompleteResponse
+ | HogQLMetadataResponse
+ | HogQLQueryResponse<any[]>
+ | HogQueryResponse
+ | LogAttributesQueryResponse
+ | LogValuesQueryResponse
+ | MetricsQueryResponse
+ | Record<string, any>
+ | SessionsQueryResponse
+ | TraceSpansAggregationQueryResponse
+ | TraceSpansAttributeBreakdownQueryResponse
+ | TraceSpansQueryResponse
+ | null,
+ reconciledTiles: AccountsOverviewTile[]
+ ) => Record<string, number | null>
+ tilesLoading: (accountsResponseLoading: boolean) => boolean
+ selectedTileId: (tileFilter: TileFilter | null) => string | null
+ }
+}
+
+export type accountsOverviewTilesLogicType = MakeLogicType<
+ accountsOverviewTilesLogicValues,
+ accountsOverviewTilesLogicActions,
+ Record<string, any>,
+ accountsOverviewTilesLogicMeta
+>
+
export const accountsOverviewTilesLogic = kea<accountsOverviewTilesLogicType>([
path(['scenes', 'customerAnalytics', 'accounts', 'accountsOverviewTilesLogic']),
connect(() => ({
diff --git a/products/customer_analytics/frontend/components/Accounts/accountsViewsLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountsViewsLogic.ts
index 88c01adb1137..e59e60e02a05 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountsViewsLogic.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountsViewsLogic.ts
@@ -1,5 +1,6 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
import posthog from 'posthog-js'
@@ -13,10 +14,12 @@ import { userLogic } from 'scenes/userLogic'
import { ColumnConfigurationApi } from 'products/product_analytics/frontend/generated/api.schemas'
+import type { UserType } from '../../../../../frontend/src/types'
import { ACCOUNTS_COLUMN_CONFIG_KEY, accountsColumnConfigLogic } from './accountsColumnConfigLogic'
import { accountsLogic } from './accountsLogic'
+import type { AccountSortOrder, RoleFilterValue } from './accountsLogic'
import { accountsOverviewTilesLogic } from './accountsOverviewTilesLogic'
-import type { accountsViewsLogicType } from './accountsViewsLogicType'
+import type { AccountsOverviewTile, TileFilter } from './accountsOverviewTilesLogic'
import {
AccountsViewProperties,
AccountsViewState,
@@ -27,6 +30,336 @@ import { AccountsEvents, DEFAULT_TILES } from './constants'
export type ViewVisibility = 'private' | 'shared'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountsViewsLogicValues {
+ selectColumns: string[] // accountsColumnConfigLogic
+ allRolesUnassigned: boolean // accountsLogic
+ assignedToFilter: RoleFilterValue // accountsLogic
+ searchQuery: string // accountsLogic
+ sortOrder: AccountSortOrder // accountsLogic
+ tagsFilter: string[] // accountsLogic
+ tileFilter: TileFilter | null // accountsOverviewTilesLogic
+ tiles: AccountsOverviewTile[] // accountsOverviewTilesLogic
+ currentTeamId: number | null // teamLogic
+ user: UserType | null // userLogic
+ canEditCurrentView: boolean
+ currentView: ColumnConfigurationApi | null
+ currentViewId: string | null
+ isCreating: boolean
+ isDirty: boolean
+ isNewViewFormSubmitting: boolean
+ isNewViewFormValid: boolean
+ isRenameViewFormSubmitting: boolean
+ isRenameViewFormValid: boolean
+ liveViewState: AccountsViewState
+ newViewForm: {
+ name: string
+ visibility: ViewVisibility
+ }
+ newViewFormAllErrors: Record<string, any>
+ newViewFormChanged: boolean
+ newViewFormErrors: DeepPartialMap<
+ {
+ name: string
+ visibility: ViewVisibility
+ },
+ ValidationErrorType
+ >
+ newViewFormHasErrors: boolean
+ newViewFormManualErrors: Record<string, any>
+ newViewFormTouched: boolean
+ newViewFormTouches: Record<string, boolean>
+ newViewFormValidationErrors: DeepPartialMap<
+ {
+ name: string
+ visibility: ViewVisibility
+ },
+ ValidationErrorType
+ >
+ renameViewForm: {
+ name: string
+ }
+ renameViewFormAllErrors: Record<string, any>
+ renameViewFormChanged: boolean
+ renameViewFormErrors: DeepPartialMap<
+ {
+ name: string
+ },
+ ValidationErrorType
+ >
+ renameViewFormHasErrors: boolean
+ renameViewFormManualErrors: Record<string, any>
+ renameViewFormTouched: boolean
+ renameViewFormTouches: Record<string, boolean>
+ renameViewFormValidationErrors: DeepPartialMap<
+ {
+ name: string
+ },
+ ValidationErrorType
+ >
+ showNewViewFormErrors: boolean
+ showRenameViewFormErrors: boolean
+ viewToDelete: string | null
+ viewToRename: string | null
+ views: ColumnConfigurationApi[]
+ viewsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountsViewsLogicActions {
+ setSelectColumns: (columns: string[]) => {
+ columns: string[]
+ } // accountsColumnConfigLogic
+ setAllRolesUnassigned: (value: boolean) => {
+ value: boolean
+ } // accountsLogic
+ setAssignedToFilter: (value: RoleFilterValue) => {
+ value: RoleFilterValue
+ } // accountsLogic
+ setSearchQuery: (query: string) => {
+ query: string
+ } // accountsLogic
+ setSortOrder: (sortOrder: AccountSortOrder) => {
+ sortOrder: AccountSortOrder
+ } // accountsLogic
+ setTagsFilter: (tags: string[]) => {
+ tags: string[]
+ } // accountsLogic
+ setTileFilter: (filter: TileFilter | null) => {
+ filter: TileFilter | null
+ } // accountsOverviewTilesLogic
+ setTiles: (tiles: AccountsOverviewTile[]) => {
+ tiles: AccountsOverviewTile[]
+ } // accountsOverviewTilesLogic
+ applyView: (view: ColumnConfigurationApi) => {
+ view: ColumnConfigurationApi
+ }
+ deleteView: ({ id }: { id: string }) => {
+ id: string
+ }
+ deleteViewFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteViewSuccess: (
+ views: ColumnConfigurationApi[],
+ payload?: {
+ id: string
+ }
+ ) => {
+ views: ColumnConfigurationApi[]
+ payload?: {
+ id: string
+ }
+ }
+ loadViews: () => any
+ loadViewsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadViewsSuccess: (
+ views: ColumnConfigurationApi[],
+ payload?: any
+ ) => {
+ views: ColumnConfigurationApi[]
+ payload?: any
+ }
+ patchViewProperties: ({ id, properties }: { id: string; properties: AccountsViewProperties }) => {
+ id: string
+ properties: AccountsViewProperties
+ }
+ patchViewPropertiesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ patchViewPropertiesSuccess: (
+ views: ColumnConfigurationApi[],
+ payload?: {
+ id: string
+ properties: AccountsViewProperties
+ }
+ ) => {
+ views: ColumnConfigurationApi[]
+ payload?: {
+ id: string
+ properties: AccountsViewProperties
+ }
+ }
+ resetNewViewForm: (values?: { name: string; visibility: ViewVisibility }) => {
+ values?: {
+ name: string
+ visibility: ViewVisibility
+ }
+ }
+ resetRenameViewForm: (values?: { name: string }) => {
+ values?: {
+ name: string
+ }
+ }
+ selectView: (id: string) => {
+ id: string
+ }
+ setCurrentViewId: (id: string | null) => {
+ id: string | null
+ }
+ setIsCreating: (isCreating: boolean) => {
+ isCreating: boolean
+ }
+ setNewViewFormManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setNewViewFormValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setNewViewFormValues: (
+ values: DeepPartial<{
+ name: string
+ visibility: ViewVisibility
+ }>
+ ) => {
+ values: DeepPartial<{
+ name: string
+ visibility: ViewVisibility
+ }>
+ }
+ setRenameViewFormManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setRenameViewFormValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setRenameViewFormValues: (
+ values: DeepPartial<{
+ name: string
+ }>
+ ) => {
+ values: DeepPartial<{
+ name: string
+ }>
+ }
+ setViewToDelete: (id: string | null) => {
+ id: string | null
+ }
+ setViewToRename: (id: string | null) => {
+ id: string | null
+ }
+ submitNewViewForm: () => {
+ value: boolean
+ }
+ submitNewViewFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitNewViewFormRequest: (newViewForm: { name: string; visibility: ViewVisibility }) => {
+ newViewForm: {
+ name: string
+ visibility: ViewVisibility
+ }
+ }
+ submitNewViewFormSuccess: (newViewForm: { name: string; visibility: ViewVisibility }) => {
+ newViewForm: {
+ name: string
+ visibility: ViewVisibility
+ }
+ }
+ submitRenameViewForm: () => {
+ value: boolean
+ }
+ submitRenameViewFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitRenameViewFormRequest: (renameViewForm: { name: string }) => {
+ renameViewForm: {
+ name: string
+ }
+ }
+ submitRenameViewFormSuccess: (renameViewForm: { name: string }) => {
+ renameViewForm: {
+ name: string
+ }
+ }
+ touchNewViewFormField: (key: string) => {
+ key: string
+ }
+ touchRenameViewFormField: (key: string) => {
+ key: string
+ }
+ updateView: ({ id, updates }: { id: string; updates: Partial<ColumnConfigurationApi> }) => {
+ id: string
+ updates: Partial<ColumnConfigurationApi>
+ }
+ updateViewFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateViewSuccess: (
+ views: ColumnConfigurationApi[],
+ payload?: {
+ id: string
+ updates: Partial<ColumnConfigurationApi>
+ }
+ ) => {
+ views: ColumnConfigurationApi[]
+ payload?: {
+ id: string
+ updates: Partial<ColumnConfigurationApi>
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountsViewsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ liveViewState: (
+ selectColumns: string[],
+ searchQuery: string,
+ tagsFilter: string[],
+ allRolesUnassigned: boolean,
+ assignedToFilter: RoleFilterValue,
+ sortOrder: AccountSortOrder,
+ tileFilter: TileFilter | null,
+ tiles: AccountsOverviewTile[]
+ ) => AccountsViewState
+ currentView: (views: ColumnConfigurationApi[], currentViewId: string | null) => ColumnConfigurationApi | null
+ isDirty: (currentView: ColumnConfigurationApi | null, liveViewState: AccountsViewState) => boolean
+ canEditCurrentView: (currentView: ColumnConfigurationApi | null, user: UserType | null) => boolean
+ }
+}
+
+export type accountsViewsLogicType = MakeLogicType<
+ accountsViewsLogicValues,
+ accountsViewsLogicActions,
+ Record<string, any>,
+ accountsViewsLogicMeta
+>
+
export const accountsViewsLogic = kea<accountsViewsLogicType>([
path(['scenes', 'customerAnalytics', 'accounts', 'accountsViewsLogic']),
connect(() => ({
@@ -142,14 +475,14 @@ export const accountsViewsLogic = kea<accountsViewsLogicType>([
s.tiles,
],
(
- selectColumns,
- searchQuery,
- tagsFilter,
- allRolesUnassigned,
- assignedToFilter,
- sortOrder,
- tileFilter,
- tiles
+ selectColumns: string[],
+ searchQuery: string,
+ tagsFilter: string[],
+ allRolesUnassigned: boolean,
+ assignedToFilter: import('./accountsLogic').RoleFilterValue,
+ sortOrder: import('./accountsLogic').AccountSortOrder,
+ tileFilter: null | import('./accountsOverviewTilesLogic').TileFilter,
+ tiles: import('./accountsOverviewTilesLogic').AccountsOverviewTile[]
): AccountsViewState => ({
columns: selectColumns,
sortOrder,
@@ -165,12 +498,12 @@ export const accountsViewsLogic = kea<accountsViewsLogicType>([
],
currentView: [
(s) => [s.views, s.currentViewId],
- (views, currentViewId): ColumnConfigurationApi | null =>
+ (views: ColumnConfigurationApi[], currentViewId: string | null): ColumnConfigurationApi | null =>
views.find((view) => view.id === currentViewId) ?? null,
],
isDirty: [
(s) => [s.currentView, s.liveViewState],
- (currentView, liveViewState): boolean =>
+ (currentView: ColumnConfigurationApi | null, liveViewState: AccountsViewState): boolean =>
currentView
? !objectsEqual(
serializeAccountsView(deserializeAccountsView(currentView)),
@@ -180,7 +513,8 @@ export const accountsViewsLogic = kea<accountsViewsLogicType>([
],
canEditCurrentView: [
(s) => [s.currentView, s.user],
- (currentView, user): boolean => !!currentView && !!user && currentView.created_by === user.id,
+ (currentView: ColumnConfigurationApi | null, user: null | import('~/types').UserType): boolean =>
+ !!currentView && !!user && currentView.created_by === user.id,
],
}),
forms(({ actions, values }) => ({
diff --git a/products/customer_analytics/frontend/components/CustomerJourneys/customerJourneysLogic.ts b/products/customer_analytics/frontend/components/CustomerJourneys/customerJourneysLogic.ts
index b9e6a17a2215..2ff525d37479 100644
--- a/products/customer_analytics/frontend/components/CustomerJourneys/customerJourneysLogic.ts
+++ b/products/customer_analytics/frontend/components/CustomerJourneys/customerJourneysLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { lazyLoaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -15,7 +15,7 @@ import { FunnelVizType, PropertyFilterType, PropertyOperator, QueryBasedInsightM
import { CustomerJourneyApi } from 'products/customer_analytics/frontend/generated/api.schemas'
-import type { customerJourneysLogicType } from './customerJourneysLogicType'
+import type { Node } from '../../../../../frontend/src/queries/schema/schema-general'
export interface CustomerJourneysLogicProps {
key?: string
@@ -24,6 +24,172 @@ export interface CustomerJourneysLogicProps {
groupTypeIndex?: number
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerJourneysLogicValues {
+ activeInsight: QueryBasedInsightModel | null
+ activeInsightLoading: boolean
+ activeJourney: CustomerJourneyApi | null
+ activeJourneyFullQuery: InsightVizNode<FunnelsQuery> | null
+ activeJourneyId: string | null
+ filteredQuery: InsightVizNode<FunnelsQuery> | null
+ isProfileMode: boolean
+ journeyOptions: LemonSelectOptions<string>
+ journeys: CustomerJourneyApi[]
+ journeysLoading: boolean
+ queryOverride: InsightVizNode<FunnelsQuery> | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerJourneysLogicActions {
+ reportCustomerJourneyViewed: (
+ journeyId: string,
+ journeyName: string,
+ stepCount: number,
+ delay?: number
+ ) => {
+ delay: number | undefined
+ journeyId: string
+ journeyName: string
+ stepCount: number
+ } // eventUsageLogic
+ addJourney: ({ insightId, name, description }: { description?: string; insightId: number; name: string }) => {
+ insightId: number
+ name: string
+ description?: string
+ }
+ addJourneyFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ addJourneySuccess: (
+ journeys: CustomerJourneyApi[],
+ payload?: {
+ insightId: number
+ name: string
+ description?: string
+ }
+ ) => {
+ journeys: CustomerJourneyApi[]
+ payload?: {
+ insightId: number
+ name: string
+ description?: string
+ }
+ }
+ deleteJourney: (journeyId: string) => string
+ deleteJourneyFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteJourneySuccess: (
+ journeys: CustomerJourneyApi[],
+ payload?: string
+ ) => {
+ journeys: CustomerJourneyApi[]
+ payload?: string
+ }
+ loadActiveInsight: () => any
+ loadActiveInsightFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadActiveInsightSuccess: (
+ activeInsight: QueryBasedInsightModel<Node<Record<string, any>>> | null,
+ payload?: any
+ ) => {
+ activeInsight: QueryBasedInsightModel<Node<Record<string, any>>> | null
+ payload?: any
+ }
+ loadJourneys: () => any
+ loadJourneysFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadJourneysSuccess: (
+ journeys: CustomerJourneyApi[],
+ payload?: any
+ ) => {
+ journeys: CustomerJourneyApi[]
+ payload?: any
+ }
+ selectFirstJourneyIfNeeded: (journeys: CustomerJourneyApi[]) => {
+ journeys: CustomerJourneyApi[]
+ }
+ setActiveJourneyId: (journeyId: string | null) => {
+ journeyId: string | null
+ }
+ setQueryOverride: (query: InsightVizNode<FunnelsQuery>) => {
+ query: InsightVizNode<FunnelsQuery>
+ }
+ updateJourney: ({ journeyId, name, description }: { description?: string; journeyId: string; name: string }) => {
+ journeyId: string
+ name: string
+ description?: string
+ }
+ updateJourneyFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateJourneySuccess: (
+ journeys: CustomerJourneyApi[],
+ payload?: {
+ journeyId: string
+ name: string
+ description?: string
+ }
+ ) => {
+ journeys: CustomerJourneyApi[]
+ payload?: {
+ journeyId: string
+ name: string
+ description?: string
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerJourneysLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ journeyOptions: (journeys: CustomerJourneyApi[]) => LemonSelectOptions<string>
+ activeJourney: (journeys: CustomerJourneyApi[], activeJourneyId: string | null) => CustomerJourneyApi | null
+ activeJourneyFullQuery: (
+ activeInsight: QueryBasedInsightModel<Node<Record<string, any>>> | null,
+ queryOverride: InsightVizNode<FunnelsQuery> | null
+ ) => InsightVizNode<FunnelsQuery> | null
+ isProfileMode: (arg: any, arg2: any) => boolean
+ filteredQuery: (
+ activeJourneyFullQuery: InsightVizNode<FunnelsQuery> | null,
+ isProfileMode: boolean,
+ arg: any,
+ arg2: any,
+ arg3: any
+ ) => InsightVizNode<FunnelsQuery> | null
+ }
+}
+
+export type customerJourneysLogicType = MakeLogicType<
+ customerJourneysLogicValues,
+ customerJourneysLogicActions,
+ CustomerJourneysLogicProps,
+ customerJourneysLogicMeta
+>
+
export const customerJourneysLogic = kea<customerJourneysLogicType>([
path(['products', 'customer_analytics', 'frontend', 'components', 'CustomerJourneys', 'customerJourneysLogic']),
props({} as CustomerJourneysLogicProps),
@@ -156,7 +322,7 @@ export const customerJourneysLogic = kea<customerJourneysLogicType>([
selectors({
journeyOptions: [
(s) => [s.journeys],
- (journeys): LemonSelectOptions<string> =>
+ (journeys: CustomerJourneyApi[]): LemonSelectOptions<string> =>
journeys.map((journey) => ({
value: journey.id,
label: journey.name,
@@ -164,7 +330,7 @@ export const customerJourneysLogic = kea<customerJourneysLogicType>([
],
activeJourney: [
(s) => [s.journeys, s.activeJourneyId],
- (journeys, activeId): CustomerJourneyApi | null => {
+ (journeys: CustomerJourneyApi[], activeId: string | null): CustomerJourneyApi | null => {
if (!activeId) {
return null
}
@@ -173,7 +339,10 @@ export const customerJourneysLogic = kea<customerJourneysLogicType>([
],
activeJourneyFullQuery: [
(s) => [s.activeInsight, s.queryOverride],
- (activeInsight, queryOverride): InsightVizNode<FunnelsQuery> | null => {
+ (
+ activeInsight: QueryBasedInsightModel | null,
+ queryOverride: InsightVizNode<FunnelsQuery> | null
+ ): InsightVizNode<FunnelsQuery> | null => {
if (queryOverride) {
return queryOverride
}
@@ -207,7 +376,13 @@ export const customerJourneysLogic = kea<customerJourneysLogicType>([
(_, p) => p.groupKey,
(_, p) => p.groupTypeIndex,
],
- (query, isProfileMode, personId, groupKey, groupTypeIndex): InsightVizNode<FunnelsQuery> | null => {
+ (
+ query: InsightVizNode<FunnelsQuery> | null,
+ isProfileMode: boolean,
+ personId,
+ groupKey,
+ groupTypeIndex
+ ): InsightVizNode<FunnelsQuery> | null => {
if (!query || !isProfileMode) {
return query
}
diff --git a/products/customer_analytics/frontend/components/CustomerJourneys/journeyBuilderLogic.ts b/products/customer_analytics/frontend/components/CustomerJourneys/journeyBuilderLogic.ts
index 2e3934f357af..99610f84d1ca 100644
--- a/products/customer_analytics/frontend/components/CustomerJourneys/journeyBuilderLogic.ts
+++ b/products/customer_analytics/frontend/components/CustomerJourneys/journeyBuilderLogic.ts
@@ -1,4 +1,15 @@
-import { actions, afterMount, connect, isBreakpoint, kea, listeners, path, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ connect,
+ isBreakpoint,
+ kea,
+ listeners,
+ path,
+ reducers,
+ selectors,
+} from 'kea'
import { router, urlToAction } from 'kea-router'
import posthog from 'posthog-js'
@@ -35,9 +46,10 @@ import {
StepOrderValue,
} from '~/types'
+import type { Node } from '../../../../../frontend/src/queries/schema/schema-general'
import { customerAnalyticsConfigLogic } from '../../customerAnalyticsConfigLogic'
+import type { CustomerJourneyApi } from '../../generated/api.schemas'
import { customerJourneysLogic } from './customerJourneysLogic'
-import type { journeyBuilderLogicType } from './journeyBuilderLogicType'
const JOURNEY_NAME_MAX_LENGTH = 64
const INSIGHT_NAME_PREFIX = 'Journey: '
@@ -133,6 +145,202 @@ function createDefaultQuery(): InsightVizNode<FunnelsQuery> {
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface journeyBuilderLogicValues {
+ paymentEvent: AnyEntityNode // customerAnalyticsConfigLogic
+ signupEvent: AnyEntityNode // customerAnalyticsConfigLogic
+ signupPageviewEvent: AnyEntityNode // customerAnalyticsConfigLogic
+ breadcrumbs: Breadcrumb[]
+ creationSource: string | null
+ editingInsightId: number | null
+ editingJourneyId: string | null
+ isEditMode: boolean
+ isSaving: boolean
+ journeyDescription: string
+ journeyName: string
+ query: InsightVizNode<FunnelsQuery>
+ series: AnyEntityNode[]
+ stepCount: number
+ taxonomicGroupTypes: TaxonomicFilterGroupType[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface journeyBuilderLogicActions {
+ addJourney: (args_0: { description?: string; insightId: number; name: string }) => {
+ description?: string
+ insightId: number
+ name: string
+ } // customerJourneysLogic
+ addJourneyFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ } // customerJourneysLogic
+ addJourneySuccess: (
+ journeys: CustomerJourneyApi[],
+ payload?:
+ | {
+ description?: string
+ insightId: number
+ name: string
+ }
+ | undefined
+ ) => {
+ journeys: CustomerJourneyApi[]
+ payload?: {
+ description?: string
+ insightId: number
+ name: string
+ }
+ } // customerJourneysLogic
+ updateJourney: (args_0: { description?: string; journeyId: string; name: string }) => {
+ description?: string
+ journeyId: string
+ name: string
+ } // customerJourneysLogic
+ updateJourneyFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ } // customerJourneysLogic
+ updateJourneySuccess: (
+ journeys: CustomerJourneyApi[],
+ payload?:
+ | {
+ description?: string
+ journeyId: string
+ name: string
+ }
+ | undefined
+ ) => {
+ journeys: CustomerJourneyApi[]
+ payload?: {
+ description?: string
+ journeyId: string
+ name: string
+ }
+ } // customerJourneysLogic
+ reportCustomerJourneyBuilderStepAdded: (
+ stepIndex: number,
+ stepCount: number
+ ) => {
+ stepCount: number
+ stepIndex: number
+ } // eventUsageLogic
+ reportCustomerJourneyBuilderStepRemoved: (
+ stepIndex: number,
+ stepCount: number
+ ) => {
+ stepCount: number
+ stepIndex: number
+ } // eventUsageLogic
+ reportCustomerJourneyCreated: (
+ journeyName: string,
+ stepCount: number,
+ creationSource: string | null
+ ) => {
+ creationSource: string | null
+ journeyName: string
+ stepCount: number
+ } // eventUsageLogic
+ reportCustomerJourneyUpdated: (
+ journeyId: string,
+ journeyName: string,
+ stepCount: number
+ ) => {
+ journeyId: string
+ journeyName: string
+ stepCount: number
+ } // eventUsageLogic
+ collapsePath: () => {
+ value: true
+ } // funnelPathsExpansionLogic
+ setInsightQuery: (query: Node<Record<string, any>> | null) => {
+ query: Node<Record<string, any>> | null
+ } // insightDataLogic
+ addStep: (insertAtIndex: number) => {
+ insertAtIndex: number
+ }
+ addStepFromPath: (
+ eventName: string,
+ expansion: PathExpansion,
+ funnelStepCount: number
+ ) => {
+ eventName: string
+ expansion: PathExpansion
+ funnelStepCount: number
+ }
+ applyTemplate: (templateKey: string) => {
+ templateKey: string
+ }
+ loadFromInsight: (insightId: number) => {
+ insightId: number
+ }
+ removeStep: (stepIndex: number) => {
+ stepIndex: number
+ }
+ resetBuilder: () => {
+ value: true
+ }
+ saveJourney: () => {
+ value: true
+ }
+ saveJourneyFailure: (error: string) => {
+ error: string
+ }
+ setEditingJourney: (
+ journeyId: string,
+ insightId: number
+ ) => {
+ insightId: number
+ journeyId: string
+ }
+ setJourneyDescription: (description: string) => {
+ description: string
+ }
+ setJourneyName: (name: string) => {
+ name: string
+ }
+ setQuery: (query: InsightVizNode<FunnelsQuery>) => {
+ query: InsightVizNode<FunnelsQuery>
+ }
+ setQueryFromViz: (query: InsightVizNode<FunnelsQuery>) => {
+ query: InsightVizNode<FunnelsQuery>
+ }
+ updateStepEvent: (
+ stepIndex: number,
+ value: string | null,
+ groupType: TaxonomicFilterGroupType,
+ item: Record<string, any>
+ ) => {
+ groupType: TaxonomicFilterGroupType
+ item: Record<string, any>
+ stepIndex: number
+ value: string | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface journeyBuilderLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isEditMode: (editingJourneyId: string | null) => boolean
+ breadcrumbs: (isEditMode: boolean, journeyName: string) => Breadcrumb[]
+ stepCount: (query: InsightVizNode<FunnelsQuery>) => number
+ series: (query: InsightVizNode<FunnelsQuery>) => AnyEntityNode[]
+ }
+}
+
+export type journeyBuilderLogicType = MakeLogicType<
+ journeyBuilderLogicValues,
+ journeyBuilderLogicActions,
+ Record<string, any>,
+ journeyBuilderLogicMeta
+>
+
export const journeyBuilderLogic = kea<journeyBuilderLogicType>([
path(['products', 'customer_analytics', 'frontend', 'components', 'CustomerJourneys', 'journeyBuilderLogic']),
@@ -253,10 +461,10 @@ export const journeyBuilderLogic = kea<journeyBuilderLogicType>([
}),
selectors({
- isEditMode: [(s) => [s.editingJourneyId], (id): boolean => !!id],
+ isEditMode: [(s) => [s.editingJourneyId], (id: string | null): boolean => !!id],
breadcrumbs: [
(s) => [s.isEditMode, s.journeyName],
- (isEditMode, journeyName): Breadcrumb[] => [
+ (isEditMode: boolean, journeyName: string): Breadcrumb[] => [
{
key: Scene.CustomerAnalytics,
name: 'Customer analytics',
@@ -288,8 +496,11 @@ export const journeyBuilderLogic = kea<journeyBuilderLogicType>([
]),
],
],
- stepCount: [(s) => [s.query], (query): number => query.source.series.length],
- series: [(s) => [s.query], (query): AnyEntityNode[] => query.source.series as AnyEntityNode[]],
+ stepCount: [(s) => [s.query], (query: InsightVizNode<FunnelsQuery>): number => query.source.series.length],
+ series: [
+ (s) => [s.query],
+ (query: InsightVizNode<FunnelsQuery>): AnyEntityNode[] => query.source.series as AnyEntityNode[],
+ ],
taxonomicGroupTypes: [
() => [],
(): TaxonomicFilterGroupType[] => {
diff --git a/products/customer_analytics/frontend/components/CustomerJourneys/journeyEditorLogic.ts b/products/customer_analytics/frontend/components/CustomerJourneys/journeyEditorLogic.ts
index cc00b86016a7..9f9637a7caa1 100644
--- a/products/customer_analytics/frontend/components/CustomerJourneys/journeyEditorLogic.ts
+++ b/products/customer_analytics/frontend/components/CustomerJourneys/journeyEditorLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
@@ -11,7 +11,6 @@ import { insightsApi } from '~/scenes/insights/utils/api'
import { FunnelPathType } from '~/types'
import { customerJourneysLogic } from './customerJourneysLogic'
-import type { journeyEditorLogicType } from './journeyEditorLogicType'
export interface StagedNode {
nodeId: string
@@ -28,6 +27,92 @@ function layerIndexFromNodeId(nodeId: string): number {
return extractLayerIndex(rawName)
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface journeyEditorLogicValues {
+ expansionContext: ExpansionContext | null
+ insertionIndex: number
+ isEditMode: boolean
+ isSaving: boolean
+ newSeriesEntries: EventsNode[]
+ sortedStagedNodes: StagedNode[]
+ stagedNodeIds: Set<string>
+ stagedNodeOptional: Record<string, boolean>
+ stagedNodeOptionalMap: Map<string, boolean>
+ stagedNodes: StagedNode[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface journeyEditorLogicActions {
+ reportCustomerJourneyStepAddedFromPath: (
+ eventName: string,
+ pathType: string,
+ stepIndex: number
+ ) => {
+ eventName: string
+ pathType: string
+ stepIndex: number
+ } // eventUsageLogic
+ reportCustomerJourneyStepsSavedFromEditor: (
+ stepsAdded: number,
+ journeyId: string | null
+ ) => {
+ journeyId: string | null
+ stepsAdded: number
+ } // eventUsageLogic
+ cancelChanges: () => {
+ value: true
+ }
+ saveChanges: () => {
+ value: true
+ }
+ saveChangesFailure: (error: string) => {
+ error: string
+ }
+ saveChangesSuccess: () => {
+ value: true
+ }
+ stagePathNode: (
+ nodeId: string,
+ eventName: string,
+ expansion: PathExpansion,
+ funnelStepCount: number
+ ) => {
+ eventName: string
+ expansion: PathExpansion
+ funnelStepCount: number
+ nodeId: string
+ }
+ toggleStagedNodeOptional: (nodeId: string) => {
+ nodeId: string
+ }
+ unstagePathNode: (nodeId: string) => {
+ nodeId: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface journeyEditorLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isEditMode: (stagedNodes: StagedNode[]) => boolean
+ stagedNodeIds: (stagedNodes: StagedNode[]) => Set<string>
+ insertionIndex: (expansionContext: ExpansionContext | null) => number
+ sortedStagedNodes: (stagedNodes: StagedNode[]) => StagedNode[]
+ stagedNodeOptionalMap: (stagedNodeOptional: Record<string, boolean>) => Map<string, boolean>
+ newSeriesEntries: (
+ sortedStagedNodes: StagedNode[],
+ insertionIndex: number,
+ stagedNodeOptional: Record<string, boolean>
+ ) => EventsNode[]
+ }
+}
+
+export type journeyEditorLogicType = MakeLogicType<
+ journeyEditorLogicValues,
+ journeyEditorLogicActions,
+ Record<string, any>,
+ journeyEditorLogicMeta
+>
+
export const journeyEditorLogic = kea<journeyEditorLogicType>([
path(['products', 'customer_analytics', 'frontend', 'components', 'CustomerJourneys', 'journeyEditorLogic']),
@@ -97,14 +182,14 @@ export const journeyEditorLogic = kea<journeyEditorLogicType>([
}),
selectors({
- isEditMode: [(s) => [s.stagedNodes], (stagedNodes): boolean => stagedNodes.length > 0],
+ isEditMode: [(s) => [s.stagedNodes], (stagedNodes: StagedNode[]): boolean => stagedNodes.length > 0],
stagedNodeIds: [
(s) => [s.stagedNodes],
- (stagedNodes): Set<string> => new Set(stagedNodes.map((n) => n.nodeId)),
+ (stagedNodes: StagedNode[]): Set<string> => new Set(stagedNodes.map((n) => n.nodeId)),
],
insertionIndex: [
(s) => [s.expansionContext],
- (ctx): number => {
+ (ctx: ExpansionContext | null): number => {
if (!ctx) {
return 0
}
@@ -123,16 +208,21 @@ export const journeyEditorLogic = kea<journeyEditorLogicType>([
],
sortedStagedNodes: [
(s) => [s.stagedNodes],
- (stagedNodes): StagedNode[] =>
+ (stagedNodes: StagedNode[]): StagedNode[] =>
[...stagedNodes].sort((a, b) => layerIndexFromNodeId(a.nodeId) - layerIndexFromNodeId(b.nodeId)),
],
stagedNodeOptionalMap: [
(s) => [s.stagedNodeOptional],
- (stagedNodeOptional): Map<string, boolean> => new Map(Object.entries(stagedNodeOptional)),
+ (stagedNodeOptional: Record<string, boolean>): Map<string, boolean> =>
+ new Map(Object.entries(stagedNodeOptional)),
],
newSeriesEntries: [
(s) => [s.sortedStagedNodes, s.insertionIndex, s.stagedNodeOptional],
- (sortedNodes, insertionIndex, stagedNodeOptional): EventsNode[] => {
+ (
+ sortedNodes: StagedNode[],
+ insertionIndex: number,
+ stagedNodeOptional: Record<string, boolean>
+ ): EventsNode[] => {
return sortedNodes.map((node, i) => {
const entry = eventNameToEventsNode(node.eventName)
const isFirstFunnelStep = insertionIndex === 0 && i === 0
diff --git a/products/customer_analytics/frontend/components/ZendeskTicketsFilters/zendeskTicketsFiltersLogic.ts b/products/customer_analytics/frontend/components/ZendeskTicketsFilters/zendeskTicketsFiltersLogic.ts
index e0724556b93f..8fb11e76584a 100644
--- a/products/customer_analytics/frontend/components/ZendeskTicketsFilters/zendeskTicketsFiltersLogic.ts
+++ b/products/customer_analytics/frontend/components/ZendeskTicketsFilters/zendeskTicketsFiltersLogic.ts
@@ -1,6 +1,4 @@
-import { actions, kea, key, path, props, reducers } from 'kea'
-
-import type { zendeskTicketsFiltersLogicType } from './zendeskTicketsFiltersLogicType'
+import { MakeLogicType, actions, kea, key, path, props, reducers } from 'kea'
const DEFAULT_PRIORITY = 'all'
const DEFAULT_STATUS = 'all'
@@ -11,6 +9,42 @@ export interface ZendeskTicketsFiltersLogicProps {
logicKey: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface zendeskTicketsFiltersLogicValues {
+ orderBy: string
+ orderDirection: string
+ priority: string
+ status: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface zendeskTicketsFiltersLogicActions {
+ setOrderBy: (orderBy: string) => {
+ orderBy: string
+ }
+ setOrderDirection: (orderDirection: string) => {
+ orderDirection: string
+ }
+ setPriority: (priority: string) => {
+ priority: string
+ }
+ setStatus: (status: string) => {
+ status: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface zendeskTicketsFiltersLogicMeta {
+ key: string
+}
+
+export type zendeskTicketsFiltersLogicType = MakeLogicType<
+ zendeskTicketsFiltersLogicValues,
+ zendeskTicketsFiltersLogicActions,
+ ZendeskTicketsFiltersLogicProps,
+ zendeskTicketsFiltersLogicMeta
+>
+
export const zendeskTicketsFiltersLogic = kea<zendeskTicketsFiltersLogicType>([
path(['products', 'customer_analytics', 'components', 'ZendeskTicketsFilters', 'zendeskTicketsFiltersLogic']),
props({} as ZendeskTicketsFiltersLogicProps),
diff --git a/products/customer_analytics/frontend/customerAnalyticsConfigLogic.ts b/products/customer_analytics/frontend/customerAnalyticsConfigLogic.ts
index 24ba139e5151..f08ff2b30d93 100644
--- a/products/customer_analytics/frontend/customerAnalyticsConfigLogic.ts
+++ b/products/customer_analytics/frontend/customerAnalyticsConfigLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, selectors } from 'kea'
import { isEmptyObject } from 'lib/utils/guards'
import { teamLogic } from 'scenes/teamLogic'
@@ -12,7 +12,46 @@ import {
GroupNode,
} from '~/queries/schema/schema-general'
-import type { customerAnalyticsConfigLogicType } from './customerAnalyticsConfigLogicType'
+import type { TeamType } from '../../../frontend/src/types'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerAnalyticsConfigLogicValues {
+ customerAnalyticsConfig: CustomerAnalyticsConfig // teamLogic
+ activityEvent: AnyEntityNode
+ paymentEvent: AnyEntityNode
+ signupEvent: AnyEntityNode
+ signupPageviewEvent: AnyEntityNode
+ subscriptionEvent: AnyEntityNode
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerAnalyticsConfigLogicActions {
+ updateCurrentTeam: (payload: Partial<TeamType>) => Partial<TeamType> // teamLogic
+ loadConfig: () => {
+ value: true
+ }
+ updateEvents: (events: Record<string, ActionsNode | DataWarehouseNode | EventsNode | GroupNode>) => {
+ events: Record<string, ActionsNode | DataWarehouseNode | EventsNode | GroupNode<DataWarehouseNode>>
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerAnalyticsConfigLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ activityEvent: (customerAnalyticsConfig: CustomerAnalyticsConfig) => AnyEntityNode
+ signupEvent: (customerAnalyticsConfig: CustomerAnalyticsConfig) => AnyEntityNode
+ signupPageviewEvent: (customerAnalyticsConfig: CustomerAnalyticsConfig) => AnyEntityNode
+ subscriptionEvent: (customerAnalyticsConfig: CustomerAnalyticsConfig) => AnyEntityNode
+ paymentEvent: (customerAnalyticsConfig: CustomerAnalyticsConfig) => AnyEntityNode
+ }
+}
+
+export type customerAnalyticsConfigLogicType = MakeLogicType<
+ customerAnalyticsConfigLogicValues,
+ customerAnalyticsConfigLogicActions,
+ Record<string, any>,
+ customerAnalyticsConfigLogicMeta
+>
export const customerAnalyticsConfigLogic = kea<customerAnalyticsConfigLogicType>([
path(['products', 'customerAnalytics', 'customerAnalyticsConfigModel']),
diff --git a/products/customer_analytics/frontend/customerAnalyticsSceneLogic.ts b/products/customer_analytics/frontend/customerAnalyticsSceneLogic.ts
index 6ef978acaa66..f405307923a7 100644
--- a/products/customer_analytics/frontend/customerAnalyticsSceneLogic.ts
+++ b/products/customer_analytics/frontend/customerAnalyticsSceneLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, path, reducers, selectors } from 'kea'
import { router, urlToAction } from 'kea-router'
import { FunnelLayout } from 'lib/constants'
@@ -35,9 +35,11 @@ import {
StepOrderValue,
} from '~/types'
+import type { Noun } from '../../../frontend/src/models/groupsModel'
+import type { CustomerAnalyticsConfig } from '../../../frontend/src/queries/schema/schema-general'
+import type { GroupType } from '../../../frontend/src/types'
import { CUSTOMER_ANALYTICS_DEFAULT_QUERY_TAGS } from './constants'
import { customerAnalyticsConfigLogic } from './customerAnalyticsConfigLogic'
-import type { customerAnalyticsSceneLogicType } from './customerAnalyticsSceneLogicType'
export type BusinessType = 'b2c' | 'b2b'
@@ -77,6 +79,180 @@ const setQueryParams = (params: Record<string, string>): string => {
return `${currentPath}${urlParams.toString() ? '?' + urlParams.toString() : ''}`
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerAnalyticsSceneLogicValues {
+ activityEvent: AnyEntityNode // customerAnalyticsConfigLogic
+ customerAnalyticsConfig: CustomerAnalyticsConfig // customerAnalyticsConfigLogic
+ paymentEvent: AnyEntityNode // customerAnalyticsConfigLogic
+ signupEvent: AnyEntityNode // customerAnalyticsConfigLogic
+ signupPageviewEvent: AnyEntityNode // customerAnalyticsConfigLogic
+ subscriptionEvent: AnyEntityNode // customerAnalyticsConfigLogic
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun // groupsModel
+ groupTypesRaw: Array<GroupType> // groupsModel
+ groupsEnabled: boolean // groupsModel
+ sceneKey: string | null // sceneLogic
+ activeTab: 'accounts' | 'dashboard' | 'journeys' | 'notes'
+ activeUsersInsights: InsightDefinition[]
+ breadcrumbs: Breadcrumb[]
+ businessType: BusinessType
+ customerLabel: {
+ plural: string
+ singular: string
+ }
+ dateFilter: {
+ dateFrom: string | null
+ dateTo: string | null
+ interval: SimpleIntervalType
+ }
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ }
+ dauSeries: AnyEntityNode | null
+ filterTestAccounts: boolean
+ groupOptions: {
+ label: string
+ value: number
+ }[]
+ mauSeries: AnyEntityNode | null
+ mineOnly: boolean
+ paymentSeries: AnyEntityNode | null
+ selectedGroupType: number
+ sessionInsights: InsightDefinition[]
+ signupInsights: InsightDefinition[]
+ signupPageviewSeries: AnyEntityNode | null
+ signupSeries: AnyEntityNode | null
+ subscriptionSeries: AnyEntityNode | null
+ wauSeries: AnyEntityNode | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerAnalyticsSceneLogicActions {
+ setBusinessType: (businessType: BusinessType) => {
+ businessType: BusinessType
+ }
+ setDates: (
+ dateFrom: string | null,
+ dateTo: string | null
+ ) => {
+ dateFrom: string | null
+ dateTo: string | null
+ }
+ setFilterTestAccounts: (filterTestAccounts: boolean) => {
+ filterTestAccounts: boolean
+ }
+ setMineOnly: (mineOnly: boolean) => {
+ mineOnly: boolean
+ }
+ setSelectedGroupType: (selectedGroupType: number) => {
+ selectedGroupType: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerAnalyticsSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ activeTab: (sceneKey: string | null) => 'accounts' | 'dashboard' | 'journeys' | 'notes'
+ customerLabel: (
+ aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun,
+ businessType: BusinessType,
+ selectedGroupType: number
+ ) => {
+ plural: string
+ singular: string
+ }
+ dateRange: (dateFilter: { dateFrom: string | null; dateTo: string | null; interval: SimpleIntervalType }) => {
+ date_from: string | null
+ date_to: string | null
+ }
+ groupOptions: (groupTypesRaw: GroupType[]) => {
+ label: string
+ value: number
+ }[]
+ dauSeries: (
+ activityEvent: AnyEntityNode,
+ businessType: BusinessType,
+ selectedGroupType: number
+ ) => AnyEntityNode | null
+ wauSeries: (
+ activityEvent: AnyEntityNode,
+ businessType: BusinessType,
+ selectedGroupType: number
+ ) => AnyEntityNode | null
+ mauSeries: (
+ activityEvent: AnyEntityNode,
+ businessType: BusinessType,
+ selectedGroupType: number
+ ) => AnyEntityNode | null
+ signupSeries: (
+ businessType: BusinessType,
+ selectedGroupType: number,
+ signupEvent: AnyEntityNode
+ ) => AnyEntityNode | null
+ signupPageviewSeries: (
+ businessType: BusinessType,
+ selectedGroupType: number,
+ signupPageviewEvent: AnyEntityNode
+ ) => AnyEntityNode | null
+ subscriptionSeries: (
+ businessType: BusinessType,
+ selectedGroupType: number,
+ subscriptionEvent: AnyEntityNode
+ ) => AnyEntityNode | null
+ paymentSeries: (
+ businessType: BusinessType,
+ selectedGroupType: number,
+ paymentEvent: AnyEntityNode
+ ) => AnyEntityNode | null
+ activeUsersInsights: (
+ customerLabel: {
+ plural: string
+ singular: string
+ },
+ dauSeries: AnyEntityNode | null,
+ wauSeries: AnyEntityNode | null,
+ mauSeries: AnyEntityNode | null,
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ filterTestAccounts: boolean
+ ) => InsightDefinition[]
+ sessionInsights: (
+ customerLabel: {
+ plural: string
+ singular: string
+ },
+ filterTestAccounts: boolean
+ ) => InsightDefinition[]
+ signupInsights: (
+ businessType: BusinessType,
+ customerLabel: {
+ plural: string
+ singular: string
+ },
+ signupSeries: AnyEntityNode | null,
+ paymentSeries: AnyEntityNode | null,
+ selectedGroupType: number,
+ subscriptionSeries: AnyEntityNode | null,
+ signupPageviewSeries: AnyEntityNode | null,
+ dauSeries: AnyEntityNode | null,
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ filterTestAccounts: boolean
+ ) => InsightDefinition[]
+ }
+}
+
+export type customerAnalyticsSceneLogicType = MakeLogicType<
+ customerAnalyticsSceneLogicValues,
+ customerAnalyticsSceneLogicActions,
+ Record<string, any>,
+ customerAnalyticsSceneLogicMeta
+>
+
export const customerAnalyticsSceneLogic = kea<customerAnalyticsSceneLogicType>([
path(['scenes', 'customerAnalytics', 'customerAnalyticsScene']),
connect(() => ({
@@ -150,7 +326,7 @@ export const customerAnalyticsSceneLogic = kea<customerAnalyticsSceneLogicType>(
selectors({
activeTab: [
(s) => [s.sceneKey],
- (sceneKey): 'dashboard' | 'journeys' | 'accounts' | 'notes' => {
+ (sceneKey: string | null): 'dashboard' | 'journeys' | 'accounts' | 'notes' => {
if (sceneKey === 'customerAnalyticsJourneys') {
return 'journeys'
}
@@ -280,7 +456,11 @@ export const customerAnalyticsSceneLogic = kea<customerAnalyticsSceneLogicType>(
],
signupSeries: [
(s) => [s.businessType, s.selectedGroupType, s.signupEvent],
- (businessType: BusinessType, selectedGroupType: GroupTypeIndex, signupEvent): AnyEntityNode | null => {
+ (
+ businessType: BusinessType,
+ selectedGroupType: GroupTypeIndex,
+ signupEvent: AnyEntityNode
+ ): AnyEntityNode | null => {
if (Object.keys(signupEvent).length === 0) {
return null
}
@@ -302,7 +482,7 @@ export const customerAnalyticsSceneLogic = kea<customerAnalyticsSceneLogicType>(
(
businessType: BusinessType,
selectedGroupType: GroupTypeIndex,
- signupPageviewEvent
+ signupPageviewEvent: AnyEntityNode
): AnyEntityNode | null => {
if (Object.keys(signupPageviewEvent).length === 0) {
return null
@@ -325,7 +505,7 @@ export const customerAnalyticsSceneLogic = kea<customerAnalyticsSceneLogicType>(
(
businessType: BusinessType,
selectedGroupType: GroupTypeIndex,
- subscriptionEvent
+ subscriptionEvent: AnyEntityNode
): AnyEntityNode | null => {
if (Object.keys(subscriptionEvent).length === 0) {
return null
@@ -345,7 +525,11 @@ export const customerAnalyticsSceneLogic = kea<customerAnalyticsSceneLogicType>(
],
paymentSeries: [
(s) => [s.businessType, s.selectedGroupType, s.paymentEvent],
- (businessType: BusinessType, selectedGroupType: GroupTypeIndex, paymentEvent): AnyEntityNode | null => {
+ (
+ businessType: BusinessType,
+ selectedGroupType: GroupTypeIndex,
+ paymentEvent: AnyEntityNode
+ ): AnyEntityNode | null => {
if (Object.keys(paymentEvent).length === 0) {
return null
}
@@ -486,7 +670,13 @@ export const customerAnalyticsSceneLogic = kea<customerAnalyticsSceneLogicType>(
],
sessionInsights: [
(s) => [s.customerLabel, s.filterTestAccounts],
- (customerLabel, filterTestAccounts): InsightDefinition[] => [
+ (
+ customerLabel: {
+ plural: string
+ singular: string
+ },
+ filterTestAccounts: boolean
+ ): InsightDefinition[] => [
{
name: 'Unique sessions',
description: 'Events without session IDs are excluded.',
@@ -629,16 +819,22 @@ export const customerAnalyticsSceneLogic = kea<customerAnalyticsSceneLogicType>(
s.filterTestAccounts,
],
(
- businessType,
- customerLabel,
- signupSeries,
- paymentSeries,
- selectedGroupType,
- subscriptionSeries,
- signupPageviewSeries,
- dauSeries,
- dateRange,
- filterTestAccounts
+ businessType: BusinessType,
+ customerLabel: {
+ plural: string
+ singular: string
+ },
+ signupSeries: AnyEntityNode | null,
+ paymentSeries: AnyEntityNode | null,
+ selectedGroupType: number,
+ subscriptionSeries: AnyEntityNode | null,
+ signupPageviewSeries: AnyEntityNode | null,
+ dauSeries: AnyEntityNode | null,
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ filterTestAccounts: boolean
): InsightDefinition[] => [
{
name: `${capitalizeFirstLetter(customerLabel.singular)} signups`,
diff --git a/products/customer_analytics/frontend/customerProfileConfigLogic.ts b/products/customer_analytics/frontend/customerProfileConfigLogic.ts
index a4e4e601f9d6..4b105ff7b160 100644
--- a/products/customer_analytics/frontend/customerProfileConfigLogic.ts
+++ b/products/customer_analytics/frontend/customerProfileConfigLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -7,12 +7,130 @@ import { teamLogic } from 'scenes/teamLogic'
import { CustomerProfileConfigType, CustomerProfileScope } from '~/types'
-import type { customerProfileConfigLogicType } from './customerProfileConfigLogicType'
-
export interface CustomerProfileConfigLogicProps {
scope?: CustomerProfileScope
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerProfileConfigLogicValues {
+ currentTeamId: number | null // teamLogic
+ configs: CustomerProfileConfigType[]
+ configsLoading: boolean
+ customerProfileConfig: CustomerProfileConfigType | undefined
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerProfileConfigLogicActions {
+ createConfig: (config: Partial<CustomerProfileConfigType>) => {
+ config: Partial<CustomerProfileConfigType>
+ }
+ createConfigFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ createConfigSuccess: (
+ configs: CustomerProfileConfigType[],
+ payload?: {
+ config: Partial<CustomerProfileConfigType>
+ }
+ ) => {
+ configs: CustomerProfileConfigType[]
+ payload?: {
+ config: Partial<CustomerProfileConfigType>
+ }
+ }
+ deleteConfig: (id: CustomerProfileConfigType['id']) => {
+ id: string
+ }
+ deleteConfigFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteConfigSuccess: (
+ configs: CustomerProfileConfigType[],
+ payload?: {
+ id: string
+ }
+ ) => {
+ configs: CustomerProfileConfigType[]
+ payload?: {
+ id: string
+ }
+ }
+ loadConfigs: () => {
+ value: true
+ }
+ loadConfigsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadConfigsSuccess: (
+ configs: CustomerProfileConfigType[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ configs: CustomerProfileConfigType[]
+ payload?: {
+ value: true
+ }
+ }
+ setConfigs: (configs: CustomerProfileConfigType[]) => {
+ configs: CustomerProfileConfigType[]
+ }
+ updateConfig: (
+ id: CustomerProfileConfigType['id'],
+ config: Partial<CustomerProfileConfigType>
+ ) => {
+ config: Partial<CustomerProfileConfigType>
+ id: string
+ }
+ updateConfigFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ updateConfigSuccess: (
+ configs: CustomerProfileConfigType[],
+ payload?: {
+ config: Partial<CustomerProfileConfigType>
+ id: string
+ }
+ ) => {
+ configs: CustomerProfileConfigType[]
+ payload?: {
+ config: Partial<CustomerProfileConfigType>
+ id: string
+ }
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerProfileConfigLogicMeta {
+ key: CustomerProfileScope | 'all'
+ __keaTypeGenInternalSelectorTypes: {
+ customerProfileConfig: (configs: CustomerProfileConfigType[], arg: any) => CustomerProfileConfigType | undefined
+ }
+}
+
+export type customerProfileConfigLogicType = MakeLogicType<
+ customerProfileConfigLogicValues,
+ customerProfileConfigLogicActions,
+ CustomerProfileConfigLogicProps,
+ customerProfileConfigLogicMeta
+>
+
export const customerProfileConfigLogic = kea<customerProfileConfigLogicType>([
path(['products', 'customer_analytics', 'customerProfileConfigLogic']),
props({} as CustomerProfileConfigLogicProps),
@@ -84,7 +202,8 @@ export const customerProfileConfigLogic = kea<customerProfileConfigLogicType>([
selectors({
customerProfileConfig: [
(s) => [s.configs, (_, props) => props.scope],
- (configs, scope): CustomerProfileConfigType | undefined => configs.find((c) => c.scope === scope),
+ (configs: CustomerProfileConfigType[], scope): CustomerProfileConfigType | undefined =>
+ configs.find((c) => c.scope === scope),
],
}),
diff --git a/products/customer_analytics/frontend/customerProfileLogic.ts b/products/customer_analytics/frontend/customerProfileLogic.ts
index 59c231d5566a..96686f5e5a38 100644
--- a/products/customer_analytics/frontend/customerProfileLogic.ts
+++ b/products/customer_analytics/frontend/customerProfileLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { JSONContent } from 'lib/components/RichContentEditor/types'
import { FEATURE_FLAGS } from 'lib/constants'
@@ -12,8 +12,15 @@ import { CustomerProfileScope, GroupTypeIndex } from '~/types'
import { sourceManagementLogic } from 'products/data_warehouse/frontend/shared/logics/sourceManagementLogic'
+import type { PaginatedResponse } from '../../../frontend/src/lib/api'
+import type { FeatureFlagsSet } from '../../../frontend/src/lib/logic/featureFlagLogic'
+import type {
+ CustomerProfileConfigType,
+ ExternalDataSource,
+ TeamPublicType,
+ TeamType,
+} from '../../../frontend/src/types'
import { customerProfileConfigLogic } from './customerProfileConfigLogic'
-import type { customerProfileLogicType } from './customerProfileLogicType'
export const DEFAULT_PERSON_PROFILE_SIDEBAR: JSONContent[] = [
{ type: NotebookNodeType.Person, attrs: { title: 'Info' } },
@@ -96,6 +103,172 @@ export interface PersonProfileLogicProps {
canvasShortId: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerProfileLogicValues {
+ customerProfileConfig: CustomerProfileConfigType | undefined // customerProfileConfigLogic
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ dataWarehouseSourcesLoading: boolean // sourceManagementLogic
+ hasZendeskSource: boolean // sourceManagementLogic
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
+ changed: boolean
+ content: JSONContent[]
+ defaultContent: JSONContent[]
+ isProfileConfigEnabled: boolean | string | undefined
+ profileLocalContent: JSONContent[] | null
+ scopedAddAttrFunction: ({ attrs, node, children }: AddAttrsToNodeProps) => JSONContent
+ scopedSidebarContent: JSONContent[]
+ storedContent: JSONContent[] | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerProfileLogicActions {
+ createConfig: (config: Partial<CustomerProfileConfigType>) => {
+ config: Partial<CustomerProfileConfigType>
+ } // customerProfileConfigLogic
+ createConfigSuccess: (
+ configs: CustomerProfileConfigType[],
+ payload?:
+ | {
+ config: Partial<CustomerProfileConfigType>
+ }
+ | undefined
+ ) => {
+ configs: CustomerProfileConfigType[]
+ payload?: {
+ config: Partial<CustomerProfileConfigType>
+ }
+ } // customerProfileConfigLogic
+ loadConfigsSuccess: (
+ configs: CustomerProfileConfigType[],
+ payload?:
+ | {
+ value: true
+ }
+ | undefined
+ ) => {
+ configs: CustomerProfileConfigType[]
+ payload?: {
+ value: true
+ }
+ } // customerProfileConfigLogic
+ updateConfig: (
+ id: string,
+ config: Partial<CustomerProfileConfigType>
+ ) => {
+ config: Partial<CustomerProfileConfigType>
+ id: string
+ } // customerProfileConfigLogic
+ updateConfigSuccess: (
+ configs: CustomerProfileConfigType[],
+ payload?:
+ | {
+ config: Partial<CustomerProfileConfigType>
+ id: string
+ }
+ | undefined
+ ) => {
+ configs: CustomerProfileConfigType[]
+ payload?: {
+ config: Partial<CustomerProfileConfigType>
+ id: string
+ }
+ } // customerProfileConfigLogic
+ setLocalContent: (
+ jsonContent: JSONContent,
+ skipCapture?: any
+ ) => {
+ jsonContent: JSONContent
+ skipCapture: any
+ } // notebookLogic
+ loadSourcesSuccess: (
+ dataWarehouseSources:
+ | PaginatedResponse<ExternalDataSource>
+ | {
+ count: number
+ next: null
+ previous: null
+ results: never[]
+ },
+ payload?: {
+ value: true
+ }
+ ) => {
+ dataWarehouseSources:
+ | PaginatedResponse<ExternalDataSource>
+ | {
+ count: number
+ next: null
+ previous: null
+ results: never[]
+ }
+ payload?: {
+ value: true
+ }
+ } // sourceManagementLogic
+ addNode: (nodeType: string) => {
+ nodeType: string
+ }
+ removeNode: (nodeType: string) => {
+ nodeType: string
+ }
+ resetToDefaults: () => {
+ value: true
+ }
+ saveChanges: () => {
+ value: true
+ }
+ setProfileLocalContent: (content: JSONContent[] | null) => {
+ content: JSONContent[] | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerProfileLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ changed: (
+ profileLocalContent: JSONContent[] | null,
+ storedContent: JSONContent[] | null,
+ defaultContent: JSONContent[]
+ ) => boolean
+ isProfileConfigEnabled: (featureFlags: FeatureFlagsSet) => boolean | string | undefined
+ scopedSidebarContent: (arg: any) => JSONContent[]
+ scopedAddAttrFunction: (arg: any) => ({ attrs, node, children }: AddAttrsToNodeProps) => JSONContent
+ defaultContent: (
+ scopedSidebarContent: JSONContent[],
+ scopedAddAttrFunction: ({ attrs, node, children }: AddAttrsToNodeProps) => JSONContent,
+ featureFlags: FeatureFlagsSet,
+ hasZendeskSource: boolean,
+ dataWarehouseSourcesLoading: boolean,
+ currentTeam: TeamPublicType | TeamType | null,
+ arg: any,
+ arg2: any
+ ) => JSONContent[]
+ storedContent: (
+ customerProfileConfig: CustomerProfileConfigType | undefined,
+ scopedAddAttrFunction: ({ attrs, node, children }: AddAttrsToNodeProps) => JSONContent,
+ featureFlags: FeatureFlagsSet,
+ hasZendeskSource: boolean,
+ dataWarehouseSourcesLoading: boolean,
+ currentTeam: TeamPublicType | TeamType | null,
+ arg: any
+ ) => JSONContent[] | null
+ content: (
+ defaultContent: JSONContent[],
+ storedContent: JSONContent[] | null,
+ profileLocalContent: JSONContent[] | null,
+ isProfileConfigEnabled: boolean | string | undefined
+ ) => JSONContent[]
+ }
+}
+
+export type customerProfileLogicType = MakeLogicType<
+ customerProfileLogicValues,
+ customerProfileLogicActions,
+ PersonProfileLogicProps,
+ customerProfileLogicMeta
+>
+
export const customerProfileLogic = kea<customerProfileLogicType>([
path(['products', 'customer_analytics', 'frontend', 'customerProfileLogic']),
props({} as PersonProfileLogicProps),
@@ -144,7 +317,11 @@ export const customerProfileLogic = kea<customerProfileLogicType>([
selectors({
changed: [
(s) => [s.profileLocalContent, s.storedContent, s.defaultContent],
- (profileLocalContent, storedContent, defaultContent) => {
+ (
+ profileLocalContent: JSONContent[] | null,
+ storedContent: JSONContent[] | null,
+ defaultContent: JSONContent[]
+ ) => {
if (!profileLocalContent) {
return false
}
@@ -167,7 +344,8 @@ export const customerProfileLogic = kea<customerProfileLogicType>([
],
isProfileConfigEnabled: [
(s) => [s.featureFlags],
- (featureFlags) => featureFlags[FEATURE_FLAGS.CUSTOMER_PROFILE_CONFIG_BUTTON],
+ (featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet) =>
+ featureFlags[FEATURE_FLAGS.CUSTOMER_PROFILE_CONFIG_BUTTON],
],
scopedSidebarContent: [
() => [(_, props) => props.scope],
@@ -190,12 +368,12 @@ export const customerProfileLogic = kea<customerProfileLogicType>([
(_, props) => props.attrs,
],
(
- scopedSidebarContent,
- scopedAddAttrFunction,
- featureFlags,
- hasZendeskSource,
- dataWarehouseSourcesLoading,
- currentTeam,
+ scopedSidebarContent: JSONContent[],
+ scopedAddAttrFunction: ({ attrs, node, children }: AddAttrsToNodeProps) => JSONContent,
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet,
+ hasZendeskSource: boolean,
+ dataWarehouseSourcesLoading: boolean,
+ currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType,
scope,
attrs
) => {
@@ -231,12 +409,12 @@ export const customerProfileLogic = kea<customerProfileLogicType>([
(_, props) => props.attrs,
],
(
- customerProfileConfig,
- scopedAddAttrFunction,
- featureFlags,
- hasZendeskSource,
- dataWarehouseSourcesLoading,
- currentTeam,
+ customerProfileConfig: import('~/types').CustomerProfileConfigType | undefined,
+ scopedAddAttrFunction: ({ attrs, node, children }: AddAttrsToNodeProps) => JSONContent,
+ featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet,
+ hasZendeskSource: boolean,
+ dataWarehouseSourcesLoading: boolean,
+ currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType,
attrs
): JSONContent[] | null => {
if (!customerProfileConfig) {
@@ -268,7 +446,12 @@ export const customerProfileLogic = kea<customerProfileLogicType>([
],
content: [
(s) => [s.defaultContent, s.storedContent, s.profileLocalContent, s.isProfileConfigEnabled],
- (defaultContent, storedContent, profileLocalContent, isProfileConfigEnabled): JSONContent[] => {
+ (
+ defaultContent: JSONContent[],
+ storedContent: JSONContent[] | null,
+ profileLocalContent: JSONContent[] | null,
+ isProfileConfigEnabled: boolean | string | undefined
+ ): JSONContent[] => {
// Return default content if flag is disabled
if (isProfileConfigEnabled) {
if (profileLocalContent !== null) {
diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.ts b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.ts
index 53e3f1c3c2aa..c12c54855e41 100644
--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.ts
+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.ts
@@ -1,5 +1,6 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { loaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -27,7 +28,6 @@ import type {
CustomPropertyReferenceApi,
} from 'products/customer_analytics/frontend/generated/api.schemas'
-import type { customPropertyDefinitionsLogicType } from './customPropertyDefinitionsLogicType'
import { NEW_OPTION_ID_PREFIX, isNumericDisplayType, optionLabelError } from './customPropertyTypes'
export type CustomPropertySourceMode = 'manual' | 'data_warehouse' | 'workflow'
@@ -135,6 +135,219 @@ const handleNameConflict = (error: unknown, setManualErrors: (errors: { name: st
class MissingNameError extends Error {}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customPropertyDefinitionsLogicValues {
+ currentProjectId: number | null // projectLogic
+ columnMappingWarnings: (string | null)[]
+ customPropertyForm: CustomPropertyFormValues
+ customPropertyFormAllErrors: Record<string, any>
+ customPropertyFormChanged: boolean
+ customPropertyFormErrors: DeepPartialMap<CustomPropertyFormValues, ValidationErrorType>
+ customPropertyFormHasErrors: boolean
+ customPropertyFormManualErrors: Record<string, any>
+ customPropertyFormTouched: boolean
+ customPropertyFormTouches: Record<string, boolean>
+ customPropertyFormValidationErrors: DeepPartialMap<CustomPropertyFormValues, ValidationErrorType>
+ definitions: CustomPropertyDefinitionApi[]
+ definitionsLoading: boolean
+ editingDefinition: CustomPropertyDefinitionApi | null
+ editingReferences: readonly CustomPropertyReferenceApi[]
+ isCustomPropertyFormSubmitting: boolean
+ isCustomPropertyFormValid: boolean
+ materializedViews: DataWarehouseSavedQuery[]
+ modalVisible: boolean
+ newWorkflowUrl: string | null
+ newWorkflowUrlLoading: boolean
+ personPropertyDefinitions: PropertyDefinition[]
+ personPropertyDefinitionsLoading: boolean
+ savedQueries: DataWarehouseSavedQuery[]
+ savedQueriesLoading: boolean
+ selectedSourceColumns: string[]
+ selectedWarehouseSchemaId: string | null
+ serializedColumnPropertyMap: Record<string, string>
+ showCustomPropertyFormErrors: boolean
+ warehouseTables: DataWarehouseTable[]
+ warehouseTablesLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customPropertyDefinitionsLogicActions {
+ closeModal: () => {
+ value: true
+ }
+ createWorkflowForProperty: () => any
+ createWorkflowForPropertyFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ createWorkflowForPropertySuccess: (
+ newWorkflowUrl: string,
+ payload?: any
+ ) => {
+ newWorkflowUrl: string
+ payload?: any
+ }
+ deleteDefinition: ({ id }: { id: string }) => {
+ id: string
+ }
+ deleteDefinitionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteDefinitionSuccess: (
+ definitions: CustomPropertyDefinitionApi[],
+ payload?: {
+ id: string
+ }
+ ) => {
+ definitions: CustomPropertyDefinitionApi[]
+ payload?: {
+ id: string
+ }
+ }
+ loadDefinitions: () => any
+ loadDefinitionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDefinitionsSuccess: (
+ definitions: CustomPropertyDefinitionApi[],
+ payload?: any
+ ) => {
+ definitions: CustomPropertyDefinitionApi[]
+ payload?: any
+ }
+ loadPersonPropertyDefinitions: () => any
+ loadPersonPropertyDefinitionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPersonPropertyDefinitionsSuccess: (
+ personPropertyDefinitions: PropertyDefinition[],
+ payload?: any
+ ) => {
+ personPropertyDefinitions: PropertyDefinition[]
+ payload?: any
+ }
+ loadSavedQueries: () => any
+ loadSavedQueriesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadSavedQueriesSuccess: (
+ savedQueries: DataWarehouseSavedQuery[],
+ payload?: any
+ ) => {
+ savedQueries: DataWarehouseSavedQuery[]
+ payload?: any
+ }
+ loadWarehouseTables: () => any
+ loadWarehouseTablesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadWarehouseTablesSuccess: (
+ warehouseTables: DataWarehouseTable[],
+ payload?: any
+ ) => {
+ warehouseTables: DataWarehouseTable[]
+ payload?: any
+ }
+ openCreateModal: () => {
+ value: true
+ }
+ openEditModal: (definition: CustomPropertyDefinitionApi) => {
+ definition: CustomPropertyDefinitionApi
+ }
+ resetCustomPropertyForm: (values?: CustomPropertyFormValues) => {
+ values?: CustomPropertyFormValues
+ }
+ setCustomPropertyFormManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setCustomPropertyFormValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setCustomPropertyFormValues: (values: DeepPartial<CustomPropertyFormValues>) => {
+ values: DeepPartial<CustomPropertyFormValues>
+ }
+ setEditingDefinition: (definition: CustomPropertyDefinitionApi) => {
+ definition: CustomPropertyDefinitionApi
+ }
+ submitCustomPropertyForm: () => {
+ value: boolean
+ }
+ submitCustomPropertyFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitCustomPropertyFormRequest: (customPropertyForm: CustomPropertyFormValues) => {
+ customPropertyForm: CustomPropertyFormValues
+ }
+ submitCustomPropertyFormSuccess: (customPropertyForm: CustomPropertyFormValues) => {
+ customPropertyForm: CustomPropertyFormValues
+ }
+ touchCustomPropertyFormField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customPropertyDefinitionsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ materializedViews: (savedQueries: DataWarehouseSavedQuery[]) => DataWarehouseSavedQuery[]
+ selectedSourceColumns: (
+ savedQueries: DataWarehouseSavedQuery[],
+ customPropertyForm: CustomPropertyFormValues
+ ) => string[]
+ selectedWarehouseSchemaId: (
+ warehouseTables: DataWarehouseTable[],
+ customPropertyForm: CustomPropertyFormValues
+ ) => string | null
+ serializedColumnPropertyMap: (customPropertyForm: CustomPropertyFormValues) => Record<string, string>
+ columnMappingWarnings: (
+ customPropertyForm: CustomPropertyFormValues,
+ personPropertyDefinitions: PropertyDefinition[]
+ ) => (string | null)[]
+ editingReferences: (
+ definitions: CustomPropertyDefinitionApi[],
+ editingDefinition: CustomPropertyDefinitionApi | null
+ ) => readonly CustomPropertyReferenceApi[]
+ }
+}
+
+export type customPropertyDefinitionsLogicType = MakeLogicType<
+ customPropertyDefinitionsLogicValues,
+ customPropertyDefinitionsLogicActions,
+ Record<string, any>,
+ customPropertyDefinitionsLogicMeta
+>
+
export const customPropertyDefinitionsLogic = kea<customPropertyDefinitionsLogicType>([
path([
'products',
diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/relationshipDefinitionsLogic.ts b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/relationshipDefinitionsLogic.ts
index 64717e1875d2..c7d5bb465155 100644
--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/relationshipDefinitionsLogic.ts
+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/relationshipDefinitionsLogic.ts
@@ -1,5 +1,6 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { loaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -14,8 +15,6 @@ import {
} from 'products/customer_analytics/frontend/generated/api'
import type { AccountRelationshipDefinitionApi } from 'products/customer_analytics/frontend/generated/api.schemas'
-import type { relationshipDefinitionsLogicType } from './relationshipDefinitionsLogicType'
-
export interface RelationshipDefinitionFormValues {
name: string
description: string
@@ -47,6 +46,116 @@ const handleNameConflict = (error: unknown, setManualErrors: (errors: { name: st
return true
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface relationshipDefinitionsLogicValues {
+ currentProjectId: number | null // projectLogic
+ definitions: AccountRelationshipDefinitionApi[]
+ definitionsLoading: boolean
+ editingDefinition: AccountRelationshipDefinitionApi | null
+ isRelationshipDefinitionFormSubmitting: boolean
+ isRelationshipDefinitionFormValid: boolean
+ modalVisible: boolean
+ relationshipDefinitionForm: RelationshipDefinitionFormValues
+ relationshipDefinitionFormAllErrors: Record<string, any>
+ relationshipDefinitionFormChanged: boolean
+ relationshipDefinitionFormErrors: DeepPartialMap<RelationshipDefinitionFormValues, ValidationErrorType>
+ relationshipDefinitionFormHasErrors: boolean
+ relationshipDefinitionFormManualErrors: Record<string, any>
+ relationshipDefinitionFormTouched: boolean
+ relationshipDefinitionFormTouches: Record<string, boolean>
+ relationshipDefinitionFormValidationErrors: DeepPartialMap<RelationshipDefinitionFormValues, ValidationErrorType>
+ showRelationshipDefinitionFormErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface relationshipDefinitionsLogicActions {
+ closeModal: () => {
+ value: true
+ }
+ deleteDefinition: ({ id }: { id: string }) => {
+ id: string
+ }
+ deleteDefinitionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ deleteDefinitionSuccess: (
+ definitions: AccountRelationshipDefinitionApi[],
+ payload?: {
+ id: string
+ }
+ ) => {
+ definitions: AccountRelationshipDefinitionApi[]
+ payload?: {
+ id: string
+ }
+ }
+ loadDefinitions: () => any
+ loadDefinitionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadDefinitionsSuccess: (
+ definitions: AccountRelationshipDefinitionApi[],
+ payload?: any
+ ) => {
+ definitions: AccountRelationshipDefinitionApi[]
+ payload?: any
+ }
+ openCreateModal: () => {
+ value: true
+ }
+ openEditModal: (definition: AccountRelationshipDefinitionApi) => {
+ definition: AccountRelationshipDefinitionApi
+ }
+ resetRelationshipDefinitionForm: (values?: RelationshipDefinitionFormValues) => {
+ values?: RelationshipDefinitionFormValues
+ }
+ setRelationshipDefinitionFormManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setRelationshipDefinitionFormValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setRelationshipDefinitionFormValues: (values: DeepPartial<RelationshipDefinitionFormValues>) => {
+ values: DeepPartial<RelationshipDefinitionFormValues>
+ }
+ submitRelationshipDefinitionForm: () => {
+ value: boolean
+ }
+ submitRelationshipDefinitionFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitRelationshipDefinitionFormRequest: (relationshipDefinitionForm: RelationshipDefinitionFormValues) => {
+ relationshipDefinitionForm: RelationshipDefinitionFormValues
+ }
+ submitRelationshipDefinitionFormSuccess: (relationshipDefinitionForm: RelationshipDefinitionFormValues) => {
+ relationshipDefinitionForm: RelationshipDefinitionFormValues
+ }
+ touchRelationshipDefinitionFormField: (key: string) => {
+ key: string
+ }
+}
+
+export type relationshipDefinitionsLogicType = MakeLogicType<
+ relationshipDefinitionsLogicValues,
+ relationshipDefinitionsLogicActions
+>
+
export const relationshipDefinitionsLogic = kea<relationshipDefinitionsLogicType>([
path([
'products',
diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/customerAnalyticsConfigurationSceneLogic.ts b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/customerAnalyticsConfigurationSceneLogic.ts
index ceed61db5de5..3975fd326c1b 100644
--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/customerAnalyticsConfigurationSceneLogic.ts
+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/customerAnalyticsConfigurationSceneLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, path, props, reducers, selectors } from 'kea'
import { actionToUrl, router, urlToAction } from 'kea-router'
import { Scene } from 'scenes/sceneTypes'
@@ -7,8 +7,8 @@ import { urls } from 'scenes/urls'
import { Breadcrumb } from '~/types'
+import type { SettingId } from '../../../../../frontend/src/scenes/settings/types'
import { CUSTOMER_ANALYTICS_LOGIC_KEY } from '../../utils'
-import type { customerAnalyticsConfigurationSceneLogicType } from './customerAnalyticsConfigurationSceneLogicType'
export type ConfigurationSceneTabType =
| 'group-analytics'
@@ -20,6 +20,36 @@ export interface CustomerAnalyticsConfigurationSceneLogicProps {
initialTab?: ConfigurationSceneTabType
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerAnalyticsConfigurationSceneLogicValues {
+ breadcrumbs: Breadcrumb[]
+ tab: ConfigurationSceneTabType
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerAnalyticsConfigurationSceneLogicActions {
+ selectSetting: (setting: SettingId) => {
+ setting: SettingId
+ } // settingsLogic
+ setTab: (tab: ConfigurationSceneTabType) => {
+ tab: ConfigurationSceneTabType
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerAnalyticsConfigurationSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ breadcrumbs: (tab: ConfigurationSceneTabType) => Breadcrumb[]
+ }
+}
+
+export type customerAnalyticsConfigurationSceneLogicType = MakeLogicType<
+ customerAnalyticsConfigurationSceneLogicValues,
+ customerAnalyticsConfigurationSceneLogicActions,
+ CustomerAnalyticsConfigurationSceneLogicProps,
+ customerAnalyticsConfigurationSceneLogicMeta
+>
+
export const customerAnalyticsConfigurationSceneLogic = kea<customerAnalyticsConfigurationSceneLogicType>([
path(['scenes', 'customer-analytics', 'configuration', 'customerAnalyticsConfigurationSceneLogic']),
props({} as CustomerAnalyticsConfigurationSceneLogicProps),
@@ -51,7 +81,7 @@ export const customerAnalyticsConfigurationSceneLogic = kea<customerAnalyticsCon
selectors({
breadcrumbs: [
(s) => [s.tab],
- (tab): Breadcrumb[] => [
+ (tab: ConfigurationSceneTabType): Breadcrumb[] => [
{
key: Scene.CustomerAnalytics,
path:
diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/events/customerAnalyticsDashboardEventsLogic.ts b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/events/customerAnalyticsDashboardEventsLogic.ts
index 12b5ddb8bbe6..eb15e477e892 100644
--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/events/customerAnalyticsDashboardEventsLogic.ts
+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/events/customerAnalyticsDashboardEventsLogic.ts
@@ -1,4 +1,5 @@
-import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import type { ActionForPayloadBuilder } from 'kea'
import { urlToAction } from 'kea-router'
import { isEmptyObject } from 'lib/utils/guards'
@@ -11,8 +12,183 @@ import { FilterType, InsightType } from '~/types'
import { customerAnalyticsConfigLogic } from 'products/customer_analytics/frontend/customerAnalyticsConfigLogic'
+import type { AnyEntityNode } from '../../../../../../frontend/src/queries/schema/schema-general'
import { EventSelectorProps } from './CustomerAnalyticsDashboardEvents'
-import type { customerAnalyticsDashboardEventsLogicType } from './customerAnalyticsDashboardEventsLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerAnalyticsDashboardEventsLogicValues {
+ activityEvent: AnyEntityNode // customerAnalyticsConfigLogic
+ paymentEvent: AnyEntityNode // customerAnalyticsConfigLogic
+ signupEvent: AnyEntityNode // customerAnalyticsConfigLogic
+ signupPageviewEvent: AnyEntityNode // customerAnalyticsConfigLogic
+ subscriptionEvent: AnyEntityNode // customerAnalyticsConfigLogic
+ activityEventFilters: FilterType
+ activityEventSelection: FilterType | null
+ activityEventSelector: EventSelectorProps
+ eventSelectors: EventSelectorProps[]
+ eventsToHighlight: string[]
+ hasChanges: boolean
+ paymentEventFilters: FilterType | null
+ paymentEventSelection: FilterType | null
+ paymentEventSelector: {
+ caption: string
+ filters: FilterType | null
+ prompt: string
+ relatedSeries: string[]
+ setFilters: ActionForPayloadBuilder<
+ (filters: FilterType | null) => {
+ filters: FilterType | null
+ }
+ >
+ title: string
+ }
+ signupEventFilters: FilterType | null
+ signupEventSelection: FilterType | null
+ signupEventSelector: EventSelectorProps
+ signupPageviewEventFilters: FilterType | null
+ signupPageviewEventSelection: FilterType | null
+ signupPageviewEventSelector: EventSelectorProps
+ subscriptionEventFilters: FilterType | null
+ subscriptionEventSelection: FilterType | null
+ subscriptionEventSelector: {
+ caption: string
+ filters: FilterType | null
+ prompt: string
+ relatedSeries: string[]
+ setFilters: ActionForPayloadBuilder<
+ (filters: FilterType | null) => {
+ filters: FilterType | null
+ }
+ >
+ title: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerAnalyticsDashboardEventsLogicActions {
+ updateEvents: (
+ events: Record<string, ActionsNode | DataWarehouseNode | EventsNode | GroupNode<DataWarehouseNode>>
+ ) => {
+ events: Record<string, ActionsNode | DataWarehouseNode | EventsNode | GroupNode<DataWarehouseNode>>
+ } // customerAnalyticsConfigLogic
+ addEventToHighlight: (event: string) => {
+ event: string
+ }
+ clearEventsToHighlight: () => {
+ value: true
+ }
+ clearFilterSelections: () => {
+ value: true
+ }
+ saveEvents: () => {
+ value: true
+ }
+ setActivityEventSelection: (filters: FilterType | null) => {
+ filters: FilterType | null
+ }
+ setPaymentEventSelection: (filters: FilterType | null) => {
+ filters: FilterType | null
+ }
+ setSignupEventSelection: (filters: FilterType | null) => {
+ filters: FilterType | null
+ }
+ setSignupPageviewEventSelection: (filters: FilterType | null) => {
+ filters: FilterType | null
+ }
+ setSubscriptionEventSelection: (filters: FilterType | null) => {
+ filters: FilterType | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface customerAnalyticsDashboardEventsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ activityEventFilters: (activityEvent: AnyEntityNode, activityEventSelection: FilterType | null) => FilterType
+ signupEventFilters: (signupEvent: AnyEntityNode, signupEventSelection: FilterType | null) => FilterType | null
+ signupPageviewEventFilters: (
+ signupPageviewEvent: AnyEntityNode,
+ signupPageviewEventSelection: FilterType | null
+ ) => FilterType | null
+ paymentEventFilters: (
+ paymentEvent: AnyEntityNode,
+ paymentEventSelection: FilterType | null
+ ) => FilterType | null
+ subscriptionEventFilters: (
+ subscriptionEvent: AnyEntityNode,
+ subscriptionEventSelection: FilterType | null
+ ) => FilterType | null
+ hasChanges: (
+ activityEventSelection: FilterType | null,
+ signupEventSelection: FilterType | null,
+ signupPageviewEventSelection: FilterType | null,
+ paymentEventSelection: FilterType | null,
+ subscriptionEventSelection: FilterType | null
+ ) => boolean
+ activityEventSelector: (activityEventFilters: FilterType) => EventSelectorProps
+ signupPageviewEventSelector: (signupPageviewEventFilters: FilterType | null) => EventSelectorProps
+ signupEventSelector: (signupEventFilters: FilterType | null) => EventSelectorProps
+ subscriptionEventSelector: (subscriptionEventFilters: FilterType | null) => {
+ caption: string
+ filters: FilterType | null
+ prompt: string
+ relatedSeries: string[]
+ setFilters: ActionForPayloadBuilder<
+ (filters: FilterType | null) => {
+ filters: FilterType | null
+ }
+ >
+ title: string
+ }
+ paymentEventSelector: (paymentEventFilters: FilterType | null) => {
+ caption: string
+ filters: FilterType | null
+ prompt: string
+ relatedSeries: string[]
+ setFilters: ActionForPayloadBuilder<
+ (filters: FilterType | null) => {
+ filters: FilterType | null
+ }
+ >
+ title: string
+ }
+ eventSelectors: (
+ activityEventSelector: EventSelectorProps,
+ signupPageviewEventSelector: EventSelectorProps,
+ signupEventSelector: EventSelectorProps,
+ subscriptionEventSelector: {
+ caption: string
+ filters: FilterType | null
+ prompt: string
+ relatedSeries: string[]
+ setFilters: ActionForPayloadBuilder<
+ (filters: FilterType | null) => {
+ filters: FilterType | null
+ }
+ >
+ title: string
+ },
+ paymentEventSelector: {
+ caption: string
+ filters: FilterType | null
+ prompt: string
+ relatedSeries: string[]
+ setFilters: ActionForPayloadBuilder<
+ (filters: FilterType | null) => {
+ filters: FilterType | null
+ }
+ >
+ title: string
+ }
+ ) => EventSelectorProps[]
+ }
+}
+
+export type customerAnalyticsDashboardEventsLogicType = MakeLogicType<
+ customerAnalyticsDashboardEventsLogicValues,
+ customerAnalyticsDashboardEventsLogicActions,
+ Record<string, any>,
+ customerAnalyticsDashboardEventsLogicMeta
+>
export const customerAnalyticsDashboardEventsLogic = kea<customerAnalyticsDashboardEventsLogicType>([
path(['products', 'customerAnalytics', 'components', 'insights', 'eventConfigModal']),
@@ -91,7 +267,10 @@ export const customerAnalyticsDashboardEventsLogic = kea<customerAnalyticsDashbo
selectors(({ actions }) => ({
activityEventFilters: [
(s) => [s.activityEvent, s.activityEventSelection],
- (activityEvent, activityEventSelection): FilterType => {
+ (
+ activityEvent: import('~/queries/schema').AnyEntityNode,
+ activityEventSelection: FilterType | null
+ ): FilterType => {
if (activityEventSelection) {
return activityEventSelection
}
@@ -103,7 +282,10 @@ export const customerAnalyticsDashboardEventsLogic = kea<customerAnalyticsDashbo
],
signupEventFilters: [
(s) => [s.signupEvent, s.signupEventSelection],
- (signupEvent, signupEventSelection): FilterType | null => {
+ (
+ signupEvent: import('~/queries/schema').AnyEntityNode,
+ signupEventSelection: FilterType | null
+ ): FilterType | null => {
if (signupEventSelection) {
return signupEventSelection
}
@@ -118,7 +300,10 @@ export const customerAnalyticsDashboardEventsLogic = kea<customerAnalyticsDashbo
],
signupPageviewEventFilters: [
(s) => [s.signupPageviewEvent, s.signupPageviewEventSelection],
- (signupPageviewEvent, signupPageviewEventSelection): FilterType | null => {
+ (
+ signupPageviewEvent: import('~/queries/schema').AnyEntityNode,
+ signupPageviewEventSelection: FilterType | null
+ ): FilterType | null => {
if (signupPageviewEventSelection) {
return signupPageviewEventSelection
}
@@ -133,7 +318,10 @@ export const customerAnalyticsDashboardEventsLogic = kea<customerAnalyticsDashbo
],
paymentEventFilters: [
(s) => [s.paymentEvent, s.paymentEventSelection],
- (paymentEvent, paymentEventSelection): FilterType | null => {
+ (
+ paymentEvent: import('~/queries/schema').AnyEntityNode,
+ paymentEventSelection: FilterType | null
+ ): FilterType | null => {
if (paymentEventSelection) {
return paymentEventSelection
}
@@ -148,7 +336,10 @@ export const customerAnalyticsDashboardEventsLogic = kea<customerAnalyticsDashbo
],
subscriptionEventFilters: [
(s) => [s.subscriptionEvent, s.subscriptionEventSelection],
- (subscriptionEvent, subscriptionEventSelection): FilterType | null => {
+ (
+ subscriptionEvent: import('~/queries/schema').AnyEntityNode,
+ subscriptionEventSelection: FilterType | null
+ ): FilterType | null => {
if (subscriptionEventSelection) {
return subscriptionEventSelection
}
@@ -170,11 +361,11 @@ export const customerAnalyticsDashboardEventsLogic = kea<customerAnalyticsDashbo
s.subscriptionEventSelection,
],
(
- activityEventSelection,
- signupEventSelection,
- signupPageviewEventSelection,
- paymentEventSelection,
- subscriptionEventSelection
+ activityEventSelection: FilterType | null,
+ signupEventSelection: FilterType | null,
+ signupPageviewEventSelection: FilterType | null,
+ paymentEventSelection: FilterType | null,
+ subscriptionEventSelection: FilterType | null
): boolean => {
return (
activityEventSelection !== null ||
@@ -187,7 +378,7 @@ export const customerAnalyticsDashboardEventsLogic = kea<customerAnalyticsDashbo
],
activityEventSelector: [
(s) => [s.activityEventFilters],
- (activityEventFilters): EventSelectorProps => ({
+ (activityEventFilters: FilterType): EventSelectorProps => ({
title: 'Activity event',
caption: 'Defines what is considered user activity for active users and engagement calculations',
filters: activityEventFilters,
@@ -198,7 +389,7 @@ export const customerAnalyticsDashboardEventsLogic = kea<customerAnalyticsDashbo
],
signupPageviewEventSelector: [
(s) => [s.signupPageviewEventFilters],
- (signupPageviewEventFilters): EventSelectorProps => ({
+ (signupPageviewEventFilters: FilterType | null): EventSelectorProps => ({
title: 'Signup pageview event',
caption: 'Tracks when users view the signup page. Used to calculate signup conversion',
filters: signupPageviewEventFilters,
@@ -209,7 +400,7 @@ export const customerAnalyticsDashboardEventsLogic = kea<customerAnalyticsDashbo
],
signupEventSelector: [
(s) => [s.signupEventFilters],
- (signupEventFilters): EventSelectorProps => ({
+ (signupEventFilters: FilterType | null): EventSelectorProps => ({
title: 'Signup event',
caption: 'Tracks when users complete registration or account creation',
filters: signupEventFilters,
@@ -220,7 +411,7 @@ export const customerAnalyticsDashboardEventsLogic = kea<customerAnalyticsDashbo
],
subscriptionEventSelector: [
(s) => [s.subscriptionEventFilters],
- (subscriptionEventFilters) => ({
+ (subscriptionEventFilters: FilterType | null) => ({
title: 'Subscription event',
caption: 'Tracks when users subscribe to a plan. May or may not be associated with a payment',
filters: subscriptionEventFilters,
@@ -231,7 +422,7 @@ export const customerAnalyticsDashboardEventsLogic = kea<customerAnalyticsDashbo
],
paymentEventSelector: [
(s) => [s.paymentEventFilters],
- (paymentEventFilters) => ({
+ (paymentEventFilters: FilterType | null) => ({
title: 'Payment event',
caption: 'Tracks when users complete a payment. Used to calculate free-to-paid conversion',
filters: paymentEventFilters,
@@ -249,11 +440,25 @@ export const customerAnalyticsDashboardEventsLogic = kea<customerAnalyticsDashbo
s.paymentEventSelector,
],
(
- activityEventSelector,
- signupPageviewEventSelector,
- signupEventSelector,
- subscriptionEventSelector,
- paymentEventSelector
+ activityEventSelector: EventSelectorProps,
+ signupPageviewEventSelector: EventSelectorProps,
+ signupEventSelector: EventSelectorProps,
+ subscriptionEventSelector: {
+ caption: string
+ filters: FilterType | null
+ prompt: string
+ relatedSeries: string[]
+ setFilters: (filters: FilterType | null) => void
+ title: string
+ },
+ paymentEventSelector: {
+ caption: string
+ filters: FilterType | null
+ prompt: string
+ relatedSeries: string[]
+ setFilters: (filters: FilterType | null) => void
+ title: string
+ }
): EventSelectorProps[] => [
activityEventSelector,
signupPageviewEventSelector,
diff --git a/products/customer_analytics/frontend/scenes/CustomerJourneyTemplatesScene/journeyTemplatePickerLogic.ts b/products/customer_analytics/frontend/scenes/CustomerJourneyTemplatesScene/journeyTemplatePickerLogic.ts
index fd0735f8fc32..2ecedefec247 100644
--- a/products/customer_analytics/frontend/scenes/CustomerJourneyTemplatesScene/journeyTemplatePickerLogic.ts
+++ b/products/customer_analytics/frontend/scenes/CustomerJourneyTemplatesScene/journeyTemplatePickerLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { lazyLoaders } from 'kea-loaders'
import { router } from 'kea-router'
@@ -10,11 +10,85 @@ import { urls } from 'scenes/urls'
import { getQueryBasedInsightModel } from '~/queries/nodes/InsightViz/utils'
import { InsightType, QueryBasedInsightModel } from '~/types'
+import type { AnyEntityNode, Node } from '../../../../../frontend/src/queries/schema/schema-general'
import { customerAnalyticsConfigLogic } from '../../customerAnalyticsConfigLogic'
-import type { journeyTemplatePickerLogicType } from './journeyTemplatePickerLogicType'
export type JourneyTemplateKey = 'signup_conversion' | 'free_to_paid' | 'scratch'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface journeyTemplatePickerLogicValues {
+ paymentEvent: AnyEntityNode // customerAnalyticsConfigLogic
+ signupEvent: AnyEntityNode // customerAnalyticsConfigLogic
+ signupPageviewEvent: AnyEntityNode // customerAnalyticsConfigLogic
+ funnels: QueryBasedInsightModel[]
+ funnelsLoading: boolean
+ isFreeToPaidAvailable: boolean
+ isSignupConversionAvailable: boolean
+ searchTerm: string
+ showExistingFunnels: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface journeyTemplatePickerLogicActions {
+ reportCustomerJourneyExistingFunnelSelected: (insightId: number) => {
+ insightId: number
+ } // eventUsageLogic
+ reportCustomerJourneyTemplateSelected: (templateKey: string) => {
+ templateKey: string
+ } // eventUsageLogic
+ loadFunnels: () => {
+ value: true
+ }
+ loadFunnelsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFunnelsSuccess: (
+ funnels: QueryBasedInsightModel<Node<Record<string, any>>>[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ funnels: QueryBasedInsightModel<Node<Record<string, any>>>[]
+ payload?: {
+ value: true
+ }
+ }
+ resetState: () => {
+ value: true
+ }
+ selectExistingFunnel: (insightId: number) => {
+ insightId: number
+ }
+ selectTemplate: (templateKey: JourneyTemplateKey) => {
+ templateKey: JourneyTemplateKey
+ }
+ setSearchTerm: (term: string) => {
+ term: string
+ }
+ toggleExistingFunnels: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface journeyTemplatePickerLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isSignupConversionAvailable: (signupPageviewEvent: AnyEntityNode, signupEvent: AnyEntityNode) => boolean
+ isFreeToPaidAvailable: (signupEvent: AnyEntityNode, paymentEvent: AnyEntityNode) => boolean
+ }
+}
+
+export type journeyTemplatePickerLogicType = MakeLogicType<
+ journeyTemplatePickerLogicValues,
+ journeyTemplatePickerLogicActions,
+ Record<string, any>,
+ journeyTemplatePickerLogicMeta
+>
+
export const journeyTemplatePickerLogic = kea<journeyTemplatePickerLogicType>([
path([
'products',
@@ -77,12 +151,17 @@ export const journeyTemplatePickerLogic = kea<journeyTemplatePickerLogicType>([
selectors({
isSignupConversionAvailable: [
(s) => [s.signupPageviewEvent, s.signupEvent],
- (signupPageviewEvent, signupEvent): boolean =>
- !isEmptyObject(signupPageviewEvent) && !isEmptyObject(signupEvent),
+ (
+ signupPageviewEvent: import('~/queries/schema').AnyEntityNode,
+ signupEvent: import('~/queries/schema').AnyEntityNode
+ ): boolean => !isEmptyObject(signupPageviewEvent) && !isEmptyObject(signupEvent),
],
isFreeToPaidAvailable: [
(s) => [s.signupEvent, s.paymentEvent],
- (signupEvent, paymentEvent): boolean => !isEmptyObject(signupEvent) && !isEmptyObject(paymentEvent),
+ (
+ signupEvent: import('~/queries/schema').AnyEntityNode,
+ paymentEvent: import('~/queries/schema').AnyEntityNode
+ ): boolean => !isEmptyObject(signupEvent) && !isEmptyObject(paymentEvent),
],
}),
diff --git a/products/endpoints/frontend/endpointLogic.tsx b/products/endpoints/frontend/endpointLogic.tsx
index 853997031379..50bbd934aef8 100644
--- a/products/endpoints/frontend/endpointLogic.tsx
+++ b/products/endpoints/frontend/endpointLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
@@ -16,12 +16,186 @@ import { sceneLayoutLogic } from '~/layout/scenes/sceneLayoutLogic'
import { EndpointRequest, ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
import { EndpointType, EndpointVersionType } from '~/types'
-import type { endpointLogicType } from './endpointLogicType'
+import type { ProductIntentProperties } from '../../../frontend/src/lib/utils/product-intents'
+import type { EndpointVersionMaterializationType } from '../../../frontend/src/types'
import { endpointsLogic } from './endpointsLogic'
import { insightPickerEndpointModalLogic } from './insightPickerEndpointModalLogic'
export type CodeExampleTab = 'terminal' | 'python' | 'nodejs'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface endpointLogicValues {
+ activeCodeExampleTab: CodeExampleTab
+ createFromInsightModalOpen: boolean
+ duplicateEndpoint: EndpointType | null
+ endpoint: EndpointVersionType | null
+ endpointDescription: string | null
+ endpointLoading: boolean
+ endpointName: string | null
+ isUpdateMode: boolean
+ materializationStatus: EndpointType['materialization'] | null
+ materializationStatusLoading: boolean
+ selectedCodeExampleVersion: number | null
+ selectedEndpointName: string | null
+ updatingEndpoint: boolean
+ versions: EndpointVersionType[]
+ versionsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface endpointLogicActions {
+ loadEndpoints: () => any // endpointsLogic
+ setScenePanelOpen: (open: boolean) => {
+ open: boolean
+ } // sceneLayoutLogic
+ addProductIntent: (properties: ProductIntentProperties) => ProductIntentProperties // teamLogic
+ clearMaterializationStatus: () => {
+ value: true
+ }
+ closeCreateFromInsightModal: () => {
+ value: true
+ }
+ confirmToggleActive: (endpoint: EndpointType) => {
+ endpoint: EndpointType
+ }
+ createEndpoint: (request: EndpointRequest) => {
+ request: EndpointRequest
+ }
+ createEndpointFailure: (queryError?: string | null) => {
+ queryError: string | null | undefined
+ }
+ createEndpointSuccess: (response: any) => {
+ response: any
+ }
+ deleteEndpoint: (name: string) => {
+ name: string
+ }
+ deleteEndpointFailure: () => {}
+ deleteEndpointSuccess: (response: any) => {
+ response: any
+ }
+ loadEndpoint: (name: string) => string
+ loadEndpointFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadEndpointSuccess: (
+ endpoint: EndpointVersionType | null,
+ payload?: string
+ ) => {
+ endpoint: EndpointVersionType | null
+ payload?: string
+ }
+ loadMaterializationStatus: ({ name, version }: { name: string; version?: number }) => {
+ name: string
+ version?: number
+ }
+ loadMaterializationStatusFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMaterializationStatusSuccess: (
+ materializationStatus: EndpointVersionMaterializationType | null | undefined,
+ payload?: {
+ name: string
+ version?: number
+ }
+ ) => {
+ materializationStatus: EndpointVersionMaterializationType | null | undefined
+ payload?: {
+ name: string
+ version?: number
+ }
+ }
+ loadVersions: (name: string) => string
+ loadVersionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadVersionsSuccess: (
+ versions: EndpointVersionType[],
+ payload?: string
+ ) => {
+ versions: EndpointVersionType[]
+ payload?: string
+ }
+ openCreateFromInsightModal: () => {
+ value: true
+ }
+ saveTagsInline: (tags: string[]) => {
+ tags: string[]
+ }
+ setActiveCodeExampleTab: (tab: CodeExampleTab) => {
+ tab: CodeExampleTab
+ }
+ setDuplicateEndpoint: (endpoint: EndpointType | null) => {
+ endpoint: EndpointType | null
+ }
+ setEndpointDescription: (endpointDescription: string | null) => {
+ endpointDescription: string | null
+ }
+ setEndpointName: (endpointName: string) => {
+ endpointName: string
+ }
+ setIsUpdateMode: (isUpdateMode: boolean) => {
+ isUpdateMode: boolean
+ }
+ setSelectedCodeExampleVersion: (version: number | null) => {
+ version: number | null
+ }
+ setSelectedEndpointName: (selectedEndpointName: string | null) => {
+ selectedEndpointName: string | null
+ }
+ updateEndpoint: (
+ name: string,
+ request: Partial<EndpointRequest>,
+ options?: {
+ showViewButton?: boolean
+ version?: number
+ }
+ ) => {
+ name: string
+ options:
+ | {
+ showViewButton?: boolean | undefined
+ version?: number | undefined
+ }
+ | undefined
+ request: Partial<EndpointRequest>
+ }
+ updateEndpointFailure: (queryError?: string | null) => {
+ queryError: string | null | undefined
+ }
+ updateEndpointSuccess: (
+ response: any,
+ endpointName: string,
+ options?: {
+ showViewButton?: boolean
+ version?: number
+ }
+ ) => {
+ endpointName: string
+ options:
+ | {
+ showViewButton?: boolean | undefined
+ version?: number | undefined
+ }
+ | undefined
+ response: any
+ }
+}
+
+export type endpointLogicType = MakeLogicType<endpointLogicValues, endpointLogicActions>
+
export const endpointLogic = kea<endpointLogicType>([
path(['products', 'endpoints', 'frontend', 'endpointLogic']),
connect(() => ({
diff --git a/products/endpoints/frontend/endpointSceneLogic.tsx b/products/endpoints/frontend/endpointSceneLogic.tsx
index 69b1808d4775..b12d66d3bc5e 100644
--- a/products/endpoints/frontend/endpointSceneLogic.tsx
+++ b/products/endpoints/frontend/endpointSceneLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, connect, events, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, events, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { router, urlToAction } from 'kea-router'
@@ -22,7 +22,6 @@ import { isHogQLQuery, isInsightQueryNode } from '~/queries/utils'
import { Breadcrumb, ChartDisplayType, EndpointType, EndpointVersionType } from '~/types'
import { endpointLogic } from './endpointLogic'
-import type { endpointSceneLogicType } from './endpointSceneLogicType'
import { endpointsMaterializationSuggestionCreate } from './generated/api'
import type { EndpointMaterializationSuggestionApi } from './generated/api.schemas'
@@ -134,6 +133,247 @@ export interface MaterializationPreview {
aggregates: { expression: string; reaggregate_fn: string | null }[]
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface endpointSceneLogicValues {
+ endpoint: EndpointVersionType | null // endpointLogic
+ endpointLoading: boolean // endpointLogic
+ activeTab: EndpointTab
+ breadcrumbs: Breadcrumb[]
+ bucketOverrides: Record<string, string>
+ currentQuery: Node | null
+ dataFreshness: number
+ debugInfoExpanded: boolean
+ debugMode: boolean
+ endpointName: string | null
+ endpointResult: string | null
+ endpointResultLoading: boolean
+ isMaterialized: boolean | null
+ localQuery: Node | null
+ materializationPreview: MaterializationPreview | null
+ materializationPreviewLoading: boolean
+ materializationSuggestion: EndpointMaterializationSuggestionApi | null
+ materializationSuggestionLoading: boolean
+ materializationSuggestionModalOpen: boolean
+ optionalBreakdownProperties: string[]
+ payloadJson: string
+ payloadJsonError: string | null
+ queryToRender: Node | null
+ suggestionMatchesCurrentQuery: boolean
+ viewingVersion: EndpointVersionType | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface endpointSceneLogicActions {
+ clearMaterializationStatus: () => {
+ value: true
+ } // endpointLogic
+ loadEndpoint: (name: string) => string // endpointLogic
+ loadEndpointSuccess: (
+ endpoint: EndpointVersionType | null,
+ payload?: string | undefined
+ ) => {
+ endpoint: EndpointVersionType | null
+ payload?: string
+ } // endpointLogic
+ loadVersions: (name: string) => string // endpointLogic
+ setEndpointDescription: (endpointDescription: string | null) => {
+ endpointDescription: string | null
+ } // endpointLogic
+ updateEndpointSuccess: (
+ response: any,
+ endpointName: string,
+ options?:
+ | {
+ showViewButton?: boolean
+ version?: number
+ }
+ | undefined
+ ) => {
+ endpointName: string
+ options:
+ | {
+ showViewButton?: boolean | undefined
+ version?: number | undefined
+ }
+ | undefined
+ response: any
+ } // endpointLogic
+ applyMaterializationSuggestion: () => {
+ value: true
+ }
+ closeMaterializationSuggestionModal: () => {
+ value: true
+ }
+ keepSqlEditorMounted: (editorTabId: string) => {
+ editorTabId: string
+ }
+ loadEndpointResult: ({ name, data }: { data: EndpointRunRequest; name: string }) => {
+ name: string
+ data: EndpointRunRequest
+ }
+ loadEndpointResultFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadEndpointResultSuccess: (
+ endpointResult: string,
+ payload?: {
+ name: string
+ data: EndpointRunRequest
+ }
+ ) => {
+ endpointResult: string
+ payload?: {
+ name: string
+ data: EndpointRunRequest
+ }
+ }
+ loadMaterializationPreview: () => {
+ value: true
+ }
+ loadMaterializationPreviewFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMaterializationPreviewSuccess: (
+ materializationPreview: {
+ aggregates: {
+ expression: string
+ reaggregate_fn: string | null
+ }[]
+ can_materialize: boolean
+ range_pairs: {
+ bucket_fn: string
+ column: string
+ variables: string[]
+ }[]
+ reason: string | null
+ transformed_query: string | null
+ } | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ materializationPreview: {
+ aggregates: {
+ expression: string
+ reaggregate_fn: string | null
+ }[]
+ can_materialize: boolean
+ range_pairs: {
+ bucket_fn: string
+ column: string
+ variables: string[]
+ }[]
+ reason: string | null
+ transformed_query: string | null
+ } | null
+ payload?: {
+ value: true
+ }
+ }
+ loadMaterializationSuggestion: () => any
+ loadMaterializationSuggestionFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMaterializationSuggestionSuccess: (
+ materializationSuggestion: EndpointMaterializationSuggestionApi | null,
+ payload?: any
+ ) => {
+ materializationSuggestion: EndpointMaterializationSuggestionApi | null
+ payload?: any
+ }
+ openMaterializationSuggestionModal: () => {
+ value: true
+ }
+ regenerateMaterializationSuggestion: () => {
+ value: true
+ }
+ resetBucketOverrides: (overrides: Record<string, string>) => {
+ overrides: Record<string, string>
+ }
+ resetOptionalBreakdownProperties: (props: string[]) => {
+ props: string[]
+ }
+ setActiveTab: (tab: EndpointTab) => {
+ tab: EndpointTab
+ }
+ setBucketOverride: (
+ column: string,
+ bucketFn: string
+ ) => {
+ bucketFn: string
+ column: string
+ }
+ setDataFreshness: (dataFreshness: number) => {
+ dataFreshness: number
+ }
+ setDebugInfoExpanded: (debugInfoExpanded: boolean) => {
+ debugInfoExpanded: boolean
+ }
+ setDebugMode: (debugMode: boolean) => {
+ debugMode: boolean
+ }
+ setEndpointName: (name: string | null) => {
+ name: string | null
+ }
+ setIsMaterialized: (isMaterialized: boolean | null) => {
+ isMaterialized: boolean | null
+ }
+ setLocalQuery: (query: Node | null) => {
+ query: Node<Record<string, any>> | null
+ }
+ setPayloadJson: (value: string) => {
+ value: string
+ }
+ setPayloadJsonError: (error: string | null) => {
+ error: string | null
+ }
+ setViewingVersion: (version: EndpointVersionType | null) => {
+ version: EndpointVersionType | null
+ }
+ toggleBreakdownOptional: (property: string) => {
+ property: string
+ }
+ toggleMaterializationFromMenu: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface endpointSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ currentQuery: (
+ localQuery: Node<Record<string, any>> | null,
+ endpoint: EndpointVersionType | null,
+ viewingVersion: EndpointVersionType | null
+ ) => Node | null
+ suggestionMatchesCurrentQuery: (
+ materializationSuggestion: EndpointMaterializationSuggestionApi | null,
+ currentQuery: Node<Record<string, any>> | null
+ ) => boolean
+ queryToRender: (currentQuery: Node<Record<string, any>> | null) => Node | null
+ breadcrumbs: (endpoint: EndpointVersionType | null) => Breadcrumb[]
+ }
+}
+
+export type endpointSceneLogicType = MakeLogicType<
+ endpointSceneLogicValues,
+ endpointSceneLogicActions,
+ Record<string, any>,
+ endpointSceneLogicMeta
+>
+
export const endpointSceneLogic = kea<endpointSceneLogicType>([
path(['products', 'endpoints', 'frontend', 'endpointSceneLogic']),
connect(() => ({
diff --git a/products/endpoints/frontend/endpointsLogic.tsx b/products/endpoints/frontend/endpointsLogic.tsx
index ad3259b9770a..56c855ce30d9 100644
--- a/products/endpoints/frontend/endpointsLogic.tsx
+++ b/products/endpoints/frontend/endpointsLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { urlToAction } from 'kea-router'
@@ -10,7 +10,7 @@ import { urls } from 'scenes/urls'
import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
import { EndpointType } from '~/types'
-import type { endpointsLogicType } from './endpointsLogicType'
+import type { ProductIntentProperties } from '../../../frontend/src/lib/utils/product-intents'
export type EndpointsTab = 'endpoints' | 'usage'
@@ -24,6 +24,55 @@ export const DEFAULT_FILTERS: EndpointsFilters = {
tags: [],
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface endpointsLogicValues {
+ activeTab: EndpointsTab
+ allEndpoints: EndpointType[]
+ allEndpointsLoading: boolean
+ endpoints: EndpointType[]
+ filters: EndpointsFilters
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface endpointsLogicActions {
+ addProductIntent: (properties: ProductIntentProperties) => ProductIntentProperties // teamLogic
+ loadEndpoints: () => any
+ loadEndpointsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadEndpointsSuccess: (
+ allEndpoints: EndpointType[],
+ payload?: any
+ ) => {
+ allEndpoints: EndpointType[]
+ payload?: any
+ }
+ setActiveTab: (activeTab: EndpointsTab) => {
+ activeTab: EndpointsTab
+ }
+ setFilters: (filters: Partial<EndpointsFilters>) => {
+ filters: Partial<EndpointsFilters>
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface endpointsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ endpoints: (allEndpoints: EndpointType[], filters: EndpointsFilters) => EndpointType[]
+ }
+}
+
+export type endpointsLogicType = MakeLogicType<
+ endpointsLogicValues,
+ endpointsLogicActions,
+ Record<string, any>,
+ endpointsLogicMeta
+>
+
export const endpointsLogic = kea<endpointsLogicType>([
path(['products', 'endpoints', 'frontend', 'endpointsLogic']),
connect(() => ({
@@ -61,7 +110,7 @@ export const endpointsLogic = kea<endpointsLogicType>([
selectors({
endpoints: [
(s) => [s.allEndpoints, s.filters],
- (allEndpoints, filters) => {
+ (allEndpoints: EndpointType[], filters: EndpointsFilters) => {
let results = allEndpoints
if (filters.tags.length > 0) {
diff --git a/products/endpoints/frontend/endpointsUsageLogic.tsx b/products/endpoints/frontend/endpointsUsageLogic.tsx
index dd195f94159c..e2f4273a909c 100644
--- a/products/endpoints/frontend/endpointsUsageLogic.tsx
+++ b/products/endpoints/frontend/endpointsUsageLogic.tsx
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { router, urlToAction } from 'kea-router'
import { dayjs } from 'lib/dayjs'
@@ -16,12 +16,158 @@ import {
import { EndpointType, IntervalType } from '~/types'
import { endpointsLogic } from './endpointsLogic'
-import type { endpointsUsageLogicType } from './endpointsUsageLogicType'
export const INITIAL_DATE_FROM = '-7d'
export const INITIAL_DATE_TO = null as string | null
export const INITIAL_INTERVAL: IntervalType = 'day'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface endpointsUsageLogicValues {
+ allEndpoints: EndpointType[] // endpointsLogic
+ allEndpointsLoading: boolean // endpointsLogic
+ activeEndpointNames: Set<string>
+ breakdownBy: EndpointsUsageBreakdown | null
+ bytesReadTrendsQuery: EndpointsUsageTrendsQuery
+ canRefresh: boolean
+ cooldownActive: boolean
+ cpuSecondsTrendsQuery: EndpointsUsageTrendsQuery
+ dateFilter: {
+ dateFrom: string | null
+ dateTo: string | null
+ }
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ }
+ endpointFilter: string[]
+ endpointNames: string[]
+ endpointNamesLoading: boolean
+ endpointTableQuery: EndpointsUsageTableQuery
+ errorRateTrendsQuery: EndpointsUsageTrendsQuery
+ interval: IntervalType
+ materializationType: 'inline' | 'materialized' | null
+ overviewQuery: EndpointsUsageOverviewQuery
+ queryDurationTrendsQuery: EndpointsUsageTrendsQuery
+ refreshKey: number
+ requestsTrendsQuery: EndpointsUsageTrendsQuery
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface endpointsUsageLogicActions {
+ clearCooldown: () => {
+ value: true
+ }
+ refresh: () => {
+ value: true
+ }
+ setBreakdownBy: (breakdownBy: EndpointsUsageBreakdown | null) => {
+ breakdownBy: EndpointsUsageBreakdown | null
+ }
+ setDates: (
+ dateFrom: string | null,
+ dateTo: string | null
+ ) => {
+ dateFrom: string | null
+ dateTo: string | null
+ }
+ setEndpointFilter: (endpointFilter: string[]) => {
+ endpointFilter: string[]
+ }
+ setInterval: (interval: IntervalType) => {
+ interval: IntervalType
+ }
+ setMaterializationType: (materializationType: 'inline' | 'materialized' | null) => {
+ materializationType: 'inline' | 'materialized' | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface endpointsUsageLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ endpointNames: (allEndpoints: EndpointType[]) => string[]
+ activeEndpointNames: (endpointNames: string[]) => Set<string>
+ endpointNamesLoading: (allEndpointsLoading: boolean) => boolean
+ canRefresh: (cooldownActive: boolean) => boolean
+ dateRange: (dateFilter: { dateFrom: string | null; dateTo: string | null }) => {
+ date_from: string | null
+ date_to: string | null
+ }
+ overviewQuery: (
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ endpointFilter: string[],
+ materializationType: 'inline' | 'materialized' | null
+ ) => EndpointsUsageOverviewQuery
+ requestsTrendsQuery: (
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ endpointFilter: string[],
+ materializationType: 'inline' | 'materialized' | null,
+ interval: IntervalType,
+ breakdownBy: EndpointsUsageBreakdown | null
+ ) => EndpointsUsageTrendsQuery
+ bytesReadTrendsQuery: (
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ endpointFilter: string[],
+ materializationType: 'inline' | 'materialized' | null,
+ interval: IntervalType,
+ breakdownBy: EndpointsUsageBreakdown | null
+ ) => EndpointsUsageTrendsQuery
+ cpuSecondsTrendsQuery: (
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ endpointFilter: string[],
+ materializationType: 'inline' | 'materialized' | null,
+ interval: IntervalType,
+ breakdownBy: EndpointsUsageBreakdown | null
+ ) => EndpointsUsageTrendsQuery
+ queryDurationTrendsQuery: (
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ endpointFilter: string[],
+ materializationType: 'inline' | 'materialized' | null,
+ interval: IntervalType,
+ breakdownBy: EndpointsUsageBreakdown | null
+ ) => EndpointsUsageTrendsQuery
+ errorRateTrendsQuery: (
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ endpointFilter: string[],
+ materializationType: 'inline' | 'materialized' | null,
+ interval: IntervalType,
+ breakdownBy: EndpointsUsageBreakdown | null
+ ) => EndpointsUsageTrendsQuery
+ endpointTableQuery: (
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ endpointFilter: string[],
+ materializationType: 'inline' | 'materialized' | null
+ ) => EndpointsUsageTableQuery
+ }
+}
+
+export type endpointsUsageLogicType = MakeLogicType<
+ endpointsUsageLogicValues,
+ endpointsUsageLogicActions,
+ Record<string, any>,
+ endpointsUsageLogicMeta
+>
+
export const endpointsUsageLogic = kea<endpointsUsageLogicType>([
path(['products', 'endpoints', 'frontend', 'endpointsUsageLogic']),
connect(() => ({
@@ -100,7 +246,10 @@ export const endpointsUsageLogic = kea<endpointsUsageLogicType>([
canRefresh: [(s) => [s.cooldownActive], (cooldownActive: boolean): boolean => !cooldownActive],
dateRange: [
(s) => [s.dateFilter],
- (dateFilter): { date_from: string | null; date_to: string | null } => {
+ (dateFilter: {
+ dateFrom: string | null
+ dateTo: string | null
+ }): { date_from: string | null; date_to: string | null } => {
const dateFromDayjs = dateStringToDayJs(dateFilter.dateFrom)
const dateToDayjs = dateFilter.dateTo ? dateStringToDayJs(dateFilter.dateTo) : null
@@ -113,7 +262,14 @@ export const endpointsUsageLogic = kea<endpointsUsageLogicType>([
overviewQuery: [
(s) => [s.dateRange, s.endpointFilter, s.materializationType],
- (dateRange, endpointFilter, materializationType): EndpointsUsageOverviewQuery => ({
+ (
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ endpointFilter: string[],
+ materializationType: 'inline' | 'materialized' | null
+ ): EndpointsUsageOverviewQuery => ({
kind: NodeKind.EndpointsUsageOverviewQuery,
dateRange,
endpointNames: endpointFilter.length > 0 ? endpointFilter : undefined,
@@ -124,7 +280,16 @@ export const endpointsUsageLogic = kea<endpointsUsageLogicType>([
requestsTrendsQuery: [
(s) => [s.dateRange, s.endpointFilter, s.materializationType, s.interval, s.breakdownBy],
- (dateRange, endpointFilter, materializationType, interval, breakdownBy): EndpointsUsageTrendsQuery => ({
+ (
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ endpointFilter: string[],
+ materializationType: 'inline' | 'materialized' | null,
+ interval: IntervalType,
+ breakdownBy: EndpointsUsageBreakdown | null
+ ): EndpointsUsageTrendsQuery => ({
kind: NodeKind.EndpointsUsageTrendsQuery,
dateRange,
endpointNames: endpointFilter.length > 0 ? endpointFilter : undefined,
@@ -137,7 +302,16 @@ export const endpointsUsageLogic = kea<endpointsUsageLogicType>([
bytesReadTrendsQuery: [
(s) => [s.dateRange, s.endpointFilter, s.materializationType, s.interval, s.breakdownBy],
- (dateRange, endpointFilter, materializationType, interval, breakdownBy): EndpointsUsageTrendsQuery => ({
+ (
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ endpointFilter: string[],
+ materializationType: 'inline' | 'materialized' | null,
+ interval: IntervalType,
+ breakdownBy: EndpointsUsageBreakdown | null
+ ): EndpointsUsageTrendsQuery => ({
kind: NodeKind.EndpointsUsageTrendsQuery,
dateRange,
endpointNames: endpointFilter.length > 0 ? endpointFilter : undefined,
@@ -150,7 +324,16 @@ export const endpointsUsageLogic = kea<endpointsUsageLogicType>([
cpuSecondsTrendsQuery: [
(s) => [s.dateRange, s.endpointFilter, s.materializationType, s.interval, s.breakdownBy],
- (dateRange, endpointFilter, materializationType, interval, breakdownBy): EndpointsUsageTrendsQuery => ({
+ (
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ endpointFilter: string[],
+ materializationType: 'inline' | 'materialized' | null,
+ interval: IntervalType,
+ breakdownBy: EndpointsUsageBreakdown | null
+ ): EndpointsUsageTrendsQuery => ({
kind: NodeKind.EndpointsUsageTrendsQuery,
dateRange,
endpointNames: endpointFilter.length > 0 ? endpointFilter : undefined,
@@ -163,7 +346,16 @@ export const endpointsUsageLogic = kea<endpointsUsageLogicType>([
queryDurationTrendsQuery: [
(s) => [s.dateRange, s.endpointFilter, s.materializationType, s.interval, s.breakdownBy],
- (dateRange, endpointFilter, materializationType, interval, breakdownBy): EndpointsUsageTrendsQuery => ({
+ (
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ endpointFilter: string[],
+ materializationType: 'inline' | 'materialized' | null,
+ interval: IntervalType,
+ breakdownBy: EndpointsUsageBreakdown | null
+ ): EndpointsUsageTrendsQuery => ({
kind: NodeKind.EndpointsUsageTrendsQuery,
dateRange,
endpointNames: endpointFilter.length > 0 ? endpointFilter : undefined,
@@ -176,7 +368,16 @@ export const endpointsUsageLogic = kea<endpointsUsageLogicType>([
errorRateTrendsQuery: [
(s) => [s.dateRange, s.endpointFilter, s.materializationType, s.interval, s.breakdownBy],
- (dateRange, endpointFilter, materializationType, interval, breakdownBy): EndpointsUsageTrendsQuery => ({
+ (
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ endpointFilter: string[],
+ materializationType: 'inline' | 'materialized' | null,
+ interval: IntervalType,
+ breakdownBy: EndpointsUsageBreakdown | null
+ ): EndpointsUsageTrendsQuery => ({
kind: NodeKind.EndpointsUsageTrendsQuery,
dateRange,
endpointNames: endpointFilter.length > 0 ? endpointFilter : undefined,
@@ -189,7 +390,14 @@ export const endpointsUsageLogic = kea<endpointsUsageLogicType>([
endpointTableQuery: [
(s) => [s.dateRange, s.endpointFilter, s.materializationType],
- (dateRange, endpointFilter, materializationType): EndpointsUsageTableQuery => ({
+ (
+ dateRange: {
+ date_from: string | null
+ date_to: string | null
+ },
+ endpointFilter: string[],
+ materializationType: 'inline' | 'materialized' | null
+ ): EndpointsUsageTableQuery => ({
kind: NodeKind.EndpointsUsageTableQuery,
dateRange,
endpointNames: endpointFilter.length > 0 ? endpointFilter : undefined,
diff --git a/products/endpoints/frontend/insightPickerEndpointModalLogic.ts b/products/endpoints/frontend/insightPickerEndpointModalLogic.ts
index c5b7f36e6a3c..55656686191a 100644
--- a/products/endpoints/frontend/insightPickerEndpointModalLogic.ts
+++ b/products/endpoints/frontend/insightPickerEndpointModalLogic.ts
@@ -1,4 +1,4 @@
-import { actions, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, listeners, path, reducers } from 'kea'
import { actionToUrl, urlToAction } from 'kea-router'
import { addSavedInsightsModalLogic } from 'scenes/saved-insights/addSavedInsightsModalLogic'
@@ -6,7 +6,38 @@ import { urls } from 'scenes/urls'
import { QueryBasedInsightModel } from '~/types'
-import type { insightPickerEndpointModalLogicType } from './insightPickerEndpointModalLogicType'
+import type { Node } from '../../../frontend/src/queries/schema/schema-general'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightPickerEndpointModalLogicValues {
+ isOpen: boolean
+ selectedInsight: QueryBasedInsightModel | null
+ showMoreInsightTypes: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface insightPickerEndpointModalLogicActions {
+ clearSelectedInsight: () => {
+ value: true
+ }
+ closeModal: () => {
+ value: true
+ }
+ openModal: () => {
+ value: true
+ }
+ selectInsight: (insight: QueryBasedInsightModel) => {
+ insight: QueryBasedInsightModel<Node<Record<string, any>>>
+ }
+ toggleShowMoreInsightTypes: () => {
+ value: true
+ }
+}
+
+export type insightPickerEndpointModalLogicType = MakeLogicType<
+ insightPickerEndpointModalLogicValues,
+ insightPickerEndpointModalLogicActions
+>
export const insightPickerEndpointModalLogic = kea<insightPickerEndpointModalLogicType>([
path(['products', 'endpoints', 'frontend', 'insightPickerEndpointModalLogic']),
diff --git a/products/legal_documents/frontend/scenes/legalDocumentsLogic.ts b/products/legal_documents/frontend/scenes/legalDocumentsLogic.ts
index 4c63073152c3..2cb3528a71dc 100644
--- a/products/legal_documents/frontend/scenes/legalDocumentsLogic.ts
+++ b/products/legal_documents/frontend/scenes/legalDocumentsLogic.ts
@@ -1,5 +1,6 @@
-import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { loaders } from 'kea-loaders'
import { router, urlToAction } from 'kea-router'
@@ -11,8 +12,8 @@ import { urls } from 'scenes/urls'
import { BillingType } from '~/types'
+import type { OrganizationType } from '../../../../frontend/src/types'
import * as api from '../generated/api'
-import type { legalDocumentsLogicType } from './legalDocumentsLogicType'
export type LegalDocumentType = 'BAA' | 'DPA'
export type DPAMode = 'pretty' | 'lawyer' | 'fairytale' | 'tswift'
@@ -55,6 +56,134 @@ function defaultsFor(documentType: LegalDocumentType): LegalDocumentFormValues {
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface legalDocumentsLogicValues {
+ billing: BillingType | null // billingLogic
+ currentOrganization: OrganizationType | null // organizationLogic
+ currentOrganizationId: string // organizationLogic
+ isAdminOrOwner: boolean | null // organizationLogic
+ deletingId: string | null
+ existingDocumentOfCurrentType: LegalDocument | null
+ existingDocumentTypes: Set<LegalDocumentType>
+ hasQualifyingBaaAddon: boolean
+ isDpaModeSubmittable: boolean
+ isLegalDocumentSubmitting: boolean
+ isLegalDocumentValid: boolean
+ isOnEnterpriseStandardTrial: boolean
+ isOnQualifyingAddonTrial: boolean
+ legalDocument: LegalDocumentFormValues
+ legalDocumentAllErrors: Record<string, any>
+ legalDocumentChanged: boolean
+ legalDocumentErrors: DeepPartialMap<LegalDocumentFormValues, ValidationErrorType>
+ legalDocumentHasErrors: boolean
+ legalDocumentManualErrors: Record<string, any>
+ legalDocumentTouched: boolean
+ legalDocumentTouches: Record<string, boolean>
+ legalDocumentValidationErrors: DeepPartialMap<LegalDocumentFormValues, ValidationErrorType>
+ legalDocuments: LegalDocument[]
+ legalDocumentsLoading: boolean
+ showLegalDocumentErrors: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface legalDocumentsLogicActions {
+ loadCurrentOrganizationSuccess: (
+ currentOrganization: OrganizationType | null,
+ payload?: any
+ ) => {
+ currentOrganization: OrganizationType | null
+ payload?: any
+ } // organizationLogic
+ deleteLegalDocument: (
+ id: string,
+ documentType: LegalDocumentType
+ ) => {
+ documentType: LegalDocumentType
+ id: string
+ }
+ loadLegalDocuments: () => any
+ loadLegalDocumentsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadLegalDocumentsSuccess: (
+ legalDocuments: LegalDocument[],
+ payload?: any
+ ) => {
+ legalDocuments: LegalDocument[]
+ payload?: any
+ }
+ resetLegalDocument: (values?: LegalDocumentFormValues) => {
+ values?: LegalDocumentFormValues
+ }
+ setDeletingId: (id: string | null) => {
+ id: string | null
+ }
+ setDocumentType: (documentType: LegalDocumentType) => {
+ documentType: LegalDocumentType
+ }
+ setDpaMode: (dpaMode: DPAMode) => {
+ dpaMode: DPAMode
+ }
+ setLegalDocumentManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setLegalDocumentValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setLegalDocumentValues: (values: DeepPartial<LegalDocumentFormValues>) => {
+ values: DeepPartial<LegalDocumentFormValues>
+ }
+ submitLegalDocument: () => {
+ value: boolean
+ }
+ submitLegalDocumentFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitLegalDocumentRequest: (legalDocument: LegalDocumentFormValues) => {
+ legalDocument: LegalDocumentFormValues
+ }
+ submitLegalDocumentSuccess: (legalDocument: LegalDocumentFormValues) => {
+ legalDocument: LegalDocumentFormValues
+ }
+ touchLegalDocumentField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface legalDocumentsLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ hasQualifyingBaaAddon: (billing: BillingType | null) => boolean
+ isOnQualifyingAddonTrial: (billing: BillingType | null) => boolean
+ isOnEnterpriseStandardTrial: (billing: BillingType | null) => boolean
+ isDpaModeSubmittable: (legalDocument: LegalDocumentFormValues) => boolean
+ existingDocumentTypes: (legalDocuments: LegalDocument[]) => Set<LegalDocumentType>
+ existingDocumentOfCurrentType: (
+ legalDocument: LegalDocumentFormValues,
+ legalDocuments: LegalDocument[]
+ ) => LegalDocument | null
+ }
+}
+
+export type legalDocumentsLogicType = MakeLogicType<
+ legalDocumentsLogicValues,
+ legalDocumentsLogicActions,
+ Record<string, any>,
+ legalDocumentsLogicMeta
+>
+
export const legalDocumentsLogic = kea<legalDocumentsLogicType>([
path(['products', 'legal_documents', 'legalDocumentsLogic']),
connect(() => ({
diff --git a/products/live_debugger/frontend/liveDebuggerLogic.ts b/products/live_debugger/frontend/liveDebuggerLogic.ts
index 77887fe95fbe..e0fc18359d59 100644
--- a/products/live_debugger/frontend/liveDebuggerLogic.ts
+++ b/products/live_debugger/frontend/liveDebuggerLogic.ts
@@ -1,11 +1,9 @@
-import { actions, connect, events, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, events, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
import { teamLogic } from 'scenes/teamLogic'
-import type { liveDebuggerLogicType } from './liveDebuggerLogicType'
-
export interface Breakpoint {
id: string
repository: string | null
@@ -28,6 +26,144 @@ export interface BreakpointInstance {
filename: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface liveDebuggerLogicValues {
+ currentProjectId: number | string // teamLogic
+ breakpointInstances: BreakpointInstance[]
+ breakpointInstancesLoading: boolean
+ breakpointLines: number[]
+ breakpoints: Breakpoint[]
+ breakpointsByLine: Record<number, Breakpoint>
+ breakpointsLoading: boolean
+ currentRepository: string
+ hitCountsByLine: Record<number, number>
+ hitsForSelectedLine: BreakpointInstance[]
+ instancesByLine: Record<number, BreakpointInstance[]>
+ newHitsByLine: Set<number>
+ newInstanceIds: Set<string>
+ previousInstanceIds: Set<string>
+ seenInstanceIds: Set<string>
+ selectedFilePath: string
+ selectedInstance: BreakpointInstance | null
+ selectedInstanceId: string | null
+ selectedLineForHits: number | null
+ visibleBreakpointIds: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface liveDebuggerLogicActions {
+ clearAllBreakpoints: () => {
+ value: true
+ }
+ loadBreakpointInstances: () => any
+ loadBreakpointInstancesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadBreakpointInstancesSuccess: (
+ breakpointInstances: BreakpointInstance[],
+ payload?: any
+ ) => {
+ breakpointInstances: BreakpointInstance[]
+ payload?: any
+ }
+ loadBreakpoints: () => any
+ loadBreakpointsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadBreakpointsSuccess: (
+ breakpoints: Breakpoint[],
+ payload?: any
+ ) => {
+ breakpoints: Breakpoint[]
+ payload?: any
+ }
+ markInstanceAsOld: (instanceId: string) => {
+ instanceId: string
+ }
+ selectInstance: (instanceId: string | null) => {
+ instanceId: string | null
+ }
+ setCurrentRepository: (repository: string) => {
+ repository: string
+ }
+ setHoveredLine: (lineNumber: number | null) => {
+ lineNumber: number | null
+ }
+ setSelectedFilePath: (filePath: string) => {
+ filePath: string
+ }
+ showHitsForLine: (lineNumber: number | null) => {
+ lineNumber: number | null
+ }
+ startPollingBreakpoints: () => {
+ value: true
+ }
+ stopPollingBreakpoints: () => {
+ value: true
+ }
+ toggleBreakpoint: (
+ filename: string,
+ lineNumber: number,
+ repository: string
+ ) => {
+ filename: string
+ lineNumber: number
+ repository: string
+ }
+ toggleBreakpointForFile: (
+ filename: string,
+ lineNumber: number,
+ repository: string
+ ) => {
+ filename: string
+ lineNumber: number
+ repository: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface liveDebuggerLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ selectedInstance: (
+ selectedInstanceId: string | null,
+ breakpointInstances: BreakpointInstance[]
+ ) => BreakpointInstance | null
+ visibleBreakpointIds: (breakpoints: Breakpoint[]) => string[]
+ breakpointLines: (breakpoints: Breakpoint[], selectedFilePath: string) => number[]
+ breakpointsByLine: (breakpoints: Breakpoint[], selectedFilePath: string) => Record<number, Breakpoint>
+ instancesByLine: (
+ breakpointInstances: BreakpointInstance[],
+ selectedFilePath: string
+ ) => Record<number, BreakpointInstance[]>
+ newInstanceIds: (breakpointInstances: BreakpointInstance[], seenInstanceIds: Set<string>) => Set<string>
+ hitCountsByLine: (breakpointInstances: BreakpointInstance[], selectedFilePath: string) => Record<number, number>
+ newHitsByLine: (
+ breakpointInstances: BreakpointInstance[],
+ seenInstanceIds: Set<string>,
+ selectedFilePath: string
+ ) => Set<number>
+ hitsForSelectedLine: (
+ selectedLineForHits: number | null,
+ instancesByLine: Record<number, BreakpointInstance[]>
+ ) => BreakpointInstance[]
+ }
+}
+
+export type liveDebuggerLogicType = MakeLogicType<
+ liveDebuggerLogicValues,
+ liveDebuggerLogicActions,
+ Record<string, any>,
+ liveDebuggerLogicMeta
+>
+
export const liveDebuggerLogic = kea<liveDebuggerLogicType>([
path(['products', 'live_debugger', 'frontend', 'liveDebuggerLogic']),
connect(() => ({ values: [teamLogic, ['currentProjectId']] })),
@@ -254,7 +390,8 @@ export const liveDebuggerLogic = kea<liveDebuggerLogicType>([
selectors({
selectedInstance: [
(s) => [s.selectedInstanceId, s.breakpointInstances],
- (selectedId, instances): BreakpointInstance | null => instances.find((i) => i.id === selectedId) || null,
+ (selectedId: string | null, instances: BreakpointInstance[]): BreakpointInstance | null =>
+ instances.find((i) => i.id === selectedId) || null,
],
visibleBreakpointIds: [
(s) => [s.breakpoints],
@@ -262,7 +399,7 @@ export const liveDebuggerLogic = kea<liveDebuggerLogicType>([
],
breakpointLines: [
(s) => [s.breakpoints, s.selectedFilePath],
- (breakpoints, selectedFilePath): number[] => {
+ (breakpoints: Breakpoint[], selectedFilePath: string): number[] => {
if (!Array.isArray(breakpoints) || !selectedFilePath) {
return []
}
@@ -274,7 +411,7 @@ export const liveDebuggerLogic = kea<liveDebuggerLogicType>([
],
breakpointsByLine: [
(s) => [s.breakpoints, s.selectedFilePath],
- (breakpoints, selectedFilePath): Record<number, Breakpoint> => {
+ (breakpoints: Breakpoint[], selectedFilePath: string): Record<number, Breakpoint> => {
const byLine: Record<number, Breakpoint> = {}
if (Array.isArray(breakpoints) && selectedFilePath) {
breakpoints
@@ -288,7 +425,7 @@ export const liveDebuggerLogic = kea<liveDebuggerLogicType>([
],
instancesByLine: [
(s) => [s.breakpointInstances, s.selectedFilePath],
- (instances, selectedFilePath): Record<number, BreakpointInstance[]> => {
+ (instances: BreakpointInstance[], selectedFilePath: string): Record<number, BreakpointInstance[]> => {
const grouped: Record<number, BreakpointInstance[]> = {}
instances
.filter((instance) => !selectedFilePath || instance.filename === selectedFilePath)
@@ -303,13 +440,13 @@ export const liveDebuggerLogic = kea<liveDebuggerLogicType>([
],
newInstanceIds: [
(s) => [s.breakpointInstances, s.seenInstanceIds],
- (instances, seenIds): Set<string> => {
+ (instances: BreakpointInstance[], seenIds: Set<string>): Set<string> => {
return new Set(instances.filter((instance) => !seenIds.has(instance.id)).map((instance) => instance.id))
},
],
hitCountsByLine: [
(s) => [s.breakpointInstances, s.selectedFilePath],
- (instances, selectedFilePath): Record<number, number> => {
+ (instances: BreakpointInstance[], selectedFilePath: string): Record<number, number> => {
const counts: Record<number, number> = {}
instances
.filter((instance) => !selectedFilePath || instance.filename === selectedFilePath)
@@ -321,7 +458,7 @@ export const liveDebuggerLogic = kea<liveDebuggerLogicType>([
],
newHitsByLine: [
(s) => [s.breakpointInstances, s.seenInstanceIds, s.selectedFilePath],
- (instances, seenIds, selectedFilePath): Set<number> => {
+ (instances: BreakpointInstance[], seenIds: Set<string>, selectedFilePath: string): Set<number> => {
const newInstances = instances
.filter((instance) => !seenIds.has(instance.id))
.filter((instance) => !selectedFilePath || instance.filename === selectedFilePath)
@@ -330,7 +467,10 @@ export const liveDebuggerLogic = kea<liveDebuggerLogicType>([
],
hitsForSelectedLine: [
(s) => [s.selectedLineForHits, s.instancesByLine],
- (selectedLine, instancesByLine): BreakpointInstance[] => {
+ (
+ selectedLine: number | null,
+ instancesByLine: Record<number, BreakpointInstance[]>
+ ): BreakpointInstance[] => {
if (!selectedLine) {
return []
}
diff --git a/products/live_debugger/frontend/repo_browser/repoBrowserLogic.ts b/products/live_debugger/frontend/repo_browser/repoBrowserLogic.ts
index 5163d3e25c9c..09da4963e95b 100644
--- a/products/live_debugger/frontend/repo_browser/repoBrowserLogic.ts
+++ b/products/live_debugger/frontend/repo_browser/repoBrowserLogic.ts
@@ -1,5 +1,5 @@
import _Fuse from 'fuse.js'
-import { actions, events, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, events, kea, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import type { TreeDataItem } from 'lib/lemon-ui/LemonTree/LemonTree'
@@ -12,11 +12,93 @@ import {
loadFileContent,
loadRepositoryTree,
} from './githubClient'
-import type { repoBrowserLogicType } from './repoBrowserLogicType'
// Hack so kea-typegen picks up the type
export type Fuse<T> = _Fuse<T>
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface repoBrowserLogicValues {
+ codeLines: string[]
+ fileContent: GitHubFileContent | null
+ fileContentLoading: boolean
+ fileSearchQuery: string
+ fuzzyIndex: Fuse<GitHubTreeItem>
+ relevantFiles: GitHubTreeItem[]
+ repositoryTree: GitHubTreeResponse | null
+ repositoryTreeLoading: boolean
+ selectedFilePath: string | null
+ treeData: TreeDataItem[]
+ visibleFilesAndFolders: GitHubTreeItem[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface repoBrowserLogicActions {
+ loadFileContent: (filePath: string) => {
+ filePath: string
+ }
+ loadFileContentFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFileContentSuccess: (
+ fileContent: GitHubFileContent,
+ payload?: {
+ filePath: string
+ }
+ ) => {
+ fileContent: GitHubFileContent
+ payload?: {
+ filePath: string
+ }
+ }
+ loadRepositoryTree: () => any
+ loadRepositoryTreeFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadRepositoryTreeSuccess: (
+ repositoryTree: GitHubTreeResponse,
+ payload?: any
+ ) => {
+ repositoryTree: GitHubTreeResponse
+ payload?: any
+ }
+ setExpandedFolderPaths: (paths: string[]) => {
+ paths: string[]
+ }
+ setFileSearchQuery: (query: string) => {
+ query: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface repoBrowserLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ codeLines: (fileContent: GitHubFileContent | null) => string[]
+ relevantFiles: (repositoryTree: GitHubTreeResponse | null) => GitHubTreeItem[]
+ fuzzyIndex: (relevantFiles: GitHubTreeItem[]) => Fuse<GitHubTreeItem>
+ visibleFilesAndFolders: (
+ fileSearchQuery: string,
+ relevantFiles: GitHubTreeItem[],
+ fuzzyIndex: Fuse<GitHubTreeItem>
+ ) => GitHubTreeItem[]
+ treeData: (visibleFilesAndFolders: GitHubTreeItem[]) => TreeDataItem[]
+ }
+}
+
+export type repoBrowserLogicType = MakeLogicType<
+ repoBrowserLogicValues,
+ repoBrowserLogicActions,
+ Record<string, any>,
+ repoBrowserLogicMeta
+>
+
export const repoBrowserLogic = kea<repoBrowserLogicType>([
path(['products', 'live_debugger', 'frontend', 'repo_browser', 'repoBrowserLogic']),
diff --git a/products/replay_vision/frontend/logics/bulkScanLogic.ts b/products/replay_vision/frontend/logics/bulkScanLogic.ts
index 4ea1688e30e2..89e7e52b9117 100644
--- a/products/replay_vision/frontend/logics/bulkScanLogic.ts
+++ b/products/replay_vision/frontend/logics/bulkScanLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers } from 'kea'
import { router } from 'kea-router'
import { ApiError } from 'lib/api-error'
@@ -7,13 +7,39 @@ import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
import { visionScannersObserveCreate } from '../generated/api'
-import type { bulkScanLogicType } from './bulkScanLogicType'
+import type { ReplayScannerApi } from '../generated/api.schemas'
import { refreshVisionQuota } from './visionQuotaLogic'
import { visionScannersListLogic } from './visionScannersListLogic'
// Caps simultaneous workflow-start requests; the batches run sequentially.
const BULK_SCAN_CONCURRENCY = 10
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface bulkScanLogicValues {
+ scanners: ReplayScannerApi[] // visionScannersListLogic
+ scannersLoading: boolean // visionScannersListLogic
+ scanning: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface bulkScanLogicActions {
+ scanRecordings: (
+ scannerId: string,
+ sessionIds: string[]
+ ) => {
+ scannerId: string
+ sessionIds: string[]
+ }
+ scanRecordingsFailure: () => {
+ value: true
+ }
+ scanRecordingsSuccess: () => {
+ value: true
+ }
+}
+
+export type bulkScanLogicType = MakeLogicType<bulkScanLogicValues, bulkScanLogicActions>
+
export const bulkScanLogic = kea<bulkScanLogicType>([
path(['products', 'replay_vision', 'frontend', 'logics', 'bulkScanLogic']),
diff --git a/products/replay_vision/frontend/logics/observationsDockLogic.ts b/products/replay_vision/frontend/logics/observationsDockLogic.ts
index fb48718d7c47..f275ed766bf0 100644
--- a/products/replay_vision/frontend/logics/observationsDockLogic.ts
+++ b/products/replay_vision/frontend/logics/observationsDockLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { metricCount } from 'lib/operationalMetrics'
@@ -8,7 +8,6 @@ import { visionObservationsList, visionScannersObserveCreate } from '../generate
import type { ReplayScannerApi, ReplayObservationApi } from '../generated/api.schemas'
import { OBSERVE_POLL_GRACE_MS, scheduleObservationPoll, shouldPollObservations } from './observationPolling'
import { requestObservationRetry } from './observationRetry'
-import type { observationsDockLogicType } from './observationsDockLogicType'
import { refreshVisionQuota } from './visionQuotaLogic'
import { visionScannersListLogic } from './visionScannersListLogic'
@@ -16,6 +15,77 @@ export interface ObservationsDockLogicProps {
sessionId: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface observationsDockLogicValues {
+ scanners: ReplayScannerApi[] // visionScannersListLogic
+ dockOpen: boolean
+ filteredScanners: ReplayScannerApi[]
+ hasObservationsInFlight: boolean
+ observations: ReplayObservationApi[]
+ observationsLoading: boolean
+ observing: boolean
+ pollUntil: number
+ retryingObservationIds: string[]
+ scannerPickerOpen: boolean
+ scannerSearch: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface observationsDockLogicActions {
+ loadObservations: () => {
+ value: true
+ }
+ loadObservationsFailure: () => {
+ value: true
+ }
+ loadObservationsSuccess: (observations: ReplayObservationApi[]) => {
+ observations: ReplayObservationApi[]
+ }
+ observe: (scannerId: string) => {
+ scannerId: string
+ }
+ observeFailure: () => {
+ value: true
+ }
+ observeSuccess: () => {
+ value: true
+ }
+ retryObservation: (observationId: string) => {
+ observationId: string
+ }
+ retryObservationFailure: (observationId: string) => {
+ observationId: string
+ }
+ retryObservationSuccess: (observationId: string) => {
+ observationId: string
+ }
+ setDockOpen: (open: boolean) => {
+ open: boolean
+ }
+ setScannerPickerOpen: (open: boolean) => {
+ open: boolean
+ }
+ setScannerSearch: (search: string) => {
+ search: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface observationsDockLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ hasObservationsInFlight: (observations: ReplayObservationApi[]) => boolean
+ filteredScanners: (scanners: ReplayScannerApi[], scannerSearch: string) => ReplayScannerApi[]
+ }
+}
+
+export type observationsDockLogicType = MakeLogicType<
+ observationsDockLogicValues,
+ observationsDockLogicActions,
+ ObservationsDockLogicProps,
+ observationsDockLogicMeta
+>
+
export const observationsDockLogic = kea<observationsDockLogicType>([
path(['products', 'replay_vision', 'frontend', 'logics', 'observationsDockLogic']),
props({} as ObservationsDockLogicProps),
diff --git a/products/replay_vision/frontend/logics/visionQuotaLogic.ts b/products/replay_vision/frontend/logics/visionQuotaLogic.ts
index 85ee78eef968..11ef5fa4d8de 100644
--- a/products/replay_vision/frontend/logics/visionQuotaLogic.ts
+++ b/products/replay_vision/frontend/logics/visionQuotaLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import { billingLogic } from 'scenes/billing/billingLogic'
@@ -6,7 +6,43 @@ import { teamLogic } from 'scenes/teamLogic'
import { environmentVisionQuotaRetrieve } from '../generated/api'
import type { VisionQuotaApi } from '../generated/api.schemas'
-import type { visionQuotaLogicType } from './visionQuotaLogicType'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visionQuotaLogicValues {
+ quota: VisionQuotaApi | null
+ quotaLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visionQuotaLogicActions {
+ loadBilling: () => any // billingLogic
+ adjustProjectedMonthly: (delta: number) => {
+ delta: number
+ }
+ loadQuota: () => {
+ value: true
+ }
+ loadQuotaFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadQuotaSuccess: (
+ quota: VisionQuotaApi | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ quota: VisionQuotaApi | null
+ payload?: {
+ value: true
+ }
+ }
+}
+
+export type visionQuotaLogicType = MakeLogicType<visionQuotaLogicValues, visionQuotaLogicActions>
export const visionQuotaLogic = kea<visionQuotaLogicType>([
path(['products', 'replay_vision', 'frontend', 'logics', 'visionQuotaLogic']),
diff --git a/products/replay_vision/frontend/logics/visionScannersListLogic.ts b/products/replay_vision/frontend/logics/visionScannersListLogic.ts
index e5a567309f83..0c529529ae7a 100644
--- a/products/replay_vision/frontend/logics/visionScannersListLogic.ts
+++ b/products/replay_vision/frontend/logics/visionScannersListLogic.ts
@@ -1,15 +1,55 @@
-import { actions, afterMount, connect, isBreakpoint, kea, listeners, path } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, isBreakpoint, kea, listeners, path } from 'kea'
import { loaders } from 'kea-loaders'
import { metricCount } from 'lib/operationalMetrics'
import { teamLogic } from 'scenes/teamLogic'
+import type { TeamPublicType } from '../../../../frontend/src/types'
import { visionScannersList } from '../generated/api'
import type { ReplayScannerApi } from '../generated/api.schemas'
-import type { visionScannersListLogicType } from './visionScannersListLogicType'
const PAGE_LIMIT = 100
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visionScannersListLogicValues {
+ scanners: ReplayScannerApi[]
+ scannersLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visionScannersListLogicActions {
+ loadCurrentTeamSuccess: (
+ currentTeam: TeamPublicType | null,
+ payload?: any
+ ) => {
+ currentTeam: TeamPublicType | null
+ payload?: any
+ } // teamLogic
+ loadScanners: () => {
+ value: true
+ }
+ loadScannersFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadScannersSuccess: (
+ scanners: ReplayScannerApi[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ scanners: ReplayScannerApi[]
+ payload?: {
+ value: true
+ }
+ }
+}
+
+export type visionScannersListLogicType = MakeLogicType<visionScannersListLogicValues, visionScannersListLogicActions>
+
/** The team's full scanner list for pickers — shared and propless so each surface doesn't refetch its own copy. */
export const visionScannersListLogic = kea<visionScannersListLogicType>([
path(['products', 'replay_vision', 'frontend', 'logics', 'visionScannersListLogic']),
diff --git a/products/replay_vision/frontend/observations/observationLabelLogic.ts b/products/replay_vision/frontend/observations/observationLabelLogic.ts
index b88a7c0cf35b..fa38cbba0813 100644
--- a/products/replay_vision/frontend/observations/observationLabelLogic.ts
+++ b/products/replay_vision/frontend/observations/observationLabelLogic.ts
@@ -1,11 +1,10 @@
-import { actions, kea, key, listeners, path, props, propsChanged, reducers } from 'kea'
+import { MakeLogicType, actions, kea, key, listeners, path, props, propsChanged, reducers } from 'kea'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { teamLogic } from 'scenes/teamLogic'
import { visionObservationsLabelCreate, visionObservationsLabelDestroy } from '../generated/api'
import type { ReplayObservationLabelApi } from '../generated/api.schemas'
-import type { observationLabelLogicType } from './observationLabelLogicType'
export interface ObservationLabelLogicProps {
observationId: string
@@ -15,6 +14,48 @@ export interface ObservationLabelLogicProps {
onChange?: (label: ReplayObservationLabelApi | null) => void
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface observationLabelLogicValues {
+ feedbackDraft: string
+ label: ReplayObservationLabelApi | null
+ saving: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface observationLabelLogicActions {
+ clearRating: () => {
+ value: true
+ }
+ labelUpdated: (label: ReplayObservationLabelApi | null) => {
+ label: ReplayObservationLabelApi | null
+ }
+ rate: (
+ isCorrect: boolean,
+ feedback: string
+ ) => {
+ feedback: string
+ isCorrect: boolean
+ }
+ setFeedbackDraft: (feedback: string) => {
+ feedback: string
+ }
+ setSaving: (saving: boolean) => {
+ saving: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface observationLabelLogicMeta {
+ key: string
+}
+
+export type observationLabelLogicType = MakeLogicType<
+ observationLabelLogicValues,
+ observationLabelLogicActions,
+ ObservationLabelLogicProps,
+ observationLabelLogicMeta
+>
+
/** One instance per observation: the team's shared thumbs up/down rating with feedback autosave. */
export const observationLabelLogic = kea<observationLabelLogicType>([
path(['products', 'replay_vision', 'frontend', 'observations', 'observationLabelLogic']),
diff --git a/products/replay_vision/frontend/observations/observationProgressLogic.ts b/products/replay_vision/frontend/observations/observationProgressLogic.ts
index 6ec0442736e5..9cdd48f42c86 100644
--- a/products/replay_vision/frontend/observations/observationProgressLogic.ts
+++ b/products/replay_vision/frontend/observations/observationProgressLogic.ts
@@ -1,9 +1,8 @@
-import { actions, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, kea, key, listeners, path, props, reducers } from 'kea'
import { teamLogic } from 'scenes/teamLogic'
import { observationsDockLogic } from '../logics/observationsDockLogic'
-import type { observationProgressLogicType } from './observationProgressLogicType'
export interface ObservationFrameProgress {
frame: number
@@ -94,6 +93,40 @@ async function consumeProgressStream(
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface observationProgressLogicValues {
+ progress: ObservationProgress | null
+ streamError: string | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface observationProgressLogicActions {
+ setProgress: (progress: ObservationProgress) => {
+ progress: ObservationProgress
+ }
+ setStreamError: (error: string) => {
+ error: string
+ }
+ startStream: () => {
+ value: true
+ }
+ streamCompleted: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface observationProgressLogicMeta {
+ key: string
+}
+
+export type observationProgressLogicType = MakeLogicType<
+ observationProgressLogicValues,
+ observationProgressLogicActions,
+ ObservationProgressLogicProps,
+ observationProgressLogicMeta
+>
+
/**
* Streams live progress for one in-flight observation over SSE. Keyed by observation id, so the dock card and the
* details page share a single stream. The stream self-terminates once the observation settles.
diff --git a/products/replay_vision/frontend/observations/replayObservationLogic.ts b/products/replay_vision/frontend/observations/replayObservationLogic.ts
index 4cebd56db04e..30d5c2de73c2 100644
--- a/products/replay_vision/frontend/observations/replayObservationLogic.ts
+++ b/products/replay_vision/frontend/observations/replayObservationLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers } from 'kea'
import { combineUrl, router } from 'kea-router'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
@@ -11,7 +11,6 @@ import { scheduleObservationPoll } from '../logics/observationPolling'
import { requestObservationRetry } from '../logics/observationRetry'
import { OBSERVATION_LIST_FILTER_KEYS } from '../replay_scanners/types'
import { observationProgressLogic } from './observationProgressLogic'
-import type { replayObservationLogicType } from './replayObservationLogicType'
import { replayObservationSceneLogic } from './replayObservationSceneLogic'
export interface ReplayObservationLogicProps {
@@ -35,6 +34,50 @@ export function observationDetailUrl(id: string, filterParams: Record<string, st
return combineUrl(urls.replayVisionObservation(id), filterParams).url
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayObservationLogicValues {
+ observation: ReplayObservationApi | null
+ observationLoading: boolean
+ retrying: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayObservationLogicActions {
+ streamCompleted: () => {
+ value: true
+ } // observationProgressLogic
+ loadObservation: () => {
+ value: true
+ }
+ loadObservationFailure: () => {
+ value: true
+ }
+ loadObservationSuccess: (observation: ReplayObservationApi) => {
+ observation: ReplayObservationApi
+ }
+ retryObservation: () => {
+ value: true
+ }
+ retryObservationFailure: () => {
+ value: true
+ }
+ retryObservationSuccess: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayObservationLogicMeta {
+ key: string
+}
+
+export type replayObservationLogicType = MakeLogicType<
+ replayObservationLogicValues,
+ replayObservationLogicActions,
+ ReplayObservationLogicProps,
+ replayObservationLogicMeta
+>
+
export const replayObservationLogic = kea<replayObservationLogicType>([
path(['products', 'replay_vision', 'frontend', 'observations', 'replayObservationLogic']),
props({} as ReplayObservationLogicProps),
diff --git a/products/replay_vision/frontend/observations/replayObservationSceneLogic.ts b/products/replay_vision/frontend/observations/replayObservationSceneLogic.ts
index f1eed1248955..7730a5866a44 100644
--- a/products/replay_vision/frontend/observations/replayObservationSceneLogic.ts
+++ b/products/replay_vision/frontend/observations/replayObservationSceneLogic.ts
@@ -1,11 +1,53 @@
-import { actions, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers, selectors } from 'kea'
import { urlToAction } from 'kea-router'
import { urls } from 'scenes/urls'
import { Breadcrumb } from '~/types'
-import type { replayObservationSceneLogicType } from './replayObservationSceneLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayObservationSceneLogicValues {
+ breadcrumbs: Breadcrumb[]
+ observationId: string
+ scannerContext: {
+ scannerId: string | null
+ scannerName: string | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayObservationSceneLogicActions {
+ setObservationId: (observationId: string) => {
+ observationId: string
+ }
+ setScannerContext: (
+ scannerId: string | null,
+ scannerName: string | null
+ ) => {
+ scannerId: string | null
+ scannerName: string | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayObservationSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ breadcrumbs: (
+ observationId: string,
+ scannerContext: {
+ scannerId: string | null
+ scannerName: string | null
+ }
+ ) => Breadcrumb[]
+ }
+}
+
+export type replayObservationSceneLogicType = MakeLogicType<
+ replayObservationSceneLogicValues,
+ replayObservationSceneLogicActions,
+ Record<string, any>,
+ replayObservationSceneLogicMeta
+>
export const replayObservationSceneLogic = kea<replayObservationSceneLogicType>([
path(['products', 'replay_vision', 'frontend', 'observations', 'replayObservationSceneLogic']),
diff --git a/products/replay_vision/frontend/replay_scanners/actionEditorSceneLogic.ts b/products/replay_vision/frontend/replay_scanners/actionEditorSceneLogic.ts
index 444b6adaaf1c..4725c2c83cb5 100644
--- a/products/replay_vision/frontend/replay_scanners/actionEditorSceneLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/actionEditorSceneLogic.ts
@@ -1,5 +1,6 @@
-import { actions, isBreakpoint, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, isBreakpoint, kea, listeners, path, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { router, urlToAction } from 'kea-router'
import { dayjs } from 'lib/dayjs'
@@ -22,11 +23,121 @@ import {
VisionAlertMetricEnumApi,
} from '../generated/api.schemas'
import type { VisionActionApi } from '../generated/api.schemas'
-import type { actionEditorSceneLogicType } from './actionEditorSceneLogicType'
import { parseRruleToCadence } from './cadence'
import { visionActionRunsLogic } from './visionActionRunsLogic'
import { buildActionBody, NEW_ACTION_FORM, VisionActionForm, visionActionsLogic } from './visionActionsLogic'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionEditorSceneLogicValues {
+ actionForm: VisionActionForm
+ actionFormAllErrors: Record<string, any>
+ actionFormChanged: boolean
+ actionFormErrors: DeepPartialMap<VisionActionForm, ValidationErrorType>
+ actionFormHasErrors: boolean
+ actionFormManualErrors: Record<string, any>
+ actionFormTouched: boolean
+ actionFormTouches: Record<string, boolean>
+ actionFormValidationErrors: DeepPartialMap<VisionActionForm, ValidationErrorType>
+ actionId: string
+ actionLoading: boolean
+ breadcrumbs: Breadcrumb[]
+ effectiveScannerId: string
+ isActionFormSubmitting: boolean
+ isActionFormValid: boolean
+ isNew: boolean
+ loadedAction: VisionActionApi | null
+ scannerId: string
+ scannerName: string
+ scannerType: string
+ showActionFormErrors: boolean
+ targetingMode: 'all' | 'filtered'
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionEditorSceneLogicActions {
+ loadAction: (actionId: string) => {
+ actionId: string
+ }
+ loadActionFailure: () => {
+ value: true
+ }
+ loadActionSuccess: (action: VisionActionApi) => {
+ action: VisionActionApi
+ }
+ resetActionForm: (values?: VisionActionForm) => {
+ values?: VisionActionForm
+ }
+ setActionFormManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setActionFormValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setActionFormValues: (values: DeepPartial<VisionActionForm>) => {
+ values: DeepPartial<VisionActionForm>
+ }
+ setActionId: (actionId: string) => {
+ actionId: string
+ }
+ setScannerId: (scannerId: string) => {
+ scannerId: string
+ }
+ setScannerName: (scannerName: string) => {
+ scannerName: string
+ }
+ setScannerType: (scannerType: string) => {
+ scannerType: string
+ }
+ setTargetingMode: (mode: 'all' | 'filtered') => {
+ mode: 'all' | 'filtered'
+ }
+ submitActionForm: () => {
+ value: boolean
+ }
+ submitActionFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitActionFormRequest: (actionForm: VisionActionForm) => {
+ actionForm: VisionActionForm
+ }
+ submitActionFormSuccess: (actionForm: VisionActionForm) => {
+ actionForm: VisionActionForm
+ }
+ touchActionFormField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface actionEditorSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isNew: (actionId: string) => boolean
+ effectiveScannerId: (scannerId: string, loadedAction: VisionActionApi | null) => string
+ breadcrumbs: (
+ isNew: boolean,
+ actionId: string,
+ effectiveScannerId: string,
+ loadedAction: VisionActionApi | null,
+ scannerName: string
+ ) => Breadcrumb[]
+ }
+}
+
+export type actionEditorSceneLogicType = MakeLogicType<
+ actionEditorSceneLogicValues,
+ actionEditorSceneLogicActions,
+ Record<string, any>,
+ actionEditorSceneLogicMeta
+>
+
export const actionEditorSceneLogic = kea<actionEditorSceneLogicType>([
path(['products', 'replay_vision', 'frontend', 'replay_scanners', 'actionEditorSceneLogic']),
diff --git a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts
index a778058fc314..23f19906331b 100644
--- a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts
@@ -1,5 +1,18 @@
-import { actions, afterMount, isBreakpoint, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ isBreakpoint,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ reducers,
+ selectors,
+} from 'kea'
import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { loaders } from 'kea-loaders'
import { actionToUrl, beforeUnload, router, urlToAction } from 'kea-router'
import { CombinedLocation } from 'kea-router/lib/utils'
@@ -29,12 +42,12 @@ import type {
ReplayObservationApi,
TagSuggestionApi,
} from '../generated/api.schemas'
+import type { ScannerTypeEnumApi } from '../generated/api.schemas'
import { OBSERVE_POLL_GRACE_MS, scheduleObservationPoll, shouldPollObservations } from '../logics/observationPolling'
import { requestObservationRetry } from '../logics/observationRetry'
import { refreshVisionQuota } from '../logics/visionQuotaLogic'
import { type UrlSorting, parseCsvParam, parseSortParam, serializeSortParam } from '../utils/urlParams'
import { clampDurationFilter, durationFilterError } from './durationBounds'
-import type { replayScannerLogicType } from './replayScannerLogicType'
import { SCANNER_EDITOR_STEPS, scannerEditorSceneLogic, scannerStepUrl } from './scannerEditorSceneLogic'
import { findScannerTemplate, newScanner } from './scannerTemplates'
import {
@@ -185,6 +198,364 @@ export function buildObservationListParams(
return params
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayScannerLogicValues {
+ availableTags: string[]
+ chartDateFrom: string | null
+ chartDateTo: string | null
+ classifierTagStats: {
+ fixedRanked: [string, number][]
+ freeformRanked: [string, number][]
+ totalWithTags: number
+ }
+ coverageStats: {
+ recentDays: number
+ recentSessions: number
+ totalSessions: number
+ }
+ durationValidationError: string | null
+ estimateRequestVersion: number
+ hasActiveObservationFilters: boolean
+ hasObservationsInFlight: boolean
+ hasUnsavedChanges: boolean
+ isNew: boolean
+ isScannerSubmitting: boolean
+ isScannerValid: boolean
+ monitorStats: {
+ inconclusiveTotal: number
+ noTotal: number
+ yesTotal: number
+ }
+ observationDetailLinkParams: Record<string, string>
+ observationStats: {
+ failed: number
+ ineligible: number
+ inFlight: number
+ succeeded: number
+ successRate: number | null
+ total: number
+ }
+ observationStatsApi: ObservationStatsApi | null
+ observationStatsApiLoading: boolean
+ observationStatusFilter: ObservationStatusValue[]
+ observationSubjectFilter: string
+ observationTagFilter: string[]
+ observationTriggeredByFilter: ObservationTriggeredByValue[]
+ observationVerdictFilter: ObservationVerdictValue[]
+ observations: ReplayObservationApi[]
+ observationsLoading: boolean
+ observationsPage: number
+ observationsSort: ObservationsSorting | null
+ observationsTotal: number
+ onDemandObservationSuccessCount: number
+ originalScanner: ReplayScanner | null
+ pollUntil: number
+ retryingObservationIds: string[]
+ scanner: ReplayScanner
+ scannerAllErrors: Record<string, any>
+ scannerChanged: boolean
+ scannerErrors: DeepPartialMap<ReplayScanner, ValidationErrorType>
+ scannerEstimate: EstimateResponseApi | null
+ scannerEstimateError: string | null
+ scannerEstimateLoading: boolean
+ scannerHasErrors: boolean
+ scannerLoading: boolean
+ scannerManualErrors: Record<string, any>
+ scannerTouched: boolean
+ scannerTouches: Record<string, boolean>
+ scannerValidationErrors: DeepPartialMap<ReplayScanner, ValidationErrorType>
+ scorerHistogram: {
+ counts: number[]
+ labels: string[]
+ } | null
+ scorerSummary: {
+ count: number
+ max: number
+ mean: number
+ median: number
+ min: number
+ p25: number
+ p75: number
+ } | null
+ showScannerErrors: boolean
+ submitIntent: 'advance' | 'save'
+ tagSuggestions: TagSuggestionApi[]
+ tagSuggestionsLoading: boolean
+ togglingEnabled: boolean
+ triggeringOnDemandObservation: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayScannerLogicActions {
+ acceptAllTagSuggestions: () => {
+ value: true
+ }
+ acceptTagSuggestion: (tag: string) => {
+ tag: string
+ }
+ appendClassifierTags: (tags: string[]) => {
+ tags: string[]
+ }
+ clearObservationFilters: () => {
+ value: true
+ }
+ dismissTagSuggestions: () => {
+ value: true
+ }
+ loadObservationStats: () => {
+ value: true
+ }
+ loadObservationStatsFailure: () => {
+ value: true
+ }
+ loadObservationStatsSuccess: (stats: ObservationStatsApi) => {
+ stats: ObservationStatsApi
+ }
+ loadObservations: (background?: any) => {
+ background: any
+ }
+ loadObservationsFailure: () => {
+ value: true
+ }
+ loadObservationsSuccess: (
+ observations: ReplayObservationApi[],
+ total: number
+ ) => {
+ observations: ReplayObservationApi[]
+ total: number
+ }
+ loadScanner: () => {
+ value: true
+ }
+ loadScannerEstimate: () => {
+ value: true
+ }
+ loadScannerEstimateFailure: (error?: string | null) => {
+ error: string | null
+ }
+ loadScannerEstimateSuccess: (estimate: EstimateResponseApi) => {
+ estimate: EstimateResponseApi
+ }
+ loadScannerFailure: () => {
+ value: true
+ }
+ loadScannerSuccess: (scanner: ReplayScanner) => {
+ scanner: ReplayScanner
+ }
+ loadTagSuggestions: () => any
+ loadTagSuggestionsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTagSuggestionsSuccess: (
+ tagSuggestions: TagSuggestionApi[],
+ payload?: any
+ ) => {
+ tagSuggestions: TagSuggestionApi[]
+ payload?: any
+ }
+ refreshObservations: () => {
+ value: true
+ }
+ requestScannerEstimate: () => {
+ value: true
+ }
+ resetScanner: (values?: ReplayScanner) => {
+ values?: ReplayScanner
+ }
+ restoreObservationsTableState: (state: {
+ page: number
+ sort: ObservationsSorting | null
+ status: ObservationStatusValue[]
+ subject: string
+ tags: string[]
+ triggeredBy: ObservationTriggeredByValue[]
+ verdict: ObservationVerdictValue[]
+ }) => {
+ page: number
+ sort: ObservationsSorting | null
+ status: ObservationStatusEnumApi[]
+ subject: string
+ tags: string[]
+ triggeredBy: ObservationTriggerEnumApi[]
+ verdict: ObservationVerdictValue[]
+ }
+ retryObservation: (observationId: string) => {
+ observationId: string
+ }
+ retryObservationFailure: (observationId: string) => {
+ observationId: string
+ }
+ retryObservationSuccess: (observationId: string) => {
+ observationId: string
+ }
+ scannerSaved: (scanner: ReplayScanner) => {
+ scanner: ReplayScanner
+ }
+ setChartDateRange: (
+ dateFrom: string | null,
+ dateTo: string | null
+ ) => {
+ dateFrom: string | null
+ dateTo: string | null
+ }
+ setObservationStatusFilter: (values: ObservationStatusValue[]) => {
+ values: ObservationStatusEnumApi[]
+ }
+ setObservationSubjectFilter: (value: string) => {
+ value: string
+ }
+ setObservationTagFilter: (values: string[]) => {
+ values: string[]
+ }
+ setObservationTriggeredByFilter: (values: ObservationTriggeredByValue[]) => {
+ values: ObservationTriggerEnumApi[]
+ }
+ setObservationVerdictFilter: (values: ObservationVerdictValue[]) => {
+ values: ObservationVerdictValue[]
+ }
+ setObservationsPage: (page: number) => {
+ page: number
+ }
+ setObservationsSort: (sorting: ObservationsSorting | null) => {
+ sorting: ObservationsSorting | null
+ }
+ setScannerManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setScannerType: (scannerType: ScannerType) => {
+ scannerType: ScannerTypeEnumApi
+ }
+ setScannerValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setScannerValues: (values: DeepPartial<ReplayScanner>) => {
+ values: DeepPartial<ReplayScanner>
+ }
+ setSubmitIntent: (intent: 'advance' | 'save') => {
+ intent: 'advance' | 'save'
+ }
+ submitScanner: () => {
+ value: boolean
+ }
+ submitScannerFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitScannerRequest: (scanner: ReplayScanner) => {
+ scanner: ReplayScanner
+ }
+ submitScannerSuccess: (scanner: ReplayScanner) => {
+ scanner: ReplayScanner
+ }
+ toggleEnabled: () => {
+ value: true
+ }
+ toggleEnabledFailure: () => {
+ value: true
+ }
+ toggleEnabledSuccess: (enabled: boolean) => {
+ enabled: boolean
+ }
+ touchScannerField: (key: string) => {
+ key: string
+ }
+ triggerOnDemandObservation: (
+ sessionId: string,
+ silent?: any
+ ) => {
+ sessionId: string
+ silent: any
+ }
+ triggerOnDemandObservationFailure: () => {
+ value: true
+ }
+ triggerOnDemandObservationSuccess: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayScannerLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ isNew: (id: string) => boolean
+ durationValidationError: (scanner: ReplayScanner) => string | null
+ hasUnsavedChanges: (scanner: ReplayScanner, originalScanner: ReplayScanner | null) => boolean
+ hasObservationsInFlight: (observationStatsApi: ObservationStatsApi | null) => boolean
+ hasActiveObservationFilters: (
+ observationStatusFilter: ObservationStatusEnumApi[],
+ observationTriggeredByFilter: ObservationTriggerEnumApi[],
+ observationVerdictFilter: ObservationVerdictValue[],
+ observationTagFilter: string[],
+ observationSubjectFilter: string
+ ) => boolean
+ observationDetailLinkParams: (
+ observationStatusFilter: ObservationStatusEnumApi[],
+ observationTriggeredByFilter: ObservationTriggerEnumApi[],
+ observationVerdictFilter: ObservationVerdictValue[],
+ observationTagFilter: string[],
+ observationSubjectFilter: string,
+ observationsSort: ObservationsSorting | null,
+ scanner: ReplayScanner
+ ) => Record<string, string>
+ availableTags: (observationStatsApi: ObservationStatsApi | null) => string[]
+ observationStats: (observationStatsApi: ObservationStatsApi | null) => {
+ failed: number
+ ineligible: number
+ inFlight: number
+ succeeded: number
+ successRate: number | null
+ total: number
+ }
+ monitorStats: (observationStatsApi: ObservationStatsApi | null) => {
+ inconclusiveTotal: number
+ noTotal: number
+ yesTotal: number
+ }
+ classifierTagStats: (observationStatsApi: ObservationStatsApi | null) => {
+ fixedRanked: [string, number][]
+ freeformRanked: [string, number][]
+ totalWithTags: number
+ }
+ scorerSummary: (observationStatsApi: ObservationStatsApi | null) => {
+ count: number
+ max: number
+ mean: number
+ median: number
+ min: number
+ p25: number
+ p75: number
+ } | null
+ scorerHistogram: (observationStatsApi: ObservationStatsApi | null) => {
+ counts: number[]
+ labels: string[]
+ } | null
+ coverageStats: (observationStatsApi: ObservationStatsApi | null) => {
+ recentDays: number
+ recentSessions: number
+ totalSessions: number
+ }
+ }
+}
+
+export type replayScannerLogicType = MakeLogicType<
+ replayScannerLogicValues,
+ replayScannerLogicActions,
+ ReplayScannerLogicProps,
+ replayScannerLogicMeta
+>
+
export const replayScannerLogic = kea<replayScannerLogicType>([
path(['products', 'replay_vision', 'frontend', 'replay_scanners', 'replayScannerLogic']),
props({} as ReplayScannerLogicProps),
diff --git a/products/replay_vision/frontend/replay_scanners/replayScannerSceneLogic.ts b/products/replay_vision/frontend/replay_scanners/replayScannerSceneLogic.ts
index 7bb625cb00a2..8ed346a9f48f 100644
--- a/products/replay_vision/frontend/replay_scanners/replayScannerSceneLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/replayScannerSceneLogic.ts
@@ -1,12 +1,10 @@
-import { actions, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers, selectors } from 'kea'
import { actionToUrl, router, urlToAction } from 'kea-router'
import { urls } from 'scenes/urls'
import { Breadcrumb } from '~/types'
-import type { replayScannerSceneLogicType } from './replayScannerSceneLogicType'
-
export enum ReplayScannerTab {
Observations = 'observations',
Quality = 'quality',
@@ -22,6 +20,37 @@ function parseTab(tab: unknown): ReplayScannerTab {
return SCANNER_TABS.includes(tab as ReplayScannerTab) ? (tab as ReplayScannerTab) : DEFAULT_TAB
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayScannerSceneLogicValues {
+ activeTab: ReplayScannerTab
+ breadcrumbs: Breadcrumb[]
+ scannerId: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayScannerSceneLogicActions {
+ setActiveTab: (tab: ReplayScannerTab) => {
+ tab: ReplayScannerTab
+ }
+ setScannerId: (scannerId: string) => {
+ scannerId: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayScannerSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ breadcrumbs: (scannerId: string) => Breadcrumb[]
+ }
+}
+
+export type replayScannerSceneLogicType = MakeLogicType<
+ replayScannerSceneLogicValues,
+ replayScannerSceneLogicActions,
+ Record<string, any>,
+ replayScannerSceneLogicMeta
+>
+
export const replayScannerSceneLogic = kea<replayScannerSceneLogicType>([
path(['products', 'replay_vision', 'frontend', 'replay_scanners', 'replayScannerSceneLogic']),
diff --git a/products/replay_vision/frontend/replay_scanners/replayScannersLogic.ts b/products/replay_vision/frontend/replay_scanners/replayScannersLogic.ts
index d9c59cf6a53f..af0ae18a63f9 100644
--- a/products/replay_vision/frontend/replay_scanners/replayScannersLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/replayScannersLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, isBreakpoint, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, isBreakpoint, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { router, urlToAction } from 'kea-router'
@@ -16,9 +16,9 @@ import {
visionScannersStatsRetrieve,
} from '../generated/api'
import type { ScannerStatsResponseApi, UserBasicApi, VisionScannersListParams } from '../generated/api.schemas'
+import type { ScannerTypeEnumApi } from '../generated/api.schemas'
import { refreshVisionQuota, visionQuotaLogic } from '../logics/visionQuotaLogic'
import { csvParam, parseCsvParam, parseSortParam, serializeSortParam } from '../utils/urlParams'
-import type { replayScannersLogicType } from './replayScannersLogicType'
import {
ENABLED_OPTIONS,
EnabledFilter,
@@ -116,6 +116,163 @@ export function buildScannerListParams(
return params
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayScannersLogicValues {
+ chartDateFrom: string | null
+ chartDateTo: string | null
+ createdByFilter: string[]
+ createdByOptions: {
+ label: string
+ value: string
+ }[]
+ creators: UserBasicApi[]
+ creatorsLoading: boolean
+ deletingIds: string[]
+ enabledFilter: EnabledFilter[]
+ filters: ScannersFilters
+ hasActiveFilters: boolean
+ scannerStats: ScannerStatsResponseApi | null
+ scannerStatsLoading: boolean
+ scannerTypeFilter: ScannerTypeEnumApi[]
+ scanners: ReplayScanner[]
+ scannersLoading: boolean
+ scannersPage: number
+ scannersSort: ScannersSorting | null
+ scannersTotal: number
+ search: string
+ togglingIds: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayScannersLogicActions {
+ clearFilters: () => {
+ value: true
+ }
+ deleteScanner: (id: string) => {
+ id: string
+ }
+ deleteScannerSuccess: (id: string) => {
+ id: string
+ }
+ loadCreators: () => {
+ value: true
+ }
+ loadCreatorsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadCreatorsSuccess: (
+ creators: UserBasicApi[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ creators: UserBasicApi[]
+ payload?: {
+ value: true
+ }
+ }
+ loadScannerStats: () => {
+ value: true
+ }
+ loadScannerStatsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadScannerStatsSuccess: (
+ scannerStats: ScannerStatsResponseApi | null,
+ payload?: {
+ value: true
+ }
+ ) => {
+ scannerStats: ScannerStatsResponseApi | null
+ payload?: {
+ value: true
+ }
+ }
+ loadScanners: () => {
+ value: true
+ }
+ loadScannersFailure: (error: string) => {
+ error: string
+ }
+ loadScannersSuccess: (
+ scanners: ReplayScanner[],
+ total: number
+ ) => {
+ scanners: ReplayScanner[]
+ total: number
+ }
+ revertScannerEnabled: (id: string) => {
+ id: string
+ }
+ setChartDateRange: (
+ dateFrom: string | null,
+ dateTo: string | null
+ ) => {
+ dateFrom: string | null
+ dateTo: string | null
+ }
+ setScannerDeleting: (
+ id: string,
+ deleting: boolean
+ ) => {
+ deleting: boolean
+ id: string
+ }
+ setScannersFilters: (
+ filters: Partial<ScannersFilters>,
+ replace?: boolean
+ ) => {
+ filters: Partial<ScannersFilters>
+ replace: boolean
+ }
+ toggleScannerEnabled: (id: string) => {
+ id: string
+ }
+ toggleScannerEnabledDone: (id: string) => {
+ id: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface replayScannersLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ search: (filters: ScannersFilters) => string
+ enabledFilter: (filters: ScannersFilters) => EnabledFilter[]
+ scannerTypeFilter: (filters: ScannersFilters) => ScannerTypeEnumApi[]
+ createdByFilter: (filters: ScannersFilters) => string[]
+ scannersPage: (filters: ScannersFilters) => number
+ scannersSort: (filters: ScannersFilters) => ScannersSorting | null
+ hasActiveFilters: (
+ search: string,
+ enabledFilter: EnabledFilter[],
+ scannerTypeFilter: ScannerTypeEnumApi[],
+ createdByFilter: string[]
+ ) => boolean
+ createdByOptions: (
+ creators: UserBasicApi[],
+ createdByFilter: string[]
+ ) => {
+ label: string
+ value: string
+ }[]
+ }
+}
+
+export type replayScannersLogicType = MakeLogicType<
+ replayScannersLogicValues,
+ replayScannersLogicActions,
+ Record<string, any>,
+ replayScannersLogicMeta
+>
+
export const replayScannersLogic = kea<replayScannersLogicType>([
path(['products', 'replay_vision', 'frontend', 'replay_scanners', 'replayScannersLogic']),
diff --git a/products/replay_vision/frontend/replay_scanners/scannerDigestLogic.ts b/products/replay_vision/frontend/replay_scanners/scannerDigestLogic.ts
index 5cf3c633d8c6..95bf346d74f1 100644
--- a/products/replay_vision/frontend/replay_scanners/scannerDigestLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/scannerDigestLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { teamLogic } from 'scenes/teamLogic'
@@ -6,7 +6,6 @@ import { teamLogic } from 'scenes/teamLogic'
import { visionActionsCreate, visionActionsRunsList, visionActionsRunsRetrieve } from '../generated/api'
import { VisionActionRunStatusEnumApi } from '../generated/api.schemas'
import type { VisionActionApi, VisionActionRunApi } from '../generated/api.schemas'
-import type { scannerDigestLogicType } from './scannerDigestLogicType'
import { visionActionsLogic } from './visionActionsLogic'
export interface ScannerDigestLogicProps {
@@ -20,6 +19,69 @@ export const SCANNER_DIGEST_RRULE = 'FREQ=DAILY;BYHOUR=8;BYMINUTE=0'
// How many recent runs to scan for the newest completed one (skipped/failed runs don't carry a summary).
const RUN_LOOKBACK = 10
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface scannerDigestLogicValues {
+ visionActions: VisionActionApi[] // visionActionsLogic
+ visionActionsLoading: boolean // visionActionsLogic
+ digest: VisionActionApi | null
+ digestCreating: boolean
+ expanded: boolean
+ latestRun: VisionActionRunApi | null
+ latestRunLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface scannerDigestLogicActions {
+ addAction: (action: VisionActionApi) => {
+ action: VisionActionApi
+ } // visionActionsLogic
+ loadActions: () => {
+ value: true
+ } // visionActionsLogic
+ loadActionsSuccess: (visionActions: VisionActionApi[]) => {
+ visionActions: VisionActionApi[]
+ } // visionActionsLogic
+ toggleActionEnabled: (id: string) => {
+ id: string
+ } // visionActionsLogic
+ createDigest: () => {
+ value: true
+ }
+ createDigestFailure: () => {
+ value: true
+ }
+ createDigestSuccess: () => {
+ value: true
+ }
+ loadLatestRun: () => {
+ value: true
+ }
+ loadLatestRunFailure: () => {
+ value: true
+ }
+ loadLatestRunSuccess: (run: VisionActionRunApi | null) => {
+ run: VisionActionRunApi | null
+ }
+ toggleExpanded: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface scannerDigestLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ digest: (visionActions: VisionActionApi[]) => VisionActionApi | null
+ }
+}
+
+export type scannerDigestLogicType = MakeLogicType<
+ scannerDigestLogicValues,
+ scannerDigestLogicActions,
+ ScannerDigestLogicProps,
+ scannerDigestLogicMeta
+>
+
export const scannerDigestLogic = kea<scannerDigestLogicType>([
path(['products', 'replay_vision', 'frontend', 'replay_scanners', 'scannerDigestLogic']),
props({} as ScannerDigestLogicProps),
diff --git a/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts b/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts
index 7ba46759b3c4..65bd8465d6c3 100644
--- a/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts
@@ -1,12 +1,10 @@
-import { actions, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers, selectors } from 'kea'
import { router, urlToAction } from 'kea-router'
import { urls } from 'scenes/urls'
import { Breadcrumb } from '~/types'
-import type { scannerEditorSceneLogicType } from './scannerEditorSceneLogicType'
-
export type ScannerEditorStep = 'template' | 'configure' | 'triggers' | 'self_driving'
export const SCANNER_EDITOR_STEPS: readonly ScannerEditorStep[] = ['template', 'configure', 'triggers', 'self_driving']
export const SCANNER_EDITOR_STEP_ORDER: Record<ScannerEditorStep, number> = {
@@ -29,6 +27,41 @@ export function scannerStepUrl(step: ScannerEditorStep, scannerId: string): stri
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface scannerEditorSceneLogicValues {
+ breadcrumbs: Breadcrumb[]
+ isNew: boolean
+ scannerId: string
+ step: ScannerEditorStep
+ visibleSteps: readonly ScannerEditorStep[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface scannerEditorSceneLogicActions {
+ setScannerId: (scannerId: string) => {
+ scannerId: string
+ }
+ setStep: (step: ScannerEditorStep) => {
+ step: ScannerEditorStep
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface scannerEditorSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ isNew: (scannerId: string) => boolean
+ visibleSteps: (isNew: boolean) => readonly ScannerEditorStep[]
+ breadcrumbs: (scannerId: string, isNew: boolean) => Breadcrumb[]
+ }
+}
+
+export type scannerEditorSceneLogicType = MakeLogicType<
+ scannerEditorSceneLogicValues,
+ scannerEditorSceneLogicActions,
+ Record<string, any>,
+ scannerEditorSceneLogicMeta
+>
+
export const scannerEditorSceneLogic = kea<scannerEditorSceneLogicType>([
path(['products', 'replay_vision', 'frontend', 'replay_scanners', 'scannerEditorSceneLogic']),
diff --git a/products/replay_vision/frontend/replay_scanners/scannerQualityLogic.ts b/products/replay_vision/frontend/replay_scanners/scannerQualityLogic.ts
index 5eff05f1c42a..5977ba5a1424 100644
--- a/products/replay_vision/frontend/replay_scanners/scannerQualityLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/scannerQualityLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { teamLogic } from 'scenes/teamLogic'
@@ -24,7 +24,6 @@ import type {
} from '../generated/api.schemas'
import { visionQuotaLogic } from '../logics/visionQuotaLogic'
import { ObservationsSorting, replayScannerLogic, resolveOrderByKey } from './replayScannerLogic'
-import type { scannerQualityLogicType } from './scannerQualityLogicType'
export type RatedFilterValue = 'all' | 'unrated' | 'rated'
@@ -38,6 +37,156 @@ export interface ScannerQualityLogicProps {
scannerId: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface scannerQualityLogicValues {
+ applying: boolean
+ currentSuggestion: ReplayScannerPromptSuggestionApi | null
+ dismissing: boolean
+ evaluating: boolean
+ evaluationSessionCap: number
+ generating: boolean
+ labelStats: ObservationLabelStatsApi | null
+ labelStatsLoading: boolean
+ observations: ReplayObservationApi[]
+ observationsLoading: boolean
+ page: number
+ plannedTestSessions: number
+ ratedCount: number
+ ratedFilter: RatedFilterValue
+ sort: ObservationsSorting | null
+ suggestionHistory: ReplayScannerPromptSuggestionApi[]
+ suggestionHistoryLoading: boolean
+ suggestionLoading: boolean
+ suggestionStale: boolean
+ testSessionLimit: number | null
+ themeFilter: FeedbackThemeApi | null
+ total: number
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface scannerQualityLogicActions {
+ loadQuota: () => {
+ value: true
+ } // visionQuotaLogic
+ applySuggestion: (suggestionId: string) => {
+ suggestionId: string
+ }
+ applySuggestionFailure: () => {
+ value: true
+ }
+ applySuggestionSuccess: (suggestion: ReplayScannerPromptSuggestionApi) => {
+ suggestion: ReplayScannerPromptSuggestionApi
+ }
+ dismissSuggestion: (suggestionId: string) => {
+ suggestionId: string
+ }
+ dismissSuggestionFailure: () => {
+ value: true
+ }
+ dismissSuggestionSuccess: (suggestion: ReplayScannerPromptSuggestionApi) => {
+ suggestion: ReplayScannerPromptSuggestionApi
+ }
+ evaluateSuggestion: (suggestionId: string) => {
+ suggestionId: string
+ }
+ evaluateSuggestionFailure: () => {
+ value: true
+ }
+ evaluateSuggestionSuccess: (suggestion: ReplayScannerPromptSuggestionApi) => {
+ suggestion: ReplayScannerPromptSuggestionApi
+ }
+ generateSuggestion: () => {
+ value: true
+ }
+ generateSuggestionFailure: () => {
+ value: true
+ }
+ generateSuggestionSuccess: (suggestion: ReplayScannerPromptSuggestionApi) => {
+ suggestion: ReplayScannerPromptSuggestionApi
+ }
+ labelChanged: (
+ observationId: string,
+ label: ReplayObservationLabelApi | null
+ ) => {
+ label: ReplayObservationLabelApi | null
+ observationId: string
+ }
+ loadCurrentSuggestion: () => {
+ value: true
+ }
+ loadCurrentSuggestionFailure: () => {
+ value: true
+ }
+ loadCurrentSuggestionSuccess: (current: CurrentPromptSuggestionApi) => {
+ current: CurrentPromptSuggestionApi
+ }
+ loadLabelStats: () => {
+ value: true
+ }
+ loadLabelStatsFailure: () => {
+ value: true
+ }
+ loadLabelStatsSuccess: (stats: ObservationLabelStatsApi) => {
+ stats: ObservationLabelStatsApi
+ }
+ loadObservations: () => {
+ value: true
+ }
+ loadObservationsFailure: () => {
+ value: true
+ }
+ loadObservationsSuccess: (
+ observations: ReplayObservationApi[],
+ total: number
+ ) => {
+ observations: ReplayObservationApi[]
+ total: number
+ }
+ loadSuggestionHistory: () => {
+ value: true
+ }
+ loadSuggestionHistoryFailure: () => {
+ value: true
+ }
+ loadSuggestionHistorySuccess: (history: ReplayScannerPromptSuggestionApi[]) => {
+ history: ReplayScannerPromptSuggestionApi[]
+ }
+ setPage: (page: number) => {
+ page: number
+ }
+ setRatedFilter: (value: RatedFilterValue) => {
+ value: RatedFilterValue
+ }
+ setSort: (sorting: ObservationsSorting | null) => {
+ sorting: ObservationsSorting | null
+ }
+ setTestSessionLimit: (limit: number | null) => {
+ limit: number | null
+ }
+ setThemeFilter: (theme: FeedbackThemeApi | null) => {
+ theme: FeedbackThemeApi | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface scannerQualityLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ plannedTestSessions: (
+ evaluationSessionCap: number,
+ ratedCount: number,
+ testSessionLimit: number | null
+ ) => number
+ }
+}
+
+export type scannerQualityLogicType = MakeLogicType<
+ scannerQualityLogicValues,
+ scannerQualityLogicActions,
+ ScannerQualityLogicProps,
+ scannerQualityLogicMeta
+>
+
/** State for the Quality tab: the prompt recommendation, observations to rate, and rated-over-time aggregates. */
export const scannerQualityLogic = kea<scannerQualityLogicType>([
path(['products', 'replay_vision', 'frontend', 'replay_scanners', 'scannerQualityLogic']),
diff --git a/products/replay_vision/frontend/replay_scanners/scannerRunTabLogic.ts b/products/replay_vision/frontend/replay_scanners/scannerRunTabLogic.ts
index d948d517cd1f..2cbea44ad987 100644
--- a/products/replay_vision/frontend/replay_scanners/scannerRunTabLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/scannerRunTabLogic.ts
@@ -1,4 +1,16 @@
-import { actions, connect, isBreakpoint, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ connect,
+ isBreakpoint,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ reducers,
+ selectors,
+} from 'kea'
import { teamLogic } from 'scenes/teamLogic'
@@ -6,7 +18,6 @@ import { visionScannersObservationsList } from '../generated/api'
import type { ReplayObservationApi } from '../generated/api.schemas'
import { scheduleObservationPoll } from '../logics/observationPolling'
import { replayScannerLogic } from './replayScannerLogic'
-import type { scannerRunTabLogicType } from './scannerRunTabLogicType'
export interface RowObservation {
id: string
@@ -19,6 +30,70 @@ export interface ScannerRunTabLogicProps {
scannerId: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface scannerRunTabLogicValues {
+ triggeringOnDemandObservation: boolean // replayScannerLogic
+ observationBySession: Record<string, RowObservation>
+ pendingId: string | null
+ refreshingObservations: boolean
+ shouldPoll: boolean
+ visibleSessionIds: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface scannerRunTabLogicActions {
+ triggerOnDemandObservation: (
+ sessionId: string,
+ silent?: any
+ ) => {
+ sessionId: string
+ silent: any
+ } // replayScannerLogic
+ triggerOnDemandObservationFailure: () => {
+ value: true
+ } // replayScannerLogic
+ triggerOnDemandObservationSuccess: () => {
+ value: true
+ } // replayScannerLogic
+ loadObservations: (background?: any) => {
+ background: any
+ }
+ loadObservationsFailure: () => {
+ value: true
+ }
+ loadObservationsSuccess: (bySession: Record<string, RowObservation>) => {
+ bySession: Record<string, RowObservation>
+ }
+ setPendingId: (sessionId: string) => {
+ sessionId: string
+ }
+ setVisibleSessionIds: (sessionIds: string[]) => {
+ sessionIds: string[]
+ }
+ startScan: (sessionId: string) => {
+ sessionId: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface scannerRunTabLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ shouldPoll: (
+ visibleSessionIds: string[],
+ observationBySession: Record<string, RowObservation>,
+ pendingId: string | null
+ ) => boolean
+ }
+}
+
+export type scannerRunTabLogicType = MakeLogicType<
+ scannerRunTabLogicValues,
+ scannerRunTabLogicActions,
+ ScannerRunTabLogicProps,
+ scannerRunTabLogicMeta
+>
+
/** Backs the on-demand recordings list: per-session observation lookup, scan bridging, and result polling. */
export const scannerRunTabLogic = kea<scannerRunTabLogicType>([
path(['products', 'replay_vision', 'frontend', 'replay_scanners', 'scannerRunTabLogic']),
diff --git a/products/replay_vision/frontend/replay_scanners/visionActionRunSceneLogic.ts b/products/replay_vision/frontend/replay_scanners/visionActionRunSceneLogic.ts
index 3b7d6e347efe..6fda5ae954d5 100644
--- a/products/replay_vision/frontend/replay_scanners/visionActionRunSceneLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/visionActionRunSceneLogic.ts
@@ -1,4 +1,4 @@
-import { actions, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, listeners, path, reducers, selectors } from 'kea'
import { urlToAction } from 'kea-router'
import { dayjs } from 'lib/dayjs'
@@ -10,7 +10,6 @@ import { Breadcrumb } from '~/types'
import { visionActionsRetrieve, visionActionsRunsRetrieve } from '../generated/api'
import type { RunObservationApi, VisionActionApi, VisionActionRunApi } from '../generated/api.schemas'
-import type { visionActionRunSceneLogicType } from './visionActionRunSceneLogicType'
/**
* Resolve the `[obs N]` citation markers the synthesizer leaves in a group summary into `[N]` links to
@@ -25,6 +24,66 @@ export function resolveObservationCitations(markdown: string, observations: read
})
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visionActionRunSceneLogicValues {
+ action: VisionActionApi | null
+ actionId: string
+ breadcrumbs: Breadcrumb[]
+ run: VisionActionRunApi | null
+ runId: string
+ runLoading: boolean
+ summaryMarkdown: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visionActionRunSceneLogicActions {
+ loadAction: () => {
+ value: true
+ }
+ loadActionFailure: () => {
+ value: true
+ }
+ loadActionSuccess: (action: VisionActionApi) => {
+ action: VisionActionApi
+ }
+ loadRun: () => {
+ value: true
+ }
+ loadRunFailure: () => {
+ value: true
+ }
+ loadRunSuccess: (run: VisionActionRunApi) => {
+ run: VisionActionRunApi
+ }
+ setIds: (
+ actionId: string,
+ runId: string
+ ) => {
+ actionId: string
+ runId: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visionActionRunSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ summaryMarkdown: (run: VisionActionRunApi | null) => string
+ breadcrumbs: (
+ actionId: string,
+ runId: string,
+ action: VisionActionApi | null,
+ run: VisionActionRunApi | null
+ ) => Breadcrumb[]
+ }
+}
+
+export type visionActionRunSceneLogicType = MakeLogicType<
+ visionActionRunSceneLogicValues,
+ visionActionRunSceneLogicActions,
+ Record<string, any>,
+ visionActionRunSceneLogicMeta
+>
+
export const visionActionRunSceneLogic = kea<visionActionRunSceneLogicType>([
path(['products', 'replay_vision', 'frontend', 'replay_scanners', 'visionActionRunSceneLogic']),
diff --git a/products/replay_vision/frontend/replay_scanners/visionActionRunsLogic.ts b/products/replay_vision/frontend/replay_scanners/visionActionRunsLogic.ts
index 574ad53a419e..6e6cf3db510b 100644
--- a/products/replay_vision/frontend/replay_scanners/visionActionRunsLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/visionActionRunsLogic.ts
@@ -1,17 +1,63 @@
-import { actions, afterMount, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, afterMount, kea, key, listeners, path, props, reducers } from 'kea'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { teamLogic } from 'scenes/teamLogic'
import { visionActionsRetrieve, visionActionsRunsList } from '../generated/api'
import type { VisionActionApi, VisionActionRunListApi } from '../generated/api.schemas'
-import type { visionActionRunsLogicType } from './visionActionRunsLogicType'
import { visionActionSceneLogic } from './visionActionSceneLogic'
export interface VisionActionRunsLogicProps {
actionId: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visionActionRunsLogicValues {
+ action: VisionActionApi | null
+ actionLoading: boolean
+ runs: VisionActionRunListApi[]
+ runsCount: number
+ runsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visionActionRunsLogicActions {
+ loadAction: () => {
+ value: true
+ }
+ loadActionFailure: () => {
+ value: true
+ }
+ loadActionSuccess: (action: VisionActionApi) => {
+ action: VisionActionApi
+ }
+ loadRuns: () => {
+ value: true
+ }
+ loadRunsFailure: () => {
+ value: true
+ }
+ loadRunsSuccess: (
+ runs: VisionActionRunListApi[],
+ count: number
+ ) => {
+ count: number
+ runs: VisionActionRunListApi[]
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visionActionRunsLogicMeta {
+ key: string
+}
+
+export type visionActionRunsLogicType = MakeLogicType<
+ visionActionRunsLogicValues,
+ visionActionRunsLogicActions,
+ VisionActionRunsLogicProps,
+ visionActionRunsLogicMeta
+>
+
export const visionActionRunsLogic = kea<visionActionRunsLogicType>([
path(['products', 'replay_vision', 'frontend', 'replay_scanners', 'visionActionRunsLogic']),
props({} as VisionActionRunsLogicProps),
diff --git a/products/replay_vision/frontend/replay_scanners/visionActionSceneLogic.ts b/products/replay_vision/frontend/replay_scanners/visionActionSceneLogic.ts
index 7edb72561b38..9f9368247917 100644
--- a/products/replay_vision/frontend/replay_scanners/visionActionSceneLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/visionActionSceneLogic.ts
@@ -1,11 +1,53 @@
-import { actions, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers, selectors } from 'kea'
import { urlToAction } from 'kea-router'
import { urls } from 'scenes/urls'
import { Breadcrumb } from '~/types'
-import type { visionActionSceneLogicType } from './visionActionSceneLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visionActionSceneLogicValues {
+ actionContext: {
+ name: string | null
+ scannerId: string | null
+ }
+ actionId: string
+ breadcrumbs: Breadcrumb[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visionActionSceneLogicActions {
+ setActionContext: (
+ name: string | null,
+ scannerId: string | null
+ ) => {
+ name: string | null
+ scannerId: string | null
+ }
+ setActionId: (actionId: string) => {
+ actionId: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visionActionSceneLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ breadcrumbs: (
+ actionId: string,
+ actionContext: {
+ name: string | null
+ scannerId: string | null
+ }
+ ) => Breadcrumb[]
+ }
+}
+
+export type visionActionSceneLogicType = MakeLogicType<
+ visionActionSceneLogicValues,
+ visionActionSceneLogicActions,
+ Record<string, any>,
+ visionActionSceneLogicMeta
+>
export const visionActionSceneLogic = kea<visionActionSceneLogicType>([
path(['products', 'replay_vision', 'frontend', 'replay_scanners', 'visionActionSceneLogic']),
diff --git a/products/replay_vision/frontend/replay_scanners/visionActionsLogic.ts b/products/replay_vision/frontend/replay_scanners/visionActionsLogic.ts
index b3f676294d12..d83d1332ac87 100644
--- a/products/replay_vision/frontend/replay_scanners/visionActionsLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/visionActionsLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, afterMount, kea, key, listeners, path, props, reducers } from 'kea'
import { dayjs } from 'lib/dayjs'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
@@ -20,7 +20,6 @@ import {
} from '../generated/api.schemas'
import type { VerdictEnumApi, VisionActionApi } from '../generated/api.schemas'
import { CadenceState, cadenceToRrule, DEFAULT_CADENCE } from './cadence'
-import type { visionActionsLogicType } from './visionActionsLogicType'
export interface VisionActionsLogicProps {
scannerId: string
@@ -128,6 +127,56 @@ export function buildActionBody(form: VisionActionForm, scannerId: string): Para
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visionActionsLogicValues {
+ togglingIds: string[]
+ visionActions: VisionActionApi[]
+ visionActionsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visionActionsLogicActions {
+ addAction: (action: VisionActionApi) => {
+ action: VisionActionApi
+ }
+ deleteAction: (id: string) => {
+ id: string
+ }
+ deleteActionSuccess: (id: string) => {
+ id: string
+ }
+ loadActions: () => {
+ value: true
+ }
+ loadActionsFailure: () => {
+ value: true
+ }
+ loadActionsSuccess: (visionActions: VisionActionApi[]) => {
+ visionActions: VisionActionApi[]
+ }
+ revertActionEnabled: (id: string) => {
+ id: string
+ }
+ toggleActionEnabled: (id: string) => {
+ id: string
+ }
+ toggleActionEnabledDone: (id: string) => {
+ id: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface visionActionsLogicMeta {
+ key: string
+}
+
+export type visionActionsLogicType = MakeLogicType<
+ visionActionsLogicValues,
+ visionActionsLogicActions,
+ VisionActionsLogicProps,
+ visionActionsLogicMeta
+>
+
export const visionActionsLogic = kea<visionActionsLogicType>([
path(['products', 'replay_vision', 'frontend', 'replay_scanners', 'visionActionsLogic']),
props({} as VisionActionsLogicProps),
diff --git a/products/tracing/frontend/components/FacetRail/facetCountsLogic.ts b/products/tracing/frontend/components/FacetRail/facetCountsLogic.ts
index bd3c61a74381..347799a137d3 100644
--- a/products/tracing/frontend/components/FacetRail/facetCountsLogic.ts
+++ b/products/tracing/frontend/components/FacetRail/facetCountsLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { subscriptions } from 'kea-subscriptions'
@@ -21,7 +21,6 @@ import {
SpanPropertyTypeEnumApi,
TracingSpansAttributesRetrieveAttributeType,
} from '../../generated/api.schemas'
-import type { facetCountsLogicType } from './facetCountsLogicType'
import { FACETS, FacetConfig, innerFilters } from './facets'
export interface FacetCountsLogicProps {
@@ -35,6 +34,116 @@ export interface BreakdownScope {
queryFilterGroup: UniversalFiltersGroup
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface facetCountsLogicValues {
+ currentTeamId: number | null // teamLogic
+ queryFilterGroup: UniversalFiltersGroup // tracingFiltersLogic
+ serviceNames: string[] // tracingFiltersLogic
+ utcDateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ } // tracingFiltersLogic
+ breakdownScope: BreakdownScope
+ erroredFacetKeys: string[]
+ facetSearch: Record<string, string>
+ facetValues: Record<string, _TracingAttributeBreakdownRowApi[]>
+ facetValuesLoading: boolean
+ loadingFacetKeys: string[]
+ loadingReloadKeys: string[]
+ loadingSearchKey: string | null
+ presenceLoaded: boolean
+ presentResourceKeys: string[]
+ presentResourceKeysLoading: boolean
+ visibleFacets: FacetConfig[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface facetCountsLogicActions {
+ loadFacetValues: (facetKeys: string[] | null) => string[] | null
+ loadFacetValuesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFacetValuesForKey: (facetKey: string) => string
+ loadFacetValuesForKeyFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFacetValuesForKeySuccess: (
+ facetValues: Record<string, _TracingAttributeBreakdownRowApi[]>,
+ payload?: string
+ ) => {
+ facetValues: Record<string, _TracingAttributeBreakdownRowApi[]>
+ payload?: string
+ }
+ loadFacetValuesSuccess: (
+ facetValues: Record<string, _TracingAttributeBreakdownRowApi[]>,
+ payload?: string[] | null
+ ) => {
+ facetValues: Record<string, _TracingAttributeBreakdownRowApi[]>
+ payload?: string[] | null
+ }
+ loadPresentResourceKeys: () => any
+ loadPresentResourceKeysFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadPresentResourceKeysSuccess: (
+ presentResourceKeys: string[],
+ payload?: any
+ ) => {
+ presentResourceKeys: string[]
+ payload?: any
+ }
+ setFacetFetchErrors: (
+ attempted: string[],
+ failed: string[]
+ ) => {
+ attempted: string[]
+ failed: string[]
+ }
+ setFacetSearch: (
+ facetKey: string,
+ search: string
+ ) => {
+ facetKey: string
+ search: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface facetCountsLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ visibleFacets: (presentResourceKeys: string[]) => FacetConfig[]
+ loadingFacetKeys: (loadingReloadKeys: string[], loadingSearchKey: string | null) => string[]
+ breakdownScope: (
+ utcDateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ },
+ serviceNames: string[],
+ queryFilterGroup: UniversalFiltersGroup
+ ) => BreakdownScope
+ }
+}
+
+export type facetCountsLogicType = MakeLogicType<
+ facetCountsLogicValues,
+ facetCountsLogicActions,
+ FacetCountsLogicProps,
+ facetCountsLogicMeta
+>
+
/**
* Per-facet values + counts, cross-filtered server-side: each facet's results reflect every active
* filter except its own selection (excludeBreakdownFilter drops the facet's own column, serviceNames,
@@ -229,7 +338,7 @@ export const facetCountsLogic = kea<facetCountsLogicType>([
// Column facets always render; resource-attribute facets only when the tenant emits the key.
visibleFacets: [
(s) => [s.presentResourceKeys],
- (presentResourceKeys): FacetConfig[] =>
+ (presentResourceKeys: string[]): FacetConfig[] =>
FACETS.filter((f) => f.source.type === 'column' || presentResourceKeys.includes(f.source.key)),
],
// Per-facet loading state. A filter-change reload and a per-facet search have independent
@@ -249,7 +358,14 @@ export const facetCountsLogic = kea<facetCountsLogicType>([
// Subscribing to this keeps a view-mode or sort toggle from refetching every facet.
breakdownScope: [
(s) => [s.utcDateRange, s.serviceNames, s.queryFilterGroup],
- (utcDateRange, serviceNames, queryFilterGroup): BreakdownScope => ({
+ (
+ utcDateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ },
+ serviceNames: string[],
+ queryFilterGroup: UniversalFiltersGroup
+ ): BreakdownScope => ({
utcDateRange,
serviceNames,
queryFilterGroup,
diff --git a/products/tracing/frontend/components/FacetRail/facetRailLogic.ts b/products/tracing/frontend/components/FacetRail/facetRailLogic.ts
index 6ceca144b8ce..4aa4f51857b9 100644
--- a/products/tracing/frontend/components/FacetRail/facetRailLogic.ts
+++ b/products/tracing/frontend/components/FacetRail/facetRailLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
import {
TRACING_SCENE_VIEWER_ID,
@@ -6,7 +6,7 @@ import {
TracingFiltersLogicProps,
} from 'products/tracing/frontend/tracingFiltersLogic'
-import type { facetRailLogicType } from './facetRailLogicType'
+import type { UniversalFiltersGroup } from '../../../../../frontend/src/types'
import { FacetSource, toggleFacetFilter } from './facets'
export interface FacetRailLogicProps {
@@ -18,6 +18,47 @@ function toggleMembership(values: readonly string[] | undefined | null, value: s
return current.includes(value) ? current.filter((v) => v !== value) : [...current, value]
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface facetRailLogicValues {
+ collapsedFacets: string[]
+ facetNameSearch: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface facetRailLogicActions {
+ setFilterGroup: (filterGroup: UniversalFiltersGroup) => {
+ filterGroup: UniversalFiltersGroup
+ } // tracingFiltersLogic
+ setServiceNames: (serviceNames: string[]) => {
+ serviceNames: string[]
+ } // tracingFiltersLogic
+ setFacetNameSearch: (search: string) => {
+ search: string
+ }
+ toggleFacetCollapsed: (facetKey: string) => {
+ facetKey: string
+ }
+ toggleFacetValue: (
+ source: FacetSource,
+ value: string
+ ) => {
+ source: FacetSource
+ value: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface facetRailLogicMeta {
+ key: string
+}
+
+export type facetRailLogicType = MakeLogicType<
+ facetRailLogicValues,
+ facetRailLogicActions,
+ FacetRailLogicProps,
+ facetRailLogicMeta
+>
+
// The rail is a lens over the existing filter model — facet toggles write straight back to
// tracingFiltersLogic's reducers, so URL sync, saved views, and the filter chips stay in step.
export const facetRailLogic = kea<facetRailLogicType>([
diff --git a/products/tracing/frontend/components/SetupPrompt/tracingIngestionLogic.tsx b/products/tracing/frontend/components/SetupPrompt/tracingIngestionLogic.tsx
index 55c54d002f06..370f31e07c76 100644
--- a/products/tracing/frontend/components/SetupPrompt/tracingIngestionLogic.tsx
+++ b/products/tracing/frontend/components/SetupPrompt/tracingIngestionLogic.tsx
@@ -1,13 +1,53 @@
-import { afterMount, kea, path, reducers, selectors } from 'kea'
+import { MakeLogicType, afterMount, kea, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
import { retryWithBackoff } from 'lib/utils/async'
-import type { tracingIngestionLogicType } from './tracingIngestionLogicType'
-
const teamId = window.POSTHOG_APP_CONTEXT?.current_team?.id
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingIngestionLogicValues {
+ cachedTeamHasSpans: boolean | null
+ hasSpans: boolean | undefined
+ teamHasSpans: boolean | undefined
+ teamHasSpansCheckFailed: boolean
+ teamHasSpansLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingIngestionLogicActions {
+ loadTeamHasSpans: () => any
+ loadTeamHasSpansFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTeamHasSpansSuccess: (
+ teamHasSpans: boolean,
+ payload?: any
+ ) => {
+ teamHasSpans: boolean
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingIngestionLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ hasSpans: (teamHasSpans: boolean | undefined, cachedTeamHasSpans: boolean | null) => boolean | undefined
+ }
+}
+
+export type tracingIngestionLogicType = MakeLogicType<
+ tracingIngestionLogicValues,
+ tracingIngestionLogicActions,
+ Record<string, any>,
+ tracingIngestionLogicMeta
+>
+
export const tracingIngestionLogic = kea<tracingIngestionLogicType>([
path(['products', 'tracing', 'components', 'SetupPrompt', 'tracingIngestionLogic']),
loaders({
@@ -41,7 +81,8 @@ export const tracingIngestionLogic = kea<tracingIngestionLogicType>([
selectors({
hasSpans: [
(s) => [s.teamHasSpans, s.cachedTeamHasSpans],
- (teamHasSpans, cachedTeamHasSpans): boolean | undefined => teamHasSpans ?? cachedTeamHasSpans ?? undefined,
+ (teamHasSpans: boolean | undefined, cachedTeamHasSpans: boolean | null): boolean | undefined =>
+ teamHasSpans ?? cachedTeamHasSpans ?? undefined,
],
}),
diff --git a/products/tracing/frontend/savedViews/tracingViewsListLogic.ts b/products/tracing/frontend/savedViews/tracingViewsListLogic.ts
index 09b2fbcf3a84..5525bbfec2b2 100644
--- a/products/tracing/frontend/savedViews/tracingViewsListLogic.ts
+++ b/products/tracing/frontend/savedViews/tracingViewsListLogic.ts
@@ -1,8 +1,64 @@
-import { actions, connect, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers } from 'kea'
import { TRACING_SCENE_VIEWER_ID, tracingFiltersLogic } from '../tracingFiltersLogic'
-import type { tracingViewsListLogicType } from './tracingViewsListLogicType'
+import type { TracingFilters } from '../tracingFiltersLogic'
import { tracingViewsLogic } from './tracingViewsLogic'
+import type { SavedTracingFilters, TracingView } from './tracingViewsLogic'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingViewsListLogicValues {
+ filters: TracingFilters // tracingFiltersLogic
+ isModalOpen: boolean
+ isSaveModalOpen: boolean
+ viewName: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingViewsListLogicActions {
+ createView: (args_0: { filters: Partial<SavedTracingFilters>; name: string }) => {
+ filters: Partial<SavedTracingFilters>
+ name: string
+ } // tracingViewsLogic
+ createViewSuccess: (
+ views: TracingView[],
+ payload?:
+ | {
+ filters: Partial<SavedTracingFilters>
+ name: string
+ }
+ | undefined
+ ) => {
+ payload?: {
+ filters: Partial<SavedTracingFilters>
+ name: string
+ }
+ views: TracingView[]
+ } // tracingViewsLogic
+ loadView: (view: TracingView) => {
+ view: TracingView
+ } // tracingViewsLogic
+ loadViews: () => any // tracingViewsLogic
+ closeModal: () => {
+ value: true
+ }
+ closeSaveModal: () => {
+ value: true
+ }
+ openModal: () => {
+ value: true
+ }
+ openSaveModal: () => {
+ value: true
+ }
+ saveView: () => {
+ value: true
+ }
+ setViewName: (viewName: string) => {
+ viewName: string
+ }
+}
+
+export type tracingViewsListLogicType = MakeLogicType<tracingViewsListLogicValues, tracingViewsListLogicActions>
export const tracingViewsListLogic = kea<tracingViewsListLogicType>([
path(['products', 'tracing', 'frontend', 'savedViews', 'tracingViewsListLogic']),
diff --git a/products/tracing/frontend/savedViews/tracingViewsLogic.ts b/products/tracing/frontend/savedViews/tracingViewsLogic.ts
index cfe422a1e9ad..49efeec50b7c 100644
--- a/products/tracing/frontend/savedViews/tracingViewsLogic.ts
+++ b/products/tracing/frontend/savedViews/tracingViewsLogic.ts
@@ -1,4 +1,4 @@
-import { actions, connect, kea, listeners, path, reducers } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import { lemonToast } from '@posthog/lemon-ui'
@@ -7,7 +7,6 @@ import api from 'lib/api'
import { teamLogic } from 'scenes/teamLogic'
import { TRACING_SCENE_VIEWER_ID, TracingFilters, tracingFiltersLogic } from '../tracingFiltersLogic'
-import type { tracingViewsLogicType } from './tracingViewsLogicType'
// Subset of TracingFilters persisted in a saved view. Compare-mode and the dragged overlay windows
// are ephemeral UI state tied to on-screen sparkline data, so they're intentionally excluded.
@@ -33,6 +32,67 @@ export interface TracingView {
const tracingViewsUrl = (teamId: number | null): string => `api/projects/${teamId}/tracing/views`
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingViewsLogicValues {
+ currentTeamId: number | null // teamLogic
+ views: TracingView[]
+ viewsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingViewsLogicActions {
+ setFilters: (filters: Partial<TracingFilters>) => {
+ filters: Partial<TracingFilters>
+ } // tracingFiltersLogic
+ createView: ({ name, filters }: { filters: Partial<SavedTracingFilters>; name: string }) => {
+ name: string
+ filters: Partial<SavedTracingFilters>
+ }
+ createViewFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ createViewSuccess: (
+ views: TracingView[],
+ payload?: {
+ name: string
+ filters: Partial<SavedTracingFilters>
+ }
+ ) => {
+ views: TracingView[]
+ payload?: {
+ name: string
+ filters: Partial<SavedTracingFilters>
+ }
+ }
+ deleteView: (shortId: string) => {
+ shortId: string
+ }
+ loadView: (view: TracingView) => {
+ view: TracingView
+ }
+ loadViews: () => any
+ loadViewsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadViewsSuccess: (
+ views: TracingView[],
+ payload?: any
+ ) => {
+ views: TracingView[]
+ payload?: any
+ }
+}
+
+export type tracingViewsLogicType = MakeLogicType<tracingViewsLogicValues, tracingViewsLogicActions>
+
export const tracingViewsLogic = kea<tracingViewsLogicType>([
path(['products', 'tracing', 'frontend', 'savedViews', 'tracingViewsLogic']),
diff --git a/products/tracing/frontend/tracingConfigLogic.ts b/products/tracing/frontend/tracingConfigLogic.ts
index a902ee93e814..208d3f76e151 100644
--- a/products/tracing/frontend/tracingConfigLogic.ts
+++ b/products/tracing/frontend/tracingConfigLogic.ts
@@ -1,6 +1,18 @@
-import { actions, kea, path, reducers } from 'kea'
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
-import type { tracingConfigLogicType } from './tracingConfigLogicType'
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingConfigLogicValues {
+ facetRailCollapsed: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingConfigLogicActions {
+ setFacetRailCollapsed: (facetRailCollapsed: boolean) => {
+ facetRailCollapsed: boolean
+ }
+}
+
+export type tracingConfigLogicType = MakeLogicType<tracingConfigLogicValues, tracingConfigLogicActions>
/** Display-only preferences for the tracing scene — never affects the query. */
export const tracingConfigLogic = kea<tracingConfigLogicType>([
diff --git a/products/tracing/frontend/tracingDataLogic.ts b/products/tracing/frontend/tracingDataLogic.ts
index 2700de125e41..93bf96d56b4b 100644
--- a/products/tracing/frontend/tracingDataLogic.ts
+++ b/products/tracing/frontend/tracingDataLogic.ts
@@ -1,4 +1,17 @@
-import { actions, afterMount, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ connect,
+ events,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ reducers,
+ selectors,
+} from 'kea'
import { loaders } from 'kea-loaders'
import posthog from 'posthog-js'
@@ -12,6 +25,8 @@ import { humanFriendlyDetailedTime } from 'lib/utils/datetime'
import { AggregatedSpanRow, SpanTreeNode } from '~/queries/schema/schema-general'
import { PropertyGroupFilter } from '~/types'
+import type { DateRange } from '../../../frontend/src/queries/schema/schema-general'
+import type { UniversalFiltersGroup } from '../../../frontend/src/types'
import {
type DurationHistogramRow,
pivotDurationHistogram,
@@ -20,13 +35,13 @@ import {
visibleDurationRange,
} from './durationBuckets'
import { traceLookupDateRange } from './traceLinks'
-import type { tracingDataLogicType } from './tracingDataLogicType'
import {
type TracingFilters,
type TracingOrderBy,
TRACING_SCENE_VIEWER_ID,
tracingFiltersLogic,
} from './tracingFiltersLogic'
+import type { OverlayWindow, TimeComparison, TracingOrderDirection, TracingViewMode } from './tracingFiltersLogic'
import type { Span } from './types'
export interface SparklineRow {
@@ -93,6 +108,462 @@ export interface TracingDataLogicProps {
autoLoad?: boolean
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingDataLogicValues {
+ compareActive: boolean // tracingFiltersLogic
+ currentWindowMs: OverlayWindow // tracingFiltersLogic
+ filters: TracingFilters // tracingFiltersLogic
+ orderBy: TracingOrderBy // tracingFiltersLogic
+ previousWindowMs: OverlayWindow // tracingFiltersLogic
+ queryFilterGroup: UniversalFiltersGroup // tracingFiltersLogic
+ sparklineWindowMs: OverlayWindow // tracingFiltersLogic
+ timeComparison: TimeComparison | null // tracingFiltersLogic
+ utcDateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ } // tracingFiltersLogic
+ aggregation: {
+ current: AggregatedSpanRow[]
+ previous: AggregatedSpanRow[] | null
+ }
+ aggregationAbortController: AbortController | null
+ aggregationLoading: boolean
+ durationHistogramAbortController: AbortController | null
+ durationHistogramData: TracingDurationHistogramData
+ durationHistogramLoading: boolean
+ hasMoreToLoad: boolean
+ hasRunQuery: boolean
+ isDurationMode: boolean
+ lastAggregationWindow: {
+ currentEndMs: number
+ currentStartMs: number
+ previousEndMs: number
+ previousStartMs: number
+ } | null
+ listRowDurations: number[]
+ listRows: Span[]
+ matchingCounts: {
+ count: number
+ traceCount: number
+ }
+ matchingCountsAbortController: AbortController | null
+ matchingCountsLoading: boolean
+ nextCursor: string | null
+ rawDurationHistogram: DurationHistogramRow[]
+ rawDurationHistogramLoading: boolean
+ rawSparklineData: SparklineRow[]
+ rawSparklineDataLoading: boolean
+ spanTree: {
+ current: SpanTreeNode[]
+ previous: SpanTreeNode[] | null
+ spanName: string | null
+ }
+ spanTreeAbortController: AbortController | null
+ spanTreeLoading: boolean
+ spans: Span[]
+ spansAbortController: AbortController | null
+ spansLoading: boolean
+ sparklineAbortController: AbortController | null
+ sparklineData: TracingSparklineData
+ sparklineLoading: boolean
+ totalMatchingFilters: number
+ traceLoadContext: {
+ traceId: string
+ ts?: string | null
+ } | null
+ traceSpans: Span[]
+ traceSpansHasMore: boolean
+ traceSpansLoading: boolean
+ traceSpansLoadingMore: boolean
+ traceSpansNextOffset: number
+ visibleRowDateRange: VisibleSpanTimeRange | null
+ visibleRowDurationRange: VisibleDurationRange | null
+ visibleRowRange: VisibleRowRange | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingDataLogicActions {
+ setComparison: (comparison: TimeComparison | null) => {
+ comparison: TimeComparison | null
+ } // tracingFiltersLogic
+ setDateRange: (dateRange: DateRange) => {
+ dateRange: DateRange
+ } // tracingFiltersLogic
+ setFilterGroup: (filterGroup: UniversalFiltersGroup) => {
+ filterGroup: UniversalFiltersGroup
+ } // tracingFiltersLogic
+ setFilters: (filters: Partial<TracingFilters>) => {
+ filters: Partial<TracingFilters>
+ } // tracingFiltersLogic
+ setServiceNames: (serviceNames: string[]) => {
+ serviceNames: string[]
+ } // tracingFiltersLogic
+ setSort: (
+ orderBy: TracingOrderBy,
+ orderDirection: TracingOrderDirection
+ ) => {
+ orderBy: TracingOrderBy
+ orderDirection: TracingOrderDirection
+ } // tracingFiltersLogic
+ setViewMode: (viewMode: TracingViewMode) => {
+ viewMode: TracingViewMode
+ } // tracingFiltersLogic
+ updateComparisonWindows: (
+ current: OverlayWindow,
+ previous: OverlayWindow
+ ) => {
+ current: OverlayWindow
+ previous: OverlayWindow
+ } // tracingFiltersLogic
+ cancelInProgressAggregation: (controller: AbortController | null) => {
+ controller: AbortController | null
+ }
+ cancelInProgressDurationHistogram: (controller: AbortController | null) => {
+ controller: AbortController | null
+ }
+ cancelInProgressMatchingCounts: (controller: AbortController | null) => {
+ controller: AbortController | null
+ }
+ cancelInProgressSpanTree: (controller: AbortController | null) => {
+ controller: AbortController | null
+ }
+ cancelInProgressSpans: (controller: AbortController | null) => {
+ controller: AbortController | null
+ }
+ cancelInProgressSparkline: (controller: AbortController | null) => {
+ controller: AbortController | null
+ }
+ clearSpans: () => {
+ value: true
+ }
+ clearSpansFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ clearSpansSuccess: (
+ spans: never[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ spans: never[]
+ payload?: {
+ value: true
+ }
+ }
+ fetchAggregation: (
+ options?: {
+ fullRange?: boolean
+ } | null
+ ) => {
+ fullRange?: boolean
+ } | null
+ fetchAggregationFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ fetchAggregationSuccess: (
+ aggregation: {
+ current: AggregatedSpanRow[]
+ previous: AggregatedSpanRow[] | null
+ },
+ payload?: {
+ fullRange?: boolean
+ } | null
+ ) => {
+ aggregation: {
+ current: AggregatedSpanRow[]
+ previous: AggregatedSpanRow[] | null
+ }
+ payload?: {
+ fullRange?: boolean
+ } | null
+ }
+ fetchDurationHistogram: () => any
+ fetchDurationHistogramFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ fetchDurationHistogramSuccess: (
+ rawDurationHistogram: {
+ bucket_ns: number
+ count: number
+ service: string
+ }[],
+ payload?: any
+ ) => {
+ rawDurationHistogram: {
+ bucket_ns: number
+ count: number
+ service: string
+ }[]
+ payload?: any
+ }
+ fetchMatchingCounts: () => any
+ fetchMatchingCountsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ fetchMatchingCountsSuccess: (
+ matchingCounts: {
+ count: number
+ traceCount: number
+ },
+ payload?: any
+ ) => {
+ matchingCounts: {
+ count: number
+ traceCount: number
+ }
+ payload?: any
+ }
+ fetchNextPage: () => {
+ value: true
+ }
+ fetchNextPageFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ fetchNextPageSuccess: (
+ spans: Span[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ spans: Span[]
+ payload?: {
+ value: true
+ }
+ }
+ fetchSpanTree: (params: { serviceName: string; spanName: string }) => {
+ spanName: string
+ serviceName: string
+ }
+ fetchSpanTreeFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ fetchSpanTreeSuccess: (
+ spanTree: {
+ current: SpanTreeNode[]
+ previous: SpanTreeNode[] | null
+ spanName: string
+ },
+ payload?: {
+ spanName: string
+ serviceName: string
+ }
+ ) => {
+ spanTree: {
+ current: SpanTreeNode[]
+ previous: SpanTreeNode[] | null
+ spanName: string
+ }
+ payload?: {
+ spanName: string
+ serviceName: string
+ }
+ }
+ fetchSpans: () => any
+ fetchSpansFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ fetchSpansSuccess: (
+ spans: Span[],
+ payload?: any
+ ) => {
+ spans: Span[]
+ payload?: any
+ }
+ fetchSparkline: () => any
+ fetchSparklineFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ fetchSparklineSuccess: (
+ rawSparklineData: {
+ count: number
+ service: string
+ time: string
+ }[],
+ payload?: any
+ ) => {
+ rawSparklineData: {
+ count: number
+ service: string
+ time: string
+ }[]
+ payload?: any
+ }
+ handleFilterChange: (
+ filterType: string,
+ extraProps?: Record<string, unknown>
+ ) => {
+ extraProps: Record<string, unknown> | undefined
+ filterType: string
+ }
+ loadMoreTraceSpans: () => {
+ value: true
+ }
+ loadMoreTraceSpansFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadMoreTraceSpansSuccess: (
+ traceSpans: Span[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ traceSpans: Span[]
+ payload?: {
+ value: true
+ }
+ }
+ loadTraceSpans: ({ traceId, ts }: { traceId: string; ts?: string | null }) => {
+ traceId: string
+ ts?: string | null
+ }
+ loadTraceSpansFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTraceSpansSuccess: (
+ traceSpans: Span[],
+ payload?: {
+ traceId: string
+ ts?: string | null
+ }
+ ) => {
+ traceSpans: Span[]
+ payload?: {
+ traceId: string
+ ts?: string | null
+ }
+ }
+ runQuery: () => {
+ value: true
+ }
+ setAggregationAbortController: (controller: AbortController | null) => {
+ controller: AbortController | null
+ }
+ setDurationHistogramAbortController: (controller: AbortController | null) => {
+ controller: AbortController | null
+ }
+ setHasMoreToLoad: (hasMore: boolean) => {
+ hasMore: boolean
+ }
+ setLastAggregationWindow: (window: {
+ currentEndMs: number
+ currentStartMs: number
+ previousEndMs: number
+ previousStartMs: number
+ }) => {
+ window: {
+ currentEndMs: number
+ currentStartMs: number
+ previousEndMs: number
+ previousStartMs: number
+ }
+ }
+ setMatchingCountsAbortController: (controller: AbortController | null) => {
+ controller: AbortController | null
+ }
+ setNextCursor: (cursor: string | null) => {
+ cursor: string | null
+ }
+ setSpanTreeAbortController: (controller: AbortController | null) => {
+ controller: AbortController | null
+ }
+ setSpansAbortController: (controller: AbortController | null) => {
+ controller: AbortController | null
+ }
+ setSparklineAbortController: (controller: AbortController | null) => {
+ controller: AbortController | null
+ }
+ setTracePagination: (
+ hasMore: boolean,
+ nextOffset: number | null
+ ) => {
+ hasMore: boolean
+ nextOffset: number | null
+ }
+ setVisibleRowRange: (
+ startIndex: number,
+ stopIndex: number
+ ) => {
+ startIndex: number
+ stopIndex: number
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingDataLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ sparklineData: (rawSparklineData: SparklineRow[]) => TracingSparklineData
+ totalMatchingFilters: (
+ matchingCounts: {
+ count: number
+ traceCount: number
+ },
+ filters: TracingFilters
+ ) => number
+ durationHistogramData: (rawDurationHistogram: DurationHistogramRow[]) => TracingDurationHistogramData
+ listRows: (spans: Span[], filters: TracingFilters) => Span[]
+ listRowDurations: (listRows: Span[]) => number[]
+ isDurationMode: (filters: TracingFilters, compareActive: boolean) => boolean
+ visibleRowDurationRange: (
+ visibleRowRange: VisibleRowRange | null,
+ listRowDurations: number[],
+ isDurationMode: boolean
+ ) => VisibleDurationRange | null
+ visibleRowDateRange: (
+ visibleRowRange: VisibleRowRange | null,
+ listRows: Span[],
+ orderBy: TracingOrderBy
+ ) => VisibleSpanTimeRange | null
+ }
+}
+
+export type tracingDataLogicType = MakeLogicType<
+ tracingDataLogicValues,
+ tracingDataLogicActions,
+ TracingDataLogicProps,
+ tracingDataLogicMeta
+>
+
export const tracingDataLogic = kea<tracingDataLogicType>([
props({ id: TRACING_SCENE_VIEWER_ID, autoLoad: false } as TracingDataLogicProps),
key((props) => props.id),
diff --git a/products/tracing/frontend/tracingFiltersLogic.ts b/products/tracing/frontend/tracingFiltersLogic.ts
index 020b2571d193..f5ea80c3b0d3 100644
--- a/products/tracing/frontend/tracingFiltersLogic.ts
+++ b/products/tracing/frontend/tracingFiltersLogic.ts
@@ -1,5 +1,5 @@
import { deepEqual as equal } from 'fast-equals'
-import { actions, afterMount, kea, key, path, props, propsChanged, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, kea, key, path, props, propsChanged, reducers, selectors } from 'kea'
import { DEFAULT_UNIVERSAL_GROUP_FILTER } from 'lib/components/UniversalFilters/universalFiltersLogic'
import { dayjs } from 'lib/dayjs'
@@ -7,8 +7,6 @@ import { dayjs } from 'lib/dayjs'
import { DateRange } from '~/queries/schema/schema-general'
import { FilterLogicalOperator, UniversalFiltersGroup } from '~/types'
-import type { tracingFiltersLogicType } from './tracingFiltersLogicType'
-
export const DEFAULT_DATE_RANGE: DateRange = { date_from: '-1h', date_to: null }
export const DEFAULT_TIMEZONE: string = 'UTC'
export const DEFAULT_SERVICE_NAMES: string[] = []
@@ -146,6 +144,112 @@ export function combineWithPinnedFilters(
}
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingFiltersLogicValues {
+ compareActive: boolean
+ comparison: TracingComparison | null
+ currentWindowMs: OverlayWindow
+ dateRange: DateRange
+ filterGroup: UniversalFiltersGroup
+ filters: TracingFilters
+ orderBy: TracingOrderBy
+ orderDirection: TracingOrderDirection
+ pinnedFilters: UniversalFiltersGroup | undefined
+ previousWindowMs: OverlayWindow
+ queryFilterGroup: UniversalFiltersGroup
+ serviceNames: string[]
+ sparklineWindowMs: OverlayWindow
+ timeComparison: TimeComparison | null
+ timezone: string
+ utcDateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ }
+ viewMode: TracingViewMode
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingFiltersLogicActions {
+ setComparison: (comparison: TracingComparison | null) => {
+ comparison: TimeComparison | null
+ }
+ setDateRange: (dateRange: DateRange) => {
+ dateRange: DateRange
+ }
+ setFilterGroup: (filterGroup: UniversalFiltersGroup) => {
+ filterGroup: UniversalFiltersGroup
+ }
+ setFilters: (filters: Partial<TracingFilters>) => {
+ filters: Partial<TracingFilters>
+ }
+ setPinnedFilters: (pinnedFilters: UniversalFiltersGroup | undefined) => {
+ pinnedFilters: UniversalFiltersGroup | undefined
+ }
+ setServiceNames: (serviceNames: string[]) => {
+ serviceNames: string[]
+ }
+ setSort: (
+ orderBy: TracingOrderBy,
+ orderDirection: TracingOrderDirection
+ ) => {
+ orderBy: TracingOrderBy
+ orderDirection: TracingOrderDirection
+ }
+ setTimezone: (timezone: string) => {
+ timezone: string
+ }
+ setViewMode: (viewMode: TracingViewMode) => {
+ viewMode: TracingViewMode
+ }
+ updateComparisonWindows: (
+ current: OverlayWindow,
+ previous: OverlayWindow
+ ) => {
+ current: OverlayWindow
+ previous: OverlayWindow
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingFiltersLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ filters: (
+ dateRange: DateRange,
+ serviceNames: string[],
+ filterGroup: UniversalFiltersGroup,
+ orderBy: TracingOrderBy,
+ orderDirection: TracingOrderDirection,
+ viewMode: TracingViewMode,
+ comparison: TimeComparison | null
+ ) => TracingFilters
+ compareActive: (comparison: TimeComparison | null) => boolean
+ timeComparison: (comparison: TimeComparison | null) => TimeComparison | null
+ queryFilterGroup: (
+ filterGroup: UniversalFiltersGroup,
+ pinnedFilters: UniversalFiltersGroup | undefined
+ ) => UniversalFiltersGroup
+ utcDateRange: (dateRange: DateRange) => {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ }
+ sparklineWindowMs: (dateRange: DateRange) => OverlayWindow
+ currentWindowMs: (sparklineWindowMs: OverlayWindow, timeComparison: TimeComparison | null) => OverlayWindow
+ previousWindowMs: (
+ sparklineWindowMs: OverlayWindow,
+ currentWindowMs: OverlayWindow,
+ timeComparison: TimeComparison | null
+ ) => OverlayWindow
+ }
+}
+
+export type tracingFiltersLogicType = MakeLogicType<
+ tracingFiltersLogicValues,
+ tracingFiltersLogicActions,
+ TracingFiltersLogicProps,
+ tracingFiltersLogicMeta
+>
+
export const tracingFiltersLogic = kea<tracingFiltersLogicType>([
props({ id: TRACING_SCENE_VIEWER_ID } as TracingFiltersLogicProps),
key((props) => props.id),
@@ -253,7 +357,15 @@ export const tracingFiltersLogic = kea<tracingFiltersLogicType>([
selectors({
filters: [
(s) => [s.dateRange, s.serviceNames, s.filterGroup, s.orderBy, s.orderDirection, s.viewMode, s.comparison],
- (dateRange, serviceNames, filterGroup, orderBy, orderDirection, viewMode, comparison): TracingFilters => ({
+ (
+ dateRange: DateRange,
+ serviceNames: string[],
+ filterGroup: UniversalFiltersGroup,
+ orderBy: TracingOrderBy,
+ orderDirection: TracingOrderDirection,
+ viewMode: TracingViewMode,
+ comparison: TracingComparison | null
+ ): TracingFilters => ({
dateRange,
serviceNames,
filterGroup,
diff --git a/products/tracing/frontend/tracingOperationSceneLogic.ts b/products/tracing/frontend/tracingOperationSceneLogic.ts
index 3b3799d3791a..bb333beda7dd 100644
--- a/products/tracing/frontend/tracingOperationSceneLogic.ts
+++ b/products/tracing/frontend/tracingOperationSceneLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, router, urlToAction } from 'kea-router'
@@ -13,7 +13,6 @@ import { type DurationHistogramRow, pivotDurationHistogram, type TracingDuration
import { type DurationRange, operationFilterGroup } from './operationFilters'
import { traceLookupDateRange } from './traceLinks'
import { DEFAULT_DATE_RANGE } from './tracingFiltersLogic'
-import type { tracingOperationSceneLogicType } from './tracingOperationSceneLogicType'
import type { Span } from './types'
export interface TracingOperationSceneLogicProps {
@@ -23,6 +22,138 @@ export interface TracingOperationSceneLogicProps {
const SAMPLE_LIMIT = 100
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingOperationSceneLogicValues {
+ currentSample: Span | null
+ dateRange: DateRange
+ durationSelection: DurationRange | null
+ histogramData: TracingDurationHistogramData
+ operationStats: AggregatedSpanRow | null
+ operationStatsLoading: boolean
+ rawHistogram: DurationHistogramRow[]
+ rawHistogramLoading: boolean
+ sampleIndex: number
+ sampleTraceSpans: Span[]
+ sampleTraceSpansLoading: boolean
+ samples: Span[]
+ samplesHaveMore: boolean
+ samplesLoading: boolean
+ selectedSpanId: string | null
+ serviceName: string
+ spanName: string
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingOperationSceneLogicActions {
+ fetchHistogram: (_: void) => void
+ fetchHistogramFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ fetchHistogramSuccess: (
+ rawHistogram: {
+ bucket_ns: number
+ count: number
+ service: string
+ }[],
+ payload?: void
+ ) => {
+ rawHistogram: {
+ bucket_ns: number
+ count: number
+ service: string
+ }[]
+ payload?: void
+ }
+ fetchSampleTrace: ({ sample }: { sample: Span }) => {
+ sample: Span
+ }
+ fetchSampleTraceFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ fetchSampleTraceSuccess: (
+ sampleTraceSpans: Span[],
+ payload?: {
+ sample: Span
+ }
+ ) => {
+ sampleTraceSpans: Span[]
+ payload?: {
+ sample: Span
+ }
+ }
+ fetchSamples: (_: void) => void
+ fetchSamplesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ fetchSamplesSuccess: (
+ samples: Span[],
+ payload?: void
+ ) => {
+ samples: Span[]
+ payload?: void
+ }
+ fetchStats: (_: void) => void
+ fetchStatsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ fetchStatsSuccess: (
+ operationStats: AggregatedSpanRow | null,
+ payload?: void
+ ) => {
+ operationStats: AggregatedSpanRow | null
+ payload?: void
+ }
+ selectSpan: (spanId: string | null) => {
+ spanId: string | null
+ }
+ setDateRange: (dateRange: DateRange) => {
+ dateRange: DateRange
+ }
+ setDurationSelection: (selection: DurationRange | null) => {
+ selection: DurationRange | null
+ }
+ setSampleIndex: (index: number) => {
+ index: number
+ }
+ setSamplesHaveMore: (hasMore: boolean) => {
+ hasMore: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingOperationSceneLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ serviceName: (arg: any) => string
+ spanName: (arg: any) => string
+ histogramData: (rawHistogram: DurationHistogramRow[]) => TracingDurationHistogramData
+ currentSample: (samples: Span[], sampleIndex: number) => Span | null
+ }
+}
+
+export type tracingOperationSceneLogicType = MakeLogicType<
+ tracingOperationSceneLogicValues,
+ tracingOperationSceneLogicActions,
+ TracingOperationSceneLogicProps,
+ tracingOperationSceneLogicMeta
+>
+
export const tracingOperationSceneLogic = kea<tracingOperationSceneLogicType>([
props({} as TracingOperationSceneLogicProps),
key(({ serviceName, spanName }) => `${serviceName}//${spanName}`),
diff --git a/products/tracing/frontend/tracingSceneLogic.ts b/products/tracing/frontend/tracingSceneLogic.ts
index 31546e53d44c..3e3d33f2eef5 100644
--- a/products/tracing/frontend/tracingSceneLogic.ts
+++ b/products/tracing/frontend/tracingSceneLogic.ts
@@ -1,5 +1,5 @@
import { deepEqual as equal } from 'fast-equals'
-import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { router, urlToAction } from 'kea-router'
import { DEFAULT_UNIVERSAL_GROUP_FILTER } from 'lib/components/UniversalFilters/universalFiltersLogic'
@@ -9,7 +9,11 @@ import { Params } from 'scenes/sceneTypes'
import { Breadcrumb } from '~/types'
+import type { AggregatedSpanRow, DateRange, SpanTreeNode } from '../../../frontend/src/queries/schema/schema-general'
+import type { UniversalFiltersGroup } from '../../../frontend/src/types'
+import type { TracingDurationHistogramData, VisibleDurationRange } from './durationBuckets'
import { tracingDataLogic } from './tracingDataLogic'
+import type { TracingSparklineData, VisibleSpanTimeRange } from './tracingDataLogic'
import {
DEFAULT_CUSTOM_COMPARISON,
DEFAULT_DATE_RANGE,
@@ -23,8 +27,182 @@ import {
type TracingComparison,
tracingFiltersLogic,
} from './tracingFiltersLogic'
-import type { tracingSceneLogicType } from './tracingSceneLogicType'
+import type {
+ OverlayWindow,
+ TimeComparison,
+ TracingFilters,
+ TracingOrderBy,
+ TracingOrderDirection,
+ TracingViewMode,
+} from './tracingFiltersLogic'
import { tracingViewerLogic } from './tracingViewerLogic'
+import type { Span } from './types'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingSceneLogicValues {
+ aggregation: {
+ current: AggregatedSpanRow[]
+ previous: AggregatedSpanRow[] | null
+ } // tracingDataLogic
+ aggregationLoading: boolean // tracingDataLogic
+ durationHistogramData: TracingDurationHistogramData // tracingDataLogic
+ durationHistogramLoading: boolean // tracingDataLogic
+ hasMoreToLoad: boolean // tracingDataLogic
+ hasRunQuery: boolean // tracingDataLogic
+ isDurationMode: boolean // tracingDataLogic
+ listRows: Span[] // tracingDataLogic
+ spanTree: {
+ current: SpanTreeNode[]
+ previous: SpanTreeNode[] | null
+ spanName: string | null
+ } // tracingDataLogic
+ spanTreeLoading: boolean // tracingDataLogic
+ spans: Span[] // tracingDataLogic
+ spansLoading: boolean // tracingDataLogic
+ sparklineData: TracingSparklineData // tracingDataLogic
+ sparklineLoading: boolean // tracingDataLogic
+ totalMatchingFilters: number // tracingDataLogic
+ traceSpans: Span[] // tracingDataLogic
+ traceSpansHasMore: boolean // tracingDataLogic
+ traceSpansLoading: boolean // tracingDataLogic
+ traceSpansLoadingMore: boolean // tracingDataLogic
+ visibleRowDateRange: VisibleSpanTimeRange | null // tracingDataLogic
+ visibleRowDurationRange: VisibleDurationRange | null // tracingDataLogic
+ compareActive: boolean // tracingFiltersLogic
+ currentWindowMs: OverlayWindow // tracingFiltersLogic
+ filters: TracingFilters // tracingFiltersLogic
+ previousWindowMs: OverlayWindow // tracingFiltersLogic
+ sparklineWindowMs: OverlayWindow // tracingFiltersLogic
+ utcDateRange: {
+ date_from: string | null | undefined
+ date_to: string | null | undefined
+ } // tracingFiltersLogic
+ canLoadMoreTraceSpans: boolean // tracingViewerLogic
+ compareFlameServiceName: string | null // tracingViewerLogic
+ compareFlameSpanName: string | null // tracingViewerLogic
+ isLoadingFullTrace: boolean // tracingViewerLogic
+ isTraceOpen: boolean // tracingViewerLogic
+ openTraceSpans: Span[] // tracingViewerLogic
+ selectedSpanId: string | null // tracingViewerLogic
+ selectedTraceId: string | null // tracingViewerLogic
+ selectedTraceTs: string | null // tracingViewerLogic
+ activeTracingTab: 'operations' | 'traces'
+ breadcrumbs: Breadcrumb[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingSceneLogicActions {
+ fetchAggregation: (
+ options?:
+ | {
+ fullRange?: boolean
+ }
+ | null
+ | undefined
+ ) => {
+ fullRange?: boolean
+ } | null // tracingDataLogic
+ fetchNextPage: () => {
+ value: true
+ } // tracingDataLogic
+ fetchSpanTree: (params: { serviceName: string; spanName: string }) => {
+ serviceName: string
+ spanName: string
+ } // tracingDataLogic
+ handleFilterChange: (
+ filterType: string,
+ extraProps?: Record<string, unknown> | undefined
+ ) => {
+ extraProps: Record<string, unknown> | undefined
+ filterType: string
+ } // tracingDataLogic
+ loadMoreTraceSpans: () => {
+ value: true
+ } // tracingDataLogic
+ loadTraceSpans: (args_0: { traceId: string; ts?: string | null }) => {
+ traceId: string
+ ts?: string | null
+ } // tracingDataLogic
+ runQuery: () => {
+ value: true
+ } // tracingDataLogic
+ setVisibleRowRange: (
+ startIndex: number,
+ stopIndex: number
+ ) => {
+ startIndex: number
+ stopIndex: number
+ } // tracingDataLogic
+ setComparison: (comparison: TimeComparison | null) => {
+ comparison: TimeComparison | null
+ } // tracingFiltersLogic
+ setDateRange: (dateRange: DateRange) => {
+ dateRange: DateRange
+ } // tracingFiltersLogic
+ setFilterGroup: (filterGroup: UniversalFiltersGroup) => {
+ filterGroup: UniversalFiltersGroup
+ } // tracingFiltersLogic
+ setFilters: (filters: Partial<TracingFilters>) => {
+ filters: Partial<TracingFilters>
+ } // tracingFiltersLogic
+ setServiceNames: (serviceNames: string[]) => {
+ serviceNames: string[]
+ } // tracingFiltersLogic
+ setSort: (
+ orderBy: TracingOrderBy,
+ orderDirection: TracingOrderDirection
+ ) => {
+ orderBy: TracingOrderBy
+ orderDirection: TracingOrderDirection
+ } // tracingFiltersLogic
+ setViewMode: (viewMode: TracingViewMode) => {
+ viewMode: TracingViewMode
+ } // tracingFiltersLogic
+ updateComparisonWindows: (
+ current: OverlayWindow,
+ previous: OverlayWindow
+ ) => {
+ current: OverlayWindow
+ previous: OverlayWindow
+ } // tracingFiltersLogic
+ closeCompareFlame: () => {
+ value: true
+ } // tracingViewerLogic
+ closeTrace: () => {
+ value: true
+ } // tracingViewerLogic
+ openCompareFlame: (
+ spanName: string,
+ serviceName: string
+ ) => {
+ serviceName: string
+ spanName: string
+ } // tracingViewerLogic
+ openTrace: (
+ traceId: string,
+ options?:
+ | {
+ spanId?: string | null
+ ts?: string | null
+ }
+ | undefined
+ ) => {
+ spanId: string | null
+ traceId: string
+ ts: string | null
+ } // tracingViewerLogic
+ selectSpan: (spanId: string | null) => {
+ spanId: string | null
+ } // tracingViewerLogic
+ setActiveTracingTab: (tab: 'operations' | 'traces') => {
+ tab: 'operations' | 'traces'
+ }
+ syncUrl: () => {
+ value: true
+ }
+}
+
+export type tracingSceneLogicType = MakeLogicType<tracingSceneLogicValues, tracingSceneLogicActions>
export const tracingSceneLogic = kea<tracingSceneLogicType>([
path(['products', 'tracing', 'frontend', 'tracingSceneLogic']),
diff --git a/products/tracing/frontend/tracingServiceFilterLogic.ts b/products/tracing/frontend/tracingServiceFilterLogic.ts
index 21be186c964d..2c983239a3ba 100644
--- a/products/tracing/frontend/tracingServiceFilterLogic.ts
+++ b/products/tracing/frontend/tracingServiceFilterLogic.ts
@@ -1,4 +1,17 @@
-import { actions, afterMount, connect, kea, key, listeners, path, props, propsChanged, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ connect,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ propsChanged,
+ reducers,
+ selectors,
+} from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
@@ -6,12 +19,56 @@ import { teamLogic } from 'scenes/teamLogic'
import { DateRange } from '~/queries/schema/schema-general'
-import type { tracingServiceFilterLogicType } from './tracingServiceFilterLogicType'
-
export interface TracingServiceFilterLogicProps {
dateRange?: DateRange
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingServiceFilterLogicValues {
+ currentTeamId: number | null // teamLogic
+ allServiceNames: string[]
+ allServiceNamesLoading: boolean
+ search: string
+ serviceNames: string[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingServiceFilterLogicActions {
+ loadServiceNames: () => any
+ loadServiceNamesFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadServiceNamesSuccess: (
+ allServiceNames: string[],
+ payload?: any
+ ) => {
+ allServiceNames: string[]
+ payload?: any
+ }
+ setSearch: (search: string) => {
+ search: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingServiceFilterLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ serviceNames: (allServiceNames: string[], search: string) => string[]
+ }
+}
+
+export type tracingServiceFilterLogicType = MakeLogicType<
+ tracingServiceFilterLogicValues,
+ tracingServiceFilterLogicActions,
+ TracingServiceFilterLogicProps,
+ tracingServiceFilterLogicMeta
+>
+
export const tracingServiceFilterLogic = kea<tracingServiceFilterLogicType>([
path(['products', 'tracing', 'frontend', 'tracingServiceFilterLogic']),
props({} as TracingServiceFilterLogicProps),
diff --git a/products/tracing/frontend/tracingViewerLogic.ts b/products/tracing/frontend/tracingViewerLogic.ts
index acff01519805..60966264746b 100644
--- a/products/tracing/frontend/tracingViewerLogic.ts
+++ b/products/tracing/frontend/tracingViewerLogic.ts
@@ -1,15 +1,111 @@
-import { actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import posthog from 'posthog-js'
import { PREFETCH_SPANS, tracingDataLogic } from './tracingDataLogic'
import { TRACING_SCENE_VIEWER_ID, tracingFiltersLogic } from './tracingFiltersLogic'
-import type { tracingViewerLogicType } from './tracingViewerLogicType'
+import type { OverlayWindow } from './tracingFiltersLogic'
import type { Span } from './types'
export interface TracingViewerLogicProps {
id: string
}
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingViewerLogicValues {
+ spans: Span[] // tracingDataLogic
+ traceSpans: Span[] // tracingDataLogic
+ traceSpansHasMore: boolean // tracingDataLogic
+ traceSpansLoading: boolean // tracingDataLogic
+ traceSpansLoadingMore: boolean // tracingDataLogic
+ canLoadMoreTraceSpans: boolean
+ compareFlameServiceName: string | null
+ compareFlameSpanName: string | null
+ isLoadingFullTrace: boolean
+ isTraceOpen: boolean
+ openTraceSpans: Span[]
+ selectedSpanId: string | null
+ selectedTraceId: string | null
+ selectedTraceTs: string | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingViewerLogicActions {
+ fetchAggregation: (
+ options?:
+ | {
+ fullRange?: boolean
+ }
+ | null
+ | undefined
+ ) => {
+ fullRange?: boolean
+ } | null // tracingDataLogic
+ fetchSpanTree: (params: { serviceName: string; spanName: string }) => {
+ serviceName: string
+ spanName: string
+ } // tracingDataLogic
+ loadTraceSpans: (args_0: { traceId: string; ts?: string | null }) => {
+ traceId: string
+ ts?: string | null
+ } // tracingDataLogic
+ updateComparisonWindows: (
+ current: OverlayWindow,
+ previous: OverlayWindow
+ ) => {
+ current: OverlayWindow
+ previous: OverlayWindow
+ } // tracingFiltersLogic
+ closeCompareFlame: () => {
+ value: true
+ }
+ closeTrace: () => {
+ value: true
+ }
+ openCompareFlame: (
+ spanName: string,
+ serviceName: string
+ ) => {
+ serviceName: string
+ spanName: string
+ }
+ openTrace: (
+ traceId: string,
+ options?: {
+ spanId?: string | null
+ ts?: string | null
+ }
+ ) => {
+ spanId: string | null
+ traceId: string
+ ts: string | null
+ }
+ selectSpan: (spanId: string | null) => {
+ spanId: string | null
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface tracingViewerLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ isTraceOpen: (selectedTraceId: string | null) => boolean
+ openTraceSpans: (selectedTraceId: string | null, spans: Span[], traceSpans: Span[]) => Span[]
+ isLoadingFullTrace: (traceSpansLoading: boolean, traceSpansLoadingMore: boolean) => boolean
+ canLoadMoreTraceSpans: (
+ traceSpansHasMore: boolean,
+ traceSpans: Span[],
+ selectedTraceId: string | null
+ ) => boolean
+ }
+}
+
+export type tracingViewerLogicType = MakeLogicType<
+ tracingViewerLogicValues,
+ tracingViewerLogicActions,
+ TracingViewerLogicProps,
+ tracingViewerLogicMeta
+>
+
// Per-instance viewer UI state: the trace drawer and the compare-flame modal. URL-free by
// design — the /tracing scene logic reads and writes this instance's state to sync the URL;
// an embedded viewer just never wires it up. Mirrors the logsViewerLogic boundary.